Lines Matching +full:range +full:- +full:double

2  * Double-precision scalar cospi function.
4 * Copyright (c) 2023-2024, Arm Limited.
5 * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception
16 C2_hi = 4, C2_lo = C2 - C2_hi (~=1.16771278)
19 static const double poly[]
20 = { 0x1.921fb54442d184p1, -0x1.2aef39896f94bp0, 0x1.466bc6775ab16p1,
21 -0x1.32d2cce62dc33p-1, 0x1.507834891188ep-4, -0x1.e30750a28c88ep-8,
22 0x1.e8f48308acda4p-12, -0x1.6fc0032b3c29fp-16, 0x1.af86ae521260bp-21,
23 -0x1.012a9870eeb7dp-25 };
27 /* Approximation for scalar double-precision cospi(x).
29 cospi(0x1.160b129300112p-21) got 0x1.fffffffffd16bp-1
30 want 0x1.fffffffffd16ep-1. */
31 double
32 arm_math_cospi (double x) in arm_math_cospi()
37 double ax = asdouble (asuint64 (x) & ~0x8000000000000000); in arm_math_cospi()
44 /* If x is an integer, return +- 1, based upon if x is odd. */ in arm_math_cospi()
47 return (m & 1) ? -1 : 1; in arm_math_cospi()
52 if (ax < 0x1p-63) in arm_math_cospi()
55 /* Any non-integer values >= 0x1x51 will be int +0.5. in arm_math_cospi()
61 double n = ax + Shift; in arm_math_cospi()
63 n = n - Shift; in arm_math_cospi()
65 /* We know that cospi(x) = sinpi(0.5 - x) in arm_math_cospi()
66 range reduction and offset into sinpi range -1/2 .. 1/2 in arm_math_cospi()
67 r = 0.5 - |x - rint(x)|. */ in arm_math_cospi()
68 double r = 0.5 - fabs (ax - n); in arm_math_cospi()
71 double r2 = r * r; in arm_math_cospi()
72 double y = horner_9_f64 (r2, poly); in arm_math_cospi()
76 y = fma (-4 * r2, r, y); in arm_math_cospi()
78 /* As all values are reduced to -1/2 .. 1/2, the result of cos(x) always be in arm_math_cospi()
85 double
86 cospi (double x) in cospi()
94 TEST_SYM_INTERVAL (arm_math_cospi, 0, 0x1p-63, 5000)
95 TEST_SYM_INTERVAL (arm_math_cospi, 0x1p-63, 0.5, 10000)