Skip to content

Normalize integer scalar keepbits in BitRound#851

Draft
sapunyangkut wants to merge 1 commit into
zarr-developers:mainfrom
sapunyangkut:codex/issue-793-integer-scalar-keepbits
Draft

Normalize integer scalar keepbits in BitRound#851
sapunyangkut wants to merge 1 commit into
zarr-developers:mainfrom
sapunyangkut:codex/issue-793-integer-scalar-keepbits

Conversation

@sapunyangkut

Copy link
Copy Markdown

Summary

  • normalize integer-like keepbits values with operator.index before BitRound arithmetic
  • add regression coverage for built-in, NumPy int32, and NumPy int64 scalars plus invalid inputs
  • document the fix in the unreleased notes

Fixes #793.

Validation

  • tests/test_bitround.py: 16 passed
  • adjacent Quantize and FixedScaleOffset encode/decode tests: 2 passed
  • numeric oracle: built-in/NumPy integer inputs remain finite, serialize as Python int, negative NumPy integers raise ValueError, and floats raise TypeError
  • python -m compileall -q src/numcodecs/bitround.py tests/test_bitround.py
  • git diff --check

The focused tests loaded the repository's Python modules directly because this Windows environment does not have the project's compiled C extensions and build toolchain. The full suite, documentation build, and coverage run were not executed locally; this remains a Draft while CI and maintainer review provide those gates.

Checklist

  • Unit tests added for the changed behavior
  • Affected tests pass locally
  • Change documented in docs/release.md
  • Full test suite and coverage pass in GitHub Actions
  • Documentation builds in CI

AI assistance disclosure

This patch, tests, and pull request text were developed and checked with OpenAI Codex assistance. No independent human self-review is claimed; maintainer review is requested before merge.

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 this pull request may close these issues.

BitRound codec returns NaN if keepbits has dtype int32 instead of int64

1 participant