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

Corinna Vinschen vinschen@redhat.com
Thu Nov 4 20:57:56 GMT 2021

[Please don't CC me on list replies.  I set "Reply-To:" for a reason.

On Nov  4 09:48, Keith Packard wrote:
> Corinna Vinschen <vinschen@redhat.com> writes:
> > Is anybody here willing to take a look and change Newlib to gdtoa?
> It might be useful for newlib to adopt the Ryū floating point conversion
> code developed by Ulf Adams (currently at Google). This does correct
> double conversion in 128 bits, avoiding need for arbitrary precision
> math and any allocations.
>         https://dl.acm.org/doi/10.1145/3360595
> There is a BSD licensed implementation of the core algorithm available
> on github; adopting that into complete printf/scanf implementations
> isn't a huge amount of work. picolibc uses this implementation.

Sounds like a great idea, too.  This may drop code size as well, which
is always good.


More information about the Newlib mailing list