scurker/currency.js

dollars function on big numbers

Closed this issue · 2 comments

currency('90071992547').dollars();
expected: 90071992547
actual: -122320669

tested on Firefox 71 & Chrome 78

I think the problem in the double telda in the dollar method

let tmp = 90071992547.1234;
console.log(~~tmp); 
// expected: 90071992547, actual: -122320669

console.log( Math.floor(tmp) ); 
// expected: 90071992547, actual: 90071992547