-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
BUG: Force npymath
to respect npy_longdouble
#20360
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…t `npy_longdouble` In some certain cases mostly workarounds, there's a necessity to define `npy_longdouble` as `double` even if that was against the compiler implementation(sizeof(long double) != sizeof(double)). Therefore, avoid `long double`, use `npy_longdouble` instead, and when it comes to standard math functions make sure of using the double version when `NPY_SIZEOF_LONGDOUBLE` == `NPY_SIZEOF_DOUBLE`.
long double
changes, and force npymath
to respet npy_longdouble
long double
changes, and force npymath
to respect npy_longdouble
CI seems happy. Is this in Draft mode on purpose still @seiko2plus? Cc @carlkl. . |
it's fine to merge it, since the patch fixes the build on arm7 and m1 without changing the behavior of |
@seiko2plus, concerning The defintion of #if defined(NPY_USE_C99_COMPLEX) && defined(NPY_HAVE_COMPLEX_LONG_DOUBLE)
typedef complex long double npy_clongdouble;
#else
typedef struct {npy_longdouble real, imag;} npy_clongdouble;
#endif as
which is correct in our case if (and only if) |
@carlkl, msvc is fine in both cases since numpy/numpy/core/src/npymath/npy_math_complex.c.src Lines 1753 to 1770 in 491564d
However, since we only do this workaround on MSVC & MinGW and both had been tested then I think we're fine. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, this looks good so let's get it in. Thanks @seiko2plus, @carlkl and everyone else who weighed in!
…t `npy_longdouble` (numpy#20360) In some certain cases mostly workarounds, there's a necessity to define `npy_longdouble` as `double` even if that was against the compiler implementation(sizeof(long double) != sizeof(double)). Therefore, avoid `long double`, use `npy_longdouble` instead, and when it comes to standard math functions make sure of using the double version when `NPY_SIZEOF_LONGDOUBLE` == `NPY_SIZEOF_DOUBLE`.
long double
changes, and force npymath
to respect npy_longdouble
npymath
to respect npy_longdouble
closes #20348
In some certain cases mostly workarounds, there's a necessity to define
npy_longdouble
as
double
even if that was against the compiler implementation(sizeof(long double) != sizeof(double))
.Therefore, avoid
long double
, usenpy_longdouble
instead,and when it comes to standard math functions make sure of using
the double version when
NPY_SIZEOF_LONGDOUBLE
==NPY_SIZEOF_DOUBLE
.