mirror of https://github.com/svaarala/duktape.git
Sami Vaarala
8 years ago
committed by
GitHub
14 changed files with 237 additions and 27 deletions
@ -0,0 +1,8 @@ |
|||
define: DUK_USE_ATAN2_WORKAROUNDS |
|||
introduced: 2.0.0 |
|||
default: false |
|||
tags: |
|||
- portability |
|||
description: > |
|||
Enable workarounds to common atan2() semantics issues. At least Cygwin/MinGW |
|||
has such issues, see test-bug-mingw-math-issues.js. |
@ -0,0 +1,9 @@ |
|||
define: DUK_USE_POW_WORKAROUNDS |
|||
introduced: 2.0.0 |
|||
default: false |
|||
tags: |
|||
- portability |
|||
description: > |
|||
Enable workarounds to common pow() semantics issues. At least NetBSD |
|||
6.0 x86 and Cygwin/MinGW have such issues, see test-bug-netbsd-math-pow.js |
|||
and test-bug-mingw-math-issues.js. |
@ -0,0 +1,75 @@ |
|||
/* |
|||
* Some MinGW math issues |
|||
* |
|||
* https://github.com/svaarala/duktape/pull/1099
|
|||
*/ |
|||
|
|||
/*@include util-number.js@*/ |
|||
|
|||
/*=== |
|||
1 |
|||
1 |
|||
-1e+100 |
|||
-1e+100 |
|||
NaN |
|||
NaN |
|||
NaN |
|||
NaN |
|||
0 |
|||
-0 |
|||
0 |
|||
-0 |
|||
0 |
|||
-0 |
|||
0 |
|||
-0 |
|||
NaN |
|||
NaN |
|||
NaN |
|||
NaN |
|||
NaN |
|||
NaN |
|||
0.7853981633974483 |
|||
2.356194490192345 |
|||
-0.7853981633974483 |
|||
-2.356194490192345 |
|||
1 |
|||
1 |
|||
===*/ |
|||
|
|||
function test() { |
|||
printExact((0/0) ** 0); |
|||
printExact((0/0) ** -0); |
|||
printExact((-1e100) % (1/0)); // return 1st arg if modulus is +/- inf
|
|||
printExact((-1e100) % (-1/0)); |
|||
printExact((1/0) % (1/0)); // but if 1st arg is +/- inf (and modulus +/- inf), return NaN
|
|||
printExact((1/0) % (-1/0)); |
|||
printExact((-1/0) % (1/0)); |
|||
printExact((-1/0) % (-1/0)); |
|||
printExact(0 % 1); // preserve zero and its sign, even for inf
|
|||
printExact(-0 % 1); |
|||
printExact(0 % -1); |
|||
printExact(-0 % -1); |
|||
printExact(0 % (1/0)); |
|||
printExact(-0 % (1/0)); |
|||
printExact(0 % (-1/0)); |
|||
printExact(-0 % (-1/0)); |
|||
printExact(0 % (0/0)); // ... but if modulus is NaN or 0, result is NaN
|
|||
printExact(-0 % (0/0)); |
|||
printExact(0 % 0); |
|||
printExact(-0 % 0); |
|||
printExact(0 % -0); |
|||
printExact(-0 % -0); |
|||
printExact(Math.atan2(1/0, 1/0)); |
|||
printExact(Math.atan2(1/0, -1/0)); |
|||
printExact(Math.atan2(-1/0, 1/0)); |
|||
printExact(Math.atan2(-1/0, -1/0)); |
|||
printExact(Math.pow(0/0, 0)); |
|||
printExact(Math.pow(0/0, -0)); |
|||
} |
|||
|
|||
try { |
|||
test(); |
|||
} catch (e) { |
|||
print(e.stack || e); |
|||
} |
Loading…
Reference in new issue