@procedures/rational 0.0.0-stage → 0.62.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/LICENSE +21 -0
- package/README.md +65 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/manifest.d.ts +3 -0
- package/dist/manifest.d.ts.map +1 -0
- package/dist/manifest.js +859 -0
- package/dist/manifest.js.map +1 -0
- package/dist/module.d.ts +19 -0
- package/dist/module.d.ts.map +1 -0
- package/dist/module.js +23 -0
- package/dist/module.js.map +1 -0
- package/dist/register.d.ts +6 -0
- package/dist/register.d.ts.map +1 -0
- package/dist/register.js +8 -0
- package/dist/register.js.map +1 -0
- package/package.json +87 -3
- package/src/index.ts +2 -0
- package/src/manifest.ts +861 -0
- package/src/module.ts +27 -0
- package/src/register.ts +10 -0
package/src/manifest.ts
ADDED
|
@@ -0,0 +1,861 @@
|
|
|
1
|
+
// The manifest of @mark1russell7/rational 0.1.3, made from its types by `node scripts/wraps.ts generate`. Do not edit it.
|
|
2
|
+
import type { ExportsManifest } from "@procedures/compiler";
|
|
3
|
+
|
|
4
|
+
export const manifest: ExportsManifest = {
|
|
5
|
+
"format": "procedures-exports/1",
|
|
6
|
+
"package": "@mark1russell7/rational",
|
|
7
|
+
"version": "0.1.3",
|
|
8
|
+
"entry": ".",
|
|
9
|
+
"namespace": [
|
|
10
|
+
"rational"
|
|
11
|
+
],
|
|
12
|
+
"$defs": {
|
|
13
|
+
"Rational": {
|
|
14
|
+
"type": "object",
|
|
15
|
+
"properties": {
|
|
16
|
+
"n": {
|
|
17
|
+
"type": "string",
|
|
18
|
+
"pattern": "^-?(0|[1-9][0-9]*)$",
|
|
19
|
+
"x-procedures-codec": "bigint"
|
|
20
|
+
},
|
|
21
|
+
"d": {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"pattern": "^-?(0|[1-9][0-9]*)$",
|
|
24
|
+
"x-procedures-codec": "bigint"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"required": [
|
|
28
|
+
"n",
|
|
29
|
+
"d"
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"procedures": [
|
|
34
|
+
{
|
|
35
|
+
"name": "abs",
|
|
36
|
+
"path": [
|
|
37
|
+
"rational",
|
|
38
|
+
"abs"
|
|
39
|
+
],
|
|
40
|
+
"description": "This function gives `|a|`. The result is exact.",
|
|
41
|
+
"params": [
|
|
42
|
+
"a"
|
|
43
|
+
],
|
|
44
|
+
"input": {
|
|
45
|
+
"type": "object",
|
|
46
|
+
"properties": {
|
|
47
|
+
"a": {
|
|
48
|
+
"$ref": "#/$defs/Rational"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"required": [
|
|
52
|
+
"a"
|
|
53
|
+
],
|
|
54
|
+
"additionalProperties": false
|
|
55
|
+
},
|
|
56
|
+
"output": {
|
|
57
|
+
"$ref": "#/$defs/Rational"
|
|
58
|
+
},
|
|
59
|
+
"effects": {
|
|
60
|
+
"reads": [],
|
|
61
|
+
"writes": []
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"name": "add",
|
|
66
|
+
"path": [
|
|
67
|
+
"rational",
|
|
68
|
+
"add"
|
|
69
|
+
],
|
|
70
|
+
"description": "This function gives `a + b`. The result is exact.",
|
|
71
|
+
"params": [
|
|
72
|
+
"a",
|
|
73
|
+
"b"
|
|
74
|
+
],
|
|
75
|
+
"input": {
|
|
76
|
+
"type": "object",
|
|
77
|
+
"properties": {
|
|
78
|
+
"a": {
|
|
79
|
+
"$ref": "#/$defs/Rational"
|
|
80
|
+
},
|
|
81
|
+
"b": {
|
|
82
|
+
"$ref": "#/$defs/Rational"
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
"required": [
|
|
86
|
+
"a",
|
|
87
|
+
"b"
|
|
88
|
+
],
|
|
89
|
+
"additionalProperties": false
|
|
90
|
+
},
|
|
91
|
+
"output": {
|
|
92
|
+
"$ref": "#/$defs/Rational"
|
|
93
|
+
},
|
|
94
|
+
"effects": {
|
|
95
|
+
"reads": [],
|
|
96
|
+
"writes": []
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"name": "ceil",
|
|
101
|
+
"path": [
|
|
102
|
+
"rational",
|
|
103
|
+
"ceil"
|
|
104
|
+
],
|
|
105
|
+
"description": "This function gives the least integer that is not less than the value. The result is exact.",
|
|
106
|
+
"params": [
|
|
107
|
+
"a"
|
|
108
|
+
],
|
|
109
|
+
"input": {
|
|
110
|
+
"type": "object",
|
|
111
|
+
"properties": {
|
|
112
|
+
"a": {
|
|
113
|
+
"$ref": "#/$defs/Rational"
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
"required": [
|
|
117
|
+
"a"
|
|
118
|
+
],
|
|
119
|
+
"additionalProperties": false
|
|
120
|
+
},
|
|
121
|
+
"output": {
|
|
122
|
+
"$ref": "#/$defs/Rational"
|
|
123
|
+
},
|
|
124
|
+
"effects": {
|
|
125
|
+
"reads": [],
|
|
126
|
+
"writes": []
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"name": "cmp",
|
|
131
|
+
"path": [
|
|
132
|
+
"rational",
|
|
133
|
+
"cmp"
|
|
134
|
+
],
|
|
135
|
+
"description": "This function is `compare`, with the name that `@mark1russell7/quantity` uses.",
|
|
136
|
+
"params": [
|
|
137
|
+
"a",
|
|
138
|
+
"b"
|
|
139
|
+
],
|
|
140
|
+
"input": {
|
|
141
|
+
"type": "object",
|
|
142
|
+
"properties": {
|
|
143
|
+
"a": {
|
|
144
|
+
"$ref": "#/$defs/Rational"
|
|
145
|
+
},
|
|
146
|
+
"b": {
|
|
147
|
+
"$ref": "#/$defs/Rational"
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
"required": [
|
|
151
|
+
"a",
|
|
152
|
+
"b"
|
|
153
|
+
],
|
|
154
|
+
"additionalProperties": false
|
|
155
|
+
},
|
|
156
|
+
"output": {
|
|
157
|
+
"enum": [
|
|
158
|
+
0,
|
|
159
|
+
1,
|
|
160
|
+
-1
|
|
161
|
+
]
|
|
162
|
+
},
|
|
163
|
+
"effects": {
|
|
164
|
+
"reads": [],
|
|
165
|
+
"writes": []
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
"name": "compare",
|
|
170
|
+
"path": [
|
|
171
|
+
"rational",
|
|
172
|
+
"compare"
|
|
173
|
+
],
|
|
174
|
+
"description": "This function gives -1, 0 or 1 for `a < b`, `a = b` or `a > b`. The result is exact.",
|
|
175
|
+
"params": [
|
|
176
|
+
"a",
|
|
177
|
+
"b"
|
|
178
|
+
],
|
|
179
|
+
"input": {
|
|
180
|
+
"type": "object",
|
|
181
|
+
"properties": {
|
|
182
|
+
"a": {
|
|
183
|
+
"$ref": "#/$defs/Rational"
|
|
184
|
+
},
|
|
185
|
+
"b": {
|
|
186
|
+
"$ref": "#/$defs/Rational"
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
"required": [
|
|
190
|
+
"a",
|
|
191
|
+
"b"
|
|
192
|
+
],
|
|
193
|
+
"additionalProperties": false
|
|
194
|
+
},
|
|
195
|
+
"output": {
|
|
196
|
+
"enum": [
|
|
197
|
+
0,
|
|
198
|
+
1,
|
|
199
|
+
-1
|
|
200
|
+
]
|
|
201
|
+
},
|
|
202
|
+
"effects": {
|
|
203
|
+
"reads": [],
|
|
204
|
+
"writes": []
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
"name": "div",
|
|
209
|
+
"path": [
|
|
210
|
+
"rational",
|
|
211
|
+
"div"
|
|
212
|
+
],
|
|
213
|
+
"description": "This function gives `a / b`. The result is exact.",
|
|
214
|
+
"params": [
|
|
215
|
+
"a",
|
|
216
|
+
"b"
|
|
217
|
+
],
|
|
218
|
+
"input": {
|
|
219
|
+
"type": "object",
|
|
220
|
+
"properties": {
|
|
221
|
+
"a": {
|
|
222
|
+
"$ref": "#/$defs/Rational"
|
|
223
|
+
},
|
|
224
|
+
"b": {
|
|
225
|
+
"$ref": "#/$defs/Rational"
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
"required": [
|
|
229
|
+
"a",
|
|
230
|
+
"b"
|
|
231
|
+
],
|
|
232
|
+
"additionalProperties": false
|
|
233
|
+
},
|
|
234
|
+
"output": {
|
|
235
|
+
"$ref": "#/$defs/Rational"
|
|
236
|
+
},
|
|
237
|
+
"effects": {
|
|
238
|
+
"reads": [],
|
|
239
|
+
"writes": []
|
|
240
|
+
}
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
"name": "equals",
|
|
244
|
+
"path": [
|
|
245
|
+
"rational",
|
|
246
|
+
"equals"
|
|
247
|
+
],
|
|
248
|
+
"description": "This function tells if `a = b`. Each rational is in lowest terms, so the test compares the fields.",
|
|
249
|
+
"params": [
|
|
250
|
+
"a",
|
|
251
|
+
"b"
|
|
252
|
+
],
|
|
253
|
+
"input": {
|
|
254
|
+
"type": "object",
|
|
255
|
+
"properties": {
|
|
256
|
+
"a": {
|
|
257
|
+
"$ref": "#/$defs/Rational"
|
|
258
|
+
},
|
|
259
|
+
"b": {
|
|
260
|
+
"$ref": "#/$defs/Rational"
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
"required": [
|
|
264
|
+
"a",
|
|
265
|
+
"b"
|
|
266
|
+
],
|
|
267
|
+
"additionalProperties": false
|
|
268
|
+
},
|
|
269
|
+
"output": {
|
|
270
|
+
"type": "boolean"
|
|
271
|
+
},
|
|
272
|
+
"effects": {
|
|
273
|
+
"reads": [],
|
|
274
|
+
"writes": []
|
|
275
|
+
}
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
"name": "floor",
|
|
279
|
+
"path": [
|
|
280
|
+
"rational",
|
|
281
|
+
"floor"
|
|
282
|
+
],
|
|
283
|
+
"description": "This function gives the greatest integer that is not more than the value. The result is exact.",
|
|
284
|
+
"params": [
|
|
285
|
+
"a"
|
|
286
|
+
],
|
|
287
|
+
"input": {
|
|
288
|
+
"type": "object",
|
|
289
|
+
"properties": {
|
|
290
|
+
"a": {
|
|
291
|
+
"$ref": "#/$defs/Rational"
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
"required": [
|
|
295
|
+
"a"
|
|
296
|
+
],
|
|
297
|
+
"additionalProperties": false
|
|
298
|
+
},
|
|
299
|
+
"output": {
|
|
300
|
+
"$ref": "#/$defs/Rational"
|
|
301
|
+
},
|
|
302
|
+
"effects": {
|
|
303
|
+
"reads": [],
|
|
304
|
+
"writes": []
|
|
305
|
+
}
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
"name": "fromDecimal",
|
|
309
|
+
"path": [
|
|
310
|
+
"rational",
|
|
311
|
+
"fromDecimal"
|
|
312
|
+
],
|
|
313
|
+
"description": "This function reads a decimal from its text, exactly. The text `\"0.0254\"` gives 127/5000, and `\"1e-9\"` gives 1/10^9.",
|
|
314
|
+
"params": [
|
|
315
|
+
"text"
|
|
316
|
+
],
|
|
317
|
+
"input": {
|
|
318
|
+
"type": "object",
|
|
319
|
+
"properties": {
|
|
320
|
+
"text": {
|
|
321
|
+
"type": "string"
|
|
322
|
+
}
|
|
323
|
+
},
|
|
324
|
+
"required": [
|
|
325
|
+
"text"
|
|
326
|
+
],
|
|
327
|
+
"additionalProperties": false
|
|
328
|
+
},
|
|
329
|
+
"output": {
|
|
330
|
+
"$ref": "#/$defs/Rational"
|
|
331
|
+
},
|
|
332
|
+
"effects": {
|
|
333
|
+
"reads": [],
|
|
334
|
+
"writes": []
|
|
335
|
+
}
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
"name": "fromFloat",
|
|
339
|
+
"path": [
|
|
340
|
+
"rational",
|
|
341
|
+
"fromFloat"
|
|
342
|
+
],
|
|
343
|
+
"description": "This function gives the exact value of a finite double. Thus `0.1` gives 3602879701896397/2^55. The value `-0` gives 0.",
|
|
344
|
+
"params": [
|
|
345
|
+
"value"
|
|
346
|
+
],
|
|
347
|
+
"input": {
|
|
348
|
+
"type": "object",
|
|
349
|
+
"properties": {
|
|
350
|
+
"value": {
|
|
351
|
+
"type": "number"
|
|
352
|
+
}
|
|
353
|
+
},
|
|
354
|
+
"required": [
|
|
355
|
+
"value"
|
|
356
|
+
],
|
|
357
|
+
"additionalProperties": false
|
|
358
|
+
},
|
|
359
|
+
"output": {
|
|
360
|
+
"$ref": "#/$defs/Rational"
|
|
361
|
+
},
|
|
362
|
+
"effects": {
|
|
363
|
+
"reads": [],
|
|
364
|
+
"writes": []
|
|
365
|
+
}
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
"name": "fromNumber",
|
|
369
|
+
"path": [
|
|
370
|
+
"rational",
|
|
371
|
+
"fromNumber"
|
|
372
|
+
],
|
|
373
|
+
"description": "This function reads a finite number as JavaScript prints it. That text is the shortest decimal that reads back as the same number. Thus `0.1` gives 1/10, not the exact value of the double. Use `fromFloat` for the exact value.",
|
|
374
|
+
"params": [
|
|
375
|
+
"value"
|
|
376
|
+
],
|
|
377
|
+
"input": {
|
|
378
|
+
"type": "object",
|
|
379
|
+
"properties": {
|
|
380
|
+
"value": {
|
|
381
|
+
"type": "number"
|
|
382
|
+
}
|
|
383
|
+
},
|
|
384
|
+
"required": [
|
|
385
|
+
"value"
|
|
386
|
+
],
|
|
387
|
+
"additionalProperties": false
|
|
388
|
+
},
|
|
389
|
+
"output": {
|
|
390
|
+
"$ref": "#/$defs/Rational"
|
|
391
|
+
},
|
|
392
|
+
"effects": {
|
|
393
|
+
"reads": [],
|
|
394
|
+
"writes": []
|
|
395
|
+
}
|
|
396
|
+
},
|
|
397
|
+
{
|
|
398
|
+
"name": "gcd",
|
|
399
|
+
"path": [
|
|
400
|
+
"rational",
|
|
401
|
+
"gcd"
|
|
402
|
+
],
|
|
403
|
+
"description": "This function gives the greatest common divisor of `|a|` and `|b|`. The result for `0` and `0` is `0`.",
|
|
404
|
+
"params": [
|
|
405
|
+
"a",
|
|
406
|
+
"b"
|
|
407
|
+
],
|
|
408
|
+
"input": {
|
|
409
|
+
"type": "object",
|
|
410
|
+
"properties": {
|
|
411
|
+
"a": {
|
|
412
|
+
"type": "string",
|
|
413
|
+
"pattern": "^-?(0|[1-9][0-9]*)$",
|
|
414
|
+
"x-procedures-codec": "bigint",
|
|
415
|
+
"description": "An integer."
|
|
416
|
+
},
|
|
417
|
+
"b": {
|
|
418
|
+
"type": "string",
|
|
419
|
+
"pattern": "^-?(0|[1-9][0-9]*)$",
|
|
420
|
+
"x-procedures-codec": "bigint",
|
|
421
|
+
"description": "An integer."
|
|
422
|
+
}
|
|
423
|
+
},
|
|
424
|
+
"required": [
|
|
425
|
+
"a",
|
|
426
|
+
"b"
|
|
427
|
+
],
|
|
428
|
+
"additionalProperties": false
|
|
429
|
+
},
|
|
430
|
+
"output": {
|
|
431
|
+
"type": "string",
|
|
432
|
+
"pattern": "^-?(0|[1-9][0-9]*)$",
|
|
433
|
+
"x-procedures-codec": "bigint"
|
|
434
|
+
},
|
|
435
|
+
"effects": {
|
|
436
|
+
"reads": [],
|
|
437
|
+
"writes": []
|
|
438
|
+
}
|
|
439
|
+
},
|
|
440
|
+
{
|
|
441
|
+
"name": "integerRoot",
|
|
442
|
+
"path": [
|
|
443
|
+
"rational",
|
|
444
|
+
"integerRoot"
|
|
445
|
+
],
|
|
446
|
+
"description": "This function gives the floor of the `k`-th root of `n`: the largest integer `r` with `r^k <= n`. The result is exact. The search starts above the root, from the bit length of `n`, and the Newton steps go down to the root.",
|
|
447
|
+
"params": [
|
|
448
|
+
"n",
|
|
449
|
+
"k"
|
|
450
|
+
],
|
|
451
|
+
"input": {
|
|
452
|
+
"type": "object",
|
|
453
|
+
"properties": {
|
|
454
|
+
"n": {
|
|
455
|
+
"type": "string",
|
|
456
|
+
"pattern": "^-?(0|[1-9][0-9]*)$",
|
|
457
|
+
"x-procedures-codec": "bigint",
|
|
458
|
+
"description": "A value that is not less than `0n`."
|
|
459
|
+
},
|
|
460
|
+
"k": {
|
|
461
|
+
"type": "number",
|
|
462
|
+
"description": "An integer index of 1 or more."
|
|
463
|
+
}
|
|
464
|
+
},
|
|
465
|
+
"required": [
|
|
466
|
+
"n",
|
|
467
|
+
"k"
|
|
468
|
+
],
|
|
469
|
+
"additionalProperties": false
|
|
470
|
+
},
|
|
471
|
+
"output": {
|
|
472
|
+
"type": "string",
|
|
473
|
+
"pattern": "^-?(0|[1-9][0-9]*)$",
|
|
474
|
+
"x-procedures-codec": "bigint"
|
|
475
|
+
},
|
|
476
|
+
"effects": {
|
|
477
|
+
"reads": [],
|
|
478
|
+
"writes": []
|
|
479
|
+
}
|
|
480
|
+
},
|
|
481
|
+
{
|
|
482
|
+
"name": "inverse",
|
|
483
|
+
"path": [
|
|
484
|
+
"rational",
|
|
485
|
+
"inverse"
|
|
486
|
+
],
|
|
487
|
+
"description": "This function gives `1 / a`. The result is exact.",
|
|
488
|
+
"params": [
|
|
489
|
+
"a"
|
|
490
|
+
],
|
|
491
|
+
"input": {
|
|
492
|
+
"type": "object",
|
|
493
|
+
"properties": {
|
|
494
|
+
"a": {
|
|
495
|
+
"$ref": "#/$defs/Rational"
|
|
496
|
+
}
|
|
497
|
+
},
|
|
498
|
+
"required": [
|
|
499
|
+
"a"
|
|
500
|
+
],
|
|
501
|
+
"additionalProperties": false
|
|
502
|
+
},
|
|
503
|
+
"output": {
|
|
504
|
+
"$ref": "#/$defs/Rational"
|
|
505
|
+
},
|
|
506
|
+
"effects": {
|
|
507
|
+
"reads": [],
|
|
508
|
+
"writes": []
|
|
509
|
+
}
|
|
510
|
+
},
|
|
511
|
+
{
|
|
512
|
+
"name": "isInteger",
|
|
513
|
+
"path": [
|
|
514
|
+
"rational",
|
|
515
|
+
"isInteger"
|
|
516
|
+
],
|
|
517
|
+
"description": "This function tells if the value is an integer.",
|
|
518
|
+
"params": [
|
|
519
|
+
"a"
|
|
520
|
+
],
|
|
521
|
+
"input": {
|
|
522
|
+
"type": "object",
|
|
523
|
+
"properties": {
|
|
524
|
+
"a": {
|
|
525
|
+
"$ref": "#/$defs/Rational"
|
|
526
|
+
}
|
|
527
|
+
},
|
|
528
|
+
"required": [
|
|
529
|
+
"a"
|
|
530
|
+
],
|
|
531
|
+
"additionalProperties": false
|
|
532
|
+
},
|
|
533
|
+
"output": {
|
|
534
|
+
"type": "boolean"
|
|
535
|
+
},
|
|
536
|
+
"effects": {
|
|
537
|
+
"reads": [],
|
|
538
|
+
"writes": []
|
|
539
|
+
}
|
|
540
|
+
},
|
|
541
|
+
{
|
|
542
|
+
"name": "mul",
|
|
543
|
+
"path": [
|
|
544
|
+
"rational",
|
|
545
|
+
"mul"
|
|
546
|
+
],
|
|
547
|
+
"description": "This function gives `a × b`. The result is exact.",
|
|
548
|
+
"params": [
|
|
549
|
+
"a",
|
|
550
|
+
"b"
|
|
551
|
+
],
|
|
552
|
+
"input": {
|
|
553
|
+
"type": "object",
|
|
554
|
+
"properties": {
|
|
555
|
+
"a": {
|
|
556
|
+
"$ref": "#/$defs/Rational"
|
|
557
|
+
},
|
|
558
|
+
"b": {
|
|
559
|
+
"$ref": "#/$defs/Rational"
|
|
560
|
+
}
|
|
561
|
+
},
|
|
562
|
+
"required": [
|
|
563
|
+
"a",
|
|
564
|
+
"b"
|
|
565
|
+
],
|
|
566
|
+
"additionalProperties": false
|
|
567
|
+
},
|
|
568
|
+
"output": {
|
|
569
|
+
"$ref": "#/$defs/Rational"
|
|
570
|
+
},
|
|
571
|
+
"effects": {
|
|
572
|
+
"reads": [],
|
|
573
|
+
"writes": []
|
|
574
|
+
}
|
|
575
|
+
},
|
|
576
|
+
{
|
|
577
|
+
"name": "neg",
|
|
578
|
+
"path": [
|
|
579
|
+
"rational",
|
|
580
|
+
"neg"
|
|
581
|
+
],
|
|
582
|
+
"description": "This function gives `-a`. The result is exact.",
|
|
583
|
+
"params": [
|
|
584
|
+
"a"
|
|
585
|
+
],
|
|
586
|
+
"input": {
|
|
587
|
+
"type": "object",
|
|
588
|
+
"properties": {
|
|
589
|
+
"a": {
|
|
590
|
+
"$ref": "#/$defs/Rational"
|
|
591
|
+
}
|
|
592
|
+
},
|
|
593
|
+
"required": [
|
|
594
|
+
"a"
|
|
595
|
+
],
|
|
596
|
+
"additionalProperties": false
|
|
597
|
+
},
|
|
598
|
+
"output": {
|
|
599
|
+
"$ref": "#/$defs/Rational"
|
|
600
|
+
},
|
|
601
|
+
"effects": {
|
|
602
|
+
"reads": [],
|
|
603
|
+
"writes": []
|
|
604
|
+
}
|
|
605
|
+
},
|
|
606
|
+
{
|
|
607
|
+
"name": "pow",
|
|
608
|
+
"path": [
|
|
609
|
+
"rational",
|
|
610
|
+
"pow"
|
|
611
|
+
],
|
|
612
|
+
"description": "This function gives `a` to an integer power. The result is exact. The power 0 of each value, 0 too, is 1.",
|
|
613
|
+
"params": [
|
|
614
|
+
"a",
|
|
615
|
+
"exponent"
|
|
616
|
+
],
|
|
617
|
+
"input": {
|
|
618
|
+
"type": "object",
|
|
619
|
+
"properties": {
|
|
620
|
+
"a": {
|
|
621
|
+
"$ref": "#/$defs/Rational"
|
|
622
|
+
},
|
|
623
|
+
"exponent": {
|
|
624
|
+
"type": "number"
|
|
625
|
+
}
|
|
626
|
+
},
|
|
627
|
+
"required": [
|
|
628
|
+
"a",
|
|
629
|
+
"exponent"
|
|
630
|
+
],
|
|
631
|
+
"additionalProperties": false
|
|
632
|
+
},
|
|
633
|
+
"output": {
|
|
634
|
+
"$ref": "#/$defs/Rational"
|
|
635
|
+
},
|
|
636
|
+
"effects": {
|
|
637
|
+
"reads": [],
|
|
638
|
+
"writes": []
|
|
639
|
+
}
|
|
640
|
+
},
|
|
641
|
+
{
|
|
642
|
+
"name": "rational",
|
|
643
|
+
"path": [
|
|
644
|
+
"rational",
|
|
645
|
+
"rational"
|
|
646
|
+
],
|
|
647
|
+
"description": "This function makes the rational `n / d` in lowest terms. The result is exact.",
|
|
648
|
+
"params": [
|
|
649
|
+
"n",
|
|
650
|
+
"d"
|
|
651
|
+
],
|
|
652
|
+
"input": {
|
|
653
|
+
"type": "object",
|
|
654
|
+
"properties": {
|
|
655
|
+
"n": {
|
|
656
|
+
"type": "string",
|
|
657
|
+
"pattern": "^-?(0|[1-9][0-9]*)$",
|
|
658
|
+
"x-procedures-codec": "bigint",
|
|
659
|
+
"description": "The numerator."
|
|
660
|
+
},
|
|
661
|
+
"d": {
|
|
662
|
+
"type": "string",
|
|
663
|
+
"pattern": "^-?(0|[1-9][0-9]*)$",
|
|
664
|
+
"x-procedures-codec": "bigint",
|
|
665
|
+
"description": "The denominator. The default is `1n`."
|
|
666
|
+
}
|
|
667
|
+
},
|
|
668
|
+
"required": [
|
|
669
|
+
"n"
|
|
670
|
+
],
|
|
671
|
+
"additionalProperties": false
|
|
672
|
+
},
|
|
673
|
+
"output": {
|
|
674
|
+
"$ref": "#/$defs/Rational"
|
|
675
|
+
},
|
|
676
|
+
"effects": {
|
|
677
|
+
"reads": [],
|
|
678
|
+
"writes": []
|
|
679
|
+
}
|
|
680
|
+
},
|
|
681
|
+
{
|
|
682
|
+
"name": "root",
|
|
683
|
+
"path": [
|
|
684
|
+
"rational",
|
|
685
|
+
"root"
|
|
686
|
+
],
|
|
687
|
+
"description": "This function gives the `k`-th root of `a` when it is a rational, and `null` when it is not. The root of a rational in lowest terms is rational only when its numerator and its denominator are both `k`-th powers of integers. An odd index gives the negative root of a negative value. The result is exact.",
|
|
688
|
+
"params": [
|
|
689
|
+
"a",
|
|
690
|
+
"k"
|
|
691
|
+
],
|
|
692
|
+
"input": {
|
|
693
|
+
"type": "object",
|
|
694
|
+
"properties": {
|
|
695
|
+
"a": {
|
|
696
|
+
"$ref": "#/$defs/Rational",
|
|
697
|
+
"description": "The value."
|
|
698
|
+
},
|
|
699
|
+
"k": {
|
|
700
|
+
"type": "number",
|
|
701
|
+
"description": "An integer index of 1 or more."
|
|
702
|
+
}
|
|
703
|
+
},
|
|
704
|
+
"required": [
|
|
705
|
+
"a",
|
|
706
|
+
"k"
|
|
707
|
+
],
|
|
708
|
+
"additionalProperties": false
|
|
709
|
+
},
|
|
710
|
+
"output": {
|
|
711
|
+
"anyOf": [
|
|
712
|
+
{
|
|
713
|
+
"type": "null"
|
|
714
|
+
},
|
|
715
|
+
{
|
|
716
|
+
"$ref": "#/$defs/Rational"
|
|
717
|
+
}
|
|
718
|
+
]
|
|
719
|
+
},
|
|
720
|
+
"effects": {
|
|
721
|
+
"reads": [],
|
|
722
|
+
"writes": []
|
|
723
|
+
}
|
|
724
|
+
},
|
|
725
|
+
{
|
|
726
|
+
"name": "sign",
|
|
727
|
+
"path": [
|
|
728
|
+
"rational",
|
|
729
|
+
"sign"
|
|
730
|
+
],
|
|
731
|
+
"description": "This function gives -1, 0 or 1 for a value that is less than 0, equal to 0 or more than 0.",
|
|
732
|
+
"params": [
|
|
733
|
+
"a"
|
|
734
|
+
],
|
|
735
|
+
"input": {
|
|
736
|
+
"type": "object",
|
|
737
|
+
"properties": {
|
|
738
|
+
"a": {
|
|
739
|
+
"$ref": "#/$defs/Rational"
|
|
740
|
+
}
|
|
741
|
+
},
|
|
742
|
+
"required": [
|
|
743
|
+
"a"
|
|
744
|
+
],
|
|
745
|
+
"additionalProperties": false
|
|
746
|
+
},
|
|
747
|
+
"output": {
|
|
748
|
+
"enum": [
|
|
749
|
+
0,
|
|
750
|
+
1,
|
|
751
|
+
-1
|
|
752
|
+
]
|
|
753
|
+
},
|
|
754
|
+
"effects": {
|
|
755
|
+
"reads": [],
|
|
756
|
+
"writes": []
|
|
757
|
+
}
|
|
758
|
+
},
|
|
759
|
+
{
|
|
760
|
+
"name": "sub",
|
|
761
|
+
"path": [
|
|
762
|
+
"rational",
|
|
763
|
+
"sub"
|
|
764
|
+
],
|
|
765
|
+
"description": "This function gives `a - b`. The result is exact.",
|
|
766
|
+
"params": [
|
|
767
|
+
"a",
|
|
768
|
+
"b"
|
|
769
|
+
],
|
|
770
|
+
"input": {
|
|
771
|
+
"type": "object",
|
|
772
|
+
"properties": {
|
|
773
|
+
"a": {
|
|
774
|
+
"$ref": "#/$defs/Rational"
|
|
775
|
+
},
|
|
776
|
+
"b": {
|
|
777
|
+
"$ref": "#/$defs/Rational"
|
|
778
|
+
}
|
|
779
|
+
},
|
|
780
|
+
"required": [
|
|
781
|
+
"a",
|
|
782
|
+
"b"
|
|
783
|
+
],
|
|
784
|
+
"additionalProperties": false
|
|
785
|
+
},
|
|
786
|
+
"output": {
|
|
787
|
+
"$ref": "#/$defs/Rational"
|
|
788
|
+
},
|
|
789
|
+
"effects": {
|
|
790
|
+
"reads": [],
|
|
791
|
+
"writes": []
|
|
792
|
+
}
|
|
793
|
+
},
|
|
794
|
+
{
|
|
795
|
+
"name": "toNumber",
|
|
796
|
+
"path": [
|
|
797
|
+
"rational",
|
|
798
|
+
"toNumber"
|
|
799
|
+
],
|
|
800
|
+
"description": "This function gives the nearest double to the value, with ties to even. The error is at most half a unit in the last place. A value past the range of the doubles gives an infinity, and a value too small gives 0 or a subnormal.",
|
|
801
|
+
"params": [
|
|
802
|
+
"a"
|
|
803
|
+
],
|
|
804
|
+
"input": {
|
|
805
|
+
"type": "object",
|
|
806
|
+
"properties": {
|
|
807
|
+
"a": {
|
|
808
|
+
"$ref": "#/$defs/Rational"
|
|
809
|
+
}
|
|
810
|
+
},
|
|
811
|
+
"required": [
|
|
812
|
+
"a"
|
|
813
|
+
],
|
|
814
|
+
"additionalProperties": false
|
|
815
|
+
},
|
|
816
|
+
"output": {
|
|
817
|
+
"type": "number"
|
|
818
|
+
},
|
|
819
|
+
"effects": {
|
|
820
|
+
"reads": [],
|
|
821
|
+
"writes": []
|
|
822
|
+
}
|
|
823
|
+
},
|
|
824
|
+
{
|
|
825
|
+
"name": "toString",
|
|
826
|
+
"path": [
|
|
827
|
+
"rational",
|
|
828
|
+
"toString"
|
|
829
|
+
],
|
|
830
|
+
"description": "This function gives the text `\"n/d\"`, or `\"n\"` for an integer. The text is exact.",
|
|
831
|
+
"params": [
|
|
832
|
+
"a"
|
|
833
|
+
],
|
|
834
|
+
"input": {
|
|
835
|
+
"type": "object",
|
|
836
|
+
"properties": {
|
|
837
|
+
"a": {
|
|
838
|
+
"$ref": "#/$defs/Rational"
|
|
839
|
+
}
|
|
840
|
+
},
|
|
841
|
+
"required": [
|
|
842
|
+
"a"
|
|
843
|
+
],
|
|
844
|
+
"additionalProperties": false
|
|
845
|
+
},
|
|
846
|
+
"output": {
|
|
847
|
+
"type": "string"
|
|
848
|
+
},
|
|
849
|
+
"effects": {
|
|
850
|
+
"reads": [],
|
|
851
|
+
"writes": []
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
],
|
|
855
|
+
"exempt": [],
|
|
856
|
+
"others": {
|
|
857
|
+
"classes": [],
|
|
858
|
+
"values": 3,
|
|
859
|
+
"types": 1
|
|
860
|
+
}
|
|
861
|
+
};
|