Replacement for snprintf
Stefan Koch
uplink.coder at googlemail.com
Thu Oct 31 21:04:49 UTC 2019
On Thursday, 31 October 2019 at 20:20:24 UTC, Walter Bright wrote:
> On 10/31/2019 1:27 AM, drug wrote:
>> In some cases it is much more productive to have text
>> representation of data than binary ones. Initially I believed
>> too that binary representation is the more suitable but
>> afterwards I was forced to use text format and that gives me
>> a good result.
>
> To get round-trip 100% accuracy, print the floats in hex using
> the %A format.
DtoA is also supposed to have 100% accuracy, when it comes to
value, not necessarily to binary representation though.
I'd still prefer grisu2 over ryu, since it easier to understand
and I already have a ctfeable version of it. (it can't be safe
though since it casts double* to ulong*)
More information about the Digitalmars-d
mailing list