mirror of
https://github.com/MariaDB/server.git
synced 2025-01-27 17:33:44 +01:00
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.
This commit is contained in:
parent
3bbc30c73b
commit
bc469a0bdf
6 changed files with 5 additions and 24 deletions
|
@ -162,7 +162,6 @@
|
|||
#cmakedefine HAVE_IN_ADDR_T 1
|
||||
#cmakedefine HAVE_INITGROUPS 1
|
||||
#cmakedefine HAVE_ISNAN 1
|
||||
#cmakedefine HAVE_ISINF 1
|
||||
#cmakedefine HAVE_LARGE_PAGE_OPTION 1
|
||||
#cmakedefine HAVE_LDIV 1
|
||||
#cmakedefine HAVE_LRAND48 1
|
||||
|
|
|
@ -481,16 +481,6 @@ CHECK_SYMBOL_EXISTS(log2 math.h HAVE_LOG2)
|
|||
CHECK_SYMBOL_EXISTS(isnan math.h HAVE_ISNAN)
|
||||
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 endianness
|
||||
#
|
||||
|
|
|
@ -833,19 +833,11 @@ inline unsigned long long my_double2ulonglong(double d)
|
|||
#endif
|
||||
#define my_isnan(x) isnan(x)
|
||||
|
||||
#ifndef HAVE_ISINF
|
||||
#define isinf(X) (!isfinite(X) && !isnan(X))
|
||||
#endif
|
||||
#define my_isinf(X) isinf(X)
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include <cmath>
|
||||
#ifndef isnan
|
||||
#define isnan(X) std::isnan(X)
|
||||
#endif
|
||||
#ifndef isinf
|
||||
#define isinf(X) std::isinf(X)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Define missing math constants. */
|
||||
|
|
|
@ -4705,7 +4705,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;
|
||||
|
|
|
@ -2509,12 +2509,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)
|
||||
{
|
||||
|
|
|
@ -2041,7 +2041,7 @@ double Item_sum_std::val_real()
|
|||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
double nr= Item_sum_variance::val_real();
|
||||
if (my_isinf(nr))
|
||||
if (std::isinf(nr))
|
||||
return DBL_MAX;
|
||||
DBUG_ASSERT(nr >= 0.0);
|
||||
return sqrt(nr);
|
||||
|
|
Loading…
Add table
Reference in a new issue