Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
NaN
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Function definition == There are differences of opinion about the proper definition for the result of a numeric [[subroutine|function]] that receives a quiet NaN as input. One view is that the NaN should propagate to the output of the function in all cases to propagate the indication of an error. Another view, and the one taken by the [[C99|ISO C99]] and [[IEEE 754-2008 revision|IEEE 754-2008]] standards in general, is that if the function has multiple arguments and the output is uniquely determined by all the non-NaN inputs (including infinity), then that value should be the result. Thus for example the value returned by {{code|hypot(±∞, qNaN)|class=nowrap}} and {{code|hypot(qNaN, ±∞)|class=nowrap}} is +∞. The problem is particularly acute for the [[exponentiation]] function {{nowrap|1=<code>pow(''x'', ''y'')</code> = ''x''<sup>''y''</sup>.}} The expressions 0<sup>0</sup>, ∞<sup>0</sup> and 1<sup>∞</sup> are considered [[indeterminate form]]s when they occur as limits (just like ∞ × 0), and the question of whether [[Zero to the power of zero|zero to the zero power]] should be defined as 1 has divided opinion. If the output is considered as undefined when a parameter is undefined, then {{code|pow(1, qNaN)|class=nowrap}} should produce a qNaN. However, [[C mathematical functions|math libraries]] have typically returned 1 for {{nowrap|<code>pow(1, ''y'')</code>}} for any [[real number]] ''y'', and even when ''y'' is an [[Extended real number line|infinity]]. Similarly, they produce 1 for {{nowrap|<code>pow(''x'', 0)</code>}} even when ''x'' is 0 or an infinity. {{citation needed span|date=December 2021|The rationale for returning the value 1 for the indeterminate forms was that the value of functions at singular points can be taken as a particular value if that value is in the limit the value{{Clarify|date=October 2011}} for all but a vanishingly small part of a ball around the limit value of the parameters.}} The 2008 version of the [[IEEE 754]] standard says that {{code|pow(1, qNaN)|class=nowrap}} and {{code|pow(qNaN, 0)|class=nowrap}} should both return 1 since they return 1 whatever else is used instead of quiet NaN. Moreover, ISO C99, and later IEEE 754-2008, chose to specify {{nowrap|1=<code>pow(−1, ±∞)</code> = 1}} instead of qNaN; the reason of this choice is given in the C rationale:<ref>{{cite web |url=https://www.open-std.org/jtc1/sc22/wg14/www/C99RationaleV5.10.pdf |title=Rationale for International Standard—Programming Languages—C, Revision 5.10 |date=April 2003 |page=180}}</ref> "Generally, C99 eschews a NaN result where a numerical value is useful. ... The result of {{code|pow(−2, ∞)|class=nowrap}} is +∞, because all large positive floating-point values are even integers." To satisfy those wishing a more strict interpretation of how the power function should act, the 2008 standard defines two additional power functions: {{nowrap|<code>pown(''x'', ''n'')</code>,}} where the exponent must be an integer, and {{nowrap|<code>powr(''x'', ''y'')</code>,}} which returns a NaN whenever a parameter is a NaN or the exponentiation would give an [[indeterminate form]].
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
NaN
(section)
Add topic