]> git.kaiwu.me - njs.git/commitdiff
Removed checking for range errors in Math.hypot().
authorValentin Bartenev <vbart@nginx.com>
Wed, 16 Nov 2016 09:49:53 +0000 (12:49 +0300)
committerValentin Bartenev <vbart@nginx.com>
Wed, 16 Nov 2016 09:49:53 +0000 (12:49 +0300)
It seems other interpreters do not return an exception in this case.

njs/njs_math.c

index 66fc6a0f033791c49ecc9cb5ac98aa39afeaee12..2281e276f943e7932ce2e4c9002786daa0f67d56 100644 (file)
@@ -19,7 +19,6 @@
 #include <njs_object.h>
 #include <njs_function.h>
 #include <math.h>
-#include <errno.h>
 
 
 static njs_ret_t
@@ -216,14 +215,7 @@ njs_object_math_hypot(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs,
     for (i = 2; i < nargs; i++) {
         num = hypot(num, args[i].data.u.number);
 
-        if (num == HUGE_VAL) {
-            /* HUGE_VAL is equal to INFINITY on IEEE-754 systems. */
-
-            if (nxt_slow_path(errno == ERANGE)) {
-                vm->exception = &njs_exception_range_error;
-                return NXT_ERROR;
-            }
-
+        if (num == INFINITY) {
             break;
         }
     }