Skip to content

Commit

Permalink
attempt to fix 32-bit issue: try out making Base.rat use Int64s.
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanKarpinski committed Apr 7, 2015
1 parent 3ffdaf5 commit aa30ada
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions base/range.jl
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,15 @@ FloatRange(a::FloatingPoint, s::FloatingPoint, l::Real, d::FloatingPoint) =
# float rationalization helper
function rat(x)
y = x
a = d = 1
b = c = 0
a = d = Int64(1)
b = c = Int64(0)
m = maxintfloat(Float32)
while abs(y) <= m
f = trunc(Int,y)
f = trunc(Int64,y)
y -= f
a, c = f*a + c, a
b, d = f*b + d, b
max(abs(a),abs(b)) <= convert(Int,m) || return c, d
max(abs(a),abs(b)) <= convert(Int64,m) || return c, d
oftype(x,a)/oftype(x,b) == x && break
y = inv(y)
end
Expand Down

0 comments on commit aa30ada

Please sign in to comment.