Open
Description
I'm expecting the result of the roundUp to be 1.12, but it returns wrongly 1.13.
const Big = require('big.js');
const amountAvailable = 1.12;
const quantityArs = 1197.5384615384617;
const exchangeRate = 1069.2307692307693;
// Big
console.log(Big(amountAvailable).times(exchangeRate).toNumber()); // 1197.5376
console.log(Big(quantityArs).div(exchangeRate).toNumber()); // 1.12
console.log(Big(quantityArs).div(exchangeRate).round(2, Big.roundUp).toNumber()); // 1.13
console.log(Big(1.12).round(2, Big.roundUp).toNumber()); // 1.12
Metadata
Assignees
Labels
No labels
Activity