forked from project-jedi/jcl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path8087.dtx
445 lines (445 loc) · 15.3 KB
/
8087.dtx
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
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
@@Jcl8087.pas
Summary:
Unit Jcl8087 contains various routine for manipulating the math coprocessor.
This includes such things as querying and setting the rounding precision of
floating point operations and retrieving the coprocessor's status word.
--------------------------------------------------------------------------------
@@MathRoutines.Hardware
<GROUP MathRoutines>
<TITLE Hardware>
<TOPICORDER 600>
--------------------------------------------------------------------------------
@@T8087Exception
Summary:
An enumeration describing the set of available FPU exception masks.
Description:
An enumeration which describes the set of available FPU
exception masks. Note that you can use the All8087Exceptions
constant whenever you need a set which includes all exception
flags.
Donator:
Robert Rossmair
@@T8087Exception.emInvalidOp
Invalid operation mask.
@@T8087Exception.emDenormalizedOperand
Denormalized operation mask.
@@T8087Exception.emZeroDivide
Division by zero mask.
@@T8087Exception.emOverflow
Overflow mask.
@@T8087Exception.emUnderflow
Underflow mask.
@@T8087Exception.emPrecision
Precision error mask.
@@T8087Exceptions
<COMBINE T8087Exception>
<GROUP MathRoutines.Hardware>
--------------------------------------------------------------------------------
@@All8087Exceptions
Summary:
A set containing all FPU exception flags.
Description:
All8087Exceptions is a pre-initialized set which contains all
of the available FPU exception flags (from the T8087Exception enumeration).
Donator:
Robert Rossmair
--------------------------------------------------------------------------------
@@ClearPending8087Exceptions
<GROUP MathRoutines.Hardware>
Summary:
Clears all pending FPU exceptions.
Description:
The ClearPending8087Exceptions function clears all pending FPU exceptions.
Result:
The result is the set of exception flags that were set before the entire mask was cleared.
See also:
T8087Exceptions
GetPending8087Exceptions
Donator:
Robert Rossmair
--------------------------------------------------------------------------------
@@GetPending8087Exceptions
Summary:
Returns a set of pending FPU exception flags.
Description:
The GetPending8087Exceptions routine returns a set of flags
representing the pending FPU exceptions. Note that the
pending exceptions are not cleared. To get the pending
exceptions and clear them use the ClearPending8087Exceptions
routine.
Result:
The result is the set of pending FPU exceptions.
See also:
T8087Exceptions
ClearPending8087Exceptions
Donator:
Robert Rossmair
--------------------------------------------------------------------------------
@@GetMasked8087Exceptions
<GROUP MathRoutines.Hardware>
Summary:
Returns the set of masked FPU exceptions.
Description:
GetMasked8087Exceptions returns a set of flags representing the FPU exceptions
that are currently masked (i.e. the exceptions ignored by the FPU).
Result:
The result is the set of masked FPU exceptions.
See also
T8087Exceptions
SetMasked8087Exceptions
Unmask8087Exceptions
Mask8087Exceptions
Donator
Robert Rossmair
--------------------------------------------------------------------------------
@@SetMasked8087Exceptions
Summary:
Sets the FPU exception mask.
Description
The SetMasked8087Exceptions routine sets the masked exception
flags of the FPU's control word. In effect this means that
afterwards the FPU no longer raises an exception of the kind
included in the Exceptions parameter, instead it ignores the
error situation. Note that by default exceptions previously
masked are cleared if they do not appear in the Exception
parameter.
Parameters:
Exceptions - Set of exceptions to mask.
ClearBefore - If set to True the routine clears pending exceptions, if any, before modifying the
exception mask. This is the default behavior. If set to False the routine does not
clear pending exceptions.
Result:
The result is the exception mask before it was modified.
See also:
T8087Exceptions
GetMasked8087Exceptions
Unmask8087Exceptions
Mask8087Exceptions
Donator:
Robert Rossmair
--------------------------------------------------------------------------------
@@Mask8087Exceptions
Summary:
Masks additional exceptions.
Description:
Mask8087Exceptions masks the exceptions specified by the
Exceptions parameter. Unlike SetMasked8087Exceptions
the original exception mask is left intact. For example, if
the current exception mask equals [emInvalidOp,
emDenormalizedOperand], and you call
Mask8087Exceptions([emZeroDivide]), then upon return the
exception mask equals [emInvalidOp, emDenormalizedOperand,
emZeroDivide].
Parameters:
Exceptions - Exceptions to be masked.
Result:
The set of exceptions that were masked upon routine entry.
Upon exit the set of masked exceptions equals Result plus
Exceptions.
See also:
T8087Exceptions
Unmask8087Exceptions
GetMasked8087Exceptions
SetMasked8087Exceptions
Donator:
Robert Rossmair
--------------------------------------------------------------------------------
@@Unmask8087Exceptions
Summary:
Unmasks the specified exceptions.
Description:
The Unmask8087Exceptions routine unmasks the exceptions
specified by the Exceptions parameter. Note that exceptions
not included in the Exceptions parameter are left unchanged,
unlike SetMasked8087Exceptions which modifies the entire mask.
Parameters:
Exceptions - Exceptions to be unmasked.
ClearBefore - If set to True any pending exceptions are
cleared before the routine returns, if set to
False pending exceptions are not cleared.
Result:
The set of exceptions that were masked upon routine entry.
Upon exit the set of masked exceptions equals Result minus
Exceptions.
See also:
T8087Exceptions
Mask8087Exceptions
GetMasked8087Exceptions
SetMasked8087Exceptions
Donator:
Robert Rossmair
--------------------------------------------------------------------------------
@@T8087Precision
<GROUP MathRoutines.Hardware>
Summary:
Used for retrieving and setting the FPU precision control.
Description:
T8087Precision is an enumeration used to set and retrieve the FPU precision control.
Donator:
Marcel van Brakel
@@T8087Precision.pcSingle
Single precision (short).
@@T8087Precision.pcReserved
Reserved, never actually used (convenience).
@@T8087Precision.pcDouble
Double precision (long).
@@T8087Precision.pcExtended
Extended precision (temporary).
--------------------------------------------------------------------------------
@@T8087Rounding
<GROUP MathRoutines.Hardware>
Summary:
Enumeration used for retrieving and setting the FPU rounding control.
Description:
T8087Rounding is an enumeration used to set and retrieve the FPU rounding control.
See also:
Get8087Rounding
Set8087Rounding
Donator:
Marcel van Brakel
@@T8087Rounding.rcNearestOrEven
Rounds to the nearest or even.
@@T8087Rounding.rcDownInfinity
Rounds down towards negative infinity.
@@T8087Rounding.rcUpInfinity
Rounds up towards positive infinity.
@@T8087Rounding.rcChopOrTruncate
Chops or truncates towards zero.
--------------------------------------------------------------------------------
@@T8087Infinity
<GROUP MathRoutines.Hardware>
Summary:
Enumeration used for retrieving and setting the FPU infinity control.
Description:
T8087Infinity is an enumeration used to set and retrieve the FPU infinity control.
See also:
Set8087Infinity
Set8087Precision
Donator:
Marcel van Brakel
@@T8087Infinity.icProjective
Infinity is always assumed to be unsigned.
@@T8087Infinity.icAffine
Allows positive and negative infinity.
--------------------------------------------------------------------------------
@@Set8087Infinity
Description:
Set8087Infinity adjusts the infinity control setting of the
mathematical coprocessor.
Summary:
Sets the infinity control of the FPU.
Notes:
This setting doesn't actually affect the way the FPU works.
The infinity control flag is provided for compatibility with the
Intel 287 Math Coprocessor; it is not meaningful for later
version x87 FPU coprocessors or 32 bit Intel architecture
processors.
Parameters:
Infinity - New value for the infinity control of the FPU. See
T8087Infinity for the possible values and their meaning.
Result:
Returns the previous infinity setting of the FPU.
See also:
Set8087Precision
Set8087Rounding
Get8087Infinity
Get8087Precision
Get8087Rounding
Get8087ControlWord
Set8087ControlWord
Donator
Marcel van Brakel
--------------------------------------------------------------------------------
@@Set8087Precision
Summary:
Sets the precision control of the FPU.
Description:
Set8087Precision adjusts the precision control setting of the
mathematical coprocessor.
Parameters:
Precision - New value for the precision control of the FPU.
See T8087Precision for the possible values
and their meaning.
Result:
Returns the previous precision setting of the FPU.
See also:
Set8087Infinity
Set8087Rounding
Get8087Infinity
Get8087Precision
Get8087Rounding
Get8087ControlWord
Set8087ControlWord
Donator:
Marcel van Brakel
--------------------------------------------------------------------------------
@@Set8087Rounding
Summary:
Sets the rounding control of the FPU.
Description:
Set8087Rounding adjusts the rounding control setting of the
mathematical coprocessor.
Parameters:
Rounding - New value for the rounding control of the FPU.
See T8087Rounding for the possible values and
their meaning.
Result:
Returns the previous rounding setting of the FPU.
See also:
Set8087Infinity
Set8087Precision
Get8087Infinity
Get8087Precision
Get8087Rounding
Get8087ControlWord
Set8087ControlWord
Donator:
Marcel van Brakel
--------------------------------------------------------------------------------
@@Get8087Infinity
Summary:
Returns the infinity setting of the FPU.
Description:
Get8087Infinity returns the infinity control setting of the
mathematical coprocessor. The infinity setting controls how
the FPU interprets infinity values.
Result:
Returns the infinity setting of the FPU in the form of an enumerated
type. See T8087Infinity for the possible values and their meaning.
See also:
Get8087Precision
Get8087Rounding
Set8087Infinity
Set8087Precision
Set8087Rounding
Get8087ControlWord
Set8087ControlWord
Donator:
Marcel van Brakel
--------------------------------------------------------------------------------
@@Get8087Precision
Summary:
Returns the precision setting of the FPU.
Description:
Get8087Precision returns the precision control setting of the
mathematical coprocessor.
Result:
Returns the precision setting of the FPU. See T8087Precision
for the possible values and their meaning.
See also:
Get8087Infinity
Get8087Rounding
Set8087Infinity
Set8087Precision
Set8087Rounding
Get8087ControlWord
Set8087ControlWord
Donator:
Marcel van Brakel
--------------------------------------------------------------------------------
@@Get8087Rounding
Summary:
Returns the rounding setting of the FPU.
Description:
Get8087Rounding returns the rounding control setting of the
mathematical coprocessor.
Result:
Returns the rounding setting of the FPU. See T8087Rounding for
more information about the possible values and their meaning.
See also:
Get8087Infinity
Get8087Precision
Set8087Infinity
Set8087Precision
Set8087Rounding
Get8087ControlWord
Set8087ControlWord
Donator:
Marcel van Brakel
--------------------------------------------------------------------------------
@@Set8087ControlWord
Summary:
Sets the 80x87 control word.
Description:
Set8087ControlWord sets the 80x87 control word (register).
See Get8087ControlWord for details on the individual
bits of the Control parameter.
Parameters:
Control - New value for the 80x87 control word.
Result:
Returns the previous value of the control word.
See also:
Get8087ControlWord
Get8087StatusWord
Donator:
ESB Consultancy
--------------------------------------------------------------------------------
@@Get8087ControlWord
Summary:
Returns the 80x87 control word.
Description:
Get8087ControlWord returns the 80x87 control word (register).
This is the FPU's register that controls how the FPU operates
with regard to things such as precision, rounding and
infinity control. See the table below for the meaning of the
individual bits. Note that although this routine might be
handy at times, the Get8087Infinity, Get8087Precision
and Get8087Rounding functions are preferred as they
shield you from the low level bit manipulation.
<TABLE>
Bit(s) Description
----------- ----------------------------------------------------
0 (IM) Invalid operation mask
1 (DM) Denormalized operand mask
2 (ZM) Division by zero mask
3 (OM) Overflow mask
4 (UM) Underflow mask
5 (PM) Precision error mask
8,9 (PC) Precision control * 00 Single precision * 01
Reserved * 10 Double precision * 11 Extended
precision
10,11 (RC) Rounding control * 00 Round to nearest or even * 01
Round down * 10 Round up * Chop or truncate toward 0
12 (IC) Infinity control * 0 projective * 1 affine
</TABLE>
Result:
Returns the 80x87 control word.
See also:
Get8087StatusWord
Set8087ControlWord
Donator:
ESB Consultancy
--------------------------------------------------------------------------------
@@Get8087StatusWord
<GROUP MathRoutines.Hardware>
Summary:
Returns the 80x87 status word.
Description:
Get8087StatusWord returns the 80x87 status word. This is the FPU's register that
reflects it's overall status. The meaning of the individual bits are documented
in the table below.
Parameters:
ClearExceptions - If True the function clears any pending floating point exceptions before returning the status word. If False the function does not clear pending exceptions (it's the difference between using FSTSW and FNSTSW).
Result:
Returns the contents of the 80x87 status word.
<TABLE>
Bit(s) Description
------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------
0 (IE) Invalid error such as stack overflow/underflow.
1 (DE) Denormalized error meaning at least one operand was denormalized.
2 (ZE) Zero error indicates the divisor was 0 while the dividend was non-zero or non-infinity.
3 (OE) Overflow error indicating the result of an operation was too large to be represented. If overflow error is masked a result of infinity was returned.
4 (UE) Underflow error indicating the result of an operation was too small to be represented.
5 (PE) Precision error indicating an operand or the result exceeds the selected precision.
6 (SF) Used in some newer coprocessors to denote overflow or underflow.
7 (ES) Error summary is set if any of the unmasked error bits is set.
8-10, 14 (C0-C2,C3) Condition code bits indicate certain conditions such as NAN. These are opcode dependent. See the Intel reference.
11-13 (TOP) Stack top pointer. Register which functions as top of stack, usually 0.
15 (B) Busy bit indicating the coprocessor is performing some task.
</TABLE>
See also:
Set8087ControlWord
Get8087ControlWord
Donator:
Marcel van Brakel
--------------------------------------------------------------------------------