Skip to content

v3.1.0: pow accepts negative bases with integer exponents - #12

Merged
GeEom merged 2 commits into
mainfrom
pow_domain
Sep 3, 2026
Merged

GeEom merged 2 commits into
mainfrom
pow_domain

Conversation

@GeEom

@GeEom GeEom commented Sep 3, 2026

Copy link
Copy Markdown
Owner

Follow-up to #11.

  • pow now accepts a negative base with an integer exponent, applying the sign from the exponent's parity (read from the raw bits, so it holds beyond i32). Non-integer exponents on a negative base remain a domain error, as sqrt of a negative is: there is no real result. Zero base with a negative exponent likewise.
  • The accuracy harness gains a two-argument function type and measures pow over bases in [0.05, 20] and exponents in [-3, 3]; it joins the README table and the baseline (new row, other rows unchanged).
  • Minor version: the domain widens, nothing existing changes.

A negative base has a real power exactly when the exponent is an
integer, so pow now computes |base|^exponent and applies the sign from
the exponent's parity, read from the raw bits so it holds beyond i32.
Non-integer exponents on a negative base still return the domain error,
as sqrt does for a negative argument.
The accuracy harness sampled one argument per function. A
TestedBinaryFunction variant samples two, pairing each base with an
exponent from elsewhere in the sorted list so the arguments vary
independently. pow is measured over bases in [0.05, 20] and exponents
in [-3, 3], inside I16F16's range, and joins the README table and the
baseline: I16F16 mean 6.90e-4, I32F32 mean 1.09e-8.
@GeEom
GeEom merged commit 0f40dc8 into main Sep 3, 2026
12 checks passed
@GeEom
GeEom deleted the pow_domain branch September 3, 2026 09:23
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 84.61538% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/ops/exponential.rs 84.61% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

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.

2 participants