[Patch, Fortran] Rework of floating point number reading

Paolo Bonzini bonzini@gnu.org
Tue Dec 30 15:47:00 GMT 2008


> 1.) Check other compilers and decide the rounding error is not that much
> of a problem.

The rounding error is always a problem, unfortunately.  Suppose you
write a *printing* function in Fortran, and this function has a constant
in it; my experience is that a 1-ulp rounding error in parsing the
constant will almost invariably cause you to print 10^n as 10^(n+1) or
10^(n-1) for some n, or other embarrassing bugs.

> 2.) Allow the user to choose, maybe something like -ffast-math for IO
> (don't know what to think about this).

A possibility.

> 3.) Keep using strtod; I'm quite sure we can speed up the existing code
> still significantly by optimizing how the string passed to strtod is
> constructed.

Yes, by not using sprintf for example.  It might even be better than
pow, which is all but fast.

Paolo



More information about the Gcc-patches mailing list