1
0
mirror of https://github.com/MikeMcl/decimal.js.git synced 2024-10-27 20:34:12 +00:00

Adds toNearest tests for numbers to round that are less-than-even

This will test numbers that are less than half the first argument (y) of the toNearest function.
If the y value is ten, the decimal value on which toNearest is tested will be a multiplication of ten plus less than 5.
This commit is contained in:
Lucia Velasco 2018-03-02 21:55:54 +00:00
parent 875f6d0f7a
commit caaba6d513

View File

@ -112,6 +112,16 @@ T('toNearest', function () {
t('83105511539', '83105511539.5', new Decimal('-1'), 3, 5); t('83105511539', '83105511539.5', new Decimal('-1'), 3, 5);
t('83105511540', '83105511539.5000000000000000000001', -1, 3, 5); t('83105511540', '83105511539.5000000000000000000001', -1, 3, 5);
t('83105511540', '83105511539.4', 1, 30, 0);
t('83105511539', '83105511539.4', 1, 30, 1);
t('83105511540', '83105511539.4', 1, 30, 2);
t('83105511539', '83105511539.4', 1, 30, 3);
t('83105511539', '83105511539.4', 1, 30, 4);
t('83105511539', '83105511539.4', 1, 30, 5);
t('83105511539', '83105511539.4', 1, 30, 6);
t('83105511539', '83105511539.4', 1, 30, 7);
t('83105511539', '83105511539.4', 1, 30, 8);
t('83105511540', '83105511539.5', 1, 30, 0); t('83105511540', '83105511539.5', 1, 30, 0);
t('83105511539', '83105511539.5', 1, 30, 1); t('83105511539', '83105511539.5', 1, 30, 1);
t('83105511540', '83105511539.5', 1, 30, 2); t('83105511540', '83105511539.5', 1, 30, 2);