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

Literal NaNs in ASTs #15718

Closed
Keno opened this issue Mar 31, 2016 · 3 comments
Closed

Literal NaNs in ASTs #15718

Keno opened this issue Mar 31, 2016 · 3 comments
Assignees

Comments

@Keno
Copy link
Member

Keno commented Mar 31, 2016

Perhaps comparing ASTs isn't a very common operation, but I came across the following which I found surprising. I think it is even arguable that == should ignore the facts that NaNs are not numerically equal to themselves since it's not really numerical comparison.

julia> :(f($NaN)) == :(f($NaN))
false

julia> isequal(:(f($NaN)), :(f($NaN)))
false
@JeffBezanson
Copy link
Sponsor Member

It looks like we need an isequal method for Expr that calls isequal recursively.

@wizzard0
Copy link

wizzard0 commented Apr 2, 2016

it is even arguable that == should ignore the facts that NaNs are not numerically equal to themselves since it's not really numerical comparison.

NaN literal is not NaN value, yep

@JeffBezanson
Copy link
Sponsor Member

Very good point. The real solution is probably for == on Exprs to use isequal to compare elements.

@JeffBezanson JeffBezanson self-assigned this Apr 15, 2016
JeffBezanson added a commit that referenced this issue Apr 22, 2016
fix #15718, comparing Exprs containing NaNs
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

No branches or pull requests

3 participants