[Issue 18047] New: std.format value.length modulo seperator step width leads to wrong length
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Dec 8 13:16:51 UTC 2017
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 at puremagic.com
Reporter: rburners at 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.
--
More information about the Digitalmars-d-bugs
mailing list