Skip to content

[libc][math] Remove constexpr quantifier from cbrt's utility functions. #99349

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 17, 2024

Conversation

lntue
Copy link
Contributor

@lntue lntue commented Jul 17, 2024

@lntue lntue requested review from overmighty and jhuber6 July 17, 2024 16:31
@llvmbot llvmbot added the libc label Jul 17, 2024
@lntue lntue requested a review from SchrodingerZhu July 17, 2024 16:31
@llvmbot
Copy link
Member

llvmbot commented Jul 17, 2024

@llvm/pr-subscribers-libc

Author: None (lntue)

Changes

Fix full build failures: https://lab.llvm.org/buildbot/#/builders/131/builds/2342


Full diff: https://github.com/llvm/llvm-project/pull/99349.diff

1 Files Affected:

  • (modified) libc/src/math/generic/cbrt.cpp (+3-3)
diff --git a/libc/src/math/generic/cbrt.cpp b/libc/src/math/generic/cbrt.cpp
index e226054332dfa..036664c2aafaf 100644
--- a/libc/src/math/generic/cbrt.cpp
+++ b/libc/src/math/generic/cbrt.cpp
@@ -35,7 +35,7 @@ namespace {
 // > P = fpminimax(x^(-2/3), 7, [|D...|], [1, 2]);
 // > dirtyinfnorm(P/x^(-2/3) - 1, [1, 2]);
 // 0x1.28...p-21
-constexpr double intial_approximation(double x) {
+double intial_approximation(double x) {
   constexpr double COEFFS[8] = {
       0x1.bc52aedead5c6p1,  -0x1.b52bfebf110b3p2,  0x1.1d8d71d53d126p3,
       -0x1.de2db9e81cf87p2, 0x1.0154ca06153bdp2,   -0x1.5973c66ee6da7p0,
@@ -59,12 +59,12 @@ constexpr double intial_approximation(double x) {
 // Get the error term for Newton iteration:
 //   h(x) = x^3 * a^2 - 1,
 #ifdef LIBC_TARGET_CPU_HAS_FMA
-constexpr double get_error(const DoubleDouble &x_3, const DoubleDouble &a_sq) {
+double get_error(const DoubleDouble &x_3, const DoubleDouble &a_sq) {
   return fputil::multiply_add(x_3.hi, a_sq.hi, -1.0) +
          fputil::multiply_add(x_3.lo, a_sq.hi, x_3.hi * a_sq.lo);
 }
 #else
-constexpr double get_error(const DoubleDouble &x_3, const DoubleDouble &a_sq) {
+double get_error(const DoubleDouble &x_3, const DoubleDouble &a_sq) {
   DoubleDouble x_3_a_sq = fputil::quick_mult(a_sq, x_3);
   return (x_3_a_sq.hi - 1.0) + x_3_a_sq.lo;
 }

@lntue lntue merged commit ac1d5fa into llvm:main Jul 17, 2024
6 of 7 checks passed
@lntue lntue deleted the cbrt branch July 17, 2024 16:33
yuxuanchen1997 pushed a commit that referenced this pull request Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants