Differences in results when using the same function in CTFE and Runtime
Timon Gehr
timon.gehr at gmx.ch
Mon Aug 12 20:29:59 UTC 2024
On 8/8/24 12:31, Carsten Schlote wrote:
>
> And it opens up some questions:
>
> - Can CTFE be used under all circumstances when float numbers of any
> precision are involved?
> - Or is this some kind of expected behaviour whenever floats are involved?
> - Is the D CTFE documentation completely covering such possible issues?
>
> I can imagine that bugs causes by such subtil differences might be very
> difficult to fix.
>
>
> Any experiences or thought on this?
The specification allows behavior like that even at runtime.
https://dlang.org/spec/float.html
I have been vocally against this. Full portability is perhaps one thing,
as hardware differences do exist, but completely thwarting the
expectations by deliberately doing a different operation than the one
you requested I think makes no sense at all. A lot of modern hardware
nowadays is compatible or almost compatible regarding floats.
More information about the Digitalmars-d
mailing list