Re: now it's possible! printing floating point numbers at compile-time
ketmar
ketmar at ketmar.no-ip.org
Fri Dec 28 19:03:02 UTC 2018
Stefan Koch wrote:
> Hi Guys,
>
> during my research on floating point numbers I came across a short and
> efficient implementation[0] of the grisu2 algorithm for converting
> floating point numbers into strings.
>
> Which I then ported into CTFEable D code.
> Thus enabling you to convert doubles into strings at compiletime.
>
> Cheers
>
> Stefan Koch
>
> P.S. You can find it at my fork of fpconv[1].
>
>
> [0] https://github.com/night-shift/fpconv
> [1] https://github.com/UplinkCoder/fpconv/blob/master/src/fpconv_ctfe.d
of course, it is not all that fancy, but i ported STB converter quite a
long time ago, and it is ctfe-able too. ;-)
[0] https://repo.or.cz/iv.d.git/blob_plain/HEAD:/ctfefloat.d
More information about the Digitalmars-d-announce
mailing list