Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve type stable in function expint #466

Merged
merged 4 commits into from
Feb 29, 2024
Merged

Conversation

songjhaha
Copy link
Contributor

@songjhaha songjhaha commented Feb 28, 2024

We found a type unstable code in expint(z::ComplexF64)

before this PR,the return type is unstable:

julia> @code_warntype SpecialFunctions.En_cf_gamma(1, rand(ComplexF64), 1000)
MethodInstance for SpecialFunctions.En_cf_gamma(::Int64, ::ComplexF64, ::Int64)
  from En_cf_gamma::Number, z::Number, n::Int64) @ SpecialFunctions C:\Users\TR\github\SpecialFunctions.jl\src\expint.jl:209
Arguments
  #self#::Core.Const(SpecialFunctions.En_cf_gamma)
  ν::Int64
  z::ComplexF64
  n::Int64
Locals
...
Body::Tuple{ComplexF64, Union{Float64, ComplexF64}, Int64}
...

After this PR:

julia> @code_warntype SpecialFunctions.En_cf_gamma(1, rand(ComplexF64), 1000)
MethodInstance for SpecialFunctions.En_cf_gamma(::Int64, ::ComplexF64, ::Int64)
  from En_cf_gamma::Number, z::Number, n::Int64) @ SpecialFunctions C:\Users\TR\github\SpecialFunctions.jl\src\expint.jl:209
Arguments
  #self#::Core.Const(SpecialFunctions.En_cf_gamma)
  ν::Int64
  z::ComplexF64
  n::Int64
Locals
...
Body::Tuple{ComplexF64, ComplexF64, Int64}
...

Copy link

codecov bot commented Feb 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.44%. Comparing base (fdf95ab) to head (913efcb).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #466      +/-   ##
==========================================
+ Coverage   94.40%   94.44%   +0.03%     
==========================================
  Files          14       14              
  Lines        2914     2914              
==========================================
+ Hits         2751     2752       +1     
+ Misses        163      162       -1     
Flag Coverage Δ
unittests 94.44% <100.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

Copy link
Member

@inkydragon inkydragon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@devmotion devmotion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to add tests for the changes with e.g. @inferred.

src/expint.jl Outdated Show resolved Hide resolved
src/expint.jl Outdated Show resolved Hide resolved
src/expint.jl Outdated Show resolved Hide resolved
src/expint.jl Outdated Show resolved Hide resolved
test/expint.jl Outdated Show resolved Hide resolved
test/expint.jl Outdated Show resolved Hide resolved
@stevengj stevengj merged commit b27f0ad into JuliaMath:master Feb 29, 2024
12 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.

4 participants