From -2280020165790101792
X-Google-Thread: f78e5,4ba9dcb1ae436e16
X-Google-Attributes: gidf78e5,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: g2news1.google.com!news2.google.com!proxad.net!proxad.net!194.159.246.34.MISMATCH!peer-uk.news.demon.net!kibo.news.demon.net!news.demon.co.uk!demon!stump.algebra.com!devnull
From: kuyper@wizard.net (James Kuyper)
Newsgroups: comp.std.c++
Subject: Re: Pi, Euler Number, and perhaps other 'natural' constants?
Date: Sun,  1 Aug 2004 11:11:20 GMT
Organization: http://groups.google.com
Lines: 39
Sender: mail2news@demon.net
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <8b42afac.0408010210.7d10bd55@posting.google.com>
References: <5cydnSisJNo4yJncRVn-sQ@speakeasy.net> <ce5ais$f50$1@news.inter.net.il> <mrvNc.3129$AY5.1919@newssvr21.news.prodigy.com> <ce86oh$biu$1@news.inter.net.il>
NNTP-Posting-Host: news.news.demon.net
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: news.demon.co.uk 1091358691 24163 158.152.254.254 (1 Aug 2004 11:11:31 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Sun, 1 Aug 2004 11:11:31 +0000 (UTC)
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-Spam-Checker-Version: SpamAssassin 2.60-mulga_r1 (1.212-2003-09-23-exp) on 
	mulga.cs.mu.OZ.AU
X-Spam-Status: No, hits=-3.8 required=5.2 tests=AWL,BAYES_00 autolearn=ham 
	version=2.60-mulga_r1
X-Received: (from fjh@localhost)
	by mulga.cs.mu.OZ.AU (8.12.10+Sun/8.12.9/Submit) id i71BBKT3024631;
	Sun, 1 Aug 2004 21:11:20 +1000 (EST)
X-Path: comp-std-cpp-robomod!not-for-mail
X-NNTP-Posting-Date: Sun, 1 Aug 2004 10:10:09 +0000 (UTC)
X-Spam-Level: 
X-Delivered-To: std-c++@ucar.edu
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
X-Newsgroups: comp.std.c++
Xref: g2news1.google.com comp.std.c++:1511

pfefferd@hotmail.co.il.nospam ("Daniel Pfeffer") wrote in message news:<ce86oh$biu$1@news.inter.net.il>...
..
> The _mathematical_ value of pi is known to a very high accuracy. The
> _machine_ representation of PI depends on the size of the mantissa, the
> rounding mode, etc. Even in a single environment, the value of PI can change
> because of a difference in the rounding mode of the environment (e.g. round
> towards negative infinity will always give a result that differs from round
> round towards positive infinity).
>
> These rounding mode differences are not unimportant. For example, correct
> interval arithmetic relies on the presence of both of the above rounding
> modes.
>
> I am aware that the FP rounding mode is defined in std::numeric_limits<>,
> and that it is currently constant for each FP type. However, if the C99
> <fenv.h> mechanisms are incorporated into C++0x, this will have to change.

If C99's hexadecimal constants  are also incorporated, it will be
possible to define PI in a way that doesn't get rounded, at least for
machines where FLT_RADIX is a power of 2.

>>    We should have "std::pi" as a double, accurate to the last bit
>> of a double, even if it has to be calculated offline and
>> stored as a hex float.  This is worth doing, because it's
>> a huge pain to do that and it only needs to be done once.
>
>
>
> See above. The actual value may change (by 1 ulp), depending on the
> environment's current rounding mode.

Not if stored as a hex float, at least if FLT_RADIX is a power of 2.

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]



