Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
39
Task/Integer-overflow/Jq/integer-overflow.jq
Normal file
39
Task/Integer-overflow/Jq/integer-overflow.jq
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
def compare:
|
||||
if type == "string" then "\n\(.)\n"
|
||||
else map(tostring)
|
||||
| .[1] as $s
|
||||
| .[0]
|
||||
| if $s == . then . + ": agrees"
|
||||
else $s + ": expression evaluates to " + .
|
||||
end
|
||||
end;
|
||||
|
||||
[ -(-2147483647-1),"2147483648"],
|
||||
[2000000000 + 2000000000, "4000000000"],
|
||||
[-2147483647 - 2147483647, "-4294967294"],
|
||||
[46341 * 46341, "2147488281"],
|
||||
[(-2147483647-1) / -1, "2147483648"],
|
||||
|
||||
"For 64-bit signed integers:",
|
||||
|
||||
[-(-9223372036854775807-1), "9223372036854775808"],
|
||||
[5000000000000000000+5000000000000000000, "10000000000000000000"],
|
||||
[-9223372036854775807 - 9223372036854775807, "-18446744073709551614"],
|
||||
[3037000500 * 3037000500, "9223372037000250000"],
|
||||
[(-9223372036854775807-1) / -1, "9223372036854775808"],
|
||||
|
||||
"For 32-bit unsigned integers:",
|
||||
|
||||
[-4294967295, "-4294967295"],
|
||||
[3000000000 + 3000000000, "6000000000"],
|
||||
[2147483647 - 4294967295, "-2147483648"],
|
||||
[65537 * 65537, "4295098369"],
|
||||
|
||||
"For 64-bit unsigned integers:",
|
||||
|
||||
[-18446744073709551615, "-18446744073709551615"],
|
||||
[10000000000000000000 + 10000000000000000000, "20000000000000000000"],
|
||||
[9223372036854775807 - 18446744073709551615, "-9223372036854775808"],
|
||||
[4294967296 * 4294967296, "18446744073709551616"]
|
||||
|
||||
| compare
|
||||
Loading…
Add table
Add a link
Reference in a new issue