Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Counter intuitive result in centered with rounding modes specified #250

Closed
jishnub opened this issue Jul 17, 2021 · 1 comment · Fixed by #251
Closed

Counter intuitive result in centered with rounding modes specified #250

jishnub opened this issue Jul 17, 2021 · 1 comment · Fixed by #251
Assignees

Comments

@jishnub
Copy link
Member

jishnub commented Jul 17, 2021

It's not clear what the rounding mode refers to, since centered used .-center to generate the offset. This implies that the center of the original array, if rounded up, actually gets rounded down when negated.

julia> OffsetArrays.center(OffsetArrays.centered(ones(2,2), RoundDown))
(0, 0)

julia> OffsetArrays.center(OffsetArrays.centered(ones(2,2), RoundUp))
(-1, -1)

Intuitively it seems that the center of the array should have higher coordinate values when RoundUp is selected

@johnnychen94
Copy link
Member

Yep, this was really a mistake.

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

Successfully merging a pull request may close this issue.

2 participants