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

Jerry DeLisle <jvdelisle at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID

--- Comment #6 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> 2011-04-18 
02:48:03 UTC ---
OK,

After reading the manual.

#include <stdio.h>

int
main ()
{
  float num1 = 0.90;
  double num2 = 0.90l;
  long double num3 = 0.90L;
  printf("%+-#48.*e\n", 46, num1);
  printf("%+-#48.*le\n", 46, num2);
  printf("%+-#48.*Le\n", 46, num3);
}

Gives:

$ ./a.out 
+8.9999997615814208984375000000000000000000000000e-01
+9.0000000000000002220446049250313080847263336182e-01
+8.9999999999999999997831595655028991131985094398e-01

This is rounding to nearest which for double, just happens to be slightly above
.9 rather than slightly below.  I conclude this is correct and not a bug in
either libgfortran or libc.

Its an artifact of inexact biray representation of a decimal number.  Closing
this PR as invalid.

Reply via email to