Skip to content

Commit 16a6405

Browse files
committed
restore HAVE_POWL for macOS blocklisting
Signed-off-by: mattip <[email protected]>
1 parent c35cb18 commit 16a6405

File tree

2 files changed

+31
-3
lines changed

2 files changed

+31
-3
lines changed

numpy/core/setup_common.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,14 @@ def set_sig(sig):
124124
"floor", "ceil", "sqrt", "log10", "log", "exp", "asin",
125125
"acos", "atan", "fmod", 'modf', 'frexp', 'ldexp',
126126
"expm1", "log1p", "acosh", "asinh", "atanh",
127-
"rint", "trunc", "exp2", "hypot", "atan2", "pow",
127+
"rint", "trunc", "exp2", "hypot", "atan2",
128128
"copysign", "nextafter", "strtoll", "strtoull", "cbrt"]
129129

130130
OPTIONAL_STDFUNCS = [
131131
# cygwin
132132
"log2",
133+
# macos for powl
134+
"pow",
133135
]
134136

135137
OPTIONAL_LOCALE_FUNCS = ["strtold_l"]

numpy/core/src/npymath/npy_math_internal.h.src

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,9 @@ NPY_INPLACE @type@ npy_@kind@@c@(@type@ x)
193193
}
194194

195195
/**end repeat1**/
196+
196197
/* Optional C99 functions */
198+
197199
/**begin repeat1
198200
* #kind = log2#
199201
* #KIND = LOG2#
@@ -210,17 +212,41 @@ NPY_INPLACE @type@ npy_@kind@@c@(@type@ x)
210212
#undef WORKAROUND_APPLE_TRIG_BUG
211213

212214
/**begin repeat1
213-
* #kind = atan2,hypot,pow,fmod,copysign#
214-
* #KIND = ATAN2,HYPOT,POW,FMOD,COPYSIGN#
215+
* #kind = pow#
216+
* #KIND = POW#
215217
*/
218+
#ifdef @kind@@c@
219+
#undef @kind@@c@
220+
#endif
221+
#ifndef HAVE_@KIND@@C@
222+
NPY_INPLACE @type@ npy_@kind@@c@(@type@ x, @type@ y)
223+
{
224+
return (@type@) npy_@kind@((double)x, (double) y);
225+
}
226+
#endif
227+
228+
#ifdef HAVE_@KIND@@C@
216229
NPY_INPLACE @type@ npy_@kind@@c@(@type@ x, @type@ y)
217230
{
218231
return NPY__FP_SFX(@kind@)(x, y);
219232
}
233+
#endif
220234
/**end repeat1**/
221235

236+
222237
/* C99 mandatory */
223238

239+
/**begin repeat1
240+
* #kind = atan2,hypot,fmod,copysign#
241+
* #KIND = ATAN2,HYPOT,FMOD,COPYSIGN#
242+
*/
243+
NPY_INPLACE @type@ npy_@kind@@c@(@type@ x, @type@ y)
244+
{
245+
return NPY__FP_SFX(@kind@)(x, y);
246+
}
247+
/**end repeat1**/
248+
249+
224250
NPY_INPLACE @type@ npy_modf@c@(@type@ x, @type@ *iptr)
225251
{
226252
return NPY__FP_SFX(modf)(x, iptr);

0 commit comments

Comments
 (0)