www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20536] New: std.format: %a on real gives wrong result


          Issue ID: 20536
           Summary: std.format: %a on real gives wrong result
           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

On my computer the format command below produces "0x8p-23" which is inconsitent
with the results from float/double, where the first digit after "0x" is always
a 1 (leaving aside corner cases). The test below should work independent of the
type of real used.

void main()
    import std.format : format;

    real r = .00000095367431640625L;

    assert(format("%a", r) == "0x1p-20"); // fails

Jan 26 2020