Bug 24082 – add Int128.toString that supports std.format

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2023-08-11T20:58:33Z
Last change time
2023-08-20T17:38:10Z
Keywords
pull
Assigned to
No Owner
Creator
Nathan S.

Comments

Comment #0 by n8sh.secondary — 2023-08-11T20:58:33Z
``` import std; writeln(Int128.min); ``` Current output: "Int128(Cent(0, 9223372036854775808))" Proposed output: "-170141183460469231731687303715884105728" ``` import std; writefln("%x", Int128.min); ``` Currently throws std.format.FormatException "Expected '%s' format specifier for type 'Int128'" Proposed output: "7fffffffffffffffffffffffffffffff"
Comment #1 by dlang-bot — 2023-08-11T21:08:20Z
@n8sh created dlang/phobos pull request #8797 "Fix Issue 24082 - add Int128.toString that supports std.format" fixing this issue: - Fix Issue 24082 - add Int128.toString that supports std.format toString has template parameter FormatSpec instead of template parameter Char and argument std.format.FormatSpec!Char so importing std.int128 does not require importing std.format unless toString is actually used (pay as you go). https://github.com/dlang/phobos/pull/8797
Comment #2 by dlang-bot — 2023-08-20T17:38:10Z
dlang/phobos pull request #8797 "Fix Issue 24082 - add Int128.toString that supports std.format" was merged into master: - c7fb52ecab52f1a821703547da6cf7e1b6fc143a by Nathan Sashihara: Fix Issue 24082 - add Int128.toString that supports std.format toString has template parameter FormatSpec instead of template parameter Char and argument std.format.FormatSpec!Char so importing std.int128 does not require importing std.format unless toString is actually used (pay as you go). https://github.com/dlang/phobos/pull/8797