Differences in results when using the same function in CTFE and Runtime
Timon Gehr
timon.gehr at gmx.ch
Thu Aug 15 11:01:14 UTC 2024
On 8/15/24 12:25, Dom DiSc wrote:
> On Wednesday, 14 August 2024 at 07:54:15 UTC, claptrap wrote:
>> I agree the compiler should actually use the float precision you
>> explicitly ask for.
>
> But if you do cross compiling, that may simply be not possible (because
> the target has different hardware implementation than the hardware the
> compiler runs on).
> ...
It's still possible, but it's not even what I asked for. Also,
personally I am not targeting any machine whose floating-point unit is
sufficiently incompatible to cause a difference on this specific code.
There has been a convergence of how floats work. D differs gratuitously.
> Also relying on specific inaccuracy of FP calculations is very bad design.
The point is not "relying on specific inaccuracy", the point is
reproducibility. The specifics of the inaccuracy usually do not matter
at all, what matters a great deal sometimes is that you get the same
result when you run the same computation.
More information about the Digitalmars-d
mailing list