Difference between revisions of "NaN"

From Lazarus wiki
Jump to navigationJump to search
(formatting; add note only for floating point numbers; http_s_ links to documentation)
m (syntaxhighlight)
Line 1: Line 1:
 
{{NaN}}
 
{{NaN}}
  
<code>NaN</code> (not a number) is a numeric data type value representing an undefined or unrepresentable value.
+
<syntaxhighlight lang="pascal" enclose="none">NaN</syntaxhighlight> (not a number) is a numeric data type value representing an undefined or unrepresentable value.
 
These values result from operations which have undefined numerical results.
 
These values result from operations which have undefined numerical results.
<code>NaN</code> is not the same as infinity.
+
<syntaxhighlight lang="pascal" enclose="none">NaN</syntaxhighlight> is not the same as infinity.
  
<syntaxhighlight>
+
<syntaxhighlight lang="pascal" line start="0" highlight="3-4">
 
program NotANumber(input, output, stderr);
 
program NotANumber(input, output, stderr);
 
begin
 
begin
Line 13: Line 13:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Note, <code>NaN</code> exists only in the context of floating point number calculations:
+
Note, <syntaxhighlight lang="pascal" enclose="none">NaN</syntaxhighlight> exists only in the context of floating point number calculations:
<code>0 div 0</code> (integer division) is not allowed, though.
+
<syntaxhighlight lang="pascal" enclose="none">0 div 0</syntaxhighlight> ([[Div|integer division]]) is not allowed, though.
  
 
== See also ==
 
== See also ==

Revision as of 17:50, 11 February 2018

English (en) suomi (fi) русский (ru)

NaN (not a number) is a numeric data type value representing an undefined or unrepresentable value. These values result from operations which have undefined numerical results. NaN is not the same as infinity.

0program NotANumber(input, output, stderr);
1begin
2	// writes 'Nan' (with spacing) on its own line
3	writeLn(0/0);
4end.

Note, NaN exists only in the context of floating point number calculations: 0 div 0 (integer division) is not allowed, though.

See also