JeffreySarnoff / SaferIntegers.jl

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

`SafeUInt(::SafeUInt)` constructor errors #9

Closed sostock closed 5 years ago

sostock commented 5 years ago

One cannot create a SafeUInt from a SafeUInt if the value is greater than typemax(SafeUInt)/2:

julia> SafeUInt(typemax(SafeUInt))
ERROR: InexactError: check_top_bit(UInt64, 18446744073709551615)

The same happens for the other SafeUnsigned types:

julia> SafeUInt8(SafeUInt8(127))
127

julia> SafeUInt8(SafeUInt8(128))
ERROR: InexactError: check_top_bit(UInt8, 128)
JeffreySarnoff commented 5 years ago

ok, thank you; on it

JeffreySarnoff commented 5 years ago

fixed in master -- merge pending