@grain/stdlib 0.6.5 → 0.7.0

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.
Files changed (139) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/LICENSE +1 -1
  3. package/README.md +2 -2
  4. package/array.gr +55 -7
  5. package/array.md +123 -77
  6. package/bigint.md +30 -30
  7. package/buffer.gr +20 -53
  8. package/buffer.md +47 -47
  9. package/bytes.gr +111 -35
  10. package/bytes.md +111 -32
  11. package/char.gr +201 -99
  12. package/char.md +361 -34
  13. package/exception.gr +11 -11
  14. package/exception.md +26 -1
  15. package/float32.gr +327 -3
  16. package/float32.md +606 -19
  17. package/float64.gr +320 -3
  18. package/float64.md +606 -19
  19. package/fs.gr +1082 -0
  20. package/fs.md +630 -0
  21. package/hash.gr +142 -88
  22. package/hash.md +102 -14
  23. package/int16.md +23 -23
  24. package/int32.gr +25 -4
  25. package/int32.md +65 -30
  26. package/int64.gr +26 -1
  27. package/int64.md +65 -30
  28. package/int8.md +23 -23
  29. package/json.gr +366 -51
  30. package/json.md +418 -2
  31. package/list.gr +387 -49
  32. package/list.md +492 -69
  33. package/map.gr +20 -12
  34. package/map.md +44 -38
  35. package/marshal.gr +41 -40
  36. package/marshal.md +2 -2
  37. package/number.gr +159 -30
  38. package/number.md +215 -38
  39. package/option.md +21 -21
  40. package/package.json +5 -3
  41. package/path.gr +48 -0
  42. package/path.md +103 -12
  43. package/pervasives.gr +2 -2
  44. package/pervasives.md +37 -37
  45. package/priorityqueue.gr +7 -7
  46. package/priorityqueue.md +19 -19
  47. package/queue.gr +183 -29
  48. package/queue.md +296 -40
  49. package/random.md +6 -6
  50. package/range.gr +4 -4
  51. package/range.md +6 -6
  52. package/rational.md +16 -16
  53. package/regex.gr +52 -51
  54. package/regex.md +11 -11
  55. package/result.md +16 -16
  56. package/runtime/atof/common.md +39 -39
  57. package/runtime/atof/decimal.gr +6 -6
  58. package/runtime/atof/decimal.md +8 -8
  59. package/runtime/atof/lemire.gr +5 -5
  60. package/runtime/atof/lemire.md +1 -1
  61. package/runtime/atof/parse.gr +16 -16
  62. package/runtime/atof/parse.md +2 -2
  63. package/runtime/atof/slow.md +1 -1
  64. package/runtime/atof/table.md +2 -2
  65. package/runtime/atoi/parse.gr +3 -3
  66. package/runtime/atoi/parse.md +1 -1
  67. package/runtime/bigint.gr +15 -47
  68. package/runtime/bigint.md +54 -60
  69. package/runtime/compare.gr +2 -2
  70. package/runtime/compare.md +1 -1
  71. package/runtime/dataStructures.md +33 -33
  72. package/runtime/debugPrint.gr +4 -1
  73. package/runtime/debugPrint.md +9 -9
  74. package/runtime/equal.gr +99 -77
  75. package/runtime/equal.md +1 -1
  76. package/runtime/exception.gr +62 -82
  77. package/runtime/exception.md +62 -11
  78. package/runtime/gc.gr +39 -45
  79. package/runtime/gc.md +4 -4
  80. package/runtime/malloc.gr +7 -7
  81. package/runtime/malloc.md +4 -4
  82. package/runtime/math/kernel/cos.gr +70 -0
  83. package/runtime/math/kernel/cos.md +14 -0
  84. package/runtime/math/kernel/sin.gr +65 -0
  85. package/runtime/math/kernel/sin.md +14 -0
  86. package/runtime/math/kernel/tan.gr +136 -0
  87. package/runtime/math/kernel/tan.md +14 -0
  88. package/runtime/math/rempio2.gr +244 -0
  89. package/runtime/math/rempio2.md +14 -0
  90. package/runtime/math/trig.gr +130 -0
  91. package/runtime/math/trig.md +28 -0
  92. package/runtime/math/umuldi.gr +26 -0
  93. package/runtime/math/umuldi.md +14 -0
  94. package/runtime/numberUtils.gr +29 -29
  95. package/runtime/numberUtils.md +12 -12
  96. package/runtime/numbers.gr +373 -381
  97. package/runtime/numbers.md +79 -73
  98. package/runtime/string.gr +37 -105
  99. package/runtime/string.md +3 -9
  100. package/runtime/unsafe/constants.md +24 -24
  101. package/runtime/unsafe/conv.md +13 -13
  102. package/runtime/unsafe/memory.gr +24 -20
  103. package/runtime/unsafe/memory.md +27 -7
  104. package/runtime/unsafe/offsets.gr +36 -0
  105. package/runtime/unsafe/offsets.md +88 -0
  106. package/runtime/unsafe/panic.gr +28 -0
  107. package/runtime/unsafe/panic.md +14 -0
  108. package/runtime/unsafe/tags.md +32 -32
  109. package/runtime/unsafe/wasmf32.md +28 -28
  110. package/runtime/unsafe/wasmf64.md +28 -28
  111. package/runtime/unsafe/wasmi32.md +47 -47
  112. package/runtime/unsafe/wasmi64.md +50 -50
  113. package/runtime/utf8.gr +189 -0
  114. package/runtime/utf8.md +117 -0
  115. package/runtime/wasi.gr +4 -2
  116. package/runtime/wasi.md +138 -138
  117. package/set.gr +18 -11
  118. package/set.md +42 -36
  119. package/stack.gr +171 -2
  120. package/stack.md +297 -15
  121. package/string.gr +352 -557
  122. package/string.md +77 -34
  123. package/uint16.gr +81 -0
  124. package/uint16.md +183 -22
  125. package/uint32.gr +25 -4
  126. package/uint32.md +63 -28
  127. package/uint64.gr +25 -5
  128. package/uint64.md +63 -28
  129. package/uint8.gr +81 -0
  130. package/uint8.md +183 -22
  131. package/uri.gr +57 -53
  132. package/uri.md +11 -12
  133. package/wasi/file.gr +67 -59
  134. package/wasi/file.md +39 -39
  135. package/wasi/process.md +5 -5
  136. package/wasi/random.md +3 -3
  137. package/wasi/time.md +4 -4
  138. package/runtime/utils/printing.gr +0 -60
  139. package/runtime/utils/printing.md +0 -26
package/float64.md CHANGED
@@ -41,7 +41,7 @@ No other changes yet.
41
41
  </details>
42
42
 
43
43
  ```grain
44
- infinity : Float64
44
+ infinity: Float64
45
45
  ```
46
46
 
47
47
  Infinity represented as a Float64 value.
@@ -55,7 +55,7 @@ No other changes yet.
55
55
  </details>
56
56
 
57
57
  ```grain
58
- nan : Float64
58
+ nan: Float64
59
59
  ```
60
60
 
61
61
  NaN (Not a Number) represented as a Float64 value.
@@ -69,7 +69,7 @@ No other changes yet.
69
69
  </details>
70
70
 
71
71
  ```grain
72
- pi : Float64
72
+ pi: Float64
73
73
  ```
74
74
 
75
75
  Pi represented as a Float64 value.
@@ -82,7 +82,7 @@ No other changes yet.
82
82
  </details>
83
83
 
84
84
  ```grain
85
- tau : Float64
85
+ tau: Float64
86
86
  ```
87
87
 
88
88
  Tau represented as a Float64 value.
@@ -95,7 +95,7 @@ No other changes yet.
95
95
  </details>
96
96
 
97
97
  ```grain
98
- e : Float64
98
+ e: Float64
99
99
  ```
100
100
 
101
101
  Euler's number represented as a Float64 value.
@@ -108,7 +108,7 @@ No other changes yet.
108
108
  </details>
109
109
 
110
110
  ```grain
111
- fromNumber : (number: Number) => Float64
111
+ fromNumber: (number: Number) => Float64
112
112
  ```
113
113
 
114
114
  Converts a Number to a Float64.
@@ -133,7 +133,7 @@ No other changes yet.
133
133
  </details>
134
134
 
135
135
  ```grain
136
- toNumber : (float: Float64) => Number
136
+ toNumber: (float: Float64) => Number
137
137
  ```
138
138
 
139
139
  Converts a Float64 to a Number.
@@ -150,6 +150,76 @@ Returns:
150
150
  |----|-----------|
151
151
  |`Number`|The Float64 represented as a Number|
152
152
 
153
+ ### Float64.**reinterpretInt64**
154
+
155
+ <details disabled>
156
+ <summary tabindex="-1">Added in <code>0.7.0</code></summary>
157
+ No other changes yet.
158
+ </details>
159
+
160
+ ```grain
161
+ reinterpretInt64: (value: Int64) => Float64
162
+ ```
163
+
164
+ Interprets an Int64 as a Float64.
165
+
166
+ Parameters:
167
+
168
+ |param|type|description|
169
+ |-----|----|-----------|
170
+ |`value`|`Int64`|The value to convert|
171
+
172
+ Returns:
173
+
174
+ |type|description|
175
+ |----|-----------|
176
+ |`Float64`|The Int64 interpreted as an Float64|
177
+
178
+ Examples:
179
+
180
+ ```grain
181
+ assert Float64.reinterpretInt64(4607182418800017408L) == 1.0d
182
+ ```
183
+
184
+ ```grain
185
+ assert Float64.reinterpretInt64(-4616189618054758400L) == -1.0d
186
+ ```
187
+
188
+ ### Float64.**reinterpretUint64**
189
+
190
+ <details disabled>
191
+ <summary tabindex="-1">Added in <code>0.7.0</code></summary>
192
+ No other changes yet.
193
+ </details>
194
+
195
+ ```grain
196
+ reinterpretUint64: (value: Uint64) => Float64
197
+ ```
198
+
199
+ Interprets an Uint64 as a Float64.
200
+
201
+ Parameters:
202
+
203
+ |param|type|description|
204
+ |-----|----|-----------|
205
+ |`value`|`Uint64`|The value to convert|
206
+
207
+ Returns:
208
+
209
+ |type|description|
210
+ |----|-----------|
211
+ |`Float64`|The Uint64 interpreted as an Float64|
212
+
213
+ Examples:
214
+
215
+ ```grain
216
+ assert Float64.reinterpretUint64(4607182418800017408uL) == 1.0d
217
+ ```
218
+
219
+ ```grain
220
+ assert Float64.reinterpretUint64(13830554455654793216uL) == -1.0d
221
+ ```
222
+
153
223
  ### Float64.**(+)**
154
224
 
155
225
  <details>
@@ -165,7 +235,7 @@ Returns:
165
235
  </details>
166
236
 
167
237
  ```grain
168
- (+) : (x: Float64, y: Float64) => Float64
238
+ (+): (x: Float64, y: Float64) => Float64
169
239
  ```
170
240
 
171
241
  Computes the sum of its operands.
@@ -205,7 +275,7 @@ assert 1.0d + 1.0d == 2.0d
205
275
  </details>
206
276
 
207
277
  ```grain
208
- (-) : (x: Float64, y: Float64) => Float64
278
+ (-): (x: Float64, y: Float64) => Float64
209
279
  ```
210
280
 
211
281
  Computes the difference of its operands.
@@ -245,7 +315,7 @@ assert 5.0d - 4.0d == 1.0d
245
315
  </details>
246
316
 
247
317
  ```grain
248
- (*) : (x: Float64, y: Float64) => Float64
318
+ (*): (x: Float64, y: Float64) => Float64
249
319
  ```
250
320
 
251
321
  Computes the product of its operands.
@@ -285,7 +355,7 @@ assert -5.0d * 4.0d == -20.0d
285
355
  </details>
286
356
 
287
357
  ```grain
288
- (/) : (x: Float64, y: Float64) => Float64
358
+ (/): (x: Float64, y: Float64) => Float64
289
359
  ```
290
360
 
291
361
  Computes the quotient of its operands.
@@ -310,6 +380,39 @@ use Float64.{ (/) }
310
380
  assert 25.0d / 4.0d == 6.25d
311
381
  ```
312
382
 
383
+ ### Float64.**(\*\*)**
384
+
385
+ <details disabled>
386
+ <summary tabindex="-1">Added in <code>0.7.0</code></summary>
387
+ No other changes yet.
388
+ </details>
389
+
390
+ ```grain
391
+ (**): (base: Float64, power: Float64) => Float64
392
+ ```
393
+
394
+ Computes the exponentiation of the given base and power.
395
+
396
+ Parameters:
397
+
398
+ |param|type|description|
399
+ |-----|----|-----------|
400
+ |`base`|`Float64`|The base float|
401
+ |`power`|`Float64`|The exponent float|
402
+
403
+ Returns:
404
+
405
+ |type|description|
406
+ |----|-----------|
407
+ |`Float64`|The base raised to the given power|
408
+
409
+ Examples:
410
+
411
+ ```grain
412
+ use Float64.{ (**) }
413
+ assert 2.0d ** 2.0d == 4.0d
414
+ ```
415
+
313
416
  ### Float64.**(<)**
314
417
 
315
418
  <details>
@@ -325,7 +428,7 @@ assert 25.0d / 4.0d == 6.25d
325
428
  </details>
326
429
 
327
430
  ```grain
328
- (<) : (x: Float64, y: Float64) => Bool
431
+ (<): (x: Float64, y: Float64) => Bool
329
432
  ```
330
433
 
331
434
  Checks if the first value is less than the second value.
@@ -365,7 +468,7 @@ assert -5.0d < 5.0d
365
468
  </details>
366
469
 
367
470
  ```grain
368
- (>) : (x: Float64, y: Float64) => Bool
471
+ (>): (x: Float64, y: Float64) => Bool
369
472
  ```
370
473
 
371
474
  Checks if the first value is greater than the second value.
@@ -405,7 +508,7 @@ assert 6.0d > 5.0d
405
508
  </details>
406
509
 
407
510
  ```grain
408
- (<=) : (x: Float64, y: Float64) => Bool
511
+ (<=): (x: Float64, y: Float64) => Bool
409
512
  ```
410
513
 
411
514
  Checks if the first value is less than or equal to the second value.
@@ -450,7 +553,7 @@ assert 2.0d <= 2.0d
450
553
  </details>
451
554
 
452
555
  ```grain
453
- (>=) : (x: Float64, y: Float64) => Bool
556
+ (>=): (x: Float64, y: Float64) => Bool
454
557
  ```
455
558
 
456
559
  Checks if the first value is greater than or equal to the second value.
@@ -480,6 +583,54 @@ use Float64.{ (>=) }
480
583
  assert -1.0d >= -1.0d
481
584
  ```
482
585
 
586
+ ### Float64.**isFinite**
587
+
588
+ <details disabled>
589
+ <summary tabindex="-1">Added in <code>0.7.0</code></summary>
590
+ No other changes yet.
591
+ </details>
592
+
593
+ ```grain
594
+ isFinite: (x: Float64) => Bool
595
+ ```
596
+
597
+ Checks if a float is finite.
598
+ All values are finite exept for NaN, infinity or negative infinity.
599
+
600
+ Parameters:
601
+
602
+ |param|type|description|
603
+ |-----|----|-----------|
604
+ |`x`|`Float64`|The number to check|
605
+
606
+ Returns:
607
+
608
+ |type|description|
609
+ |----|-----------|
610
+ |`Bool`|`true` if the value is finite or `false` otherwise|
611
+
612
+ Examples:
613
+
614
+ ```grain
615
+ Float64.isFinite(0.5d)
616
+ ```
617
+
618
+ ```grain
619
+ Float64.isFinite(1.0d)
620
+ ```
621
+
622
+ ```grain
623
+ Float64.isFinite(Infinityd) == false
624
+ ```
625
+
626
+ ```grain
627
+ Float64.isFinite(-Infinityd) == false
628
+ ```
629
+
630
+ ```grain
631
+ Float64.isFinite(NaNd) == false
632
+ ```
633
+
483
634
  ### Float64.**isNaN**
484
635
 
485
636
  <details disabled>
@@ -488,7 +639,7 @@ No other changes yet.
488
639
  </details>
489
640
 
490
641
  ```grain
491
- isNaN : (x: Float64) => Bool
642
+ isNaN: (x: Float64) => Bool
492
643
  ```
493
644
 
494
645
  Checks if the value is a float NaN value (Not A Number).
@@ -535,7 +686,7 @@ No other changes yet.
535
686
  </details>
536
687
 
537
688
  ```grain
538
- isInfinite : (x: Float64) => Bool
689
+ isInfinite: (x: Float64) => Bool
539
690
  ```
540
691
 
541
692
  Checks if a float is infinite, that is either of positive or negative infinity.
@@ -574,6 +725,70 @@ Float64.isInfinite(0.5d) == false
574
725
  Float64.isInfinite(1.0d) == false
575
726
  ```
576
727
 
728
+ ### Float64.**min**
729
+
730
+ <details disabled>
731
+ <summary tabindex="-1">Added in <code>0.7.0</code></summary>
732
+ No other changes yet.
733
+ </details>
734
+
735
+ ```grain
736
+ min: (x: Float64, y: Float64) => Float64
737
+ ```
738
+
739
+ Returns the smaller of its operands.
740
+
741
+ Parameters:
742
+
743
+ |param|type|description|
744
+ |-----|----|-----------|
745
+ |`x`|`Float64`|The first operand|
746
+ |`y`|`Float64`|The second operand|
747
+
748
+ Returns:
749
+
750
+ |type|description|
751
+ |----|-----------|
752
+ |`Float64`|The smaller of the two operands|
753
+
754
+ Examples:
755
+
756
+ ```grain
757
+ Float64.min(5.0d, 2.0d) == 2.0d
758
+ ```
759
+
760
+ ### Float64.**max**
761
+
762
+ <details disabled>
763
+ <summary tabindex="-1">Added in <code>0.7.0</code></summary>
764
+ No other changes yet.
765
+ </details>
766
+
767
+ ```grain
768
+ max: (x: Float64, y: Float64) => Float64
769
+ ```
770
+
771
+ Returns the larger of its operands.
772
+
773
+ Parameters:
774
+
775
+ |param|type|description|
776
+ |-----|----|-----------|
777
+ |`x`|`Float64`|The first operand|
778
+ |`y`|`Float64`|The second operand|
779
+
780
+ Returns:
781
+
782
+ |type|description|
783
+ |----|-----------|
784
+ |`Float64`|The larger of the two operands|
785
+
786
+ Examples:
787
+
788
+ ```grain
789
+ Float64.max(5.0d, 2.0d) == 5.0d
790
+ ```
791
+
577
792
  ### Float64.**abs**
578
793
 
579
794
  <details disabled>
@@ -582,7 +797,7 @@ No other changes yet.
582
797
  </details>
583
798
 
584
799
  ```grain
585
- abs : (x: Float64) => Float64
800
+ abs: (x: Float64) => Float64
586
801
  ```
587
802
 
588
803
  Returns the absolute value. That is, it returns `x` if `x` is positive or zero and the negation of `x` if `x` is negative.
@@ -617,7 +832,7 @@ No other changes yet.
617
832
  </details>
618
833
 
619
834
  ```grain
620
- neg : (x: Float64) => Float64
835
+ neg: (x: Float64) => Float64
621
836
  ```
622
837
 
623
838
  Returns the negation of its operand.
@@ -644,3 +859,375 @@ Float64.neg(-1.0d) == 1.0d
644
859
  Float64.neg(1.0d) == -1.0d
645
860
  ```
646
861
 
862
+ ### Float64.**ceil**
863
+
864
+ <details disabled>
865
+ <summary tabindex="-1">Added in <code>0.7.0</code></summary>
866
+ No other changes yet.
867
+ </details>
868
+
869
+ ```grain
870
+ ceil: (x: Float64) => Float64
871
+ ```
872
+
873
+ Rounds its operand up to the next largest whole value.
874
+
875
+ Parameters:
876
+
877
+ |param|type|description|
878
+ |-----|----|-----------|
879
+ |`x`|`Float64`|The operand to ceil|
880
+
881
+ Returns:
882
+
883
+ |type|description|
884
+ |----|-----------|
885
+ |`Float64`|The next largest whole value of the operand|
886
+
887
+ Examples:
888
+
889
+ ```grain
890
+ Float64.ceil(5.5d) == 6.0d
891
+ ```
892
+
893
+ ```grain
894
+ Float64.ceil(-5.5d) == -5.0d
895
+ ```
896
+
897
+ ### Float64.**floor**
898
+
899
+ <details disabled>
900
+ <summary tabindex="-1">Added in <code>0.7.0</code></summary>
901
+ No other changes yet.
902
+ </details>
903
+
904
+ ```grain
905
+ floor: (x: Float64) => Float64
906
+ ```
907
+
908
+ Rounds its operand down to the largest whole value less than the operand.
909
+
910
+ Parameters:
911
+
912
+ |param|type|description|
913
+ |-----|----|-----------|
914
+ |`x`|`Float64`|The operand to floor|
915
+
916
+ Returns:
917
+
918
+ |type|description|
919
+ |----|-----------|
920
+ |`Float64`|The previous whole value of the operand|
921
+
922
+ Examples:
923
+
924
+ ```grain
925
+ Float64.floor(5.5d) == 5.0d
926
+ ```
927
+
928
+ ```grain
929
+ Float64.floor(-5.5d) == -6.0d
930
+ ```
931
+
932
+ ### Float64.**trunc**
933
+
934
+ <details disabled>
935
+ <summary tabindex="-1">Added in <code>0.7.0</code></summary>
936
+ No other changes yet.
937
+ </details>
938
+
939
+ ```grain
940
+ trunc: (x: Float64) => Float64
941
+ ```
942
+
943
+ Returns the whole value part of its operand, removing any fractional value.
944
+
945
+ Parameters:
946
+
947
+ |param|type|description|
948
+ |-----|----|-----------|
949
+ |`x`|`Float64`|The operand to truncate|
950
+
951
+ Returns:
952
+
953
+ |type|description|
954
+ |----|-----------|
955
+ |`Float64`|The whole value part of the operand|
956
+
957
+ Examples:
958
+
959
+ ```grain
960
+ Float64.trunc(5.5d) == 5.0d
961
+ ```
962
+
963
+ ### Float64.**round**
964
+
965
+ <details disabled>
966
+ <summary tabindex="-1">Added in <code>0.7.0</code></summary>
967
+ No other changes yet.
968
+ </details>
969
+
970
+ ```grain
971
+ round: (x: Float64) => Float64
972
+ ```
973
+
974
+ Returns its operand rounded to its nearest integer.
975
+
976
+ Parameters:
977
+
978
+ |param|type|description|
979
+ |-----|----|-----------|
980
+ |`x`|`Float64`|The operand to round|
981
+
982
+ Returns:
983
+
984
+ |type|description|
985
+ |----|-----------|
986
+ |`Float64`|The nearest integer to the operand|
987
+
988
+ Examples:
989
+
990
+ ```grain
991
+ Float64.round(5.5d) == 6.0d
992
+ ```
993
+
994
+ ```grain
995
+ Float64.round(5.4d) == 5.0d
996
+ ```
997
+
998
+ ```grain
999
+ Float64.round(-5.5d) == -6.0d
1000
+ ```
1001
+
1002
+ ```grain
1003
+ Float64.round(-5.4d) == -5.0d
1004
+ ```
1005
+
1006
+ ### Float64.**sqrt**
1007
+
1008
+ <details disabled>
1009
+ <summary tabindex="-1">Added in <code>0.7.0</code></summary>
1010
+ No other changes yet.
1011
+ </details>
1012
+
1013
+ ```grain
1014
+ sqrt: (x: Float64) => Float64
1015
+ ```
1016
+
1017
+ Computes the square root of its operand.
1018
+
1019
+ Parameters:
1020
+
1021
+ |param|type|description|
1022
+ |-----|----|-----------|
1023
+ |`x`|`Float64`|The operand to square root|
1024
+
1025
+ Returns:
1026
+
1027
+ |type|description|
1028
+ |----|-----------|
1029
+ |`Float64`|The square root of the operand|
1030
+
1031
+ Examples:
1032
+
1033
+ ```grain
1034
+ Float64.sqrt(25.0d) == 5.0d
1035
+ ```
1036
+
1037
+ ### Float64.**copySign**
1038
+
1039
+ <details disabled>
1040
+ <summary tabindex="-1">Added in <code>0.7.0</code></summary>
1041
+ No other changes yet.
1042
+ </details>
1043
+
1044
+ ```grain
1045
+ copySign: (x: Float64, y: Float64) => Float64
1046
+ ```
1047
+
1048
+ Copys the sign of the second operand to the first operand.
1049
+
1050
+ Parameters:
1051
+
1052
+ |param|type|description|
1053
+ |-----|----|-----------|
1054
+ |`x`|`Float64`|The operand to be modify|
1055
+ |`y`|`Float64`|The operand to copy the sign from|
1056
+
1057
+ Returns:
1058
+
1059
+ |type|description|
1060
+ |----|-----------|
1061
+ |`Float64`|The first operand with the sign of the second operand|
1062
+
1063
+ Examples:
1064
+
1065
+ ```grain
1066
+ Float64.copySign(2.0d, 1.0d) == 2.0d
1067
+ ```
1068
+
1069
+ ```grain
1070
+ Float64.copySign(3.0d, -1.0d) == -3.0d
1071
+ ```
1072
+
1073
+ ```grain
1074
+ Float64.copySign(-5.0d, 1.0d) == 5.0d
1075
+ ```
1076
+
1077
+ ### Float64.**isClose**
1078
+
1079
+ <details disabled>
1080
+ <summary tabindex="-1">Added in <code>0.7.0</code></summary>
1081
+ No other changes yet.
1082
+ </details>
1083
+
1084
+ ```grain
1085
+ isClose:
1086
+ (a: Float64, b: Float64, ?relativeTolerance: Float64,
1087
+ ?absoluteTolerance: Float64) => Bool
1088
+ ```
1089
+
1090
+ Determines whether two values are considered close to each other using a relative and absolute tolerance.
1091
+
1092
+ Parameters:
1093
+
1094
+ |param|type|description|
1095
+ |-----|----|-----------|
1096
+ |`a`|`Float64`|The first value|
1097
+ |`b`|`Float64`|The second value|
1098
+ |`?relativeTolerance`|`Float64`|The maximum tolerance to use relative to the larger absolute value `a` or `b`|
1099
+ |`?absoluteTolerance`|`Float64`|The absolute tolerance to use, regardless of the values of `a` or `b`|
1100
+
1101
+ Returns:
1102
+
1103
+ |type|description|
1104
+ |----|-----------|
1105
+ |`Bool`|`true` if the values are considered close to each other or `false` otherwise|
1106
+
1107
+ Examples:
1108
+
1109
+ ```grain
1110
+ Float64.isClose(1.233d, 1.233d)
1111
+ ```
1112
+
1113
+ ```grain
1114
+ Float64.isClose(1.233d, 1.233000001d)
1115
+ ```
1116
+
1117
+ ```grain
1118
+ Float64.isClose(8.005d, 8.450d, absoluteTolerance=0.5d)
1119
+ ```
1120
+
1121
+ ```grain
1122
+ Float64.isClose(4.0d, 4.1d, relativeTolerance=0.025d)
1123
+ ```
1124
+
1125
+ ```grain
1126
+ Float64.isClose(1.233d, 1.24d) == false
1127
+ ```
1128
+
1129
+ ```grain
1130
+ Float64.isClose(1.233d, 1.4566d) == false
1131
+ ```
1132
+
1133
+ ```grain
1134
+ Float64.isClose(8.005d, 8.450d, absoluteTolerance=0.4d) == false
1135
+ ```
1136
+
1137
+ ```grain
1138
+ Float64.isClose(4.0d, 4.1d, relativeTolerance=0.024d) == false
1139
+ ```
1140
+
1141
+ ### Float64.**sin**
1142
+
1143
+ <details disabled>
1144
+ <summary tabindex="-1">Added in <code>0.7.0</code></summary>
1145
+ No other changes yet.
1146
+ </details>
1147
+
1148
+ ```grain
1149
+ sin: (radians: Float64) => Float64
1150
+ ```
1151
+
1152
+ Computes the sine of a float (in radians).
1153
+
1154
+ Parameters:
1155
+
1156
+ |param|type|description|
1157
+ |-----|----|-----------|
1158
+ |`radians`|`Float64`|The input in radians|
1159
+
1160
+ Returns:
1161
+
1162
+ |type|description|
1163
+ |----|-----------|
1164
+ |`Float64`|The computed sine|
1165
+
1166
+ Examples:
1167
+
1168
+ ```grain
1169
+ Float64.sin(0.0d) == 0.0d
1170
+ ```
1171
+
1172
+ ### Float64.**cos**
1173
+
1174
+ <details disabled>
1175
+ <summary tabindex="-1">Added in <code>0.7.0</code></summary>
1176
+ No other changes yet.
1177
+ </details>
1178
+
1179
+ ```grain
1180
+ cos: (radians: Float64) => Float64
1181
+ ```
1182
+
1183
+ Computes the cosine of a float (in radians).
1184
+
1185
+ Parameters:
1186
+
1187
+ |param|type|description|
1188
+ |-----|----|-----------|
1189
+ |`radians`|`Float64`|The input in radians|
1190
+
1191
+ Returns:
1192
+
1193
+ |type|description|
1194
+ |----|-----------|
1195
+ |`Float64`|The computed cosine|
1196
+
1197
+ Examples:
1198
+
1199
+ ```grain
1200
+ Float64.cos(0.0d) == 1.0d
1201
+ ```
1202
+
1203
+ ### Float64.**tan**
1204
+
1205
+ <details disabled>
1206
+ <summary tabindex="-1">Added in <code>0.7.0</code></summary>
1207
+ No other changes yet.
1208
+ </details>
1209
+
1210
+ ```grain
1211
+ tan: (radians: Float64) => Float64
1212
+ ```
1213
+
1214
+ Computes the tangent of a number (in radians).
1215
+
1216
+ Parameters:
1217
+
1218
+ |param|type|description|
1219
+ |-----|----|-----------|
1220
+ |`radians`|`Float64`|The input in radians|
1221
+
1222
+ Returns:
1223
+
1224
+ |type|description|
1225
+ |----|-----------|
1226
+ |`Float64`|The computed tangent|
1227
+
1228
+ Examples:
1229
+
1230
+ ```grain
1231
+ Float64.tan(0.0d) == 0.0d
1232
+ ```
1233
+