Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 25 Sep 2019 17:06:32 +0200
From: Szabolcs Nagy <nsz@...t70.net>
To: musl@...ts.openwall.com
Subject: Re: Bug report: strtod drops LSB

* Anastasios <antonbachin@...oo.com> [2019-09-25 09:32:35 -0500]:
> Hello,
> 
> Consider this program, strtod.c:
> 
>     #include <stdlib.h>
>     #include <stdio.h>
> 
>     int main()
>     {
>         printf("%lf\n", strtod("283686952306183", NULL));
>     }
> 
> With current musl master from Git:
> 
>     $ musl-gcc -static strtod.c -o a.musl
>     $ ./a.musl
>     283686952306176.000000
> 
> By comparison, with glibc:
> 
>     $ gcc -static strtod.c -o a.glibc
>     $ ./a.glibc
>     283686952306183.000000
> 

works for me on both i486-linux-musl and aarch64-linux-musl.
i have no idea what can cause such bug.

can you try printf with %a and strtod(...)==0x1.020304050607p+48
to see if it's printf %lf that goes wrong?

> The correct binary representation of this float is
> 
>     0x42f0203040506070
> 
> but musl strtod produces
> 
>     0x42f0203040506000
> 
> i.e., it fails to set the LSB. I examined this while ruling out printf as the cause.

Powered by blists - more mailing lists

Your e-mail address:

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