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

Integer division by zero #18

Closed
sylvanc opened this issue Sep 2, 2014 · 3 comments
Closed

Integer division by zero #18

sylvanc opened this issue Sep 2, 2014 · 3 comments

Comments

@sylvanc
Copy link
Contributor

sylvanc commented Sep 2, 2014

Given that pony can't crash, how do we handle integer division by zero? Here are the choices:

  1. Raise an error. This means any use of integer division or modulus must come in a try block or in a partial function.
  2. Force the result to zero. So x / 0 or x % 0 results in 0.

I lean towards option 2. Both have the same performance cost (a conditional on the divisor) since catching SIGFPE (or the equivalent on Windows) would be problematic.

@andymcn
Copy link
Contributor

andymcn commented Sep 2, 2014

Definitely don't want to have to put every integer divide in a try block and catching SIGFPE would be terrible. So I think we should go with option 2.

@andymcn
Copy link
Contributor

andymcn commented Sep 11, 2014

I believe this is now implemented and I have recorded the decision on the wiki random information page.

Can we close this now Sylvan?

@sylvanc
Copy link
Contributor Author

sylvanc commented Sep 11, 2014

Yup, thanks! Went with option 2.

@sylvanc sylvanc closed this as completed Sep 11, 2014
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