Re: float/double to string (pure nothrow @nogc)

2018-08-08 Thread Paul Backus via Digitalmars-d-learn

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


Re: float/double to string (pure nothrow @nogc)

2018-08-08 Thread ketmar via Digitalmars-d-learn

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.


Re: float/double to string (pure nothrow @nogc)

2018-08-08 Thread vit via Digitalmars-d-learn

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...



Re: float/double to string (pure nothrow @nogc)

2018-08-08 Thread ketmar via Digitalmars-d-learn

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


Re: float/double to string (pure nothrow @nogc)

2018-08-08 Thread Steven Schveighoffer via Digitalmars-d-learn

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


float/double to string (pure nothrow @nogc)

2018-08-08 Thread vit via Digitalmars-d-learn
Hello, is in phobos some function which convert float/double to 
string and is pure @nogc and nothrow?