Thread overview
CTFE pow()
Jan 01, 2015
Manu
Jan 13, 2015
Shammah Chancellor
Jan 01, 2015
Xinok
Jan 13, 2015
Martin Nowak
Jan 13, 2015
Martin Nowak
January 01, 2015
Does anyone know how to fix this? Can we please do so? It's been a
problem for like 5 years it seems.
It's a bit insane that we can't resolve any non-linear functions at
compile time.
January 01, 2015
Manu via Digitalmars-d <digitalmars-d@puremagic.com> wrote:
> Does anyone know how to fix this? Can we please do so? It's been a
> problem for like 5 years it seems.
> It's a bit insane that we can't resolve any non-linear functions at
> compile time.

I've been hoping for that too for a long time. Application to memoization tables is immediate and awesome. -- Andrei
January 01, 2015
On Thursday, 1 January 2015 at 16:56:24 UTC, Manu via Digitalmars-d wrote:
> Does anyone know how to fix this? Can we please do so? It's been a
> problem for like 5 years it seems.
> It's a bit insane that we can't resolve any non-linear functions at
> compile time.

I was looking for a relevant issue in the bug tracker. I stumbled upon issue [1] and pull request [2] which was closed for the following reasons:

1. if(__ctfe) kills inlining in DMD.
2. Other CTFE math can not be implemented until CTFE-able unions.


[1] https://issues.dlang.org/show_bug.cgi?id=5227
[2] https://github.com/D-Programming-Language/phobos/pull/2521#issuecomment-56265251
January 13, 2015
On 2015-01-01 17:59:09 +0000, Andrei Alexandrescu said:

> Manu via Digitalmars-d <digitalmars-d@puremagic.com> wrote:
>> Does anyone know how to fix this? Can we please do so? It's been a
>> problem for like 5 years it seems.
>> It's a bit insane that we can't resolve any non-linear functions at
>> compile time.
> 
> I've been hoping for that too for a long time. Application to memoization
> tables is immediate and awesome. -- Andrei

I think that SDC can do this already. :D

January 13, 2015
On Thursday, 1 January 2015 at 16:56:24 UTC, Manu via Digitalmars-d wrote:
> Does anyone know how to fix this? Can we please do so? It's been a
> problem for like 5 years it seems.
> It's a bit insane that we can't resolve any non-linear functions at
> compile time.

Oh, we got yl2x recently [1].
So, your code here ->
https://github.com/D-Programming-Language/dmd/blob/6fe4b48891ff5d7d171f718b2a4af6ddbb6714ec/src/builtin.c#L183

[1]: https://github.com/D-Programming-Language/dmd/pull/4012
January 13, 2015
https://issues.dlang.org/show_bug.cgi?id=3749