From -923242171054667781
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!news.cs.univ-paris8.fr!news.zanker.org!news.clara.net!wagner.news.clara.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: pfefferd@hotmail.co.il.nospam ("Daniel Pfeffer")
Newsgroups: comp.std.c++
Subject: Re: Pi, Euler Number, and perhaps other 'natural' constants?
Date: Thu, 29 Jul 2004 04:48:35 GMT
Organization: INTERNET-ZAHAV
Lines: 54
Sender: mail2news@demon.net
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <ce86oh$biu$1@news.inter.net.il>
References: <5cydnSisJNo4yJncRVn-sQ@speakeasy.net> <ce5ais$f50$1@news.inter.net.il> <mrvNc.3129$AY5.1919@newssvr21.news.prodigy.com>
NNTP-Posting-Host: news.news.demon.net
X-Trace: news.demon.co.uk 1091076521 25908 158.152.254.254 (29 Jul 2004 04:48:41 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Thu, 29 Jul 2004 04:48:41 +0000 (UTC)
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
X-Priority: 3
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.4 required=5.2 tests=AWL,BAYES_00,PRIORITY_NO_NAME 
	autolearn=no version=2.60-mulga_r1
X-MSMail-Priority: Normal
X-Received: (from fjh@localhost)
	by mulga.cs.mu.OZ.AU (8.12.10+Sun/8.12.9/Submit) id i6T4mZQx028929;
	Thu, 29 Jul 2004 14:48:35 +1000 (EST)
X-Path: comp-std-cpp-robomod!not-for-mail
X-NNTP-Posting-Date: Wed, 28 Jul 2004 12:38:41 +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-Newsreader: Microsoft Outlook Express 6.00.2800.1437
X-Newsgroups: comp.std.c++
Xref: g2news1.google.com comp.std.c++:1480

"John Nagle" <nagle@animats.com> wrote in message
news:mrvNc.3129$AY5.1919@newssvr21.news.prodigy.com...
> Daniel Pfeffer wrote:
> > "Steven T. Hatton" <hattons@globalsymmetry.com> wrote in message
> > news:5cydnSisJNo4yJncRVn-sQ@speakeasy.net...
>
> > For serious numerical work, the required machine representation
> > of PI must be determined for each floating-point
> > implementation.
>
>     That's a bit much.  It's not like the value of "pi" is a
> matter of either opinion or measurement.

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.


>     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.


>     I'd provide "pi" and "e", but stop there.  For one thing,
> the trig functions themselves need those constants, so
> they're already in the library somewhere.

Agreed.


Daniel Pfeffer


---
[ 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                       ]



