Skip to content

Commit 9da7fbc

Browse files
mschauerJeffBezanson
authored andcommitted
Fix 32 bit overflows (#32908)
1 parent 387eb80 commit 9da7fbc

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

test/hashing.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ vals = Any[
7272
# Overflow with Int8
7373
Any[Int8(127), Int8(-128), -383], 127:-255:-383,
7474
# Loss of precision with Float64
75-
Any[-2^53-1, 0.0, 2^53+1], [-2^53-1, 0, 2^53+1], (-2^53-1):2^53+1:(2^53+1),
75+
Any[-Int64(2)^53-1, 0.0, Int64(2)^53+1], [-Int64(2)^53-1, 0, Int64(2)^53+1],
76+
(-Int64(2)^53-1):Int64(2)^53+1:(Int64(2)^53+1),
7677
# Some combinations of elements support -, others do not
7778
[1, 2, "a"], [1, "a", 2], [1, 2, "a", 2], [1, 'a', 2],
7879
Set([1,2,3,4]),

test/rounding.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ end
133133
end
134134

135135
@testset "rounding difficult values" begin
136-
for x = 2^53-10:2^53+10
136+
for x = Int64(2)^53-10:Int64(2)^53+10
137137
y = Float64(x)
138138
i = trunc(Int64,y)
139139
@test Int64(trunc(y)) == i

0 commit comments

Comments
 (0)