Boost logo

Boost Users :

From: me22 (me22.ca_at_[hidden])
Date: 2005-09-12 18:35:56


On 12/09/05, Sohail Somani <s.somani_at_[hidden]> wrote:
> What about using a type that guarantees a certain amount instead of just
> "max" (which may vary)? Or equivalently, are we guaranteed that
> uintmax_t can hold, say one TB, on any platform that boost supports?
>

Even 1 TB isn't really safe. I know a number of people with more
total storage than that.

How about a double? The imprecision shouldn't be a worry -- if you're
beyond the range of a double's precision for free space then being off
by even a few MB it doesn't matter and doubles are perfectly precise
for small integral numbers. ( on x86 linux it seems my 64-bit doubles
have 53 bits of mantissa meaning they're perfectly precise for
anything less than 8192 TeraBytes. I don't know what the standard
specifes though, and my 32-bit floats are only perfectly precise for
under 16 MB. That being said, even the 32-bit float has a max of over
3e26 TB, so just saying the precision of the number returned is
dependant on the precision of your platform's double would get around
that, assuming of course we can assure that any rounding is done on
the safe side. )

Also, the implementation could work internally in whatever it wants to
keep perfect precision and just feed out a double at the end.

- Scott McMurray


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net