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

Cool, CTFE formating is something that occasionaly comes in the forum. Now i remember there's also RYU [1] that could have worked too


Aww .... I am dumb ... should have waited 2 days :)


No because actually from a pagan point of view the big thing was yesterday night (solstice).

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

[1] https://github.com/ulfjack/ryu

Reply via email to