[libc-commits] [libc] [libc][math] Implement an integer-only version of double precision sin with 1 ULP errors. (PR #184752)
via libc-commits
libc-commits at lists.llvm.org
Thu Mar 5 18:48:03 PST 2026
================
@@ -7,10 +7,21 @@
//===----------------------------------------------------------------------===//
#include "src/math/sin.h"
+#include "src/__support/macros/optimization.h"
+#include "src/__support/macros/properties/cpu_features.h"
#include "src/__support/math/sin.h"
+#include "src/__support/math/sin_integer_eval.h"
namespace LIBC_NAMESPACE_DECL {
-LLVM_LIBC_FUNCTION(double, sin, (double x)) { return math::sin(x); }
+LLVM_LIBC_FUNCTION(double, sin, (double x)) {
+#if defined(LIBC_MATH_HAS_SKIP_ACCURATE_PASS) && \
+ defined(LIBC_MATH_SMALL_TABLES) && \
+ !defined(LIBC_TARGET_CPU_HAS_FPU_DOUBLE)
+ return math::integer_only::sin(x);
+#else
+ return math::sin(x);
+#endif
----------------
lntue wrote:
It will be, when we make the integer_only version correctly rounded. At the moment, it still has 1 ULP errors.
https://github.com/llvm/llvm-project/pull/184752
More information about the libc-commits
mailing list