www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 7155] New: inconsistent .stringof

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

           Summary: inconsistent .stringof
           Product: D
           Version: D2
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: timon.gehr gmx.ch



For example, all of those fail:
static assert(100001f.stringof     == "100001f");
static assert(1000001f.stringof    == "1000001f");
static assert([100001f].stringof   == "[100001f]");
static assert([1000001f].stringof  == "[1000001f]");

static assert(100001.0.stringof    == "100001.0");
static assert(1000001.0.stringof   == "1000001.0");
static assert([100001.0].stringof  == "[100001.0]");
static assert([1000001.0].stringof == "[1000001.0]");

static assert(TypeTuple!(int, 1).stringof == "(int, 1)");

currently:

100001f.stringof     == "100001",
1000001f.stringof    == "1e+06
[100001f].stringof   == "[100001F]"
[1000001f].stringof  == "[0xf.4241p+16F]"

100001.0.stringof    == "100001"
1000001.0.stringof   == "1e+06"
[100001.0].stringof  == "[100001]"
[1000001.0].stringof == "[0xf.4241p+16]"

TypeTuple!(int,double).stringof == "(int, double)" // fine
TypeTuple!(int, 1).stringof == "tuple((int),1)"    // oO ?

Preferably the constants should all be represented in decimal but in a way that
preserves their value when mixed in at another place. (with the minimum number
of digits)

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