File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11// INTERNAL HEADER — DO NOT INCLUDE DIRECTLY.
22// Use #include "numpy/core.h" which pulls this in automatically.
33//
4+ // All functions live in numpy::detail — do not call directly.
5+ // Use numpy::exp() etc. from core.h.
6+ //
47// Bit-exact float32 math matching numpy 1.23.5 SIMD polynomial approximations.
58// Replicates numpy's simd_exp_FLOAT, simd_log_FLOAT, simd_sincos_f32 algorithms.
69
1114#include < cmath>
1215
1316namespace numpy {
14- namespace npy_float_math {
17+ namespace detail {
18+ // Float32 bit-exact polynomial approximations — internal detail, do not use directly.
19+ // These replicate numpy's simd_exp_FLOAT, simd_log_FLOAT, simd_sincos_f32 algorithms.
20+ // Public API: use numpy::exp() etc. from core.h.
1521
1622namespace {
1723
@@ -279,5 +285,5 @@ inline float npy_cosf(float x) {
279285}
280286
281287} // anonymous namespace
282- } // namespace npy_float_math
288+ } // namespace detail
283289} // namespace numpy
Original file line number Diff line number Diff line change @@ -168,10 +168,10 @@ NUMPY_NPY_F64(exp2, std::exp2(x))
168168// f32 exp/log/sin/cos: numpy's own polynomial approximations (npy_math_float.h)
169169// are the canonical implementation for float32. dlsym npy_expf/etc. would
170170// resolve a different (non-matching) code path. Never use dlsym for these.
171- inline float exp_npy_f32 (float x) { return npy_float_math:: npy_expf (x); }
172- inline float log_npy_f32 (float x) { return npy_float_math:: npy_logf (x); }
173- inline float sin_npy_f32 (float x) { return npy_float_math:: npy_sinf (x); }
174- inline float cos_npy_f32 (float x) { return npy_float_math:: npy_cosf (x); }
171+ inline float exp_npy_f32 (float x) { return npy_expf (x); }
172+ inline float log_npy_f32 (float x) { return npy_logf (x); }
173+ inline float sin_npy_f32 (float x) { return npy_sinf (x); }
174+ inline float cos_npy_f32 (float x) { return npy_cosf (x); }
175175NUMPY_NPY_F32 (tan, std::tan(x))
176176NUMPY_NPY_F32 (asin, std::asin(x))
177177NUMPY_NPY_F32 (acos, std::acos(x))
You can’t perform that action at this time.
0 commit comments