[Bug math/30220] New: String to double returns incorrectly rounded value for hexadecimal subnormal

michaelrj at google dot com sourceware-bugzilla@sourceware.org
Fri Mar 10 22:50:37 GMT 2023


https://sourceware.org/bugzilla/show_bug.cgi?id=30220

            Bug ID: 30220
           Summary: String to double returns incorrectly rounded value for
                    hexadecimal subnormal
           Product: glibc
           Version: unspecified
            Status: UNCONFIRMED
          Severity: minor
          Priority: P2
         Component: math
          Assignee: unassigned at sourceware dot org
          Reporter: michaelrj at google dot com
  Target Milestone: ---

When evaluating the string "0x30000002222225p-1077" with atof or strtod in the
NEAREST rounding mode, the returned value is 0x0.6000000444444p-1022 when it
should be 0x0.6000000444445p-1022.

The easiest way to demonstrate this is by running the following line of code:
printf("%a\n%a\n", 0x30000002222225p-1077, atof("0x30000002222225p-1077"));

I discovered this bug with version 2.36, but it also occurs with a fresh
checkout (latest commit at time of writing is
e78c4c49831d0ca6253ff5ce5b956cdc4189c8a9).

When building glibc I used configure with the option
"--prefix=$HOME/glibc-install/", my triple is x86_64-linux-gnu
(host/build/target are the same), and I'm using gcc version 12.2.0.

I hope this is enough information to replicate my issue, thank you in advance.
--Michael

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Glibc-bugs mailing list