std.math performance (SSE vs. real)
via Digitalmars-d
digitalmars-d at puremagic.com
Mon Jun 30 07:10:27 PDT 2014
On Monday, 30 June 2014 at 11:57:04 UTC, Don wrote:
> And if you perform a division using integers, you've silently
> lost precision.
2 ints of arbitrary length = rational numbers => no loss of
precision for divs.
CPU vendors make arbitrary decisions about FP and break
compliance with no remorse for single precision float vector
operations in order to reduce die size / increase throughput.
That includes not having NaN/Inf, reducing mantissa precision for
some operations, etc.
FP is not portable out-of-the-box.
I think the main advantage of integers is that you control the
precision and can repeat the calculation with the same result. It
is easier to avoid stability issues with integers too. And it is
portable.
More information about the Digitalmars-d
mailing list