-
Notifications
You must be signed in to change notification settings - Fork 41
/
machine.html
302 lines (265 loc) · 7.61 KB
/
machine.html
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
<html>
<head>
<title>
MACHINE - Table of Machine Constants
</title>
</head>
<body bgcolor="#EEEEEE" link="#CC0000" alink="#FF3300" vlink="#000055">
<h1 align = "center">
MACHINE <br> Table of Machine Constants
</h1>
<hr>
<p>
<b>MACHINE</b>
is a C++ library which
returns machine constants, particularly those related to arithmetic
with single precision real and double precision real quantities.
</p>
<h3 align = "center">
MACHINE must be reset for your computer
</h3>
<p>
MACHINE is not an "intelligent" program; it's simply a way to
store and retrieve the information necessary to describe the arithmetic
performed on a given computer. Therefore, if you plan to use
MACHINE on a particular kind of computer, you must verify
that the values being returned are appropriate.
</p>
<p>
One way to do this is to run the program <b>MACHAR</b> which is an
"intelligent" program that actually tries to determine machine arithmetic
properties dynamically.
</p>
<h3 align = "center">
MACHINE's arithmetic assumptions
</h3>
<p>
<b>MACHINE</b> uses some simple conventions to describe how
integers and real numbers are stored on an arbitrary computer.
</p>
<p>
<b>MACHINE</b> assumes that integers are represented using <b>S</b> digits
in base <b>A</b>:
<blockquote><b>
Sign * ( X(S-1)*A^(S-1) + ... + X(1)*A + X(0))
</b></blockquote>
</p>
<p>
<b>MACHINE</b> assumes that real numbers are represented using a
mantissa <b>T</b>, base <b>B</b> and exponent <b>E</b> as:
<blockquote><b>
Sign * T * B<sup>E</sup>
</b></blockquote>
</p>
<h3 align = "center">
What MACHINE can return
</h3>
<p>
<b>D1MACH</b> returns quantities associated with double precision
arithmetic, including:
<ol>
<li>
<b>B^(EMIN-1)</b>, the smallest positive magnitude.
</li>
<li>
<b>B^EMAX*(1-B^(-T))</b>, the largest magnitude.
</li>
<li>
<b>B^(-T)</b>, the smallest relative spacing.
</li>
<li>
<b>B^(1-T)</b>, the largest relative spacing.
</li>
<li>
<b>log10(B)</b>
</li>
</ol>
</p>
<p>
<b>I1MACH</b> returns quantities associated with integer arithmetic,
as well as some integer quantities associated with real and
double precision arithmetic, and other machine-specific information.
<ol>
<li>
the standard input unit.
</li>
<li>
the standard output unit.
</li>
<li>
the standard punch unit.
</li>
<li>
the standard error message unit.
</li>
<li>
the number of bits per integer storage unit.
</li>
<li>
the number of characters per integer storage unit.
</li>
<li>
<b>A</b>, the base for integers.
</li>
<li>
<b>S</b>, the number of base <b>A</b> digits in an integer.
</li>
<li>
<b>A^S-1</b>, the largest integer.
</li>
<li>
<b>B</b>, the base for single and double precision numbers.
</li>
<li>
<b>T</b>, the number of base <b>B</b> digits for single precision.
</li>
<li>
<b>EMIN</b>, the smallest exponent <b>E</b> for single precision.
</li>
<li>
<b>EMAX</b>, the largest exponent <b>E</b> for single precision.
</li>
<li>
<b>T</b>, the number of base <b>B</b> digits for double precision.
</li>
<li>
<b>EMIN</b>, the smallest exponent <b>E</b> for double precision.
</li>
<li>
<b>EMAX</b>, the largest exponent <b>E</b> for double precision.
</li>
</ol>
<p>
<p>
<b>R1MACH</b> returns quantities associated with single precision
arithmetic, including:
<ol>
<li>
<b>B^(EMIN-1)</b>, the smallest positive magnitude.
</li>
<li>
<b>B^EMAX*(1-B^(-T))</b>, the largest magnitude.
</li>
<li>
<b>B^(-T)</b>, the smallest relative spacing.
</li>
<li>
<b>B^(1-T)</b>, the largest relative spacing.
</li>
<li>
<b>log10(B)</b>
</li>
</ol>
</p>
<h3 align = "center">
Licensing:
</h3>
<p>
The computer code and data files described and made available on this web page
are distributed under
<a href = "../../txt/gnu_lgpl.txt">the GNU LGPL license.</a>
</p>
<h3 align = "center">
Languages:
</h3>
<p>
<b>MACHINE</b> is available in
<a href = "../../c_src/machine/machine.html">a C version</a> and
<a href = "../../cpp_src/machine/machine.html">a C++ version</a> and
<a href = "../../f77_src/machine/machine.html">a FORTRAN77 version</a> and
<a href = "../../f_src/machine/machine.html">a FORTRAN90 version</a> and
<a href = "../../m_src/machine/machine.html">a MATLAB version</a> and
<a href = "../../py_src/machine/machine.html">a Python version</a>.
</p>
<h3 align = "center">
Related Data and Programs:
</h3>
<p>
<a href = "../../cpp_src/machar/machar.html">
MACHAR</a>,
a C++ library which
can compute machine arithmetic quantities dynamically.
</p>
<h3 align = "center">
Reference:
</h3>
<p>
<ol>
<li>
Phyllis Fox, Andrew Hall, Norman Schryer,<br>
Algorithm 528:
Framework for a Portable Library,<br>
ACM Transactions on Mathematical Software,<br>
Volume 4, Number 2, June 1978, page 176-188.
</li>
<li>
<a href = "http://www.netlib.org/toms/528">
http://www.netlib.org/toms/528 </a> <br>
the NETLIB web site for ACM TOMS algorithms.
</li>
</ol>
</p>
<h3 align = "center">
Source Code:
</h3>
<p>
<ul>
<li>
<a href = "machine.cpp">machine.cpp</a>, the source code.
</li>
<li>
<a href = "machine.hpp">machine.hpp</a>, the include file.
</li>
<li>
<a href = "machine.sh">machine.sh</a>,
commands to compile the source code.
</li>
</ul>
</p>
<h3 align = "center">
Examples and Tests:
</h3>
<p>
<ul>
<li>
<a href = "machine_prb.cpp">machine_prb.cpp</a>,
a sample calling program.
</li>
<li>
<a href = "machine_prb.sh">machine_prb.sh</a>,
commands to compile and run the sample program.
</li>
<li>
<a href = "machine_prb_output.txt">machine_prb_output.txt</a>,
the output from a run of the sample program.
</li>
</ul>
</p>
<h3 align = "center">
List of Routines:
</h3>
<p>
<ul>
<li>
<b>D1MACH</b> returns double precision machine constants.
</li>
<li>
<b>I1MACH</b> returns integer machine constants.
</li>
<li>
<b>R1MACH</b> returns single precision machine constants.
</li>
</ul>
</p>
<p>
You can go up one level to <a href = "../cpp_src.html">
the C++ source codes</a>.
</p>
<hr>
<i>
Last revised on 24 April 2007.
</i>
<!-- John Burkardt -->
</body>
<!-- Initial HTML skeleton created by HTMLINDEX. -->
</html>