Thread overview
[Issue 17185] Error: number '0x0.0123p-1022' is not representable
Feb 15, 2017
Sophie
Feb 15, 2017
Stefan Koch
Feb 15, 2017
Sophie
Nov 16, 2022
RazvanN
February 15, 2017
https://issues.dlang.org/show_bug.cgi?id=17185

--- Comment #1 from Sophie <meapineapple@gmail.com> ---
This occurred when compiling on ubuntu 12.04.04

--
February 15, 2017
https://issues.dlang.org/show_bug.cgi?id=17185

Stefan Koch <uplink.coder@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |uplink.coder@gmail.com

--- Comment #2 from Stefan Koch <uplink.coder@gmail.com> ---
This occurs because dmd's parser calls strtold from the c runtime to parse
floats.
apparently ubuntu 12.04 version of the runtime does mess this up.

--
February 15, 2017
https://issues.dlang.org/show_bug.cgi?id=17185

--- Comment #3 from Sophie <meapineapple@gmail.com> ---
Note that one possible solution to this bug would be to use a custom strtold
implementation rather than relying on the runtime. For reference, here is one
such function implemented in native D code:
https://github.com/pineapplemachine/mach.d/blob/master/mach/text/numeric/hexfloats.d#L147

--
November 16, 2022
https://issues.dlang.org/show_bug.cgi?id=17185

RazvanN <razvan.nitu1305@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |razvan.nitu1305@gmail.com
         Resolution|---                         |WORKSFORME

--- Comment #4 from RazvanN <razvan.nitu1305@gmail.com> ---
This code:

void main()
{
    import std.stdio : writeln;
    writeln(double(0x0.0123p-1022)); // Prints 64+64i, should print 64+0i
}


compiles just fine on my machine (Ubunutu 20.04.4).

--