Skip to content

Shift test arguments of logitexp and logit1mexp to their domain - #333

Merged
devmotion merged 1 commit into
masterfrom
dmw/logitexp-domain
Nov 10, 2026
Merged

devmotion merged 1 commit into
masterfrom
dmw/logitexp-domain

Conversation

@devmotion

Copy link
Copy Markdown
Member

LogExpFunctions.logitexp and logit1mexp are only defined for x < 0. JuliaDiff/DiffRules.jl#121 adds DiffRules rules for them. The tests that loop over all rules in DiffRules.diffrules() evaluate them at rand() in (0, 1), and the primal call throws a DomainError (logexpm1 → log of a negative number). This PR shifts their arguments by -1, as for log1mexp and log2mexp.

With DiffRules' current release these functions have no rules, so the change has no effect there. It only matters once DiffRules#121 is released.

I checked the change locally against the DiffRules#121 branch: ForwardDiff's DualTest.jl and ReverseDiff's derivatives/ScalarTests.jl and derivatives/ElementwiseTests.jl all pass.

🤖 Generated with Claude Code

`LogExpFunctions.logitexp` and `logit1mexp` are only defined for `x < 0`.
JuliaDiff/DiffRules.jl#121 adds rules for them, so the tests that loop over
all DiffRules rules evaluate them at `rand()` and throw a `DomainError`.
Treat them like `log1mexp` and `log2mexp`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.77%. Comparing base (fdf1b3d) to head (7e34b70).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #333   +/-   ##
=======================================
  Coverage   94.77%   94.77%           
=======================================
  Files          19       19           
  Lines        1703     1703           
=======================================
  Hits         1614     1614           
  Misses         89       89           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@devmotion
devmotion merged commit 4465ee6 into master Nov 10, 2026
8 of 9 checks passed
@devmotion
devmotion deleted the dmw/logitexp-domain branch November 10, 2026 23:37
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.

1 participant