Skip to content
This repository has been archived by the owner on Nov 22, 2023. It is now read-only.

OffsetInteger operations incorrect #186

Closed
goretkin opened this issue Oct 31, 2019 · 2 comments
Closed

OffsetInteger operations incorrect #186

goretkin opened this issue Oct 31, 2019 · 2 comments

Comments

@goretkin
Copy link
Contributor

I think the intent of OffsetInteger is that it preserves all the structure of integers, but the definitions at

for op in (:(-), :abs)
@eval $(op)(x::T) where {T <: OffsetInteger} = T($(op)(x.i))
end
for op in (:(+), :(-), :(*), :(/), :div)
@eval begin
@inline function $(op)(x::OffsetInteger{O}, y::OffsetInteger{O}) where O
OffsetInteger{O}($op(x.i, y.i))
end
end
end

don't do this.

The operations shouldn't happen on the underlying value, but on the "effective" value.

@SimonDanisch
Copy link
Member

Hm good point... I will see if there are any regression by fixing this!

@goretkin
Copy link
Contributor Author

Thanks for looking at the PR!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants