Function that calculates in compile time when it can
Minas Mina
minas_mina1990 at hotmail.co.uk
Mon Aug 6 09:17:21 PDT 2012
On Monday, 6 August 2012 at 15:56:52 UTC, Namespace wrote:
> Take a look into std.math:
> https://github.com/D-Programming-Language/phobos/blob/master/std/math.d
I found this:
real sin(real x) @safe pure nothrow; /* intrinsic */
And these:
creal sin(creal z) @safe pure nothrow
{
creal cs = expi(z.re);
creal csh = coshisinh(z.im);
return cs.im * csh.re + cs.re * csh.im * 1i;
}
/** ditto */
ireal sin(ireal y) @safe pure nothrow
{
return cosh(y.im)*1i;
}
I don't see anything about ctfe. Maybe I didn't understand well
and sin is not evaluated at compile time. Can someone clarify
this?
More information about the Digitalmars-d-learn
mailing list