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 a468b61 commit cf42b92Copy full SHA for cf42b92
src/Mods.jl/src/Mods.jl
@@ -60,7 +60,7 @@ julia> value(a)
60
11
61
```
62
"""
63
-value(a::Mod{N}) where {N} = a.val
+value(a::Mod{N}) where {N} = mod(a.val, N)
64
65
Base.abs(a::Mod{N,<:Real} where {N}) = abs(value(a))
66
@@ -71,8 +71,8 @@ function hash(x::Mod, h::UInt64 = UInt64(0))
71
end
72
73
# Test for equality
74
-iszero(x::Mod{N}) where {N} = iszero(x.val)
75
-==(x::Mod, y::Mod) = modulus(x) == modulus(y) && value(y) == value(y)
+iszero(x::Mod{N}) where {N} = iszero(value(x))
+==(x::Mod, y::Mod) = modulus(x) == modulus(y) && value(x) == value(y)
76
# ==(x::Mod{N}, y::Mod{N}) where {N} = iszero(value(x - y))
77
78
# Apporximate equality
0 commit comments