From ee5bd547bf73cf9ec6b976088c0c2565630f4ea5 Mon Sep 17 00:00:00 2001 From: kimikage Date: Thu, 7 Nov 2019 13:48:26 +0900 Subject: [PATCH] Fix `rem` problem with negative float inputs on ARMv7 --- src/normed.jl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/normed.jl b/src/normed.jl index ec92ee5f..e3375ab9 100644 --- a/src/normed.jl +++ b/src/normed.jl @@ -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