Skip to content

Commit cf42b92

Browse files
authored
fix mod == (#96)
1 parent a468b61 commit cf42b92

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Mods.jl/src/Mods.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ julia> value(a)
6060
11
6161
```
6262
"""
63-
value(a::Mod{N}) where {N} = a.val
63+
value(a::Mod{N}) where {N} = mod(a.val, N)
6464

6565
Base.abs(a::Mod{N,<:Real} where {N}) = abs(value(a))
6666

@@ -71,8 +71,8 @@ function hash(x::Mod, h::UInt64 = UInt64(0))
7171
end
7272

7373
# 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)
74+
iszero(x::Mod{N}) where {N} = iszero(value(x))
75+
==(x::Mod, y::Mod) = modulus(x) == modulus(y) && value(x) == value(y)
7676
# ==(x::Mod{N}, y::Mod{N}) where {N} = iszero(value(x - y))
7777

7878
# Apporximate equality

0 commit comments

Comments
 (0)