JuliaMath / FixedPointNumbers.jl

fixed point types for julia

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MSB may be cleared in conversion from `BigFloat` on ARM

kimikage opened this issue · comments

julia> BigFloat(typemax(UInt64))|>N63f1 # x86-64 / i686 
1.8446744073709552e19N63f1 

julia> BigFloat(typemax(UInt64))|>N63f1 # Aarch64 / ARMv7
9.223372036854776e18N63f1

Originally posted by @kimikage in #200 (comment)

The following workaround is harmful to BigFloat.

# a workaround for 32-bit ARMv7 (issue #134)
function _unsafe_trunc(::Type{T}, x::AbstractFloat) where {T}
unsafe_trunc(T, unsafe_trunc(typeof(signed(zero(T))), x))
end