Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upJP22: 20.2.2.26 Math.pow(1, inf) and Math.pow(1, -inf) #196
Comments
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
anba
Nov 17, 2015
Contributor
This is a known difference between ECMAScript and IEEE 754-2008. The first ECMAScript edition (released 1997) used the definitions from fdlibm (i.e. Math.pow(± 1, ± Infinity) = NaN), whereas C99 (and later IEEE 754-2008) chose to use Math.pow(± 1, ± Infinity) = 1.
|
This is a known difference between ECMAScript and IEEE 754-2008. The first ECMAScript edition (released 1997) used the definitions from fdlibm (i.e. Math.pow(± 1, ± Infinity) = NaN), whereas C99 (and later IEEE 754-2008) chose to use Math.pow(± 1, ± Infinity) = 1. |
bterlson
closed this
Dec 2, 2015
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
anba
Dec 2, 2015
Contributor
We should probably add a note to Math.pow to point out the definition differs from IEEE 754-2008.
|
We should probably add a note to Math.pow to point out the definition differs from IEEE 754-2008. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
bterlson
Dec 2, 2015
Member
Agreed. Note:
The result of `Math.pow(x, y)` when abs(_x_) is 1 and _y_ is *+Infinity* or *-Infinity* differs from IEEE 754-2008 for historical reasons. The first edition of ECMAScript specified a result of *NaN* for this operation, whereas later versions of IEEE 754-2008 specified *1*. The historical ECMAScript behavior is preserved for compatibility reasons.
|
Agreed. Note: The result of `Math.pow(x, y)` when abs(_x_) is 1 and _y_ is *+Infinity* or *-Infinity* differs from IEEE 754-2008 for historical reasons. The first edition of ECMAScript specified a result of *NaN* for this operation, whereas later versions of IEEE 754-2008 specified *1*. The historical ECMAScript behavior is preserved for compatibility reasons. |
added a commit
that referenced
this issue
Dec 2, 2015
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
Editorial nit: drop the last "reasons" |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
bterlson
Dec 2, 2015
Member
I didn't like it either, I think the text I committed is better in this respect :)
|
I didn't like it either, I think the text I committed is better in this respect :) |
akr commentedNov 17, 2015
The section, "20.2.2.26 Math.pow(x, y)" defines Math.pow(1, inf) and Math.pow(1, -inf) as follows.
| If abs(x) is 1 and y is +inf, the result is NaN.
| If abs(x) is 1 and y is -inf, the result is NaN.
Is it appropriate?
They can be considered as 1.