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!
=== Operations generating NaN === There are three kinds of operations that can return NaN:<ref>{{cite web|url=http://citeseer.ist.psu.edu/viewdoc/summary?doi=10.1.1.39.2736|author=David Goldberg|title= What Every Computer Scientist Should Know About Floating-Point|year=1991}}</ref> * Most operations with at least one NaN operand. * [[Indeterminate form]]s: ** The divisions {{math|(Β±0) / (Β±0)}} and {{math|(Β±β) / (Β±β)}}. ** The multiplications {{math|(Β±0) Γ (Β±β)}} and {{math|(Β±β) Γ (Β±0)}}. ** Remainder {{math|''x'' % ''y''}} when {{math|''x''}} is an infinity or {{math|''y''}} is zero. ** The additions {{math|(+β) + (−β)}}, {{math|(−β) + (+β)}} and equivalent subtractions {{math|(+β) − (+β)}} and {{math|(−β) − (−β)}}. ** The standard has alternative functions for powers: *** The standard {{code|pow}} function and the integer exponent {{code|pown}} function define {{math|[[zero to the power of zero|0<sup>0</sup>]]}}, {{math|1<sup>β</sup>}}, and {{math|β<sup>0</sup>}} as {{math|1}}. *** The {{code|powr}} function defines all three indeterminate forms as invalid operations and so returns NaN. * Real operations with [[complex number|complex]] results, for example: ** The square root of a negative number. ** The [[logarithm]] of a negative number. ** The [[Inverse trigonometric functions|inverse sine or inverse cosine]] of a number that is less than β1 or greater than 1. NaNs may also be explicitly assigned to variables, typically as a representation for missing values. Prior to the IEEE standard, programmers often used a special value (such as β99999999) to represent undefined or missing values, but there was no guarantee that they would be handled consistently or correctly.<ref name=idl/> NaNs are not necessarily generated in all the above cases. If an operation can produce an exception condition and traps are not masked then the operation will cause a trap instead.<ref>{{cite web |url=http://www.intel.com/products/processor/manuals/index.htm |title=Intel 64 and IA-32 Architectures Software Developer's Manual Volume 1: Basic Architecture |date=April 2008 |pages=118β125, 266β267, 334β335 }}</ref> If an operand is a quiet NaN, and there is also no signaling NaN operand, then there is no exception condition and the result is a quiet NaN. Explicit assignments will not cause an exception even for signaling NaNs.
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