We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b56f4be commit ea00b23Copy full SHA for ea00b23
src/intervals/functions.jl
@@ -378,7 +378,7 @@ end
378
Calculate `x mod y` where `x` is an interval and `y` is a positive divisor.
379
"""
380
function mod(x::Interval, y::Real)
381
- @assert y > 0 "modulo is currently implemented only for a positive divisor."
+ @assert y > zero(y) "modulo is currently implemented only for a positive divisor."
382
division = x / y
383
fl = floor(division)
384
fl.lo < fl.hi ? Interval(zero(y), y) : y * (division - fl)
test/interval_tests/numeric.jl
@@ -458,4 +458,6 @@ end
458
@test mod(x, 2) == mod(x, 2.0) == 0..2
459
@test mod(x, 2.5) == 0..2.5
460
@test mod(x, 0.5) == 0..0.5
461
+
462
+ @test_throws AssertionError mod(x, -1)
463
end
0 commit comments