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 in exp exp1m for Complex{Int} #18786

Closed
wants to merge 1 commit into from

Conversation

KristofferC
Copy link
Member

Fixes #18785

@@ -424,7 +424,8 @@ function log2(z::Complex)
a/log(oftype(real(a),2))
end

function exp(z::Complex)
exp(z::Complex) = exp(float(z))
Copy link
Contributor

@yuyichao yuyichao Oct 4, 2016

Choose a reason for hiding this comment

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

Why can't type inference figure this out given isnan(::Int) and isfinite(::Int) are both constants (edit: pure)? I was thinking about doing this a while ago (before we had constant propagation in type inference) but this adds branches (isfinite one in particular) that seems hard for LLVM to eliminate.

@@ -424,7 +424,8 @@ function log2(z::Complex)
a/log(oftype(real(a),2))
end

function exp(z::Complex)
exp(z::Complex) = exp(float(z))
Copy link
Contributor

Choose a reason for hiding this comment

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

Ref #13539 for a better workaround to the same issue.

Copy link
Contributor

Choose a reason for hiding this comment

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

And also the (probably) new preferred way of adding similar test one line above the one you added.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think I missunderstand you but the test above the one I added looks pretty similar to how I did it?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think you need to rebase

@testset "issue #11839" begin

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh yeah, of course. Thanks.

@kshyatt kshyatt added maths Mathematical functions complex Complex numbers labels Oct 4, 2016
@KristofferC
Copy link
Member Author

Subsumed by #18793

@KristofferC KristofferC closed this Oct 5, 2016
@KristofferC KristofferC deleted the kc/type_stab_expm1 branch October 9, 2016 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
complex Complex numbers maths Mathematical functions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants