[Issue 3520] New: std.numeric.CustomFloat horribly broken

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Nov 16 19:54:21 PST 2009


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

           Summary: std.numeric.CustomFloat horribly broken
           Product: D
           Version: 2.036
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: dsimcha at yahoo.com


--- Comment #0 from David Simcha <dsimcha at yahoo.com> 2009-11-16 19:54:20 PST ---
Filing these as one bug report since they probably have the same underlying
cause (can't tell for sure since CustomFloat relies on BitFields, and debugging
string mixins that I didn't write myself is incredibly hard)

import std.stdio, std.numeric;

alias CustomFloat!(1, 13, 2) F;

void main() {
    F num = F(0.314);
    writeln(num.get!float);
}


Compile w/ -O -inline -release.  Result:  Compile time error:
numeric.d(206): Error: variable result used before set

Compile with default compiler settings.  Result:  Compiles, assert failure:
core.exception.AssertError at std.numeric(115): Assertion failure

Compile with -release to disable asserts but without -O to prevent compiler
from noticing variable used before set.  Runs, produces incorrect result. 
Prints:
1.74431e-39

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