justmoon / node-bignum

Big integers for Node.js using OpenSSL
420 stars 117 forks source link

.mod(n) returns .abs().mod(n) for negative numbers #106

Open juanelas opened 6 years ago

juanelas commented 6 years ago
const number = bignum(-5);
console.log(number.mod(6).toString()); // Outputs: 5.  Expected: 1
console.log(number.mod(3).toString()); // Outputs: 2.  Expected: 1