diff options
author | Thibaut Lienart <tlienart@me.com> | 2019-02-18 12:25:23 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-18 12:25:23 +1100 |
commit | 18c010ecd9b654be5bf6d4dfcd68aeb41edfc3a1 (patch) | |
tree | a2a8dc24b538bf3ce433439ac219e588687f293c /julia.html.markdown | |
parent | 1980272c4f37eae54f3b704e3fce2ba8fab00ecf (diff) |
Add note about integer overflow
Something that may trip users coming from a Python background as per https://discourse.julialang.org/t/julia-messes-up-integer-exponents/20773
Diffstat (limited to 'julia.html.markdown')
-rw-r--r-- | julia.html.markdown | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/julia.html.markdown b/julia.html.markdown index eabb988e..5e9ef1b8 100644 --- a/julia.html.markdown +++ b/julia.html.markdown @@ -46,6 +46,13 @@ div(5, 2) # => 2 # for a truncated result, use div # Enforce precedence with parentheses (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 ~2 # => -3 # bitwise not 3 & 5 # => 1 # bitwise and |