This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libfortran/48906] Wrong rounding results with -m32
- From: "thenlich at users dot sourceforge.net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 6 Jun 2011 12:42:24 +0000
- Subject: [Bug libfortran/48906] Wrong rounding results with -m32
- Auto-submitted: auto-generated
- References: <bug-48906-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48906
--- Comment #28 from Thomas Henlich <thenlich at users dot sourceforge.net> 2011-06-06 12:41:55 UTC ---
I had a look at the code and what I think we should do is the following:
If G editing and a scale factor p != 0 is in effect, split the rounding step
into 2 steps:
First, check if overflow occurs (.9999.. => 1.0000...) but do not actually
overwrite the digits yet.
With this information, we determine the final value of e.
If it turns out we need F editing: Repeat the rounding as above (or remember if
overflow occured the first time), and this time actually overwrite the digits.
If it turns out we need E editing: Set the new value for the number of digits
according to p and repeat the rounding.
It may help to refactor some of the code into a separate function, since we
need to call it twice.