Commit fe7d354b authored by Sergey Vojtovich's avatar Sergey Vojtovich Committed by Vlad Lesin

Cleanup isinf() portability checks

Original problem reported by Wlad: re-compilation of 10.3 on top of 10.2
build would cache undefined HAVE_ISINF from 10.2, whereas it is expected
to be 1 in 10.3.

std::isinf() seem to be available on all supported platforms.
(cherry picked from commit bc469a0b)
parent b55890d6
......@@ -477,16 +477,6 @@ ENDIF()
CHECK_SYMBOL_EXISTS(log2 math.h HAVE_LOG2)
CHECK_SYMBOL_EXISTS(rint math.h HAVE_RINT)
# isinf() prototype not found on Solaris
CHECK_CXX_SOURCE_COMPILES(
"#include <math.h>
int main() {
isinf(0.0);
return 0;
}" HAVE_ISINF)
#
# Test for endianess
#
......
......@@ -826,12 +826,6 @@ inline unsigned long long my_double2ulonglong(double d)
static inline bool isfinite(double x) { return std::isfinite(x); }
#endif /* isfinite */
#ifdef HAVE_ISINF
#define my_isinf(X) isinf(X)
#else /* !HAVE_ISINF */
#define my_isinf(X) (!finite(X) && !isnan(X))
#endif
/* Define missing math constants. */
#ifndef M_PI
#define M_PI 3.14159265358979323846
......
......@@ -4843,7 +4843,7 @@ int truncate_double(double *nr, uint field_length, uint dec,
max_value-= 1.0 / log_10[dec];
/* Check for infinity so we don't get NaN in calculations */
if (!my_isinf(res))
if (!std::isinf(res))
{
double tmp= rint((res - floor(res)) * log_10[dec]) / log_10[dec];
res= floor(res) + tmp;
......
......@@ -2553,12 +2553,12 @@ double my_double_round(double value, longlong dec, bool dec_unsigned,
volatile double value_div_tmp= value / tmp;
volatile double value_mul_tmp= value * tmp;
if (!dec_negative && my_isinf(tmp)) // "dec" is too large positive number
if (!dec_negative && std::isinf(tmp)) // "dec" is too large positive number
return value;
if (dec_negative && my_isinf(tmp))
if (dec_negative && std::isinf(tmp))
tmp2= 0.0;
else if (!dec_negative && my_isinf(value_mul_tmp))
else if (!dec_negative && std::isinf(value_mul_tmp))
tmp2= value;
else if (truncate)
{
......
......@@ -1808,7 +1808,7 @@ double Item_sum_std::val_real()
{
DBUG_ASSERT(fixed == 1);
double nr= Item_sum_variance::val_real();
if (isnan(nr))
if (std::isnan(nr))
{
/*
variance_fp_recurrence_next() can overflow in some cases and return "nan":
......@@ -1820,7 +1820,7 @@ double Item_sum_std::val_real()
null_value= true; // Convert "nan" to NULL
return 0;
}
if (my_isinf(nr))
if (std::isinf(nr))
return DBL_MAX;
DBUG_ASSERT(nr >= 0.0);
return sqrt(nr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment