Boost logo

Boost :

From: Matthew Austern (austern_at_[hidden])
Date: 2000-11-28 17:11:56

Paul Moore wrote:
> > On the other hand, conversion from a string doesn't strike me
> > as such a bad idea. Radix conversion is easy; it's parsing that's
> > hard. If you're looking at a decimal string, it's easy to see
> > that "0.1" is 1*10^-1.
> Hm. I guess take the point. As long as we exclude exponential notation, it's
> not too hard to do. But I still worry about edge conditions caused by
> limited precision integers...

Oops! First of all, I see that I goofed. Parsing is easy; radix
conversion is a very hard problem. I hope people paid attention
to what I meant, not what I said.

Second, I'm sure you're right that limited precision integers
could be a problem. "3.14159265358979323846264" is an exact
rational number, but you won't be able to represent it exactly
if the numerator and denominator are 32-bit integers. I
suppose I'd be inclined either to use bignums, or, for fixed-
length integers, to throw an exception in cases like this.


Boost list run by bdawes at, gregod at, cpdaniel at, john at