Skip to content

Commit

Permalink
Fix rem problem with negative float inputs on ARMv7
Browse files Browse the repository at this point in the history
  • Loading branch information
kimikage committed Nov 11, 2019
1 parent 70ae1d6 commit ee5bd54
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/normed.jl
Original file line number Diff line number Diff line change
Expand Up @@ -203,3 +203,9 @@ end

_unsafe_trunc(::Type{T}, x::Integer) where {T} = x % T
_unsafe_trunc(::Type{T}, x) where {T} = unsafe_trunc(T, x)
if !signbit(signed(unsafe_trunc(UInt, -12.345)))
# 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
end

0 comments on commit ee5bd54

Please sign in to comment.