Skip to content

Fix arb powers with integer exponents - #427

Open
morluto wants to merge 1 commit into
flintlib:mainfrom
morluto:fix-arb-integer-power
Open

Fix arb powers with integer exponents#427
morluto wants to merge 1 commit into
flintlib:mainfrom
morluto:fix-arb-integer-power

Conversation

@morluto

@morluto morluto commented Sep 3, 2026

Copy link
Copy Markdown

Fixes #426.

arb.__pow__ currently converts Python and FLINT integer exponents to arb before dispatching to generic arb_pow. For an interval crossing zero, that path can return nan even for exponents such as 1 and 2.

This change preserves the exponent type and calls FLINT's integer-specific arb_pow_fmpz for Python int and fmpz operands. Other supported exponent types continue to use arb_pow as before. Regression coverage checks that zero-crossing interval powers remain finite and enclose representative values.

Validation:

  • spin test -- --pyargs flint.test.test_arb -q (47 passed)
  • spin test -- -q -k "not docstrings" (456 passed)
  • cython-lint src/

The full doctest collection was also attempted under a local CPython 3.14 free-threaded build; it has pre-existing doctest namespace failures unrelated to this change, so the passing general and focused suites above are the relevant evidence.

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.

arb interval powers with integer exponents can return nan

1 participant