summaryrefslogtreecommitdiff
path: root/numpy/core
diff options
context:
space:
mode:
authorChris Sidebottom <chris.sidebottom@arm.com>2023-05-02 10:03:04 +0100
committerChris Sidebottom <chris.sidebottom@arm.com>2023-05-02 15:48:30 +0100
commitc43ae85bdd44174c0f2867adc85fe94cbc626873 (patch)
tree9ebd0a0ea9a2ee8e27c3baf76ab3179b8a0547a7 /numpy/core
parent525c35b5083da99dec8a5756d1b86099b2cf0c6b (diff)
downloadnumpy-c43ae85bdd44174c0f2867adc85fe94cbc626873.tar.gz
BUG: Correct sin/cos float64 range check functions
When I translated range checks for [sin](https://github.com/ARM-software/optimized-routines/blob/91d5bbc3091fa568e6856c7c41f9d7492d5957df/math/v_sin.c#L68): ```c cmp = v_cond_u64 ((ir >> 52) - TinyBound >= Thresh); ``` and [cos](https://github.com/ARM-software/optimized-routines/blob/91d5bbc3091fa568e6856c7c41f9d7492d5957df/math/v_cos.c#L56): ```c cmp = v_cond_u64 (v_as_u64_f64 (r) >= v_as_u64_f64 (RangeVal)); ``` They ended up the wrong way around, this corrects it.
Diffstat (limited to 'numpy/core')
-rw-r--r--numpy/core/src/umath/loops_trigonometric.dispatch.c.src4
1 files changed, 2 insertions, 2 deletions
diff --git a/numpy/core/src/umath/loops_trigonometric.dispatch.c.src b/numpy/core/src/umath/loops_trigonometric.dispatch.c.src
index 28af04f6b..43eb58ffe 100644
--- a/numpy/core/src/umath/loops_trigonometric.dispatch.c.src
+++ b/numpy/core/src/umath/loops_trigonometric.dispatch.c.src
@@ -104,14 +104,14 @@ simd_range_reduction_pi2(npyv_f64 r, npyv_f64 n) {
return simd_range_reduction_f64(r, n, pi1, pi2, pi3);
}
-NPY_FINLINE npyv_b64 simd_cos_range_check_f64(npyv_u64 ir) {
+NPY_FINLINE npyv_b64 simd_sin_range_check_f64(npyv_u64 ir) {
const npyv_u64 tiny_bound = npyv_setall_u64(0x202); /* top12 (asuint64 (0x1p-509)). */
const npyv_u64 simd_thresh = npyv_setall_u64(0x214); /* top12 (asuint64 (RangeVal)) - SIMD_TINY_BOUND. */
return npyv_cmpge_u64(npyv_sub_u64(npyv_shri_u64(ir, 52), tiny_bound), simd_thresh);
}
-NPY_FINLINE npyv_b64 simd_sin_range_check_f64(npyv_u64 ir) {
+NPY_FINLINE npyv_b64 simd_cos_range_check_f64(npyv_u64 ir) {
const npyv_f64 range_val = npyv_setall_f64(0x1p23);
return npyv_cmpge_u64(ir, npyv_reinterpret_u64_f64(range_val));