now it's possible! printing floating point numbers at compile-time

Stefan Koch uplink.coder at googlemail.com
Sat Dec 22 20:24:46 UTC 2018


On Saturday, 22 December 2018 at 20:08:12 UTC, Stefan Koch wrote:
> Thus enabling you to convert doubles into strings at 
> compiletime.

Aww .... I am dumb ... should have waited 2 days :)
Anyhow I hope that this is helpful to some of you.

Please note that grisu 2 will give you representation which will 
convert into the same(!) floatingpoint number you passed in >92% 
of all possible inputs.

Meaning you can round trip from string to double without loss of 
bits, for very many number but not all of them, that said the 
accuracy in general should be better than what a usual sprintf 
would give you.


Cheers and Merry Christmas,

Stefan



More information about the Digitalmars-d-announce mailing list