[OT] The Usual Arithmetic Confusions

Timon Gehr timon.gehr at gmx.ch
Sat Feb 5 14:54:30 UTC 2022


On 05.02.22 00:43, Walter Bright wrote:
> 
> That's fine unless you're using a systems programming language, where 
> the customers expect performance.
> 
> Remember the the recent deal with the x87 where dmd would keep the extra 
> precision around, to avoid the double rounding problem?

That does not avoid problems, it's just confusing to users and it will 
introduce new bugs. It's not even a cure for double-rounding issues! It 
may even have the opposite effect!

> I propagated 
> this to dmc, and it cost me a design win. The customer benchmarked it on 
> 'float' arithmetic, and pronounced dmc 10% slower. The double rounding 
> issue did not interest him.

Sure, it stands to reason that people who are not careful with their 
floating-point implementations actually do not care. And the weird extra 
precision is extremely annoying for those that are careful.

Less performance, less reproducibility, randomly introducing 
double-rounding issues in code that would be correct if it did not 
insist on keeping around more precision in hard-to-predict, 
implementation defined cases that are not even properly specced out, in 
exchange for sometimes randomly hiding issues in badly written code. No, 
thanks. This is terrible!

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.


More information about the Digitalmars-d mailing list