From 4477428868919272174 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!mutlu.news.demon.net!news.demon.co.uk!demon!stump.algebra.com!devnull From: pbristow@hetp.u-net.com ("Paul A Bristow") Newsgroups: comp.std.c++ Subject: Re: Pi, Euler Number, and perhaps other 'natural' constants? Date: Sun, 1 Aug 2004 22:02:02 GMT Organization: (Posted via) VIA Net.Works UK Ltd. Lines: 58 Sender: mail2news@demon.net Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++) Message-ID: References: <5cydnSisJNo4yJncRVn-sQ@speakeasy.net> NNTP-Posting-Host: news.news.demon.net X-Trace: news.demon.co.uk 1091397726 4872 158.152.254.254 (1 Aug 2004 22:02:06 GMT) X-Complaints-To: abuse@demon.net NNTP-Posting-Date: Sun, 1 Aug 2004 22:02:06 +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=-4.2 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 i71M22o0020865; Mon, 2 Aug 2004 08:02:02 +1000 (EST) X-Path: comp-std-cpp-robomod!not-for-mail X-NNTP-Posting-Date: Sun, 01 Aug 2004 19:00:05 BST X-Spam-Level: X-Delivered-To: std-c++@ucar.edu X-Spamscanner: mailbox5.ucsd.edu (v1.4 May 20 2004 13:55:33, 0.7/5.0 2.63) 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++ X-MailScanner: PASSED (v1.2.8 50497 i71I0DG5054558 mailbox5.ucsd.edu) Xref: g2news1.google.com comp.std.c++:1514 The need for an optmisable method of presentation was a major issue in the Boost groups attempts, but it was not possible to find a fully portable solution and we are waiting for typeof and better compilers to solve this. To ensure that the constant is stored correctly, it is necessary to provide an exactlyrepresentable decimal digit string (which is twice the number of binary bits in the significand). This overcomes the need to have fp hex values (and a language change). In my view, very many constants would be useful and aid program portability. Paul "Alberto Barbati" wrote in message news:P1JNc.15868$1V3.392640@twister2.libero.it... > John Nagle wrote: > > Daniel Pfeffer wrote: > > > > 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. > > > > Should std::pi be a constant? As my current programming platform is > ix86-based I would prefer having a function instead. That's because > there is a FPU instruction (namely FLDPI) that loads the value of pi in > an FPU register. Calling FLDPI has a few advantages over a "regular" FLD > load instruction, mostly the fact that there the value need not be read > from memory and that the value is loaded at full internal precision > (ix86 FPU registers internally have more precision than a double). > > If std::pi is defined as a constant, it may be difficult for a compiler > to generate an intrinsic call to FLDPI thus producing optimized code, > while it may be easier if std::pi() is function (at least the machinery > to replace calls to sin(), cos() etc. with intrinsics is already there). > > Just my opinion, > > Alberto > > --- > [ 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 ] > --- [ 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 ]