1
0
mirror of https://github.com/MikeMcl/decimal.js.git synced 2026-09-23 12:24:47 +00:00
This commit is contained in:
Michael Mclaughlin
2016-01-25 00:11:32 +00:00
parent bc66aa91a5
commit 8a6f8fe412
122 changed files with 33533 additions and 128882 deletions

30
test/modules/sign.js Normal file
View File

@@ -0,0 +1,30 @@
if (typeof T === 'undefined') require('../setup');
(function () {
T('sign');
function t(n, expected) {
T.assertEqual(expected, Decimal.sign(n));
}
t(NaN, NaN);
t('NaN', NaN);
t(Infinity, 1);
t(-Infinity, -1);
t('Infinity', 1);
t('-Infinity', -1);
T.assert(1 / Decimal.sign('0') === Infinity);
T.assert(1 / Decimal.sign(new Decimal('0')) === Infinity);
T.assert(1 / Decimal.sign('-0') === -Infinity);
T.assert(1 / Decimal.sign(new Decimal('-0')) === -Infinity);
t('0', 0);
t('-0', -0);
t('1', 1);
t('-1', -1);
t('9.99', 1);
t('-9.99', -1);
T.stop();
})();