Skip to content

Commit 39ef3f5

Browse files
committed
debug
1 parent a399254 commit 39ef3f5

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/ufixed.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ convert(::Type{UFixed16}, x::UFixed8) = reinterpret(UFixed16, convert(UInt16, 0x
5353
convert{U<:UFixed}(::Type{U}, x::Real) = _convert(U, rawtype(U), x)
5454
function _convert{U<:UFixed,T}(::Type{U}, ::Type{T}, x)
5555
y = round(widen1(rawone(U))*x)
56+
if y > typemax(T)
57+
@show typeof(x) y typemax(T)
58+
end
5659
(0 <= y) & (y <= typemax(T)) || throw_converterror(U, x)
5760
U(_unsafe_trunc(T, y), 0)
5861
end

test/ufixed.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ UF2 = (UFixed{UInt32,16}, UFixed{UInt64,3}, UFixed{UInt64,51}, UFixed{UInt128,7}
2626
for T in (FixedPointNumbers.UF..., UF2...)
2727
@test zero(T) == 0
2828
@test one(T) == 1
29+
@show @code_llvm one(T)*one(T)
30+
o = one(T)
31+
p = o*o
32+
@show code_llvm p == o
33+
if (one(T)*one(T) != one(T))
34+
@show (one(T)*one(T)).i
35+
@show one(T).i
36+
end
2937
@test one(T) * one(T) == one(T)
3038
@test typemin(T) == 0
3139
@test realmin(T) == 0

0 commit comments

Comments
 (0)