From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/14726 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: "Anastasios" Newsgroups: gmane.linux.lib.musl.general Subject: Bug report: strtod drops LSB Date: Wed, 25 Sep 2019 09:32:35 -0500 Message-ID: Reply-To: musl@lists.openwall.com Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_64160113.171087697809" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="246461"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mailbird/2.6.1.0 To: "" Original-X-From: musl-return-14742-gllmg-musl=m.gmane.org@lists.openwall.com Wed Sep 25 16:39:11 2019 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.89) (envelope-from ) id 1iD8Rj-00120P-Cp for gllmg-musl@m.gmane.org; Wed, 25 Sep 2019 16:39:11 +0200 Original-Received: (qmail 30041 invoked by uid 550); 25 Sep 2019 14:39:09 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 28246 invoked from network); 25 Sep 2019 14:32:51 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1569421959; bh=NG/j0HuDws4foClE+XiXto+M7Om9yFjgvx8gavcJwg8=; h=Date:Subject:From:To:From:Subject; b=MWf5/KSow0EvGlZloGQkEDlLAXDW42Ge4pCyWbv2VWwRjpCo3oshv0fz6pp8UPxlKm4wiq/0tiva5BKzM244I71V40EDxpIiADAWDeCsONoacFbhAzh4R+e8tAaSdIY8x7oDYCROQNt7rBSZfwL36jZ71su71bG3h8IocF41Rmr8dFZt6tsm9KKCz8dAhz4YfsmAcpH3BM/67VqN4YpomHCpA45i8elQyenkGhvEzx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.general:14726 Archived-At: ------=_NextPart_64160113.171087697809 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Hello, Consider this program, strtod.c: =C2=A0 =C2=A0=C2=A0#include =C2=A0 =C2=A0=C2=A0#include =C2=A0 =C2=A0=C2=A0int main() =C2=A0 =C2=A0=C2=A0{ =C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0printf("%lf\n", strtod("2836869523061= 83", NULL)); =C2=A0 =C2=A0=C2=A0} With current musl master from Git: =C2=A0 =C2=A0=C2=A0$ musl-gcc -static strtod.c -o a.musl =C2=A0 =C2=A0 $ ./a.musl =C2=A0 =C2=A0 283686952306176.000000 By comparison, with glibc: =C2=A0 =C2=A0 $ gcc -static strtod.c -o a.glibc =C2=A0 =C2=A0 $ ./a.glibc =C2=A0 =C2=A0 283686952306183.000000 The correct binary representation of this float is =C2=A0 =C2=A0 0x42f0203040506070 but musl strtod produces =C2=A0 =C2=A0 0x42f0203040506000 i.e., it fails to set the LSB. I examined this while ruling out printf as t= he cause. ------=_NextPart_64160113.171087697809 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable
Hello,

Consider = this program, strtod.c:

=     #include <stdl= ib.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
  &nb= sp; $ ./a.glibc
    283686952306183.000000

The correct = binary representation of this float is

    0x42f0203040506= 070

but musl strtod produces

    0x42f0203040506000=

i.e., it fails to set the LSB. I examined this while ruling out pri= ntf as the cause.
------=_NextPart_64160113.171087697809--