Differences in results when using the same function in CTFE and Runtime

H. S. Teoh hsteoh at qfbox.info
Thu Aug 8 14:41:51 UTC 2024


On Thu, Aug 08, 2024 at 10:31:32AM +0000, Carsten Schlote via Digitalmars-d wrote:
[...]
> Ok, the fractal code uses 'double' floats, which are by their very
> nature limited in precision. But assuming that the math emulation of
> CTFE works identical as the CPU does at runtime, the outcome should be
> identical.

IIRC DMD either uses in CTFE or emits code that uses 8088 80-bit
extended precision in intermediate results. Which, obviously, will
produce different results when the same computation performed using only
doubles.


[...]
> - Or is this some kind of expected behaviour whenever floats are involved?

https://floating-point-gui.de/


--T


More information about the Digitalmars-d mailing list