Differences in results when using the same function in CTFE and Runtime
Nicholas Wilson
iamthewilsonator at hotmail.com
Fri Aug 9 00:46:12 UTC 2024
On Thursday, 8 August 2024 at 10:31:32 UTC, Carsten Schlote wrote:
> Hi
> - 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?
>
there are `toPrec`[1] intrinsics to solve exactly this issue of
lack of truncation of precision.
[1]:
https://github.com/dlang/dmd/blob/958ba9cbe3583830efe39505238939daa0dbd64c/druntime/src/core/math.d#L198-L214
> Greetz
> Carsten
More information about the Digitalmars-d
mailing list