Assume that we have cbrt().
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 21 Feb 2020 18:24:21 +0000 (13:24 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 21 Feb 2020 19:30:47 +0000 (14:30 -0500)
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

configure
configure.in
src/backend/utils/adt/float.c
src/include/pg_config.h.in
src/tools/msvc/Solution.pm

index 4bd68b99e58e02df35b1ae641e6e96cf22442dee..4041051d59febf686654d9d6ca6192aae3c626e4 100755 (executable)
--- a/configure
+++ b/configure
@@ -14925,7 +14925,7 @@ fi
 LIBS_including_readline="$LIBS"
 LIBS=`echo "$LIBS" | sed -e 's/-ledit//g' -e 's/-lreadline//g'`
 
-for ac_func in backtrace_symbols cbrt clock_gettime copyfile fdatasync getifaddrs getpeerucred getrlimit kqueue mbstowcs_l memset_s memmove poll posix_fallocate ppoll pstat pthread_is_threaded_np readlink setproctitle setproctitle_fast setsid shm_open strchrnul strsignal symlink sync_file_range uselocale utime utimes wcstombs_l
+for ac_func in backtrace_symbols clock_gettime copyfile fdatasync getifaddrs getpeerucred getrlimit kqueue mbstowcs_l memset_s memmove poll posix_fallocate ppoll pstat pthread_is_threaded_np readlink setproctitle setproctitle_fast setsid shm_open strchrnul strsignal symlink sync_file_range uselocale utime utimes wcstombs_l
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
index 23ed5f92e0933580e5aba82817296965bc5d32b7..7660c7776705a57793b7ea21649419aab5bcfa9f 100644 (file)
@@ -1618,7 +1618,6 @@ LIBS=`echo "$LIBS" | sed -e 's/-ledit//g' -e 's/-lreadline//g'`
 
 AC_CHECK_FUNCS(m4_normalize([
        backtrace_symbols
-       cbrt
        clock_gettime
        copyfile
        fdatasync
index 012c3252f3c7c5cd0077b9ee702efed3e3611e48..34af0eb22b5c5c415452428c1c46158ed880729c 100644 (file)
@@ -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 */
index 002e04000831a662a7ca42469be6cca5ca464649..9de9ae6631e3fd55a63b64d971e8538c37e4619a 100644 (file)
 /* Define to 1 if you have the `BIO_meth_new' function. */
 #undef HAVE_BIO_METH_NEW
 
-/* Define to 1 if you have the `cbrt' function. */
-#undef HAVE_CBRT
-
 /* Define to 1 if you have the `clock_gettime' function. */
 #undef HAVE_CLOCK_GETTIME
 
index 8a703385ea288939715f7257dfff20f8d5cae573..81b0bf2128239e8b42ef05c74b1ae79b233fe074 100644 (file)
@@ -210,7 +210,6 @@ sub GenerateFiles
                HAVE_BACKTRACE_SYMBOLS     => undef,
                HAVE_BIO_GET_DATA          => undef,
                HAVE_BIO_METH_NEW          => undef,
-               HAVE_CBRT                  => undef,
                HAVE_CLOCK_GETTIME         => undef,
                HAVE_COMPUTED_GOTO         => undef,
                HAVE_COPYFILE              => undef,