peon/tests/cast.pn

10 lines
408 B
Plaintext
Raw Normal View History

2023-06-01 12:57:32 +02:00
import std;
# Note: unlike C-style casts, casting in peon tells the compiler
# "hey, please reinterpret the underlying bits of data of this thing
# as the type I'm telling you, trust me bro". There is no data conversion
# occurring whatsoever! For that, use converters (once they're implemented LoL)
2023-06-01 12:57:32 +02:00
print(cast[int, float](2.0) == 4611686018427387904);
print(cast[float, int](4611686018427387904) == 2.0);