[Issue 5970] fix BigInt.toString

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Aug 25 01:27:45 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=5970


Don <clugdbug at yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugdbug at yahoo.com.au


--- Comment #3 from Don <clugdbug at yahoo.com.au> 2011-08-25 01:27:40 PDT ---
(In reply to comment #0)
> This is in reply to comment #3 of bug 5765
> 
> > > How do I perform the equivalent of str(ackermann(4, 2)) with BigInt?
> > 
> > format("%d", ackermann(4,2))
> 
> I think it doesn't work with DMD 2.053beta:
> 
> 
> import std.bigint, std.string;
> void main() {
>     format("%d", BigInt(1));
> }
> 
> 
> It prints:
> std.format.FormatError: std.format Can't convert std.bigint.BigInt to string:
> "string toString()" not defined

You're right. writefln() works, but format() doesn't:

import std.bigint, std.stdio;
void main() {
    writefln("%d %x", BigInt(114), BigInt(114)); // works
}

A bit strange, since writefln() should really be using format().

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list