Skip to content
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

Editorial: Add NaN to exponent values whose behavior deviates from IEEE 754-2008 #1609

Open
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
6 participants
@Ashbringer7077
Copy link

commented Jul 3, 2019

…or deviates from IEEE 754-2008

This oversight was discovered and reported to me by James Clark (jjc@jclark.com).

Informative: (Exponentiation) Add NaN to exponent values whose behavi…
…or deviates from IEEE 754-2008

This oversight was discovered and reported to me by James Clark (jjc@jclark.com).

@ljharb ljharb changed the title Informative: (Exponentiation) Add NaN to exponent values whose behavi… Editorial: Add NaN to exponent values whose behavior deviates from IEEE 754-2008 Jul 3, 2019

@@ -13615,7 +13615,7 @@ <h1>Applying the `**` Operator</h1>
<li>If _base_ &lt; 0 and _base_ is finite and _exponent_ is finite and _exponent_ is not an integer, the result is *NaN*.</li>
</ul>
<emu-note>
<p>The result of _base_ `**` _exponent_ when _base_ is *1* or *-1* and _exponent_ is *+Infinity* or *-Infinity* differs from IEEE 754-2008. 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 behaviour is preserved for compatibility reasons.</p>
<p>The result of _base_ `**` _exponent_ when _base_ is *1* or *-1* and _exponent_ is *+Infinity*, *-Infinity* or *NaN* differs from IEEE 754-2008. 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 behaviour is preserved for compatibility reasons.</p>

This comment has been minimized.

Copy link
@ljharb

ljharb Jul 3, 2019

Member
Suggested change
<p>The result of _base_ `**` _exponent_ when _base_ is *1* or *-1* and _exponent_ is *+Infinity*, *-Infinity* or *NaN* differs from IEEE 754-2008. 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 behaviour is preserved for compatibility reasons.</p>
<p>The result of _base_ `**` _exponent_ when _base_ is *1* or *-1* and _exponent_ is *+Infinity*, *-Infinity*, or *NaN* differs from IEEE 754-2008. 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 behaviour is preserved for compatibility reasons.</p>

This comment was marked as resolved.

Copy link
@leobalter

leobalter Jul 3, 2019

Member

the comma in the suggestion is fine, but spec should use Oxford English, so behaviour should not be changed.

This comment was marked as resolved.

Copy link
@ljharb

ljharb Jul 3, 2019

Member

ah, fair enough - there's 125 current uses of the "u" and 1 use without. I'll update the suggestion.

@waldemarhorwat

This comment has been minimized.

Copy link

commented Jul 3, 2019

The new wording is incorrect. IEEE 754-2008 does not specify that -1 ** NaN is 1. The result of that exponentiation is still NaN in IEEE 754-2008, which matches what ECMAScript is doing.

@apaprocki

This comment has been minimized.

Copy link
Contributor

commented Jul 4, 2019

The new wording is incorrect. IEEE 754-2008 does not specify that -1 ** NaN is 1.

Agreed. If my reading of Section 9.2.1 is correct, this would break out the two cases:

The result of _base_ `**` _exponent_ 
when _base_ is *1* and _exponent_ is *+Infinity*, *-Infinity* or *NaN*; or
when _base_ is *-1* and _exponent_ is *+Infinity* or *-Infinity* differs ...

I'm not sure if there is a cleaner way to write those two conditions with inline lists in one phrase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.