Thread overview | ||||||||
---|---|---|---|---|---|---|---|---|
|
August 08, 2018 float/double to string (pure nothrow @nogc) | ||||
---|---|---|---|---|
| ||||
Hello, is in phobos some function which convert float/double to string and is pure @nogc and nothrow? |
August 08, 2018 Re: float/double to string (pure nothrow @nogc) | ||||
---|---|---|---|---|
| ||||
Posted in reply to vit | On 8/8/18 1:08 PM, vit wrote:
> Hello, is in phobos some function which convert float/double to string and is pure @nogc and nothrow?
>
>
Not one that I can see. formattedWrite doesn't seem to be pure.
-Steve
|
August 08, 2018 Re: float/double to string (pure nothrow @nogc) | ||||
---|---|---|---|---|
| ||||
Posted in reply to vit | vit wrote: > Hello, is in phobos some function which convert float/double to string and is pure @nogc and nothrow? i don't think that you can make it `pure`, but you certainly can make it `nothrow`, `@nogc` and ctfe-able. it's dangerous to go alone! take this[0]. [0] http://repo.or.cz/iv.d.git/blob_plain/HEAD:/ctfefloat.d |
August 08, 2018 Re: float/double to string (pure nothrow @nogc) | ||||
---|---|---|---|---|
| ||||
Posted in reply to ketmar | On Wednesday, 8 August 2018 at 17:40:11 UTC, ketmar wrote:
> vit wrote:
>
>> Hello, is in phobos some function which convert float/double to string and is pure @nogc and nothrow?
>
> i don't think that you can make it `pure`, but you certainly can make it `nothrow`, `@nogc` and ctfe-able. it's dangerous to go alone! take this[0].
>
>
> [0] http://repo.or.cz/iv.d.git/blob_plain/HEAD:/ctfefloat.d
thanks, that code can be modified to pure nothrow @nogc @safe.
Is that lib ok? Is little complicated...
|
August 08, 2018 Re: float/double to string (pure nothrow @nogc) | ||||
---|---|---|---|---|
| ||||
Posted in reply to vit | On Wednesday, 8 August 2018 at 17:08:57 UTC, vit wrote: > Hello, is in phobos some function which convert float/double to string and is pure @nogc and nothrow? Short answer: no. Long answer: https://issues.dlang.org/show_bug.cgi?id=17628 |
August 08, 2018 Re: float/double to string (pure nothrow @nogc) | ||||
---|---|---|---|---|
| ||||
Posted in reply to vit | vit wrote:
> thanks, that code can be modified to pure nothrow @nogc @safe.
> Is that lib ok? Is little complicated...
converting float to string is a *very* complicated task. that lib is quite small for what it is doing ('cause it hacks around some... interesting cases). the *real* thing will be a LOT bigger.
|
Copyright © 1999-2021 by the D Language Foundation