summaryrefslogtreecommitdiff
path: root/math.c
diff options
context:
space:
mode:
Diffstat (limited to 'math.c')
-rw-r--r--math.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/math.c b/math.c
index 9a6d459797..d8a0230fc5 100644
--- a/math.c
+++ b/math.c
@@ -29,20 +29,17 @@ domain_check(x, msg)
double x;
const char *msg;
{
- while(1) {
- if (errno) {
- rb_sys_fail(msg);
- }
- if (isnan(x)) {
+ 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);
}