Skip to content

Commit fe244dd

Browse files
authored
Merge pull request #52 from vchuravy/vc/rem
cleanup rem function for ufixed
2 parents 045b3f0 + 8462f61 commit fe244dd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/ufixed.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ _convert{U<:UFixed,T}(::Type{U}, ::Type{T}, x) = U(round(T, widen1(rawone(
4848
_convert{U<:UFixed }(::Type{U}, ::Type{UInt128}, x) = U(round(UInt128, rawone(U)*x), 0)
4949

5050
rem{T<:UFixed}(x::T, ::Type{T}) = x
51-
rem{T<:UFixed}(x::UFixed, ::Type{T}) = reinterpret(T, rem(unsafe_trunc(UInt, round((rawone(T)/rawone(x))*reinterpret(x))), rawtype(T)))
52-
rem{T<:UFixed}(x::Real, ::Type{T}) = reinterpret(T, rem(unsafe_trunc(Int, round(rawone(T)*x)), rawtype(T)))
51+
rem{T<:UFixed}(x::UFixed, ::Type{T}) = reinterpret(T, unsafe_trunc(rawtype(T), round((rawone(T)/rawone(x))*reinterpret(x))))
52+
rem{T<:UFixed}(x::Real, ::Type{T}) = reinterpret(T, unsafe_trunc(rawtype(T), round(rawone(T)*x)))
5353

5454
convert(::Type{BigFloat}, x::UFixed) = reinterpret(x)*(1/BigFloat(rawone(x)))
5555
function convert{T<:AbstractFloat}(::Type{T}, x::UFixed)

0 commit comments

Comments
 (0)