Skip to content

Fix Julia 1.13 DomainError in log1p test grid (followup to #45) - #47

Merged
ChrisRackauckas merged 1 commit into
masterfrom
fix/log1p-test-grid-julia113
May 28, 2026
Merged

Fix Julia 1.13 DomainError in log1p test grid (followup to #45)#47
ChrisRackauckas merged 1 commit into
masterfrom
fix/log1p-test-grid-julia113

Conversation

@ChrisRackauckas

Copy link
Copy Markdown
Member

Summary

A second instance of the same Julia 1.13 Base.:^(::Real, ::Real) → DomainError issue that #45 fixed for the pow test grid. This one is in the log1p test grid at test/accuracy.jl:146:

vcat(0.0001:0.0001:10, 0.0001:0.1:10000, 10.0 .^ -(0:0.02:300), -10.0 .^ -(0:0.02:300))
                                                                 ^^^^^^^^^^^^^^^^^^^^^^^^

The last term parses as (-10.0) .^ (-(0:0.02:300)) — broadcasting (-10.0)^y over a non-integer range. Pre-1.13 each call returned NaN (and countulp(NaN, NaN) == 0 means it contributed nothing to the accuracy test); Julia 1.13 throws DomainError and the test file fails to even load.

This was the remaining failure on JuliaSIMD/VectorizationBase.jl#127's SLEEFPirates.jl/Interface/pre job after #45 + the VB FMA release shipped.

Fix

Wrap as -(10.0 .^ -(0:0.02:300)) so the negation applies to the result (a vector of small positives) rather than the base. Values are bitwise-identical to what pre-1.13 was producing for the valid entries, and the negative-base ^ call is gone.

Test plan

  • Local Julia 1.11 sanity check: old expression and new expression produce identical values element-by-element.
  • Local test/accuracy.jl runs to completion (Float64 testset: 388 pass / 5 broken — same as before, no regression).
  • CI on pre/nightly to confirm the DomainError is gone.

🤖 Generated with Claude Code

`vcat(..., -10.0 .^ -(0:0.02:300))` was parsing as
`(-10.0) .^ (-(0:0.02:300))` — broadcasting `(-10.0)^y` over a
non-integer range. Pre-1.13 each call returned `NaN` (with
`countulp(NaN, NaN) == 0` so the test contributed no information),
but Julia 1.13 changed `Base.:^(::Real, ::Real)` to throw `DomainError`
on a negative base with non-integer exponent. The file then fails to
even load on Julia 1.13+.

Wrap as `-(10.0 .^ -(0:0.02:300))` instead. The resulting values are
identical to what the previous expression produced on pre-1.13 (the
operands `10.0^(-y)` are positive small floats; negating gives the
intended fan of small negatives near 0 for `log1p`'s near-zero
kernel), and avoids the negative-base `^` call entirely.

#45 had the same fix shape for the `pow` test grid; this is the
matching fix for the `log1p` grid that was missed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ChrisRackauckas
ChrisRackauckas merged commit 2ff3ffe into master May 28, 2026
6 of 19 checks passed
@ChrisRackauckas
ChrisRackauckas deleted the fix/log1p-test-grid-julia113 branch May 28, 2026 20:41
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