We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cc1be0e commit eccbd5fCopy full SHA for eccbd5f
src/rewrite.jl
@@ -79,6 +79,9 @@ function Base.:/(z::Zero, x::Any)
79
end
80
81
82
+Base.iszero(::Zero) = true
83
+Base.isone(::Zero) = false
84
+
85
# These methods are used to provide an efficient implementation for the common
86
# case like `x^2 * sum(f for i in 1:0)`, which lowers to
87
# `_MA.operate!!(*, x^2, _MA.Zero())`. We don't need the method with reversed
test/rewrite.jl
@@ -19,6 +19,8 @@ import MutableArithmetics as MA
19
@test -z isa MA.Zero
20
@test +z isa MA.Zero
21
@test *(z) isa MA.Zero
22
+ @test iszero(z)
23
+ @test !isone(z)
24
25
26
# Test that the macro call `m` throws an error exception during pre-compilation
0 commit comments