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