I'm trying to print Float64 with all significant digits, so that
re-inputting these numbers from output strings will result in exactly
the same number (is this called a round-trip?)
I understand that Julia uses a grisu algorithm to do this automatically for
values displayed at REPL and with println().
I'm using @printf to output, so I tried "%20.17g" as a format specifier
and this seems to work.
But then I compared this to println() and some numbers vary in the last
digit (e.g @printf displays 389557.48616130429, whereas println() displays
389557.4861613043)
So it seems @printf(".17g") sometimes displays an extra unnecessary digit?
Is there another printf format specifer that I can use?
Alternatively, I'm using the following to first convert Float to string,
and then pass string to @printf:
iobuffer = IOBuffer()
print(iobuffer, x)
str_hits = takebuf_string(iobuffer)
@printf("%20s", x)
but this seems a bit messy.