[Issue 9937] CTFE floats don't overflow correctly

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Apr 18 03:32:05 PDT 2013


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


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |


--- Comment #2 from Don <clugdbug at yahoo.com.au> 2013-04-18 03:32:03 PDT ---
> In D, any floating point algorithm that relies on a maximum precision is
broken. The compiler and runtime is allowed to do all such calculations at as
high a precision as they want to - the types only specify a minimum precision,
not a maximum.

That's not exactly true. It's true that the intermediate results may be at
extended precision, for example, it would not be true that
    float x = float.max;
    assert( (x * 2) / 2 == float.infinity); // may fail

But float and double must be IEEE types.
Without this, it's impossible to write correct floating-point code.
The big problem here is that the CTFE behaviour is different to the runtime
behaviour.

I hit this with HalfFloat, I can't implement it correctly because of this
issue.

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