digitalmars.D.learn - Pure double to string conversion
- Per =?UTF-8?B?Tm9yZGzDtnc=?= (15/15) May 01 2018 Is there a way to convert a `double` to a `string` in a `pure`
Is there a way to convert a `double` to a `string` in a `pure`
function?
I tried
safe pure unittest
{
import std.conv : to;
const y = 3.14.to!string;
}
but it fails to compile as
`pure` function `foo.__unittest_L1_C12` cannot call impure
function `std.conv.to!string.to!double.to`
Have anybody wrapped the corresponding C solution via, snprintf
or gcvt in a high-level D wrapper?
Is assume `gcvt` is GNU only but that's ok with me. I assume
`gcvt` is faster than `snprintf` in this case.
May 01 2018








Per =?UTF-8?B?Tm9yZGzDtnc=?= <per.nordlow gmail.com>