JeffreySarnoff / SaferIntegers.jl

These integer types use checked arithmetic, otherwise they are as system types.
MIT License
59 stars 9 forks source link

Fix fail of @saferintegers with ^ operator #36

Closed Tortar closed 1 year ago

Tortar commented 1 year ago

I admit that I'm not understanding very well how the package works but it seems that these changes should fix the problem in #35 with the ^ operator, let me know if this fix is unacceptable for whatever reason :-)

Now all seems to work fine:

julia> @saferintegers 100^1
100

julia> @saferintegers 2^62
4611686018427387904

julia> @saferintegers 2^63
ERROR: OverflowError: 2^63
Stacktrace:
 [1] ^(x::SafeInt64, y::SafeInt64)
   @ SaferIntegers ~/.julia/packages/SaferIntegers/Xn8ie/src/pow.jl:26
 [2] top-level scope
   @ REPL[16]:1
JeffreySarnoff commented 1 year ago

thank you