www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20396] New: format!"%a" leeds to wrong result for

https://issues.dlang.org/show_bug.cgi?id=20396

          Issue ID: 20396
           Summary: format!"%a" leeds to wrong result for denormalized
                    float
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: bugzilla d-ecke.de

void main()
{
    import std.stdio;
    import std.math;

    writefln!"%a"(nextUp(0.0f));
    writefln!"%a"(nextUp(0.0));
}

Leeds on my computer to

0x1p-149
0x0.0000000000001p-1022

The first one should be 0x0.000002p-126. The second one shows, that doubles
work correctly (and reals work on my computer too).

This bug is located inside C's snprintf.

--
Nov 15 2019