http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48615

--- Comment #8 from Thomas Henlich <thenlich at users dot sourceforge.net> 
2011-04-24 21:41:16 UTC ---
I don't have access to a build system until Tuesday, so I couldn't test your
patch. But I'm not sure I understand what you are trying to do.

I see that you added one more digit in the output. I am not convinced that
adding one digit will solve the problem of rounding. It will for my first test
case, because it works for the values 1.1 and 1.9. But will it work for values
like 1.00001 or 1.99999? With your patch, they will be rounded to 1.0 (or 2.0)
by printf so libfortran has no way of knowing that it should round up (or
down).

And we recently set the maximum output width to the minimum value required by
IEEE 754-2008. Increasing that further (as your patch does) will only serve in
reducing the maximum rounding error from 1/1000 to 1/10000 (but does not
contribute to fixing this bug)

Can you confirm that the patch fixes all the testcases in attachment 24083?

I still think my comment #2 still applies: We can only use this "shortcut"
rounding if the requested rounding mode equals that of printf, which I found to
be NEAREST with __mingw_printf and COMPATIBLE with MSVC printf. Others, e.g.
glibc probably have one of these modes, but I couldn't yet find out if this
feature is documented at all.

Reply via email to