Bug 6627 – BigInt textual representation

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-09-08T14:02:00Z
Last change time
2012-12-11T19:25:24Z
Keywords
rejects-valid
Assigned to
nobody
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2011-09-08T14:02:51Z
This is more than an enhancement request because I think this is a basic need. With dmd 2.055 this code doesn't compile, but I hope it will eventually work: import std.bigint, std.string, std.conv; void main() { auto s1 = text(BigInt(1)); auto s2 = format("%s", BigInt(1)); auto s3 = format("%d", BigInt(1)); }
Comment #1 by k.hara.pg — 2011-09-08T14:24:37Z
I have posted two pull requests. https://github.com/D-Programming-Language/phobos/pull/236 to!SomeString should use formatValue. After that, std.conv.text() using to!() will support BigInt implicitly. https://github.com/D-Programming-Language/phobos/pull/231 Issue 6595 - std.string.format() and sformat() are obsolete std.string.format() and sformat() are now uses std.format.doFormat(), but it is obsolute function. After that, the two functions uses formatValue, and will support BigInt implicitly.
Comment #2 by bearophile_hugs — 2012-12-11T19:25:24Z
Fixed time ago.