Commit b87bfe73 authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto

Merge pull request #2182 from cremno/use-isfinite

simply use `isfinite`
parents 4be6f1c7 86cfcd20
......@@ -60,6 +60,7 @@ typedef short mrb_sym;
# define snprintf _snprintf
# if _MSC_VER < 1800
# include <float.h>
# define isfinite(n) _finite(n)
# define isnan _isnan
# define isinf(n) (!_finite(n) && !_isnan(n))
# define signbit(n) (_copysign(1.0, (n)) < 0.0)
......
......@@ -999,7 +999,7 @@ retry:
char fbuf[32];
fval = mrb_float(mrb_Float(mrb, val));
if (isnan(fval) || isinf(fval)) {
if (!isfinite(fval)) {
const char *expr;
const int elen = 3;
......
......@@ -309,7 +309,7 @@ flodivmod(mrb_state *mrb, mrb_float x, mrb_float y, mrb_float *divp, mrb_float *
}
else {
mod = fmod(x, y);
if (isinf(x) && !isinf(y) && !isnan(y))
if (isinf(x) && isfinite(y))
div = x;
else
div = (x - mod) / y;
......@@ -495,7 +495,7 @@ flo_finite_p(mrb_state *mrb, mrb_value num)
{
mrb_float value = mrb_float(num);
return mrb_bool_value(!(isinf(value) || isnan(value)));
return mrb_bool_value(isfinite(value));
}
/* 15.2.9.3.10 */
......@@ -626,7 +626,7 @@ flo_round(mrb_state *mrb, mrb_value num)
}
if (ndigits > 0) {
if (isinf(number) || isnan(number)) return num;
if (!isfinite(number)) return num;
return mrb_float_value(mrb, number);
}
return mrb_fixnum_value((mrb_int)number);
......
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