summaryrefslogtreecommitdiff
path: root/math.c
diff options
context:
space:
mode:
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 2734280b32..5ce16e805e 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