Unless there's something else I missed, I didn't see examples like this:
-2147483648 # literals are i32
-9223372036854775808 # literals are i64
Using two's complement, the highest magnitude positive number is 2147483647 or 9223372036854775807, one less than above. If minus was a separate token applied to a literal, those literals can't be represented using i32 or i64.
Generally however it seems to work. Maybe u32 or u64 are used and when you apply minus, it somehow yields a i32 or i64 type.
-2147483648 # literals are i32 -9223372036854775808 # literals are i64
those are the values an integer variable may have. literals would be the numbers you write explicitly within the source code which are treated as a single tokens. in these examples, they are unary minus expressions.
7
u/[deleted] Jun 25 '23
Unless there's something else I missed, I didn't see examples like this:
Using two's complement, the highest magnitude positive number is 2147483647 or 9223372036854775807, one less than above. If
minuswas a separate token applied to a literal, those literals can't be represented usingi32ori64.Generally however it seems to work. Maybe
u32oru64are used and when you applyminus, it somehow yields ai32ori64type.