New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JP22: 20.2.2.26 Math.pow(1, inf) and Math.pow(1, -inf) #196

Closed
akr opened this Issue Nov 17, 2015 · 5 comments

Comments

Projects
None yet
4 participants
@akr

akr commented Nov 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.

@anba

This comment has been minimized.

Show comment
Hide comment
@anba

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.

Contributor

anba commented Nov 17, 2015

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.

@anba

This comment has been minimized.

Show comment
Hide comment
@anba

anba Dec 2, 2015

Contributor

We should probably add a note to Math.pow to point out the definition differs from IEEE 754-2008.

Contributor

anba commented Dec 2, 2015

We should probably add a note to Math.pow to point out the definition differs from IEEE 754-2008.

@bterlson

This comment has been minimized.

Show comment
Hide comment
@bterlson

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.

Member

bterlson commented Dec 2, 2015

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.

@domenic

This comment has been minimized.

Show comment
Hide comment
@domenic

domenic Dec 2, 2015

Member

Editorial nit: drop the last "reasons"

Member

domenic commented Dec 2, 2015

Editorial nit: drop the last "reasons"

@bterlson

This comment has been minimized.

Show comment
Hide comment
@bterlson

bterlson Dec 2, 2015

Member

I didn't like it either, I think the text I committed is better in this respect :)

Member

bterlson commented Dec 2, 2015

I didn't like it either, I think the text I committed is better in this respect :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment