1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

MDEV-11451: isinf || isnan -> !isfinite

There are only 3 logical states for a number. The isfinite is a
single function call rather than multiple leaving scope for compiler
/architecture optimization.

Changed the logic as follows in a few files.

my_isinf(square) || my_isnan(square) -> !isfinite(square)

Signed-off-by: Daniel Black <daniel.black@au.ibm.com>
This commit is contained in:
Daniel Black
2016-12-01 17:14:47 +11:00
parent dc9f919f27
commit b11eb36963
4 changed files with 7 additions and 6 deletions

View File

@@ -2671,7 +2671,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 (isnan(nr) || my_isinf(nr))
if (!isfinite(nr))
return str;
str_length=str->length();
}

View File

@@ -364,8 +364,9 @@ mbr_join_square(
b += 2;
} while (a != end);
/* Check for infinity or NaN, so we don't get NaN in calculations */
if (my_isinf(square) || my_isnan(square)) {
/* Check if finite (not infinity or NaN),
so we don't get NaN in calculations */
if (!isfinite(square)) {
return DBL_MAX;
}

View File

@@ -1988,7 +1988,7 @@ rtr_estimate_n_rows_in_range(
mtr_commit(&mtr);
mem_heap_free(heap);
if (my_isinf(area) || my_isnan(area)) {
if (!isfinite(area)) {
return(HA_POS_ERROR);
}

View File

@@ -69,8 +69,8 @@ static double mbr_join_square(const double *a, const double *b, int n_dim)
b += 2;
}while (a != end);
/* Check for infinity or NaN */
if (my_isinf(square) || isnan(square))
/* Check if not finite (i.e. infinity or NaN) */
if (!isfinite(square))
square = DBL_MAX;
return square;