1
0
mirror of https://github.com/MikeMcl/decimal.js.git synced 2025-06-13 12:54:17 +00:00
MikeMcl_decimal.js/test/modules/toPrimitive.js
2021-10-08 11:23:06 +02:00

24 lines
498 B
JavaScript

if (typeof T === 'undefined') require('../setup');
T('Symbol.toPrimitive', function () {
function D(v) { return new Decimal(v); }
Decimal.config({
precision: 20,
rounding: 4,
toExpNeg: -9e15,
toExpPos: 9e15,
minE: -9e15,
maxE: 9e15
});
T.assert(D('1') < D('2'));
T.assert(D('100') > D('2'));
T.assert(D('-435435.232') < D('2.09802'));
T.assert(D('-1.987234') > D('-2.5473421'));
T.assert(D('10.3') >= D('10.3'));
T.assert(D('10.3') <= D('10.3'));
});