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

Keith Packard <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
Corinna Vinschen <[email protected]> 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.

-- 
-keith
signature.asc (application/pgp-signature, 832 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEw4O3eCVWE9/bQJ2R2yIaaQAAABEFAmGEDucACgkQ2yIaaQAA
ABF+Jg//V4zi2udVahk5QGZZWCEWmQHcMqIW1E/c8HIXyCN9EJDETSGZV+J3ztpf
ZTjXTGWsM8B6wCNiiiXyjs+eHbkr2hEx+w2J7TLSj1wlnLYtwWhvaBDf0aIf1mcM
aQ74kFLu36V83ruTStCm/4Ud6PwcpH0YbXf4wGB5H48aXf01EwpJ0S3mRWpZYw30
xoj66pccSPFJ5hJL9KK8l3IcQky0k63Wf7hx10ua3u/L8G9lHujjQz+VJNudZOs0
IZbxtbhZltxfMQ4Hfo5/4ChYdPmVXAaPDjhX6gTAaySvZPU0UwoQ/c15yXq9mYrY
8fr291Ty3dzsEJBV9890R8xTf08CX+1vTWbDNnbcvBtwQDmrdCrmNpZ7bmQN4iHv
b8vjxeoUIejWkAgtw403FA7XFU6az239pwYU9/W4SgZUvvsS38yO7wYwT8RTAxau
URYo0oKoNgB/tk9/VAwufGmCWRI9EnkP52NeBuuPongGKzd/GDYaexDRdmJh5skf
iSwdzEhjG+Dux+r42RYjIaAc4+3ZQljTDvLC3XpL30c34KwrK2lpIGqFi4ZTqX1g
tbTotT24a/wqDOd/0/aJfEwxiC2tLR0Szm6et+1YG5OU89jEVE/fEHBhXg1bdF9S
yxjkGWdRMCwPX9LSdfJGXTWEmunrJyS8a+HyRuuZ1CPKUckjNeg=
=knA4
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.