Skip to content

Commit 2a9f441

Browse files
authored
More tests for rem2pi branches (#48541)
1 parent baf9680 commit 2a9f441

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

test/numbers.jl

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2676,6 +2676,24 @@ end
26762676
@test rem2pi(T(-8), RoundNearest) -8+2pi
26772677
@test rem2pi(T(-8), RoundDown) -8+4pi
26782678
@test rem2pi(T(-8), RoundUp) -8+2pi
2679+
# to hit n is even and n % 4 == 2 condition
2680+
@test rem2pi(T(3), RoundToZero) == 3
2681+
@test rem2pi(T(3), RoundNearest) == 3
2682+
@test rem2pi(T(3), RoundDown) == 3
2683+
@test rem2pi(T(3), RoundUp) 3 - 2π
2684+
@test rem2pi(T(-3), RoundToZero) == -3
2685+
@test rem2pi(T(-3), RoundNearest) == -3
2686+
@test rem2pi(T(-3), RoundDown) -3 + 2π
2687+
@test rem2pi(T(-3), RoundUp) == -3
2688+
# to hit even n condition and n % 4 != 2 condition
2689+
@test rem2pi(T(13), RoundToZero) 13-4π
2690+
@test rem2pi(T(13), RoundNearest) 13-4π
2691+
@test rem2pi(T(13), RoundDown) 13-4π
2692+
@test rem2pi(T(13), RoundUp) 13-6π
2693+
@test rem2pi(T(-13), RoundToZero) -13+4π
2694+
@test rem2pi(T(-13), RoundNearest) -13+4π
2695+
@test rem2pi(T(-13), RoundDown) -13+6π
2696+
@test rem2pi(T(-13), RoundUp) -13+4π
26792697
end
26802698

26812699
@testset "PR #36420 $T" for T in (Float16, Float32, Float64)

0 commit comments

Comments
 (0)