Welcome! Log In Create A New Profile

Advanced

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

Valentin Bartenev
November 16, 2016 04:52AM
details: http://hg.nginx.org/njs/rev/8253ecba7ad6
branches:
changeset: 259:8253ecba7ad6
user: Valentin Bartenev <vbart@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;
}
}

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

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

Valentin Bartenev 589 November 16, 2016 04:52AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 314
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready