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

Fix type instability when h is a float #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

maltezfaria
Copy link

On commit 41dc041, the following code errors on my machine:

@inferred extrapolate(x -> sin(x)/x, 1.0)

while this one works

@inferred extrapolate(x -> sin(x)/x, 1)

I poked around a bit, and it appears that type instability comes from the branch with x0 infinite, but I failed to really understand what was going on (I suspect it had something to do with the recursive call). This PR fixes the issue by factoring out the logic of extrapolate into an _extrapolate function that takes only positional arguments, thus avoiding the recursive call.

Copy link

codecov bot commented Feb 18, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (41dc041) to head (616cfe2).

Additional details and impacted files
@@            Coverage Diff            @@
##            master       #18   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines          101       104    +3     
=========================================
+ Hits           101       104    +3     

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

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