|
|
Message-ID: <20260521185152.GG3520958@port70.net>
Date: Thu, 21 May 2026 20:51:52 +0200
From: Szabolcs Nagy <nsz@...t70.net>
To: Rich Felker <dalias@...c.org>
Cc: musl@...ts.openwall.com
Subject: Re: [PATCH] libc-test: add tests for strtod hex float
rounding bug
* Rich Felker <dalias@...c.org> [2026-05-21 13:33:45 -0400]:
> diff --git a/src/functional/strtold.c b/src/functional/strtold.c
> index 6ea1672..7c6e59c 100644
> --- a/src/functional/strtold.c
> +++ b/src/functional/strtold.c
> @@ -59,6 +59,9 @@ static struct {
> {"0.2346324356502437045212230713960457676531e6", 234632.43565024371}, // 0x1.ca4437c3631eap+17
> {"0.9709481716420048341897258980454298205278e8", 97094817.164200485}, // 0x1.7263284a8242cp+26
> {"0.4996908522051874110779982354932499499602e9", 499690852.20518744}, // 0x1.dc8ad6434872ap+28
> + // rounding at end of mantissa
> + {"0x1.111111111111281", 0x1.1111111111113p0},
> + {"0x1.11111111111111", 0x1.1111111111111p0},
> #elif LDBL_MANT_DIG == 64
> // 2^-16445 * 0.5 - eps
> {".1822599765941237301264202966809709908199525407846781671860490243514185844316698e-4950", 0},
> @@ -76,6 +79,13 @@ static struct {
> {"118973149535723176505351158982948.86679662540046955672e4900", 0x1.fffffffffffffffep16383L},
> // 2^16384 - 2^16319 + eps
> {"118973149535723176505351158982948.86679662540046955673e4900", INFINITY},
> + // rounding at end of mantissa
> + {"0x8.11111111111111281", 0x8.111111111111113p0},
> + {"0x8.1111111111111111", 0x8.111111111111111p0},
> +#elif LDBL_MANT_DIG == 113
> + // rounding at end of mantissa
> + {"0x1.111111111111111111111111111281", 0x1.1111111111111111111111111113p0},
> + {"0x1.11111111111111111111111111111", 0x1.1111111111111111111111111111p0},
the const literals require the 'L' suffix for the correct type.
fixed now.
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.