[Issue 1475] allow to use intrinsic math functions (e.g. trigonometry) in CTFEs
BCS
BCS at pathlink.com
Wed Sep 5 16:12:52 PDT 2007
Sean Kelly wrote:
> d-bugmail at puremagic.com wrote:
>
>>
>> ------- Comment #2 from wbaxter at gmail.com 2007-09-05 16:10 -------
>> Of course you can already do this by writing your own CTFE functions to
>> approximate those via Taylor series and the like. One of the first
>> CTFE demos
>> was a compile-time sqrt function.
>>
>> But yeh, the compiler has access to a better way to evaluate those
>> functions
>> than running what amounts to an interpreted language, so it would be
>> nice to be
>> able to access it.
>
>
> It was my impression that CTFE relies on a fancy version of constant
> folding, which doesn't make support for any special routines or plugins
> a really natural fit. And while it seems like a potentially interesting
> feature to add, I wonder whether there might be issues related to cross
> compilation.
Intrinsics are just function that get special handling. Something akin
to that could be done for CTFE. Put some special case rules in the
engine for sin/cos/tan/etc. that call functions that are part of the
compiler.
More information about the Digitalmars-d-bugs
mailing list