D float types operations vs C++ ones
Ali Çehreli via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Dec 17 08:34:27 PST 2015
On 12/17/2015 03:50 AM, drug wrote:
> D and C++ [...] But with some data the results differ
You may have similar results between two C and two C++ compilers, even
between two different versions of the same compiler.
In addition to possible reasons that has already been mentioned, note
that function arguments can be evaluated in any order by compilers of C
and C++ (D uses left-to-right). For example, for the following
expression, gcc evaluates bar() first but dmd (and other D compilers)
evaluate foo() first:
If foo() and bar() have side effects on floating values, those values
can be observed differently.
More information about the Digitalmars-d-learn