Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DIO8A3MFVR6C.21H9DZAJ0H07B@posteo.net>
Date: Thu, 21 May 2026 08:56:41 +0000
From: "Sertonix" <sertonix@...teo.net>
To: <musl@...ts.openwall.com>, "Sertonix" <sertonix@...teo.net>
Subject: Re: strtod:

On Thu May 21, 2026 at 4:55 AM CEST, Rich Felker wrote:
> On Wed, May 20, 2026 at 10:22:18PM -0400, Rich Felker wrote:
>> On Thu, May 21, 2026 at 01:33:13AM +0000, Sertonix wrote:
>> > Hi,
>> > 
>> > I noticed a subtle difference in the result of strtod on alpine linux
>> > between arm/ppc64le and other arches. The following reproducer shows
>> > 1.3754889325393114e+24 on x86_64 and 1.3754889325393111e+24 on armv7.
>> > Is this maybe a musl bug or is that level of precision undefined?
>> > 
>> > #include <stdio.h>
>> > #include <stdlib.h>
>> > 
>> > int main() {
>> > 	char *end;
>> > 	double v = strtod("0x0123456789ABCDEFabcdef", &end);
>> > 	printf("%.16e\n", v);
>> > }
>> 
>> I confirmed this report. It seems to give the wrong output (rounding
>> down instead of up) on all archs with 64-bit long double (same as
>> double). I'll have to step thru the execution and see where it's going
>> wrong. I'll see if I can figure it out tomorrow if nobody beats me to
>> it.
>> 
>> BTW the issue is easier to see if you change the %.16e to %a.
>
> I think this fixes it.


Thanks! With the patch applied the binaryen test suite no longer fails
on these arches.

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.