big.js icon indicating copy to clipboard operation
big.js copied to clipboard

Add params to div, pow, and sqrt

Open martinglova opened this issue 2 years ago • 1 comments

Sometimes it's pretty useful to define rounding mode or decimal places per operation without touching global variable (it's like that in other languages as well, ex. Java's BigDecimal).

  1. I am adding a possibility to change rounding mode or decimal places without touching Big.RM or Big.DP for div, pow, and sqrt operations per single usage. This change is non-breaking, it's just enhancement.
  2. I've also simplified mod operation by using new parameters of the div operation.
  3. I've added tests that prove it works as expected and non of the old tests were touched and are passing as before.

Please let me know your feedback @MikeMcl. Thanks in advance.

martinglova avatar Feb 01 '23 10:02 martinglova

So far I only made changes to .js file. If all is good I'll update .mjs as well.

martinglova avatar Feb 01 '23 12:02 martinglova