accuracy of floating point calculations: d vs cpp

drug drug2004 at bk.ru
Mon Jul 22 14:19:09 UTC 2019


22.07.2019 16:26, Guillaume Piolat пишет:
>>
>> Typical floating point operations in single-precision like a simple (a 
>> * b) + c will provide a -140dB difference if order is changed. It's 
>> likely the order of operations is not the same in your program, so the 
>> least significant digit should be different.
> 
> What I would recommend is compute the mean relative error, in double, 
> and if it's below -200 dB, not bother. This is an incredibly low 
> relative error of 0.00000001%.
> You will have no difficulty making your D program deterministic, but 
> knowing exactly where the C++ and D differ will be long and serve no 
> purpose.
Unfortunately error has been turned out to be much bigger than I guessed 
before. So obviously there is a problem either on D side or on C++ side. 
Error is too huge to ignore it.


More information about the Digitalmars-d-learn mailing list