Skip to content

GH-55636: [C++] Fix logb results for zero input - #55666

Open
ViktorBystrov72 wants to merge 1 commit into
apache:mainfrom
ViktorBystrov72:fix/logb-zero-base
Open

ViktorBystrov72 wants to merge 1 commit into
apache:mainfrom
ViktorBystrov72:fix/logb-zero-base

Conversation

@ViktorBystrov72

@ViktorBystrov72 ViktorBystrov72 commented Nov 18, 2026 •

Copy link
Copy Markdown

Rationale for this change

Fixes #55636. logb(0, base) returned negative infinity for bases between zero and one, and for NaN or infinite bases.

What changes are included in this PR?

For zero input, the unchecked kernel returns positive infinity for finite bases between zero and one, negative infinity for finite bases at least one, and NaN for nonpositive or nonfinite bases. The kernel determines these results without evaluating a logarithm at zero.

Are these changes tested?

The new assertions failed on the original C++ kernel for both float and double. After the fix, the scalar math test executable reported 595 passed and 28 skipped. The C++ formatting and lint checks also passed.

Are there any user-facing changes?

The corrected results are visible through the C++ compute function and pyarrow.compute.logb.

Was AI used for this PR?

Codex generated the C++ change, regression test, and PR description and reviewed the patch and test results.

PR code and description written by

  • Human
  • AI

Reviewed before submission by

  • Human
  • AI
  • Not reviewed

@github-actions

Copy link
Copy Markdown

⚠️ GitHub issue #55636 has been automatically assigned in GitHub to PR creator.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Python][C++][Compute] logb(0, base) returns -inf for every base, including 0 < base < 1 and NaN

1 participant