[Issue 9937] CTFE floats don't overflow correctly

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Apr 24 14:24:52 PDT 2013


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



--- Comment #12 from Walter Bright <bugzilla at digitalmars.com> 2013-04-24 14:24:50 PDT ---
(In reply to comment #11)

> This is about making compile-time behave the same as runtime.

Floating point answers can (and do) vary depending on optimization settings.
This is true for C and C++ compilers, too, even though the arithmetic is
Standard compliant.

> Specifically:
> 1. A manifest constant should not be carrying extra precision. That's simply
> incorrect.

This is an assertion that earlier I would have accepted without question. I
question it now.

> 2. JIT compilation onto the target machine should be valid for CTFE.

I agree.

> 3. The results of CTFE should be as reproducible as runtime results are.

The definition should provide a minimum precision, not a maximum. As long as
the runtime results comply with a minimum precision, they are D standard
compliant.

I feel kinda strongly about this.

(Note that Go uses infinite precision for all integer constant folding. I think
that is superior to what D does, which limits the precision to the target
integer size.)

My earlier proposal to provide functions roundToFloat and roundToDouble at
least provide solid documentation at points in an algorithm where precision
ceilings are required.

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