MikeMcl / bignumber.js

A JavaScript library for arbitrary-precision decimal and non-decimal arithmetic
http://mikemcl.github.io/bignumber.js
MIT License
6.63k stars 743 forks source link

wrong calculation result on multipliedBy/times methods #358

Closed niloofaradibi closed 1 year ago

niloofaradibi commented 1 year ago

hi i am trying to use this library for calculation in my javascript app .. i except that result become same as calculator .. i tried many numbers and results is same as i except .. but some numbers are not for example : result in calculator : 6237.5 / 85 = 73.38235294117647 73.38235294117647 * 85 = 6237.5

result with bigNumber.js: 6237.5 / 85 = 73.38235294117646 73.38235294117646 * 85 = 6237.499999999999 ===> why ?????

why in this case result not is same as calculator ?

MikeMcl commented 1 year ago

That last result you give is incorrect and is not what you would get from bignumber.js.

Please check your work carefully and post some code if you want some help.

Also, make sure you understand how the DECIMAL_PLACES setting affects the result of division.