Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions base/rational.jl
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,7 @@ fma(x::Rational, y::Rational, z::Rational) = x*y+z
<=(x::Rational, y::Integer ) = x.num <= widemul(x.den,y)
<=(x::Integer , y::Rational) = widemul(x,y.den) <= y.num

==(x::Float16, q::Rational) = widen(x) == q
function ==(x::AbstractFloat, q::Rational)
if isfinite(x)
(count_ones(q.den) == 1) & (x*q.den == q.num)
Expand Down
5 changes: 5 additions & 0 deletions test/rational.jl
Original file line number Diff line number Diff line change
Expand Up @@ -837,3 +837,8 @@ end
@test_throws OverflowError numerator(Int8(1)//Int8(31) + Int8(8)im//Int8(3))
end
end

@testset "Float16 comparison" begin
@test Float16(6.0e-8) == big(1//16777216) == 1//16777216
@test Float16(6.0e-8) == 1//16777216
end