May 01, 2018 Pure double to string conversion | ||||
---|---|---|---|---|
| ||||
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. |
Copyright © 1999-2021 by the D Language Foundation