Thread overview
[Issue 23521] Bad conversion in double.to!long for values around long.max
Dec 05, 2022
Nick Treleaven
Dec 17, 2022
Iain Buclaw
December 05, 2022
https://issues.dlang.org/show_bug.cgi?id=23521

Nick Treleaven <nick@geany.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nick@geany.org

--- Comment #1 from Nick Treleaven <nick@geany.org> ---
to!long(double) calls toImpl which just does cast(long). The problem seems to
be that casting a value bigger than 9223372036854775295 to long gives a
negative result:

    long l = 9223372036854775296;
    assert(l < long.max);
    double d = cast(double)l;
    assert(cast(long)d > 0); // fails

However C with gcc does the same:

    double d = 9223372036854775296L;
    assert((long)d > 0); // fails

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=23521

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P3

--
December 01
https://issues.dlang.org/show_bug.cgi?id=23521

--- Comment #2 from dlangBugzillaToGithub <robert.schadek@posteo.de> ---
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/phobos/issues/10509

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB

--