std.math performance (SSE vs. real)
Kapps via Digitalmars-d
digitalmars-d at puremagic.com
Sat Jun 28 22:58:49 PDT 2014
On Saturday, 28 June 2014 at 05:16:29 UTC, Walter Bright wrote:
>
> That's a common perception of people who do not use the
> floating point unit for numerical work, and whose main concern
> is speed instead of accuracy.
>
> <snip>
>
> > I find it's extremely rare to have precision problems even
> with float under most normal usage
> > circumstances,
>
> Then you aren't doing numerical work, because it happens right
> away.
There is of course many situations where a high precision is
necessary. But in these situations you have 'real' available to
you, which presumably would maintain as high precision as is
possible. In the situations where you're using float/double, you
should not be expecting maximum precision and instead performance
should be focused on. There are existing overloads for 'real' in
std.math that presumably would not go away, the only need now is
to add new overloads for float/double that can take advantage of
SSE instructions. While striving for precision is nice, in a huge
majority of situations it's simply not necessary (and when it is,
'real' will be used). It makes D look bad when it does so poorly
on benchmarks like this simply so that the output perlin noise
can be rounded from 238.32412319 to 238 instead of 238.32 to 238.
More information about the Digitalmars-d
mailing list