[njs] Removed checking for range errors in Math.hypot().

Valentin Bartenev vbart at nginx.com
Wed Nov 16 09:50:41 UTC 2016


details:   http://hg.nginx.org/njs/rev/8253ecba7ad6
branches:  
changeset: 259:8253ecba7ad6
user:      Valentin Bartenev <vbart at nginx.com>
date:      Wed Nov 16 12:49:53 2016 +0300
description:
Removed checking for range errors in Math.hypot().

It seems other interpreters do not return an exception in this case.

diffstat:

 njs/njs_math.c |  10 +---------
 1 files changed, 1 insertions(+), 9 deletions(-)

diffs (27 lines):

diff -r 56bf74dccca1 -r 8253ecba7ad6 njs/njs_math.c
--- a/njs/njs_math.c	Wed Nov 16 12:49:53 2016 +0300
+++ b/njs/njs_math.c	Wed Nov 16 12:49:53 2016 +0300
@@ -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_
     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;
         }
     }



More information about the nginx-devel mailing list