-
-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathdocumentation.lisp
368 lines (285 loc) · 8.64 KB
/
documentation.lisp
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
(in-package #:org.shirakumo.float-features)
(docs:define-docs
(variable short-float-positive-infinity
"The positive infinity for short-floats.
Supported on:
* ALLEGRO
* CCL
* CMUCL
* ECL
* LISPWORKS
* MEZZANO
* MKCL
* SBCL
Defaults to MOST-POSITIVE-SHORT-FLOAT on unsupported implementations.")
(variable short-float-negative-infinity
"The negative infinity for short-floats.
Supported on:
* ALLEGRO
* CCL
* CMUCL
* ECL
* LISPWORKS
* MEZZANO
* MKCL
* SBCL
Defaults to MOST-NEGATIVE-SHORT-FLOAT on unsupported implementations.")
(variable short-float-nan
"A positive quiet NaN value with zero-cleared payload for short-floats.
This value should NOT be used for comparison with a float value for the pupose of testing NaN
because NaN has unused bits (called payload) which are explicitly allowed to store additional information.
Comparing this value with other NaN representations via = will fail.
To test if a number is a NaN, use FLOAT-NAN-P.
It is supported on implementations which support BITS-SHORT-FLOAT.
Defaults to MOST-POSITIVE-SHORT-FLOAT on unsupported implementations.")
(variable single-float-positive-infinity
"The positive infinity for single-floats.
Supported on:
* ABCL
* ALLEGRO
* CCL
* CMUCL
* ECL
* LISPWORKS
* MEZZANO
* MKCL
* SBCL
Defaults to MOST-POSITIVE-SINGLE-FLOAT on unsupported implementations.")
(variable single-float-negative-infinity
"The negative infinity for single-floats.
Supported on:
* ABCL
* ALLEGRO
* CCL
* CMUCL
* ECL
* LISPWORKS
* MEZZANO
* MKCL
* SBCL
Defaults to MOST-NEGATIVE-SINGLE-FLOAT on unsupported implementations.")
(variable single-float-nan
"A positive quiet NaN value with zero-cleared payload for single-floats.
This value should NOT be used for comparison with a float value for the pupose of testing NaN
because NaN has unused bits (called payload) which are explicitly allowed to store additional information.
Comparing this value with other NaN representations via = will fail.
To test if a number is a NaN, use FLOAT-NAN-P.
It is supported on implementations which support BITS-SINGLE-FLOAT.
Defaults to MOST-POSITIVE-SINGLE-FLOAT on unsupported implementations.")
(variable double-float-positive-infinity
"The positive infinity for double-floats.
Supported on:
* ABCL
* ALLEGRO
* CCL
* CMUCL
* ECL
* LISPWORKS
* MEZZANO
* MKCL
* SBCL
Defaults to MOST-POSITIVE-DOUBLE-FLOAT on unsupported implementations.")
(variable double-float-negative-infinity
"The negative infinity for double-floats.
Supported on:
* ABCL
* ALLEGRO
* CCL
* CMUCL
* ECL
* LISPWORKS
* MEZZANO
* MKCL
* SBCL
Defaults to MOST-NEGATIVE-DOUBLE-FLOAT on unsupported implementations.")
(variable double-float-nan
"A positive quiet NaN value with zero-cleared payload for double-floats.
This value should NOT be used for comparison with a float value for the pupose of testing NaN
because NaN has unused bits (called payload) which are explicitly allowed to store additional information.
Comparing this value with other NaN representations via = will fail.
To test if a number is a NaN, use FLOAT-NAN-P.
It is supported on implementations which support BITS-DOUBLE-FLOAT.
Defaults to MOST-POSITIVE-DOUBLE-FLOAT on unsupported implementations.")
(variable long-float-positive-infinity
"The positive infinity for long-floats.
Supported on:
* CCL
* CMUCL
* ECL
* LISPWORKS
* MEZZANO
* MKCL
* SBCL
Defaults to MOST-POSITIVE-LONG-FLOAT on unsupported implementations.")
(variable long-float-negative-infinity
"The negative infinity for long-floats.
Supported on:
* CCL
* CMUCL
* ECL
* LISPWORKS
* MEZZANO
* MKCL
* SBCL
Defaults to MOST-NEGATIVE-LONG-FLOAT on unsupported implementations.")
(variable long-float-nan
"A positive quiet NaN value with zero-cleared payload for long-floats.
This value should NOT be used for comparison with a float value for the pupose of testing NaN
because NaN has unused bits (called payload) which are explicitly allowed to store additional information.
Comparing this value with other NaN representations via = will fail.
To test if a number is a NaN, use FLOAT-NAN-P.
It is supported on implementations which support BITS-LONG-FLOAT.
Defaults to MOST-POSITIVE-LONG-FLOAT on unsupported implementations.")
(function float-infinity-p
"Returns T if the given float is an infinity, NIL otherwise.
Supported on:
* ABCL
* ALLEGRO
* CCL
* CMUCL
* ECL
* LISPWORKS
* MEZZANO
* SBCL
Defaults to comparing against the individual constants on unsupported
implementations.")
(function float-nan-p
"Returns T if the given float is in not-a-number state, NIL otherwise.
Supported on:
* ABCL
* ALLEGRO
* CCL
* CMUCL
* ECL
* LISPWORKS
* MEZZANO
* SBCL
Defaults to returning NIL on unsupported implementations.")
(function with-float-traps-masked
"Attempts to mask the given floating point traps.
Masking a floating point trap causes the given floating point exception
to not signal a condition in the lisp world, and instead lets the
operation return a float that is either a NaN or an infinity.
The following traps are recognised:
:underflow
:overflow
:inexact
:invalid
:divide-by-zero
:denormalized-operand
The traps argument may be either a list of the above trap identifiers,
or T to signify all maskable traps.
Note that not all implementations will signal conditions on all of the
above floating point traps anyway, and some implementations may only
support masking some of the above traps.
Supported on:
* ABCL (:overflow :underflow)
* CCL (:overflow :underflow :inexact :invalid :divide-by-zero)
* CLISP (:underflow)
* CMUCL T
* ECL (:underflow :overflow :inexact :invalid :divide-by-zero)
* MEZZANO T
* SBCL T
Defaults to a progn on unsupported implementations and ignores
unsupported traps.")
(function with-rounding-mode
"Temporarily set rounding mode when execute body.
The following modes are recognised:
:nearest Round to nearest, ties to even
:positive Round toward positive infinity
:negative Round toward negative infinity
:zero Round toward zero
Note that many compilers would by default try to fold floating point
expressions into constants before the rounding mode can take effect.
It is advisory to check disassembled functions to see if that is the
case when the result is not expected.
Supported on:
* CCL
* CMUCL
* MEZZANO
* SBCL
Signals an error on unsupported implementations.")
(function short-float-bits
"Returns the bit representation of the short-float as an (unsigned-byte 16).
Supported on:
* MEZZANO
Supported (with 32bit short-float = single-float) on:
* ALLEGRO
* CCL
* CMUCL
* ECL
* LISPWORKS (64-bit only. on 32-bit lw, short-float is not 16 or 32 bits)
* SBCL
On platforms with 32-bit short-float, low bits of significand are
dropped without rounding, and out of range exponents are converted to
infinities. All values returned by bits-short-float should convert
back to the same bits.
Defaults to signalling an error on unsupported implementations.")
(function single-float-bits
"Returns the bit representation of the single-float as an (unsigned-byte 32).
Supported on:
* ABCL
* ALLEGRO
* CCL
* CLASP
* CMUCL
* LISPWORKS
* MEZZANO
* SBCL
Defaults to signalling an error on unsupported implementations.")
(function double-float-bits
"Returns the bit representation of the double-float as an (unsigned-byte 64).
Supported on:
* ABCL
* ALLEGRO
* CCL
* CLASP
* CMUCL
* LISPWORKS
* MEZZANO
* SBCL
Defaults to signalling an error on unsupported implementations.")
(function long-float-bits
"Returns the bit representation of the long-float as an (unsigned-byte 128).
Supported on:
Defaults to signalling an error on unsupported implementations.")
(function bits-short-float
"Encodes the (unsigned-byte 16) bit representation into a native short-float.
Supported on:
* MEZZANO
Supported (with 32bit short-float = single-float) on:
* ALLEGRO
* CCL
* CMUCL
* ECL
* LISPWORKS (64-bit only. on 32-bit lw, short-float is not 16 or 32 bits)
* SBCL
Defaults to signalling an error on unsupported implementations.")
(function bits-single-float
"Encodes the (unsigned-byte 32) bit representation into a native single-float.
Supported on:
* ABCL
* ALLEGRO
* CCL
* CLASP
* CMUCL
* LISPWORKS
* MEZZANO
* SBCL
Defaults to signalling an error on unsupported implementations.")
(function bits-double-float
"Encodes the (unsigned-byte 64) bit representation into a native double-float.
Supported on:
* ABCL
* ALLEGRO
* CCL
* CLASP
* CMUCL
* LISPWORKS
* MEZZANO
* SBCL
Defaults to signalling an error on unsupported implementations.")
(function bits-long-float
"Encodes the (unsigned-byte 128) bit representation into a native long-float.
Supported on:
Defaults to signalling an error on unsupported implementations."))