[Issue 8523] New: compile time parsing of hex floats

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Aug 8 12:55:20 PDT 2012


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

           Summary: compile time parsing of hex floats
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: ellery-newcomer at utulsa.edu


--- Comment #0 from Ellery Newcomer <ellery-newcomer at utulsa.edu> 2012-08-08 12:55:19 PDT ---
doesn't work, but should.

enum string s = "0x9.D70A3D70A3D70A4p-3";
enum d2 = to!real(s);
pragma(msg, d2);

gives me:

/usr/include/dmd-d/std/conv.d(2305): Error: Cannot convert &real to long* at
compile time
/usr/include/dmd-d/std/conv.d(1592):        called from here: parse(value)
/usr/include/dmd-d/std/conv.d(268):        called from here: toImpl(_param_0)
test.d(14):        called from here: to("0x9.D70A3D70A3D70A4p-3")
/usr/include/dmd-d/std/conv.d(2305): Error: Cannot convert &real to long* at
compile time
/usr/include/dmd-d/std/conv.d(1592):        called from here: parse(value)
/usr/include/dmd-d/std/conv.d(268):        called from here: toImpl(_param_0)
test.d(15):        called from here: to("0x9.D70A3D70A3D70A4p-3")
to("0x9.D70A3D70A3D70A4p-3")

however,

double d = to!real(s);
writeln(d);

compiles and prints

1.23

-- 
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