1
0
mirror of https://github.com/adambard/learnxinyminutes-docs.git synced 2025-08-26 16:15:09 +02:00

Merge pull request #3478 from tlienart/patch-1

[julia/en] Add note about integer overflow
This commit is contained in:
Andre Polykanine
2019-02-20 01:27:51 +02:00
committed by GitHub

View File

@@ -46,6 +46,13 @@ div(5, 2) # => 2 # for a truncated result, use div
# Enforce precedence with parentheses # Enforce precedence with parentheses
(1 + 3) * 2 # => 8 (1 + 3) * 2 # => 8
# Julia (unlike Python for instance) has integer under/overflow
10^19 # => -8446744073709551616
# use bigint or floating point to avoid this
big(10)^19 # => 10000000000000000000
1e19 # => 1.0e19
10.0^19 # => 1.0e19
# Bitwise Operators # Bitwise Operators
~2 # => -3 # bitwise not ~2 # => -3 # bitwise not
3 & 5 # => 1 # bitwise and 3 & 5 # => 1 # bitwise and