summaryrefslogtreecommitdiffhomepage
path: root/tests/custom/00_syntax/10_numeric_literals
blob: a19bbd53704f9d9e89a8faada8e0444480e6c87e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
C-style numeric integer and float literals are understood, as well
as the special keywords "Infinity" and "NaN" to denote the IEEE 754
floating point values.

Numeric values are either stored as signed 64 bit integers or signed
doubles internally.

-- Expect stdout --
Integers literals: 123, 127, 2748, 57082
Float literals: 10, 10.3, 1.23456e-65, 16.0625
Octal literals: 63, 118
Binary literals: 7, 11
Special values: Infinity, Infinity, NaN, NaN
Minimum values: -9223372036854775808, -1.79769e+308
Maximum values: 9223372036854775807, 1.79769e+308
Minimum truncation: -9223372036854775808, -Infinity
Maximum truncation: 18446744073709551615, Infinity
-- End --

-- Testcase --
Integers literals: {{ 123 }}, {{ 0177 }}, {{ 0xabc }}, {{ 0xDEFA }}
Float literals: {{ 10. }}, {{ 10.3 }}, {{ 123.456e-67 }}, {{ 0x10.1 }}
Octal literals: {{ 0o77 }}, {{ 0O166 }}
Binary literals: {{ 0b111 }}, {{ 0B1011 }}
Special values: {{ Infinity }}, {{ 1 / 0 }}, {{ NaN }}, {{ "x" / 1 }}
Minimum values: {{ -9223372036854775808 }}, {{ -1.7976931348623158e+308 }}
Maximum values: {{ 9223372036854775807 }}, {{ 1.7976931348623158e+308 }}
Minimum truncation: {{ -100000000000000000000 }}, {{ -1.0e309 }}
Maximum truncation: {{ 100000000000000000000 }}, {{ 1.0e309 }}
-- End --