diff options
author | Jeff Walden <jwalden@mit.edu> | 2018-02-14 14:02:39 -0800 |
---|---|---|
committer | Leo Balter <leonardo.balter@gmail.com> | 2018-02-14 17:02:39 -0500 |
commit | a19993e2691b2420dade202db26e022e44436a86 (patch) | |
tree | b71d1a9333aa93a117da4b7d4485b92b8101cb6d /test/language | |
parent | 8342824894d7c11788cb454ab388fced6d4f7831 (diff) | |
download | qtdeclarative-testsuites-a19993e2691b2420dade202db26e022e44436a86.tar.gz |
Add tests for the behavior of INT32_MIN (-2147483648) as exponent with the exponentiation operator and with Math.pow (which shares the same core algorithm in the spec, but might be differently implemented in actual implementations). (#1445)
Diffstat (limited to 'test/language')
-rw-r--r-- | test/language/expressions/exponentiation/int32_min-exponent.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/language/expressions/exponentiation/int32_min-exponent.js b/test/language/expressions/exponentiation/int32_min-exponent.js new file mode 100644 index 000000000..556c8885c --- /dev/null +++ b/test/language/expressions/exponentiation/int32_min-exponent.js @@ -0,0 +1,18 @@ +// Copyright (C) 2018 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-applying-the-exp-operator +description: > + Using -(2**31) as exponent with the exponentiation operator should behave + as expected. +---*/ + +const INT32_MIN = -2147483648; + +assert.sameValue(2**INT32_MIN, +0.0, + "2**-(gonzo huge exponent > 1074) should be +0 because " + + "2**-1074 is the smallest positive IEEE-754 number"); + +assert.sameValue(1**INT32_MIN, 1, + "1**-(gonzo huge exponent > 1074) should be 1"); |