diff options
author | Jo-Philipp Wich <jo@mein.io> | 2022-06-01 13:08:36 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-01 13:08:36 +0200 |
commit | b211ca0e420d8086d3fa0358413a6f8b44df1115 (patch) | |
tree | 2e60555dc4ce9e81b42b7556dd2e2491473f776c /tests/custom/03_stdlib | |
parent | 9b35df7b37f21043f4be0bdba011000ad4f7cf0f (diff) | |
parent | d99604749d658f5f344d53e77dd52fbb0f6d176c (diff) |
Merge pull request #78 from jow-/number-literals
Number literals
Diffstat (limited to 'tests/custom/03_stdlib')
-rw-r--r-- | tests/custom/03_stdlib/08_int | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/tests/custom/03_stdlib/08_int b/tests/custom/03_stdlib/08_int index a6b5923..eae4904 100644 --- a/tests/custom/03_stdlib/08_int +++ b/tests/custom/03_stdlib/08_int @@ -1,8 +1,9 @@ The `int()` function converts the given value into a signed integer -value and returns the resulting number. +value and returns the resulting number. In case the value is of type +string, a second optional base argument may be specified which is +passed to the underlying strtoll(3) implementation. Returns `NaN` if the given argument is not convertible into a number. - Returns `NaN` if the conversion result is out of range. -- Testcase -- @@ -19,7 +20,11 @@ Returns `NaN` if the conversion result is out of range. int("0xffffffffffffffff"), int("0177"), int("+145"), - int("-96") + int("-96"), + int("0177", 8), + int("0x1000", 16), + int("1111", 2), + int("0xffffffffffffffff", 16) ]); %} -- End -- @@ -30,13 +35,17 @@ Returns `NaN` if the conversion result is out of range. 0, 123, 456, - 0, "NaN", "NaN", - 4096, "NaN", + 0, + 0, + 177, + 145, + -96, 127, - "NaN", - -96 + 4096, + 15, + "NaN" ] -- End -- |