mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Szabolcs Nagy <nsz@port70.net>
To: musl@lists.openwall.com
Subject: Re: Bug report: strtod drops LSB
Date: Wed, 25 Sep 2019 17:06:32 +0200	[thread overview]
Message-ID: <20190925150632.GL22009@port70.net> (raw)
In-Reply-To: <ca099df7-a6a2-4c08-9a80-0502a16d1d25@getmailbird.com>

* Anastasios <antonbachin@yahoo.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.


  reply	other threads:[~2019-09-25 15:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-25 14:32 Anastasios
2019-09-25 15:06 ` Szabolcs Nagy [this message]
2019-09-25 15:51 ` Rich Felker
2019-09-25 17:56   ` Anastasios
2019-09-25 18:11     ` Anastasios

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190925150632.GL22009@port70.net \
    --to=nsz@port70.net \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).