4 ms·
The funny thing is that the example in README shows that this library works incorrectly: EUR: 1.00 GBP: 0.92 const result = cashify.convert(10, {from:
by dchest 7y ago
The funny thing is that the example in README shows that this library works incorrectly:
EUR: 1.00
GBP: 0.92
const result = cashify.convert(10, {from: 'EUR', to: 'GBP'});
console.log(result); //=> 9.200000000000001
The correct result is 9.2. Due to IEEE floating point precision quirk, the library gives 9.200000000000001.
- STRML 7y agoAnd in fact, something called "money.js" - or the successor to money.js - ought to be able to properly round decimals such that floating point error never becomes the developer's concern.