Skip to content

feat: add math/base/special/boxcoxinvf - #16359

Open
Harsh28-raj wants to merge 1 commit into
stdlib-js:developfrom
Harsh28-raj:feat/boxcoxinvf
Open

Harsh28-raj wants to merge 1 commit into
stdlib-js:developfrom
Harsh28-raj:feat/boxcoxinvf

Conversation

@Harsh28-raj

Copy link
Copy Markdown

Description

What is the purpose of this pull request?

This pull request:

  • adds @stdlib/math/base/special/boxcoxinvf, a single-precision port of @stdlib/math/base/special/boxcoxinv, with JavaScript and C implementations.

Related Issues

Does this pull request have any related issues?

This pull request has the following related issues:

Reference Packages

Did the content of this pull request follow one or more existing packages? Answering is optional.

This pull request followed these packages:

  • math/base/special/boxcoxinv
  • math/base/special/xlogyf

What carried over from the reference(s)?

  • Package structure, documentation, examples, benchmarks, and test fixtures from boxcoxinv.
  • Single-precision conventions from xlogyf: f32 rounding in JS, float types and f-suffixed literals in C, isnanf, STDLIB_CONSTANT_FLOAT32_NAN, the FF_F N-API macro, float32 benchmark inputs, and reusing the double-precision Python fixtures with isAlmostSameValuef( out, f32( expected ), N ).
  • Applied the review feedback from feat: add math/base/special/boxcoxf #10150 (boxcoxf): single-precision dependencies throughout (expf, log1pf, isnanf) and "for a single-precision floating-point number" in descriptions.

What differed, or what did you have to work out yourself?

  • In JS, the inputs, lambda*y, and log1pf( lambda*y ) / lambda are each rounded to single precision to mirror the C kernel.
  • ULP tolerances are set to the maximum observed difference for each fixture: 3 (medium positive), 2 (medium negative), 2 (small positive), 1 (small negative), 0 (tiny), and 8 (lambda = 0). The lambda = 0 case reduces to expf( y ) for y in [1, 10], so rounding y to single precision alone contributes up to roughly y ULPs relative to the double-precision reference.

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

  • JavaScript tests pass locally (11,275 assertions).
  • I compiled the C kernel together with its dependencies (gcc 16.2, -std=c99 -Wall -Wextra -pedantic, no warnings) and checked it against the JavaScript implementation on all 9,270 fixture inputs plus edge cases: the results are bit-for-bit identical. The C example and C benchmark build and run. I could not build the Node.js addon locally (Windows, no MSVC), so test.native.js relies on CI.

Checklist

Please ensure the following tasks are completed before submitting this pull request.

AI Assistance

When authoring the changes proposed in this PR, did you use any kind of AI assistance?

  • Yes
  • No

If you answered "yes" above, how did you use AI assistance?

  • Code generation (e.g., when writing an implementation or fixing a bug)
  • Test/benchmark generation
  • Documentation (including examples)
  • Research and understanding

Disclosure

If you answered "yes" to using AI assistance, please provide a short disclosure indicating how you used AI assistance. This helps reviewers determine how much scrutiny to apply when reviewing your contribution. Example disclosures: "This PR was written primarily by Claude Code." or "I consulted ChatGPT to understand the codebase, but the proposed changes were fully authored manually by myself.".

This PR was written primarily by Claude Code, by porting boxcoxinv and following the single-precision conventions in xlogyf and the review feedback on #10150. I reviewed the changes and ran the JavaScript tests and the C comparison locally.


@stdlib-js/reviewers

Ref: stdlib-js#649

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Harsh28-raj
Harsh28-raj requested a review from a team October 29, 2026 12:19
@stdlib-bot stdlib-bot added Math Issue or pull request specific to math functionality. Needs Review A pull request which needs code review. First-time Contributor A pull request from a contributor who has never previously committed to the project repository. labels Oct 29, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

First-time Contributor A pull request from a contributor who has never previously committed to the project repository. Math Issue or pull request specific to math functionality. Needs Review A pull request which needs code review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants