Skip to content

Commit dcde84d

Browse files
committed
Merge pull request #16512 from JuliaLang/sb/rationalfix
fix possible type instability in rationalize.
2 parents ad854b6 + d67e246 commit dcde84d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

base/rational.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ function rationalize{T<:Integer}(::Type{T}, x::AbstractFloat; tol::Real=eps(x))
142142

143143
# find optimal semiconvergent
144144
# smallest a such that x-a*y < a*t+tt
145-
a = max(cld(x-tt,y+t),0.0)
145+
a = cld(x-tt,y+t)
146146
try
147147
ia = convert(T,a)
148148
np = checked_add(checked_mul(ia,p),pp)

0 commit comments

Comments
 (0)