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

Timon Gehr timon.gehr at gmx.ch
Thu Aug 15 16:51:51 UTC 2024


On 8/15/24 18:21, Abdulhaq wrote:
> Why do you want to reproduce the errors?

It's you who calls it "errors". Someone else may just call it "results".

Science. Determinism, e.g. blockchain or other deterministic lock-step 
networking. etc. It's not hard to come up with use cases. Sometimes what 
exact result you get is not very important, but it is important that you 
get the same one.

> 
> In general floating point calculations are inexact, and we shouldn't (generalising here) expect to get the same error across different platforms. 

It's just not true that floating point calculations are somehow 
"inexact". You are confusing digital and analog computing. This is still 
digital computing. Rounding is a deterministic, exact function, like any 
other.


More information about the Digitalmars-d mailing list