Skip to content
New issue

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

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

Already on GitHub? # to your account

Bugfix in Horner's scheme #79

Merged
merged 1 commit into from
Dec 12, 2016
Merged

Bugfix in Horner's scheme #79

merged 1 commit into from
Dec 12, 2016

Conversation

aytekinar
Copy link

Closes #78.

@@ -372,7 +372,7 @@ function polyval{T,S}(p::Poly{T}, x::S)
if lenp == 0
return zero(R) * x
else
y = convert(R, p[end]) + zero(T)*x
y = convert(R, p[end])
Copy link
Member

Choose a reason for hiding this comment

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

I don't understand why zero(T)*x is here. If there is any reason, perhaps changing to zero(T)*zero(x)?

Copy link
Author

Choose a reason for hiding this comment

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

actually, I do not see any benefit in using zero(T)*zero(x). since we have convert(R, p[end]) where R = promote_type(T,S), zero(x) will be automatically promoted to R. For normal numbers, I mean standard Numbers, zero(x) is not needed at all. Then, if there is a custom type Type <: Number, it might make sense to use zero(x) and rely on the conversion rules among Numbers.

What do you think?

Do you think we can push these issues (i.e., Horner's bug, Base./ and perhaps polyder) this weekend?

Copy link
Member

Choose a reason for hiding this comment

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

I feel the same way, but didn't write this so may be missing something. As for time, yes if no one chimes in I'll merge the first two in a few days.

Copy link
Author

Choose a reason for hiding this comment

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

thanks! that'd be great! :)

@jverzani jverzani merged commit b53802d into JuliaMath:master Dec 12, 2016
@jverzani
Copy link
Member

Thanks!

@aytekinar aytekinar deleted the 78-bug-horner branch December 12, 2016 19:47
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants