gcc 11.1.0: printf("%.43f\n", 0x1.52f8a8e32e982p-140): printed value is incorrectly rounded

Takashi Yano takashi.yano@nifty.ne.jp
Wed Dec 1 12:05:55 GMT 2021

On Tue, 30 Nov 2021 16:09:26 +0100
Corinna Vinschen wrote:
> Could some people with other targets than Cygwin give this patch a try?
> RTEMS, anybody?

I have confirmed new gdtoa code works with a simple printf test
for the following two platforms.

- aarch64 (128bit long double with little endian)
- armv7l (64bit long double with little endian)

Actually, LDBL_MANT_DIG == DBL_MANT_DIG in armv7l platform, so
gdtoa code would not be used. To make gdtoa code be used forcibly,
a simple patch was applied for vfprintf.c and gdtoa-ldtoa.c.
Without this patch, _dtoa_r is used even for long double, which
also works as expected.

Takashi Yano <takashi.yano@nifty.ne.jp>

More information about the Newlib mailing list