Skip to content

Commit f9218ff

Browse files
committed
round and ceil now return FixedPoint
1 parent d0be500 commit f9218ff

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
@@ -96,12 +96,16 @@ function testtrunc{T}(inc::T)
9696
for i = 0 : min(1e6, reinterpret(typemax(T))-1)
9797
xf = incf*i
9898
try
99+
@test typeof(trunc(x)) == T
99100
@test trunc(x) == trunc(xf)
101+
@test typeof(round(x)) == T
100102
@test round(x) == round(xf)
101103
cxf = ceil(xf)
102104
if cxf < tm
105+
@test typeof(ceil(x)) == T
103106
@test ceil(x) == ceil(xf)
104107
end
108+
@test typeof(floor(x)) == T
105109
@test floor(x) == floor(xf)
106110
@test trunc(Int,x) == trunc(Int,xf)
107111
@test round(Int,x) == round(Int,xf)

0 commit comments

Comments
 (0)