Skip to content

Commit b36f86b

Browse files
committed
round and ceil now return FixedPoint
1 parent 2ceea17 commit b36f86b

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
@@ -112,10 +112,6 @@ trunc{T<:Integer}(::Type{T}, x::UFixed) = convert(T, div(reinterpret(x), rawone(
112112
round{T<:Integer}(::Type{T}, x::UFixed) = round(T, reinterpret(x)/rawone(x))
113113
floor{T<:Integer}(::Type{T}, x::UFixed) = trunc(T, x)
114114
ceil{T<:Integer}(::Type{T}, x::UFixed) = ceil(T, reinterpret(x)/rawone(x))
115-
trunc(x::UFixed) = trunc(Int, x)
116-
round(x::UFixed) = round(Int, x)
117-
floor(x::UFixed) = floor(Int, x)
118-
ceil(x::UFixed) = ceil(Int, x)
119115

120116
isfinite(x::UFixed) = true
121117
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)