1.0.0 • Published 2 years ago

twexxor-round-off-calculator v1.0.0

Weekly downloads
-
License
-
Repository
github
Last release
2 years ago
npm install twexxor-round-off-calculator
const twexxorRoundOffCalculator = require('twexxor-round-off-calculator');
twexxorRoundOffCalculator('1.4'); // '1'
twexxorRoundOffCalculator('1.5'); // '2'
twexxorRoundOffCalculator('1'); // '1'
twexxorRoundOffCalculator('1.23456789', 3, 'up'); // '1.235'
twexxorRoundOffCalculator('1.23456789', 3, 'up'); // '1.235'
twexxorRoundOffCalculator('1.23456789', 4, 'down'); // '1.2345'
twexxorRoundOffCalculator('1.23456789', 4); // '1.2346'
twexxorRoundOffCalculator('1.23456789'); // '1'
twexxorRoundOffCalculator('1.23456789', 0, 'up'); // '2'
twexxorRoundOffCalculator('1.23456789', 1, 'up'); // '1.3'
twexxorRoundOffCalculator('1.23456789', 7); // '1.2345679'
twexxorRoundOffCalculator('1.23456789', 100); // '1.23456789'
twexxorRoundOffCalculator('-1.23456789', 3, 'up'); // '-1.234'
twexxorRoundOffCalculator('-1.23456789', 3, 'down'); // '-1.235'
twexxorRoundOffCalculator('-0.23456789', 1, 'up'); // '-0.2'
twexxorRoundOffCalculator('-0.23456789', 0, 'down'); // '-1'
twexxorRoundOffCalculator('-0.23456789', 0, 'up'); // '0'
twexxorRoundOffCalculator('-0.23456789', 0); // '0'
twexxorRoundOffCalculator('0.99999', 0); // '1'
twexxorRoundOffCalculator('0.99999', 0, 'down'); // '0'
twexxorRoundOffCalculator('0.99999', 3, 'up'); // '1'
twexxorRoundOffCalculator('0.000000000000000000000000000123456789', 30, 'up'); // '0.000000000000000000000000000124'
twexxorRoundOffCalculator('0.0000000000009999', 14, 'up'); // '0.000000000001'
twexxorRoundOffCalculator('0.0000000000009999', 0, 'up'); // '1'
twexxorRoundOffCalculator('0.0000000000009999', 0, 'up'); // '1'
twexxorRoundOffCalculator('-0.9999', 1, 'down'); // -1
twexxorRoundOffCalculator('-0.9999', 2); // -1