From 819336908551b9fa1d2658605a9e06d2e38904ee Mon Sep 17 00:00:00 2001 From: Yonggang Luo Date: Tue, 16 Feb 2021 13:31:01 +0000 Subject: [PATCH] Fixes asinh and atanh on mingw MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit test262/test/built-ins/Math/asinh/asinh-specialVals.js:11: Test262Error: Math.asinh should produce +0 for +0 Expected SameValue(«-Infinity», «Infinity») to be true test262/test/built-ins/Math/asinh/asinh-specialVals.js:11: strict mode: Test262Error: Math.asinh should produce +0 for +0 Expected SameValue(«-Infinity», «Infinity») to be true test262/test/built-ins/Math/atanh/atanh-specialVals.js:21: Test262Error: Math.atanh should produce -0 for -0 Expected SameValue(«Infinity», «-Infinity») to be true test262/test/built-ins/Math/atanh/atanh-specialVals.js:21: strict mode: Test262Error: Math.atanh should produce -0 for -0 Expected SameValue(«Infinity», «-Infinity») to be true --- quickjs.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/quickjs.c b/quickjs.c index 418041843..c7d1fc3bb 100644 --- a/quickjs.c +++ b/quickjs.c @@ -41770,6 +41770,22 @@ static double js_ceil(double a) return ceil(a); } +static double js_asinh(double a) +{ + if (a == 0) { + return a; + } + return asinh(a); +} + +static double js_atanh(double a) +{ + if (a == 0) { + return a; + } + return atanh(a); +} + static const JSCFunctionListEntry js_math_funcs[] = { JS_CFUNC_MAGIC_DEF("min", 2, js_math_min_max, 0 ), JS_CFUNC_MAGIC_DEF("max", 2, js_math_min_max, 1 ), @@ -41796,8 +41812,8 @@ static const JSCFunctionListEntry js_math_funcs[] = { JS_CFUNC_SPECIAL_DEF("sinh", 1, f_f, sinh ), JS_CFUNC_SPECIAL_DEF("tanh", 1, f_f, tanh ), JS_CFUNC_SPECIAL_DEF("acosh", 1, f_f, acosh ), - JS_CFUNC_SPECIAL_DEF("asinh", 1, f_f, asinh ), - JS_CFUNC_SPECIAL_DEF("atanh", 1, f_f, atanh ), + JS_CFUNC_SPECIAL_DEF("asinh", 1, f_f, js_asinh ), + JS_CFUNC_SPECIAL_DEF("atanh", 1, f_f, js_atanh ), JS_CFUNC_SPECIAL_DEF("expm1", 1, f_f, expm1 ), JS_CFUNC_SPECIAL_DEF("log1p", 1, f_f, log1p ), JS_CFUNC_SPECIAL_DEF("log2", 1, f_f, log2 ),