Is there a standard C way to print floating-point values "perfectly" a la Dragon4? -


reading here dragons: advances in problems didn’t know had i've noticed compare new algorithm 1 used in glibc's printf:

grisu3 5 times faster algorithm used printf in gnu libc

but @ same time i've failed find format specifier printf automatically find best number of decimal places print. tried either have strange defaults 6 digits after decimal point %f or 2 after point %g or 6 after point %e.

how make use of algorithm implementation in glibc, mentioned in article? there such implementation in glibc , discussed in way standard?

this actual article. blog post referring results in section 7 (in other words, “they” not comparing in blog post, “they” regurgitating information actual article, omitting crucial details):

table of results information

implementations of dragon4 or grisu3 can found in implementations of modern programming languages specify “minimal number of decimal digits” fashion (i recommend avoid calling “perfect”). java uses type of conversion decimal in contexts, ruby. c not 1 of languages specify “minimal number of decimal digits” conversion decimal, there no reason compiler or libc provide implementation dragon4 or grisu3.


Comments