strint
strint copied to clipboard
Multiply error and errors with "0"
strint.mul ("69226", "90739") gives "6279698014". Should be "6281498014".
strint.mul ("676", "-162252177270612080800354289") gives "-73682471834573766620859493964". Should be "-109682471834933766621039499364".
And several other multiplys fails.
strint.mul ("-5058219","0") gives "-". Should be "0".
strint.mul ("0","0") gives "". Should be "0".
string.add("0","0") gives "". Should be "0". string.sub("0","0") gives "". Should be "0".
strint.div("10","0") makes browser hang. Should return "Division by zero error".
Also strint.mul("2","256"); --> 422 strint.mul("256","2"); --> 512
strint.mul("2","512 "); --> 124 strint.mul("512 ","2"); --> 124
VERY experimental code :\
Yes, this is why the readme starts with “Experimental code – beware”. It is a proof of concept, neither efficient nor bug-free.
Thanks for reporting the bugs, though! I will (eventually) add them to the unit tests.
Here's a whole bunch of examples not working :(
https://jsfiddle.net/8vzo2fgw/7/
I think I may have fixed the weird multiplying results with Pull Request #5. At least the first few examples in the original comment work now.
@calebsander Great work. I've confirmed your branch fixes my failing case: 3844 X 27
Hello, all. :) Just adding one more test case for the forthcoming suite. This one is multiplication error.
console.log(strint.mul(String(14159572), String(63967072))); //905745461613184
console.log(+bigNum(14159572).multiply(63967072)); // 905746361613184
Library big-number is provided for reference.
My branch (see #5) fixes your issue. I don't believe this repository is being maintained any longer.