www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18047] New: std.format value.length modulo seperator step

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

          Issue ID: 18047
           Summary: std.format value.length modulo seperator step width
                    leads to wrong length
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: rburners gmail.com

 safe unittest
{
        auto cmp = "     123,456";
        assert(cmp.length == 12, format("%d", cmp.length));
        auto tmp = format("%12,d", 123456);
        assert(tmp.length == 12, format("%d", tmp.length));

        assert(tmp == cmp, "'" ~ tmp ~ "'");
}

The length of tmp should be 12, but it is 11.
Does not depend on number type. The error also occurs with floats.

--
Dec 08 2017