Skip to content

Commit cb44fae

Browse files
authored
fix parseInt description and definition (#193)
1 parent 6d1be01 commit cb44fae

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/stdlib/globals.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,16 @@ The following global constants and functions are present alongside the standard
3131
Tests if a 32-bit or 64-bit float is finite, that is not `NaN` or +/-`Infinity`.
3232

3333
* ```ts
34-
function parseInt(str: string, radix?: i32): i64
35-
```
36-
Parses a string to a 64-bit integer. Returns `0` on invalid inputs.
34+
function parseInt(str: string, radix?: i32): f64
35+
```
36+
Parses a string representing an integer to an f64 number Returns `NaN` on invalid inputs.
37+
38+
Type-specific variants of `parseInt` are available separately:
39+
* `F32.parseInt` to parse to a 32-bit float.
40+
* `I8.parseInt` to parse to a signed 8-bit integer, respectively `U8.parseInt` if unsigned.
41+
* `I16.parseInt` to parse to a signed 16-bit integer, respectively `U16.parseInt` if unsigned.
42+
* `I32.parseInt` to parse to a signed 32-bit integer, respectively `U32.parseInt` if unsigned.
43+
* `I64.parseInt` to parse to a signed 64-bit integer, respectively `U64.parseInt` if unsigned.
3744

3845
* ```ts
3946
function parseFloat(str: string): f64

0 commit comments

Comments
 (0)