Skip to content

Commit 4eb9be2

Browse files
committed
round and ceil now return FixedPoint
1 parent f1b4f2a commit 4eb9be2

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/ufixed.jl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,6 @@ trunc{T<:Integer}(::Type{T}, x::UFixed) = convert(T, div(reinterpret(x), rawone(
106106
round{T<:Integer}(::Type{T}, x::UFixed) = round(T, reinterpret(x)/rawone(x))
107107
floor{T<:Integer}(::Type{T}, x::UFixed) = trunc(T, x)
108108
ceil{T<:Integer}(::Type{T}, x::UFixed) = ceil(T, reinterpret(x)/rawone(x))
109-
trunc(x::UFixed) = trunc(Int, x)
110-
round(x::UFixed) = round(Int, x)
111-
floor(x::UFixed) = floor(Int, x)
112-
ceil(x::UFixed) = ceil(Int, x)
113109

114110
isfinite(x::UFixed) = true
115111
isnan(x::UFixed) = false

test/ufixed.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,16 @@ function testtrunc{T}(inc::T)
100100
for i = 0 : min(1e6, reinterpret(typemax(T))-1)
101101
xf = incf*i
102102
try
103+
@test typeof(trunc(x)) == T
103104
@test trunc(x) == trunc(xf)
105+
@test typeof(round(x)) == T
104106
@test round(x) == round(xf)
105107
cxf = ceil(xf)
106108
if cxf < tm
109+
@test typeof(ceil(x)) == T
107110
@test ceil(x) == ceil(xf)
108111
end
112+
@test typeof(floor(x)) == T
109113
@test floor(x) == floor(xf)
110114
@test trunc(Int,x) == trunc(Int,xf)
111115
@test round(Int,x) == round(Int,xf)

0 commit comments

Comments
 (0)