accuracy of floating point calculations: d vs cpp

Ali Çehreli acehreli at yahoo.com
Tue Jul 23 17:48:49 UTC 2019


On 07/22/2019 08:48 PM, Timon Gehr wrote:

 > This is probably not your problem, but it may be good to know anyway: D
 > allows compilers to perform arbitrary "enhancement" of floating-point
 > precision for parts of the computation, including those performed at
 > compile time. I think this is stupid, but I haven't been able to
 > convince Walter.

For completeness, at least C++ gives the same freedom to the compiler, 
right?

And if I'm not mistaken, an additional potential problem with floating 
point is the state of floating point flags: they are used for all 
floating point computations. If a function sets them for its use and 
then fails to reset them to the previous state, all further computations 
will be affected.

Ali



More information about the Digitalmars-d-learn mailing list