[Issue 9937] CTFE floats don't overflow correctly

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Apr 19 00:57:56 PDT 2013


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



--- Comment #4 from Don <clugdbug at yahoo.com.au> 2013-04-19 00:57:55 PDT ---
(In reply to comment #3)
> You're correct for C, as those are the C rules. But this is not true for D.
> 
> Can you be more specific about what you're doing in CTFE that does not work?

Define an IEEE single-precision floating-point constant.
Perhaps this is a better example:

void main()
{
         float f1 = float.max * 2;
   const float f2 = float.max * 2;
   assert(f1 == float.infinity);          // ok
   assert(f1 == f2);                      // ok
   assert(*&f2 == float.infinity);        // even this is OK
   assert(f2 == float.infinity);          // fails!!!!!!!!!!!!!!!!!
}

f2 apparently has two different values at the same time!

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