summaryrefslogtreecommitdiff
path: root/math.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-09-02 04:47:39 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-09-02 04:47:39 +0000
commit274fa77e3f3620cbd496952f622e930ea6951f02 (patch)
tree8a8a3afc74cc716a0f638334ffe0cb965948843b /math.c
parentdc697b1905966c164ecf88a737c9c90ca95c87a8 (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.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/math.c b/math.c
index 2734280..5ce16e8 100644
--- a/math.c
+++ b/math.c
@@ -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