Bug 21814 – std.format: grouping with width 0 causes floating point exception

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-04-09T10:17:14Z
Last change time
2021-04-15T07:12:16Z
Keywords
pull
Assigned to
No Owner
Creator
Berni44

Comments

Comment #0 by bugzilla — 2021-04-09T10:17:14Z
void main() { writefln("%,0d",1000); } produces a floating point exception. It should handle this more gracefully, e.g. do no grouping at all. In that case the following unittest would hold: assert(format("%,0d",1000) == "1000");
Comment #1 by dlang-bot — 2021-04-13T20:05:02Z
@berni44 created dlang/phobos pull request #7965 "std.format: New version for formatting integral values using writeAligned" fixing this issue: - Fix Issue 21814 - std.format: grouping with width 0 causes floating point exception https://github.com/dlang/phobos/pull/7965
Comment #2 by dlang-bot — 2021-04-15T07:12:16Z
dlang/phobos pull request #7965 "std.format: New version for formatting integral values using writeAligned" was merged into master: - 77eafb11ac378b3d47a3a9e58783169a92876b77 by berni44: Fix Issue 21814 - std.format: grouping with width 0 causes floating point exception https://github.com/dlang/phobos/pull/7965