diff --git a/ChangeLog b/ChangeLog index 93a705c628..4a7011329b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Sun Jan 17 19:24:25 2010 Nobuyoshi Nakada + + * math.c (domain_check): check errno first. + Sun Jan 17 14:24:35 2010 Nobuyoshi Nakada * ext/iconv/iconv.c (rb_str_derive): use long. diff --git a/math.c b/math.c index 4d294bfbbb..bc6b7eb333 100644 --- a/math.c +++ b/math.c @@ -27,10 +27,10 @@ extern VALUE rb_to_float(VALUE val); static void domain_check(double x, double y, const char *msg) { - if (!isnan(y)) return; - else if (isnan(x)) return; - else { - if (!errno) { + if (!errno) { + if (!isnan(y)) return; + else if (isnan(x)) return; + else { #if defined(EDOM) errno = EDOM; #else