diff options
| author | Sergey Vojtovich <svoj@mariadb.org> | 2018-05-23 18:52:55 +0400 |
|---|---|---|
| committer | Vlad Lesin <vlad_lesin@mail.ru> | 2019-11-18 15:30:13 +0300 |
| commit | cdcabc6f6fbdd16756cf8c89c3af300a5bc64660 (patch) | |
| tree | 830d7280b6b756f6f035c8645f576c44369bdd50 | |
| parent | fe7d354be5b9d15466686f00f1a798b97749c56c (diff) | |
| download | mariadb-git-bb-10.2-MDEV-21050-isnan-isinf-isfinite-ported.tar.gz | |
Use std::isfinite in C++ codebb-10.2-MDEV-21050-isnan-isinf-isfinite-ported
This is addition to parent revision fixing build failures.
(cherry picked from commit 54999f4e75f42baca484ae436b382ca8817df1dd)
| -rw-r--r-- | include/my_global.h | 11 | ||||
| -rw-r--r-- | sql/field.cc | 2 | ||||
| -rw-r--r-- | sql/item_func.h | 2 | ||||
| -rw-r--r-- | sql/item_strfunc.cc | 2 | ||||
| -rw-r--r-- | storage/innobase/gis/gis0geo.cc | 2 | ||||
| -rw-r--r-- | storage/innobase/gis/gis0rtree.cc | 2 |
6 files changed, 5 insertions, 16 deletions
diff --git a/include/my_global.h b/include/my_global.h index 3246d60a57b..8103f82a7e2 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -815,17 +815,6 @@ inline unsigned long long my_double2ulonglong(double d) #include <cmath> #endif -#ifndef isfinite -#ifdef HAVE_FINITE -#define isfinite(x) finite(x) -#else -#define finite(x) (1.0 / fabs(x) > 0.0) -#endif /* HAVE_FINITE */ -#elif (__cplusplus >= 201103L) -#include <cmath> -static inline bool isfinite(double x) { return std::isfinite(x); } -#endif /* isfinite */ - /* Define missing math constants. */ #ifndef M_PI #define M_PI 3.14159265358979323846 diff --git a/sql/field.cc b/sql/field.cc index 916d72da468..09e82acb009 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -2904,7 +2904,7 @@ int Field_decimal::store(double nr) return 1; } - if (!isfinite(nr)) // Handle infinity as special case + if (!std::isfinite(nr)) // Handle infinity as special case { overflow(nr < 0.0); return 1; diff --git a/sql/item_func.h b/sql/item_func.h index 1193daea106..496109b0e24 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -241,7 +241,7 @@ public: */ inline double check_float_overflow(double value) { - return isfinite(value) ? value : raise_float_overflow(); + return std::isfinite(value) ? value : raise_float_overflow(); } /** Throw an error if the input BIGINT value represented by the diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index dcfbd272809..8738af7ac56 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -2655,7 +2655,7 @@ String *Item_func_format::val_str_ascii(String *str) return 0; /* purecov: inspected */ nr= my_double_round(nr, (longlong) dec, FALSE, FALSE); str->set_real(nr, dec, &my_charset_numeric); - if (!isfinite(nr)) + if (!std::isfinite(nr)) return str; str_length=str->length(); } diff --git a/storage/innobase/gis/gis0geo.cc b/storage/innobase/gis/gis0geo.cc index bd601c2e19e..cad3877d3e9 100644 --- a/storage/innobase/gis/gis0geo.cc +++ b/storage/innobase/gis/gis0geo.cc @@ -367,7 +367,7 @@ mbr_join_square( /* Check if finite (not infinity or NaN), so we don't get NaN in calculations */ - if (!isfinite(square)) { + if (!std::isfinite(square)) { return DBL_MAX; } diff --git a/storage/innobase/gis/gis0rtree.cc b/storage/innobase/gis/gis0rtree.cc index a9c30ae2a38..ce1749820c3 100644 --- a/storage/innobase/gis/gis0rtree.cc +++ b/storage/innobase/gis/gis0rtree.cc @@ -1969,7 +1969,7 @@ rtr_estimate_n_rows_in_range( mtr_commit(&mtr); mem_heap_free(heap); - if (!isfinite(area)) { + if (!std::isfinite(area)) { return(HA_POS_ERROR); } |
