On Mon, Aug 6, 2012 at 5:33 PM, Minas Mina <[email protected]> wrote:

> // calcuated at O(1) woohoo!

>         return cast(ulong)(a * pow(r0, cast(double)n) + b * pow(r1,

I wonder if there is any rounding error going on with these pow, but
yes, even better this way.

> double f = sin(0.5); // calculated at compile time or not?
>
> If it is calculated at compile time, how do I do it for my own functions?

sin is a library function, it has no special rights your own function
doesn't as far as I know.

I'd say, put an if(__ctfe) in sin:

if (__ctfe)
{
    pragma(msg, "Yep, CT");
    return 2.0;
}
else
{
    // standard sin code
}

And tell us the result :)

Reply via email to