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

Boolean expressions that are always true #1

Closed
dominikh opened this issue May 6, 2016 · 3 comments
Closed

Boolean expressions that are always true #1

dominikh opened this issue May 6, 2016 · 3 comments

Comments

@dominikh
Copy link

dominikh commented May 6, 2016

The following boolean expressions will always evaluate to true:

/src/github.com/MJKWoolnough/ics/event.go:237:6: identical expressions on the left and right side of the '==' operator
/src/github.com/MJKWoolnough/ics/event.go:237:44: identical expressions on the left and right side of the '==' operator
/src/github.com/MJKWoolnough/ics/todo.go:237:6: identical expressions on the left and right side of the '==' operator
/src/github.com/MJKWoolnough/ics/todo.go:237:42: identical expressions on the left and right side of the '==' operator
@MJKWoolnough
Copy link
Owner

MJKWoolnough commented May 6, 2016

Those values are floats; the expression is checking for NaN, which you check for by comparing it to itself.

https://play.golang.org/p/Y81EhPCvYL

@dominikh
Copy link
Author

dominikh commented May 6, 2016

My mistake, sorry. Though for clarity I'd recommend using math.IsNaN, as you're already importing the package.

@MJKWoolnough
Copy link
Owner

Changes made.

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

2 participants