Overflow in `N63f1(Float64(typemax(N63f1)))` and so on
kimikage opened this issue · 2 comments
kimikage commented
For example:
julia> N63f1(prevfloat(2.0^64))
1.8446744073709548e19N63f1
julia> N63f1(2.0^64)
9.223372036854776e18N63f1
The overflow itself occurs here.
FixedPointNumbers.jl/src/normed.jl
Lines 94 to 95 in 3f12729
However, this is essentially problem with the typemax
.
julia> 2.0^64 > typemax(N63f1) # clearly `2^64` is out of range
true
I already know that we have this kind of problem, and in fact I have added the special handling for the cases of N0f64
and Float16
.
I forgot about this issue, but the tests on ARM seem to "correctly" fail in this regard.
kimikage commented
Apparently there are multiple issues. I limited the scope of this issue to the simple problem, i.e. the cases where f == 1
.
julia> N31f1(2.0f0^32)
2.147483648e9N31f1
julia> Normed{UInt128,1}(prevfloat(2.0^128))
3.402823669209384e38N127f1
julia> Normed{UInt128,1}(2.0^128)
1.7014118346046923e38N127f1
kimikage commented
Perhaps I identified the other issue.
julia> BigFloat(typemax(UInt64))|>N63f1 # x86-64 / i686
1.8446744073709552e19N63f1
julia> BigFloat(typemax(UInt64))|>N63f1 # Aarch64 / ARMv7
9.223372036854776e18N63f1