std.math performance (SSE vs. real)

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Sat Jun 28 21:46:36 PDT 2014


On Sat, Jun 28, 2014 at 08:41:24PM -0700, Andrei Alexandrescu via Digitalmars-d wrote:
> On 6/28/14, 6:02 PM, Tofu Ninja wrote:
[...]
> >I think this thread needs to refocus on the main point, getting
> >math overloads for float and double and how to mitigate any
> >problems that might arise from that.
> 
> Yes please. -- Andrei

Let's see the PR!

And while we're on the topic, what about working on making std.math
CTFE-able? So far, CTFE simply doesn't support fundamental
floating-point operations like isInfinity, isNaN, signbit, to name a
few, because CTFE does not allow accessing the bit representation of
floating-point values. This is a big disappointment for me -- it defeats
the power of CTFE by making it unusable if you want to use it to
generate pre-calculated tables of values.

Perhaps we can introduce some intrinsics for implementing these
functions so that they work both in CTFE and at runtime?

	https://issues.dlang.org/show_bug.cgi?id=3749

Thanks to Iain's hard work on std.math, now we have software
implementations for all(?) the basic math functions, so in theory they
should be CTFE-able -- except that some functions require access to the
floating-point bit representation, which CTFE doesn't support. All it
takes is to these primitives, and std.math will be completely CTFE-able
-- a big step forward IMHO.


T

-- 
Talk is cheap. Whining is actually free. -- Lars Wirzenius


More information about the Digitalmars-d mailing list