On Tuesday, 20 June 2017 at 12:07:00 UTC, Stefan Koch wrote:
On Thursday, 16 February 2017 at 21:05:51 UTC, Stefan Koch wrote:
[ ... ]

limited Support for 32bit floating point ops [+, -, *, /, %] has just landed in newCTFE.

float fmadd(float a, float b, float c)
{
    return b + a * c;
}

pragma(msg, fmadd(6.7, 8.9, 1.3)/* == 17.61f*/);
pragma(msg, fmadd(6.7, 8.9, -1.3)/* == 19.00f*/);
These will pass with newCTFE:
static assert(fmadd(0x1.acccccp+2, 0x1.166666p+3, 0x1.4cccccp+0) == 0x1.168f5cp+4); static assert(fmadd(0x1.acccccp+2, 0x1.166666p+3, -0x1.4cccccp+0) == -0x1.47a8p-7);

Proving that newCTFE's floating-point-math works the same as runtime-floating-point math. Which is not surprising since the interpreter uses same code as the runtime version.
At-least if you bootstrap dmd with itself.

Reply via email to