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

Dave Nadler drn@nadler.com
Thu Nov 4 17:27:15 GMT 2021

Keith, this Ryū implementation also removes use of malloc in FP 
conversion right?
That would solve lots of problems in the embedded world.
Best Regards, Dave

On 11/4/2021 12:48 PM, 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.
> A friend of mine posited that this could be done, and got started on it
> in grad school about 20 years ago. It was very nice to see someone
> actually take the time to make it happen.

Dave Nadler, USA East Coast voice (978) 263-0097,drn@nadler.com, Skype

More information about the Newlib mailing list