On Sunday, 18 March 2018 at 07:47:24 UTC, Nicholas Wilson wrote:
On Sunday, 18 March 2018 at 04:25:48 UTC, Manu wrote:
What is so hard about implementing a pow intrinsic that CTFE
can use?
It's ridiculous that we can't CTFE any non-linear function...
It's one of those blocker bugs that's been there almost 10
years.
Not all that much. Can you give me an example that does't work
yet that you want to use?
Hello, I also needed this recently! I was surprised to see that
^^ isn't CTFE but just a pow call.
------------- main.d -----------
T convertDecibelToLinearGain(T)(T dB) pure nothrow @nogc
{
static immutable T ln10_20 = cast(T)LN10 / 20;
return exp(dB * ln10_20);
}
void main()
{
enum foo = convertDecibelToLinearGain!float(-24);
}