Hi,

On Mon, Apr 14, 2014 at 2:02 PM, Julian Taylor
<jtaylor.deb...@googlemail.com> wrote:
> The official numpy mingw binaries do not have all these math issues.
> Only the VC builds do.
> As mingw is fine the functions must be somewhere in the windows API but
> no-one has contributed a fix for the VC builds to numpy yet.

I'm building with mingw-w64.

It looks like this works as expected from this test:

#include <math.h>
#include <stdio.h>

int main() {
    double z;
    z = expm1(-0.0);
    printf("Result %f\n", z);
}

(prints -0).

as does this (modified from core/src/npymath/npy_math.c.src):

#include <stdio.h>

double npy_expm1(double x)
{
    if (isinf(x) && x > 0) {
        return x;
    }
    else {
        const double u = exp(x);

        if (u == 1.0) {
            return x;
        } else if (u - 1.0 == -1.0) {
            return -1;
        } else {
            return (u - 1.0) * x/log(u);
        }
    }
}

int main() {
    double z;
    z = npy_expm1(-0.0);
    printf("Result %f\n", z);
}

Sorry for my ignorance, but where does the `HAVE_EXPM1` symbol come from?

Cheers,

Matthew
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to