JeffreySarnoff / SaferIntegers.jl

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

Unary minus for SafeUnsigned types #10

Closed sostock closed 5 years ago

sostock commented 5 years ago

Unary minus is not overflow-aware for SafeUnsigned types:

julia> -SafeUInt(1)
18446744073709551615

If this is the desired behavior, it would be good to mention it in the documentation.

JeffreySarnoff commented 5 years ago

no, I agree that should be trapped. thank you. fixing it now.

JeffreySarnoff commented 5 years ago

fixed in master, reregistered, merge pending (that was a good find, and it also caught a gap in the handling of ~)

sostock commented 5 years ago

Thanks for the quick fixes!

JeffreySarnoff commented 5 years ago

@sostock fyi, the current, just merged, version has both this and the type conversion corrections.