Skip to content

Conversation

@kunzaatko
Copy link
Contributor

Previously:

julia> f = x -> -exp(ustrip(x)) + 3
#17 (generic function with 1 method)

julia> find_zero(f, (0.0u"nm", Inf*1u"nm"))
ERROR: Roots.ConvergenceFailed("Algorithm failed to converge")
Stacktrace:
 [1] find_zero(f::Function, x0::Tuple{Quantity{Float64, 𝐋, Unitful.FreeUnits{(nm,), 𝐋, nothing}}, Quantity{Float64, 𝐋, Unitful.FreeUnits{(nm,), 𝐋, nothing}}}, M::A42, p′::Nothing; p::Nothing, verbose::Bool, tracks::Roots.NullTracks, kwargs::@Kwargs{})
   @ Roots ~/.julia/packages/Roots/ohGnS/src/find_zero.jl:229
 [2] find_zero (repeats 2 times)
   @ ~/.julia/packages/Roots/ohGnS/src/find_zero.jl:210 [inlined]
 [3] find_zero(f::Function, x0::Tuple{Quantity{Float64, 𝐋, Unitful.FreeUnits{(nm,), 𝐋, nothing}}, Quantity{Float64, 𝐋, Unitful.FreeUnits{(nm,), 𝐋, nothing}}})
   @ Roots ~/.julia/packages/Roots/ohGnS/src/find_zero.jl:243
 [4] top-level scope
   @ REPL[18]:1

julia> f_nounit = x -> -exp(x) + 3
#20 (generic function with 1 method)

julia> find_zero(f_nounit, (0.0, Inf))
1.0986122886681098

Now:

julia> f = x -> -exp(ustrip(x)) + 3
#17 (generic function with 1 method)

julia> find_zero(f, (0.0u"nm", Inf*1u"nm"))
1.0986122886681098 nm

julia> find_zero(x -> f(x * 1u"nm"), (0.0, Inf)) * u"nm"
1.0986122886681098 nm
  • A method for choosing the same default as with dimensionless interval was added for the Quantity interval tuple.
  • A test with the broken method has been added

@codecov
Copy link

codecov bot commented Aug 19, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.78%. Comparing base (3040289) to head (716faa9).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #475      +/-   ##
==========================================
+ Coverage   86.77%   86.78%   +0.01%     
==========================================
  Files          38       39       +1     
  Lines        2540     2543       +3     
==========================================
+ Hits         2204     2207       +3     
  Misses        336      336              

☔ View full report in Codecov by Sentry.
📢 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.

@kunzaatko
Copy link
Contributor Author

Note that Codecov is reporting that the lines are not tested because the extension tests are only performed on julia 1.9 and greater.

@jverzani
Copy link
Member

Thanks so much! Let me merge this; fix the github actions; and then tag.

@jverzani jverzani merged commit 971070c into JuliaMath:master Aug 19, 2025
10 of 14 checks passed
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