Skip to content

Commit 7299e05

Browse files
Lilith HafnerLilith Hafner
authored andcommitted
add tests for #42060
1 parent 56e3510 commit 7299e05

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

test/rounding.jl

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,8 +353,19 @@ end
353353
end
354354

355355
@testset "rounding floats with specified return type #50778" begin
356-
@test round(Float64, 1.2) == 1
357-
@test round(Float32, 1e60) == Inf32
356+
@test round(Float64, 1.2) === 1.0
357+
@test round(Float32, 1e60) === Inf32
358358
x = floatmax(Float32)-1.0
359359
@test round(Float32, x) == x
360360
end
361+
362+
@testset "rounding complex numbers (#42060)" begin
363+
@test ceil(Complex(4.6, 2.2)) === Complex(5.0, 3.0)
364+
@test floor(Complex(4.6, 2.2)) === Complex(4.0, 2.0)
365+
@test trunc(Complex(4.6, 2.2)) === Complex(4.0, 2.0)
366+
@test round(Complex(4.6, 2.2)) === Complex(5.0, 2.0)
367+
@test ceil(Complex(-4.6, -2.2)) === Complex(-4.0, -2.0)
368+
@test floor(Complex(-4.6, -2.2)) === Complex(-5.0, -3.0)
369+
@test trunc(Complex(-4.6, -2.2)) === Complex(-4.0, -2.0)
370+
@test round(Complex(-4.6, -2.2)) === Complex(-5.0, -2.0)
371+
end

0 commit comments

Comments
 (0)