@grain/stdlib 0.4.4 → 0.5.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.
- package/CHANGELOG.md +87 -0
- package/LICENSE +1 -1
- package/array.gr +92 -73
- package/array.md +18 -18
- package/bigint.gr +497 -0
- package/bigint.md +811 -0
- package/buffer.gr +56 -217
- package/buffer.md +24 -17
- package/bytes.gr +103 -205
- package/bytes.md +19 -0
- package/char.gr +152 -166
- package/char.md +200 -0
- package/exception.md +6 -0
- package/float32.gr +159 -82
- package/float32.md +315 -0
- package/float64.gr +163 -82
- package/float64.md +315 -0
- package/hash.gr +53 -49
- package/int32.gr +479 -230
- package/int32.md +937 -0
- package/int64.gr +479 -230
- package/int64.md +937 -0
- package/list.gr +530 -116
- package/list.md +1141 -0
- package/map.gr +302 -121
- package/map.md +525 -0
- package/number.gr +51 -57
- package/number.md +37 -3
- package/option.gr +25 -25
- package/option.md +1 -1
- package/package.json +3 -3
- package/pervasives.gr +504 -52
- package/pervasives.md +1116 -0
- package/queue.gr +8 -1
- package/queue.md +10 -0
- package/random.gr +196 -0
- package/random.md +179 -0
- package/range.gr +26 -26
- package/regex.gr +1833 -842
- package/regex.md +11 -11
- package/result.md +1 -1
- package/runtime/bigint.gr +2045 -0
- package/runtime/bigint.md +326 -0
- package/runtime/dataStructures.gr +99 -279
- package/runtime/dataStructures.md +391 -0
- package/runtime/debug.gr +0 -1
- package/runtime/debug.md +6 -0
- package/runtime/equal.gr +40 -37
- package/runtime/equal.md +6 -0
- package/runtime/exception.gr +28 -15
- package/runtime/exception.md +30 -0
- package/runtime/gc.gr +50 -20
- package/runtime/gc.md +36 -0
- package/runtime/malloc.gr +32 -22
- package/runtime/malloc.md +55 -0
- package/runtime/numberUtils.gr +297 -142
- package/runtime/numberUtils.md +54 -0
- package/runtime/numbers.gr +1204 -453
- package/runtime/numbers.md +300 -0
- package/runtime/string.gr +193 -228
- package/runtime/string.md +24 -0
- package/runtime/stringUtils.gr +62 -38
- package/runtime/stringUtils.md +6 -0
- package/runtime/unsafe/constants.gr +17 -0
- package/runtime/unsafe/constants.md +72 -0
- package/runtime/unsafe/conv.gr +10 -10
- package/runtime/unsafe/conv.md +71 -0
- package/runtime/unsafe/errors.md +204 -0
- package/runtime/unsafe/memory.gr +14 -3
- package/runtime/unsafe/memory.md +54 -0
- package/runtime/unsafe/printWasm.gr +4 -4
- package/runtime/unsafe/printWasm.md +24 -0
- package/runtime/unsafe/tags.gr +11 -10
- package/runtime/unsafe/tags.md +120 -0
- package/runtime/unsafe/wasmf32.gr +9 -2
- package/runtime/unsafe/wasmf32.md +168 -0
- package/runtime/unsafe/wasmf64.gr +9 -2
- package/runtime/unsafe/wasmf64.md +168 -0
- package/runtime/unsafe/wasmi32.gr +65 -47
- package/runtime/unsafe/wasmi32.md +282 -0
- package/runtime/unsafe/wasmi64.gr +78 -50
- package/runtime/unsafe/wasmi64.md +300 -0
- package/runtime/utils/printing.gr +62 -0
- package/runtime/utils/printing.md +18 -0
- package/runtime/wasi.gr +200 -46
- package/runtime/wasi.md +839 -0
- package/set.gr +125 -121
- package/set.md +24 -21
- package/stack.gr +29 -29
- package/stack.md +4 -6
- package/string.gr +434 -415
- package/string.md +3 -3
- package/sys/file.gr +477 -482
- package/sys/process.gr +33 -47
- package/sys/random.gr +48 -20
- package/sys/random.md +38 -0
- package/sys/time.gr +12 -28
package/float32.gr
CHANGED
|
@@ -1,131 +1,208 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Float32: Utilities for working with the Float32 type.
|
|
3
|
+
* @example import Float32 from "float32"
|
|
4
|
+
*
|
|
5
|
+
* @since v0.2.0
|
|
6
|
+
*/
|
|
1
7
|
import WasmI32 from "runtime/unsafe/wasmi32"
|
|
2
8
|
import WasmF32 from "runtime/unsafe/wasmf32"
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
newFloat32
|
|
6
|
-
} from "runtime/dataStructures"
|
|
9
|
+
import { newFloat32 } from "runtime/dataStructures"
|
|
7
10
|
|
|
8
11
|
import {
|
|
9
12
|
coerceNumberToFloat32 as fromNumber,
|
|
10
|
-
coerceFloat32ToNumber as toNumber
|
|
13
|
+
coerceFloat32ToNumber as toNumber,
|
|
11
14
|
} from "runtime/numbers"
|
|
12
15
|
|
|
16
|
+
/**
|
|
17
|
+
* @section Conversions: Functions for converting between Numbers and the Float32 type.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Converts a Number to a Float32.
|
|
22
|
+
*
|
|
23
|
+
* @param number: The value to convert
|
|
24
|
+
* @returns The Number represented as a Float32
|
|
25
|
+
*
|
|
26
|
+
* @since v0.2.0
|
|
27
|
+
*/
|
|
13
28
|
export fromNumber
|
|
14
|
-
export toNumber
|
|
15
29
|
|
|
30
|
+
/**
|
|
31
|
+
* Converts a Float32 to a Number.
|
|
32
|
+
*
|
|
33
|
+
* @param float: The value to convert
|
|
34
|
+
* @returns The Float32 represented as a Number
|
|
35
|
+
*
|
|
36
|
+
* @since v0.2.0
|
|
37
|
+
*/
|
|
38
|
+
export toNumber
|
|
16
39
|
|
|
17
|
-
|
|
18
|
-
|
|
40
|
+
/**
|
|
41
|
+
* @section Operations: Mathematical operations for Float32 values.
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Computes the sum of its operands.
|
|
46
|
+
*
|
|
47
|
+
* @param x: The first operand
|
|
48
|
+
* @param y: The second operand
|
|
49
|
+
* @returns The sum of the two operands
|
|
50
|
+
*
|
|
51
|
+
* @since v0.2.0
|
|
52
|
+
*/
|
|
53
|
+
@unsafe
|
|
54
|
+
export let add = (x: Float32, y: Float32) => {
|
|
19
55
|
let xv = WasmF32.load(WasmI32.fromGrain(x), 8n)
|
|
20
56
|
let yv = WasmF32.load(WasmI32.fromGrain(y), 8n)
|
|
21
57
|
let ptr = newFloat32(WasmF32.add(xv, yv))
|
|
22
|
-
|
|
23
|
-
Memory.decRef(WasmI32.fromGrain(x))
|
|
24
|
-
Memory.decRef(WasmI32.fromGrain(y))
|
|
25
|
-
Memory.decRef(WasmI32.fromGrain(add))
|
|
26
|
-
ret
|
|
58
|
+
WasmI32.toGrain(ptr): Float32
|
|
27
59
|
}
|
|
28
60
|
|
|
29
|
-
|
|
30
|
-
|
|
61
|
+
/**
|
|
62
|
+
* Computes the difference of its operands.
|
|
63
|
+
*
|
|
64
|
+
* @param x: The first operand
|
|
65
|
+
* @param y: The second operand
|
|
66
|
+
* @returns The difference of the two operands
|
|
67
|
+
*
|
|
68
|
+
* @since v0.2.0
|
|
69
|
+
*/
|
|
70
|
+
@unsafe
|
|
71
|
+
export let sub = (x: Float32, y: Float32) => {
|
|
31
72
|
let xv = WasmF32.load(WasmI32.fromGrain(x), 8n)
|
|
32
73
|
let yv = WasmF32.load(WasmI32.fromGrain(y), 8n)
|
|
33
74
|
let ptr = newFloat32(WasmF32.sub(xv, yv))
|
|
34
|
-
|
|
35
|
-
Memory.decRef(WasmI32.fromGrain(x))
|
|
36
|
-
Memory.decRef(WasmI32.fromGrain(y))
|
|
37
|
-
Memory.decRef(WasmI32.fromGrain(sub))
|
|
38
|
-
ret
|
|
75
|
+
WasmI32.toGrain(ptr): Float32
|
|
39
76
|
}
|
|
40
77
|
|
|
41
|
-
|
|
42
|
-
|
|
78
|
+
/**
|
|
79
|
+
* Computes the product of its operands.
|
|
80
|
+
*
|
|
81
|
+
* @param x: The first operand
|
|
82
|
+
* @param y: The second operand
|
|
83
|
+
* @returns The product of the two operands
|
|
84
|
+
*
|
|
85
|
+
* @since v0.2.0
|
|
86
|
+
*/
|
|
87
|
+
@unsafe
|
|
88
|
+
export let mul = (x: Float32, y: Float32) => {
|
|
43
89
|
let xv = WasmF32.load(WasmI32.fromGrain(x), 8n)
|
|
44
90
|
let yv = WasmF32.load(WasmI32.fromGrain(y), 8n)
|
|
45
91
|
let ptr = newFloat32(WasmF32.mul(xv, yv))
|
|
46
|
-
|
|
47
|
-
Memory.decRef(WasmI32.fromGrain(x))
|
|
48
|
-
Memory.decRef(WasmI32.fromGrain(y))
|
|
49
|
-
Memory.decRef(WasmI32.fromGrain(mul))
|
|
50
|
-
ret
|
|
92
|
+
WasmI32.toGrain(ptr): Float32
|
|
51
93
|
}
|
|
52
94
|
|
|
53
|
-
|
|
54
|
-
|
|
95
|
+
/**
|
|
96
|
+
* Computes the quotient of its operands.
|
|
97
|
+
*
|
|
98
|
+
* @param x: The first operand
|
|
99
|
+
* @param y: The second operand
|
|
100
|
+
* @returns The quotient of the two operands
|
|
101
|
+
*
|
|
102
|
+
* @since v0.2.0
|
|
103
|
+
*/
|
|
104
|
+
@unsafe
|
|
105
|
+
export let div = (x: Float32, y: Float32) => {
|
|
55
106
|
let xv = WasmF32.load(WasmI32.fromGrain(x), 8n)
|
|
56
107
|
let yv = WasmF32.load(WasmI32.fromGrain(y), 8n)
|
|
57
108
|
let ptr = newFloat32(WasmF32.div(xv, yv))
|
|
58
|
-
|
|
59
|
-
Memory.decRef(WasmI32.fromGrain(x))
|
|
60
|
-
Memory.decRef(WasmI32.fromGrain(y))
|
|
61
|
-
Memory.decRef(WasmI32.fromGrain(div))
|
|
62
|
-
ret
|
|
109
|
+
WasmI32.toGrain(ptr): Float32
|
|
63
110
|
}
|
|
64
111
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
112
|
+
/**
|
|
113
|
+
* @section Comparisons: Functions for comparing Float32 values.
|
|
114
|
+
*/
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Checks if the first value is less than the second value.
|
|
118
|
+
*
|
|
119
|
+
* @param x: The first value
|
|
120
|
+
* @param y: The second value
|
|
121
|
+
* @returns `true` if the first value is less than the second value or `false` otherwise
|
|
122
|
+
*
|
|
123
|
+
* @since v0.2.0
|
|
124
|
+
*/
|
|
125
|
+
@unsafe
|
|
126
|
+
export let lt = (x: Float32, y: Float32) => {
|
|
69
127
|
let xv = WasmF32.load(WasmI32.fromGrain(x), 8n)
|
|
70
128
|
let yv = WasmF32.load(WasmI32.fromGrain(y), 8n)
|
|
71
|
-
|
|
72
|
-
Memory.decRef(WasmI32.fromGrain(x))
|
|
73
|
-
Memory.decRef(WasmI32.fromGrain(y))
|
|
74
|
-
Memory.decRef(WasmI32.fromGrain(lt))
|
|
75
|
-
ret
|
|
129
|
+
WasmF32.lt(xv, yv)
|
|
76
130
|
}
|
|
77
131
|
|
|
78
|
-
|
|
79
|
-
|
|
132
|
+
/**
|
|
133
|
+
* Checks if the first value is greater than the second value.
|
|
134
|
+
*
|
|
135
|
+
* @param x: The first value
|
|
136
|
+
* @param y: The second value
|
|
137
|
+
* @returns `true` if the first value is greater than the second value or `false` otherwise
|
|
138
|
+
*
|
|
139
|
+
* @since v0.2.0
|
|
140
|
+
*/
|
|
141
|
+
@unsafe
|
|
142
|
+
export let gt = (x: Float32, y: Float32) => {
|
|
80
143
|
let xv = WasmF32.load(WasmI32.fromGrain(x), 8n)
|
|
81
144
|
let yv = WasmF32.load(WasmI32.fromGrain(y), 8n)
|
|
82
|
-
|
|
83
|
-
Memory.decRef(WasmI32.fromGrain(x))
|
|
84
|
-
Memory.decRef(WasmI32.fromGrain(y))
|
|
85
|
-
Memory.decRef(WasmI32.fromGrain(gt))
|
|
86
|
-
ret
|
|
145
|
+
WasmF32.gt(xv, yv)
|
|
87
146
|
}
|
|
88
147
|
|
|
89
|
-
|
|
90
|
-
|
|
148
|
+
/**
|
|
149
|
+
* Checks if the first value is less than or equal to the second value.
|
|
150
|
+
*
|
|
151
|
+
* @param x: The first value
|
|
152
|
+
* @param y: The second value
|
|
153
|
+
* @returns `true` if the first value is less than or equal to the second value or `false` otherwise
|
|
154
|
+
*
|
|
155
|
+
* @since v0.2.0
|
|
156
|
+
*/
|
|
157
|
+
@unsafe
|
|
158
|
+
export let lte = (x: Float32, y: Float32) => {
|
|
91
159
|
let xv = WasmF32.load(WasmI32.fromGrain(x), 8n)
|
|
92
160
|
let yv = WasmF32.load(WasmI32.fromGrain(y), 8n)
|
|
93
|
-
|
|
94
|
-
Memory.decRef(WasmI32.fromGrain(x))
|
|
95
|
-
Memory.decRef(WasmI32.fromGrain(y))
|
|
96
|
-
Memory.decRef(WasmI32.fromGrain(lte))
|
|
97
|
-
ret
|
|
161
|
+
WasmF32.le(xv, yv)
|
|
98
162
|
}
|
|
99
163
|
|
|
100
|
-
|
|
101
|
-
|
|
164
|
+
/**
|
|
165
|
+
* Checks if the first value is greater than or equal to the second value.
|
|
166
|
+
*
|
|
167
|
+
* @param x: The first value
|
|
168
|
+
* @param y: The second value
|
|
169
|
+
* @returns `true` if the first value is greater than or equal to the second value or `false` otherwise
|
|
170
|
+
*
|
|
171
|
+
* @since v0.2.0
|
|
172
|
+
*/
|
|
173
|
+
@unsafe
|
|
174
|
+
export let gte = (x: Float32, y: Float32) => {
|
|
102
175
|
let xv = WasmF32.load(WasmI32.fromGrain(x), 8n)
|
|
103
176
|
let yv = WasmF32.load(WasmI32.fromGrain(y), 8n)
|
|
104
|
-
|
|
105
|
-
Memory.decRef(WasmI32.fromGrain(x))
|
|
106
|
-
Memory.decRef(WasmI32.fromGrain(y))
|
|
107
|
-
Memory.decRef(WasmI32.fromGrain(gte))
|
|
108
|
-
ret
|
|
177
|
+
WasmF32.ge(xv, yv)
|
|
109
178
|
}
|
|
110
179
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
180
|
+
/**
|
|
181
|
+
* @section Constants: Float32 constant values.
|
|
182
|
+
*/
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Infinity represented as a Float32 value.
|
|
186
|
+
*
|
|
187
|
+
* @since v0.4.0
|
|
188
|
+
*/
|
|
189
|
+
@unsafe
|
|
190
|
+
export let infinity = {
|
|
191
|
+
let ptr = newFloat32(
|
|
192
|
+
WasmF32.reinterpretI32(0b01111111100000000000000000000000n)
|
|
193
|
+
)
|
|
194
|
+
WasmI32.toGrain(ptr): Float32
|
|
119
195
|
}
|
|
120
196
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
197
|
+
/**
|
|
198
|
+
* NaN (Not a Number) represented as a Float32 value.
|
|
199
|
+
*
|
|
200
|
+
* @since v0.4.0
|
|
201
|
+
*/
|
|
202
|
+
@unsafe
|
|
203
|
+
export let nan = {
|
|
204
|
+
let ptr = newFloat32(
|
|
205
|
+
WasmF32.reinterpretI32(0b01111111100000000000000000000001n)
|
|
206
|
+
)
|
|
207
|
+
WasmI32.toGrain(ptr): Float32
|
|
129
208
|
}
|
|
130
|
-
|
|
131
|
-
export let nan = makeNaN()
|
package/float32.md
ADDED
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Float32
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Utilities for working with the Float32 type.
|
|
6
|
+
|
|
7
|
+
<details disabled>
|
|
8
|
+
<summary tabindex="-1">Added in <code>0.2.0</code></summary>
|
|
9
|
+
No other changes yet.
|
|
10
|
+
</details>
|
|
11
|
+
|
|
12
|
+
```grain
|
|
13
|
+
import Float32 from "float32"
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Conversions
|
|
17
|
+
|
|
18
|
+
Functions for converting between Numbers and the Float32 type.
|
|
19
|
+
|
|
20
|
+
### Float32.**fromNumber**
|
|
21
|
+
|
|
22
|
+
<details disabled>
|
|
23
|
+
<summary tabindex="-1">Added in <code>0.2.0</code></summary>
|
|
24
|
+
No other changes yet.
|
|
25
|
+
</details>
|
|
26
|
+
|
|
27
|
+
```grain
|
|
28
|
+
fromNumber : Number -> Float32
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Converts a Number to a Float32.
|
|
32
|
+
|
|
33
|
+
Parameters:
|
|
34
|
+
|
|
35
|
+
|param|type|description|
|
|
36
|
+
|-----|----|-----------|
|
|
37
|
+
|`number`|`Number`|The value to convert|
|
|
38
|
+
|
|
39
|
+
Returns:
|
|
40
|
+
|
|
41
|
+
|type|description|
|
|
42
|
+
|----|-----------|
|
|
43
|
+
|`Float32`|The Number represented as a Float32|
|
|
44
|
+
|
|
45
|
+
### Float32.**toNumber**
|
|
46
|
+
|
|
47
|
+
<details disabled>
|
|
48
|
+
<summary tabindex="-1">Added in <code>0.2.0</code></summary>
|
|
49
|
+
No other changes yet.
|
|
50
|
+
</details>
|
|
51
|
+
|
|
52
|
+
```grain
|
|
53
|
+
toNumber : Float32 -> Number
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Converts a Float32 to a Number.
|
|
57
|
+
|
|
58
|
+
Parameters:
|
|
59
|
+
|
|
60
|
+
|param|type|description|
|
|
61
|
+
|-----|----|-----------|
|
|
62
|
+
|`float`|`Float32`|The value to convert|
|
|
63
|
+
|
|
64
|
+
Returns:
|
|
65
|
+
|
|
66
|
+
|type|description|
|
|
67
|
+
|----|-----------|
|
|
68
|
+
|`Number`|The Float32 represented as a Number|
|
|
69
|
+
|
|
70
|
+
## Operations
|
|
71
|
+
|
|
72
|
+
Mathematical operations for Float32 values.
|
|
73
|
+
|
|
74
|
+
### Float32.**add**
|
|
75
|
+
|
|
76
|
+
<details disabled>
|
|
77
|
+
<summary tabindex="-1">Added in <code>0.2.0</code></summary>
|
|
78
|
+
No other changes yet.
|
|
79
|
+
</details>
|
|
80
|
+
|
|
81
|
+
```grain
|
|
82
|
+
add : (Float32, Float32) -> Float32
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Computes the sum of its operands.
|
|
86
|
+
|
|
87
|
+
Parameters:
|
|
88
|
+
|
|
89
|
+
|param|type|description|
|
|
90
|
+
|-----|----|-----------|
|
|
91
|
+
|`x`|`Float32`|The first operand|
|
|
92
|
+
|`y`|`Float32`|The second operand|
|
|
93
|
+
|
|
94
|
+
Returns:
|
|
95
|
+
|
|
96
|
+
|type|description|
|
|
97
|
+
|----|-----------|
|
|
98
|
+
|`Float32`|The sum of the two operands|
|
|
99
|
+
|
|
100
|
+
### Float32.**sub**
|
|
101
|
+
|
|
102
|
+
<details disabled>
|
|
103
|
+
<summary tabindex="-1">Added in <code>0.2.0</code></summary>
|
|
104
|
+
No other changes yet.
|
|
105
|
+
</details>
|
|
106
|
+
|
|
107
|
+
```grain
|
|
108
|
+
sub : (Float32, Float32) -> Float32
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Computes the difference of its operands.
|
|
112
|
+
|
|
113
|
+
Parameters:
|
|
114
|
+
|
|
115
|
+
|param|type|description|
|
|
116
|
+
|-----|----|-----------|
|
|
117
|
+
|`x`|`Float32`|The first operand|
|
|
118
|
+
|`y`|`Float32`|The second operand|
|
|
119
|
+
|
|
120
|
+
Returns:
|
|
121
|
+
|
|
122
|
+
|type|description|
|
|
123
|
+
|----|-----------|
|
|
124
|
+
|`Float32`|The difference of the two operands|
|
|
125
|
+
|
|
126
|
+
### Float32.**mul**
|
|
127
|
+
|
|
128
|
+
<details disabled>
|
|
129
|
+
<summary tabindex="-1">Added in <code>0.2.0</code></summary>
|
|
130
|
+
No other changes yet.
|
|
131
|
+
</details>
|
|
132
|
+
|
|
133
|
+
```grain
|
|
134
|
+
mul : (Float32, Float32) -> Float32
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Computes the product of its operands.
|
|
138
|
+
|
|
139
|
+
Parameters:
|
|
140
|
+
|
|
141
|
+
|param|type|description|
|
|
142
|
+
|-----|----|-----------|
|
|
143
|
+
|`x`|`Float32`|The first operand|
|
|
144
|
+
|`y`|`Float32`|The second operand|
|
|
145
|
+
|
|
146
|
+
Returns:
|
|
147
|
+
|
|
148
|
+
|type|description|
|
|
149
|
+
|----|-----------|
|
|
150
|
+
|`Float32`|The product of the two operands|
|
|
151
|
+
|
|
152
|
+
### Float32.**div**
|
|
153
|
+
|
|
154
|
+
<details disabled>
|
|
155
|
+
<summary tabindex="-1">Added in <code>0.2.0</code></summary>
|
|
156
|
+
No other changes yet.
|
|
157
|
+
</details>
|
|
158
|
+
|
|
159
|
+
```grain
|
|
160
|
+
div : (Float32, Float32) -> Float32
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Computes the quotient of its operands.
|
|
164
|
+
|
|
165
|
+
Parameters:
|
|
166
|
+
|
|
167
|
+
|param|type|description|
|
|
168
|
+
|-----|----|-----------|
|
|
169
|
+
|`x`|`Float32`|The first operand|
|
|
170
|
+
|`y`|`Float32`|The second operand|
|
|
171
|
+
|
|
172
|
+
Returns:
|
|
173
|
+
|
|
174
|
+
|type|description|
|
|
175
|
+
|----|-----------|
|
|
176
|
+
|`Float32`|The quotient of the two operands|
|
|
177
|
+
|
|
178
|
+
## Comparisons
|
|
179
|
+
|
|
180
|
+
Functions for comparing Float32 values.
|
|
181
|
+
|
|
182
|
+
### Float32.**lt**
|
|
183
|
+
|
|
184
|
+
<details disabled>
|
|
185
|
+
<summary tabindex="-1">Added in <code>0.2.0</code></summary>
|
|
186
|
+
No other changes yet.
|
|
187
|
+
</details>
|
|
188
|
+
|
|
189
|
+
```grain
|
|
190
|
+
lt : (Float32, Float32) -> Bool
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Checks if the first value is less than the second value.
|
|
194
|
+
|
|
195
|
+
Parameters:
|
|
196
|
+
|
|
197
|
+
|param|type|description|
|
|
198
|
+
|-----|----|-----------|
|
|
199
|
+
|`x`|`Float32`|The first value|
|
|
200
|
+
|`y`|`Float32`|The second value|
|
|
201
|
+
|
|
202
|
+
Returns:
|
|
203
|
+
|
|
204
|
+
|type|description|
|
|
205
|
+
|----|-----------|
|
|
206
|
+
|`Bool`|`true` if the first value is less than the second value or `false` otherwise|
|
|
207
|
+
|
|
208
|
+
### Float32.**gt**
|
|
209
|
+
|
|
210
|
+
<details disabled>
|
|
211
|
+
<summary tabindex="-1">Added in <code>0.2.0</code></summary>
|
|
212
|
+
No other changes yet.
|
|
213
|
+
</details>
|
|
214
|
+
|
|
215
|
+
```grain
|
|
216
|
+
gt : (Float32, Float32) -> Bool
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
Checks if the first value is greater than the second value.
|
|
220
|
+
|
|
221
|
+
Parameters:
|
|
222
|
+
|
|
223
|
+
|param|type|description|
|
|
224
|
+
|-----|----|-----------|
|
|
225
|
+
|`x`|`Float32`|The first value|
|
|
226
|
+
|`y`|`Float32`|The second value|
|
|
227
|
+
|
|
228
|
+
Returns:
|
|
229
|
+
|
|
230
|
+
|type|description|
|
|
231
|
+
|----|-----------|
|
|
232
|
+
|`Bool`|`true` if the first value is greater than the second value or `false` otherwise|
|
|
233
|
+
|
|
234
|
+
### Float32.**lte**
|
|
235
|
+
|
|
236
|
+
<details disabled>
|
|
237
|
+
<summary tabindex="-1">Added in <code>0.2.0</code></summary>
|
|
238
|
+
No other changes yet.
|
|
239
|
+
</details>
|
|
240
|
+
|
|
241
|
+
```grain
|
|
242
|
+
lte : (Float32, Float32) -> Bool
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
Checks if the first value is less than or equal to the second value.
|
|
246
|
+
|
|
247
|
+
Parameters:
|
|
248
|
+
|
|
249
|
+
|param|type|description|
|
|
250
|
+
|-----|----|-----------|
|
|
251
|
+
|`x`|`Float32`|The first value|
|
|
252
|
+
|`y`|`Float32`|The second value|
|
|
253
|
+
|
|
254
|
+
Returns:
|
|
255
|
+
|
|
256
|
+
|type|description|
|
|
257
|
+
|----|-----------|
|
|
258
|
+
|`Bool`|`true` if the first value is less than or equal to the second value or `false` otherwise|
|
|
259
|
+
|
|
260
|
+
### Float32.**gte**
|
|
261
|
+
|
|
262
|
+
<details disabled>
|
|
263
|
+
<summary tabindex="-1">Added in <code>0.2.0</code></summary>
|
|
264
|
+
No other changes yet.
|
|
265
|
+
</details>
|
|
266
|
+
|
|
267
|
+
```grain
|
|
268
|
+
gte : (Float32, Float32) -> Bool
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
Checks if the first value is greater than or equal to the second value.
|
|
272
|
+
|
|
273
|
+
Parameters:
|
|
274
|
+
|
|
275
|
+
|param|type|description|
|
|
276
|
+
|-----|----|-----------|
|
|
277
|
+
|`x`|`Float32`|The first value|
|
|
278
|
+
|`y`|`Float32`|The second value|
|
|
279
|
+
|
|
280
|
+
Returns:
|
|
281
|
+
|
|
282
|
+
|type|description|
|
|
283
|
+
|----|-----------|
|
|
284
|
+
|`Bool`|`true` if the first value is greater than or equal to the second value or `false` otherwise|
|
|
285
|
+
|
|
286
|
+
## Constants
|
|
287
|
+
|
|
288
|
+
Float32 constant values.
|
|
289
|
+
|
|
290
|
+
### Float32.**infinity**
|
|
291
|
+
|
|
292
|
+
<details disabled>
|
|
293
|
+
<summary tabindex="-1">Added in <code>0.4.0</code></summary>
|
|
294
|
+
No other changes yet.
|
|
295
|
+
</details>
|
|
296
|
+
|
|
297
|
+
```grain
|
|
298
|
+
infinity : Float32
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
Infinity represented as a Float32 value.
|
|
302
|
+
|
|
303
|
+
### Float32.**nan**
|
|
304
|
+
|
|
305
|
+
<details disabled>
|
|
306
|
+
<summary tabindex="-1">Added in <code>0.4.0</code></summary>
|
|
307
|
+
No other changes yet.
|
|
308
|
+
</details>
|
|
309
|
+
|
|
310
|
+
```grain
|
|
311
|
+
nan : Float32
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
NaN (Not a Number) represented as a Float32 value.
|
|
315
|
+
|