File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -107,7 +107,7 @@ T == UInt32 |x - - - - - - -:- - - - - - - -:x - - - - - - -:- - - - - - - -|
107
107
"""
108
108
function target_f (X:: Type , T:: Type{<:Integer} ; ex = :default )
109
109
f_min = X === Fixed ? 0 : 1
110
- f_max = bitwidth (T) - (T <: Signed ) - 1 + f_min
110
+ f_max = bitwidth (T) - (T <: Signed )
111
111
ex === :heavy && return f_min: f_max
112
112
ex === :default && bitwidth (T) <= 16 && return f_min: f_max
113
113
ex === :thin && return ((f_max + 1 ) ÷ 2 , f_max)
Original file line number Diff line number Diff line change @@ -24,8 +24,8 @@ function test_fixed(::Type{F}) where {F}
24
24
fxf = convert (Float64, fx)
25
25
26
26
@test convert (F, convert (Float64, fx)) === fx
27
- @test convert (F, convert (Float64, - fx)) === - fx
28
- @test convert (Float64, - fx) == - convert (Float64, fx)
27
+ fx != typemin (F) && @test convert (F, convert (Float64, - fx)) === - fx
28
+ fx != typemin (F) && @test convert (Float64, - fx) == - convert (Float64, fx)
29
29
30
30
rx = convert (Rational{BigInt}, fx)
31
31
@assert isequal (fx, rx) == isequal (hash (fx), hash (rx))
96
96
f < bitwidth (T) - 1 && @test one (F) == 1
97
97
f < bitwidth (T) - 1 && @test one (F) * oneunit (F) == oneunit (F)
98
98
@test typemin (F) == typemin (T) >> f
99
- @test typemax (F) == typemax (T)// big " 2" ^ f
99
+ if T === Int128
100
+ @test typemax (F) * big " 2.0" ^ f == typemax (T) # force promotion to BigFloat due to lack of PR #207
101
+ else
102
+ @test typemax (F) == typemax (T)// big " 2" ^ f
103
+ end
100
104
@test floatmin (F) === eps (F) == 2.0 ^- f # issue #79
101
105
@test floatmax (F) === typemax (F)
102
106
@test eps (zero (F)) === eps (typemax (F))
You can’t perform that action at this time.
0 commit comments