BUG: Force npymath to respect npy_longdouble#20360
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_longdoublelong 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;
#endifas
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. |
rgommers
left a comment
There was a problem hiding this comment.
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_longdoublenpymath to respect npy_longdouble
closes #20348
In some certain cases mostly workarounds, there's a necessity to define
npy_longdoubleas
doubleeven if that was against the compiler implementation(sizeof(long double) != sizeof(double)).Therefore, avoid
long double, usenpy_longdoubleinstead,and when it comes to standard math functions make sure of using
the double version when
NPY_SIZEOF_LONGDOUBLE==NPY_SIZEOF_DOUBLE.