@grain/stdlib 0.6.6 → 0.7.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 +67 -0
- package/LICENSE +1 -1
- package/README.md +2 -2
- package/array.gr +55 -7
- package/array.md +606 -560
- package/bigint.md +228 -228
- package/buffer.gr +85 -53
- package/buffer.md +442 -319
- package/bytes.gr +112 -35
- package/bytes.md +299 -219
- package/char.gr +201 -99
- package/char.md +447 -120
- package/exception.gr +11 -11
- package/exception.md +29 -4
- package/float32.gr +327 -3
- package/float32.md +698 -111
- package/float64.gr +320 -3
- package/float64.md +698 -111
- package/fs.gr +1082 -0
- package/fs.md +630 -0
- package/hash.gr +142 -88
- package/hash.md +105 -17
- package/int16.md +178 -178
- package/int32.gr +26 -5
- package/int32.md +266 -231
- package/int64.gr +27 -2
- package/int64.md +266 -231
- package/int8.md +178 -178
- package/json.gr +366 -51
- package/json.md +431 -15
- package/list.gr +328 -31
- package/list.md +759 -336
- package/map.gr +20 -12
- package/map.md +266 -260
- package/marshal.gr +41 -40
- package/marshal.md +14 -14
- package/number.gr +278 -35
- package/number.md +688 -269
- package/option.md +162 -162
- package/package.json +5 -3
- package/path.gr +48 -0
- package/path.md +180 -89
- package/pervasives.gr +2 -2
- package/pervasives.md +275 -275
- package/priorityqueue.gr +7 -7
- package/priorityqueue.md +131 -131
- package/queue.gr +183 -29
- package/queue.md +404 -148
- package/random.md +43 -43
- package/range.gr +4 -4
- package/range.md +42 -42
- package/rational.md +123 -123
- package/regex.gr +52 -51
- package/regex.md +102 -102
- package/result.md +118 -118
- package/runtime/atof/common.md +39 -39
- package/runtime/atof/decimal.gr +6 -6
- package/runtime/atof/decimal.md +14 -14
- package/runtime/atof/lemire.gr +5 -5
- package/runtime/atof/lemire.md +1 -1
- package/runtime/atof/parse.gr +16 -16
- package/runtime/atof/parse.md +2 -2
- package/runtime/atof/slow.md +1 -1
- package/runtime/atof/table.md +2 -2
- package/runtime/atoi/parse.gr +3 -3
- package/runtime/atoi/parse.md +1 -1
- package/runtime/bigint.gr +15 -47
- package/runtime/bigint.md +54 -60
- package/runtime/compare.gr +2 -2
- package/runtime/compare.md +8 -8
- package/runtime/dataStructures.md +211 -211
- package/runtime/debugPrint.gr +4 -1
- package/runtime/debugPrint.md +9 -9
- package/runtime/equal.gr +99 -77
- package/runtime/equal.md +8 -8
- package/runtime/exception.gr +62 -82
- package/runtime/exception.md +62 -11
- package/runtime/gc.gr +39 -45
- package/runtime/gc.md +4 -4
- package/runtime/malloc.gr +7 -7
- package/runtime/malloc.md +13 -13
- package/runtime/math/kernel/cos.gr +70 -0
- package/runtime/math/kernel/cos.md +14 -0
- package/runtime/math/kernel/sin.gr +65 -0
- package/runtime/math/kernel/sin.md +14 -0
- package/runtime/math/kernel/tan.gr +136 -0
- package/runtime/math/kernel/tan.md +14 -0
- package/runtime/math/rempio2.gr +244 -0
- package/runtime/math/rempio2.md +14 -0
- package/runtime/math/trig.gr +130 -0
- package/runtime/math/trig.md +28 -0
- package/runtime/math/umuldi.gr +26 -0
- package/runtime/math/umuldi.md +14 -0
- package/runtime/numberUtils.gr +29 -29
- package/runtime/numberUtils.md +12 -12
- package/runtime/numbers.gr +373 -381
- package/runtime/numbers.md +348 -342
- package/runtime/string.gr +37 -105
- package/runtime/string.md +20 -26
- package/runtime/unsafe/constants.md +24 -24
- package/runtime/unsafe/conv.md +19 -19
- package/runtime/unsafe/memory.gr +24 -20
- package/runtime/unsafe/memory.md +27 -7
- package/runtime/unsafe/offsets.gr +36 -0
- package/runtime/unsafe/offsets.md +88 -0
- package/runtime/unsafe/panic.gr +28 -0
- package/runtime/unsafe/panic.md +14 -0
- package/runtime/unsafe/tags.md +32 -32
- package/runtime/unsafe/wasmf32.md +28 -28
- package/runtime/unsafe/wasmf64.md +28 -28
- package/runtime/unsafe/wasmi32.md +47 -47
- package/runtime/unsafe/wasmi64.md +50 -50
- package/runtime/utf8.gr +189 -0
- package/runtime/utf8.md +117 -0
- package/runtime/wasi.gr +4 -2
- package/runtime/wasi.md +147 -147
- package/set.gr +18 -11
- package/set.md +253 -247
- package/stack.gr +171 -2
- package/stack.md +371 -89
- package/string.gr +352 -557
- package/string.md +298 -255
- package/uint16.md +170 -170
- package/uint32.gr +25 -4
- package/uint32.md +249 -214
- package/uint64.gr +25 -5
- package/uint64.md +249 -214
- package/uint8.md +170 -170
- package/uri.gr +57 -53
- package/uri.md +88 -89
- package/wasi/file.gr +67 -59
- package/wasi/file.md +308 -308
- package/wasi/process.md +26 -26
- package/wasi/random.md +12 -12
- package/wasi/time.md +16 -16
- package/runtime/utils/printing.gr +0 -60
- package/runtime/utils/printing.md +0 -26
package/runtime/numbers.md
CHANGED
|
@@ -9,153 +9,153 @@ Functions and constants included in the Numbers module.
|
|
|
9
9
|
### Numbers.**tagSimple**
|
|
10
10
|
|
|
11
11
|
```grain
|
|
12
|
-
tagSimple
|
|
12
|
+
tagSimple: (x: WasmI32) => WasmI32
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
### Numbers.**isBoxedNumber**
|
|
16
16
|
|
|
17
17
|
```grain
|
|
18
|
-
isBoxedNumber
|
|
18
|
+
isBoxedNumber: (x: WasmI32) => Bool
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
### Numbers.**isFloat**
|
|
22
22
|
|
|
23
23
|
```grain
|
|
24
|
-
isFloat
|
|
24
|
+
isFloat: (x: WasmI32) => Bool
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
### Numbers.**isInteger**
|
|
28
28
|
|
|
29
29
|
```grain
|
|
30
|
-
isInteger
|
|
30
|
+
isInteger: (x: WasmI32) => Bool
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
### Numbers.**isRational**
|
|
34
34
|
|
|
35
35
|
```grain
|
|
36
|
-
isRational
|
|
36
|
+
isRational: (x: WasmI32) => Bool
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
### Numbers.**isNaN**
|
|
40
40
|
|
|
41
41
|
```grain
|
|
42
|
-
isNaN
|
|
42
|
+
isNaN: (x: WasmI32) => Bool
|
|
43
43
|
```
|
|
44
44
|
|
|
45
45
|
### Numbers.**isNumber**
|
|
46
46
|
|
|
47
47
|
```grain
|
|
48
|
-
isNumber
|
|
48
|
+
isNumber: (x: WasmI32) => Bool
|
|
49
49
|
```
|
|
50
50
|
|
|
51
51
|
### Numbers.**reducedInteger**
|
|
52
52
|
|
|
53
53
|
```grain
|
|
54
|
-
reducedInteger
|
|
54
|
+
reducedInteger: (x: WasmI64) => WasmI32
|
|
55
55
|
```
|
|
56
56
|
|
|
57
57
|
### Numbers.**reducedUnsignedInteger**
|
|
58
58
|
|
|
59
59
|
```grain
|
|
60
|
-
reducedUnsignedInteger
|
|
60
|
+
reducedUnsignedInteger: (x: WasmI64) => WasmI32
|
|
61
61
|
```
|
|
62
62
|
|
|
63
63
|
### Numbers.**boxedNumberTag**
|
|
64
64
|
|
|
65
65
|
```grain
|
|
66
|
-
boxedNumberTag
|
|
66
|
+
boxedNumberTag: (xptr: WasmI32) => WasmI32
|
|
67
67
|
```
|
|
68
68
|
|
|
69
69
|
### Numbers.**boxedInt64Number**
|
|
70
70
|
|
|
71
71
|
```grain
|
|
72
|
-
boxedInt64Number
|
|
72
|
+
boxedInt64Number: (xptr: WasmI32) => WasmI64
|
|
73
73
|
```
|
|
74
74
|
|
|
75
75
|
### Numbers.**boxedFloat64Number**
|
|
76
76
|
|
|
77
77
|
```grain
|
|
78
|
-
boxedFloat64Number
|
|
78
|
+
boxedFloat64Number: (xptr: WasmI32) => WasmF64
|
|
79
79
|
```
|
|
80
80
|
|
|
81
81
|
### Numbers.**boxedRationalNumerator**
|
|
82
82
|
|
|
83
83
|
```grain
|
|
84
|
-
boxedRationalNumerator
|
|
84
|
+
boxedRationalNumerator: (xptr: WasmI32) => WasmI32
|
|
85
85
|
```
|
|
86
86
|
|
|
87
87
|
### Numbers.**boxedRationalDenominator**
|
|
88
88
|
|
|
89
89
|
```grain
|
|
90
|
-
boxedRationalDenominator
|
|
90
|
+
boxedRationalDenominator: (xptr: WasmI32) => WasmI32
|
|
91
91
|
```
|
|
92
92
|
|
|
93
93
|
### Numbers.**coerceNumberToWasmF32**
|
|
94
94
|
|
|
95
95
|
```grain
|
|
96
|
-
coerceNumberToWasmF32
|
|
96
|
+
coerceNumberToWasmF32: (x: Number) => WasmF32
|
|
97
97
|
```
|
|
98
98
|
|
|
99
99
|
### Numbers.**coerceNumberToWasmF64**
|
|
100
100
|
|
|
101
101
|
```grain
|
|
102
|
-
coerceNumberToWasmF64
|
|
102
|
+
coerceNumberToWasmF64: (x: Number) => WasmF64
|
|
103
103
|
```
|
|
104
104
|
|
|
105
105
|
### Numbers.**coerceNumberToWasmI64**
|
|
106
106
|
|
|
107
107
|
```grain
|
|
108
|
-
coerceNumberToWasmI64
|
|
108
|
+
coerceNumberToWasmI64: (x: Number) => WasmI64
|
|
109
109
|
```
|
|
110
110
|
|
|
111
111
|
### Numbers.**coerceNumberToWasmI32**
|
|
112
112
|
|
|
113
113
|
```grain
|
|
114
|
-
coerceNumberToWasmI32
|
|
114
|
+
coerceNumberToWasmI32: (x: Number) => WasmI32
|
|
115
115
|
```
|
|
116
116
|
|
|
117
117
|
### Numbers.**coerceNumberToUnsignedWasmI64**
|
|
118
118
|
|
|
119
119
|
```grain
|
|
120
|
-
coerceNumberToUnsignedWasmI64
|
|
120
|
+
coerceNumberToUnsignedWasmI64: (x: Number) => WasmI64
|
|
121
121
|
```
|
|
122
122
|
|
|
123
123
|
### Numbers.**coerceNumberToUnsignedWasmI32**
|
|
124
124
|
|
|
125
125
|
```grain
|
|
126
|
-
coerceNumberToUnsignedWasmI32
|
|
126
|
+
coerceNumberToUnsignedWasmI32: (x: Number) => WasmI32
|
|
127
127
|
```
|
|
128
128
|
|
|
129
129
|
### Numbers.**numberEqual**
|
|
130
130
|
|
|
131
131
|
```grain
|
|
132
|
-
numberEqual
|
|
132
|
+
numberEqual: (x: WasmI32, y: WasmI32) => Bool
|
|
133
133
|
```
|
|
134
134
|
|
|
135
135
|
### Numbers.**addSubRational**
|
|
136
136
|
|
|
137
137
|
```grain
|
|
138
|
-
addSubRational
|
|
138
|
+
addSubRational:
|
|
139
139
|
(x: WasmI32, y: WasmI32, isSub: Bool, keepRational: Bool) => WasmI32
|
|
140
140
|
```
|
|
141
141
|
|
|
142
142
|
### Numbers.**timesDivideRational**
|
|
143
143
|
|
|
144
144
|
```grain
|
|
145
|
-
timesDivideRational
|
|
145
|
+
timesDivideRational:
|
|
146
146
|
(x: WasmI32, y: WasmI32, isDivide: Bool, keepRational: Bool) => WasmI32
|
|
147
147
|
```
|
|
148
148
|
|
|
149
149
|
### Numbers.**rationalsEqual**
|
|
150
150
|
|
|
151
151
|
```grain
|
|
152
|
-
rationalsEqual
|
|
152
|
+
rationalsEqual: (x: WasmI32, y: WasmI32) => Bool
|
|
153
153
|
```
|
|
154
154
|
|
|
155
155
|
### Numbers.**cmpRationals**
|
|
156
156
|
|
|
157
157
|
```grain
|
|
158
|
-
cmpRationals
|
|
158
|
+
cmpRationals: (x: WasmI32, y: WasmI32) => WasmI32
|
|
159
159
|
```
|
|
160
160
|
|
|
161
161
|
### Numbers.**rationalNumerator**
|
|
@@ -166,22 +166,22 @@ No other changes yet.
|
|
|
166
166
|
</details>
|
|
167
167
|
|
|
168
168
|
```grain
|
|
169
|
-
rationalNumerator
|
|
169
|
+
rationalNumerator: (x: Rational) => Number
|
|
170
170
|
```
|
|
171
171
|
|
|
172
172
|
Finds the numerator of the rational number.
|
|
173
173
|
|
|
174
174
|
Parameters:
|
|
175
175
|
|
|
176
|
-
|param|type|description|
|
|
177
|
-
|
|
178
|
-
|
|
176
|
+
| param | type | description |
|
|
177
|
+
| ----- | ---------- | ------------------------------ |
|
|
178
|
+
| `x` | `Rational` | The rational number to inspect |
|
|
179
179
|
|
|
180
180
|
Returns:
|
|
181
181
|
|
|
182
|
-
|type|description|
|
|
183
|
-
|
|
184
|
-
|
|
182
|
+
| type | description |
|
|
183
|
+
| -------- | ------------------------------------ |
|
|
184
|
+
| `Number` | The numerator of the rational number |
|
|
185
185
|
|
|
186
186
|
### Numbers.**rationalDenominator**
|
|
187
187
|
|
|
@@ -191,27 +191,27 @@ No other changes yet.
|
|
|
191
191
|
</details>
|
|
192
192
|
|
|
193
193
|
```grain
|
|
194
|
-
rationalDenominator
|
|
194
|
+
rationalDenominator: (x: Rational) => Number
|
|
195
195
|
```
|
|
196
196
|
|
|
197
197
|
Finds the denominator of the rational number.
|
|
198
198
|
|
|
199
199
|
Parameters:
|
|
200
200
|
|
|
201
|
-
|param|type|description|
|
|
202
|
-
|
|
203
|
-
|
|
201
|
+
| param | type | description |
|
|
202
|
+
| ----- | ---------- | ------------------------------ |
|
|
203
|
+
| `x` | `Rational` | The rational number to inspect |
|
|
204
204
|
|
|
205
205
|
Returns:
|
|
206
206
|
|
|
207
|
-
|type|description|
|
|
208
|
-
|
|
209
|
-
|
|
207
|
+
| type | description |
|
|
208
|
+
| -------- | -------------------------------------- |
|
|
209
|
+
| `Number` | The denominator of the rational number |
|
|
210
210
|
|
|
211
211
|
### Numbers.**cmp**
|
|
212
212
|
|
|
213
213
|
```grain
|
|
214
|
-
cmp
|
|
214
|
+
cmp: (x: WasmI32, y: WasmI32) => WasmI32
|
|
215
215
|
```
|
|
216
216
|
|
|
217
217
|
### Numbers.**(<)**
|
|
@@ -222,23 +222,23 @@ No other changes yet.
|
|
|
222
222
|
</details>
|
|
223
223
|
|
|
224
224
|
```grain
|
|
225
|
-
(<)
|
|
225
|
+
(<): (num1: Number, num2: Number) => Bool
|
|
226
226
|
```
|
|
227
227
|
|
|
228
228
|
Checks if the first operand is less than the second operand.
|
|
229
229
|
|
|
230
230
|
Parameters:
|
|
231
231
|
|
|
232
|
-
|param|type|description|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
232
|
+
| param | type | description |
|
|
233
|
+
| ------ | -------- | ------------------ |
|
|
234
|
+
| `num1` | `Number` | The first operand |
|
|
235
|
+
| `num2` | `Number` | The second operand |
|
|
236
236
|
|
|
237
237
|
Returns:
|
|
238
238
|
|
|
239
|
-
|type|description|
|
|
240
|
-
|
|
241
|
-
|
|
239
|
+
| type | description |
|
|
240
|
+
| ------ | -------------------------------------------------------------------------------- |
|
|
241
|
+
| `Bool` | `true` if the first operand is less than the second operand or `false` otherwise |
|
|
242
242
|
|
|
243
243
|
### Numbers.**(>)**
|
|
244
244
|
|
|
@@ -248,23 +248,23 @@ No other changes yet.
|
|
|
248
248
|
</details>
|
|
249
249
|
|
|
250
250
|
```grain
|
|
251
|
-
(>)
|
|
251
|
+
(>): (num1: Number, num2: Number) => Bool
|
|
252
252
|
```
|
|
253
253
|
|
|
254
254
|
Checks if the first operand is greater than the second operand.
|
|
255
255
|
|
|
256
256
|
Parameters:
|
|
257
257
|
|
|
258
|
-
|param|type|description|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
258
|
+
| param | type | description |
|
|
259
|
+
| ------ | -------- | ------------------ |
|
|
260
|
+
| `num1` | `Number` | The first operand |
|
|
261
|
+
| `num2` | `Number` | The second operand |
|
|
262
262
|
|
|
263
263
|
Returns:
|
|
264
264
|
|
|
265
|
-
|type|description|
|
|
266
|
-
|
|
267
|
-
|
|
265
|
+
| type | description |
|
|
266
|
+
| ------ | ----------------------------------------------------------------------------------- |
|
|
267
|
+
| `Bool` | `true` if the first operand is greater than the second operand or `false` otherwise |
|
|
268
268
|
|
|
269
269
|
### Numbers.**(<=)**
|
|
270
270
|
|
|
@@ -274,23 +274,23 @@ No other changes yet.
|
|
|
274
274
|
</details>
|
|
275
275
|
|
|
276
276
|
```grain
|
|
277
|
-
(<=)
|
|
277
|
+
(<=): (num1: Number, num2: Number) => Bool
|
|
278
278
|
```
|
|
279
279
|
|
|
280
280
|
Checks if the first operand is less than or equal to the second operand.
|
|
281
281
|
|
|
282
282
|
Parameters:
|
|
283
283
|
|
|
284
|
-
|param|type|description|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
284
|
+
| param | type | description |
|
|
285
|
+
| ------ | -------- | ------------------ |
|
|
286
|
+
| `num1` | `Number` | The first operand |
|
|
287
|
+
| `num2` | `Number` | The second operand |
|
|
288
288
|
|
|
289
289
|
Returns:
|
|
290
290
|
|
|
291
|
-
|type|description|
|
|
292
|
-
|
|
293
|
-
|
|
291
|
+
| type | description |
|
|
292
|
+
| ------ | -------------------------------------------------------------------------------------------- |
|
|
293
|
+
| `Bool` | `true` if the first operand is less than or equal to the second operand or `false` otherwise |
|
|
294
294
|
|
|
295
295
|
### Numbers.**(>=)**
|
|
296
296
|
|
|
@@ -300,34 +300,34 @@ No other changes yet.
|
|
|
300
300
|
</details>
|
|
301
301
|
|
|
302
302
|
```grain
|
|
303
|
-
(>=)
|
|
303
|
+
(>=): (num1: Number, num2: Number) => Bool
|
|
304
304
|
```
|
|
305
305
|
|
|
306
306
|
Checks if the first operand is greater than or equal to the second operand.
|
|
307
307
|
|
|
308
308
|
Parameters:
|
|
309
309
|
|
|
310
|
-
|param|type|description|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
310
|
+
| param | type | description |
|
|
311
|
+
| ------ | -------- | ------------------ |
|
|
312
|
+
| `num1` | `Number` | The first operand |
|
|
313
|
+
| `num2` | `Number` | The second operand |
|
|
314
314
|
|
|
315
315
|
Returns:
|
|
316
316
|
|
|
317
|
-
|type|description|
|
|
318
|
-
|
|
319
|
-
|
|
317
|
+
| type | description |
|
|
318
|
+
| ------ | ----------------------------------------------------------------------------------------------- |
|
|
319
|
+
| `Bool` | `true` if the first operand is greater than or equal to the second operand or `false` otherwise |
|
|
320
320
|
|
|
321
321
|
### Numbers.**compare**
|
|
322
322
|
|
|
323
323
|
```grain
|
|
324
|
-
compare
|
|
324
|
+
compare: (x: Number, y: Number) => Number
|
|
325
325
|
```
|
|
326
326
|
|
|
327
327
|
### Numbers.**numberEq**
|
|
328
328
|
|
|
329
329
|
```grain
|
|
330
|
-
numberEq
|
|
330
|
+
numberEq: (x: Number, y: Number) => Bool
|
|
331
331
|
```
|
|
332
332
|
|
|
333
333
|
### Numbers.**lnot**
|
|
@@ -338,22 +338,22 @@ No other changes yet.
|
|
|
338
338
|
</details>
|
|
339
339
|
|
|
340
340
|
```grain
|
|
341
|
-
lnot
|
|
341
|
+
lnot: (value: Number) => Number
|
|
342
342
|
```
|
|
343
343
|
|
|
344
344
|
Computes the bitwise NOT of the operand.
|
|
345
345
|
|
|
346
346
|
Parameters:
|
|
347
347
|
|
|
348
|
-
|param|type|description|
|
|
349
|
-
|
|
350
|
-
|
|
348
|
+
| param | type | description |
|
|
349
|
+
| ------- | -------- | ----------- |
|
|
350
|
+
| `value` | `Number` | The operand |
|
|
351
351
|
|
|
352
352
|
Returns:
|
|
353
353
|
|
|
354
|
-
|type|description|
|
|
355
|
-
|
|
356
|
-
|
|
354
|
+
| type | description |
|
|
355
|
+
| -------- | ------------------------------------------- |
|
|
356
|
+
| `Number` | Containing the inverted bits of the operand |
|
|
357
357
|
|
|
358
358
|
### Numbers.**(<<)**
|
|
359
359
|
|
|
@@ -371,23 +371,23 @@ Returns:
|
|
|
371
371
|
</details>
|
|
372
372
|
|
|
373
373
|
```grain
|
|
374
|
-
(<<)
|
|
374
|
+
(<<): (value: Number, amount: Number) => Number
|
|
375
375
|
```
|
|
376
376
|
|
|
377
377
|
Shifts the bits of the value left by the given number of bits.
|
|
378
378
|
|
|
379
379
|
Parameters:
|
|
380
380
|
|
|
381
|
-
|param|type|description|
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
381
|
+
| param | type | description |
|
|
382
|
+
| -------- | -------- | ------------------------------ |
|
|
383
|
+
| `value` | `Number` | The value to shift |
|
|
384
|
+
| `amount` | `Number` | The number of bits to shift by |
|
|
385
385
|
|
|
386
386
|
Returns:
|
|
387
387
|
|
|
388
|
-
|type|description|
|
|
389
|
-
|
|
390
|
-
|
|
388
|
+
| type | description |
|
|
389
|
+
| -------- | ----------------- |
|
|
390
|
+
| `Number` | The shifted value |
|
|
391
391
|
|
|
392
392
|
### Numbers.**(>>>)**
|
|
393
393
|
|
|
@@ -405,23 +405,23 @@ Returns:
|
|
|
405
405
|
</details>
|
|
406
406
|
|
|
407
407
|
```grain
|
|
408
|
-
(>>>)
|
|
408
|
+
(>>>): (value: Number, amount: Number) => Number
|
|
409
409
|
```
|
|
410
410
|
|
|
411
411
|
Shifts the bits of the value right by the given number of bits, preserving the sign bit.
|
|
412
412
|
|
|
413
413
|
Parameters:
|
|
414
414
|
|
|
415
|
-
|param|type|description|
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
415
|
+
| param | type | description |
|
|
416
|
+
| -------- | -------- | ---------------------- |
|
|
417
|
+
| `value` | `Number` | The value to shift |
|
|
418
|
+
| `amount` | `Number` | The amount to shift by |
|
|
419
419
|
|
|
420
420
|
Returns:
|
|
421
421
|
|
|
422
|
-
|type|description|
|
|
423
|
-
|
|
424
|
-
|
|
422
|
+
| type | description |
|
|
423
|
+
| -------- | ----------------- |
|
|
424
|
+
| `Number` | The shifted value |
|
|
425
425
|
|
|
426
426
|
### Numbers.**(&)**
|
|
427
427
|
|
|
@@ -439,23 +439,23 @@ Returns:
|
|
|
439
439
|
</details>
|
|
440
440
|
|
|
441
441
|
```grain
|
|
442
|
-
(&)
|
|
442
|
+
(&): (value1: Number, value2: Number) => Number
|
|
443
443
|
```
|
|
444
444
|
|
|
445
445
|
Computes the bitwise AND (`&`) on the given operands.
|
|
446
446
|
|
|
447
447
|
Parameters:
|
|
448
448
|
|
|
449
|
-
|param|type|description|
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
449
|
+
| param | type | description |
|
|
450
|
+
| -------- | -------- | ------------------ |
|
|
451
|
+
| `value1` | `Number` | The first operand |
|
|
452
|
+
| `value2` | `Number` | The second operand |
|
|
453
453
|
|
|
454
454
|
Returns:
|
|
455
455
|
|
|
456
|
-
|type|description|
|
|
457
|
-
|
|
458
|
-
|
|
456
|
+
| type | description |
|
|
457
|
+
| -------- | ----------------------------------------------------------------------------------------------- |
|
|
458
|
+
| `Number` | Containing a `1` in each bit position for which the corresponding bits of both operands are `1` |
|
|
459
459
|
|
|
460
460
|
### Numbers.**(|)**
|
|
461
461
|
|
|
@@ -473,23 +473,23 @@ Returns:
|
|
|
473
473
|
</details>
|
|
474
474
|
|
|
475
475
|
```grain
|
|
476
|
-
(|)
|
|
476
|
+
(|): (value1: Number, value2: Number) => Number
|
|
477
477
|
```
|
|
478
478
|
|
|
479
479
|
Computes the bitwise OR (`|`) on the given operands.
|
|
480
480
|
|
|
481
481
|
Parameters:
|
|
482
482
|
|
|
483
|
-
|param|type|description|
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
483
|
+
| param | type | description |
|
|
484
|
+
| -------- | -------- | ------------------ |
|
|
485
|
+
| `value1` | `Number` | The first operand |
|
|
486
|
+
| `value2` | `Number` | The second operand |
|
|
487
487
|
|
|
488
488
|
Returns:
|
|
489
489
|
|
|
490
|
-
|type|description|
|
|
491
|
-
|
|
492
|
-
|
|
490
|
+
| type | description |
|
|
491
|
+
| -------- | --------------------------------------------------------------------------------------------------------- |
|
|
492
|
+
| `Number` | Containing a `1` in each bit position for which the corresponding bits of either or both operands are `1` |
|
|
493
493
|
|
|
494
494
|
### Numbers.**(^)**
|
|
495
495
|
|
|
@@ -508,23 +508,23 @@ Returns:
|
|
|
508
508
|
</details>
|
|
509
509
|
|
|
510
510
|
```grain
|
|
511
|
-
(^)
|
|
511
|
+
(^): (value1: Number, value2: Number) => Number
|
|
512
512
|
```
|
|
513
513
|
|
|
514
514
|
Computes the bitwise XOR (`^`) on the given operands.
|
|
515
515
|
|
|
516
516
|
Parameters:
|
|
517
517
|
|
|
518
|
-
|param|type|description|
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
518
|
+
| param | type | description |
|
|
519
|
+
| -------- | -------- | ------------------ |
|
|
520
|
+
| `value1` | `Number` | The first operand |
|
|
521
|
+
| `value2` | `Number` | The second operand |
|
|
522
522
|
|
|
523
523
|
Returns:
|
|
524
524
|
|
|
525
|
-
|type|description|
|
|
526
|
-
|
|
527
|
-
|
|
525
|
+
| type | description |
|
|
526
|
+
| -------- | -------------------------------------------------------------------------------------------------------------- |
|
|
527
|
+
| `Number` | Containing a `1` in each bit position for which the corresponding bits of either but not both operands are `1` |
|
|
528
528
|
|
|
529
529
|
### Numbers.**(>>)**
|
|
530
530
|
|
|
@@ -542,23 +542,23 @@ Returns:
|
|
|
542
542
|
</details>
|
|
543
543
|
|
|
544
544
|
```grain
|
|
545
|
-
(>>)
|
|
545
|
+
(>>): (value: Number, amount: Number) => Number
|
|
546
546
|
```
|
|
547
547
|
|
|
548
548
|
Shifts the bits of the value right by the given number of bits.
|
|
549
549
|
|
|
550
550
|
Parameters:
|
|
551
551
|
|
|
552
|
-
|param|type|description|
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
552
|
+
| param | type | description |
|
|
553
|
+
| -------- | -------- | ---------------------- |
|
|
554
|
+
| `value` | `Number` | The value to shift |
|
|
555
|
+
| `amount` | `Number` | The amount to shift by |
|
|
556
556
|
|
|
557
557
|
Returns:
|
|
558
558
|
|
|
559
|
-
|type|description|
|
|
560
|
-
|
|
561
|
-
|
|
559
|
+
| type | description |
|
|
560
|
+
| -------- | ----------------- |
|
|
561
|
+
| `Number` | The shifted value |
|
|
562
562
|
|
|
563
563
|
### Numbers.**coerceNumberToInt8**
|
|
564
564
|
|
|
@@ -568,22 +568,22 @@ No other changes yet.
|
|
|
568
568
|
</details>
|
|
569
569
|
|
|
570
570
|
```grain
|
|
571
|
-
coerceNumberToInt8
|
|
571
|
+
coerceNumberToInt8: (number: Number) => Int8
|
|
572
572
|
```
|
|
573
573
|
|
|
574
574
|
Converts a Number to an Int8.
|
|
575
575
|
|
|
576
576
|
Parameters:
|
|
577
577
|
|
|
578
|
-
|param|type|description|
|
|
579
|
-
|
|
580
|
-
|
|
578
|
+
| param | type | description |
|
|
579
|
+
| -------- | -------- | -------------------- |
|
|
580
|
+
| `number` | `Number` | The value to convert |
|
|
581
581
|
|
|
582
582
|
Returns:
|
|
583
583
|
|
|
584
|
-
|type|description|
|
|
585
|
-
|
|
586
|
-
|
|
584
|
+
| type | description |
|
|
585
|
+
| ------ | --------------------------------- |
|
|
586
|
+
| `Int8` | The Number represented as an Int8 |
|
|
587
587
|
|
|
588
588
|
### Numbers.**coerceNumberToInt16**
|
|
589
589
|
|
|
@@ -593,22 +593,22 @@ No other changes yet.
|
|
|
593
593
|
</details>
|
|
594
594
|
|
|
595
595
|
```grain
|
|
596
|
-
coerceNumberToInt16
|
|
596
|
+
coerceNumberToInt16: (number: Number) => Int16
|
|
597
597
|
```
|
|
598
598
|
|
|
599
599
|
Converts a Number to an Int16.
|
|
600
600
|
|
|
601
601
|
Parameters:
|
|
602
602
|
|
|
603
|
-
|param|type|description|
|
|
604
|
-
|
|
605
|
-
|
|
603
|
+
| param | type | description |
|
|
604
|
+
| -------- | -------- | -------------------- |
|
|
605
|
+
| `number` | `Number` | The value to convert |
|
|
606
606
|
|
|
607
607
|
Returns:
|
|
608
608
|
|
|
609
|
-
|type|description|
|
|
610
|
-
|
|
611
|
-
|
|
609
|
+
| type | description |
|
|
610
|
+
| ------- | ---------------------------------- |
|
|
611
|
+
| `Int16` | The Number represented as an Int16 |
|
|
612
612
|
|
|
613
613
|
### Numbers.**coerceNumberToUint8**
|
|
614
614
|
|
|
@@ -618,22 +618,22 @@ No other changes yet.
|
|
|
618
618
|
</details>
|
|
619
619
|
|
|
620
620
|
```grain
|
|
621
|
-
coerceNumberToUint8
|
|
621
|
+
coerceNumberToUint8: (number: Number) => Uint8
|
|
622
622
|
```
|
|
623
623
|
|
|
624
624
|
Converts a Number to a Uint8.
|
|
625
625
|
|
|
626
626
|
Parameters:
|
|
627
627
|
|
|
628
|
-
|param|type|description|
|
|
629
|
-
|
|
630
|
-
|
|
628
|
+
| param | type | description |
|
|
629
|
+
| -------- | -------- | -------------------- |
|
|
630
|
+
| `number` | `Number` | The value to convert |
|
|
631
631
|
|
|
632
632
|
Returns:
|
|
633
633
|
|
|
634
|
-
|type|description|
|
|
635
|
-
|
|
636
|
-
|
|
634
|
+
| type | description |
|
|
635
|
+
| ------- | --------------------------------- |
|
|
636
|
+
| `Uint8` | The Number represented as a Uint8 |
|
|
637
637
|
|
|
638
638
|
### Numbers.**coerceNumberToUint16**
|
|
639
639
|
|
|
@@ -643,22 +643,22 @@ No other changes yet.
|
|
|
643
643
|
</details>
|
|
644
644
|
|
|
645
645
|
```grain
|
|
646
|
-
coerceNumberToUint16
|
|
646
|
+
coerceNumberToUint16: (number: Number) => Uint16
|
|
647
647
|
```
|
|
648
648
|
|
|
649
649
|
Converts a Number to a Uint16.
|
|
650
650
|
|
|
651
651
|
Parameters:
|
|
652
652
|
|
|
653
|
-
|param|type|description|
|
|
654
|
-
|
|
655
|
-
|
|
653
|
+
| param | type | description |
|
|
654
|
+
| -------- | -------- | -------------------- |
|
|
655
|
+
| `number` | `Number` | The value to convert |
|
|
656
656
|
|
|
657
657
|
Returns:
|
|
658
658
|
|
|
659
|
-
|type|description|
|
|
660
|
-
|
|
661
|
-
|
|
659
|
+
| type | description |
|
|
660
|
+
| -------- | ---------------------------------- |
|
|
661
|
+
| `Uint16` | The Number represented as a Uint16 |
|
|
662
662
|
|
|
663
663
|
### Numbers.**coerceNumberToInt32**
|
|
664
664
|
|
|
@@ -668,22 +668,22 @@ No other changes yet.
|
|
|
668
668
|
</details>
|
|
669
669
|
|
|
670
670
|
```grain
|
|
671
|
-
coerceNumberToInt32
|
|
671
|
+
coerceNumberToInt32: (number: Number) => Int32
|
|
672
672
|
```
|
|
673
673
|
|
|
674
674
|
Converts a Number to an Int32.
|
|
675
675
|
|
|
676
676
|
Parameters:
|
|
677
677
|
|
|
678
|
-
|param|type|description|
|
|
679
|
-
|
|
680
|
-
|
|
678
|
+
| param | type | description |
|
|
679
|
+
| -------- | -------- | -------------------- |
|
|
680
|
+
| `number` | `Number` | The value to convert |
|
|
681
681
|
|
|
682
682
|
Returns:
|
|
683
683
|
|
|
684
|
-
|type|description|
|
|
685
|
-
|
|
686
|
-
|
|
684
|
+
| type | description |
|
|
685
|
+
| ------- | ---------------------------------- |
|
|
686
|
+
| `Int32` | The Number represented as an Int32 |
|
|
687
687
|
|
|
688
688
|
### Numbers.**coerceNumberToInt64**
|
|
689
689
|
|
|
@@ -693,22 +693,22 @@ No other changes yet.
|
|
|
693
693
|
</details>
|
|
694
694
|
|
|
695
695
|
```grain
|
|
696
|
-
coerceNumberToInt64
|
|
696
|
+
coerceNumberToInt64: (number: Number) => Int64
|
|
697
697
|
```
|
|
698
698
|
|
|
699
699
|
Converts a Number to an Int64.
|
|
700
700
|
|
|
701
701
|
Parameters:
|
|
702
702
|
|
|
703
|
-
|param|type|description|
|
|
704
|
-
|
|
705
|
-
|
|
703
|
+
| param | type | description |
|
|
704
|
+
| -------- | -------- | -------------------- |
|
|
705
|
+
| `number` | `Number` | The value to convert |
|
|
706
706
|
|
|
707
707
|
Returns:
|
|
708
708
|
|
|
709
|
-
|type|description|
|
|
710
|
-
|
|
711
|
-
|
|
709
|
+
| type | description |
|
|
710
|
+
| ------- | ---------------------------------- |
|
|
711
|
+
| `Int64` | The Number represented as an Int64 |
|
|
712
712
|
|
|
713
713
|
### Numbers.**coerceNumberToBigInt**
|
|
714
714
|
|
|
@@ -718,22 +718,22 @@ No other changes yet.
|
|
|
718
718
|
</details>
|
|
719
719
|
|
|
720
720
|
```grain
|
|
721
|
-
coerceNumberToBigInt
|
|
721
|
+
coerceNumberToBigInt: (number: Number) => BigInt
|
|
722
722
|
```
|
|
723
723
|
|
|
724
724
|
Converts a Number to a BigInt.
|
|
725
725
|
|
|
726
726
|
Parameters:
|
|
727
727
|
|
|
728
|
-
|param|type|description|
|
|
729
|
-
|
|
730
|
-
|
|
728
|
+
| param | type | description |
|
|
729
|
+
| -------- | -------- | -------------------- |
|
|
730
|
+
| `number` | `Number` | The value to convert |
|
|
731
731
|
|
|
732
732
|
Returns:
|
|
733
733
|
|
|
734
|
-
|type|description|
|
|
735
|
-
|
|
736
|
-
|
|
734
|
+
| type | description |
|
|
735
|
+
| -------- | ---------------------------------- |
|
|
736
|
+
| `BigInt` | The Number represented as a BigInt |
|
|
737
737
|
|
|
738
738
|
### Numbers.**coerceNumberToRational**
|
|
739
739
|
|
|
@@ -743,22 +743,22 @@ No other changes yet.
|
|
|
743
743
|
</details>
|
|
744
744
|
|
|
745
745
|
```grain
|
|
746
|
-
coerceNumberToRational
|
|
746
|
+
coerceNumberToRational: (number: Number) => Rational
|
|
747
747
|
```
|
|
748
748
|
|
|
749
749
|
Converts a Number to a Rational.
|
|
750
750
|
|
|
751
751
|
Parameters:
|
|
752
752
|
|
|
753
|
-
|param|type|description|
|
|
754
|
-
|
|
755
|
-
|
|
753
|
+
| param | type | description |
|
|
754
|
+
| -------- | -------- | -------------------- |
|
|
755
|
+
| `number` | `Number` | The value to convert |
|
|
756
756
|
|
|
757
757
|
Returns:
|
|
758
758
|
|
|
759
|
-
|type|description|
|
|
760
|
-
|
|
761
|
-
|
|
759
|
+
| type | description |
|
|
760
|
+
| ---------- | ------------------------------------ |
|
|
761
|
+
| `Rational` | The Number represented as a Rational |
|
|
762
762
|
|
|
763
763
|
### Numbers.**coerceNumberToFloat32**
|
|
764
764
|
|
|
@@ -768,22 +768,22 @@ No other changes yet.
|
|
|
768
768
|
</details>
|
|
769
769
|
|
|
770
770
|
```grain
|
|
771
|
-
coerceNumberToFloat32
|
|
771
|
+
coerceNumberToFloat32: (number: Number) => Float32
|
|
772
772
|
```
|
|
773
773
|
|
|
774
774
|
Converts a Number to a Float32.
|
|
775
775
|
|
|
776
776
|
Parameters:
|
|
777
777
|
|
|
778
|
-
|param|type|description|
|
|
779
|
-
|
|
780
|
-
|
|
778
|
+
| param | type | description |
|
|
779
|
+
| -------- | -------- | -------------------- |
|
|
780
|
+
| `number` | `Number` | The value to convert |
|
|
781
781
|
|
|
782
782
|
Returns:
|
|
783
783
|
|
|
784
|
-
|type|description|
|
|
785
|
-
|
|
786
|
-
|
|
784
|
+
| type | description |
|
|
785
|
+
| --------- | ----------------------------------- |
|
|
786
|
+
| `Float32` | The Number represented as a Float32 |
|
|
787
787
|
|
|
788
788
|
### Numbers.**coerceNumberToFloat64**
|
|
789
789
|
|
|
@@ -793,22 +793,22 @@ No other changes yet.
|
|
|
793
793
|
</details>
|
|
794
794
|
|
|
795
795
|
```grain
|
|
796
|
-
coerceNumberToFloat64
|
|
796
|
+
coerceNumberToFloat64: (number: Number) => Float64
|
|
797
797
|
```
|
|
798
798
|
|
|
799
799
|
Converts a Number to a Float64.
|
|
800
800
|
|
|
801
801
|
Parameters:
|
|
802
802
|
|
|
803
|
-
|param|type|description|
|
|
804
|
-
|
|
805
|
-
|
|
803
|
+
| param | type | description |
|
|
804
|
+
| -------- | -------- | -------------------- |
|
|
805
|
+
| `number` | `Number` | The value to convert |
|
|
806
806
|
|
|
807
807
|
Returns:
|
|
808
808
|
|
|
809
|
-
|type|description|
|
|
810
|
-
|
|
811
|
-
|
|
809
|
+
| type | description |
|
|
810
|
+
| --------- | ----------------------------------- |
|
|
811
|
+
| `Float64` | The Number represented as a Float64 |
|
|
812
812
|
|
|
813
813
|
### Numbers.**coerceInt8ToNumber**
|
|
814
814
|
|
|
@@ -818,22 +818,22 @@ No other changes yet.
|
|
|
818
818
|
</details>
|
|
819
819
|
|
|
820
820
|
```grain
|
|
821
|
-
coerceInt8ToNumber
|
|
821
|
+
coerceInt8ToNumber: (value: Int8) => Number
|
|
822
822
|
```
|
|
823
823
|
|
|
824
824
|
Converts an Int8 to a Number.
|
|
825
825
|
|
|
826
826
|
Parameters:
|
|
827
827
|
|
|
828
|
-
|param|type|description|
|
|
829
|
-
|
|
830
|
-
|
|
828
|
+
| param | type | description |
|
|
829
|
+
| ------- | ------ | -------------------- |
|
|
830
|
+
| `value` | `Int8` | The value to convert |
|
|
831
831
|
|
|
832
832
|
Returns:
|
|
833
833
|
|
|
834
|
-
|type|description|
|
|
835
|
-
|
|
836
|
-
|
|
834
|
+
| type | description |
|
|
835
|
+
| -------- | -------------------------------- |
|
|
836
|
+
| `Number` | The Int8 represented as a Number |
|
|
837
837
|
|
|
838
838
|
### Numbers.**coerceInt16ToNumber**
|
|
839
839
|
|
|
@@ -843,22 +843,22 @@ No other changes yet.
|
|
|
843
843
|
</details>
|
|
844
844
|
|
|
845
845
|
```grain
|
|
846
|
-
coerceInt16ToNumber
|
|
846
|
+
coerceInt16ToNumber: (value: Int16) => Number
|
|
847
847
|
```
|
|
848
848
|
|
|
849
849
|
Converts an Int16 to a Number.
|
|
850
850
|
|
|
851
851
|
Parameters:
|
|
852
852
|
|
|
853
|
-
|param|type|description|
|
|
854
|
-
|
|
855
|
-
|
|
853
|
+
| param | type | description |
|
|
854
|
+
| ------- | ------- | -------------------- |
|
|
855
|
+
| `value` | `Int16` | The value to convert |
|
|
856
856
|
|
|
857
857
|
Returns:
|
|
858
858
|
|
|
859
|
-
|type|description|
|
|
860
|
-
|
|
861
|
-
|
|
859
|
+
| type | description |
|
|
860
|
+
| -------- | --------------------------------- |
|
|
861
|
+
| `Number` | The Int16 represented as a Number |
|
|
862
862
|
|
|
863
863
|
### Numbers.**coerceUint8ToNumber**
|
|
864
864
|
|
|
@@ -868,22 +868,22 @@ No other changes yet.
|
|
|
868
868
|
</details>
|
|
869
869
|
|
|
870
870
|
```grain
|
|
871
|
-
coerceUint8ToNumber
|
|
871
|
+
coerceUint8ToNumber: (value: Uint8) => Number
|
|
872
872
|
```
|
|
873
873
|
|
|
874
874
|
Converts a Uint8 to a Number.
|
|
875
875
|
|
|
876
876
|
Parameters:
|
|
877
877
|
|
|
878
|
-
|param|type|description|
|
|
879
|
-
|
|
880
|
-
|
|
878
|
+
| param | type | description |
|
|
879
|
+
| ------- | ------- | -------------------- |
|
|
880
|
+
| `value` | `Uint8` | The value to convert |
|
|
881
881
|
|
|
882
882
|
Returns:
|
|
883
883
|
|
|
884
|
-
|type|description|
|
|
885
|
-
|
|
886
|
-
|
|
884
|
+
| type | description |
|
|
885
|
+
| -------- | --------------------------------- |
|
|
886
|
+
| `Number` | The Uint8 represented as a Number |
|
|
887
887
|
|
|
888
888
|
### Numbers.**coerceUint16ToNumber**
|
|
889
889
|
|
|
@@ -893,22 +893,22 @@ No other changes yet.
|
|
|
893
893
|
</details>
|
|
894
894
|
|
|
895
895
|
```grain
|
|
896
|
-
coerceUint16ToNumber
|
|
896
|
+
coerceUint16ToNumber: (value: Uint16) => Number
|
|
897
897
|
```
|
|
898
898
|
|
|
899
899
|
Converts a Uint16 to a Number.
|
|
900
900
|
|
|
901
901
|
Parameters:
|
|
902
902
|
|
|
903
|
-
|param|type|description|
|
|
904
|
-
|
|
905
|
-
|
|
903
|
+
| param | type | description |
|
|
904
|
+
| ------- | -------- | -------------------- |
|
|
905
|
+
| `value` | `Uint16` | The value to convert |
|
|
906
906
|
|
|
907
907
|
Returns:
|
|
908
908
|
|
|
909
|
-
|type|description|
|
|
910
|
-
|
|
911
|
-
|
|
909
|
+
| type | description |
|
|
910
|
+
| -------- | ---------------------------------- |
|
|
911
|
+
| `Number` | The Uint16 represented as a Number |
|
|
912
912
|
|
|
913
913
|
### Numbers.**coerceInt32ToNumber**
|
|
914
914
|
|
|
@@ -918,22 +918,22 @@ No other changes yet.
|
|
|
918
918
|
</details>
|
|
919
919
|
|
|
920
920
|
```grain
|
|
921
|
-
coerceInt32ToNumber
|
|
921
|
+
coerceInt32ToNumber: (value: Int32) => Number
|
|
922
922
|
```
|
|
923
923
|
|
|
924
924
|
Converts an Int32 to a Number.
|
|
925
925
|
|
|
926
926
|
Parameters:
|
|
927
927
|
|
|
928
|
-
|param|type|description|
|
|
929
|
-
|
|
930
|
-
|
|
928
|
+
| param | type | description |
|
|
929
|
+
| ------- | ------- | -------------------- |
|
|
930
|
+
| `value` | `Int32` | The value to convert |
|
|
931
931
|
|
|
932
932
|
Returns:
|
|
933
933
|
|
|
934
|
-
|type|description|
|
|
935
|
-
|
|
936
|
-
|
|
934
|
+
| type | description |
|
|
935
|
+
| -------- | --------------------------------- |
|
|
936
|
+
| `Number` | The Int32 represented as a Number |
|
|
937
937
|
|
|
938
938
|
### Numbers.**coerceInt64ToNumber**
|
|
939
939
|
|
|
@@ -943,22 +943,22 @@ No other changes yet.
|
|
|
943
943
|
</details>
|
|
944
944
|
|
|
945
945
|
```grain
|
|
946
|
-
coerceInt64ToNumber
|
|
946
|
+
coerceInt64ToNumber: (value: Int64) => Number
|
|
947
947
|
```
|
|
948
948
|
|
|
949
949
|
Converts an Int64 to a Number.
|
|
950
950
|
|
|
951
951
|
Parameters:
|
|
952
952
|
|
|
953
|
-
|param|type|description|
|
|
954
|
-
|
|
955
|
-
|
|
953
|
+
| param | type | description |
|
|
954
|
+
| ------- | ------- | -------------------- |
|
|
955
|
+
| `value` | `Int64` | The value to convert |
|
|
956
956
|
|
|
957
957
|
Returns:
|
|
958
958
|
|
|
959
|
-
|type|description|
|
|
960
|
-
|
|
961
|
-
|
|
959
|
+
| type | description |
|
|
960
|
+
| -------- | --------------------------------- |
|
|
961
|
+
| `Number` | The Int64 represented as a Number |
|
|
962
962
|
|
|
963
963
|
### Numbers.**coerceBigIntToNumber**
|
|
964
964
|
|
|
@@ -968,22 +968,22 @@ No other changes yet.
|
|
|
968
968
|
</details>
|
|
969
969
|
|
|
970
970
|
```grain
|
|
971
|
-
coerceBigIntToNumber
|
|
971
|
+
coerceBigIntToNumber: (num: BigInt) => Number
|
|
972
972
|
```
|
|
973
973
|
|
|
974
974
|
Converts a BigInt to a Number.
|
|
975
975
|
|
|
976
976
|
Parameters:
|
|
977
977
|
|
|
978
|
-
|param|type|description|
|
|
979
|
-
|
|
980
|
-
|
|
978
|
+
| param | type | description |
|
|
979
|
+
| ----- | -------- | -------------------- |
|
|
980
|
+
| `num` | `BigInt` | The value to convert |
|
|
981
981
|
|
|
982
982
|
Returns:
|
|
983
983
|
|
|
984
|
-
|type|description|
|
|
985
|
-
|
|
986
|
-
|
|
984
|
+
| type | description |
|
|
985
|
+
| -------- | ---------------------------------- |
|
|
986
|
+
| `Number` | The BigInt represented as a Number |
|
|
987
987
|
|
|
988
988
|
### Numbers.**coerceRationalToNumber**
|
|
989
989
|
|
|
@@ -993,22 +993,22 @@ No other changes yet.
|
|
|
993
993
|
</details>
|
|
994
994
|
|
|
995
995
|
```grain
|
|
996
|
-
coerceRationalToNumber
|
|
996
|
+
coerceRationalToNumber: (rational: Rational) => Number
|
|
997
997
|
```
|
|
998
998
|
|
|
999
999
|
Converts a Rational to a Number.
|
|
1000
1000
|
|
|
1001
1001
|
Parameters:
|
|
1002
1002
|
|
|
1003
|
-
|param|type|description|
|
|
1004
|
-
|
|
1005
|
-
|
|
1003
|
+
| param | type | description |
|
|
1004
|
+
| ---------- | ---------- | -------------------- |
|
|
1005
|
+
| `rational` | `Rational` | The value to convert |
|
|
1006
1006
|
|
|
1007
1007
|
Returns:
|
|
1008
1008
|
|
|
1009
|
-
|type|description|
|
|
1010
|
-
|
|
1011
|
-
|
|
1009
|
+
| type | description |
|
|
1010
|
+
| -------- | ------------------------------------ |
|
|
1011
|
+
| `Number` | The Rational represented as a Number |
|
|
1012
1012
|
|
|
1013
1013
|
### Numbers.**coerceFloat32ToNumber**
|
|
1014
1014
|
|
|
@@ -1018,22 +1018,22 @@ No other changes yet.
|
|
|
1018
1018
|
</details>
|
|
1019
1019
|
|
|
1020
1020
|
```grain
|
|
1021
|
-
coerceFloat32ToNumber
|
|
1021
|
+
coerceFloat32ToNumber: (float: Float32) => Number
|
|
1022
1022
|
```
|
|
1023
1023
|
|
|
1024
1024
|
Converts a Float32 to a Number.
|
|
1025
1025
|
|
|
1026
1026
|
Parameters:
|
|
1027
1027
|
|
|
1028
|
-
|param|type|description|
|
|
1029
|
-
|
|
1030
|
-
|
|
1028
|
+
| param | type | description |
|
|
1029
|
+
| ------- | --------- | -------------------- |
|
|
1030
|
+
| `float` | `Float32` | The value to convert |
|
|
1031
1031
|
|
|
1032
1032
|
Returns:
|
|
1033
1033
|
|
|
1034
|
-
|type|description|
|
|
1035
|
-
|
|
1036
|
-
|
|
1034
|
+
| type | description |
|
|
1035
|
+
| -------- | ----------------------------------- |
|
|
1036
|
+
| `Number` | The Float32 represented as a Number |
|
|
1037
1037
|
|
|
1038
1038
|
### Numbers.**coerceFloat64ToNumber**
|
|
1039
1039
|
|
|
@@ -1043,33 +1043,33 @@ No other changes yet.
|
|
|
1043
1043
|
</details>
|
|
1044
1044
|
|
|
1045
1045
|
```grain
|
|
1046
|
-
coerceFloat64ToNumber
|
|
1046
|
+
coerceFloat64ToNumber: (float: Float64) => Number
|
|
1047
1047
|
```
|
|
1048
1048
|
|
|
1049
1049
|
Converts a Float64 to a Number.
|
|
1050
1050
|
|
|
1051
1051
|
Parameters:
|
|
1052
1052
|
|
|
1053
|
-
|param|type|description|
|
|
1054
|
-
|
|
1055
|
-
|
|
1053
|
+
| param | type | description |
|
|
1054
|
+
| ------- | --------- | -------------------- |
|
|
1055
|
+
| `float` | `Float64` | The value to convert |
|
|
1056
1056
|
|
|
1057
1057
|
Returns:
|
|
1058
1058
|
|
|
1059
|
-
|type|description|
|
|
1060
|
-
|
|
1061
|
-
|
|
1059
|
+
| type | description |
|
|
1060
|
+
| -------- | ----------------------------------- |
|
|
1061
|
+
| `Number` | The Float64 represented as a Number |
|
|
1062
1062
|
|
|
1063
1063
|
### Numbers.**convertExactToInexact**
|
|
1064
1064
|
|
|
1065
1065
|
```grain
|
|
1066
|
-
convertExactToInexact
|
|
1066
|
+
convertExactToInexact: (x: Number) => Number
|
|
1067
1067
|
```
|
|
1068
1068
|
|
|
1069
1069
|
### Numbers.**convertInexactToExact**
|
|
1070
1070
|
|
|
1071
1071
|
```grain
|
|
1072
|
-
convertInexactToExact
|
|
1072
|
+
convertInexactToExact: (x: Number) => Number
|
|
1073
1073
|
```
|
|
1074
1074
|
|
|
1075
1075
|
### Numbers.**(+)**
|
|
@@ -1080,23 +1080,23 @@ No other changes yet.
|
|
|
1080
1080
|
</details>
|
|
1081
1081
|
|
|
1082
1082
|
```grain
|
|
1083
|
-
(+)
|
|
1083
|
+
(+): (num1: Number, num2: Number) => Number
|
|
1084
1084
|
```
|
|
1085
1085
|
|
|
1086
1086
|
Computes the sum of its operands.
|
|
1087
1087
|
|
|
1088
1088
|
Parameters:
|
|
1089
1089
|
|
|
1090
|
-
|param|type|description|
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1090
|
+
| param | type | description |
|
|
1091
|
+
| ------ | -------- | ------------------ |
|
|
1092
|
+
| `num1` | `Number` | The first operand |
|
|
1093
|
+
| `num2` | `Number` | The second operand |
|
|
1094
1094
|
|
|
1095
1095
|
Returns:
|
|
1096
1096
|
|
|
1097
|
-
|type|description|
|
|
1098
|
-
|
|
1099
|
-
|
|
1097
|
+
| type | description |
|
|
1098
|
+
| -------- | --------------------------- |
|
|
1099
|
+
| `Number` | The sum of the two operands |
|
|
1100
1100
|
|
|
1101
1101
|
### Numbers.**(-)**
|
|
1102
1102
|
|
|
@@ -1106,23 +1106,23 @@ No other changes yet.
|
|
|
1106
1106
|
</details>
|
|
1107
1107
|
|
|
1108
1108
|
```grain
|
|
1109
|
-
(-)
|
|
1109
|
+
(-): (num1: Number, num2: Number) => Number
|
|
1110
1110
|
```
|
|
1111
1111
|
|
|
1112
1112
|
Computes the difference of its operands.
|
|
1113
1113
|
|
|
1114
1114
|
Parameters:
|
|
1115
1115
|
|
|
1116
|
-
|param|type|description|
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1116
|
+
| param | type | description |
|
|
1117
|
+
| ------ | -------- | ------------------ |
|
|
1118
|
+
| `num1` | `Number` | The first operand |
|
|
1119
|
+
| `num2` | `Number` | The second operand |
|
|
1120
1120
|
|
|
1121
1121
|
Returns:
|
|
1122
1122
|
|
|
1123
|
-
|type|description|
|
|
1124
|
-
|
|
1125
|
-
|
|
1123
|
+
| type | description |
|
|
1124
|
+
| -------- | ---------------------------------- |
|
|
1125
|
+
| `Number` | The difference of the two operands |
|
|
1126
1126
|
|
|
1127
1127
|
### Numbers.**(*)**
|
|
1128
1128
|
|
|
@@ -1132,23 +1132,23 @@ No other changes yet.
|
|
|
1132
1132
|
</details>
|
|
1133
1133
|
|
|
1134
1134
|
```grain
|
|
1135
|
-
(*)
|
|
1135
|
+
(*): (num1: Number, num2: Number) => Number
|
|
1136
1136
|
```
|
|
1137
1137
|
|
|
1138
1138
|
Computes the product of its operands.
|
|
1139
1139
|
|
|
1140
1140
|
Parameters:
|
|
1141
1141
|
|
|
1142
|
-
|param|type|description|
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1142
|
+
| param | type | description |
|
|
1143
|
+
| ------ | -------- | ------------------ |
|
|
1144
|
+
| `num1` | `Number` | The first operand |
|
|
1145
|
+
| `num2` | `Number` | The second operand |
|
|
1146
1146
|
|
|
1147
1147
|
Returns:
|
|
1148
1148
|
|
|
1149
|
-
|type|description|
|
|
1150
|
-
|
|
1151
|
-
|
|
1149
|
+
| type | description |
|
|
1150
|
+
| -------- | ------------------------------- |
|
|
1151
|
+
| `Number` | The product of the two operands |
|
|
1152
1152
|
|
|
1153
1153
|
### Numbers.**(/)**
|
|
1154
1154
|
|
|
@@ -1158,23 +1158,23 @@ No other changes yet.
|
|
|
1158
1158
|
</details>
|
|
1159
1159
|
|
|
1160
1160
|
```grain
|
|
1161
|
-
(/)
|
|
1161
|
+
(/): (num1: Number, num2: Number) => Number
|
|
1162
1162
|
```
|
|
1163
1163
|
|
|
1164
1164
|
Computes the quotient of its operands.
|
|
1165
1165
|
|
|
1166
1166
|
Parameters:
|
|
1167
1167
|
|
|
1168
|
-
|param|type|description|
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1168
|
+
| param | type | description |
|
|
1169
|
+
| ------ | -------- | ------------------ |
|
|
1170
|
+
| `num1` | `Number` | The first operand |
|
|
1171
|
+
| `num2` | `Number` | The second operand |
|
|
1172
1172
|
|
|
1173
1173
|
Returns:
|
|
1174
1174
|
|
|
1175
|
-
|type|description|
|
|
1176
|
-
|
|
1177
|
-
|
|
1175
|
+
| type | description |
|
|
1176
|
+
| -------- | -------------------------------- |
|
|
1177
|
+
| `Number` | The quotient of the two operands |
|
|
1178
1178
|
|
|
1179
1179
|
### Numbers.**(%)**
|
|
1180
1180
|
|
|
@@ -1184,7 +1184,7 @@ No other changes yet.
|
|
|
1184
1184
|
</details>
|
|
1185
1185
|
|
|
1186
1186
|
```grain
|
|
1187
|
-
(%)
|
|
1187
|
+
(%): (num1: Number, num2: Number) => Number
|
|
1188
1188
|
```
|
|
1189
1189
|
|
|
1190
1190
|
Computes the remainder of the division of the first operand by the second.
|
|
@@ -1192,16 +1192,16 @@ The result will have the sign of the second operand.
|
|
|
1192
1192
|
|
|
1193
1193
|
Parameters:
|
|
1194
1194
|
|
|
1195
|
-
|param|type|description|
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1195
|
+
| param | type | description |
|
|
1196
|
+
| ------ | -------- | ------------------ |
|
|
1197
|
+
| `num1` | `Number` | The first operand |
|
|
1198
|
+
| `num2` | `Number` | The second operand |
|
|
1199
1199
|
|
|
1200
1200
|
Returns:
|
|
1201
1201
|
|
|
1202
|
-
|type|description|
|
|
1203
|
-
|
|
1204
|
-
|
|
1202
|
+
| type | description |
|
|
1203
|
+
| -------- | --------------------------- |
|
|
1204
|
+
| `Number` | The modulus of its operands |
|
|
1205
1205
|
|
|
1206
1206
|
### Numbers.**incr**
|
|
1207
1207
|
|
|
@@ -1211,22 +1211,22 @@ No other changes yet.
|
|
|
1211
1211
|
</details>
|
|
1212
1212
|
|
|
1213
1213
|
```grain
|
|
1214
|
-
incr
|
|
1214
|
+
incr: (value: Number) => Number
|
|
1215
1215
|
```
|
|
1216
1216
|
|
|
1217
1217
|
Increments the value by one.
|
|
1218
1218
|
|
|
1219
1219
|
Parameters:
|
|
1220
1220
|
|
|
1221
|
-
|param|type|description|
|
|
1222
|
-
|
|
1223
|
-
|
|
1221
|
+
| param | type | description |
|
|
1222
|
+
| ------- | -------- | ---------------------- |
|
|
1223
|
+
| `value` | `Number` | The value to increment |
|
|
1224
1224
|
|
|
1225
1225
|
Returns:
|
|
1226
1226
|
|
|
1227
|
-
|type|description|
|
|
1228
|
-
|
|
1229
|
-
|
|
1227
|
+
| type | description |
|
|
1228
|
+
| -------- | --------------------- |
|
|
1229
|
+
| `Number` | The incremented value |
|
|
1230
1230
|
|
|
1231
1231
|
### Numbers.**decr**
|
|
1232
1232
|
|
|
@@ -1236,27 +1236,27 @@ No other changes yet.
|
|
|
1236
1236
|
</details>
|
|
1237
1237
|
|
|
1238
1238
|
```grain
|
|
1239
|
-
decr
|
|
1239
|
+
decr: (value: Number) => Number
|
|
1240
1240
|
```
|
|
1241
1241
|
|
|
1242
1242
|
Decrements the value by one.
|
|
1243
1243
|
|
|
1244
1244
|
Parameters:
|
|
1245
1245
|
|
|
1246
|
-
|param|type|description|
|
|
1247
|
-
|
|
1248
|
-
|
|
1246
|
+
| param | type | description |
|
|
1247
|
+
| ------- | -------- | ---------------------- |
|
|
1248
|
+
| `value` | `Number` | The value to decrement |
|
|
1249
1249
|
|
|
1250
1250
|
Returns:
|
|
1251
1251
|
|
|
1252
|
-
|type|description|
|
|
1253
|
-
|
|
1254
|
-
|
|
1252
|
+
| type | description |
|
|
1253
|
+
| -------- | --------------------- |
|
|
1254
|
+
| `Number` | The decremented value |
|
|
1255
1255
|
|
|
1256
1256
|
### Numbers.**isBigInt**
|
|
1257
1257
|
|
|
1258
1258
|
```grain
|
|
1259
|
-
isBigInt
|
|
1259
|
+
isBigInt: (x: a) => Bool
|
|
1260
1260
|
```
|
|
1261
1261
|
|
|
1262
1262
|
### Numbers.**scalbn**
|
|
@@ -1267,23 +1267,29 @@ No other changes yet.
|
|
|
1267
1267
|
</details>
|
|
1268
1268
|
|
|
1269
1269
|
```grain
|
|
1270
|
-
scalbn
|
|
1270
|
+
scalbn: (x: WasmF64, n: WasmI32) => WasmF64
|
|
1271
1271
|
```
|
|
1272
1272
|
|
|
1273
1273
|
Multiplies a floating-point number by an integral power of 2.
|
|
1274
1274
|
|
|
1275
1275
|
Parameters:
|
|
1276
1276
|
|
|
1277
|
-
|param|type|description|
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1277
|
+
| param | type | description |
|
|
1278
|
+
| ----- | --------- | ------------------------ |
|
|
1279
|
+
| `x` | `WasmF64` | The floating-point value |
|
|
1280
|
+
| `n` | `WasmI32` | The Integer exponent |
|
|
1281
1281
|
|
|
1282
1282
|
Returns:
|
|
1283
1283
|
|
|
1284
|
-
|type|description|
|
|
1285
|
-
|
|
1286
|
-
|
|
1284
|
+
| type | description |
|
|
1285
|
+
| --------- | --------------------- |
|
|
1286
|
+
| `WasmF64` | The result of x * 2^n |
|
|
1287
|
+
|
|
1288
|
+
### Numbers.**powf**
|
|
1289
|
+
|
|
1290
|
+
```grain
|
|
1291
|
+
powf: (x: WasmF64, y: WasmF64) => WasmF64
|
|
1292
|
+
```
|
|
1287
1293
|
|
|
1288
1294
|
### Numbers.**(\*\*)**
|
|
1289
1295
|
|
|
@@ -1300,21 +1306,21 @@ Returns:
|
|
|
1300
1306
|
</details>
|
|
1301
1307
|
|
|
1302
1308
|
```grain
|
|
1303
|
-
(**)
|
|
1309
|
+
(**): (base: Number, power: Number) => Number
|
|
1304
1310
|
```
|
|
1305
1311
|
|
|
1306
1312
|
Computes the exponentiation of the given base and power.
|
|
1307
1313
|
|
|
1308
1314
|
Parameters:
|
|
1309
1315
|
|
|
1310
|
-
|param|type|description|
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1316
|
+
| param | type | description |
|
|
1317
|
+
| ------- | -------- | ------------------- |
|
|
1318
|
+
| `base` | `Number` | The base number |
|
|
1319
|
+
| `power` | `Number` | The exponent number |
|
|
1314
1320
|
|
|
1315
1321
|
Returns:
|
|
1316
1322
|
|
|
1317
|
-
|type|description|
|
|
1318
|
-
|
|
1319
|
-
|
|
1323
|
+
| type | description |
|
|
1324
|
+
| -------- | ---------------------------------- |
|
|
1325
|
+
| `Number` | The base raised to the given power |
|
|
1320
1326
|
|