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

Feature request: remainder #51

Closed
dmarcelino opened this issue May 26, 2015 · 2 comments
Closed

Feature request: remainder #51

dmarcelino opened this issue May 26, 2015 · 2 comments

Comments

@dmarcelino
Copy link

Hi, thanks for creating node-bignum, I've started using it today and I'm already loving it! 😀

I'd like to suggest creating a remainder operation as it can be really useful sometimes. Currently I'm doing the below:

// Big num remainder (not very performant)
function remainder(dividend, divisor, quotient) {
  if(!quotient){
    quotient = dividend.div(divisor);
  }
  return dividend.sub(quotient.mul(divisor));
}

which I don't consider ideal by any means. Let me know what you think about the feature or even about a better existing way to get the remainder. Thanks!

@cscott
Copy link
Contributor

cscott commented Jun 11, 2015

remainder = dividend.mod(divisor);

should do what you want.

@dmarcelino
Copy link
Author

Oh you are right, mod stands for modulo which is the remainder. Thanks!

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