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

How to treat NaN and Infinity? #30

Closed
sharkdp opened this issue Mar 11, 2017 · 3 comments
Closed

How to treat NaN and Infinity? #30

sharkdp opened this issue Mar 11, 2017 · 3 comments
Labels

Comments

@sharkdp
Copy link
Owner

sharkdp commented Mar 11, 2017

> (1/0)m
Infinitym

> sqrt(-2)m
NaNm

🙁

Options to deal with this:

  • Add DivideByZeroError to EvalError.
@sharkdp sharkdp changed the title Treat NaN and Infinty problems How to treat Treat NaN and Infinty problems Mar 12, 2017
@sharkdp sharkdp changed the title How to treat Treat NaN and Infinty problems How to treat NaN and Infinty? Mar 12, 2017
@paf31
Copy link

paf31 commented Mar 20, 2017

Isn't sqrt(-2)m ill-typed to begin with? There is no unit x such that x^2 = m, right?

Edit: sorry, I parsed it wrong. I see sqrt is being applied only to -2 which is unitless.

@sharkdp
Copy link
Owner Author

sharkdp commented Mar 20, 2017

There is no unit x such that x^2 = m, right?

There is: it is simply x = m^0.5. It's a perfectly fine physical unit. sqrt is different from most other functions (like sin), in that it can be applied to a dimensionful quantity. insect already throws an error if one tries to apply sin to a non-scalar value:

> sin(2m)
Cannot convert quantity of unit 'm' to a scalar

Edit: sorry, I parsed it wrong

no worries 😄

@sharkdp sharkdp changed the title How to treat NaN and Infinty? How to treat NaN and Infinity? Mar 24, 2017
@sharkdp
Copy link
Owner Author

sharkdp commented Mar 24, 2017

Fixed by detecting numerical errors during evaluation.

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

No branches or pull requests

2 participants