diff options
Diffstat (limited to 'libc/src/math/generic')
-rw-r--r-- | libc/src/math/generic/asinpif16.cpp | 2 | ||||
-rw-r--r-- | libc/src/math/generic/sinf.cpp | 24 |
2 files changed, 22 insertions, 4 deletions
diff --git a/libc/src/math/generic/asinpif16.cpp b/libc/src/math/generic/asinpif16.cpp index aabc086..395f4c4 100644 --- a/libc/src/math/generic/asinpif16.cpp +++ b/libc/src/math/generic/asinpif16.cpp @@ -77,7 +77,7 @@ LLVM_LIBC_FUNCTION(float16, asinpif16, (float16 x)) { }; // polynomial evaluation using horner's method // work only for |x| in [0, 0.5] - auto asinpi_polyeval = [](double x) -> double { + auto asinpi_polyeval = [&](double x) -> double { return x * fputil::polyeval(x * x, POLY_COEFFS[0], POLY_COEFFS[1], POLY_COEFFS[2], POLY_COEFFS[3], POLY_COEFFS[4], POLY_COEFFS[5], POLY_COEFFS[6], POLY_COEFFS[7]); diff --git a/libc/src/math/generic/sinf.cpp b/libc/src/math/generic/sinf.cpp index a8e634c..c362628 100644 --- a/libc/src/math/generic/sinf.cpp +++ b/libc/src/math/generic/sinf.cpp @@ -17,13 +17,30 @@ #include "src/__support/macros/config.h" #include "src/__support/macros/optimization.h" // LIBC_UNLIKELY #include "src/__support/macros/properties/cpu_features.h" // LIBC_TARGET_CPU_HAS_FMA + +#if defined(LIBC_MATH_HAS_SKIP_ACCURATE_PASS) && \ + defined(LIBC_MATH_HAS_INTERMEDIATE_COMP_IN_FLOAT) && \ + defined(LIBC_TARGET_CPU_HAS_FMA_FLOAT) + +#include "src/__support/math/sincosf_float_eval.h" + +namespace LIBC_NAMESPACE_DECL { + +LLVM_LIBC_FUNCTION(float, sinf, (float x)) { + return math::sincosf_float_eval::sincosf_eval</*IS_SIN*/ true>(x); +} + +} // namespace LIBC_NAMESPACE_DECL + +#else // !LIBC_MATH_HAS_INTERMEDIATE_COMP_IN_FLOAT + #include "src/__support/math/sincosf_utils.h" -#if defined(LIBC_TARGET_CPU_HAS_FMA_DOUBLE) +#ifdef LIBC_TARGET_CPU_HAS_FMA_DOUBLE #include "src/__support/math/range_reduction_fma.h" -#else +#else // !LIBC_TARGET_CPU_HAS_FMA_DOUBLE #include "src/__support/math/range_reduction.h" -#endif +#endif // LIBC_TARGET_CPU_HAS_FMA_DOUBLE namespace LIBC_NAMESPACE_DECL { @@ -162,3 +179,4 @@ LLVM_LIBC_FUNCTION(float, sinf, (float x)) { } } // namespace LIBC_NAMESPACE_DECL +#endif // LIBC_MATH_HAS_INTERMEDIATE_COMP_IN_FLOAT |