aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/float.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2020-02-21 13:24:21 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2020-02-21 14:30:47 -0500
commitabe41f453a5c42129e21825d75450aced0053eb8 (patch)
tree378d719a3e63d3b59d63a1f094b8a541f0e6e3ba /src/backend/utils/adt/float.c
parent7fde892bc191e4df9fcd52ce11d1502673498d97 (diff)
downloadpostgresql-abe41f453a5c42129e21825d75450aced0053eb8.tar.gz
postgresql-abe41f453a5c42129e21825d75450aced0053eb8.zip
Assume that we have cbrt().
Windows has this, and so do all other live platforms according to the buildfarm, so remove the configure probe and float.c's substitute code. This is part of a series of commits to get rid of no-longer-relevant configure checks and dead src/port/ code. I'm committing them separately to make it easier to back out individual changes if they prove less portable than I expect. Discussion: https://postgr.es/m/15379.1582221614@sss.pgh.pa.us
Diffstat (limited to 'src/backend/utils/adt/float.c')
-rw-r--r--src/backend/utils/adt/float.c38
1 files changed, 0 insertions, 38 deletions
diff --git a/src/backend/utils/adt/float.c b/src/backend/utils/adt/float.c
index 012c3252f3c..34af0eb22b5 100644
--- a/src/backend/utils/adt/float.c
+++ b/src/backend/utils/adt/float.c
@@ -72,19 +72,6 @@ static double sind_q1(double x);
static double cosd_q1(double x);
static void init_degree_constants(void);
-#ifndef HAVE_CBRT
-/*
- * Some machines (in particular, some versions of AIX) have an extern
- * declaration for cbrt() in <math.h> but fail to provide the actual
- * function, which causes configure to not set HAVE_CBRT. Furthermore,
- * their compilers spit up at the mismatch between extern declaration
- * and static definition. We work around that here by the expedient
- * of a #define to make the actual name of the static function different.
- */
-#define cbrt my_cbrt
-static double cbrt(double x);
-#endif /* HAVE_CBRT */
-
/*
* We use these out-of-line ereport() calls to report float overflow,
@@ -3964,28 +3951,3 @@ width_bucket_float8(PG_FUNCTION_ARGS)
PG_RETURN_INT32(result);
}
-
-/* ========== PRIVATE ROUTINES ========== */
-
-#ifndef HAVE_CBRT
-
-static double
-cbrt(double x)
-{
- int isneg = (x < 0.0);
- double absx = fabs(x);
- double tmpres = pow(absx, (double) 1.0 / (double) 3.0);
-
- /*
- * The result is somewhat inaccurate --- not really pow()'s fault, as the
- * exponent it's handed contains roundoff error. We can improve the
- * accuracy by doing one iteration of Newton's formula. Beware of zero
- * input however.
- */
- if (tmpres > 0.0)
- tmpres -= (tmpres - absx / (tmpres * tmpres)) / (double) 3.0;
-
- return isneg ? -tmpres : tmpres;
-}
-
-#endif /* !HAVE_CBRT */