File: constants_inf.html

package info (click to toggle)
freemat 4.0-3
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 174,756 kB
  • ctags: 67,023
  • sloc: cpp: 351,059; ansic: 255,892; sh: 40,590; makefile: 4,387; perl: 4,058; asm: 3,313; pascal: 2,718; fortran: 1,722; ada: 1,681; ml: 1,360; cs: 879; csh: 795; python: 430; sed: 162; lisp: 160; awk: 5
file content (105 lines) | stat: -rw-r--r-- 1,871 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

<HTML>
<HEAD>
<TITLE>INF Infinity Constant
</TITLE>
</HEAD>
<BODY>
<H2>INF Infinity Constant
</H2>
<P>
Section: <A HREF=sec_constants.html> Base Constants </A>
<H3>Usage</H3>
Returns a value that represents positive infinity 
for both 32 and 64-bit floating point values. 
There are several forms for the <code>Inf</code> function.
The first form returns a double precision <code>Inf</code>.
<PRE>
   y = inf
</PRE>
<P>
The next form takes a class name that can be either <code>'double'</code> 
<PRE>
   y = inf('double')
</PRE>
<P>
or <code>'single'</code>:
<PRE>
   y = inf('single')
</PRE>
<P>
With a single parameter it generates a square matrix of <code>inf</code>s.
<PRE>
   y = inf(n)
</PRE>
<P>
Alternatively, you can specify the dimensions of the array via
<PRE>
   y = inf(m,n,p,...)
</PRE>
<P>
or
<PRE>
   y = inf([m,n,p,...])
</PRE>
<P>
Finally, you can add a classname of either <code>'single'</code> or <code>'double'</code>.
<H3>Function Internals</H3>
The infinity constant has
several interesting properties.  In particular:
<P>
<DIV ALIGN="CENTER">
<IMG SRC="inf_eqn1.png">
</DIV>
<P>
Note that infinities are not preserved under type conversion to integer types (see the examples below).
<H3>Example</H3>
The following examples demonstrate the various properties of the infinity constant.
<PRE>
--&gt; inf*0

ans = 
 NaN 

--&gt; inf*2

ans = 
 Inf 

--&gt; inf*-2

ans = 
 -Inf 

--&gt; inf/inf

ans = 
 NaN 

--&gt; inf/0

ans = 
 Inf 

--&gt; inf/nan

ans = 
 NaN 
</PRE>
<P>
Note that infinities are preserved under type conversion to floating point types (i.e., <code>float</code>, <code>double</code>, <code>complex</code> and <code>dcomplex</code> types), but not integer  types.
<PRE>
--&gt; uint32(inf)

ans = 
 4294967295 

--&gt; complex(inf)

ans = 
 Inf 
</PRE>
<P>
</BODY>
</HTML>