This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch, Fortran] Rework of floating point number reading
- From: Paolo Bonzini <bonzini at gnu dot org>
- To: Daniel Kraft <d at domob dot eu>
- Cc: Geert Bosch <bosch at adacore dot com>, Fortran List <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>, Jerry DeLisle <jvdelisle at verizon dot net>
- Date: Tue, 30 Dec 2008 16:23:34 +0100
- Subject: Re: [Patch, Fortran] Rework of floating point number reading
- References: <49591B2C.8070505@domob.eu> <E57FD02D-CBEE-423C-B884-85458FCA265B@adacore.com> <4959DDE7.6070103@domob.eu>
> 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