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

Matching against infinity, neg_infinity and nan #6644

Closed
vicuna opened this issue Nov 4, 2014 · 2 comments
Closed

Matching against infinity, neg_infinity and nan #6644

vicuna opened this issue Nov 4, 2014 · 2 comments

Comments

@vicuna
Copy link

vicuna commented Nov 4, 2014

Original bug ID: 6644
Reporter: bouaziz
Status: resolved (set by @damiendoligez on 2017-03-01T14:09:18Z)
Resolution: won't fix
Priority: normal
Severity: feature
Category: language features

Bug description

Since nan, infinity and neg_infinity are values of Pervasives, there is no way to use them in the lhs of a pattern matching.
One has to use _ = infinity or compare nan _ = 0 or classify_float instead.

@vicuna
Copy link
Author

vicuna commented Dec 22, 2014

Comment author: @damiendoligez

Note that it's generally not a good idea to do pattern-matching on floating-point numbers.

@vicuna
Copy link
Author

vicuna commented Dec 8, 2016

Comment author: @mshinwell

Should we close this issue? I vote yes, for the reason @doligez mentions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant