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

Should infinite values be considered equal? #14

Open
harrysarson opened this issue Oct 18, 2017 · 1 comment
Open

Should infinite values be considered equal? #14

harrysarson opened this issue Oct 18, 2017 · 1 comment

Comments

@harrysarson
Copy link
Contributor

harrysarson commented Oct 18, 2017

Currently: new Complex(Infinity).equals(Infinity) === false.

For reference:

In JavaScript: Infinity === Infinity is true
In Matlab both Inf == Inf and (Inf + Inf*i) == (Inf + Inf*i) aretrue
In Wolfram 'Infinity == Infinityistrueand it refuses to answerComplexInfinity == ComplexInfinity`
The c++ standard complex library compares the real and imaginary parts of the number.

@infusion
Copy link
Owner

Comparing re and im is done here as well, but not in a == manner but comparing against a rounding-error ignoring small epsilon. And since Inf-Inf =Inf > eps it is currently false. We could either add a special infinity check here or we keep it like this. I mean it's a philosophical question and totally depends on how you see infinity. When you say there are infinitely many infinites, then the current behavior is right. If you see it as a symbol comparision then we should follow other implementations

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