D float types operations vs C++ ones

Andrea Fontana via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Dec 17 03:52:59 PST 2015

On Thursday, 17 December 2015 at 11:50:02 UTC, drug wrote:
> I have two implementation of the same algorithm - D and C++ 
> (that is port of D version). I assume that running these 
> implementations on the same data should give the same results 
> from both. But with some data the results differ (5th decimal 
> digit after point). For my purpose it isn't important and I can 
> ignore this difference. But I'd like to have the same results 
> totally (I mean bit to bit) to easy maintanence of the 
> implementations. Question is - can I rely that D and C++ float 
> types operations should give the same result because D and C 
> are similar or no and I should use more portable way and 
> compare floats with some epsilon?

You should publish some code to check...

More information about the Digitalmars-d-learn mailing list