Boost logo

Boost :

From: rwgk_at_[hidden]
Date: 2001-07-13 19:27:59


--- In boost_at_y..., "David Abrahams" <david.abrahams_at_r...> wrote:
> I don't think it's a big deal, but doubles have a maximum exponent.
Suppose
> DOUBLE_MAX is 2^256. Well, it's easy to imagine a python LONG with
more than
> 256 bits. What happens then?

It depends on the platform:

% python
Python 1.5.2 (#1, Nov 9 2000, 16:21:10) [C] on osf1V5
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> i=2l**256
>>> float(i)
1.15792089237e+77
>>> i=2l**10000
>>> float(i)
Floating exception
%

% python
Python 1.5.2 (#1, Sep 17 1999, 20:15:36) [GCC egcs-2.91.66
19990314/Linux (egcs- on linux-i386
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> i=2l**256
>>> float(i)
1.15792089237e+77
>>> i=2l**10000
>>> float(i)
inf
>>>

How overflows are treated is always difficult to tell. To my
knowledge there is no portable method for handling overflows
or similar exceptions.
IMHO, the patch is useful and will no introduce new behavior.

Ralf


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk