This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/14049] New: Incorrect strtod, atof etc. hex float rounding


http://sourceware.org/bugzilla/show_bug.cgi?id=14049

             Bug #: 14049
           Summary: Incorrect strtod, atof etc. hex float rounding
           Product: glibc
           Version: 2.15
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: unassigned@sourceware.org
        ReportedBy: jsm28@gcc.gnu.org
                CC: drepper.fsp@gmail.com
    Classification: Unclassified


strtod, atof and related functions always treat hex floats half way between two
representable values as rounding away from zero, instead of round-to-even. 
Testcase:

#include <stdlib.h>
#include <stdio.h>

int
main (void)
{
  printf ("%.16A %.16A\n", 0x10000000000000800p0, atof
("0x10000000000000800p0"));
  return 0;
}

Prints:

0X1.0000000000000000P+64 0X1.0000000000001000P+64

This is different from bug 3479, which concerns strtod rounding for decimal
numbers.

I'm testing a patch.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]