diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-09-02 04:47:39 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-09-02 04:47:39 +0000 |
commit | 274fa77e3f3620cbd496952f622e930ea6951f02 (patch) | |
tree | 8a8a3afc74cc716a0f638334ffe0cb965948843b /math.c | |
parent | dc697b1905966c164ecf88a737c9c90ca95c87a8 (diff) |
* math.c (domain_check): simplified.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24737 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'math.c')
-rw-r--r-- | math.c | 15 |
1 files changed, 6 insertions, 9 deletions
@@ -25,21 +25,18 @@ extern VALUE rb_to_float(VALUE val); static void domain_check(double x, double y, const char *msg) { - while(1) { - if (errno) { - rb_sys_fail(msg); - } - if (isnan(y)) { - if (isnan(x)) break; + if (!isnan(y)) return; + else if (isnan(x)) return; + else { + if (!errno) { #if defined(EDOM) errno = EDOM; -#elif defined(ERANGE) +#else errno = ERANGE; #endif - continue; } - break; } + rb_sys_fail(msg); } static void |