
Boost : 
From: Paul A Bristow (pbristow_at_[hidden])
Date: 20050518 09:00:30
 Original Message
 From: boostbounces_at_[hidden]
 [mailto:boostbounces_at_[hidden]] On Behalf Of Paul A Bristow
 Sent: 17 May 2005 15:23
 To: boost_at_[hidden]
 Subject: RE: [boost] Re: Math constants
I attach a short file with some samples of math constants together with
their 'interval' upper and lower values, which (mostly) when compiled will
be only a single least significant bit different (or the same of course).
The upper and lower values contain a lot of decimal digits because they are
'exactly representable' for the floating point layout given.
C++ Exactly representable values do not involve any rounding on input (to
the appropriate floating point format).
Of course this file does not compile  many duplicates  but when the
appropriate pair of upper and lower are chosen, they should do.
For the most common case of an IEEE double,
// C++ Exactly representable interval values of pi for 2 radix & 53
significand bits.
static const double pi_l =
3.141592653589793115997963468544185161590576171875; // lower
static const double pi =
3.1415926535897932384626433832795028841971694007530293; // starting with
this value.
static const double pi_u =
3.141592653589793560087173318606801331043243408203125; // upper
When used to initialise a double,
v_d_l = 3.1415926535897931 == 0x400921fb54442d18 // lower
v_d = 3.1415926535897931 == 0x400921fb54442d18 // 'middle' == lower
v_d_u = 3.1415926535897936 == 0x400921fb54442d19 // upper
The number of possibly significant digits is given by
std::numeric_limits<double::digits() * 3010 /10000 and is 17
(std::numeric_limits<double::digits10() in contrast is the number of
__guaranteed__ accurate decimal digits and is 15).
Questions:
1 Are there many (any?) potential users for interval arithmetic computing
(we have a Boost library).
2 Would they find the intervals of the constants updated in the Sandbox
useful?
3 Can any MACRO whizzkids suggest the _best_ way to provide only pairs (or
trios) for the appropriate floating point format?
4 I can only calculate for radix == 2 (and can't be bothered to work out
for radix 8, 10, 16, 42...?). If anyone wants these and can tell me how,
please do so.
5 So one is really only chosing float, double, long double, or some UDT
like NTL arbitrary precision quads on the basis of the number of significand
bits, usually 24, 53, 64, 105, 106, 113, 127.
For example, to produce the above definitions for 53 significand IEEE 754
X86 double.
Thanks.
Paul
Paul A Bristow
Prizet Farmhouse, Kendal, Cumbria UK LA8 8AB
+44 1539 561830 +44 7714 330204
mailto: pbristow_at_[hidden]
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk