JuliaLang/julia — pull request #8611 by simonbyrne (2014-10-07 20:31:27+00:00)
Title: remove bigfloat dependence from rationalize

This implements `rationalize` without `widen`ing the argument (e.g. `Float64` to `BigFloat`), and so is a fair bit quicker.

Also the tolerance parameter is now more precise: it bounds the actual difference between the float and rational (the current behaviour bounds the difference after the rational has been converted to float). Note that this also means that `convert(Rational{T}, x)` will return the exact value if it is representable, e.g.
```julia
julia> convert(Rational{Int64},0.1)
3602879701896397//36028797018963968

julia> ispow2(ans.den)
true
```

cc: @nolta @StefanKarpinski