[OT] The Usual Arithmetic Confusions

Timon Gehr timon.gehr at gmx.ch
Sat Feb 5 22:52:20 UTC 2022


On 05.02.22 23:01, Walter Bright wrote:
> On 2/5/2022 6:54 AM, Timon Gehr wrote:
>> I get that the entire x87 design is pretty bad and so there are 
>> trade-offs, but as it has now been deprecated, I hope this kind of 
>> second-guessing will become a thing of the past entirely. In the 
>> meantime, I will avoid using DMD for anything that requires 
>> floating-point arithmetic.
> 
> I'm not sure how you concluded that.

Maybe my information is outdated. (This has come up many times in the 
past, and you have traditionally argued in favor of not respecting the 
specified precision.)

> DMD now rounds float calculations 
> to float with the x87, despite the cost in speed.
> ...

That's great news, but the opposite is still in the spec:
https://dlang.org/spec/float.html

In any case, AFAIK CTFE still relies on this leeway (in all compilers, 
as it's a frontend feature).

> If the CPU has SIMD float instructions on it, that is used instead of 
> the x87, just like what every other compiler does.

My current understanding is that this can change at any point in time 
without it being considered a breaking change, and that DMD is more 
likely to do this than LDC.


More information about the Digitalmars-d mailing list