mirror of
https://github.com/MikeMcl/decimal.js.git
synced 2024-10-27 20:34:12 +00:00
Add immutability tests
This commit is contained in:
parent
a62bb62b6b
commit
c2c4480881
@ -1,291 +1,291 @@
|
||||
if (typeof T === 'undefined') require('../setup');
|
||||
|
||||
(function () {
|
||||
T('Decimal');
|
||||
T('Decimal');
|
||||
|
||||
Decimal.config({
|
||||
precision: 40,
|
||||
rounding: 4,
|
||||
toExpNeg: -9e15,
|
||||
toExpPos: 9e15,
|
||||
maxE: 9e15,
|
||||
minE: -9e15,
|
||||
crypto: false,
|
||||
modulo: 1
|
||||
});
|
||||
Decimal.config({
|
||||
precision: 40,
|
||||
rounding: 4,
|
||||
toExpNeg: -9e15,
|
||||
toExpPos: 9e15,
|
||||
maxE: 9e15,
|
||||
minE: -9e15,
|
||||
crypto: false,
|
||||
modulo: 1
|
||||
});
|
||||
|
||||
var t = function (coefficient, exponent, sign, n) {
|
||||
T.assertDecimal(coefficient, exponent, sign, new Decimal(n));
|
||||
}
|
||||
var t = function (coefficient, exponent, sign, n) {
|
||||
T.assertEqualProps(coefficient, exponent, sign, new Decimal(n));
|
||||
}
|
||||
|
||||
t([0], 0, 1, 0);
|
||||
t([0], 0, -1, -0);
|
||||
t([1], 0, -1, -1);
|
||||
t([10], 1, -1, -10);
|
||||
t([0], 0, 1, 0);
|
||||
t([0], 0, -1, -0);
|
||||
t([1], 0, -1, -1);
|
||||
t([10], 1, -1, -10);
|
||||
|
||||
t([1], 0, 1, 1);
|
||||
t([10], 1, 1, 10);
|
||||
t([100], 2, 1, 100);
|
||||
t([1000], 3, 1, 1000);
|
||||
t([10000], 4, 1, 10000);
|
||||
t([100000], 5, 1, 100000);
|
||||
t([1000000], 6, 1, 1000000);
|
||||
t([1], 0, 1, 1);
|
||||
t([10], 1, 1, 10);
|
||||
t([100], 2, 1, 100);
|
||||
t([1000], 3, 1, 1000);
|
||||
t([10000], 4, 1, 10000);
|
||||
t([100000], 5, 1, 100000);
|
||||
t([1000000], 6, 1, 1000000);
|
||||
|
||||
t([1], 7, 1, 10000000);
|
||||
t([10], 8, 1, 100000000);
|
||||
t([100], 9, 1, 1000000000);
|
||||
t([1000], 10, 1, 10000000000);
|
||||
t([10000], 11, 1, 100000000000);
|
||||
t([100000], 12, 1, 1000000000000);
|
||||
t([1000000], 13, 1, 10000000000000);
|
||||
t([1], 7, 1, 10000000);
|
||||
t([10], 8, 1, 100000000);
|
||||
t([100], 9, 1, 1000000000);
|
||||
t([1000], 10, 1, 10000000000);
|
||||
t([10000], 11, 1, 100000000000);
|
||||
t([100000], 12, 1, 1000000000000);
|
||||
t([1000000], 13, 1, 10000000000000);
|
||||
|
||||
t([1], 14, -1, -100000000000000);
|
||||
t([10], 15, -1, -1000000000000000);
|
||||
t([100], 16, -1, -10000000000000000);
|
||||
t([1000], 17, -1, -100000000000000000);
|
||||
t([10000], 18, -1, -1000000000000000000);
|
||||
t([100000], 19, -1, -10000000000000000000);
|
||||
t([1000000], 20, -1, -100000000000000000000);
|
||||
t([1], 14, -1, -100000000000000);
|
||||
t([10], 15, -1, -1000000000000000);
|
||||
t([100], 16, -1, -10000000000000000);
|
||||
t([1000], 17, -1, -100000000000000000);
|
||||
t([10000], 18, -1, -1000000000000000000);
|
||||
t([100000], 19, -1, -10000000000000000000);
|
||||
t([1000000], 20, -1, -100000000000000000000);
|
||||
|
||||
t([1000000], -1, 1, 1e-1);
|
||||
t([100000], -2, -1, -1e-2);
|
||||
t([10000], -3, 1, 1e-3);
|
||||
t([1000], -4, -1, -1e-4);
|
||||
t([100], -5, 1, 1e-5);
|
||||
t([10], -6, -1, -1e-6);
|
||||
t([1], -7, 1, 1e-7);
|
||||
t([1000000], -1, 1, 1e-1);
|
||||
t([100000], -2, -1, -1e-2);
|
||||
t([10000], -3, 1, 1e-3);
|
||||
t([1000], -4, -1, -1e-4);
|
||||
t([100], -5, 1, 1e-5);
|
||||
t([10], -6, -1, -1e-6);
|
||||
t([1], -7, 1, 1e-7);
|
||||
|
||||
t([1000000], -8, 1, 1e-8);
|
||||
t([100000], -9, -1, -1e-9);
|
||||
t([10000], -10, 1, 1e-10);
|
||||
t([1000], -11, -1, -1e-11);
|
||||
t([100], -12, 1, 1e-12);
|
||||
t([10], -13, -1, -1e-13);
|
||||
t([1], -14, 1, 1e-14);
|
||||
t([1000000], -8, 1, 1e-8);
|
||||
t([100000], -9, -1, -1e-9);
|
||||
t([10000], -10, 1, 1e-10);
|
||||
t([1000], -11, -1, -1e-11);
|
||||
t([100], -12, 1, 1e-12);
|
||||
t([10], -13, -1, -1e-13);
|
||||
t([1], -14, 1, 1e-14);
|
||||
|
||||
t([1000000], -15, 1, 1e-15);
|
||||
t([100000], -16, -1, -1e-16);
|
||||
t([10000], -17, 1, 1e-17);
|
||||
t([1000], -18, -1, -1e-18);
|
||||
t([100], -19, 1, 1e-19);
|
||||
t([10], -20, -1, -1e-20);
|
||||
t([1], -21, 1, 1e-21);
|
||||
t([1000000], -15, 1, 1e-15);
|
||||
t([100000], -16, -1, -1e-16);
|
||||
t([10000], -17, 1, 1e-17);
|
||||
t([1000], -18, -1, -1e-18);
|
||||
t([100], -19, 1, 1e-19);
|
||||
t([10], -20, -1, -1e-20);
|
||||
t([1], -21, 1, 1e-21);
|
||||
|
||||
t([9], 0, 1, '9');
|
||||
t([99], 1, -1, '-99');
|
||||
t([999], 2, 1, '999');
|
||||
t([9999], 3, -1, '-9999');
|
||||
t([99999], 4, 1, '99999');
|
||||
t([999999], 5, -1, '-999999');
|
||||
t([9999999], 6, 1, '9999999');
|
||||
t([9], 0, 1, '9');
|
||||
t([99], 1, -1, '-99');
|
||||
t([999], 2, 1, '999');
|
||||
t([9999], 3, -1, '-9999');
|
||||
t([99999], 4, 1, '99999');
|
||||
t([999999], 5, -1, '-999999');
|
||||
t([9999999], 6, 1, '9999999');
|
||||
|
||||
t([9, 9999999], 7, -1, '-99999999');
|
||||
t([99, 9999999], 8, 1, '999999999');
|
||||
t([999, 9999999], 9, -1, '-9999999999');
|
||||
t([9999, 9999999], 10, 1, '99999999999');
|
||||
t([99999, 9999999], 11, -1, '-999999999999');
|
||||
t([999999, 9999999], 12, 1, '9999999999999');
|
||||
t([9999999, 9999999], 13, -1, '-99999999999999');
|
||||
t([9, 9999999], 7, -1, '-99999999');
|
||||
t([99, 9999999], 8, 1, '999999999');
|
||||
t([999, 9999999], 9, -1, '-9999999999');
|
||||
t([9999, 9999999], 10, 1, '99999999999');
|
||||
t([99999, 9999999], 11, -1, '-999999999999');
|
||||
t([999999, 9999999], 12, 1, '9999999999999');
|
||||
t([9999999, 9999999], 13, -1, '-99999999999999');
|
||||
|
||||
t([9, 9999999, 9999999], 14, 1, '999999999999999');
|
||||
t([99, 9999999, 9999999], 15, -1, '-9999999999999999');
|
||||
t([999, 9999999, 9999999], 16, 1, '99999999999999999');
|
||||
t([9999, 9999999, 9999999], 17, -1, '-999999999999999999');
|
||||
t([99999, 9999999, 9999999], 18, 1, '9999999999999999999');
|
||||
t([999999, 9999999, 9999999], 19, -1, '-99999999999999999999');
|
||||
t([9999999, 9999999, 9999999], 20, 1, '999999999999999999999');
|
||||
t([9, 9999999, 9999999], 14, 1, '999999999999999');
|
||||
t([99, 9999999, 9999999], 15, -1, '-9999999999999999');
|
||||
t([999, 9999999, 9999999], 16, 1, '99999999999999999');
|
||||
t([9999, 9999999, 9999999], 17, -1, '-999999999999999999');
|
||||
t([99999, 9999999, 9999999], 18, 1, '9999999999999999999');
|
||||
t([999999, 9999999, 9999999], 19, -1, '-99999999999999999999');
|
||||
t([9999999, 9999999, 9999999], 20, 1, '999999999999999999999');
|
||||
|
||||
// Test base conversion.
|
||||
// Test base conversion.
|
||||
|
||||
t = function (expected, n) {
|
||||
T.assertEqual(expected, new Decimal(n).valueOf());
|
||||
}
|
||||
t = function (expected, n) {
|
||||
T.assertEqual(expected, new Decimal(n).valueOf());
|
||||
}
|
||||
|
||||
function randInt() {
|
||||
return Math.floor(Math.random() * 0x20000000000000 / Math.pow(10, Math.random() * 16 | 0));
|
||||
}
|
||||
function randInt() {
|
||||
return Math.floor(Math.random() * 0x20000000000000 / Math.pow(10, Math.random() * 16 | 0));
|
||||
}
|
||||
|
||||
// Test random integers against Number.prototype.toString(base).
|
||||
for (var k, i = 0; i < 127; i++) {
|
||||
k = randInt();
|
||||
t(k.toString(), '0b' + k.toString(2));
|
||||
k = randInt();
|
||||
t(k.toString(), '0B' + k.toString(2));
|
||||
k = randInt();
|
||||
t(k.toString(), '0o' + k.toString(8));
|
||||
k = randInt();
|
||||
t(k.toString(), '0O' + k.toString(8));
|
||||
k = randInt();
|
||||
t(k.toString(), '0x' + k.toString(16));
|
||||
k = randInt();
|
||||
t(k.toString(), '0X' + k.toString(16));
|
||||
}
|
||||
// Test random integers against Number.prototype.toString(base).
|
||||
for (var k, i = 0; i < 127; i++) {
|
||||
k = randInt();
|
||||
t(k.toString(), '0b' + k.toString(2));
|
||||
k = randInt();
|
||||
t(k.toString(), '0B' + k.toString(2));
|
||||
k = randInt();
|
||||
t(k.toString(), '0o' + k.toString(8));
|
||||
k = randInt();
|
||||
t(k.toString(), '0O' + k.toString(8));
|
||||
k = randInt();
|
||||
t(k.toString(), '0x' + k.toString(16));
|
||||
k = randInt();
|
||||
t(k.toString(), '0X' + k.toString(16));
|
||||
}
|
||||
|
||||
// Binary.
|
||||
t('0', '0b0');
|
||||
t('0', '0B0');
|
||||
t('-5', '-0b101');
|
||||
t('1.5', '0b1.1');
|
||||
t('-1.5', '-0b1.1');
|
||||
// Binary.
|
||||
t('0', '0b0');
|
||||
t('0', '0B0');
|
||||
t('-5', '-0b101');
|
||||
t('1.5', '0b1.1');
|
||||
t('-1.5', '-0b1.1');
|
||||
|
||||
t('18181', '0b100011100000101.00');
|
||||
t('-12.5', '-0b1100.10');
|
||||
t('343872.5', '0b1010011111101000000.10');
|
||||
t('-328.28125', '-0b101001000.010010');
|
||||
t('-341919.144535064697265625', '-0b1010011011110011111.0010010100000000010');
|
||||
t('97.10482025146484375', '0b1100001.000110101101010110000');
|
||||
t('-120914.40625', '-0b11101100001010010.01101');
|
||||
t('8080777260861123367657', '0b1101101100000111101001111111010001111010111011001010100101001001011101001');
|
||||
t('18181', '0b100011100000101.00');
|
||||
t('-12.5', '-0b1100.10');
|
||||
t('343872.5', '0b1010011111101000000.10');
|
||||
t('-328.28125', '-0b101001000.010010');
|
||||
t('-341919.144535064697265625', '-0b1010011011110011111.0010010100000000010');
|
||||
t('97.10482025146484375', '0b1100001.000110101101010110000');
|
||||
t('-120914.40625', '-0b11101100001010010.01101');
|
||||
t('8080777260861123367657', '0b1101101100000111101001111111010001111010111011001010100101001001011101001');
|
||||
|
||||
// Octal.
|
||||
t('8', '0o10');
|
||||
t('-8.5', '-0O010.4');
|
||||
t('-262144.000000059604644775390625', '-0o1000000.00000001');
|
||||
t('572315667420.390625', '0o10250053005734.31');
|
||||
// Octal.
|
||||
t('8', '0o10');
|
||||
t('-8.5', '-0O010.4');
|
||||
t('-262144.000000059604644775390625', '-0o1000000.00000001');
|
||||
t('572315667420.390625', '0o10250053005734.31');
|
||||
|
||||
// Hex.
|
||||
t('1', '0x00001');
|
||||
t('255', '0xff');
|
||||
t('-15.5', '-0Xf.8');
|
||||
t('-16777216.00000000023283064365386962890625', '-0x1000000.00000001');
|
||||
t('325927753012307620476767402981591827744994693483231017778102969592507', '0xc16de7aa5bf90c3755ef4dea45e982b351b6e00cd25a82dcfe0646abb');
|
||||
// Hex.
|
||||
t('1', '0x00001');
|
||||
t('255', '0xff');
|
||||
t('-15.5', '-0Xf.8');
|
||||
t('-16777216.00000000023283064365386962890625', '-0x1000000.00000001');
|
||||
t('325927753012307620476767402981591827744994693483231017778102969592507', '0xc16de7aa5bf90c3755ef4dea45e982b351b6e00cd25a82dcfe0646abb');
|
||||
|
||||
// Test parsing.
|
||||
// Test parsing.
|
||||
|
||||
var tx = function (fn, msg) {
|
||||
T.assertException(fn, msg);
|
||||
}
|
||||
var tx = function (fn, msg) {
|
||||
T.assertException(fn, msg);
|
||||
}
|
||||
|
||||
t('NaN', NaN);
|
||||
t('NaN', 'NaN');
|
||||
t('NaN', '-NaN');
|
||||
t('NaN', NaN);
|
||||
t('NaN', 'NaN');
|
||||
t('NaN', '-NaN');
|
||||
|
||||
tx(function () {new Decimal(' NaN')}, "' NaN'");
|
||||
tx(function () {new Decimal('NaN ')}, "'NaN '");
|
||||
tx(function () {new Decimal(' NaN ')}, "' NaN '");
|
||||
tx(function () {new Decimal('+NaN')}, "'+NaN'");
|
||||
tx(function () {new Decimal(' +NaN')}, "' +NaN'");
|
||||
tx(function () {new Decimal('.NaN')}, "'.NaN'");
|
||||
tx(function () {new Decimal('NaN.')}, "'NaN.'");
|
||||
tx(function () {new Decimal(' NaN')}, "' NaN'");
|
||||
tx(function () {new Decimal('NaN ')}, "'NaN '");
|
||||
tx(function () {new Decimal(' NaN ')}, "' NaN '");
|
||||
tx(function () {new Decimal('+NaN')}, "'+NaN'");
|
||||
tx(function () {new Decimal(' +NaN')}, "' +NaN'");
|
||||
tx(function () {new Decimal('.NaN')}, "'.NaN'");
|
||||
tx(function () {new Decimal('NaN.')}, "'NaN.'");
|
||||
|
||||
t('Infinity', Infinity);
|
||||
t('-Infinity', -Infinity);
|
||||
t('Infinity', 'Infinity');
|
||||
t('-Infinity', '-Infinity');
|
||||
t('Infinity', Infinity);
|
||||
t('-Infinity', -Infinity);
|
||||
t('Infinity', 'Infinity');
|
||||
t('-Infinity', '-Infinity');
|
||||
|
||||
tx(function () {new Decimal(' Infinity')}, "' Infinity '");
|
||||
tx(function () {new Decimal('Infinity ')}, "'Infinity '");
|
||||
tx(function () {new Decimal(' Infinity ')}, "' Infinity '");
|
||||
tx(function () {new Decimal('+Infinity')}, "'+Infinity'");
|
||||
tx(function () {new Decimal(' +Infinity')}, "' +Infinity'");
|
||||
tx(function () {new Decimal('.Infinity')}, "'.Infinity'");
|
||||
tx(function () {new Decimal('Infinity.')}, "'Infinity.'");
|
||||
tx(function () {new Decimal(' Infinity')}, "' Infinity '");
|
||||
tx(function () {new Decimal('Infinity ')}, "'Infinity '");
|
||||
tx(function () {new Decimal(' Infinity ')}, "' Infinity '");
|
||||
tx(function () {new Decimal('+Infinity')}, "'+Infinity'");
|
||||
tx(function () {new Decimal(' +Infinity')}, "' +Infinity'");
|
||||
tx(function () {new Decimal('.Infinity')}, "'.Infinity'");
|
||||
tx(function () {new Decimal('Infinity.')}, "'Infinity.'");
|
||||
|
||||
t('0', 0);
|
||||
t('-0', -0);
|
||||
t('0', '0');
|
||||
t('-0', '-0');
|
||||
t('0', '0.');
|
||||
t('-0', '-0.');
|
||||
t('0', '0.0');
|
||||
t('-0', '-0.0');
|
||||
t('0', '0.00000000');
|
||||
t('-0', '-0.0000000000000000000000');
|
||||
t('0', 0);
|
||||
t('-0', -0);
|
||||
t('0', '0');
|
||||
t('-0', '-0');
|
||||
t('0', '0.');
|
||||
t('-0', '-0.');
|
||||
t('0', '0.0');
|
||||
t('-0', '-0.0');
|
||||
t('0', '0.00000000');
|
||||
t('-0', '-0.0000000000000000000000');
|
||||
|
||||
tx(function () {new Decimal(' 0')}, "' 0'");
|
||||
tx(function () {new Decimal('0 ')}, "'0 '");
|
||||
tx(function () {new Decimal(' 0 ')}, "' 0 '");
|
||||
tx(function () {new Decimal('0-')}, "'0-'");
|
||||
tx(function () {new Decimal(' -0')}, "' -0'");
|
||||
tx(function () {new Decimal('-0 ')}, "'-0 '");
|
||||
tx(function () {new Decimal('+0')}, "'+0'");
|
||||
tx(function () {new Decimal(' +0')}, "' +0'");
|
||||
tx(function () {new Decimal(' .0')}, "' .0'");
|
||||
tx(function () {new Decimal('0. ')}, "'0. '");
|
||||
tx(function () {new Decimal('+-0')}, "'+-0'");
|
||||
tx(function () {new Decimal('-+0')}, "'-+0'");
|
||||
tx(function () {new Decimal('--0')}, "'--0'");
|
||||
tx(function () {new Decimal('++0')}, "'++0'");
|
||||
tx(function () {new Decimal('.-0')}, "'.-0'");
|
||||
tx(function () {new Decimal('.+0')}, "'.+0'");
|
||||
tx(function () {new Decimal('0 .')}, "'0 .'");
|
||||
tx(function () {new Decimal('. 0')}, "'. 0'");
|
||||
tx(function () {new Decimal('..0')}, "'..0'");
|
||||
tx(function () {new Decimal('+.-0')}, "'+.-0'");
|
||||
tx(function () {new Decimal('-.+0')}, "'-.+0'");
|
||||
tx(function () {new Decimal('+. 0')}, "'+. 0'");
|
||||
tx(function () {new Decimal('.0.')}, "'.0.'");
|
||||
tx(function () {new Decimal(' 0')}, "' 0'");
|
||||
tx(function () {new Decimal('0 ')}, "'0 '");
|
||||
tx(function () {new Decimal(' 0 ')}, "' 0 '");
|
||||
tx(function () {new Decimal('0-')}, "'0-'");
|
||||
tx(function () {new Decimal(' -0')}, "' -0'");
|
||||
tx(function () {new Decimal('-0 ')}, "'-0 '");
|
||||
tx(function () {new Decimal('+0')}, "'+0'");
|
||||
tx(function () {new Decimal(' +0')}, "' +0'");
|
||||
tx(function () {new Decimal(' .0')}, "' .0'");
|
||||
tx(function () {new Decimal('0. ')}, "'0. '");
|
||||
tx(function () {new Decimal('+-0')}, "'+-0'");
|
||||
tx(function () {new Decimal('-+0')}, "'-+0'");
|
||||
tx(function () {new Decimal('--0')}, "'--0'");
|
||||
tx(function () {new Decimal('++0')}, "'++0'");
|
||||
tx(function () {new Decimal('.-0')}, "'.-0'");
|
||||
tx(function () {new Decimal('.+0')}, "'.+0'");
|
||||
tx(function () {new Decimal('0 .')}, "'0 .'");
|
||||
tx(function () {new Decimal('. 0')}, "'. 0'");
|
||||
tx(function () {new Decimal('..0')}, "'..0'");
|
||||
tx(function () {new Decimal('+.-0')}, "'+.-0'");
|
||||
tx(function () {new Decimal('-.+0')}, "'-.+0'");
|
||||
tx(function () {new Decimal('+. 0')}, "'+. 0'");
|
||||
tx(function () {new Decimal('.0.')}, "'.0.'");
|
||||
|
||||
t('1', 1);
|
||||
t('-1', -1);
|
||||
t('1', '1');
|
||||
t('-1', '-1');
|
||||
t('0.1', '.1');
|
||||
t('0.1', '.1');
|
||||
t('-0.1', '-.1');
|
||||
t('1', '1.');
|
||||
t('1', '1.0');
|
||||
t('-1', '-1.');
|
||||
t('-1', '-1.0000');
|
||||
t('1', '1.00000000');
|
||||
t('-1', '-1.000000000000000000000000');
|
||||
t('1', 1);
|
||||
t('-1', -1);
|
||||
t('1', '1');
|
||||
t('-1', '-1');
|
||||
t('0.1', '.1');
|
||||
t('0.1', '.1');
|
||||
t('-0.1', '-.1');
|
||||
t('1', '1.');
|
||||
t('1', '1.0');
|
||||
t('-1', '-1.');
|
||||
t('-1', '-1.0000');
|
||||
t('1', '1.00000000');
|
||||
t('-1', '-1.000000000000000000000000');
|
||||
|
||||
tx(function () {new Decimal(' 1')}, "' 1'");
|
||||
tx(function () {new Decimal('1 ')}, "'1 '");
|
||||
tx(function () {new Decimal(' 1 ')}, "' 1 '");
|
||||
tx(function () {new Decimal('1-')}, "'1-'");
|
||||
tx(function () {new Decimal(' -1')}, "' -1'");
|
||||
tx(function () {new Decimal('-1 ')}, "'-1 '");
|
||||
tx(function () {new Decimal('+1')}, "'+1'");
|
||||
tx(function () {new Decimal(' +1')}, "' +1'");
|
||||
tx(function () {new Decimal('.1.')}, "'.1.'");
|
||||
tx(function () {new Decimal('+-1')}, "'+-1'");
|
||||
tx(function () {new Decimal('-+1')}, "'-+1'");
|
||||
tx(function () {new Decimal('--1')}, "'--1'");
|
||||
tx(function () {new Decimal('++1')}, "'++1'");
|
||||
tx(function () {new Decimal('.-1')}, "'.-1'");
|
||||
tx(function () {new Decimal('.+1')}, "'.+1'");
|
||||
tx(function () {new Decimal('1 .')}, "'1 .'");
|
||||
tx(function () {new Decimal('. 1')}, "'. 1'");
|
||||
tx(function () {new Decimal('..1')}, "'..1'");
|
||||
tx(function () {new Decimal('+.-1')}, "'+.-1'");
|
||||
tx(function () {new Decimal('-.+1')}, "'-.+1'");
|
||||
tx(function () {new Decimal('+. 1')}, "'+. 1'");
|
||||
tx(function () {new Decimal('-. 1')}, "'-. 1'");
|
||||
tx(function () {new Decimal('1..')}, "'1..'");
|
||||
tx(function () {new Decimal('+1..')}, "'+1..'");
|
||||
tx(function () {new Decimal('-1..')}, "'-1..'");
|
||||
tx(function () {new Decimal('-.1.')}, "'-.1.'");
|
||||
tx(function () {new Decimal('+.1.')}, "'+.1.'");
|
||||
tx(function () {new Decimal('.-10.')}, "'.-10.'");
|
||||
tx(function () {new Decimal('.+10.')}, "'.+10.'");
|
||||
tx(function () {new Decimal('. 10.')}, "'. 10.'");
|
||||
tx(function () {new Decimal(' 1')}, "' 1'");
|
||||
tx(function () {new Decimal('1 ')}, "'1 '");
|
||||
tx(function () {new Decimal(' 1 ')}, "' 1 '");
|
||||
tx(function () {new Decimal('1-')}, "'1-'");
|
||||
tx(function () {new Decimal(' -1')}, "' -1'");
|
||||
tx(function () {new Decimal('-1 ')}, "'-1 '");
|
||||
tx(function () {new Decimal('+1')}, "'+1'");
|
||||
tx(function () {new Decimal(' +1')}, "' +1'");
|
||||
tx(function () {new Decimal('.1.')}, "'.1.'");
|
||||
tx(function () {new Decimal('+-1')}, "'+-1'");
|
||||
tx(function () {new Decimal('-+1')}, "'-+1'");
|
||||
tx(function () {new Decimal('--1')}, "'--1'");
|
||||
tx(function () {new Decimal('++1')}, "'++1'");
|
||||
tx(function () {new Decimal('.-1')}, "'.-1'");
|
||||
tx(function () {new Decimal('.+1')}, "'.+1'");
|
||||
tx(function () {new Decimal('1 .')}, "'1 .'");
|
||||
tx(function () {new Decimal('. 1')}, "'. 1'");
|
||||
tx(function () {new Decimal('..1')}, "'..1'");
|
||||
tx(function () {new Decimal('+.-1')}, "'+.-1'");
|
||||
tx(function () {new Decimal('-.+1')}, "'-.+1'");
|
||||
tx(function () {new Decimal('+. 1')}, "'+. 1'");
|
||||
tx(function () {new Decimal('-. 1')}, "'-. 1'");
|
||||
tx(function () {new Decimal('1..')}, "'1..'");
|
||||
tx(function () {new Decimal('+1..')}, "'+1..'");
|
||||
tx(function () {new Decimal('-1..')}, "'-1..'");
|
||||
tx(function () {new Decimal('-.1.')}, "'-.1.'");
|
||||
tx(function () {new Decimal('+.1.')}, "'+.1.'");
|
||||
tx(function () {new Decimal('.-10.')}, "'.-10.'");
|
||||
tx(function () {new Decimal('.+10.')}, "'.+10.'");
|
||||
tx(function () {new Decimal('. 10.')}, "'. 10.'");
|
||||
|
||||
t('123.456789', 123.456789);
|
||||
t('-123.456789', -123.456789);
|
||||
t('123.456789', '123.456789');
|
||||
t('-123.456789', '-123.456789');
|
||||
t('123.456789', 123.456789);
|
||||
t('-123.456789', -123.456789);
|
||||
t('123.456789', '123.456789');
|
||||
t('-123.456789', '-123.456789');
|
||||
|
||||
tx(function () {new Decimal(void 0)}, "void 0");
|
||||
tx(function () {new Decimal('undefined')}, "'undefined'");
|
||||
tx(function () {new Decimal(null)}, "null");
|
||||
tx(function () {new Decimal('null')}, "'null'");
|
||||
tx(function () {new Decimal({})}, "{}");
|
||||
tx(function () {new Decimal([])}, "[]");
|
||||
tx(function () {new Decimal(function () {})}, "function () {}");
|
||||
tx(function () {new Decimal(new Date)}, "new Date");
|
||||
tx(function () {new Decimal(new RegExp)}, "new RegExp");
|
||||
tx(function () {new Decimal('')}, "''");
|
||||
tx(function () {new Decimal(' ')}, "' '");
|
||||
tx(function () {new Decimal('nan')}, "'nan'");
|
||||
tx(function () {new Decimal('23e')}, "'23e'");
|
||||
tx(function () {new Decimal('e4')}, "'e4'");
|
||||
tx(function () {new Decimal('ff')}, "'ff'");
|
||||
tx(function () {new Decimal('0xg')}, "'oxg'");
|
||||
tx(function () {new Decimal('0Xfi')}, "'0Xfi'");
|
||||
tx(function () {new Decimal('--45')}, "'--45'");
|
||||
tx(function () {new Decimal('9.99--')}, "'9.99--'");
|
||||
tx(function () {new Decimal('0 0')}, "'0 0'");
|
||||
tx(function () {new Decimal(void 0)}, "void 0");
|
||||
tx(function () {new Decimal('undefined')}, "'undefined'");
|
||||
tx(function () {new Decimal(null)}, "null");
|
||||
tx(function () {new Decimal('null')}, "'null'");
|
||||
tx(function () {new Decimal({})}, "{}");
|
||||
tx(function () {new Decimal([])}, "[]");
|
||||
tx(function () {new Decimal(function () {})}, "function () {}");
|
||||
tx(function () {new Decimal(new Date)}, "new Date");
|
||||
tx(function () {new Decimal(new RegExp)}, "new RegExp");
|
||||
tx(function () {new Decimal('')}, "''");
|
||||
tx(function () {new Decimal(' ')}, "' '");
|
||||
tx(function () {new Decimal('nan')}, "'nan'");
|
||||
tx(function () {new Decimal('23e')}, "'23e'");
|
||||
tx(function () {new Decimal('e4')}, "'e4'");
|
||||
tx(function () {new Decimal('ff')}, "'ff'");
|
||||
tx(function () {new Decimal('0xg')}, "'oxg'");
|
||||
tx(function () {new Decimal('0Xfi')}, "'0Xfi'");
|
||||
tx(function () {new Decimal('--45')}, "'--45'");
|
||||
tx(function () {new Decimal('9.99--')}, "'9.99--'");
|
||||
tx(function () {new Decimal('0 0')}, "'0 0'");
|
||||
|
||||
T.stop();
|
||||
T.stop();
|
||||
})();
|
||||
|
@ -1,130 +1,128 @@
|
||||
if (typeof T === 'undefined') require('../setup');
|
||||
|
||||
(function () {
|
||||
T('absoluteValue');
|
||||
T('absoluteValue');
|
||||
|
||||
function t(expected, value){
|
||||
var x = new Decimal(value);
|
||||
T.assertEqual(expected, x.abs().valueOf());
|
||||
T.assert(x.eq(value) || x.isNaN());
|
||||
}
|
||||
function t(expected, value){
|
||||
T.assertEqual(expected, new Decimal(value).abs().valueOf());
|
||||
}
|
||||
|
||||
Decimal.config({
|
||||
precision: 20,
|
||||
rounding: 4,
|
||||
toExpNeg: -7,
|
||||
toExpPos: 21,
|
||||
minE: -9e15,
|
||||
maxE: 9e15
|
||||
});
|
||||
Decimal.config({
|
||||
precision: 20,
|
||||
rounding: 4,
|
||||
toExpNeg: -7,
|
||||
toExpPos: 21,
|
||||
minE: -9e15,
|
||||
maxE: 9e15
|
||||
});
|
||||
|
||||
t('0', 0);
|
||||
t('0', '0');
|
||||
t('0', -0);
|
||||
t('0', '-0');
|
||||
t('1', 1);
|
||||
t('1', -1);
|
||||
t('1', '-1');
|
||||
t('0.5', '0.5');
|
||||
t('0.5', '-0.5');
|
||||
t('0.1', 0.1);
|
||||
t('0.1', -0.1);
|
||||
t('1.1', 1.1);
|
||||
t('1.1', -1.1);
|
||||
t('1.5', '1.5');
|
||||
t('1.5', '-1.5');
|
||||
t('0', 0);
|
||||
t('0', '0');
|
||||
t('0', -0);
|
||||
t('0', '-0');
|
||||
t('1', 1);
|
||||
t('1', -1);
|
||||
t('1', '-1');
|
||||
t('0.5', '0.5');
|
||||
t('0.5', '-0.5');
|
||||
t('0.1', 0.1);
|
||||
t('0.1', -0.1);
|
||||
t('1.1', 1.1);
|
||||
t('1.1', -1.1);
|
||||
t('1.5', '1.5');
|
||||
t('1.5', '-1.5');
|
||||
|
||||
t('0.00001', '-1e-5');
|
||||
t('9000000000', '-9e9');
|
||||
t('123456.7891011', '123456.7891011');
|
||||
t('123456.7891011', -123456.7891011);
|
||||
t('99', '99');
|
||||
t('99', -99);
|
||||
t('999.999', 999.999);
|
||||
t('999.999', '-999.999');
|
||||
t('1', new Decimal(-1));
|
||||
t('1', new Decimal('-1'));
|
||||
t('0.001', new Decimal(0.001));
|
||||
t('0.001', new Decimal('-0.001'));
|
||||
t('0.00001', '-1e-5');
|
||||
t('9000000000', '-9e9');
|
||||
t('123456.7891011', '123456.7891011');
|
||||
t('123456.7891011', -123456.7891011);
|
||||
t('99', '99');
|
||||
t('99', -99);
|
||||
t('999.999', 999.999);
|
||||
t('999.999', '-999.999');
|
||||
t('1', new Decimal(-1));
|
||||
t('1', new Decimal('-1'));
|
||||
t('0.001', new Decimal(0.001));
|
||||
t('0.001', new Decimal('-0.001'));
|
||||
|
||||
t('Infinity', Infinity);
|
||||
t('Infinity', -Infinity);
|
||||
t('Infinity', 'Infinity');
|
||||
t('Infinity', '-Infinity');
|
||||
t('NaN', NaN);
|
||||
t('NaN', -NaN);
|
||||
t('NaN', 'NaN');
|
||||
t('NaN', '-NaN');
|
||||
t('Infinity', Infinity);
|
||||
t('Infinity', -Infinity);
|
||||
t('Infinity', 'Infinity');
|
||||
t('Infinity', '-Infinity');
|
||||
t('NaN', NaN);
|
||||
t('NaN', -NaN);
|
||||
t('NaN', 'NaN');
|
||||
t('NaN', '-NaN');
|
||||
|
||||
t('11.121', '11.121');
|
||||
t('0.023842', '-0.023842');
|
||||
t('1.19', '-1.19');
|
||||
t('9.622e-11', '-0.00000000009622');
|
||||
t('5.09e-10', '-0.000000000509');
|
||||
t('3838.2', '3838.2');
|
||||
t('127', '127.0');
|
||||
t('4.23073', '4.23073');
|
||||
t('2.5469', '-2.5469');
|
||||
t('29949', '-29949');
|
||||
t('277.1', '-277.10');
|
||||
t('4.97898e-15', '-0.00000000000000497898');
|
||||
t('53.456', '53.456');
|
||||
t('100564', '-100564');
|
||||
t('12431.9', '-12431.9');
|
||||
t('97633.7', '-97633.7');
|
||||
t('220', '220');
|
||||
t('18.72', '18.720');
|
||||
t('2817', '-2817');
|
||||
t('44535', '-44535');
|
||||
t('11.121', '11.121');
|
||||
t('0.023842', '-0.023842');
|
||||
t('1.19', '-1.19');
|
||||
t('9.622e-11', '-0.00000000009622');
|
||||
t('5.09e-10', '-0.000000000509');
|
||||
t('3838.2', '3838.2');
|
||||
t('127', '127.0');
|
||||
t('4.23073', '4.23073');
|
||||
t('2.5469', '-2.5469');
|
||||
t('29949', '-29949');
|
||||
t('277.1', '-277.10');
|
||||
t('4.97898e-15', '-0.00000000000000497898');
|
||||
t('53.456', '53.456');
|
||||
t('100564', '-100564');
|
||||
t('12431.9', '-12431.9');
|
||||
t('97633.7', '-97633.7');
|
||||
t('220', '220');
|
||||
t('18.72', '18.720');
|
||||
t('2817', '-2817');
|
||||
t('44535', '-44535');
|
||||
|
||||
Decimal.toExpNeg = Decimal.toExpPos = 0;
|
||||
Decimal.toExpNeg = Decimal.toExpPos = 0;
|
||||
|
||||
t('5.2452468128e+1', '-5.2452468128e+1');
|
||||
t('1.41525905257189365008396e+16', '1.41525905257189365008396e+16');
|
||||
t('2.743068083928e+11', '2.743068083928e+11');
|
||||
t('1.52993064722314247378724599e+26', '-1.52993064722314247378724599e+26');
|
||||
t('3.7205576746e+10', '3.7205576746e+10');
|
||||
t('2.663e-10', '-2.663e-10');
|
||||
t('1.26574209965030360615518e+17', '-1.26574209965030360615518e+17');
|
||||
t('1.052e+3', '1.052e+3');
|
||||
t('4.452945872502e+6', '-4.452945872502e+6');
|
||||
t('2.95732460816619226e+13', '2.95732460816619226e+13');
|
||||
t('1.1923100194288654481424e+18', '-1.1923100194288654481424e+18');
|
||||
t('8.99315449050893705e+6', '8.99315449050893705e+6');
|
||||
t('5.200726538434486963e+8', '5.200726538434486963e+8');
|
||||
t('1.182618278949368566264898065e+18', '1.182618278949368566264898065e+18');
|
||||
t('3.815873266712e-20', '-3.815873266712e-20');
|
||||
t('1.316675370382742615e+6', '-1.316675370382742615e+6');
|
||||
t('2.1032502e+6', '-2.1032502e+6');
|
||||
t('1.8e+1', '1.8e+1');
|
||||
t('1.033525906631680944018544811261e-13', '1.033525906631680944018544811261e-13');
|
||||
t('1.102361746443461856816e+14', '-1.102361746443461856816e+14');
|
||||
t('8.595358491143959e+1', '8.595358491143959e+1');
|
||||
t('1.226806049797304683867e-18', '1.226806049797304683867e-18');
|
||||
t('5e+0', '-5e+0');
|
||||
t('1.091168788407093537887970016e+15', '-1.091168788407093537887970016e+15');
|
||||
t('3.87166413612272027e+12', '3.87166413612272027e+12');
|
||||
t('1.411514e+5', '1.411514e+5');
|
||||
t('1.0053454672509859631996e+22', '1.0053454672509859631996e+22');
|
||||
t('6.9265714e+0', '6.9265714e+0');
|
||||
t('1.04627709e+4', '1.04627709e+4');
|
||||
t('2.285650225267766689304972e+5', '2.285650225267766689304972e+5');
|
||||
t('4.5790517211306242e+7', '4.5790517211306242e+7');
|
||||
t('3.0033340092338313923473428e+16', '-3.0033340092338313923473428e+16');
|
||||
t('2.83879929283797623e+1', '-2.83879929283797623e+1');
|
||||
t('4.5266377717178121183759377414e-5', '4.5266377717178121183759377414e-5');
|
||||
t('5.3781e+4', '-5.3781e+4');
|
||||
t('6.722035208213298413522819127e-18', '-6.722035208213298413522819127e-18');
|
||||
t('3.02865707828281230987116e+23', '-3.02865707828281230987116e+23');
|
||||
t('5.2452468128e+1', '-5.2452468128e+1');
|
||||
t('1.41525905257189365008396e+16', '1.41525905257189365008396e+16');
|
||||
t('2.743068083928e+11', '2.743068083928e+11');
|
||||
t('1.52993064722314247378724599e+26', '-1.52993064722314247378724599e+26');
|
||||
t('3.7205576746e+10', '3.7205576746e+10');
|
||||
t('2.663e-10', '-2.663e-10');
|
||||
t('1.26574209965030360615518e+17', '-1.26574209965030360615518e+17');
|
||||
t('1.052e+3', '1.052e+3');
|
||||
t('4.452945872502e+6', '-4.452945872502e+6');
|
||||
t('2.95732460816619226e+13', '2.95732460816619226e+13');
|
||||
t('1.1923100194288654481424e+18', '-1.1923100194288654481424e+18');
|
||||
t('8.99315449050893705e+6', '8.99315449050893705e+6');
|
||||
t('5.200726538434486963e+8', '5.200726538434486963e+8');
|
||||
t('1.182618278949368566264898065e+18', '1.182618278949368566264898065e+18');
|
||||
t('3.815873266712e-20', '-3.815873266712e-20');
|
||||
t('1.316675370382742615e+6', '-1.316675370382742615e+6');
|
||||
t('2.1032502e+6', '-2.1032502e+6');
|
||||
t('1.8e+1', '1.8e+1');
|
||||
t('1.033525906631680944018544811261e-13', '1.033525906631680944018544811261e-13');
|
||||
t('1.102361746443461856816e+14', '-1.102361746443461856816e+14');
|
||||
t('8.595358491143959e+1', '8.595358491143959e+1');
|
||||
t('1.226806049797304683867e-18', '1.226806049797304683867e-18');
|
||||
t('5e+0', '-5e+0');
|
||||
t('1.091168788407093537887970016e+15', '-1.091168788407093537887970016e+15');
|
||||
t('3.87166413612272027e+12', '3.87166413612272027e+12');
|
||||
t('1.411514e+5', '1.411514e+5');
|
||||
t('1.0053454672509859631996e+22', '1.0053454672509859631996e+22');
|
||||
t('6.9265714e+0', '6.9265714e+0');
|
||||
t('1.04627709e+4', '1.04627709e+4');
|
||||
t('2.285650225267766689304972e+5', '2.285650225267766689304972e+5');
|
||||
t('4.5790517211306242e+7', '4.5790517211306242e+7');
|
||||
t('3.0033340092338313923473428e+16', '-3.0033340092338313923473428e+16');
|
||||
t('2.83879929283797623e+1', '-2.83879929283797623e+1');
|
||||
t('4.5266377717178121183759377414e-5', '4.5266377717178121183759377414e-5');
|
||||
t('5.3781e+4', '-5.3781e+4');
|
||||
t('6.722035208213298413522819127e-18', '-6.722035208213298413522819127e-18');
|
||||
t('3.02865707828281230987116e+23', '-3.02865707828281230987116e+23');
|
||||
|
||||
t('1e-9000000000000000', '1e-9000000000000000');
|
||||
t('1e-9000000000000000', '-1e-9000000000000000');
|
||||
t('0e+0', '-9.9e-9000000000000001');
|
||||
t('9.999999e+9000000000000000', '9.999999e+9000000000000000');
|
||||
t('9.999999e+9000000000000000', '-9.999999e+9000000000000000');
|
||||
t('Infinity', '1E9000000000000001');
|
||||
t('Infinity', '-1e+9000000000000001');
|
||||
t('5.5879983320336874473209567979e+287894365', '-5.5879983320336874473209567979e+287894365');
|
||||
t('1e-9000000000000000', '1e-9000000000000000');
|
||||
t('1e-9000000000000000', '-1e-9000000000000000');
|
||||
t('0e+0', '-9.9e-9000000000000001');
|
||||
t('9.999999e+9000000000000000', '9.999999e+9000000000000000');
|
||||
t('9.999999e+9000000000000000', '-9.999999e+9000000000000000');
|
||||
t('Infinity', '1E9000000000000001');
|
||||
t('Infinity', '-1e+9000000000000001');
|
||||
t('5.5879983320336874473209567979e+287894365', '-5.5879983320336874473209567979e+287894365');
|
||||
|
||||
T.stop();
|
||||
T.stop();
|
||||
})();
|
||||
|
1993
test/modules/acos.js
1993
test/modules/acos.js
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
2035
test/modules/asin.js
2035
test/modules/asin.js
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
2035
test/modules/atan.js
2035
test/modules/atan.js
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
2015
test/modules/cbrt.js
2015
test/modules/cbrt.js
File diff suppressed because it is too large
Load Diff
@ -1,75 +1,74 @@
|
||||
if (typeof T === 'undefined') require('../setup');
|
||||
|
||||
(function () {
|
||||
T('ceil');
|
||||
T('ceil');
|
||||
|
||||
function t(expected, n) {
|
||||
T.assertEqual(expected, Decimal.ceil(n).valueOf());
|
||||
T.assertEqual(expected, new Decimal(n).ceil().valueOf());
|
||||
}
|
||||
function t(expected, n) {
|
||||
T.assertEqual(expected, new Decimal(n).ceil().valueOf());
|
||||
}
|
||||
|
||||
Decimal.config({
|
||||
precision: 20,
|
||||
rounding: 4,
|
||||
toExpNeg: -100,
|
||||
toExpPos: 100,
|
||||
minE: -9e15,
|
||||
maxE: 9e15
|
||||
});
|
||||
Decimal.config({
|
||||
precision: 20,
|
||||
rounding: 4,
|
||||
toExpNeg: -100,
|
||||
toExpPos: 100,
|
||||
minE: -9e15,
|
||||
maxE: 9e15
|
||||
});
|
||||
|
||||
t('0', 0);
|
||||
t('-0', -0);
|
||||
t('Infinity', Infinity);
|
||||
t('-Infinity', -Infinity);
|
||||
t('NaN', NaN);
|
||||
t('0', 0);
|
||||
t('-0', -0);
|
||||
t('Infinity', Infinity);
|
||||
t('-Infinity', -Infinity);
|
||||
t('NaN', NaN);
|
||||
|
||||
t('1', 0.1);
|
||||
t('1', '0.4999999999999999');
|
||||
t('1', 0.5);
|
||||
t('1', 0.7);
|
||||
t('-0', -0.1);
|
||||
t('-0', '-0.4999999999999999');
|
||||
t('-0', -0.5);
|
||||
t('-0', -0.7);
|
||||
t('1', 1);
|
||||
t('2', 1.1);
|
||||
t('2', 1.5);
|
||||
t('2', 1.7);
|
||||
t('-1', -1);
|
||||
t('-1', -1.1);
|
||||
t('-1', -1.5);
|
||||
t('-1', -1.7);
|
||||
t('1', 0.1);
|
||||
t('1', '0.4999999999999999');
|
||||
t('1', 0.5);
|
||||
t('1', 0.7);
|
||||
t('-0', -0.1);
|
||||
t('-0', '-0.4999999999999999');
|
||||
t('-0', -0.5);
|
||||
t('-0', -0.7);
|
||||
t('1', 1);
|
||||
t('2', 1.1);
|
||||
t('2', 1.5);
|
||||
t('2', 1.7);
|
||||
t('-1', -1);
|
||||
t('-1', -1.1);
|
||||
t('-1', -1.5);
|
||||
t('-1', -1.7);
|
||||
|
||||
t('-0', '-0.999');
|
||||
t('2', '1.0000000000000000001');
|
||||
t('2', '1.0000000000000000000000000000000000000000000000000000000000000000000000000000001');
|
||||
t('1', '1e-9000000000000000');
|
||||
t('-0', '-1e-9000000000000000');
|
||||
t('-0', '-9.9e-9000000000000001');
|
||||
t('9.999999e+9000000000000000', '9.999999e+9000000000000000');
|
||||
t('-9.999999e+9000000000000000', '-9.999999e+9000000000000000');
|
||||
t('-Infinity', '-1e+9000000000000001');
|
||||
t('5.5879983320336874473209567979e+287894365', '5.5879983320336874473209567979e+287894365');
|
||||
t('-5.5879983320336874473209567979e+287894365', '-5.5879983320336874473209567979e+287894365');
|
||||
t('-0', '-0.999');
|
||||
t('2', '1.0000000000000000001');
|
||||
t('2', '1.0000000000000000000000000000000000000000000000000000000000000000000000000000001');
|
||||
t('1', '1e-9000000000000000');
|
||||
t('-0', '-1e-9000000000000000');
|
||||
t('-0', '-9.9e-9000000000000001');
|
||||
t('9.999999e+9000000000000000', '9.999999e+9000000000000000');
|
||||
t('-9.999999e+9000000000000000', '-9.999999e+9000000000000000');
|
||||
t('-Infinity', '-1e+9000000000000001');
|
||||
t('5.5879983320336874473209567979e+287894365', '5.5879983320336874473209567979e+287894365');
|
||||
t('-5.5879983320336874473209567979e+287894365', '-5.5879983320336874473209567979e+287894365');
|
||||
|
||||
t('-2075364', '-2075364.364286541923');
|
||||
t('60593539780450631', '60593539780450631');
|
||||
t('65937898671515', '65937898671515');
|
||||
t('-39719494751819198566798', '-39719494751819198566798.578');
|
||||
t('92627382695288166557', '92627382695288166556.8683774524284866028260448205069');
|
||||
t('-881574', '-881574');
|
||||
t('-3633239209', '-3633239209.654526163275621746013315304191073405508491056');
|
||||
t('321978830777554620127500540', '321978830777554620127500539.339278568133088682532238002577');
|
||||
t('2074', '2073.532654804291079327244387978249477171032485250998396');
|
||||
t('677676305592', '677676305591.2');
|
||||
t('1', '0.0000000000006');
|
||||
t('39181479479778357', '39181479479778357');
|
||||
t('1', '0.00000000000000000087964700066672916651');
|
||||
t('896', '896');
|
||||
t('115083055948552475', '115083055948552475');
|
||||
t('9105942082143427451223', '9105942082143427451223');
|
||||
t('276312604693909858428', '276312604693909858427.21965306055697011390137926559');
|
||||
t('1', '0.0000252');
|
||||
t('-2075364', '-2075364.364286541923');
|
||||
t('60593539780450631', '60593539780450631');
|
||||
t('65937898671515', '65937898671515');
|
||||
t('-39719494751819198566798', '-39719494751819198566798.578');
|
||||
t('92627382695288166557', '92627382695288166556.8683774524284866028260448205069');
|
||||
t('-881574', '-881574');
|
||||
t('-3633239209', '-3633239209.654526163275621746013315304191073405508491056');
|
||||
t('321978830777554620127500540', '321978830777554620127500539.339278568133088682532238002577');
|
||||
t('2074', '2073.532654804291079327244387978249477171032485250998396');
|
||||
t('677676305592', '677676305591.2');
|
||||
t('1', '0.0000000000006');
|
||||
t('39181479479778357', '39181479479778357');
|
||||
t('1', '0.00000000000000000087964700066672916651');
|
||||
t('896', '896');
|
||||
t('115083055948552475', '115083055948552475');
|
||||
t('9105942082143427451223', '9105942082143427451223');
|
||||
t('276312604693909858428', '276312604693909858427.21965306055697011390137926559');
|
||||
t('1', '0.0000252');
|
||||
|
||||
T.stop();
|
||||
T.stop();
|
||||
})();
|
||||
|
2029
test/modules/cmp.js
2029
test/modules/cmp.js
File diff suppressed because it is too large
Load Diff
@ -1,350 +1,347 @@
|
||||
if (typeof T === 'undefined') require('../setup');
|
||||
|
||||
(function () {
|
||||
T('config');
|
||||
T('config');
|
||||
|
||||
var MAX_DIGITS = 1e9;
|
||||
var EXP_LIMIT = 9e15;
|
||||
var MAX_DIGITS = 1e9;
|
||||
var EXP_LIMIT = 9e15;
|
||||
|
||||
var t = function (actual) {
|
||||
T.assert(actual);
|
||||
}
|
||||
var t = function (actual) {
|
||||
T.assert(actual);
|
||||
}
|
||||
|
||||
var tx = function (fn, msg) {
|
||||
T.assertException(fn, msg);
|
||||
}
|
||||
var tx = function (fn, msg) {
|
||||
T.assertException(fn, msg);
|
||||
}
|
||||
|
||||
/*
|
||||
precision {number} [1, MAX_DIGITS]
|
||||
rounding {number} [0, 8]
|
||||
toExpNeg {number} [-EXP_LIMIT, 0]
|
||||
toExpPos {number} [0, EXP_LIMIT]
|
||||
maxE {number} [0, EXP_LIMIT]
|
||||
minE {number} [-EXP_LIMIT, 0]
|
||||
modulo {number} [0, 9]
|
||||
crypto {boolean|number} {true, false, 1, 0}
|
||||
isExpBin {boolean|number} {true, false, 1, 0}
|
||||
isExpHex {boolean|number} {true, false, 1, 0}
|
||||
isExpOct {boolean|number} {true, false, 1, 0}
|
||||
*/
|
||||
/*
|
||||
precision {number} [1, MAX_DIGITS]
|
||||
rounding {number} [0, 8]
|
||||
toExpNeg {number} [-EXP_LIMIT, 0]
|
||||
toExpPos {number} [0, EXP_LIMIT]
|
||||
maxE {number} [0, EXP_LIMIT]
|
||||
minE {number} [-EXP_LIMIT, 0]
|
||||
modulo {number} [0, 9]
|
||||
crypto {boolean|number} {true, false, 1, 0}
|
||||
*/
|
||||
|
||||
t(Decimal.config({}) === Decimal);
|
||||
t(Decimal.config({}) === Decimal);
|
||||
|
||||
tx(function () {Decimal.config()}, "config()");
|
||||
tx(function () {Decimal.config(null)}, "config(null)");
|
||||
tx(function () {Decimal.config(undefined)}, "config(undefined)");
|
||||
tx(function () {Decimal.config(0)}, "config(0)");
|
||||
tx(function () {Decimal.config('')}, "config('')");
|
||||
tx(function () {Decimal.config('hi')}, "config('hi')");
|
||||
tx(function () {Decimal.config('123')}, "config('123')");
|
||||
tx(function () {Decimal.config()}, "config()");
|
||||
tx(function () {Decimal.config(null)}, "config(null)");
|
||||
tx(function () {Decimal.config(undefined)}, "config(undefined)");
|
||||
tx(function () {Decimal.config(0)}, "config(0)");
|
||||
tx(function () {Decimal.config('')}, "config('')");
|
||||
tx(function () {Decimal.config('hi')}, "config('hi')");
|
||||
tx(function () {Decimal.config('123')}, "config('123')");
|
||||
|
||||
Decimal.config({
|
||||
precision: 20,
|
||||
rounding: 4,
|
||||
toExpNeg: -7,
|
||||
toExpPos: 21,
|
||||
minE: -9e15,
|
||||
maxE: 9e15,
|
||||
crypto: false,
|
||||
modulo: 1
|
||||
});
|
||||
Decimal.config({
|
||||
precision: 20,
|
||||
rounding: 4,
|
||||
toExpNeg: -7,
|
||||
toExpPos: 21,
|
||||
minE: -9e15,
|
||||
maxE: 9e15,
|
||||
crypto: false,
|
||||
modulo: 1
|
||||
});
|
||||
|
||||
t(Decimal.precision === 20);
|
||||
t(Decimal.rounding === 4);
|
||||
t(Decimal.toExpNeg === -7);
|
||||
t(Decimal.toExpPos === 21);
|
||||
t(Decimal.minE === -9e15);
|
||||
t(Decimal.maxE === 9e15);
|
||||
t(Decimal.crypto === false);
|
||||
t(Decimal.modulo === 1);
|
||||
t(Decimal.precision === 20);
|
||||
t(Decimal.rounding === 4);
|
||||
t(Decimal.toExpNeg === -7);
|
||||
t(Decimal.toExpPos === 21);
|
||||
t(Decimal.minE === -9e15);
|
||||
t(Decimal.maxE === 9e15);
|
||||
t(Decimal.crypto === false);
|
||||
t(Decimal.modulo === 1);
|
||||
|
||||
Decimal.config({
|
||||
precision: 40,
|
||||
rounding : 4,
|
||||
toExpNeg: -1000,
|
||||
toExpPos: 1000,
|
||||
minE: -1e9,
|
||||
maxE: 1e9,
|
||||
crypto: true,
|
||||
modulo: 4
|
||||
});
|
||||
Decimal.config({
|
||||
precision: 40,
|
||||
rounding : 4,
|
||||
toExpNeg: -1000,
|
||||
toExpPos: 1000,
|
||||
minE: -1e9,
|
||||
maxE: 1e9,
|
||||
crypto: true,
|
||||
modulo: 4
|
||||
});
|
||||
|
||||
t(Decimal.precision === 40);
|
||||
t(Decimal.rounding === 4);
|
||||
t(Decimal.toExpNeg === -1000);
|
||||
t(Decimal.toExpPos === 1000);
|
||||
t(Decimal.minE === -1e9);
|
||||
t(Decimal.maxE === 1e9);
|
||||
t(Decimal.crypto === true || Decimal.crypto === false);
|
||||
t(Decimal.modulo === 4);
|
||||
t(Decimal.precision === 40);
|
||||
t(Decimal.rounding === 4);
|
||||
t(Decimal.toExpNeg === -1000);
|
||||
t(Decimal.toExpPos === 1000);
|
||||
t(Decimal.minE === -1e9);
|
||||
t(Decimal.maxE === 1e9);
|
||||
t(Decimal.crypto === true || Decimal.crypto === false);
|
||||
t(Decimal.modulo === 4);
|
||||
|
||||
Decimal.config({
|
||||
toExpNeg: -7,
|
||||
toExpPos: 21,
|
||||
minE: -324,
|
||||
maxE: 308
|
||||
});
|
||||
Decimal.config({
|
||||
toExpNeg: -7,
|
||||
toExpPos: 21,
|
||||
minE: -324,
|
||||
maxE: 308
|
||||
});
|
||||
|
||||
t(Decimal.toExpNeg === -7);
|
||||
t(Decimal.toExpPos === 21);
|
||||
t(Decimal.minE === -324);
|
||||
t(Decimal.maxE === 308);
|
||||
t(Decimal.toExpNeg === -7);
|
||||
t(Decimal.toExpPos === 21);
|
||||
t(Decimal.minE === -324);
|
||||
t(Decimal.maxE === 308);
|
||||
|
||||
// precision
|
||||
// precision
|
||||
|
||||
t = function (expected, obj) {
|
||||
Decimal.config(obj);
|
||||
T.assertEqual(expected, Decimal.precision);
|
||||
}
|
||||
t = function (expected, obj) {
|
||||
Decimal.config(obj);
|
||||
T.assertEqual(expected, Decimal.precision);
|
||||
}
|
||||
|
||||
t(1, {precision: 1});
|
||||
t(1, {precision: void 0});
|
||||
t(20, {precision: 20});
|
||||
t(300000,{precision: 300000});
|
||||
t(4e+8, {precision: 4e8});
|
||||
t(1e9, {precision: 1e9});
|
||||
t(MAX_DIGITS, {precision: MAX_DIGITS});
|
||||
t(1, {precision: 1});
|
||||
t(1, {precision: void 0});
|
||||
t(20, {precision: 20});
|
||||
t(300000,{precision: 300000});
|
||||
t(4e+8, {precision: 4e8});
|
||||
t(1e9, {precision: 1e9});
|
||||
t(MAX_DIGITS, {precision: MAX_DIGITS});
|
||||
|
||||
tx(function () {Decimal.config({precision: 0})}, "precision: 0");
|
||||
tx(function () {Decimal.config({precision: MAX_DIGITS + 1})}, "precision: MAX_DIGITS + 1");
|
||||
tx(function () {Decimal.config({precision: MAX_DIGITS + 0.1})}, "precision: MAX_DIGITS + 0.1");
|
||||
tx(function () {Decimal.config({precision: '0'})}, "precision: '0'");
|
||||
tx(function () {Decimal.config({precision: '1'})}, "precision: '1'");
|
||||
tx(function () {Decimal.config({precision: '123456789'})}, "precision: '123456789'");
|
||||
tx(function () {Decimal.config({precision: -1})}, "precision: -1");
|
||||
tx(function () {Decimal.config({precision: 0.1})}, "precision: 0.1");
|
||||
tx(function () {Decimal.config({precision: 1.1})}, "precision: 1.1");
|
||||
tx(function () {Decimal.config({precision: -1.1})}, "precision: -1.1");
|
||||
tx(function () {Decimal.config({precision: 8.1})}, "precision: 8.1");
|
||||
tx(function () {Decimal.config({precision: 1e+9 + 1})}, "precision: 1e9 + 1");
|
||||
tx(function () {Decimal.config({precision: []})}, "precision: []");
|
||||
tx(function () {Decimal.config({precision: {}})}, "precision: {}");
|
||||
tx(function () {Decimal.config({precision: ''})}, "precision: ''");
|
||||
tx(function () {Decimal.config({precision: 'hi'})}, "precision: 'hi'");
|
||||
tx(function () {Decimal.config({precision: '1e+9'})}, "precision: '1e+9'");
|
||||
tx(function () {Decimal.config({precision: null})}, "precision: null");
|
||||
tx(function () {Decimal.config({precision: NaN})}, "precision: NaN");
|
||||
tx(function () {Decimal.config({precision: Infinity})}, "precision: Infinity");
|
||||
tx(function () {Decimal.config({precision: 0})}, "precision: 0");
|
||||
tx(function () {Decimal.config({precision: MAX_DIGITS + 1})}, "precision: MAX_DIGITS + 1");
|
||||
tx(function () {Decimal.config({precision: MAX_DIGITS + 0.1})}, "precision: MAX_DIGITS + 0.1");
|
||||
tx(function () {Decimal.config({precision: '0'})}, "precision: '0'");
|
||||
tx(function () {Decimal.config({precision: '1'})}, "precision: '1'");
|
||||
tx(function () {Decimal.config({precision: '123456789'})}, "precision: '123456789'");
|
||||
tx(function () {Decimal.config({precision: -1})}, "precision: -1");
|
||||
tx(function () {Decimal.config({precision: 0.1})}, "precision: 0.1");
|
||||
tx(function () {Decimal.config({precision: 1.1})}, "precision: 1.1");
|
||||
tx(function () {Decimal.config({precision: -1.1})}, "precision: -1.1");
|
||||
tx(function () {Decimal.config({precision: 8.1})}, "precision: 8.1");
|
||||
tx(function () {Decimal.config({precision: 1e+9 + 1})}, "precision: 1e9 + 1");
|
||||
tx(function () {Decimal.config({precision: []})}, "precision: []");
|
||||
tx(function () {Decimal.config({precision: {}})}, "precision: {}");
|
||||
tx(function () {Decimal.config({precision: ''})}, "precision: ''");
|
||||
tx(function () {Decimal.config({precision: 'hi'})}, "precision: 'hi'");
|
||||
tx(function () {Decimal.config({precision: '1e+9'})}, "precision: '1e+9'");
|
||||
tx(function () {Decimal.config({precision: null})}, "precision: null");
|
||||
tx(function () {Decimal.config({precision: NaN})}, "precision: NaN");
|
||||
tx(function () {Decimal.config({precision: Infinity})}, "precision: Infinity");
|
||||
|
||||
t(MAX_DIGITS, {precision: void 0});
|
||||
t(MAX_DIGITS, {precision: void 0});
|
||||
|
||||
// rounding
|
||||
// rounding
|
||||
|
||||
t = function (expected, obj) {
|
||||
Decimal.config(obj);
|
||||
T.assertEqual(expected, Decimal.rounding);
|
||||
}
|
||||
t = function (expected, obj) {
|
||||
Decimal.config(obj);
|
||||
T.assertEqual(expected, Decimal.rounding);
|
||||
}
|
||||
|
||||
t(4, {rounding: void 0});
|
||||
t(0, {rounding: 0});
|
||||
t(1, {rounding: 1});
|
||||
t(2, {rounding: 2});
|
||||
t(3, {rounding: 3});
|
||||
t(4, {rounding: 4});
|
||||
t(5, {rounding: 5});
|
||||
t(6, {rounding: 6});
|
||||
t(7, {rounding: 7});
|
||||
t(8, {rounding: 8});
|
||||
t(4, {rounding: void 0});
|
||||
t(0, {rounding: 0});
|
||||
t(1, {rounding: 1});
|
||||
t(2, {rounding: 2});
|
||||
t(3, {rounding: 3});
|
||||
t(4, {rounding: 4});
|
||||
t(5, {rounding: 5});
|
||||
t(6, {rounding: 6});
|
||||
t(7, {rounding: 7});
|
||||
t(8, {rounding: 8});
|
||||
|
||||
tx(function () {Decimal.config({rounding: -1})}, "rounding : -1");
|
||||
tx(function () {Decimal.config({rounding: 0.1})}, "rounding : 0.1");
|
||||
tx(function () {Decimal.config({rounding: 8.1})}, "rounding : 8.1");
|
||||
tx(function () {Decimal.config({rounding: 9})}, "rounding : 9");
|
||||
tx(function () {Decimal.config({rounding: '0'})}, "rounding: '0'");
|
||||
tx(function () {Decimal.config({rounding: '1'})}, "rounding: '1'");
|
||||
tx(function () {Decimal.config({rounding: '123456789'})}, "rounding: '123456789'");
|
||||
tx(function () {Decimal.config({rounding: 1.1})}, "rounding : 1.1");
|
||||
tx(function () {Decimal.config({rounding: -1.1})}, "rounding : -1.1");
|
||||
tx(function () {Decimal.config({rounding: 11})}, "rounding : 11");
|
||||
tx(function () {Decimal.config({rounding: []})}, "rounding : []");
|
||||
tx(function () {Decimal.config({rounding: {}})}, "rounding : {}");
|
||||
tx(function () {Decimal.config({rounding: ''})}, "rounding : ''");
|
||||
tx(function () {Decimal.config({rounding: 'hi'})}, "rounding : 'hi'");
|
||||
tx(function () {Decimal.config({rounding: null})}, "rounding : null");
|
||||
tx(function () {Decimal.config({rounding: NaN})}, "rounding : NaN");
|
||||
tx(function () {Decimal.config({rounding: Infinity})}, "rounding : Infinity");
|
||||
tx(function () {Decimal.config({rounding: -1})}, "rounding : -1");
|
||||
tx(function () {Decimal.config({rounding: 0.1})}, "rounding : 0.1");
|
||||
tx(function () {Decimal.config({rounding: 8.1})}, "rounding : 8.1");
|
||||
tx(function () {Decimal.config({rounding: 9})}, "rounding : 9");
|
||||
tx(function () {Decimal.config({rounding: '0'})}, "rounding: '0'");
|
||||
tx(function () {Decimal.config({rounding: '1'})}, "rounding: '1'");
|
||||
tx(function () {Decimal.config({rounding: '123456789'})}, "rounding: '123456789'");
|
||||
tx(function () {Decimal.config({rounding: 1.1})}, "rounding : 1.1");
|
||||
tx(function () {Decimal.config({rounding: -1.1})}, "rounding : -1.1");
|
||||
tx(function () {Decimal.config({rounding: 11})}, "rounding : 11");
|
||||
tx(function () {Decimal.config({rounding: []})}, "rounding : []");
|
||||
tx(function () {Decimal.config({rounding: {}})}, "rounding : {}");
|
||||
tx(function () {Decimal.config({rounding: ''})}, "rounding : ''");
|
||||
tx(function () {Decimal.config({rounding: 'hi'})}, "rounding : 'hi'");
|
||||
tx(function () {Decimal.config({rounding: null})}, "rounding : null");
|
||||
tx(function () {Decimal.config({rounding: NaN})}, "rounding : NaN");
|
||||
tx(function () {Decimal.config({rounding: Infinity})}, "rounding : Infinity");
|
||||
|
||||
t(8, {rounding: void 0});
|
||||
t(8, {rounding: void 0});
|
||||
|
||||
// toExpNeg
|
||||
// toExpNeg
|
||||
|
||||
t = function (expected, obj) {
|
||||
Decimal.config(obj);
|
||||
T.assertEqual(expected, Decimal.toExpNeg);
|
||||
}
|
||||
t = function (expected, obj) {
|
||||
Decimal.config(obj);
|
||||
T.assertEqual(expected, Decimal.toExpNeg);
|
||||
}
|
||||
|
||||
t(-7, {toExpNeg: void 0});
|
||||
t(0, {toExpNeg: 0});
|
||||
t(-1, {toExpNeg: -1});
|
||||
t(-999, {toExpNeg: -999});
|
||||
t(-5675367, {toExpNeg: -5675367});
|
||||
t(-98770170790791, {toExpNeg: -98770170790791});
|
||||
t(-EXP_LIMIT, {toExpNeg: -EXP_LIMIT});
|
||||
t(-7, {toExpNeg: void 0});
|
||||
t(0, {toExpNeg: 0});
|
||||
t(-1, {toExpNeg: -1});
|
||||
t(-999, {toExpNeg: -999});
|
||||
t(-5675367, {toExpNeg: -5675367});
|
||||
t(-98770170790791, {toExpNeg: -98770170790791});
|
||||
t(-EXP_LIMIT, {toExpNeg: -EXP_LIMIT});
|
||||
|
||||
tx(function () {Decimal.config({toExpNeg: -EXP_LIMIT - 1})}, "-EXP_LIMIT - 1");
|
||||
tx(function () {Decimal.config({toExpNeg: '-7'})}, "toExpNeg: '-7'");
|
||||
tx(function () {Decimal.config({toExpNeg: -0.1})}, "toExpNeg: -0.1");
|
||||
tx(function () {Decimal.config({toExpNeg: 0.1})}, "toExpNeg: 0.1");
|
||||
tx(function () {Decimal.config({toExpNeg: 1})}, "toExpNeg: 1");
|
||||
tx(function () {Decimal.config({toExpNeg: -Infinity})}, "toExpNeg: -Infinity");
|
||||
tx(function () {Decimal.config({toExpNeg: NaN})}, "toExpNeg: NaN");
|
||||
tx(function () {Decimal.config({toExpNeg: null})}, "toExpNeg: null");
|
||||
tx(function () {Decimal.config({toExpNeg: {}})}, "toExpNeg: {}");
|
||||
tx(function () {Decimal.config({toExpNeg: -EXP_LIMIT - 1})}, "-EXP_LIMIT - 1");
|
||||
tx(function () {Decimal.config({toExpNeg: '-7'})}, "toExpNeg: '-7'");
|
||||
tx(function () {Decimal.config({toExpNeg: -0.1})}, "toExpNeg: -0.1");
|
||||
tx(function () {Decimal.config({toExpNeg: 0.1})}, "toExpNeg: 0.1");
|
||||
tx(function () {Decimal.config({toExpNeg: 1})}, "toExpNeg: 1");
|
||||
tx(function () {Decimal.config({toExpNeg: -Infinity})}, "toExpNeg: -Infinity");
|
||||
tx(function () {Decimal.config({toExpNeg: NaN})}, "toExpNeg: NaN");
|
||||
tx(function () {Decimal.config({toExpNeg: null})}, "toExpNeg: null");
|
||||
tx(function () {Decimal.config({toExpNeg: {}})}, "toExpNeg: {}");
|
||||
|
||||
t(-EXP_LIMIT, {toExpNeg: void 0});
|
||||
t(-EXP_LIMIT, {toExpNeg: void 0});
|
||||
|
||||
// toExpPos
|
||||
// toExpPos
|
||||
|
||||
t = function (expected, obj) {
|
||||
Decimal.config(obj);
|
||||
T.assertEqual(expected, Decimal.toExpPos);
|
||||
}
|
||||
t = function (expected, obj) {
|
||||
Decimal.config(obj);
|
||||
T.assertEqual(expected, Decimal.toExpPos);
|
||||
}
|
||||
|
||||
t(21, {toExpPos: void 0});
|
||||
t(0, {toExpPos: 0});
|
||||
t(1, {toExpPos: 1});
|
||||
t(999, {toExpPos: 999});
|
||||
t(5675367, {toExpPos: 5675367});
|
||||
t(98770170790791, {toExpPos: 98770170790791});
|
||||
t(EXP_LIMIT, {toExpPos: EXP_LIMIT});
|
||||
t(21, {toExpPos: void 0});
|
||||
t(0, {toExpPos: 0});
|
||||
t(1, {toExpPos: 1});
|
||||
t(999, {toExpPos: 999});
|
||||
t(5675367, {toExpPos: 5675367});
|
||||
t(98770170790791, {toExpPos: 98770170790791});
|
||||
t(EXP_LIMIT, {toExpPos: EXP_LIMIT});
|
||||
|
||||
tx(function () {Decimal.config({toExpPos: EXP_LIMIT + 1})}, "EXP_LIMIT + 1");
|
||||
tx(function () {Decimal.config({toExpPos: '21'})}, "toExpPos: '21'");
|
||||
tx(function () {Decimal.config({toExpPos: -0.1})}, "toExpPos: -0.1");
|
||||
tx(function () {Decimal.config({toExpPos: 0.1})}, "toExpPos: 0.1");
|
||||
tx(function () {Decimal.config({toExpPos: -1})}, "toExpPos: -1");
|
||||
tx(function () {Decimal.config({toExpPos: Infinity})}, "toExpPos: Infinity");
|
||||
tx(function () {Decimal.config({toExpPos: NaN})}, "toExpPos: NaN");
|
||||
tx(function () {Decimal.config({toExpPos: null})}, "toExpPos: null");
|
||||
tx(function () {Decimal.config({toExpPos: {}})}, "toExpPos: {}");
|
||||
tx(function () {Decimal.config({toExpPos: EXP_LIMIT + 1})}, "EXP_LIMIT + 1");
|
||||
tx(function () {Decimal.config({toExpPos: '21'})}, "toExpPos: '21'");
|
||||
tx(function () {Decimal.config({toExpPos: -0.1})}, "toExpPos: -0.1");
|
||||
tx(function () {Decimal.config({toExpPos: 0.1})}, "toExpPos: 0.1");
|
||||
tx(function () {Decimal.config({toExpPos: -1})}, "toExpPos: -1");
|
||||
tx(function () {Decimal.config({toExpPos: Infinity})}, "toExpPos: Infinity");
|
||||
tx(function () {Decimal.config({toExpPos: NaN})}, "toExpPos: NaN");
|
||||
tx(function () {Decimal.config({toExpPos: null})}, "toExpPos: null");
|
||||
tx(function () {Decimal.config({toExpPos: {}})}, "toExpPos: {}");
|
||||
|
||||
t(EXP_LIMIT, {toExpPos: void 0});
|
||||
t(EXP_LIMIT, {toExpPos: void 0});
|
||||
|
||||
// maxE
|
||||
// maxE
|
||||
|
||||
t = function (expected, obj) {
|
||||
Decimal.config(obj);
|
||||
T.assertEqual(expected, Decimal.maxE);
|
||||
}
|
||||
t = function (expected, obj) {
|
||||
Decimal.config(obj);
|
||||
T.assertEqual(expected, Decimal.maxE);
|
||||
}
|
||||
|
||||
t(308, {maxE: void 0});
|
||||
t(0, {maxE: 0});
|
||||
t(1, {maxE: 1});
|
||||
t(999, {maxE: 999});
|
||||
t(5675367, {maxE: 5675367});
|
||||
t(98770170790791, {maxE: 98770170790791});
|
||||
t(EXP_LIMIT, {maxE: EXP_LIMIT});
|
||||
t(308, {maxE: void 0});
|
||||
t(0, {maxE: 0});
|
||||
t(1, {maxE: 1});
|
||||
t(999, {maxE: 999});
|
||||
t(5675367, {maxE: 5675367});
|
||||
t(98770170790791, {maxE: 98770170790791});
|
||||
t(EXP_LIMIT, {maxE: EXP_LIMIT});
|
||||
|
||||
tx(function () {Decimal.config({maxE: EXP_LIMIT + 1})}, "EXP_LIMIT + 1");
|
||||
tx(function () {Decimal.config({maxE: '308'})}, "maxE: '308'");
|
||||
tx(function () {Decimal.config({maxE: -0.1})}, "maxE: -0.1");
|
||||
tx(function () {Decimal.config({maxE: 0.1})}, "maxE: 0.1");
|
||||
tx(function () {Decimal.config({maxE: -1})}, "maxE: -1");
|
||||
tx(function () {Decimal.config({maxE: Infinity})}, "maxE: Infinity");
|
||||
tx(function () {Decimal.config({maxE: NaN})}, "maxE: NaN");
|
||||
tx(function () {Decimal.config({maxE: null})}, "maxE: null");
|
||||
tx(function () {Decimal.config({maxE: {}})}, "maxE: {}");
|
||||
tx(function () {Decimal.config({maxE: EXP_LIMIT + 1})}, "EXP_LIMIT + 1");
|
||||
tx(function () {Decimal.config({maxE: '308'})}, "maxE: '308'");
|
||||
tx(function () {Decimal.config({maxE: -0.1})}, "maxE: -0.1");
|
||||
tx(function () {Decimal.config({maxE: 0.1})}, "maxE: 0.1");
|
||||
tx(function () {Decimal.config({maxE: -1})}, "maxE: -1");
|
||||
tx(function () {Decimal.config({maxE: Infinity})}, "maxE: Infinity");
|
||||
tx(function () {Decimal.config({maxE: NaN})}, "maxE: NaN");
|
||||
tx(function () {Decimal.config({maxE: null})}, "maxE: null");
|
||||
tx(function () {Decimal.config({maxE: {}})}, "maxE: {}");
|
||||
|
||||
t(EXP_LIMIT, {maxE: void 0});
|
||||
t(EXP_LIMIT, {maxE: void 0});
|
||||
|
||||
// minE
|
||||
// minE
|
||||
|
||||
t = function (expected, obj) {
|
||||
Decimal.config(obj);
|
||||
T.assertEqual(expected, Decimal.minE);
|
||||
}
|
||||
t = function (expected, obj) {
|
||||
Decimal.config(obj);
|
||||
T.assertEqual(expected, Decimal.minE);
|
||||
}
|
||||
|
||||
t(-324, {minE: void 0});
|
||||
t(0, {minE: 0});
|
||||
t(-1, {minE: -1});
|
||||
t(-999, {minE: -999});
|
||||
t(-5675367, {minE: -5675367});
|
||||
t(-98770170790791, {minE: -98770170790791});
|
||||
t(-EXP_LIMIT, {minE: -EXP_LIMIT});
|
||||
t(-324, {minE: void 0});
|
||||
t(0, {minE: 0});
|
||||
t(-1, {minE: -1});
|
||||
t(-999, {minE: -999});
|
||||
t(-5675367, {minE: -5675367});
|
||||
t(-98770170790791, {minE: -98770170790791});
|
||||
t(-EXP_LIMIT, {minE: -EXP_LIMIT});
|
||||
|
||||
tx(function () {Decimal.config({minE: -EXP_LIMIT - 1})}, "-EXP_LIMIT - 1");
|
||||
tx(function () {Decimal.config({minE: '-324'})}, "minE: '-324'");
|
||||
tx(function () {Decimal.config({minE: -0.1})}, "minE: -0.1");
|
||||
tx(function () {Decimal.config({minE: 0.1})}, "minE: 0.1");
|
||||
tx(function () {Decimal.config({minE: 1})}, "minE: 1");
|
||||
tx(function () {Decimal.config({minE: -Infinity})}, "minE: -Infinity");
|
||||
tx(function () {Decimal.config({minE: NaN})}, "minE: NaN");
|
||||
tx(function () {Decimal.config({minE: null})}, "minE: null");
|
||||
tx(function () {Decimal.config({minE: {}})}, "minE: {}");
|
||||
tx(function () {Decimal.config({minE: -EXP_LIMIT - 1})}, "-EXP_LIMIT - 1");
|
||||
tx(function () {Decimal.config({minE: '-324'})}, "minE: '-324'");
|
||||
tx(function () {Decimal.config({minE: -0.1})}, "minE: -0.1");
|
||||
tx(function () {Decimal.config({minE: 0.1})}, "minE: 0.1");
|
||||
tx(function () {Decimal.config({minE: 1})}, "minE: 1");
|
||||
tx(function () {Decimal.config({minE: -Infinity})}, "minE: -Infinity");
|
||||
tx(function () {Decimal.config({minE: NaN})}, "minE: NaN");
|
||||
tx(function () {Decimal.config({minE: null})}, "minE: null");
|
||||
tx(function () {Decimal.config({minE: {}})}, "minE: {}");
|
||||
|
||||
t(-EXP_LIMIT, {minE: void 0});
|
||||
t(-EXP_LIMIT, {minE: void 0});
|
||||
|
||||
// crypto
|
||||
// crypto
|
||||
|
||||
t = function (expected, obj) {
|
||||
Decimal.config(obj);
|
||||
T.assertEqual(expected, Decimal.crypto);
|
||||
}
|
||||
Decimal.config(obj);
|
||||
T.assertEqual(expected, Decimal.crypto);
|
||||
}
|
||||
|
||||
// crypto was set true above, but it will have remained false if
|
||||
// there is no crypto.getRandomValues or crypto.randomBytes.
|
||||
var cryptoVal = Decimal.crypto;
|
||||
// crypto was set true above, but it will have remained false if
|
||||
// there is no crypto.getRandomValues or crypto.randomBytes.
|
||||
var cryptoVal = Decimal.crypto;
|
||||
|
||||
t(void 0, {crypto: void 0});
|
||||
t(false, {crypto: 0});
|
||||
t(cryptoVal, {crypto: 1});
|
||||
t(false, {crypto: false});
|
||||
t(cryptoVal, {crypto: true});
|
||||
t(void 0, {crypto: void 0});
|
||||
t(false, {crypto: 0});
|
||||
t(cryptoVal, {crypto: 1});
|
||||
t(false, {crypto: false});
|
||||
t(cryptoVal, {crypto: true});
|
||||
|
||||
tx(function () {Decimal.config({crypto: 'hiya'})}, "crypto: 'hiya'");
|
||||
tx(function () {Decimal.config({crypto: 'true'})}, "crypto: 'true'");
|
||||
tx(function () {Decimal.config({crypto: 'false'})}, "crypto: 'false'");
|
||||
tx(function () {Decimal.config({crypto: '0'})}, "crypto: '0'");
|
||||
tx(function () {Decimal.config({crypto: '1'})}, "crypto: '1'");
|
||||
tx(function () {Decimal.config({crypto: -1})}, "crypto: -1");
|
||||
tx(function () {Decimal.config({crypto: 0.1})}, "crypto: 0.1");
|
||||
tx(function () {Decimal.config({crypto: 1.1})}, "crypto: 1.1");
|
||||
tx(function () {Decimal.config({crypto: []})}, "crypto: []");
|
||||
tx(function () {Decimal.config({crypto: {}})}, "crypto: {}");
|
||||
tx(function () {Decimal.config({crypto: ''})}, "crypto: ''");
|
||||
tx(function () {Decimal.config({crypto: NaN})}, "crypto: NaN");
|
||||
tx(function () {Decimal.config({crypto: Infinity})}, "crypto: Infinity");
|
||||
tx(function () {Decimal.config({crypto: 'hiya'})}, "crypto: 'hiya'");
|
||||
tx(function () {Decimal.config({crypto: 'true'})}, "crypto: 'true'");
|
||||
tx(function () {Decimal.config({crypto: 'false'})}, "crypto: 'false'");
|
||||
tx(function () {Decimal.config({crypto: '0'})}, "crypto: '0'");
|
||||
tx(function () {Decimal.config({crypto: '1'})}, "crypto: '1'");
|
||||
tx(function () {Decimal.config({crypto: -1})}, "crypto: -1");
|
||||
tx(function () {Decimal.config({crypto: 0.1})}, "crypto: 0.1");
|
||||
tx(function () {Decimal.config({crypto: 1.1})}, "crypto: 1.1");
|
||||
tx(function () {Decimal.config({crypto: []})}, "crypto: []");
|
||||
tx(function () {Decimal.config({crypto: {}})}, "crypto: {}");
|
||||
tx(function () {Decimal.config({crypto: ''})}, "crypto: ''");
|
||||
tx(function () {Decimal.config({crypto: NaN})}, "crypto: NaN");
|
||||
tx(function () {Decimal.config({crypto: Infinity})}, "crypto: Infinity");
|
||||
|
||||
t(void 0, {crypto: void 0});
|
||||
t(void 0, {crypto: void 0});
|
||||
|
||||
// modulo
|
||||
// modulo
|
||||
|
||||
t = function (expected, obj) {
|
||||
Decimal.config(obj);
|
||||
T.assertEqual(expected, Decimal.modulo);
|
||||
}
|
||||
t = function (expected, obj) {
|
||||
Decimal.config(obj);
|
||||
T.assertEqual(expected, Decimal.modulo);
|
||||
}
|
||||
|
||||
t(4, {modulo: void 0});
|
||||
t(0, {modulo: 0});
|
||||
t(1, {modulo: 1});
|
||||
t(2, {modulo: 2});
|
||||
t(3, {modulo: 3});
|
||||
t(4, {modulo: 4});
|
||||
t(5, {modulo: 5});
|
||||
t(6, {modulo: 6});
|
||||
t(7, {modulo: 7});
|
||||
t(8, {modulo: 8});
|
||||
t(9, {modulo: 9});
|
||||
t(4, {modulo: void 0});
|
||||
t(0, {modulo: 0});
|
||||
t(1, {modulo: 1});
|
||||
t(2, {modulo: 2});
|
||||
t(3, {modulo: 3});
|
||||
t(4, {modulo: 4});
|
||||
t(5, {modulo: 5});
|
||||
t(6, {modulo: 6});
|
||||
t(7, {modulo: 7});
|
||||
t(8, {modulo: 8});
|
||||
t(9, {modulo: 9});
|
||||
|
||||
tx(function () {Decimal.config({modulo: -1})}, "modulo: -1");
|
||||
tx(function () {Decimal.config({modulo: 0.1})}, "modulo: 0.1");
|
||||
tx(function () {Decimal.config({modulo: 9.1})}, "modulo: 9.1");
|
||||
tx(function () {Decimal.config({modulo: '0'})}, "modulo: '0'");
|
||||
tx(function () {Decimal.config({modulo: '1'})}, "modulo: '1'");
|
||||
tx(function () {Decimal.config({modulo: 1.1})}, "modulo: 1.1");
|
||||
tx(function () {Decimal.config({modulo: -1.1})}, "modulo: -1.1");
|
||||
tx(function () {Decimal.config({modulo: 10})}, "modulo: 10");
|
||||
tx(function () {Decimal.config({modulo: -11})}, "modulo: -11");
|
||||
tx(function () {Decimal.config({modulo: []})}, "modulo: []");
|
||||
tx(function () {Decimal.config({modulo: {}})}, "modulo: {}");
|
||||
tx(function () {Decimal.config({modulo: ''})}, "modulo: ''");
|
||||
tx(function () {Decimal.config({modulo: ' '})}, "modulo: ' '");
|
||||
tx(function () {Decimal.config({modulo: 'hi'})}, "modulo: 'hi'");
|
||||
tx(function () {Decimal.config({modulo: null})}, "modulo: null");
|
||||
tx(function () {Decimal.config({modulo: NaN})}, "modulo: NaN");
|
||||
tx(function () {Decimal.config({modulo: Infinity})}, "modulo: Infinity");
|
||||
tx(function () {Decimal.config({modulo: -1})}, "modulo: -1");
|
||||
tx(function () {Decimal.config({modulo: 0.1})}, "modulo: 0.1");
|
||||
tx(function () {Decimal.config({modulo: 9.1})}, "modulo: 9.1");
|
||||
tx(function () {Decimal.config({modulo: '0'})}, "modulo: '0'");
|
||||
tx(function () {Decimal.config({modulo: '1'})}, "modulo: '1'");
|
||||
tx(function () {Decimal.config({modulo: 1.1})}, "modulo: 1.1");
|
||||
tx(function () {Decimal.config({modulo: -1.1})}, "modulo: -1.1");
|
||||
tx(function () {Decimal.config({modulo: 10})}, "modulo: 10");
|
||||
tx(function () {Decimal.config({modulo: -11})}, "modulo: -11");
|
||||
tx(function () {Decimal.config({modulo: []})}, "modulo: []");
|
||||
tx(function () {Decimal.config({modulo: {}})}, "modulo: {}");
|
||||
tx(function () {Decimal.config({modulo: ''})}, "modulo: ''");
|
||||
tx(function () {Decimal.config({modulo: ' '})}, "modulo: ' '");
|
||||
tx(function () {Decimal.config({modulo: 'hi'})}, "modulo: 'hi'");
|
||||
tx(function () {Decimal.config({modulo: null})}, "modulo: null");
|
||||
tx(function () {Decimal.config({modulo: NaN})}, "modulo: NaN");
|
||||
tx(function () {Decimal.config({modulo: Infinity})}, "modulo: Infinity");
|
||||
|
||||
t(9, {modulo: void 0});
|
||||
t(9, {modulo: void 0});
|
||||
|
||||
T.stop();
|
||||
T.stop();
|
||||
})();
|
||||
|
@ -1,130 +1,126 @@
|
||||
if (typeof T === 'undefined') require('../setup');
|
||||
|
||||
(function () {
|
||||
T('cos');
|
||||
T('cos');
|
||||
|
||||
function t(n, pr, rm, expected) {
|
||||
Decimal.precision = pr;
|
||||
Decimal.rounding = rm;
|
||||
var x = new Decimal(n);
|
||||
T.assertEqual(expected, x.cos().valueOf());
|
||||
T.assertEqual(expected, Decimal.cos(n).valueOf());
|
||||
T.assert(x.eq(n) || x.isNaN());
|
||||
}
|
||||
function t(n, pr, rm, expected) {
|
||||
Decimal.precision = pr;
|
||||
Decimal.rounding = rm;
|
||||
T.assertEqual(expected, new Decimal(n).cos().valueOf());
|
||||
}
|
||||
|
||||
Decimal.config({
|
||||
precision: 40,
|
||||
rounding: 4,
|
||||
toExpNeg: -9e15,
|
||||
toExpPos: 9e15,
|
||||
minE: -9e15,
|
||||
maxE: 9e15
|
||||
});
|
||||
Decimal.config({
|
||||
precision: 40,
|
||||
rounding: 4,
|
||||
toExpNeg: -9e15,
|
||||
toExpPos: 9e15,
|
||||
minE: -9e15,
|
||||
maxE: 9e15
|
||||
});
|
||||
|
||||
t('NaN', 40, 4, 'NaN');
|
||||
t('0', 20, 4, '1');
|
||||
t('-0', 20, 4, '1');
|
||||
t('Infinity', 40, 4, 'NaN');
|
||||
t('-Infinity', 40, 4, 'NaN');
|
||||
t('NaN', 40, 4, 'NaN');
|
||||
t('0', 20, 4, '1');
|
||||
t('-0', 20, 4, '1');
|
||||
t('Infinity', 40, 4, 'NaN');
|
||||
t('-Infinity', 40, 4, 'NaN');
|
||||
|
||||
t('0.00006', 10, 2, '0.9999999983'); // 0.9999999982000000005399999999352000000041657142...
|
||||
t('0.000000065', 18, 4, '0.999999999999997888'); // 0.99999999999999788750000000000074377...
|
||||
t('0.00006', 10, 2, '0.9999999983'); // 0.9999999982000000005399999999352000000041657142...
|
||||
t('0.000000065', 18, 4, '0.999999999999997888'); // 0.99999999999999788750000000000074377...
|
||||
|
||||
t('14044.44444444444', 10, 4, '0.04549771706');
|
||||
t('-14044.44444444444', 10, 4, '0.04549771706');
|
||||
t('5', 8, 5, '0.28366219');
|
||||
t('6723', 3, 3, '0.999');
|
||||
t('2.04964', 8, 2, '-0.46075321');
|
||||
t('476', 6, 1, '0.0486937');
|
||||
t('5298612.00024', 2, 3, '-0.26');
|
||||
t('12.5703596425462281326763791506392117455', 8, 4, '0.99999204');
|
||||
t('2797', 8, 1, '0.55491269');
|
||||
t('0.3834777777', 3, 4, '0.927');
|
||||
t('16355.3334', 9, 4, '0.979658167');
|
||||
t('0.997737586545708065463833973312637902054356957830033', 5, 5, '0.5422');
|
||||
t('-0.997737586545708065463833973312637902054356957830033', 5, 5, '0.5422');
|
||||
t('7803700', 4, 2, '-0.9032');
|
||||
t('841822094288189413002174891207354317', 5, 2, '-0.86017');
|
||||
t('67942', 8, 3, '-0.33958641');
|
||||
t('899999929799999999999919999999999999999999999999999999999999999999999999.99999', 7, 5, '-0.8773558');
|
||||
t('0.00058849862302952064864312588263928354414752285369272291803582192021298679', 10, 6, '0.9999998268');
|
||||
t('20000000923980793370370313003363533778888888888.7777777777777777', 9, 4, '-0.801329944');
|
||||
t('49.73807738608', 3, 1, '0.864');
|
||||
t('88000', 5, 3, '-0.66135');
|
||||
t('75465048517642702658117738264729233565816440737178306250850477902340698', 7, 2, '0.4233356');
|
||||
t('0.704', 10, 2, '0.7622592047');
|
||||
t('0.94828132184399998008581', 6, 5, '0.58308');
|
||||
t('0.8', 8, 3, '0.6967067');
|
||||
t('0.002', 6, 2, '0.999999');
|
||||
t('61688.77777079779777777777777797777777777777777', 1, 4, '0.9');
|
||||
t('8111', 7, 2, '0.8296971');
|
||||
t('22.1513', 10, 6, '-0.9872031473');
|
||||
t('800000000', 8, 2, '-0.98618707');
|
||||
t('7332769805669601096865534', 4, 0, '0.8803');
|
||||
t('2116627523999999999999999999', 2, 5, '0.58');
|
||||
t('16967658790', 8, 4, '0.70645039');
|
||||
t('2539668340778777961946252621835163455556224034680348035809827426444170650792306', 8, 2, '-0.49939729');
|
||||
t('36', 7, 1, '-0.1279636');
|
||||
t('61999992993999.999999999999999999949999999999999994999929999999999992999999999999999999999', 2, 6, '0.99');
|
||||
t('0.218944155186302719769455371933055277727070161042429', 10, 4, '0.9761273219');
|
||||
t('20', 2, 3, '0.4');
|
||||
t('173215504685358227465651988', 10, 4, '-0.671213895');
|
||||
t('5769000000000.2222222222222222', 10, 3, '0.4282801932');
|
||||
t('0.5', 3, 1, '0.877');
|
||||
t('5000000000053', 5, 6, '0.85063');
|
||||
t('281084', 5, 6, '0.83761');
|
||||
t('80.6', 9, 2, '0.470085225');
|
||||
t('447162', 7, 4, '0.9642869');
|
||||
t('6856.6636666666626606066666', 6, 6, '-0.137265');
|
||||
t('7.37514', 7, 4, '0.4607514');
|
||||
t('1.29', 3, 4, '0.277');
|
||||
t('9', 10, 5, '-0.9111302619');
|
||||
t('5067', 4, 0, '-0.9254');
|
||||
t('482222222222.62217863079410578', 3, 1, '-0.997');
|
||||
t('4.2202926299999999999959999999999999999999999999999999990999999999999999999999', 10, 6, '-0.4724745315');
|
||||
t('24714170816959', 8, 1, '-0.99806747');
|
||||
t('31365220956895733422', 5, 3, '0.99149');
|
||||
t('377469441384376095492196870000863.83493122', 1, 0, '0.8');
|
||||
t('0.1175', 1, 1, '0.9');
|
||||
t('223953406565183766798339942076619761', 5, 4, '0.77106');
|
||||
t('9.4', 7, 0, '-0.9996931');
|
||||
t('67777777777777733221519976680533200000000000', 7, 4, '0.883886');
|
||||
t('3', 7, 0, '-0.9899925');
|
||||
t('99127.77777', 8, 3, '-0.44933878');
|
||||
t('95555555550.5555555515555555555555555555550055555555555560555555559', 3, 0, '0.0823');
|
||||
t('1.3830713', 3, 5, '0.187');
|
||||
t('59', 9, 5, '-0.771080223');
|
||||
t('1.1', 7, 1, '0.4535961');
|
||||
t('1090000000000000000000000000000000000050000000.00004', 4, 1, '0.9972');
|
||||
t('8', 1, 6, '-0.1');
|
||||
t('43019456219304869332859776', 8, 1, '-0.99906433');
|
||||
t('0.0000003104573823727508545651739730202238202717472186710001424', 7, 4, '1');
|
||||
t('81888888888.5555555555555555511111111111111111114304', 8, 6, '0.86581506');
|
||||
t('848765718488021014558633685913717744363956181398886593', 5, 0, '-0.97123');
|
||||
t('0.4338', 69, 3, '0.907375081713258312704647471639381401468307894324094984616218937905432');
|
||||
t('6647167168310148646127', 41, 1, '-0.67876552621688089570465682794229097436017');
|
||||
t('14', 44, 5, '0.13673721820783359424892887667173824055164518');
|
||||
t('0.815', 74, 3, '0.68586839345673735262969403373783813324713582642679411838288343756307680681');
|
||||
t('52666376666220.66', 8, 2, '-0.46217165');
|
||||
t('0.1', 58, 6, '0.9950041652780257660955619878038702948385762254150840359594');
|
||||
t('5.481638560270924097', 46, 5, '0.6955963080641265200604938991229596548878269881');
|
||||
t('616019185645542611168895104511361.514', 73, 0, '-0.9897418432019178091874564214082330932214823767149588163455308944210649199');
|
||||
t('58872.6729', 27, 5, '0.71551991401684231627099417');
|
||||
t('0.00000000986995340365791470449236832278868084019660524206930178008', 33, 1, '0.999999999999999951292009904810772');
|
||||
t('200000000000000000000', 24, 1, '0.167301557725715824849981');
|
||||
t('8712357290413741268816184846819797318515482698552148280140735653', 57, 0, '-0.279047254515165435013067136950333012052507338721363544685');
|
||||
t('0.0177165009539797142337288907', 37, 1, '0.9998430669018118198896427823538202954');
|
||||
t('255555555555555775027123062979747796598651156132669853568621902', 14, 2, '-0.99883756464211');
|
||||
t('3741565840746605.71876151239588', 15, 0, '-0.930123581114026');
|
||||
t('3050000000000000000000200000000000000000000.0000000000000000000000008', 41, 3, '-0.33127228153577434134804953378906485886176');
|
||||
t('0.33482', 27, 4, '0.944469472783453774254728912');
|
||||
t('0.1979574070039662', 30, 0, '0.980470333633282159348863278164');
|
||||
t('960492.3601219999999', 74, 6, '0.78272168046024997208016985369610426247753755795663609587331768113997535495');
|
||||
t('0.1145342', 57, 0, '0.993448125551484394628225244895937689399175688856818869855');
|
||||
t('99999999999999999999999.99', 70, 0, '-0.7059760628345569635155393670172360201795320597371430862306924466086157');
|
||||
t('0.10859933721171128209598967066', 80, 4, '0.99410888528803407646108267824473898405842663808987770888683180574685964084716924');
|
||||
t('2813920.875088303362819', 33, 2, '-0.866254989781355498995879756871368');
|
||||
t('35999999999999999999999999999999999999999.999999999999999999999999919', 38, 3, '-0.9562598584240982386154988349219959087');
|
||||
t('14044.44444444444', 10, 4, '0.04549771706');
|
||||
t('-14044.44444444444', 10, 4, '0.04549771706');
|
||||
t('5', 8, 5, '0.28366219');
|
||||
t('6723', 3, 3, '0.999');
|
||||
t('2.04964', 8, 2, '-0.46075321');
|
||||
t('476', 6, 1, '0.0486937');
|
||||
t('5298612.00024', 2, 3, '-0.26');
|
||||
t('12.5703596425462281326763791506392117455', 8, 4, '0.99999204');
|
||||
t('2797', 8, 1, '0.55491269');
|
||||
t('0.3834777777', 3, 4, '0.927');
|
||||
t('16355.3334', 9, 4, '0.979658167');
|
||||
t('0.997737586545708065463833973312637902054356957830033', 5, 5, '0.5422');
|
||||
t('7803700', 4, 2, '-0.9032');
|
||||
t('841822094288189413002174891207354317', 5, 2, '-0.86017');
|
||||
t('67942', 8, 3, '-0.33958641');
|
||||
t('899999929799999999999919999999999999999999999999999999999999999999999999.99999', 7, 5, '-0.8773558');
|
||||
t('0.00058849862302952064864312588263928354414752285369272291803582192021298679', 10, 6, '0.9999998268');
|
||||
t('20000000923980793370370313003363533778888888888.7777777777777777', 9, 4, '-0.801329944');
|
||||
t('49.73807738608', 3, 1, '0.864');
|
||||
t('88000', 5, 3, '-0.66135');
|
||||
t('75465048517642702658117738264729233565816440737178306250850477902340698', 7, 2, '0.4233356');
|
||||
t('0.704', 10, 2, '0.7622592047');
|
||||
t('0.94828132184399998008581', 6, 5, '0.58308');
|
||||
t('0.8', 8, 3, '0.6967067');
|
||||
t('0.002', 6, 2, '0.999999');
|
||||
t('61688.77777079779777777777777797777777777777777', 1, 4, '0.9');
|
||||
t('8111', 7, 2, '0.8296971');
|
||||
t('22.1513', 10, 6, '-0.9872031473');
|
||||
t('800000000', 8, 2, '-0.98618707');
|
||||
t('7332769805669601096865534', 4, 0, '0.8803');
|
||||
t('2116627523999999999999999999', 2, 5, '0.58');
|
||||
t('16967658790', 8, 4, '0.70645039');
|
||||
t('2539668340778777961946252621835163455556224034680348035809827426444170650792306', 8, 2, '-0.49939729');
|
||||
t('36', 7, 1, '-0.1279636');
|
||||
t('61999992993999.999999999999999999949999999999999994999929999999999992999999999999999999999', 2, 6, '0.99');
|
||||
t('0.218944155186302719769455371933055277727070161042429', 10, 4, '0.9761273219');
|
||||
t('20', 2, 3, '0.4');
|
||||
t('173215504685358227465651988', 10, 4, '-0.671213895');
|
||||
t('5769000000000.2222222222222222', 10, 3, '0.4282801932');
|
||||
t('0.5', 3, 1, '0.877');
|
||||
t('5000000000053', 5, 6, '0.85063');
|
||||
t('281084', 5, 6, '0.83761');
|
||||
t('80.6', 9, 2, '0.470085225');
|
||||
t('447162', 7, 4, '0.9642869');
|
||||
t('6856.6636666666626606066666', 6, 6, '-0.137265');
|
||||
t('7.37514', 7, 4, '0.4607514');
|
||||
t('1.29', 3, 4, '0.277');
|
||||
t('9', 10, 5, '-0.9111302619');
|
||||
t('5067', 4, 0, '-0.9254');
|
||||
t('482222222222.62217863079410578', 3, 1, '-0.997');
|
||||
t('4.2202926299999999999959999999999999999999999999999999990999999999999999999999', 10, 6, '-0.4724745315');
|
||||
t('24714170816959', 8, 1, '-0.99806747');
|
||||
t('31365220956895733422', 5, 3, '0.99149');
|
||||
t('377469441384376095492196870000863.83493122', 1, 0, '0.8');
|
||||
t('0.1175', 1, 1, '0.9');
|
||||
t('223953406565183766798339942076619761', 5, 4, '0.77106');
|
||||
t('9.4', 7, 0, '-0.9996931');
|
||||
t('67777777777777733221519976680533200000000000', 7, 4, '0.883886');
|
||||
t('3', 7, 0, '-0.9899925');
|
||||
t('99127.77777', 8, 3, '-0.44933878');
|
||||
t('95555555550.5555555515555555555555555555550055555555555560555555559', 3, 0, '0.0823');
|
||||
t('1.3830713', 3, 5, '0.187');
|
||||
t('59', 9, 5, '-0.771080223');
|
||||
t('1.1', 7, 1, '0.4535961');
|
||||
t('1090000000000000000000000000000000000050000000.00004', 4, 1, '0.9972');
|
||||
t('8', 1, 6, '-0.1');
|
||||
t('43019456219304869332859776', 8, 1, '-0.99906433');
|
||||
t('0.0000003104573823727508545651739730202238202717472186710001424', 7, 4, '1');
|
||||
t('81888888888.5555555555555555511111111111111111114304', 8, 6, '0.86581506');
|
||||
t('848765718488021014558633685913717744363956181398886593', 5, 0, '-0.97123');
|
||||
t('0.4338', 69, 3, '0.907375081713258312704647471639381401468307894324094984616218937905432');
|
||||
t('6647167168310148646127', 41, 1, '-0.67876552621688089570465682794229097436017');
|
||||
t('14', 44, 5, '0.13673721820783359424892887667173824055164518');
|
||||
t('0.815', 74, 3, '0.68586839345673735262969403373783813324713582642679411838288343756307680681');
|
||||
t('52666376666220.66', 8, 2, '-0.46217165');
|
||||
t('0.1', 58, 6, '0.9950041652780257660955619878038702948385762254150840359594');
|
||||
t('5.481638560270924097', 46, 5, '0.6955963080641265200604938991229596548878269881');
|
||||
t('616019185645542611168895104511361.514', 73, 0, '-0.9897418432019178091874564214082330932214823767149588163455308944210649199');
|
||||
t('58872.6729', 27, 5, '0.71551991401684231627099417');
|
||||
t('0.00000000986995340365791470449236832278868084019660524206930178008', 33, 1, '0.999999999999999951292009904810772');
|
||||
t('200000000000000000000', 24, 1, '0.167301557725715824849981');
|
||||
t('8712357290413741268816184846819797318515482698552148280140735653', 57, 0, '-0.279047254515165435013067136950333012052507338721363544685');
|
||||
t('0.0177165009539797142337288907', 37, 1, '0.9998430669018118198896427823538202954');
|
||||
t('255555555555555775027123062979747796598651156132669853568621902', 14, 2, '-0.99883756464211');
|
||||
t('3741565840746605.71876151239588', 15, 0, '-0.930123581114026');
|
||||
t('3050000000000000000000200000000000000000000.0000000000000000000000008', 41, 3, '-0.33127228153577434134804953378906485886176');
|
||||
t('0.33482', 27, 4, '0.944469472783453774254728912');
|
||||
t('0.1979574070039662', 30, 0, '0.980470333633282159348863278164');
|
||||
t('960492.3601219999999', 74, 6, '0.78272168046024997208016985369610426247753755795663609587331768113997535495');
|
||||
t('0.1145342', 57, 0, '0.993448125551484394628225244895937689399175688856818869855');
|
||||
t('99999999999999999999999.99', 70, 0, '-0.7059760628345569635155393670172360201795320597371430862306924466086157');
|
||||
t('0.10859933721171128209598967066', 80, 4, '0.99410888528803407646108267824473898405842663808987770888683180574685964084716924');
|
||||
t('2813920.875088303362819', 33, 2, '-0.866254989781355498995879756871368');
|
||||
t('35999999999999999999999999999999999999999.999999999999999999999999919', 38, 3, '-0.9562598584240982386154988349219959087');
|
||||
|
||||
T.stop();
|
||||
T.stop();
|
||||
})();
|
||||
|
@ -1,125 +1,124 @@
|
||||
if (typeof T === 'undefined') require('../setup');
|
||||
|
||||
(function () {
|
||||
T('cosh');
|
||||
T('cosh');
|
||||
|
||||
function t(n, pr, rm, expected) {
|
||||
Decimal.precision = pr;
|
||||
Decimal.rounding = rm;
|
||||
T.assertEqual(expected, Decimal.cosh(n).valueOf());
|
||||
T.assertEqual(expected, new Decimal(n).cosh().valueOf());
|
||||
}
|
||||
function t(n, pr, rm, expected) {
|
||||
Decimal.precision = pr;
|
||||
Decimal.rounding = rm;
|
||||
T.assertEqual(expected, new Decimal(n).cosh().valueOf());
|
||||
}
|
||||
|
||||
Decimal.config({
|
||||
precision: 40,
|
||||
rounding: 4,
|
||||
toExpNeg: -9e15,
|
||||
toExpPos: 9e15,
|
||||
minE: -9e15,
|
||||
maxE: 9e15
|
||||
});
|
||||
Decimal.config({
|
||||
precision: 40,
|
||||
rounding: 4,
|
||||
toExpNeg: -9e15,
|
||||
toExpPos: 9e15,
|
||||
minE: -9e15,
|
||||
maxE: 9e15
|
||||
});
|
||||
|
||||
t('NaN', 40, 4, 'NaN');
|
||||
t('0', 20, 4, '1');
|
||||
t('-0', 20, 4, '1');
|
||||
t('Infinity', 40, 4, 'Infinity');
|
||||
t('-Infinity', 40, 4, 'Infinity');
|
||||
t('NaN', 40, 4, 'NaN');
|
||||
t('0', 20, 4, '1');
|
||||
t('-0', 20, 4, '1');
|
||||
t('Infinity', 40, 4, 'Infinity');
|
||||
t('-Infinity', 40, 4, 'Infinity');
|
||||
|
||||
t('0.7356369431260767888795717715533948998814', 4, 2, '1.284');
|
||||
t('0.32350325607614', 8, 2, '1.0527852');
|
||||
t('0.39', 10, 3, '1.077018834');
|
||||
t('-0.4085', 1, 3, '1');
|
||||
t('-0.8353225329554414512103907831003554564', 10, 1, '1.369646055');
|
||||
t('0.822765764301886756212368544717371789849053470184', 1, 2, '2');
|
||||
t('-0.608417', 2, 3, '1.1');
|
||||
t('-0.3135167132332845', 4, 1, '1.049');
|
||||
t('-0.3872949', 5, 6, '1.0759');
|
||||
t('-0.69', 5, 2, '1.2477');
|
||||
t('-0.6767082617749', 8, 6, '1.2378392');
|
||||
t('-0.8808', 8, 5, '1.4136402');
|
||||
t('0.49600945701356094984359748395247735156888479861846043140472804537060894678', 6, 5, '1.12556');
|
||||
t('0.046', 8, 6, '1.0010582');
|
||||
t('0.9873815', 5, 3, '1.5283');
|
||||
t('0.8784', 10, 5, '1.411246223');
|
||||
t('0.7', 7, 3, '1.255169');
|
||||
t('-0.503676971304', 2, 4, '1.1');
|
||||
t('-0.52', 9, 0, '1.1382741');
|
||||
t('0.335', 5, 3, '1.0566');
|
||||
t('0.54503134222707683066822814099005615624557424312284166822346112986570184867578297341372133058', 8, 4, '1.152243');
|
||||
t('0.140170026295214447428649742547694034916', 3, 3, '1');
|
||||
t('0.9749', 8, 1, '1.514066');
|
||||
t('0.45175', 1, 6, '1');
|
||||
t('-0.519253467128781061573541633704', 2, 4, '1.1');
|
||||
t('-0.406127947', 8, 4, '1.0836098');
|
||||
t('0.9879237062663941347586862695316948803970665245072293680153692819868', 1, 6, '2');
|
||||
t('0.93872862', 6, 2, '1.47393');
|
||||
t('-0.3444', 2, 1, '1');
|
||||
t('0.08916117467145186539045806046188938916876705938558151882', 3, 4, '1');
|
||||
t('-0.416', 5, 0, '1.0878');
|
||||
t('0.96395116729510741473428', 7, 2, '1.50171');
|
||||
t('0.99122709843935', 6, 6, '1.53283');
|
||||
t('-0.982458257490853554631770530367962387675296749498661808', 4, 2, '1.523');
|
||||
t('-0.499', 9, 1, '1.12710543');
|
||||
t('0.2', 10, 4, '1.020066756');
|
||||
t('0.32898510410686170443107121609290058087988034054', 1, 2, '2');
|
||||
t('-0.5054805141', 4, 0, '1.131');
|
||||
t('0.905453421072444252766729099661770268735489121', 5, 2, '1.4388');
|
||||
t('0.8', 8, 4, '1.3374349');
|
||||
t('-0.92256', 9, 6, '1.45661127');
|
||||
t('-0.3', 3, 1, '1.04');
|
||||
t('-0.8022', 6, 0, '1.3394');
|
||||
t('0.280279125313444767164013539810445145153395088331', 9, 6, '1.039536');
|
||||
t('0.922', 9, 0, '1.4560184');
|
||||
t('-0.3831639', 2, 3, '1');
|
||||
t('-0.116822455409380771652804478024770757014', 9, 2, '1.00683151');
|
||||
t('-0.6271139128871161107740496', 6, 6, '1.20317');
|
||||
t('-0.365006', 6, 4, '1.06736');
|
||||
t('0.2851921', 4, 0, '1.041');
|
||||
t('0.8341406563142720368', 9, 6, '1.36854088');
|
||||
t('0.91', 4, 3, '1.443');
|
||||
t('-0.578095765576', 3, 2, '1.18');
|
||||
t('-0.5523113', 1, 2, '2');
|
||||
t('0.8820775602347211771265107133401152251168847255764663', 3, 1, '1.41');
|
||||
t('0.6', 6, 6, '1.18547');
|
||||
t('0.9519214874557153045994771268316705218216663716829234702503703405', 4, 4, '1.488');
|
||||
t('-0.3218817', 3, 2, '1.06');
|
||||
t('0.44351821336668159678862896314345092', 3, 4, '1.1');
|
||||
t('0.3049381299213785', 53, 1, '1.0468550263953477301259281776879206575932575051887101');
|
||||
t('0.26099', 10, 5, '1.034251653');
|
||||
t('-0.144401442746890126', 19, 4, '1.010444017455030066');
|
||||
t('-0.5714572371177476181814955346898484074259146899385956872902543373645059', 73, 5, '1.167773824213016730263000463935976580681778400516250742892039174797873742');
|
||||
t('-0.86979236712642165283', 49, 1, '1.402726925102945094675128817370785304534247058512');
|
||||
t('-0.9152145856049272208', 69, 0, '1.44887088581511840041990778954419353285403899090899859306282037305997');
|
||||
t('0.387335806024227799329046192853758455983606', 5, 2, '1.076');
|
||||
t('0.388975556466', 66, 5, '1.07660966083264696675091150003451244766269524553188412387790834976');
|
||||
t('0.33160669064983873525', 31, 6, '1.055487176550956129534144973298');
|
||||
t('-0.28019', 70, 5, '1.039510693535834131464819444254660971197184738177259681537805828091364');
|
||||
t('0.0343866155482285230161896002936333091757205795137', 120, 5, '1.0005912779235089895769422420654318600732389756527372429232171774523704748559241986434711131587505267979139253999862614');
|
||||
t('-0.75527206899549804249272338314789674457252085843936589751993516463961504230583153756146668708760395655590486810061', 106, 2, '1.29903660802276993760774110068399331119553878155671711944963582837840404664230951744751300716828764841588');
|
||||
t('-0.83084942449681844413114311598350904971957', 93, 6, '1.36547331079818409968059488018604532655176218338970363279898668882713647242007579671435739185');
|
||||
t('-0.98844124605395210760378949114', 131, 2, '1.5295995535325468391822464280546813045893064120694053640627522765165675183539459515034055077956555297594529493277522750037125717944');
|
||||
t('-0.229408429422973', 52, 2, '1.026429721818672220645820449684681483193384767884207');
|
||||
t('-0.8795273546479571', 109, 6, '1.412369739179125250038557346407853960447139468646550916478036613726909366980231455652343138412407973670167567');
|
||||
t('0.08734', 48, 3, '1.00381656302446278617584212015393654314148839114');
|
||||
t('-0.62885554240228925749059660488815716811800585603869', 110, 5, '1.2043323206984141503358874585487300913633309056345327254563876032684247394072689488447245272709777045418471248');
|
||||
t('0.736352757166802915869146657898488678037', 144, 5, '1.28358114765511064759744597771942942566178143747193954192893000446178314298730052934993653082205769261457701471805410675980773447720532092970925');
|
||||
t('-0.03585', 71, 4, '1.000642680077818347803829459573033542748786958454887675462988399590914');
|
||||
t('-0.0688528', 140, 6, '1.0023712906116182102872252559253654170023868298415419690478795554725602053890197559688480320707763057478441774639116768661635006893735054584');
|
||||
t('0.0168267352', 5, 2, '1.0002');
|
||||
t('-0.29337986744607176495268228205202618529507623296114708105478490669140318050037567584175308798414405821808486964207338344736952978297599188171', 6, 0, '1.04335');
|
||||
t('0.86878215121864496587492106526718403062818412998115479876941611922436896770420563647660680761', 75, 0, '1.40173390305230312316107861896321531639504128694271018346467019916830918736');
|
||||
t('0.2', 13, 5, '1.020066755619');
|
||||
t('0.7186693973416109381775823439368505900019443708610142063266365964635806721', 64, 2, '1.269550877565823873829899249395373137692396168326956113337601496');
|
||||
t('-0.6081', 33, 3, '1.19066105804760103593649377284751');
|
||||
t('0.33638979922638509091106475953810395641998150066065089020973699789581749159274904445966819915958672238151012655263653519891140163', 56, 0, '1.0571145964853011640156635194135243640222120068086141542');
|
||||
t('-0.528693621225218634808351766034027', 14, 0, '1.1430443609004');
|
||||
t('-0.143173097658174034133478578859895', 139, 6, '1.01026678782935959075629127133465981817550372382865818357596044596268912805753877412874535411755367732759740274249043367842083642626220661');
|
||||
t('0.2', 26, 6, '1.0200667556190758462955038');
|
||||
t('-0.888665339961', 143, 6, '1.4215429767257970529790075871798024719315334083688503048535857341028009449476701044589860625229223409387411810670578448660839797632491579578644');
|
||||
t('-0.8927373765563130228171556137613812', 76, 4, '1.425668910210701385640797102156834965294078876259114606262240531040574444596');
|
||||
t('0.9', 103, 1, '1.433086385448774387841790401624048341627737841305230594247417192533449635356864305114609711796244033432');
|
||||
t('-0.833291445811118155331699076307265315671094768698998', 48, 2, '1.36774796193155903463660933986762434999452033326');
|
||||
t('-0.7', 66, 6, '1.25516900563094301816467474099029711586260477992884178681185039895');
|
||||
t('0.7356369431260767888795717715533948998814', 4, 2, '1.284');
|
||||
t('0.32350325607614', 8, 2, '1.0527852');
|
||||
t('0.39', 10, 3, '1.077018834');
|
||||
t('-0.4085', 1, 3, '1');
|
||||
t('-0.8353225329554414512103907831003554564', 10, 1, '1.369646055');
|
||||
t('0.822765764301886756212368544717371789849053470184', 1, 2, '2');
|
||||
t('-0.608417', 2, 3, '1.1');
|
||||
t('-0.3135167132332845', 4, 1, '1.049');
|
||||
t('-0.3872949', 5, 6, '1.0759');
|
||||
t('-0.69', 5, 2, '1.2477');
|
||||
t('-0.6767082617749', 8, 6, '1.2378392');
|
||||
t('-0.8808', 8, 5, '1.4136402');
|
||||
t('0.49600945701356094984359748395247735156888479861846043140472804537060894678', 6, 5, '1.12556');
|
||||
t('0.046', 8, 6, '1.0010582');
|
||||
t('0.9873815', 5, 3, '1.5283');
|
||||
t('0.8784', 10, 5, '1.411246223');
|
||||
t('0.7', 7, 3, '1.255169');
|
||||
t('-0.503676971304', 2, 4, '1.1');
|
||||
t('-0.52', 9, 0, '1.1382741');
|
||||
t('0.335', 5, 3, '1.0566');
|
||||
t('0.54503134222707683066822814099005615624557424312284166822346112986570184867578297341372133058', 8, 4, '1.152243');
|
||||
t('0.140170026295214447428649742547694034916', 3, 3, '1');
|
||||
t('0.9749', 8, 1, '1.514066');
|
||||
t('0.45175', 1, 6, '1');
|
||||
t('-0.519253467128781061573541633704', 2, 4, '1.1');
|
||||
t('-0.406127947', 8, 4, '1.0836098');
|
||||
t('0.9879237062663941347586862695316948803970665245072293680153692819868', 1, 6, '2');
|
||||
t('0.93872862', 6, 2, '1.47393');
|
||||
t('-0.3444', 2, 1, '1');
|
||||
t('0.08916117467145186539045806046188938916876705938558151882', 3, 4, '1');
|
||||
t('-0.416', 5, 0, '1.0878');
|
||||
t('0.96395116729510741473428', 7, 2, '1.50171');
|
||||
t('0.99122709843935', 6, 6, '1.53283');
|
||||
t('-0.982458257490853554631770530367962387675296749498661808', 4, 2, '1.523');
|
||||
t('-0.499', 9, 1, '1.12710543');
|
||||
t('0.2', 10, 4, '1.020066756');
|
||||
t('0.32898510410686170443107121609290058087988034054', 1, 2, '2');
|
||||
t('-0.5054805141', 4, 0, '1.131');
|
||||
t('0.905453421072444252766729099661770268735489121', 5, 2, '1.4388');
|
||||
t('0.8', 8, 4, '1.3374349');
|
||||
t('-0.92256', 9, 6, '1.45661127');
|
||||
t('-0.3', 3, 1, '1.04');
|
||||
t('-0.8022', 6, 0, '1.3394');
|
||||
t('0.280279125313444767164013539810445145153395088331', 9, 6, '1.039536');
|
||||
t('0.922', 9, 0, '1.4560184');
|
||||
t('-0.3831639', 2, 3, '1');
|
||||
t('-0.116822455409380771652804478024770757014', 9, 2, '1.00683151');
|
||||
t('-0.6271139128871161107740496', 6, 6, '1.20317');
|
||||
t('-0.365006', 6, 4, '1.06736');
|
||||
t('0.2851921', 4, 0, '1.041');
|
||||
t('0.8341406563142720368', 9, 6, '1.36854088');
|
||||
t('0.91', 4, 3, '1.443');
|
||||
t('-0.578095765576', 3, 2, '1.18');
|
||||
t('-0.5523113', 1, 2, '2');
|
||||
t('0.8820775602347211771265107133401152251168847255764663', 3, 1, '1.41');
|
||||
t('0.6', 6, 6, '1.18547');
|
||||
t('0.9519214874557153045994771268316705218216663716829234702503703405', 4, 4, '1.488');
|
||||
t('-0.3218817', 3, 2, '1.06');
|
||||
t('0.44351821336668159678862896314345092', 3, 4, '1.1');
|
||||
t('0.3049381299213785', 53, 1, '1.0468550263953477301259281776879206575932575051887101');
|
||||
t('0.26099', 10, 5, '1.034251653');
|
||||
t('-0.144401442746890126', 19, 4, '1.010444017455030066');
|
||||
t('-0.5714572371177476181814955346898484074259146899385956872902543373645059', 73, 5, '1.167773824213016730263000463935976580681778400516250742892039174797873742');
|
||||
t('-0.86979236712642165283', 49, 1, '1.402726925102945094675128817370785304534247058512');
|
||||
t('-0.9152145856049272208', 69, 0, '1.44887088581511840041990778954419353285403899090899859306282037305997');
|
||||
t('0.387335806024227799329046192853758455983606', 5, 2, '1.076');
|
||||
t('0.388975556466', 66, 5, '1.07660966083264696675091150003451244766269524553188412387790834976');
|
||||
t('0.33160669064983873525', 31, 6, '1.055487176550956129534144973298');
|
||||
t('-0.28019', 70, 5, '1.039510693535834131464819444254660971197184738177259681537805828091364');
|
||||
t('0.0343866155482285230161896002936333091757205795137', 120, 5, '1.0005912779235089895769422420654318600732389756527372429232171774523704748559241986434711131587505267979139253999862614');
|
||||
t('-0.75527206899549804249272338314789674457252085843936589751993516463961504230583153756146668708760395655590486810061', 106, 2, '1.29903660802276993760774110068399331119553878155671711944963582837840404664230951744751300716828764841588');
|
||||
t('-0.83084942449681844413114311598350904971957', 93, 6, '1.36547331079818409968059488018604532655176218338970363279898668882713647242007579671435739185');
|
||||
t('-0.98844124605395210760378949114', 131, 2, '1.5295995535325468391822464280546813045893064120694053640627522765165675183539459515034055077956555297594529493277522750037125717944');
|
||||
t('-0.229408429422973', 52, 2, '1.026429721818672220645820449684681483193384767884207');
|
||||
t('-0.8795273546479571', 109, 6, '1.412369739179125250038557346407853960447139468646550916478036613726909366980231455652343138412407973670167567');
|
||||
t('0.08734', 48, 3, '1.00381656302446278617584212015393654314148839114');
|
||||
t('-0.62885554240228925749059660488815716811800585603869', 110, 5, '1.2043323206984141503358874585487300913633309056345327254563876032684247394072689488447245272709777045418471248');
|
||||
t('0.736352757166802915869146657898488678037', 144, 5, '1.28358114765511064759744597771942942566178143747193954192893000446178314298730052934993653082205769261457701471805410675980773447720532092970925');
|
||||
t('-0.03585', 71, 4, '1.000642680077818347803829459573033542748786958454887675462988399590914');
|
||||
t('-0.0688528', 140, 6, '1.0023712906116182102872252559253654170023868298415419690478795554725602053890197559688480320707763057478441774639116768661635006893735054584');
|
||||
t('0.0168267352', 5, 2, '1.0002');
|
||||
t('-0.29337986744607176495268228205202618529507623296114708105478490669140318050037567584175308798414405821808486964207338344736952978297599188171', 6, 0, '1.04335');
|
||||
t('0.86878215121864496587492106526718403062818412998115479876941611922436896770420563647660680761', 75, 0, '1.40173390305230312316107861896321531639504128694271018346467019916830918736');
|
||||
t('0.2', 13, 5, '1.020066755619');
|
||||
t('0.7186693973416109381775823439368505900019443708610142063266365964635806721', 64, 2, '1.269550877565823873829899249395373137692396168326956113337601496');
|
||||
t('-0.6081', 33, 3, '1.19066105804760103593649377284751');
|
||||
t('0.33638979922638509091106475953810395641998150066065089020973699789581749159274904445966819915958672238151012655263653519891140163', 56, 0, '1.0571145964853011640156635194135243640222120068086141542');
|
||||
t('-0.528693621225218634808351766034027', 14, 0, '1.1430443609004');
|
||||
t('-0.143173097658174034133478578859895', 139, 6, '1.01026678782935959075629127133465981817550372382865818357596044596268912805753877412874535411755367732759740274249043367842083642626220661');
|
||||
t('0.2', 26, 6, '1.0200667556190758462955038');
|
||||
t('-0.888665339961', 143, 6, '1.4215429767257970529790075871798024719315334083688503048535857341028009449476701044589860625229223409387411810670578448660839797632491579578644');
|
||||
t('-0.8927373765563130228171556137613812', 76, 4, '1.425668910210701385640797102156834965294078876259114606262240531040574444596');
|
||||
t('0.9', 103, 1, '1.433086385448774387841790401624048341627737841305230594247417192533449635356864305114609711796244033432');
|
||||
t('-0.833291445811118155331699076307265315671094768698998', 48, 2, '1.36774796193155903463660933986762434999452033326');
|
||||
t('-0.7', 66, 6, '1.25516900563094301816467474099029711586260477992884178681185039895');
|
||||
|
||||
T.stop();
|
||||
T.stop();
|
||||
})();
|
||||
|
2047
test/modules/div.js
2047
test/modules/div.js
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,73 +1,73 @@
|
||||
if (typeof T === 'undefined') require('../setup');
|
||||
|
||||
(function () {
|
||||
T('decimalPlaces and precision');
|
||||
T('decimalPlaces and precision');
|
||||
|
||||
function t(n, dp, sd, zs) {
|
||||
T.assertEqual(dp, new Decimal(n).dp());
|
||||
T.assertEqual(dp, new Decimal(n).decimalPlaces());
|
||||
T.assertEqual(sd, new Decimal(n).sd(zs));
|
||||
T.assertEqual(sd, new Decimal(n).precision(zs));
|
||||
}
|
||||
function t(n, dp, sd, zs) {
|
||||
T.assertEqual(dp, new Decimal(n).dp());
|
||||
T.assertEqual(dp, new Decimal(n).decimalPlaces());
|
||||
T.assertEqual(sd, new Decimal(n).sd(zs));
|
||||
T.assertEqual(sd, new Decimal(n).precision(zs));
|
||||
}
|
||||
|
||||
function tx(fn, msg) {
|
||||
T.assertException(fn, msg);
|
||||
}
|
||||
function tx(fn, msg) {
|
||||
T.assertException(fn, msg);
|
||||
}
|
||||
|
||||
Decimal.config({
|
||||
precision: 20,
|
||||
rounding: 4,
|
||||
toExpNeg: -7,
|
||||
toExpPos: 21,
|
||||
minE: -9e15,
|
||||
maxE: 9e15
|
||||
});
|
||||
Decimal.config({
|
||||
precision: 20,
|
||||
rounding: 4,
|
||||
toExpNeg: -7,
|
||||
toExpPos: 21,
|
||||
minE: -9e15,
|
||||
maxE: 9e15
|
||||
});
|
||||
|
||||
t(0, 0, 1);
|
||||
t(-0, 0, 1);
|
||||
t(NaN, NaN, NaN);
|
||||
t(Infinity, NaN, NaN);
|
||||
t(-Infinity, NaN, NaN);
|
||||
t(1, 0, 1);
|
||||
t(-1, 0, 1);
|
||||
t(0, 0, 1);
|
||||
t(-0, 0, 1);
|
||||
t(NaN, NaN, NaN);
|
||||
t(Infinity, NaN, NaN);
|
||||
t(-Infinity, NaN, NaN);
|
||||
t(1, 0, 1);
|
||||
t(-1, 0, 1);
|
||||
|
||||
t(100, 0, 1);
|
||||
t(100, 0, 1, 0);
|
||||
t(100, 0, 1, false);
|
||||
t(100, 0, 3, 1);
|
||||
t(100, 0, 3, true);
|
||||
t(100, 0, 1);
|
||||
t(100, 0, 1, 0);
|
||||
t(100, 0, 1, false);
|
||||
t(100, 0, 3, 1);
|
||||
t(100, 0, 3, true);
|
||||
|
||||
t('0.0012345689', 10, 8);
|
||||
t('0.0012345689', 10, 8, 0);
|
||||
t('0.0012345689', 10, 8, false);
|
||||
t('0.0012345689', 10, 8, 1);
|
||||
t('0.0012345689', 10, 8, true);
|
||||
t('0.0012345689', 10, 8);
|
||||
t('0.0012345689', 10, 8, 0);
|
||||
t('0.0012345689', 10, 8, false);
|
||||
t('0.0012345689', 10, 8, 1);
|
||||
t('0.0012345689', 10, 8, true);
|
||||
|
||||
t('987654321000000.0012345689000001', 16, 31, 0);
|
||||
t('987654321000000.0012345689000001', 16, 31, 1);
|
||||
t('987654321000000.0012345689000001', 16, 31, 0);
|
||||
t('987654321000000.0012345689000001', 16, 31, 1);
|
||||
|
||||
t('1e+123', 0, 1);
|
||||
t('1e+123', 0, 124, 1);
|
||||
t('1e-123', 123, 1);
|
||||
t('1e-123', 123, 1, 1);
|
||||
t('1e+123', 0, 1);
|
||||
t('1e+123', 0, 124, 1);
|
||||
t('1e-123', 123, 1);
|
||||
t('1e-123', 123, 1, 1);
|
||||
|
||||
t('9.9999e+9000000000000000', 0, 5, false);
|
||||
t('9.9999e+9000000000000000', 0, 9000000000000001, true);
|
||||
t('-9.9999e+9000000000000000', 0, 5, false);
|
||||
t('-9.9999e+9000000000000000', 0, 9000000000000001, true);
|
||||
t('9.9999e+9000000000000000', 0, 5, false);
|
||||
t('9.9999e+9000000000000000', 0, 9000000000000001, true);
|
||||
t('-9.9999e+9000000000000000', 0, 5, false);
|
||||
t('-9.9999e+9000000000000000', 0, 9000000000000001, true);
|
||||
|
||||
t('1e-9000000000000000', 9e15, 1, false);
|
||||
t('1e-9000000000000000', 9e15, 1, true);
|
||||
t('-1e-9000000000000000', 9e15, 1, false);
|
||||
t('-1e-9000000000000000', 9e15, 1, true);
|
||||
t('1e-9000000000000000', 9e15, 1, false);
|
||||
t('1e-9000000000000000', 9e15, 1, true);
|
||||
t('-1e-9000000000000000', 9e15, 1, false);
|
||||
t('-1e-9000000000000000', 9e15, 1, true);
|
||||
|
||||
t('55325252050000000000000000000000.000000004534500000001', 21, 53);
|
||||
t('55325252050000000000000000000000.000000004534500000001', 21, 53);
|
||||
|
||||
tx(function () {new Decimal(1).precision(null)}, "new Decimal(1).precision(null)");
|
||||
tx(function () {new Decimal(1).sd(null)}, "new Decimal(1).sd(null)");
|
||||
tx(function () {new Decimal(1).sd(2)}, "new Decimal(1).sd(2)");
|
||||
tx(function () {new Decimal(1).sd('3')}, "new Decimal(1).sd('3')");
|
||||
tx(function () {new Decimal(1).sd({})}, "new Decimal(1).sd({})");
|
||||
tx(function () {new Decimal(1).precision(null)}, "new Decimal(1).precision(null)");
|
||||
tx(function () {new Decimal(1).sd(null)}, "new Decimal(1).sd(null)");
|
||||
tx(function () {new Decimal(1).sd(2)}, "new Decimal(1).sd(2)");
|
||||
tx(function () {new Decimal(1).sd('3')}, "new Decimal(1).sd('3')");
|
||||
tx(function () {new Decimal(1).sd({})}, "new Decimal(1).sd({})");
|
||||
|
||||
T.stop();
|
||||
T.stop();
|
||||
})();
|
||||
|
@ -1,147 +1,144 @@
|
||||
if (typeof T === 'undefined') require('../setup');
|
||||
|
||||
(function () {
|
||||
T('exp');
|
||||
T('exp');
|
||||
|
||||
function t(n, expected, pr, rm) {
|
||||
Decimal.precision = pr;
|
||||
Decimal.rounding = rm;
|
||||
var x = new Decimal(n);
|
||||
T.assertEqual(expected, x.exp().valueOf());
|
||||
T.assertEqual(expected, Decimal.exp(n).valueOf());
|
||||
T.assert(x.eq(n) || x.isNaN());
|
||||
}
|
||||
function t(n, expected, pr, rm) {
|
||||
Decimal.precision = pr;
|
||||
Decimal.rounding = rm;
|
||||
T.assertEqual(expected, new Decimal(n).exp().valueOf());
|
||||
}
|
||||
|
||||
Decimal.config({
|
||||
precision: 40,
|
||||
rounding: 4,
|
||||
toExpNeg: -9e15,
|
||||
toExpPos: 9e15,
|
||||
minE: -9e15,
|
||||
maxE: 9e15
|
||||
});
|
||||
Decimal.config({
|
||||
precision: 40,
|
||||
rounding: 4,
|
||||
toExpNeg: -9e15,
|
||||
toExpPos: 9e15,
|
||||
minE: -9e15,
|
||||
maxE: 9e15
|
||||
});
|
||||
|
||||
t('0', '1', 40, 4);
|
||||
t('0', String(Math.exp(0)), 40, 4);
|
||||
t('-0', '1', 40, 4);
|
||||
t('-0', String(Math.exp(-0)), 40, 4);
|
||||
t('Infinity', 'Infinity', 40, 4);
|
||||
t('Infinity', String(Math.exp(Infinity)), 40, 4);
|
||||
t('-Infinity', '0', 40, 4);
|
||||
t('-Infinity', String(Math.exp(-Infinity)), 40, 4);
|
||||
t('NaN', 'NaN', 40, 4);
|
||||
t('NaN', String(Math.exp(NaN)), 40, 4);
|
||||
t('1', '2.718281828459045235360287471352662497757', 40, 4);
|
||||
t('0', '1', 40, 4);
|
||||
t('0', String(Math.exp(0)), 40, 4);
|
||||
t('-0', '1', 40, 4);
|
||||
t('-0', String(Math.exp(-0)), 40, 4);
|
||||
t('Infinity', 'Infinity', 40, 4);
|
||||
t('Infinity', String(Math.exp(Infinity)), 40, 4);
|
||||
t('-Infinity', '0', 40, 4);
|
||||
t('-Infinity', String(Math.exp(-Infinity)), 40, 4);
|
||||
t('NaN', 'NaN', 40, 4);
|
||||
t('NaN', String(Math.exp(NaN)), 40, 4);
|
||||
t('1', '2.718281828459045235360287471352662497757', 40, 4);
|
||||
|
||||
t('4.504575', '90.42990317191332252519829', 25, 5);
|
||||
t('6.3936622751479561979', '598.04277120550571020949043340838952845520759628012', 50, 4);
|
||||
t('0.000000000000000004', '1.000000000000000004000000000000000008001', 40, 2);
|
||||
t('0.9', '2.45960311115694966380012656360247069542177230644', 48, 1);
|
||||
t('-0.0000000000000005', '0.999999999999999500000000000000124', 33, 1);
|
||||
t('-0.00000000000000000001', '0.99999999999999999999000000000000000000004999', 44, 3);
|
||||
t('-0.000000000000004', '0.999999999999996000000000000008', 31, 0);
|
||||
t('-0.0000000000000000006', '0.99999', 5, 3);
|
||||
t('0.0000000000000000006', '1', 5, 3);
|
||||
t('-0.0000003', '1', 1, 4);
|
||||
t('4.504575', '90.42990317191332252519829', 25, 5);
|
||||
t('6.3936622751479561979', '598.04277120550571020949043340838952845520759628012', 50, 4);
|
||||
t('0.000000000000000004', '1.000000000000000004000000000000000008001', 40, 2);
|
||||
t('0.9', '2.45960311115694966380012656360247069542177230644', 48, 1);
|
||||
t('-0.0000000000000005', '0.999999999999999500000000000000124', 33, 1);
|
||||
t('-0.00000000000000000001', '0.99999999999999999999000000000000000000004999', 44, 3);
|
||||
t('-0.000000000000004', '0.999999999999996000000000000008', 31, 0);
|
||||
t('-0.0000000000000000006', '0.99999', 5, 3);
|
||||
t('0.0000000000000000006', '1', 5, 3);
|
||||
t('-0.0000003', '1', 1, 4);
|
||||
|
||||
// Initial exponent estimate incorrect by -1
|
||||
t('20.72326583694641116', '1000000000.0000000038', 20, 1);
|
||||
// Initial exponent estimate incorrect by -1
|
||||
t('20.72326583694641116', '1000000000.0000000038', 20, 1);
|
||||
|
||||
// Initial exponent estimate incorrect by +1
|
||||
t('-27.6310211159285483', '0.000000000000999', 3, 1);
|
||||
// Initial exponent estimate incorrect by +1
|
||||
t('-27.6310211159285483', '0.000000000000999', 3, 1);
|
||||
|
||||
t('-0.9', '0.40656965974059911188345423964562', 32, 1);
|
||||
t('-0.00000000000005', '0.999', 3, 3);
|
||||
t('-0.9999999999999999', '0.367879441171442358383467887305694866395394004', 45, 4);
|
||||
t('-0.99999', '0.36788311998424806939070532012638041', 35, 3);
|
||||
t('-0.00000000001', '0.99999999999000000000004999999999983333333333375', 49, 2);
|
||||
t('-0.9999999999999', '0.367879441171479109539640916233017625680100198337', 48, 0);
|
||||
t('-0.999999999', '0.36787944153932176295090581241', 29, 0);
|
||||
t('-0.0000000003', '0.9999999997000000001', 19, 2);
|
||||
t('-0.0000001', '0.99999990000000499999983333333749999991667', 41, 2);
|
||||
t('-0.0000000000000001', '0.9999999999999999', 26, 1);
|
||||
t('-0.999999999999999', '0.36788', 5, 2);
|
||||
t('-0.999999999', '0.367879441539321762951', 21, 4);
|
||||
t('-0.000000000001', '0.9999999999990000000000005', 31, 0);
|
||||
t('-0.1', '0.9048374180359595731642491', 25, 0);
|
||||
t('-0.99999999', '0.36787944485', 12, 3);
|
||||
t('-0.99999999', '0.36787944485023675170391910600205499737', 38, 0);
|
||||
t('-0.1', '0.9048374180359595731642491', 25, 0);
|
||||
t('-0.9', '0.4065696597', 10, 3);
|
||||
t('-0.9999999999999', '0.367879441171479', 15, 3);
|
||||
t('-0.99', '0.371576691022045690531524119908201386918028', 42, 3);
|
||||
t('-0.999999999999999', '0.3678794411714426894749649417', 28, 0);
|
||||
t('-0.9', '0.4', 2, 1);
|
||||
t('-0.00000000009', '0.99999', 5, 1);
|
||||
t('0.9', '2.45960311115694966380012656360247069542177230644', 48, 1);
|
||||
t('40.95984262795251', '614658133673303019.41715', 23, 1);
|
||||
t('50.57728', '9234930123395249855007.64784227728909958776637', 45, 0);
|
||||
t('-9.295952106254287693', '0.00009179505707794839996147521992', 28, 3);
|
||||
t('-0.9', '0.40656965974059911188345423964562', 32, 1);
|
||||
t('-0.00000000000005', '0.999', 3, 3);
|
||||
t('-0.9999999999999999', '0.367879441171442358383467887305694866395394004', 45, 4);
|
||||
t('-0.99999', '0.36788311998424806939070532012638041', 35, 3);
|
||||
t('-0.00000000001', '0.99999999999000000000004999999999983333333333375', 49, 2);
|
||||
t('-0.9999999999999', '0.367879441171479109539640916233017625680100198337', 48, 0);
|
||||
t('-0.999999999', '0.36787944153932176295090581241', 29, 0);
|
||||
t('-0.0000000003', '0.9999999997000000001', 19, 2);
|
||||
t('-0.0000001', '0.99999990000000499999983333333749999991667', 41, 2);
|
||||
t('-0.0000000000000001', '0.9999999999999999', 26, 1);
|
||||
t('-0.999999999999999', '0.36788', 5, 2);
|
||||
t('-0.999999999', '0.367879441539321762951', 21, 4);
|
||||
t('-0.000000000001', '0.9999999999990000000000005', 31, 0);
|
||||
t('-0.1', '0.9048374180359595731642491', 25, 0);
|
||||
t('-0.99999999', '0.36787944485', 12, 3);
|
||||
t('-0.99999999', '0.36787944485023675170391910600205499737', 38, 0);
|
||||
t('-0.1', '0.9048374180359595731642491', 25, 0);
|
||||
t('-0.9', '0.4065696597', 10, 3);
|
||||
t('-0.9999999999999', '0.367879441171479', 15, 3);
|
||||
t('-0.99', '0.371576691022045690531524119908201386918028', 42, 3);
|
||||
t('-0.999999999999999', '0.3678794411714426894749649417', 28, 0);
|
||||
t('-0.9', '0.4', 2, 1);
|
||||
t('-0.00000000009', '0.99999', 5, 1);
|
||||
t('0.9', '2.45960311115694966380012656360247069542177230644', 48, 1);
|
||||
t('40.95984262795251', '614658133673303019.41715', 23, 1);
|
||||
t('50.57728', '9234930123395249855007.64784227728909958776637', 45, 0);
|
||||
t('-9.295952106254287693', '0.00009179505707794839996147521992', 28, 3);
|
||||
|
||||
t('24.429', '40679902037.5', 12, 1);
|
||||
t('3.085347', '21.875056169741656067', 20, 2);
|
||||
t('6.079163', '436.663554324263441178', 21, 0);
|
||||
t('0.89588138', '2.4494937731', 11, 5);
|
||||
t('3.06', '21.3', 3, 4);
|
||||
t('0.828620743', '2.2901578446832146', 17, 6);
|
||||
t('0.8747', '2.39815573', 9, 1);
|
||||
t('4', '54.5', 3, 3);
|
||||
t('1.74023', '5.698653962365493026791', 22, 3);
|
||||
t('0.3178134', '1.37411982654', 12, 5);
|
||||
t('1.0212228', '2.77658790066265475', 18, 0);
|
||||
t('2.8', '16.444646771097049871498016', 26, 6);
|
||||
t('2', '7.389', 5, 1);
|
||||
t('2.13349', '8.44428600324102919', 19, 1);
|
||||
t('1.0306766', '2.8029617', 8, 4);
|
||||
t('1.38629371', '3.99999739553', 12, 0);
|
||||
t('2.140864956', '8.5', 2, 4);
|
||||
t('1', '2.7182818284590452353602874713', 29, 1);
|
||||
t('2.8', '16.4446467711', 13, 4);
|
||||
t('1.7923271', '6.0034067514286690274238254973', 29, 0);
|
||||
t('2', '7.38905609893065', 15, 4);
|
||||
t('1.839758663', '6.2950188567239', 14, 1);
|
||||
t('3.1541', '23.4319388536798', 15, 3);
|
||||
t('6.23103', '508.27874', 8, 1);
|
||||
t('0.15', '1.16183424272828312261663', 24, 0);
|
||||
t('3.6454', '38.298089', 8, 4);
|
||||
t('2.8086602', '16.5877', 6, 2);
|
||||
t('1', '2.71828182845904523536', 22, 4);
|
||||
t('3.712', '40.9355959021562903', 19, 2);
|
||||
t('1.742336005', '5.71066800248', 12, 5);
|
||||
t('24.429', '40679902037.5', 12, 1);
|
||||
t('3.085347', '21.875056169741656067', 20, 2);
|
||||
t('6.079163', '436.663554324263441178', 21, 0);
|
||||
t('0.89588138', '2.4494937731', 11, 5);
|
||||
t('3.06', '21.3', 3, 4);
|
||||
t('0.828620743', '2.2901578446832146', 17, 6);
|
||||
t('0.8747', '2.39815573', 9, 1);
|
||||
t('4', '54.5', 3, 3);
|
||||
t('1.74023', '5.698653962365493026791', 22, 3);
|
||||
t('0.3178134', '1.37411982654', 12, 5);
|
||||
t('1.0212228', '2.77658790066265475', 18, 0);
|
||||
t('2.8', '16.444646771097049871498016', 26, 6);
|
||||
t('2', '7.389', 5, 1);
|
||||
t('2.13349', '8.44428600324102919', 19, 1);
|
||||
t('1.0306766', '2.8029617', 8, 4);
|
||||
t('1.38629371', '3.99999739553', 12, 0);
|
||||
t('2.140864956', '8.5', 2, 4);
|
||||
t('1', '2.7182818284590452353602874713', 29, 1);
|
||||
t('2.8', '16.4446467711', 13, 4);
|
||||
t('1.7923271', '6.0034067514286690274238254973', 29, 0);
|
||||
t('2', '7.38905609893065', 15, 4);
|
||||
t('1.839758663', '6.2950188567239', 14, 1);
|
||||
t('3.1541', '23.4319388536798', 15, 3);
|
||||
t('6.23103', '508.27874', 8, 1);
|
||||
t('0.15', '1.16183424272828312261663', 24, 0);
|
||||
t('3.6454', '38.298089', 8, 4);
|
||||
t('2.8086602', '16.5877', 6, 2);
|
||||
t('1', '2.71828182845904523536', 22, 4);
|
||||
t('3.712', '40.9355959021562903', 19, 2);
|
||||
t('1.742336005', '5.71066800248', 12, 5);
|
||||
|
||||
t('67.0234090932359557332', '129000000000000000000000000000', 3, 2);
|
||||
t('6.4350484439574', '623.3127778698531510658792212713024749828103299', 46, 3);
|
||||
t('-90.6147801309103528', '0.0000000000000000000000000000000000000004430992452392223286671364132586', 31, 0);
|
||||
t('52.6735295600', '75131702520984694212520.839', 26, 5);
|
||||
t('4.91754742409', '136.667015585278752656929641054712859399847337855456678258883', 60, 0);
|
||||
t('-8.291786018917236430647515856', '0.0002505', 4, 3);
|
||||
t('67.0234090932359557332', '129000000000000000000000000000', 3, 2);
|
||||
t('6.4350484439574', '623.3127778698531510658792212713024749828103299', 46, 3);
|
||||
t('-90.6147801309103528', '0.0000000000000000000000000000000000000004430992452392223286671364132586', 31, 0);
|
||||
t('52.6735295600', '75131702520984694212520.839', 26, 5);
|
||||
t('4.91754742409', '136.667015585278752656929641054712859399847337855456678258883', 60, 0);
|
||||
t('-8.291786018917236430647515856', '0.0002505', 4, 3);
|
||||
|
||||
Decimal.toExpNeg = Decimal.toExpPos = 0;
|
||||
Decimal.toExpNeg = Decimal.toExpPos = 0;
|
||||
|
||||
// Max integer argument
|
||||
t('20723265836946413', '6.3207512951460243608e+9000000000000000', 20, 4);
|
||||
// Max integer argument
|
||||
t('20723265836946413', '6.3207512951460243608e+9000000000000000', 20, 4);
|
||||
|
||||
// Min integer argument
|
||||
t('-20723265836946411', '1.1690154783664756563e-9000000000000000', 20, 4);
|
||||
// Min integer argument
|
||||
t('-20723265836946411', '1.1690154783664756563e-9000000000000000', 20, 4);
|
||||
|
||||
t('2.08E+16', 'Infinity', 10, 1);
|
||||
t('9.99999999e+9000000000000000', 'Infinity', 100, 4);
|
||||
t('2.08E+16', 'Infinity', 10, 1);
|
||||
t('9.99999999e+9000000000000000', 'Infinity', 100, 4);
|
||||
|
||||
t('-2.08E+16', '0e+0', 10, 1);
|
||||
t('1e-9000000000000000', '1e+0', 10, 1);
|
||||
t('-2.08E+16', '0e+0', 10, 1);
|
||||
t('1e-9000000000000000', '1e+0', 10, 1);
|
||||
|
||||
// Initial exponent estimate incorrect by +1
|
||||
t('2302585095.29663062096', '9.999998439e+1000000000', 10, 1);
|
||||
// Initial exponent estimate incorrect by +1
|
||||
t('2302585095.29663062096', '9.999998439e+1000000000', 10, 1);
|
||||
|
||||
// Initial exponent estimate incorrect by -1
|
||||
t('557.22559250455906', '1.0000000000000044e+242', 17, 1);
|
||||
// Initial exponent estimate incorrect by -1
|
||||
t('557.22559250455906', '1.0000000000000044e+242', 17, 1);
|
||||
|
||||
t('-7.2204571E-4550853476128405', '9.99999e-1', 6, 1);
|
||||
t('-1.239848698043325450682384840', '2.894280056499551869832955260486309228756785711877e-1', 49, 2);
|
||||
t('-358219354.0214584957674057041104824439823073474823', '1.7279578060422445345064581640966e-155572689', 32, 3);
|
||||
t('8.82661445434039879925209590467500361019097244359748402', '6.813181388774733211e+3', 19, 6);
|
||||
t('9.02366224E-9', '1.00000000902366228071324023326175156155718e+0', 43, 6);
|
||||
t('-4.4768686752786086271180252E+574398129049502', '0e+0', 15, 3);
|
||||
t('-7.2204571E-4550853476128405', '9.99999e-1', 6, 1);
|
||||
t('-1.239848698043325450682384840', '2.894280056499551869832955260486309228756785711877e-1', 49, 2);
|
||||
t('-358219354.0214584957674057041104824439823073474823', '1.7279578060422445345064581640966e-155572689', 32, 3);
|
||||
t('8.82661445434039879925209590467500361019097244359748402', '6.813181388774733211e+3', 19, 6);
|
||||
t('9.02366224E-9', '1.00000000902366228071324023326175156155718e+0', 43, 6);
|
||||
t('-4.4768686752786086271180252E+574398129049502', '0e+0', 15, 3);
|
||||
|
||||
T.stop();
|
||||
T.stop();
|
||||
})();
|
||||
|
@ -1,129 +1,128 @@
|
||||
if (typeof T === 'undefined') require('../setup');
|
||||
|
||||
(function () {
|
||||
T('floor');
|
||||
T('floor');
|
||||
|
||||
function t(expected, n) {
|
||||
T.assertEqual(expected, Decimal.floor(n).valueOf());
|
||||
T.assertEqual(expected, new Decimal(n).floor().valueOf());
|
||||
}
|
||||
function t(expected, n) {
|
||||
T.assertEqual(expected, new Decimal(n).floor().valueOf());
|
||||
}
|
||||
|
||||
Decimal.config({
|
||||
precision: 20,
|
||||
rounding: 4,
|
||||
toExpNeg: -1e3,
|
||||
toExpPos: 1e3,
|
||||
minE: -9e15,
|
||||
maxE: 9e15
|
||||
});
|
||||
Decimal.config({
|
||||
precision: 20,
|
||||
rounding: 4,
|
||||
toExpNeg: -1e3,
|
||||
toExpPos: 1e3,
|
||||
minE: -9e15,
|
||||
maxE: 9e15
|
||||
});
|
||||
|
||||
t('0', 0);
|
||||
t('-0', -0);
|
||||
t('0', '0.000');
|
||||
t('Infinity', Infinity);
|
||||
t('-Infinity', -Infinity);
|
||||
t('NaN', NaN);
|
||||
t('0', 0);
|
||||
t('-0', -0);
|
||||
t('0', '0.000');
|
||||
t('Infinity', Infinity);
|
||||
t('-Infinity', -Infinity);
|
||||
t('NaN', NaN);
|
||||
|
||||
t('0', 0.1);
|
||||
t('0', '0.49999999999999994');
|
||||
t('0', 0.5);
|
||||
t('0', 0.7);
|
||||
t('-1', -0.1);
|
||||
t('-1', '-0.49999999999999994');
|
||||
t('-1', -0.5);
|
||||
t('-1', -0.7);
|
||||
t('1', 1);
|
||||
t('1', 1.1);
|
||||
t('1', 1.5);
|
||||
t('1', 1.7);
|
||||
t('-1', -1);
|
||||
t('-2', -1.1);
|
||||
t('-2', -1.5);
|
||||
t('-2', -1.7);
|
||||
t('0', 0.1);
|
||||
t('0', '0.49999999999999994');
|
||||
t('0', 0.5);
|
||||
t('0', 0.7);
|
||||
t('-1', -0.1);
|
||||
t('-1', '-0.49999999999999994');
|
||||
t('-1', -0.5);
|
||||
t('-1', -0.7);
|
||||
t('1', 1);
|
||||
t('1', 1.1);
|
||||
t('1', 1.5);
|
||||
t('1', 1.7);
|
||||
t('-1', -1);
|
||||
t('-2', -1.1);
|
||||
t('-2', -1.5);
|
||||
t('-2', -1.7);
|
||||
|
||||
t('1', '1.0000000000000000000000001');
|
||||
t('0', 0.999999999999);
|
||||
t('9', '9.999999999999');
|
||||
t('123456', 123456.789);
|
||||
t('-2', '-1.0000000000000000000000001');
|
||||
t('-1', -0.999999999999);
|
||||
t('-10', '-9.999999999999');
|
||||
t('-123457', -123456.789);
|
||||
t('1', '1.0000000000000000000000001');
|
||||
t('0', 0.999999999999);
|
||||
t('9', '9.999999999999');
|
||||
t('123456', 123456.789);
|
||||
t('-2', '-1.0000000000000000000000001');
|
||||
t('-1', -0.999999999999);
|
||||
t('-10', '-9.999999999999');
|
||||
t('-123457', -123456.789);
|
||||
|
||||
t('-2075365', '-2075364.364286541923');
|
||||
t('60593539780450631', '60593539780450631');
|
||||
t('65937898671515', '65937898671515');
|
||||
t('-39719494751819198566799', '-39719494751819198566798.578');
|
||||
t('92627382695288166556', '92627382695288166556.8683774524284866028260448205069');
|
||||
t('-881574', '-881574');
|
||||
t('-3633239210', '-3633239209.654526163275621746013315304191073405508491056');
|
||||
t('-23970335459820625362', '-23970335459820625362');
|
||||
t('131869457416154038', '131869457416154038');
|
||||
t('-2685', '-2685');
|
||||
t('-4542227861', '-4542227860.9511298545226');
|
||||
t('-834103872107533086', '-834103872107533086');
|
||||
t('-1501493189970436', '-1501493189970435.74866616700317');
|
||||
t('70591', '70591.2244675522123484658978887');
|
||||
t('4446128540401735117', '4446128540401735117.435836700611264749985822486641350492901');
|
||||
t('-597273', '-597273');
|
||||
t('729117', '729117.5');
|
||||
t('-729118', '-729117.001');
|
||||
t('4803729546823170064608098091', '4803729546823170064608098091');
|
||||
t('-6581532150677269472830', '-6581532150677269472829.38194951340848938896000325718062365494');
|
||||
t('2949426983040959', '2949426983040959.8911208825380208568451907');
|
||||
t('25166', '25166.125888418871654557352055849116604612621573251770362');
|
||||
t('4560569286495', '4560569286495.98300685103599898554605198');
|
||||
t('13', '13.763105480576616251068323541559825687');
|
||||
t('9050999219306', '9050999219306.7846946346757664893036971777');
|
||||
t('39900924', '39900924.00000005');
|
||||
t('115911043168452445', '115911043168452445');
|
||||
t('20962819101135667464733349383', '20962819101135667464733349383.8959025798517496777183');
|
||||
t('4125789711001606948191', '4125789711001606948191.4707575965791242737346836');
|
||||
t('-6935502', '-6935501.294727166142750626019282');
|
||||
t('-2', '-1.518418076611593764852321765899');
|
||||
t('-35416', '-35416');
|
||||
t('6912783515683955988122411164548', '6912783515683955988122411164548.393');
|
||||
t('657', '657.0353902852');
|
||||
t('0', '0.00000000000000000000000017921822306362413915');
|
||||
t('1483059355427939255846407887', '1483059355427939255846407887.011361095342689876');
|
||||
t('7.722e+999999999999999', '7.722e+999999999999999');
|
||||
t('7722', '7722');
|
||||
t('0', '0.00000005');
|
||||
t('8551283060956479352', '8551283060956479352.5707396');
|
||||
t('0', '0.000000000000000000000000019904267');
|
||||
t('321978830777554620127500539', '321978830777554620127500539.339278568133088682532238002577');
|
||||
t('2073', '2073.532654804291079327244387978249477171032485250998396');
|
||||
t('677676305591', '677676305591.2');
|
||||
t('39181479479778357', '39181479479778357');
|
||||
t('0', '0.00000000000000000087964700066672916651');
|
||||
t('115083055948552475', '115083055948552475');
|
||||
t('9105942082143427451223', '9105942082143427451223');
|
||||
t('0', '0.00000000000000000000004');
|
||||
t('0', '0.000250427721966583680168028884692015623739');
|
||||
t('0', '0.000000000001585613219016120158734661293405081934');
|
||||
t('0', '0.00009');
|
||||
t('0', '0.000000090358252973411013592234');
|
||||
t('276312604693909858427', '276312604693909858427.21965306055697011390137926559');
|
||||
t('0', '0.0000252');
|
||||
t('1', '1.9999999999');
|
||||
t('-2075365', '-2075364.364286541923');
|
||||
t('60593539780450631', '60593539780450631');
|
||||
t('65937898671515', '65937898671515');
|
||||
t('-39719494751819198566799', '-39719494751819198566798.578');
|
||||
t('92627382695288166556', '92627382695288166556.8683774524284866028260448205069');
|
||||
t('-881574', '-881574');
|
||||
t('-3633239210', '-3633239209.654526163275621746013315304191073405508491056');
|
||||
t('-23970335459820625362', '-23970335459820625362');
|
||||
t('131869457416154038', '131869457416154038');
|
||||
t('-2685', '-2685');
|
||||
t('-4542227861', '-4542227860.9511298545226');
|
||||
t('-834103872107533086', '-834103872107533086');
|
||||
t('-1501493189970436', '-1501493189970435.74866616700317');
|
||||
t('70591', '70591.2244675522123484658978887');
|
||||
t('4446128540401735117', '4446128540401735117.435836700611264749985822486641350492901');
|
||||
t('-597273', '-597273');
|
||||
t('729117', '729117.5');
|
||||
t('-729118', '-729117.001');
|
||||
t('4803729546823170064608098091', '4803729546823170064608098091');
|
||||
t('-6581532150677269472830', '-6581532150677269472829.38194951340848938896000325718062365494');
|
||||
t('2949426983040959', '2949426983040959.8911208825380208568451907');
|
||||
t('25166', '25166.125888418871654557352055849116604612621573251770362');
|
||||
t('4560569286495', '4560569286495.98300685103599898554605198');
|
||||
t('13', '13.763105480576616251068323541559825687');
|
||||
t('9050999219306', '9050999219306.7846946346757664893036971777');
|
||||
t('39900924', '39900924.00000005');
|
||||
t('115911043168452445', '115911043168452445');
|
||||
t('20962819101135667464733349383', '20962819101135667464733349383.8959025798517496777183');
|
||||
t('4125789711001606948191', '4125789711001606948191.4707575965791242737346836');
|
||||
t('-6935502', '-6935501.294727166142750626019282');
|
||||
t('-2', '-1.518418076611593764852321765899');
|
||||
t('-35416', '-35416');
|
||||
t('6912783515683955988122411164548', '6912783515683955988122411164548.393');
|
||||
t('657', '657.0353902852');
|
||||
t('0', '0.00000000000000000000000017921822306362413915');
|
||||
t('1483059355427939255846407887', '1483059355427939255846407887.011361095342689876');
|
||||
t('7.722e+999999999999999', '7.722e+999999999999999');
|
||||
t('7722', '7722');
|
||||
t('0', '0.00000005');
|
||||
t('8551283060956479352', '8551283060956479352.5707396');
|
||||
t('0', '0.000000000000000000000000019904267');
|
||||
t('321978830777554620127500539', '321978830777554620127500539.339278568133088682532238002577');
|
||||
t('2073', '2073.532654804291079327244387978249477171032485250998396');
|
||||
t('677676305591', '677676305591.2');
|
||||
t('39181479479778357', '39181479479778357');
|
||||
t('0', '0.00000000000000000087964700066672916651');
|
||||
t('115083055948552475', '115083055948552475');
|
||||
t('9105942082143427451223', '9105942082143427451223');
|
||||
t('0', '0.00000000000000000000004');
|
||||
t('0', '0.000250427721966583680168028884692015623739');
|
||||
t('0', '0.000000000001585613219016120158734661293405081934');
|
||||
t('0', '0.00009');
|
||||
t('0', '0.000000090358252973411013592234');
|
||||
t('276312604693909858427', '276312604693909858427.21965306055697011390137926559');
|
||||
t('0', '0.0000252');
|
||||
t('1', '1.9999999999');
|
||||
|
||||
Decimal.toExpNeg = -100;
|
||||
Decimal.toExpPos = 100;
|
||||
Decimal.toExpNeg = -100;
|
||||
Decimal.toExpPos = 100;
|
||||
|
||||
t('-1', -1e-308);
|
||||
t('-1e+308', -1e308);
|
||||
t('2.1e+308', '2.1e308');
|
||||
t('-1', '-1e-999');
|
||||
t('0', '1e-999');
|
||||
t('0', '1e-9000000000000000');
|
||||
t('-1', '-1e-9000000000000000');
|
||||
t('-0', '-9.9e-9000000000000001'); // underflow to zero
|
||||
t('9.999999e+9000000000000000', '9.999999e+9000000000000000');
|
||||
t('-9.999999e+9000000000000000', '-9.999999e+9000000000000000');
|
||||
t('Infinity', '1E9000000000000001');
|
||||
t('-Infinity', '-1e+9000000000000001');
|
||||
t('5.5879983320336874473209567979e+287894365', '5.5879983320336874473209567979e+287894365');
|
||||
t('-5.5879983320336874473209567979e+287894365', '-5.5879983320336874473209567979e+287894365');
|
||||
t('-1', -1e-308);
|
||||
t('-1e+308', -1e308);
|
||||
t('2.1e+308', '2.1e308');
|
||||
t('-1', '-1e-999');
|
||||
t('0', '1e-999');
|
||||
t('0', '1e-9000000000000000');
|
||||
t('-1', '-1e-9000000000000000');
|
||||
t('-0', '-9.9e-9000000000000001'); // underflow to zero
|
||||
t('9.999999e+9000000000000000', '9.999999e+9000000000000000');
|
||||
t('-9.999999e+9000000000000000', '-9.999999e+9000000000000000');
|
||||
t('Infinity', '1E9000000000000001');
|
||||
t('-Infinity', '-1e+9000000000000001');
|
||||
t('5.5879983320336874473209567979e+287894365', '5.5879983320336874473209567979e+287894365');
|
||||
t('-5.5879983320336874473209567979e+287894365', '-5.5879983320336874473209567979e+287894365');
|
||||
|
||||
T.stop();
|
||||
T.stop();
|
||||
})();
|
||||
|
@ -1,49 +1,46 @@
|
||||
if (typeof T === 'undefined') require('../setup');
|
||||
|
||||
(function () {
|
||||
T('fromJSON');
|
||||
T('fromJSON');
|
||||
|
||||
Decimal.config({
|
||||
//crypto: true,
|
||||
precision: Math.random() * 40 + 1 | 0,
|
||||
rounding: Math.random() * 9 | 0,
|
||||
toExpNeg: -7,
|
||||
toExpPos: 21,
|
||||
minE: -9e15,
|
||||
maxE: 9e15
|
||||
});
|
||||
Decimal.config({
|
||||
precision: Math.random() * 40 + 1 | 0,
|
||||
rounding: Math.random() * 9 | 0,
|
||||
toExpNeg: -7,
|
||||
toExpPos: 21,
|
||||
minE: -9e15,
|
||||
maxE: 9e15
|
||||
});
|
||||
|
||||
var e, fromJ, i, r, toJ;
|
||||
var maxDigits = 100;
|
||||
var e, fromJ, i, r, toJ;
|
||||
var maxDigits = 100;
|
||||
|
||||
for ( i = 0; i < 100000; ) {
|
||||
for ( i = 0; i < 100000; ) {
|
||||
|
||||
// Get a random value in the range [0,1) with a random number of significant digits
|
||||
// in the range [1, maxDigits], as a string in exponential format.
|
||||
e = Decimal.random( Math.random() * maxDigits + 1 | 0 ).toExponential();
|
||||
// Get a random value in the range [0,1) with a random number of significant digits
|
||||
// in the range [1, maxDigits], as a string in exponential format.
|
||||
e = Decimal.random( Math.random() * maxDigits + 1 | 0 ).toExponential();
|
||||
|
||||
// Change exponent to a non-zero value of random length in the range (-9e15, 9e15).
|
||||
r = new Decimal(e.slice(0, e.indexOf('e') + 1) + ( Math.random() < 0.5 ? '-' : '' ) +
|
||||
( n = Math.floor( Math.random() * 9e15 ) + '' ).slice( Math.random() * n.length | 0 ));
|
||||
//( n = Math.floor( Math.random() * 40 ) + '' ).slice( Math.random() * n.length | 0 ));
|
||||
// Change exponent to a non-zero value of random length in the range (-9e15, 9e15).
|
||||
r = new Decimal(e.slice(0, e.indexOf('e') + 1) + ( Math.random() < 0.5 ? '-' : '' ) +
|
||||
( n = Math.floor( Math.random() * 9e15 ) + '' ).slice( Math.random() * n.length | 0 ));
|
||||
//console.log(r.toString());
|
||||
|
||||
//console.log(r.toString());
|
||||
toJ = r.toJSON();
|
||||
//console.log(' toJSON: ' + toJ);
|
||||
|
||||
toJ = r.toJSON();
|
||||
//console.log(' toJ: ' + toJ);
|
||||
fromJ = Decimal.fromJSON(toJ);
|
||||
//console.log(' fromJSON: ' + fromJ);
|
||||
|
||||
fromJ = Decimal.fromJSON(toJ);
|
||||
//console.log(' fromJ: ' + fromJ);
|
||||
|
||||
/*
|
||||
if (!r.eq(fromJ)) {
|
||||
console.error(' r: ' + r);
|
||||
console.error(' toJ: ' + toJ);
|
||||
console.error(' fromJ: ' + fromJ);
|
||||
}
|
||||
*/
|
||||
T.assert(r.eq(fromJ));
|
||||
/*
|
||||
if (!r.eq(fromJ)) {
|
||||
console.error(' r: ' + r);
|
||||
console.error(' toJSON: ' + toJ);
|
||||
console.error(' fromJSON: ' + fromJ);
|
||||
}
|
||||
*/
|
||||
T.assert(r.eq(fromJ));
|
||||
}
|
||||
|
||||
T.stop();
|
||||
T.stop();
|
||||
})();
|
||||
|
@ -1,124 +1,124 @@
|
||||
if (typeof T === 'undefined') require('../setup');
|
||||
|
||||
(function () {
|
||||
T('hypot');
|
||||
T('hypot');
|
||||
|
||||
function t(a, b, pr, rm, expected) {
|
||||
Decimal.precision = pr;
|
||||
Decimal.rounding = rm;
|
||||
T.assertEqual(expected, Decimal.hypot(a, b).valueOf());
|
||||
}
|
||||
function t(a, b, pr, rm, expected) {
|
||||
Decimal.precision = pr;
|
||||
Decimal.rounding = rm;
|
||||
T.assertEqual(expected, Decimal.hypot(a, b).valueOf());
|
||||
}
|
||||
|
||||
Decimal.config({
|
||||
precision: 40,
|
||||
rounding: 4,
|
||||
toExpNeg: -9e15,
|
||||
toExpPos: 9e15,
|
||||
minE: -9e15,
|
||||
maxE: 9e15
|
||||
});
|
||||
Decimal.config({
|
||||
precision: 40,
|
||||
rounding: 4,
|
||||
toExpNeg: -9e15,
|
||||
toExpPos: 9e15,
|
||||
minE: -9e15,
|
||||
maxE: 9e15
|
||||
});
|
||||
|
||||
t('1', 'NaN', 20, 4, 'NaN');
|
||||
t('NaN', '1', 20, 4, 'NaN');
|
||||
t('Infinity', 'NaN', 20, 4, 'Infinity');
|
||||
t('NaN', '-Infinity', 20, 4, 'Infinity');
|
||||
t('Infinity', '-9', 20, 4, 'Infinity');
|
||||
t('9', 'Infinity', 20, 4, 'Infinity');
|
||||
t('9', '-Infinity', 20, 4, 'Infinity');
|
||||
t('0', '0', 20, 4, '0');
|
||||
t('0', '-0', 20, 4, '0');
|
||||
t('-0', '-0', 20, 4, '0');
|
||||
t('1', 'NaN', 20, 4, 'NaN');
|
||||
t('NaN', '1', 20, 4, 'NaN');
|
||||
t('Infinity', 'NaN', 20, 4, 'Infinity');
|
||||
t('NaN', '-Infinity', 20, 4, 'Infinity');
|
||||
t('Infinity', '-9', 20, 4, 'Infinity');
|
||||
t('9', 'Infinity', 20, 4, 'Infinity');
|
||||
t('9', '-Infinity', 20, 4, 'Infinity');
|
||||
t('0', '0', 20, 4, '0');
|
||||
t('0', '-0', 20, 4, '0');
|
||||
t('-0', '-0', 20, 4, '0');
|
||||
|
||||
t('-73859972487135996812.3348849386076204815086183608621433996131', '-40900275', 92, 4, '73859972487135996812.334896262958542538634842711692934521304033086425417371740907212824629036');
|
||||
t('87777821928367383886207001990043726894046439498880958101', '13100000', 53, 2, '87777821928367383886207001990043726894046439498880959000');
|
||||
t('-9068023035566545177890098186515752036653463863403529285431568942304.1209958989782427940509418772899870623734', '2666666666666.6666666666662666666666666666666666666666766666466666666666666666666666666668', 93, 5, '9068023035566545177890098186515752036653463863403529285431568942304.12099589897824279405094188');
|
||||
t('-19.8731062176484', '-631970.6', 60, 0, '631970.600312467344715323508497215861344293021711284138304041');
|
||||
t('-1111111111111141067315396649709360127244075372005400124355334298632449424416463580266666666666', '-0.0000000015372402412953773290762250418563358319557966420343267849914304381916024954828959476537495440147246975615343391', 43, 0, '1111111111111141067315396649709360127244076000000000000000000000000000000000000000000000000000');
|
||||
t('-0.983064721909232202799884070088', '-1888888888888371106396282947223787931710', 20, 4, '1888888888888371106400000000000000000000');
|
||||
t('861123450449582222', '-3268941330032700177909698138482', 73, 1, '3268941330032700177909698251903.062363755594001549793838456512462423760753');
|
||||
t('-1.759', '-0.1666933060407184714285777825813947232316520181597980844428', 8, 3, '1.7668807');
|
||||
t('0.1852451289933636289285652675346736246965605', '-48506.827382527105658688770367877324273166861983575641312454026244237512829473955620223096782936193504746', 48, 2, '48506.8273828808265642535390473175215096921677017');
|
||||
t('-3000008000000000000000070000000000000000000001000000000000.000000000000002000000000000000000900000000010002', '-802.661566839437264337325468337423185084', 22, 0, '3000008000000000000001000000000000000000000000000000000000');
|
||||
t('-8', '-5482493793', 53, 2, '5482493793.0000000058367599140481142689669647662254134');
|
||||
t('4111111111111111.11111111111611110111171111811111111611', '-0.7801745669150266383906952786894096943691775116027', 26, 1, '4111111111111111.1111111111');
|
||||
t('4649136268549586431953848205459087026588854116776105905', '-0.4538997053719724982993', 76, 4, '4649136268549586431953848205459087026588854116776105905');
|
||||
t('-711281636404745616773671624856748035918060782119438', '0.6011202051617683354856452418581', 80, 0, '711281636404745616773671624856748035918060782119438.00000000000000000000000000001');
|
||||
t('-55102601.0381', '-5160591', 93, 5, '55343729.0091054507509667515051408897750996134016431347788775107555545851579689419350413225929');
|
||||
t('183', '0.6', 22, 3, '183.0009836039139981977');
|
||||
t('4000000000080000000000000000000000', '0.55', 82, 0, '4000000000080000000000000000000000.000000000000000000000000000000000037812499999244');
|
||||
t('-0.55', '-9000000.000000000000000000000000000000000000000000000000000000000000000000000000000009', 62, 1, '9000000.0000000168055555555555398651834705075738799986293162621');
|
||||
t('-0.388099754174217471056249565014913560596333083573199500992', '0.0000363576265205', 75, 0, '0.388099755877229375967849346839104152672911497025034368058113842991365933724');
|
||||
t('52222222222227378067480110037255168691979179742111111111', '-867069820.333078943531805179108670644728376893549909696519412570032111919516568762799', 7, 2, '52222230000000000000000000000000000000000000000000000000');
|
||||
t('-8.0898982865397951925970316274645291728205275567128', '-0.0000945902', 28, 6, '8.089898287092787678956284349');
|
||||
t('-1664553204017852793900913959927482283751', '-933333388888.15884290172642527', 32, 1, '1664553204017852793900913959927400000000');
|
||||
t('-0.09771882084', '-8', 41, 2, '8.000596788236885020873363221344096704335');
|
||||
t('-10.11111111545', '-0.306711465294651568375461540673418284608909142237604855', 98, 2, '10.11576195409518993106696772029199668325921193685867908705991646038726063827463162781415087647978');
|
||||
t('-4437098359999999999993.9999', '-0.2241991', 56, 3, '4437098359999999999993.9999000000000000000000056642012823');
|
||||
t('901390573372408932467350822015112608121945120543338853670905789705602623427861.103187236210204922562771581943724285507586728737018434159395', '-23333333333333333351020223106390010419253302605986582847591694927992733993338709578970900366475156635422035555555', 18, 0, '23333333333333333400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000');
|
||||
t('19999999999999999999999999999999.919999999999999999999', '-95670705629746263190920599520452475212900072593749902459133558626394349560336068069498100861613875411', 24, 6, '95670705629746263190920600000000000000000000000000000000000000000000000000000000000000000000000000000');
|
||||
t('459.273', '9638369683361034.552409', 63, 5, '9638369683361034.55240900001094229083644388522937457239375956406');
|
||||
t('19333333333.33313333333333', '-307058050750', 19, 4, '307666092230.143791');
|
||||
t('-4888.8813611', '61856704783261924843882364363459938129336598998376', 35, 6, '61856704783261924843882364363459938000000000000000');
|
||||
t('-90316963180999999999997999999999999.99999999999999959999999999999999999999999999999', '-899997034414865629076187032', 24, 0, '90316963181000004484176000000000000');
|
||||
t('-0.00001175529004148059889839195560772120687431522218537528816456748920635963047412762382567334499074596992570830887179621917584255805343012605460010989845894713567382571024', '59.8600988774488317444932', 22, 1, '59.86009887744998599287');
|
||||
t('-844444444444445105013379803702088715444444.44444444', '851735648360163016915210118100049528358186144013411569', 13, 2, '851735648360200000000000000000000000000000000000000000');
|
||||
t('-0.1098958603115877986399807307790849607335424187223724689574921530969578406825061416021390586394788741395795498746592063682753064315701974886', '-52222222222222262283923266176757777', 76, 5, '52222222222222262283923266176757777.00000000000000000000000000000000000011563');
|
||||
t('-10027999242546642659855555555555', '-703.824', 25, 3, '10027999242546642659855550000000');
|
||||
t('-17118682794143106193517128.496346472179213795', '19999999999999999997919330.00231406838630646574151545822388888888888888888', 38, 5, '26325829533112365449334045.441841092728');
|
||||
t('0.465596788868', '-9431769081', 29, 3, '9431769081.0000000000114920312');
|
||||
t('-587359.66395', '-0.49568003707000085674015751654640980033', 13, 5, '587359.6639502');
|
||||
t('-0.059956811106228018570509499080322651692489744383276282735', '0.7728191', 54, 5, '0.775141393890713275121528253795513914835075182802874717');
|
||||
t('2222215171676429123638899593785648371510606061543680191659124444444444.6906517318485520720388589138008481347302123923691909983086306231440651', '788888.888888885011536108582122208072284443333', 80, 6, '2222215171676429123638899593785648371510606061543680191659124444444444.6906517318');
|
||||
t('70000000000000010000000000006.100000000000004', '-78957772777.77777777777777777777777777777777777777277771777777777777', 1, 0, '80000000000000000000000000000');
|
||||
t('-41720000000020000000000000000000000000000000000000000700000000000000600000004000000001000000000000060000000000.00080000000000000006', '-46835015.87548144758089751035240583513', 34, 6, '41720000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000');
|
||||
t('28666666666666666666666676666666666666666666666666616666666666666666666.6663666666666666666666666666666666666666666666666664666666666666666666', '-7.8461', 56, 4, '28666666666666666666666676666666666666666666666666616667000000000000000');
|
||||
t('0.6', '-91.5250722217761303', 63, 0, '91.5270388748665715095625471128327141160527733302883072128489811');
|
||||
t('30000.6', '511111111111145686553087261381.999991267342292294981021024064788686134890483114665388298481703', 51, 2, '511111111111145686553087261381.999991267342292294982');
|
||||
t('72926343.726877231000712798686463998173070827809981833334964558342793176683041794308836271', '-82222222222221937444', 49, 2, '82222222222221937444.00003234071924617295968730272');
|
||||
t('-242915822316177763142341053724.3195904798466883740740090079450439', '-299999999999.999999999999999999995999999999999999999999999999990999994', 51, 2, '242915822316177763142341053724.319590665096045830207');
|
||||
t('-306555555555555555555555055555555555555555555555555555559555555555555555555555555555555555555555555555555595555555555555555555555555555555555555555555525555555555555555555555555555555.5555555555', '0.15666773914679673976142669430328125908359330664846715765297103124831482667541495', 15, 3, '306555555555555000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000');
|
||||
t('-5734991.83220402694035812590544522858837047993475498775680667010453187699606727653014592756227908536357219129844096200521', '99399999.699', 55, 0, '99565305.56110721338952690556051338361260372609898394192');
|
||||
t('-0.585223', '9742275700501', 25, 1, '9742275700501');
|
||||
t('-817', '2706343113769608709474153626083514693465686442858333333333333333', 54, 2, '2706343113769608709474153626083514693465686442858333340000000000');
|
||||
t('521999999999199999929999999999999999.99999995999999', '-6777777777777777777777777.777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777770777777775', 54, 2, '521999999999199999930044002175866866.547023411749520706');
|
||||
t('-4516475899411196.1710280841858351554959449', '0.00362', 26, 2, '4516475899411196.1710280842');
|
||||
t('79996999999999999999999999999999999999999999999.999999999999999999299999999999999599999999999999999996', '0.000000006393873924327515206665863616080266830154605167288849831012562983901', 32, 3, '79996999999999999999999999999999000000000000000');
|
||||
t('165014180635256662053.5623866609995456978976014664', '126847933143118145017958510547081.01687771', 82, 2, '126847933143118145017958617879061.6649297630723081683143413440383325550496316428679');
|
||||
t('4444444444.44444444444444444444444444444444444444444444', '0.0000390055319967605996065972540356157510147289248305250742502606', 19, 5, '4444444444.444444444');
|
||||
t('-8905370954396883647914407290800692779839518281513035906502493568844696561439275153317671748655256327646885877826948402873397232451', '0.000000002433575166551955655019349462492613256751863629697572595342683572506451544556497587139362820461701547049759568493058791704546964632763776550260691', 95, 6, '8905370954396883647914407290800692779839518281513035906502493568844696561439275153317671748655300000000000000000000000000000000000');
|
||||
t('700000000', '0.10532749524343436', 67, 4, '700000000.0000000000079242008958969198076099247634079046096355599626');
|
||||
t('9555555555555555555555555555555555555555.55555555555555555555555555555555555555555', '757773470777777777787727.7777777777777747777', 34, 5, '9555555555555555555555555555555586000000');
|
||||
t('-0.297233184499378290751031871', '94444444444450932925402136569369568252675313623114112449951937227491', 57, 4, '94444444444450932925402136569369568252675313623114112450000000000000');
|
||||
t('706.6640602786138076271815698607630793709065809977913853658899180593912800991919896234768331533404376463838897508518404177667748', '589272858', 76, 5, '589272858.0004237205967572977795909916847730224498576503592425079948021269944');
|
||||
t('141421829337978396523958245492.356577241347882862045', '-0.0000009062726880615943999813266035730355189554501814541380840728', 17, 3, '141421829337978390000000000000');
|
||||
t('288888418696038361803537630426270.71151743887471708693463333333333333', '-81195599558835246729685688119938533071101', 8, 4, '81195600000000000000000000000000000000000');
|
||||
t('382666666.66666666666', '-310.351', 17, 2, '382666666.66679252');
|
||||
t('509146', '27974901', 27, 1, '27979533.8704760590941855702');
|
||||
t('600075881745331917265194619524368592248337558828411479126381966442789', '-199999999959999999999999999999999999999999999999.9999999999999999999999999999999999999999999999999999', 68, 5, '600075881745331917265194619524368592248337592157529679693993900861880');
|
||||
t('33333333333333333333933.333', '92675418847792981854934.77651107680859649467120073', 26, 2, '98487787921777255092429.556');
|
||||
t('-194.04494819612983', '87934613325863285610318426691747541751704168685', 55, 3, '87934613325863285610318426691747541751704168685');
|
||||
t('-0.00006', '-9108555555555555755555555555555555555555555555.555855555555565555555555585555555', 69, 5, '9108555555555555755555555555555555555555555555.55585555555556555555556');
|
||||
t('-1867112.3', '-7443151922333351621784797114283077371961143985830384399', 98, 2, '7443151922333351621784797114283077371961143985830384399.0000000000000000000000000000000000000000003');
|
||||
t('0.640650325', '8337529018416437', 88, 1, '8337529018416437.000000000000000024613577836791740925174427714878489185918199187020262415');
|
||||
t('-7.0711298394245347979492394379496305607768672891309791', '-92.5549672712666393257898900443199898401181108080123982312500316214214726463524089322636338782070900725995605695513761536504989976346266550486346671844299550305743931825324317787', 26, 5, '92.824688762156584043556536');
|
||||
t('11.000500000000070000000000000000515', '-928864249591777933822222222', 69, 4, '928864249591777933822222222.000000000000000000000000065139227989011355');
|
||||
t('8.9929999999999999999999999999', '-94444444444444.7777777777777777777444449232900948624986161628952947337337208243', 100, 0, '94444444444444.77777777777820593447444492177895346249764146644605457433165778719182374051141272166291');
|
||||
t('-3', '8000000000', 48, 6, '8000000000.00000000056249999999999999998022460938');
|
||||
t('524224294278833258504244689131128804963', '-0.1964918169532600262422065880715612530725541194753716933743653473301573055', 92, 0, '524224294278833258504244689131128804963.00000000000000000000000000000000000000003682491879045');
|
||||
t('-5563710.400490441356383129065751744241271474147187007959891690143773431654594134378', '234644300000000000.86356426586528430874003818', 73, 4, '234644300000000000.8636302271381993667815855570906197025798452968278931064');
|
||||
t('0.005336508972581768759465256138116638362412237071722728683544001', '-2744818576', 62, 5, '2744818576.0000000000000051876521573143355893278038250258951491');
|
||||
t('6100958683940338086146995110755471006768600255866666666666666666', '95009361293210581532023714', 96, 2, '6100958683940338086146995110755471006768600255866666666666666666.00000000000073978363081733130453');
|
||||
t('4948457219440599111007826250603151703105812225460181157894774181631869', '-500000000050000000000000000000000000.7000000000600000000000000000000000000000000005', 23, 0, '4948457219440599111007900000000000000000000000000000000000000000000000');
|
||||
t('0.000000002979', '-9', 43, 1, '9.000000000000000000493024499999999999986495');
|
||||
t('0.47555305129875312820342601735', '-0.2673085693', 12, 0, '0.545531461807');
|
||||
t('3290866969805582657729329868.97622844503712282586503', '8996300581562651076861828923126756911315531038131347433298', 26, 5, '8996300581562651076861828900000000000000000000000000000000');
|
||||
t('-95721335544.654143365002196', '-1822222', 96, 1, '95721335561.9987248947602645712748098096888624484242375216519098735810157428711542690977103766782');
|
||||
t('0.974893703406145670332688066323452747831483011640048285105884619867888725281346574205291151337004770627960177971', '0.000239596749', 4, 6, '0.9749');
|
||||
t('-0.00012856579', '-21536540290437517549950.6925', 13, 0, '21536540290440000000000');
|
||||
t('6300828.297308463126', '-555138043489683551066925156982819307', 3, 4, '555000000000000000000000000000000000');
|
||||
t('0.4519719010451812700381881242155284703426402593258190987', '92346327717009585478189395590602.34545881237122995324639951758026247635570631069180557087', 55, 4, '92346327717009585478189395590602.3454588123712299532464');
|
||||
t('69398002688216703269792743800286307271116693445111111111111111', '-211393667179764005100083390018873694', 100, 0, '69398002688216703269792743800286307271116693445111111433074862.06409526630410784634920186057594444197');
|
||||
t('0.19', '-5288.143883', 42, 3, '5288.14388641329593020355143132324946951485');
|
||||
t('-73859972487135996812.3348849386076204815086183608621433996131', '-40900275', 92, 4, '73859972487135996812.334896262958542538634842711692934521304033086425417371740907212824629036');
|
||||
t('87777821928367383886207001990043726894046439498880958101', '13100000', 53, 2, '87777821928367383886207001990043726894046439498880959000');
|
||||
t('-9068023035566545177890098186515752036653463863403529285431568942304.1209958989782427940509418772899870623734', '2666666666666.6666666666662666666666666666666666666666766666466666666666666666666666666668', 93, 5, '9068023035566545177890098186515752036653463863403529285431568942304.12099589897824279405094188');
|
||||
t('-19.8731062176484', '-631970.6', 60, 0, '631970.600312467344715323508497215861344293021711284138304041');
|
||||
t('-1111111111111141067315396649709360127244075372005400124355334298632449424416463580266666666666', '-0.0000000015372402412953773290762250418563358319557966420343267849914304381916024954828959476537495440147246975615343391', 43, 0, '1111111111111141067315396649709360127244076000000000000000000000000000000000000000000000000000');
|
||||
t('-0.983064721909232202799884070088', '-1888888888888371106396282947223787931710', 20, 4, '1888888888888371106400000000000000000000');
|
||||
t('861123450449582222', '-3268941330032700177909698138482', 73, 1, '3268941330032700177909698251903.062363755594001549793838456512462423760753');
|
||||
t('-1.759', '-0.1666933060407184714285777825813947232316520181597980844428', 8, 3, '1.7668807');
|
||||
t('0.1852451289933636289285652675346736246965605', '-48506.827382527105658688770367877324273166861983575641312454026244237512829473955620223096782936193504746', 48, 2, '48506.8273828808265642535390473175215096921677017');
|
||||
t('-3000008000000000000000070000000000000000000001000000000000.000000000000002000000000000000000900000000010002', '-802.661566839437264337325468337423185084', 22, 0, '3000008000000000000001000000000000000000000000000000000000');
|
||||
t('-8', '-5482493793', 53, 2, '5482493793.0000000058367599140481142689669647662254134');
|
||||
t('4111111111111111.11111111111611110111171111811111111611', '-0.7801745669150266383906952786894096943691775116027', 26, 1, '4111111111111111.1111111111');
|
||||
t('4649136268549586431953848205459087026588854116776105905', '-0.4538997053719724982993', 76, 4, '4649136268549586431953848205459087026588854116776105905');
|
||||
t('-711281636404745616773671624856748035918060782119438', '0.6011202051617683354856452418581', 80, 0, '711281636404745616773671624856748035918060782119438.00000000000000000000000000001');
|
||||
t('-55102601.0381', '-5160591', 93, 5, '55343729.0091054507509667515051408897750996134016431347788775107555545851579689419350413225929');
|
||||
t('183', '0.6', 22, 3, '183.0009836039139981977');
|
||||
t('4000000000080000000000000000000000', '0.55', 82, 0, '4000000000080000000000000000000000.000000000000000000000000000000000037812499999244');
|
||||
t('-0.55', '-9000000.000000000000000000000000000000000000000000000000000000000000000000000000000009', 62, 1, '9000000.0000000168055555555555398651834705075738799986293162621');
|
||||
t('-0.388099754174217471056249565014913560596333083573199500992', '0.0000363576265205', 75, 0, '0.388099755877229375967849346839104152672911497025034368058113842991365933724');
|
||||
t('52222222222227378067480110037255168691979179742111111111', '-867069820.333078943531805179108670644728376893549909696519412570032111919516568762799', 7, 2, '52222230000000000000000000000000000000000000000000000000');
|
||||
t('-8.0898982865397951925970316274645291728205275567128', '-0.0000945902', 28, 6, '8.089898287092787678956284349');
|
||||
t('-1664553204017852793900913959927482283751', '-933333388888.15884290172642527', 32, 1, '1664553204017852793900913959927400000000');
|
||||
t('-0.09771882084', '-8', 41, 2, '8.000596788236885020873363221344096704335');
|
||||
t('-10.11111111545', '-0.306711465294651568375461540673418284608909142237604855', 98, 2, '10.11576195409518993106696772029199668325921193685867908705991646038726063827463162781415087647978');
|
||||
t('-4437098359999999999993.9999', '-0.2241991', 56, 3, '4437098359999999999993.9999000000000000000000056642012823');
|
||||
t('901390573372408932467350822015112608121945120543338853670905789705602623427861.103187236210204922562771581943724285507586728737018434159395', '-23333333333333333351020223106390010419253302605986582847591694927992733993338709578970900366475156635422035555555', 18, 0, '23333333333333333400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000');
|
||||
t('19999999999999999999999999999999.919999999999999999999', '-95670705629746263190920599520452475212900072593749902459133558626394349560336068069498100861613875411', 24, 6, '95670705629746263190920600000000000000000000000000000000000000000000000000000000000000000000000000000');
|
||||
t('459.273', '9638369683361034.552409', 63, 5, '9638369683361034.55240900001094229083644388522937457239375956406');
|
||||
t('19333333333.33313333333333', '-307058050750', 19, 4, '307666092230.143791');
|
||||
t('-4888.8813611', '61856704783261924843882364363459938129336598998376', 35, 6, '61856704783261924843882364363459938000000000000000');
|
||||
t('-90316963180999999999997999999999999.99999999999999959999999999999999999999999999999', '-899997034414865629076187032', 24, 0, '90316963181000004484176000000000000');
|
||||
t('-0.00001175529004148059889839195560772120687431522218537528816456748920635963047412762382567334499074596992570830887179621917584255805343012605460010989845894713567382571024', '59.8600988774488317444932', 22, 1, '59.86009887744998599287');
|
||||
t('-844444444444445105013379803702088715444444.44444444', '851735648360163016915210118100049528358186144013411569', 13, 2, '851735648360200000000000000000000000000000000000000000');
|
||||
t('-0.1098958603115877986399807307790849607335424187223724689574921530969578406825061416021390586394788741395795498746592063682753064315701974886', '-52222222222222262283923266176757777', 76, 5, '52222222222222262283923266176757777.00000000000000000000000000000000000011563');
|
||||
t('-10027999242546642659855555555555', '-703.824', 25, 3, '10027999242546642659855550000000');
|
||||
t('-17118682794143106193517128.496346472179213795', '19999999999999999997919330.00231406838630646574151545822388888888888888888', 38, 5, '26325829533112365449334045.441841092728');
|
||||
t('0.465596788868', '-9431769081', 29, 3, '9431769081.0000000000114920312');
|
||||
t('-587359.66395', '-0.49568003707000085674015751654640980033', 13, 5, '587359.6639502');
|
||||
t('-0.059956811106228018570509499080322651692489744383276282735', '0.7728191', 54, 5, '0.775141393890713275121528253795513914835075182802874717');
|
||||
t('2222215171676429123638899593785648371510606061543680191659124444444444.6906517318485520720388589138008481347302123923691909983086306231440651', '788888.888888885011536108582122208072284443333', 80, 6, '2222215171676429123638899593785648371510606061543680191659124444444444.6906517318');
|
||||
t('70000000000000010000000000006.100000000000004', '-78957772777.77777777777777777777777777777777777777277771777777777777', 1, 0, '80000000000000000000000000000');
|
||||
t('-41720000000020000000000000000000000000000000000000000700000000000000600000004000000001000000000000060000000000.00080000000000000006', '-46835015.87548144758089751035240583513', 34, 6, '41720000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000');
|
||||
t('28666666666666666666666676666666666666666666666666616666666666666666666.6663666666666666666666666666666666666666666666666664666666666666666666', '-7.8461', 56, 4, '28666666666666666666666676666666666666666666666666616667000000000000000');
|
||||
t('0.6', '-91.5250722217761303', 63, 0, '91.5270388748665715095625471128327141160527733302883072128489811');
|
||||
t('30000.6', '511111111111145686553087261381.999991267342292294981021024064788686134890483114665388298481703', 51, 2, '511111111111145686553087261381.999991267342292294982');
|
||||
t('72926343.726877231000712798686463998173070827809981833334964558342793176683041794308836271', '-82222222222221937444', 49, 2, '82222222222221937444.00003234071924617295968730272');
|
||||
t('-242915822316177763142341053724.3195904798466883740740090079450439', '-299999999999.999999999999999999995999999999999999999999999999990999994', 51, 2, '242915822316177763142341053724.319590665096045830207');
|
||||
t('-306555555555555555555555055555555555555555555555555555559555555555555555555555555555555555555555555555555595555555555555555555555555555555555555555555525555555555555555555555555555555.5555555555', '0.15666773914679673976142669430328125908359330664846715765297103124831482667541495', 15, 3, '306555555555555000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000');
|
||||
t('-5734991.83220402694035812590544522858837047993475498775680667010453187699606727653014592756227908536357219129844096200521', '99399999.699', 55, 0, '99565305.56110721338952690556051338361260372609898394192');
|
||||
t('-0.585223', '9742275700501', 25, 1, '9742275700501');
|
||||
t('-817', '2706343113769608709474153626083514693465686442858333333333333333', 54, 2, '2706343113769608709474153626083514693465686442858333340000000000');
|
||||
t('521999999999199999929999999999999999.99999995999999', '-6777777777777777777777777.777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777770777777775', 54, 2, '521999999999199999930044002175866866.547023411749520706');
|
||||
t('-4516475899411196.1710280841858351554959449', '0.00362', 26, 2, '4516475899411196.1710280842');
|
||||
t('79996999999999999999999999999999999999999999999.999999999999999999299999999999999599999999999999999996', '0.000000006393873924327515206665863616080266830154605167288849831012562983901', 32, 3, '79996999999999999999999999999999000000000000000');
|
||||
t('165014180635256662053.5623866609995456978976014664', '126847933143118145017958510547081.01687771', 82, 2, '126847933143118145017958617879061.6649297630723081683143413440383325550496316428679');
|
||||
t('4444444444.44444444444444444444444444444444444444444444', '0.0000390055319967605996065972540356157510147289248305250742502606', 19, 5, '4444444444.444444444');
|
||||
t('-8905370954396883647914407290800692779839518281513035906502493568844696561439275153317671748655256327646885877826948402873397232451', '0.000000002433575166551955655019349462492613256751863629697572595342683572506451544556497587139362820461701547049759568493058791704546964632763776550260691', 95, 6, '8905370954396883647914407290800692779839518281513035906502493568844696561439275153317671748655300000000000000000000000000000000000');
|
||||
t('700000000', '0.10532749524343436', 67, 4, '700000000.0000000000079242008958969198076099247634079046096355599626');
|
||||
t('9555555555555555555555555555555555555555.55555555555555555555555555555555555555555', '757773470777777777787727.7777777777777747777', 34, 5, '9555555555555555555555555555555586000000');
|
||||
t('-0.297233184499378290751031871', '94444444444450932925402136569369568252675313623114112449951937227491', 57, 4, '94444444444450932925402136569369568252675313623114112450000000000000');
|
||||
t('706.6640602786138076271815698607630793709065809977913853658899180593912800991919896234768331533404376463838897508518404177667748', '589272858', 76, 5, '589272858.0004237205967572977795909916847730224498576503592425079948021269944');
|
||||
t('141421829337978396523958245492.356577241347882862045', '-0.0000009062726880615943999813266035730355189554501814541380840728', 17, 3, '141421829337978390000000000000');
|
||||
t('288888418696038361803537630426270.71151743887471708693463333333333333', '-81195599558835246729685688119938533071101', 8, 4, '81195600000000000000000000000000000000000');
|
||||
t('382666666.66666666666', '-310.351', 17, 2, '382666666.66679252');
|
||||
t('509146', '27974901', 27, 1, '27979533.8704760590941855702');
|
||||
t('600075881745331917265194619524368592248337558828411479126381966442789', '-199999999959999999999999999999999999999999999999.9999999999999999999999999999999999999999999999999999', 68, 5, '600075881745331917265194619524368592248337592157529679693993900861880');
|
||||
t('33333333333333333333933.333', '92675418847792981854934.77651107680859649467120073', 26, 2, '98487787921777255092429.556');
|
||||
t('-194.04494819612983', '87934613325863285610318426691747541751704168685', 55, 3, '87934613325863285610318426691747541751704168685');
|
||||
t('-0.00006', '-9108555555555555755555555555555555555555555555.555855555555565555555555585555555', 69, 5, '9108555555555555755555555555555555555555555555.55585555555556555555556');
|
||||
t('-1867112.3', '-7443151922333351621784797114283077371961143985830384399', 98, 2, '7443151922333351621784797114283077371961143985830384399.0000000000000000000000000000000000000000003');
|
||||
t('0.640650325', '8337529018416437', 88, 1, '8337529018416437.000000000000000024613577836791740925174427714878489185918199187020262415');
|
||||
t('-7.0711298394245347979492394379496305607768672891309791', '-92.5549672712666393257898900443199898401181108080123982312500316214214726463524089322636338782070900725995605695513761536504989976346266550486346671844299550305743931825324317787', 26, 5, '92.824688762156584043556536');
|
||||
t('11.000500000000070000000000000000515', '-928864249591777933822222222', 69, 4, '928864249591777933822222222.000000000000000000000000065139227989011355');
|
||||
t('8.9929999999999999999999999999', '-94444444444444.7777777777777777777444449232900948624986161628952947337337208243', 100, 0, '94444444444444.77777777777820593447444492177895346249764146644605457433165778719182374051141272166291');
|
||||
t('-3', '8000000000', 48, 6, '8000000000.00000000056249999999999999998022460938');
|
||||
t('524224294278833258504244689131128804963', '-0.1964918169532600262422065880715612530725541194753716933743653473301573055', 92, 0, '524224294278833258504244689131128804963.00000000000000000000000000000000000000003682491879045');
|
||||
t('-5563710.400490441356383129065751744241271474147187007959891690143773431654594134378', '234644300000000000.86356426586528430874003818', 73, 4, '234644300000000000.8636302271381993667815855570906197025798452968278931064');
|
||||
t('0.005336508972581768759465256138116638362412237071722728683544001', '-2744818576', 62, 5, '2744818576.0000000000000051876521573143355893278038250258951491');
|
||||
t('6100958683940338086146995110755471006768600255866666666666666666', '95009361293210581532023714', 96, 2, '6100958683940338086146995110755471006768600255866666666666666666.00000000000073978363081733130453');
|
||||
t('4948457219440599111007826250603151703105812225460181157894774181631869', '-500000000050000000000000000000000000.7000000000600000000000000000000000000000000005', 23, 0, '4948457219440599111007900000000000000000000000000000000000000000000000');
|
||||
t('0.000000002979', '-9', 43, 1, '9.000000000000000000493024499999999999986495');
|
||||
t('0.47555305129875312820342601735', '-0.2673085693', 12, 0, '0.545531461807');
|
||||
t('3290866969805582657729329868.97622844503712282586503', '8996300581562651076861828923126756911315531038131347433298', 26, 5, '8996300581562651076861828900000000000000000000000000000000');
|
||||
t('-95721335544.654143365002196', '-1822222', 96, 1, '95721335561.9987248947602645712748098096888624484242375216519098735810157428711542690977103766782');
|
||||
t('0.974893703406145670332688066323452747831483011640048285105884619867888725281346574205291151337004770627960177971', '0.000239596749', 4, 6, '0.9749');
|
||||
t('-0.00012856579', '-21536540290437517549950.6925', 13, 0, '21536540290440000000000');
|
||||
t('6300828.297308463126', '-555138043489683551066925156982819307', 3, 4, '555000000000000000000000000000000000');
|
||||
t('0.4519719010451812700381881242155284703426402593258190987', '92346327717009585478189395590602.34545881237122995324639951758026247635570631069180557087', 55, 4, '92346327717009585478189395590602.3454588123712299532464');
|
||||
t('69398002688216703269792743800286307271116693445111111111111111', '-211393667179764005100083390018873694', 100, 0, '69398002688216703269792743800286307271116693445111111433074862.06409526630410784634920186057594444197');
|
||||
t('0.19', '-5288.143883', 42, 3, '5288.14388641329593020355143132324946951485');
|
||||
|
||||
T.stop();
|
||||
T.stop();
|
||||
})();
|
||||
|
561
test/modules/immutability.js
Normal file
561
test/modules/immutability.js
Normal file
@ -0,0 +1,561 @@
|
||||
// Tests immutability of operand[s] for all applicable methods.
|
||||
// Also tests each Decimal.prototype method against its equivalent Decimal method where applicable.
|
||||
if (typeof T === 'undefined') require('../setup');
|
||||
|
||||
(function () {
|
||||
T('immutability');
|
||||
|
||||
Decimal.config({
|
||||
precision: 20,
|
||||
rounding: 4,
|
||||
toExpNeg: -7,
|
||||
toExpPos: 21,
|
||||
minE: -9e15,
|
||||
maxE: 9e15
|
||||
});
|
||||
|
||||
// Integer [0, 9e15), with each possible number of digits, [1, 16], equally likely.
|
||||
function randInt() {
|
||||
return Math.floor(Math.random() * 9e15 / Math.pow(10, Math.random() * 16 | 0));
|
||||
}
|
||||
|
||||
var a, aa, b, bb, i, k, n, t, v, x, y, z;
|
||||
|
||||
t = T.assertEqualDecimal;
|
||||
|
||||
v = [
|
||||
0,
|
||||
NaN,
|
||||
Infinity,
|
||||
-Infinity,
|
||||
0.5,
|
||||
-0.5,
|
||||
1,
|
||||
-1,
|
||||
(x = Decimal.random()),
|
||||
x.neg(),
|
||||
(x = randInt()),
|
||||
-x,
|
||||
(x = Decimal.random().plus(randInt())),
|
||||
x.neg()
|
||||
];
|
||||
|
||||
for (i = 0; i < v.length; i++) {
|
||||
a = new Decimal(v[i]);
|
||||
aa = new Decimal(v[i]);
|
||||
k = (Math.random() * 10 | 0) / 10;
|
||||
b = k == 0.5 ? new Decimal(a) : a[k < 0.5 ? 'plus' : 'minus'](Decimal.random().plus(randInt()));
|
||||
bb = new Decimal(b);
|
||||
n = Math.random() * 20 + 1 | 0;
|
||||
|
||||
x = a.absoluteValue();
|
||||
t(a, aa);
|
||||
y = a.abs();
|
||||
t(a, aa);
|
||||
z = Decimal.abs(a);
|
||||
t(a, aa);
|
||||
|
||||
t(x, y);
|
||||
t(y, z);
|
||||
|
||||
x = a.ceil();
|
||||
t(a, aa);
|
||||
y = Decimal.ceil(a);
|
||||
t(a, aa);
|
||||
|
||||
t(x, y);
|
||||
|
||||
x = a.comparedTo(b);
|
||||
t(a, aa);
|
||||
t(b, bb);
|
||||
y = a.cmp(b);
|
||||
t(a, aa);
|
||||
t(b, bb);
|
||||
|
||||
T.assertEqual(x, y);
|
||||
|
||||
x = a.cosine();
|
||||
t(a, aa);
|
||||
y = a.cos();
|
||||
t(a, aa);
|
||||
z = Decimal.cos(a);
|
||||
t(a, aa);
|
||||
|
||||
t(x, y);
|
||||
t(y, z);
|
||||
|
||||
x = a.cubeRoot();
|
||||
t(a, aa);
|
||||
y = a.cbrt();
|
||||
t(a, aa);
|
||||
z = Decimal.cbrt(a);
|
||||
t(a, aa);
|
||||
|
||||
t(x, y);
|
||||
t(y, z);
|
||||
|
||||
x = a.decimalPlaces();
|
||||
t(a, aa);
|
||||
y = a.dp();
|
||||
t(a, aa);
|
||||
|
||||
T.assertEqual(x, y);
|
||||
|
||||
x = a.dividedBy(b);
|
||||
t(a, aa);
|
||||
t(b, bb);
|
||||
y = a.div(b);
|
||||
t(a, aa);
|
||||
t(b, bb);
|
||||
z = Decimal.div(a, b);
|
||||
t(a, aa);
|
||||
t(b, bb);
|
||||
|
||||
t(x, y);
|
||||
t(y, z);
|
||||
|
||||
x = a.dividedToIntegerBy(b);
|
||||
t(a, aa);
|
||||
t(b, bb);
|
||||
y = a.divToInt(b);
|
||||
t(a, aa);
|
||||
t(b, bb);
|
||||
|
||||
t(x, y);
|
||||
|
||||
x = a.equals(b);
|
||||
t(a, aa);
|
||||
t(b, bb);
|
||||
y = a.eq(b);
|
||||
t(a, aa);
|
||||
t(b, bb);
|
||||
|
||||
T.assertEqual(x, y);
|
||||
|
||||
x = a.floor();
|
||||
t(a, aa);
|
||||
y = Decimal.floor(a);
|
||||
t(a, aa);
|
||||
|
||||
t(x, y);
|
||||
|
||||
x = a.greaterThan(b);
|
||||
t(a, aa);
|
||||
t(b, bb);
|
||||
y = a.gt(b);
|
||||
t(a, aa);
|
||||
t(b, bb);
|
||||
|
||||
T.assertEqual(x, y);
|
||||
|
||||
x = a.greaterThanOrEqualTo(b);
|
||||
t(a, aa);
|
||||
t(b, bb);
|
||||
y = a.gte(b);
|
||||
t(a, aa);
|
||||
t(b, bb);
|
||||
|
||||
T.assertEqual(x, y);
|
||||
|
||||
// Omit these hyperbolic methods if a is large, as they are too time-consuming.
|
||||
if (a.abs().lt(1000)) {
|
||||
x = a.hyperbolicCosine();
|
||||
t(a, aa);
|
||||
y = a.cosh();
|
||||
t(a, aa);
|
||||
z = Decimal.cosh(a);
|
||||
t(a, aa);
|
||||
|
||||
t(x, y);
|
||||
t(y, z);
|
||||
|
||||
x = a.hyperbolicSine();
|
||||
t(a, aa);
|
||||
y = a.sinh();
|
||||
t(a, aa);
|
||||
z = Decimal.sinh(a);
|
||||
t(a, aa);
|
||||
|
||||
t(x, y);
|
||||
t(y, z);
|
||||
|
||||
x = a.hyperbolicTangent();
|
||||
t(a, aa);
|
||||
y = a.tanh();
|
||||
t(a, aa);
|
||||
z = Decimal.tanh(a);
|
||||
t(a, aa);
|
||||
|
||||
t(x, y);
|
||||
t(y, z);
|
||||
}
|
||||
|
||||
// a [-1, 1]
|
||||
x = a.inverseCosine();
|
||||
t(a, aa);
|
||||
y = a.acos();
|
||||
t(a, aa);
|
||||
z = Decimal.acos(a);
|
||||
t(a, aa);
|
||||
|
||||
t(x, y);
|
||||
t(y, z);
|
||||
|
||||
// a [1, Infinity]
|
||||
x = a.inverseHyperbolicCosine();
|
||||
t(a, aa);
|
||||
y = a.acosh();
|
||||
t(a, aa);
|
||||
z = Decimal.acosh(a);
|
||||
t(a, aa);
|
||||
|
||||
t(x, y);
|
||||
t(y, z);
|
||||
|
||||
x = a.inverseHyperbolicSine();
|
||||
t(a, aa);
|
||||
y = a.asinh();
|
||||
t(a, aa);
|
||||
z = Decimal.asinh(a);
|
||||
t(a, aa);
|
||||
|
||||
t(x, y);
|
||||
t(y, z);
|
||||
|
||||
// a [-1, 1]
|
||||
x = a.inverseHyperbolicTangent();
|
||||
t(a, aa);
|
||||
y = a.atanh();
|
||||
t(a, aa);
|
||||
z = Decimal.atanh(a);
|
||||
t(a, aa);
|
||||
|
||||
t(x, y);
|
||||
t(y, z);
|
||||
|
||||
// a [-1, 1]
|
||||
x = a.inverseSine();
|
||||
t(a, aa);
|
||||
y = a.asin();
|
||||
t(a, aa);
|
||||
z = Decimal.asin(a);
|
||||
t(a, aa);
|
||||
|
||||
t(x, y);
|
||||
t(y, z);
|
||||
|
||||
x = a.inverseTangent();
|
||||
t(a, aa);
|
||||
y = a.atan();
|
||||
t(a, aa);
|
||||
z = Decimal.atan(a);
|
||||
t(a, aa);
|
||||
|
||||
t(x, y);
|
||||
t(y, z);
|
||||
|
||||
a.isFinite();
|
||||
t(a, aa);
|
||||
|
||||
x = a.isInteger();
|
||||
t(a, aa);
|
||||
y = a.isInt();
|
||||
t(a, aa);
|
||||
|
||||
T.assertEqual(x, y);
|
||||
|
||||
a.isNaN();
|
||||
t(a, aa);
|
||||
|
||||
x = a.isNegative();
|
||||
t(a, aa);
|
||||
y = a.isNeg();
|
||||
t(a, aa);
|
||||
|
||||
T.assertEqual(x, y);
|
||||
|
||||
x = a.isPositive();
|
||||
t(a, aa);
|
||||
y = a.isPos();
|
||||
t(a, aa);
|
||||
|
||||
T.assertEqual(x, y);
|
||||
|
||||
a.isZero();
|
||||
t(a, aa);
|
||||
|
||||
x = a.lessThan(b);
|
||||
t(a, aa);
|
||||
t(b, bb);
|
||||
y = a.lt(b);
|
||||
t(a, aa);
|
||||
t(b, bb);
|
||||
|
||||
T.assertEqual(x, y);
|
||||
|
||||
x = a.lessThanOrEqualTo(b);
|
||||
t(a, aa);
|
||||
t(b, bb);
|
||||
y = a.lte(b);
|
||||
t(a, aa);
|
||||
t(b, bb);
|
||||
|
||||
T.assertEqual(x, y);
|
||||
|
||||
x = a.logarithm();
|
||||
t(a, aa);
|
||||
y = a.log();
|
||||
t(a, aa);
|
||||
z = Decimal.log(a);
|
||||
t(a, aa);
|
||||
|
||||
t(x, y);
|
||||
t(y, z);
|
||||
|
||||
x = a.minus(b);
|
||||
t(a, aa);
|
||||
t(b, bb);
|
||||
y = a.sub(b);
|
||||
t(a, aa);
|
||||
t(b, bb);
|
||||
z = Decimal.sub(a, b);
|
||||
t(a, aa);
|
||||
t(b, bb);
|
||||
|
||||
t(x, y);
|
||||
t(y, z);
|
||||
|
||||
x = a.modulo(b);
|
||||
t(a, aa);
|
||||
t(b, bb);
|
||||
y = a.mod(b);
|
||||
t(a, aa);
|
||||
t(b, bb);
|
||||
z = Decimal.mod(a, b);
|
||||
t(a, aa);
|
||||
t(b, bb);
|
||||
|
||||
t(x, y);
|
||||
t(y, z);
|
||||
|
||||
x = a.naturalExponential();
|
||||
t(a, aa);
|
||||
y = a.exp();
|
||||
t(a, aa);
|
||||
z = Decimal.exp(a);
|
||||
t(a, aa);
|
||||
|
||||
t(x, y);
|
||||
t(y, z);
|
||||
|
||||
x = a.naturalLogarithm();
|
||||
t(a, aa);
|
||||
y = a.ln();
|
||||
t(a, aa);
|
||||
z = Decimal.ln(a);
|
||||
t(a, aa);
|
||||
|
||||
t(x, y);
|
||||
t(y, z);
|
||||
|
||||
x = a.negated();
|
||||
t(a, aa);
|
||||
y = a.neg();
|
||||
t(a, aa);
|
||||
|
||||
t(x, y);
|
||||
|
||||
x = a.plus(b);
|
||||
t(a, aa);
|
||||
t(b, bb);
|
||||
y = a.add(b);
|
||||
t(a, aa);
|
||||
t(b, bb);
|
||||
z = Decimal.add(a, b);
|
||||
t(a, aa);
|
||||
t(b, bb);
|
||||
|
||||
t(x, y);
|
||||
t(y, z);
|
||||
|
||||
x = a.precision();
|
||||
t(a, aa);
|
||||
y = a.sd();
|
||||
t(a, aa);
|
||||
|
||||
T.assertEqual(x, y);
|
||||
|
||||
x = a.round();
|
||||
t(a, aa);
|
||||
y = Decimal.round(a);
|
||||
t(a, aa);
|
||||
|
||||
t(x, y);
|
||||
|
||||
x = a.sine();
|
||||
t(a, aa);
|
||||
y = a.sin();
|
||||
t(a, aa);
|
||||
z = Decimal.sin(a);
|
||||
t(a, aa);
|
||||
|
||||
t(x, y);
|
||||
t(y, z);
|
||||
|
||||
x = a.squareRoot();
|
||||
t(a, aa);
|
||||
y = a.sqrt();
|
||||
t(a, aa);
|
||||
z = Decimal.sqrt(a);
|
||||
t(a, aa);
|
||||
|
||||
t(x, y);
|
||||
t(y, z);
|
||||
|
||||
x = a.tangent();
|
||||
t(a, aa);
|
||||
y = a.tan();
|
||||
t(a, aa);
|
||||
z = Decimal.tan(a);
|
||||
t(a, aa);
|
||||
|
||||
t(x, y);
|
||||
t(y, z);
|
||||
|
||||
x = a.times(b);
|
||||
t(a, aa);
|
||||
t(b, bb);
|
||||
y = a.mul(b);
|
||||
t(a, aa);
|
||||
t(b, bb);
|
||||
z = Decimal.mul(a, b);
|
||||
t(a, aa);
|
||||
t(b, bb);
|
||||
|
||||
t(x, y);
|
||||
t(y, z);
|
||||
|
||||
a.toBinary();
|
||||
t(a, aa);
|
||||
|
||||
x = a.toDecimalPlaces(n);
|
||||
t(a, aa);
|
||||
y = a.toDP(n);
|
||||
t(a, aa);
|
||||
|
||||
t(x, y);
|
||||
|
||||
a.toExponential(n);
|
||||
t(a, aa);
|
||||
|
||||
a.toFixed(n);
|
||||
t(a, aa);
|
||||
|
||||
a.toFraction();
|
||||
t(a, aa);
|
||||
|
||||
x = a.toHexadecimal();
|
||||
t(a, aa);
|
||||
y = a.toHex();
|
||||
t(a, aa);
|
||||
|
||||
T.assertEqual(x, y);
|
||||
|
||||
a.toJSON();
|
||||
t(a, aa);
|
||||
|
||||
a.toNearest(b);
|
||||
t(a, aa);
|
||||
t(b, bb);
|
||||
|
||||
a.toNumber();
|
||||
t(a, aa);
|
||||
|
||||
a.toOctal();
|
||||
t(a, aa);
|
||||
|
||||
x = a.toPower(b);
|
||||
t(a, aa);
|
||||
t(b, bb);
|
||||
y = a.pow(b);
|
||||
t(a, aa);
|
||||
t(b, bb);
|
||||
z = Decimal.pow(a, b);
|
||||
t(a, aa);
|
||||
t(b, bb);
|
||||
|
||||
t(x, y);
|
||||
t(y, z);
|
||||
|
||||
a.toPrecision(n);
|
||||
t(a, aa);
|
||||
|
||||
x = a.toSignificantDigits(n);
|
||||
t(a, aa);
|
||||
y = a.toSD(n);
|
||||
t(a, aa);
|
||||
|
||||
t(x, y);
|
||||
|
||||
a.toString();
|
||||
t(a, aa);
|
||||
|
||||
x = a.truncated();
|
||||
t(a, aa);
|
||||
y = a.trunc();
|
||||
t(a, aa);
|
||||
z = Decimal.trunc(a);
|
||||
t(a, aa);
|
||||
|
||||
t(x, y);
|
||||
t(y, z);
|
||||
|
||||
a.valueOf();
|
||||
t(a, aa);
|
||||
|
||||
Decimal.atan2(a, b);
|
||||
t(a, aa);
|
||||
t(b, bb);
|
||||
|
||||
|
||||
Decimal.hypot(a, b);
|
||||
t(a, aa);
|
||||
t(b, bb);
|
||||
|
||||
x = Decimal.log(a, 10);
|
||||
t(a, aa);
|
||||
y = Decimal.log10(a);
|
||||
t(a, aa);
|
||||
|
||||
t(x, y);
|
||||
|
||||
x = Decimal.log(a, 2);
|
||||
t(a, aa);
|
||||
y = Decimal.log2(a);
|
||||
t(a, aa);
|
||||
|
||||
t(x, y);
|
||||
|
||||
Decimal.max(a, b);
|
||||
t(a, aa);
|
||||
t(b, bb);
|
||||
|
||||
Decimal.min(a, b);
|
||||
t(a, aa);
|
||||
t(b, bb);
|
||||
|
||||
Decimal.sign(a);
|
||||
t(a, aa);
|
||||
}
|
||||
|
||||
T.stop();
|
||||
})();
|
||||
|
||||
/*
|
||||
// All methods tested above except:
|
||||
Decimal.clone();
|
||||
Decimal.config();
|
||||
Decimal.fromJSON();
|
||||
Decimal.noConflict();
|
||||
Decimal.random();
|
||||
*/
|
File diff suppressed because it is too large
Load Diff
@ -1,263 +1,263 @@
|
||||
if (typeof T === 'undefined') require('../setup');
|
||||
|
||||
(function () {
|
||||
T('isFinite, isInteger, isNaN, isNegative, isZero');
|
||||
T('isFinite, isInteger, isNaN, isNegative, isZero');
|
||||
|
||||
function t(actual) {
|
||||
T.assert(actual);
|
||||
}
|
||||
function t(actual) {
|
||||
T.assert(actual);
|
||||
}
|
||||
|
||||
Decimal.config({
|
||||
precision: 20,
|
||||
rounding: 4,
|
||||
toExpNeg: -7,
|
||||
toExpPos: 21,
|
||||
minE: -9e15,
|
||||
maxE: 9e15
|
||||
});
|
||||
Decimal.config({
|
||||
precision: 20,
|
||||
rounding: 4,
|
||||
toExpNeg: -7,
|
||||
toExpPos: 21,
|
||||
minE: -9e15,
|
||||
maxE: 9e15
|
||||
});
|
||||
|
||||
var n = new Decimal(1);
|
||||
var n = new Decimal(1);
|
||||
|
||||
t(n.isFinite());
|
||||
t(!n.isNaN());
|
||||
t(!n.isNegative());
|
||||
t(!n.isZero());
|
||||
t(n.isInteger());
|
||||
t(n.equals(n));
|
||||
t(n.equals(1));
|
||||
t(n.equals('1.0'));
|
||||
t(n.equals('1.00'));
|
||||
t(n.equals('1.000'));
|
||||
t(n.equals('1.0000'));
|
||||
t(n.equals('1.00000'));
|
||||
t(n.equals('1.000000'));
|
||||
t(n.equals(new Decimal(1)));
|
||||
t(n.equals('0x1'));
|
||||
t(n.equals('0o1'));
|
||||
t(n.equals('0b1'));
|
||||
t(n.greaterThan(0.99999));
|
||||
t(!n.greaterThanOrEqualTo(1.1));
|
||||
t(n.lessThan(1.001));
|
||||
t(n.lessThanOrEqualTo(2));
|
||||
t(n.toString() === n.valueOf());
|
||||
t(n.isFinite());
|
||||
t(!n.isNaN());
|
||||
t(!n.isNegative());
|
||||
t(!n.isZero());
|
||||
t(n.isInteger());
|
||||
t(n.equals(n));
|
||||
t(n.equals(1));
|
||||
t(n.equals('1.0'));
|
||||
t(n.equals('1.00'));
|
||||
t(n.equals('1.000'));
|
||||
t(n.equals('1.0000'));
|
||||
t(n.equals('1.00000'));
|
||||
t(n.equals('1.000000'));
|
||||
t(n.equals(new Decimal(1)));
|
||||
t(n.equals('0x1'));
|
||||
t(n.equals('0o1'));
|
||||
t(n.equals('0b1'));
|
||||
t(n.greaterThan(0.99999));
|
||||
t(!n.greaterThanOrEqualTo(1.1));
|
||||
t(n.lessThan(1.001));
|
||||
t(n.lessThanOrEqualTo(2));
|
||||
t(n.toString() === n.valueOf());
|
||||
|
||||
n = new Decimal('-0.1');
|
||||
n = new Decimal('-0.1');
|
||||
|
||||
t(n.isFinite());
|
||||
t(!n.isNaN());
|
||||
t(n.isNeg());
|
||||
t(!n.isZero());
|
||||
t(!n.isInt());
|
||||
t(!n.equals(0.1));
|
||||
t(!n.greaterThan(-0.1));
|
||||
t(n.greaterThanOrEqualTo(-1));
|
||||
t(n.lessThan(-0.01));
|
||||
t(!n.lessThanOrEqualTo(-1));
|
||||
t(n.toString() === n.valueOf());
|
||||
t(n.isFinite());
|
||||
t(!n.isNaN());
|
||||
t(n.isNeg());
|
||||
t(!n.isZero());
|
||||
t(!n.isInt());
|
||||
t(!n.equals(0.1));
|
||||
t(!n.greaterThan(-0.1));
|
||||
t(n.greaterThanOrEqualTo(-1));
|
||||
t(n.lessThan(-0.01));
|
||||
t(!n.lessThanOrEqualTo(-1));
|
||||
t(n.toString() === n.valueOf());
|
||||
|
||||
n = new Decimal(Infinity);
|
||||
n = new Decimal(Infinity);
|
||||
|
||||
t(!n.isFinite());
|
||||
t(!n.isNaN());
|
||||
t(!n.isNegative());
|
||||
t(!n.isZero());
|
||||
t(!n.isInteger());
|
||||
t(n.eq('Infinity'));
|
||||
t(n.eq(1/0));
|
||||
t(n.gt('9e999'));
|
||||
t(n.gte(Infinity));
|
||||
t(!n.lt(Infinity));
|
||||
t(n.lte(Infinity));
|
||||
t(n.toString() === n.valueOf());
|
||||
t(!n.isFinite());
|
||||
t(!n.isNaN());
|
||||
t(!n.isNegative());
|
||||
t(!n.isZero());
|
||||
t(!n.isInteger());
|
||||
t(n.eq('Infinity'));
|
||||
t(n.eq(1/0));
|
||||
t(n.gt('9e999'));
|
||||
t(n.gte(Infinity));
|
||||
t(!n.lt(Infinity));
|
||||
t(n.lte(Infinity));
|
||||
t(n.toString() === n.valueOf());
|
||||
|
||||
n = new Decimal('-Infinity');
|
||||
n = new Decimal('-Infinity');
|
||||
|
||||
t(!n.isFinite());
|
||||
t(!n.isNaN());
|
||||
t(n.isNeg());
|
||||
t(!n.isZero());
|
||||
t(!n.isInt());
|
||||
t(!n.equals(Infinity));
|
||||
t(n.equals(-1/0));
|
||||
t(!n.greaterThan(-Infinity));
|
||||
t(n.greaterThanOrEqualTo('-Infinity', 8));
|
||||
t(n.lessThan(0));
|
||||
t(n.lessThanOrEqualTo(Infinity));
|
||||
t(n.toString() === n.valueOf());
|
||||
t(!n.isFinite());
|
||||
t(!n.isNaN());
|
||||
t(n.isNeg());
|
||||
t(!n.isZero());
|
||||
t(!n.isInt());
|
||||
t(!n.equals(Infinity));
|
||||
t(n.equals(-1/0));
|
||||
t(!n.greaterThan(-Infinity));
|
||||
t(n.greaterThanOrEqualTo('-Infinity', 8));
|
||||
t(n.lessThan(0));
|
||||
t(n.lessThanOrEqualTo(Infinity));
|
||||
t(n.toString() === n.valueOf());
|
||||
|
||||
n = new Decimal('0.0000000');
|
||||
n = new Decimal('0.0000000');
|
||||
|
||||
t(n.isFinite());
|
||||
t(!n.isNaN());
|
||||
t(!n.isNegative());
|
||||
t(n.isZero());
|
||||
t(n.isInteger());
|
||||
t(n.eq(-0));
|
||||
t(n.gt(-0.000001));
|
||||
t(!n.gte(0.1));
|
||||
t(n.lt(0.0001));
|
||||
t(n.lte(-0));
|
||||
t(n.toString() === n.valueOf());
|
||||
t(n.isFinite());
|
||||
t(!n.isNaN());
|
||||
t(!n.isNegative());
|
||||
t(n.isZero());
|
||||
t(n.isInteger());
|
||||
t(n.eq(-0));
|
||||
t(n.gt(-0.000001));
|
||||
t(!n.gte(0.1));
|
||||
t(n.lt(0.0001));
|
||||
t(n.lte(-0));
|
||||
t(n.toString() === n.valueOf());
|
||||
|
||||
n = new Decimal(-0);
|
||||
n = new Decimal(-0);
|
||||
|
||||
t(n.isFinite());
|
||||
t(!n.isNaN());
|
||||
t(n.isNeg());
|
||||
t(n.isZero());
|
||||
t(n.isInt());
|
||||
t(n.equals('0.000'));
|
||||
t(n.greaterThan(-1));
|
||||
t(!n.greaterThanOrEqualTo(0.1));
|
||||
t(!n.lessThan(0));
|
||||
t(!n.lessThan(0, 36));
|
||||
t(n.lessThan(0.1));
|
||||
t(n.lessThanOrEqualTo(0));
|
||||
t(n.valueOf() === '-0' && n.toString() === '0');
|
||||
t(n.isFinite());
|
||||
t(!n.isNaN());
|
||||
t(n.isNeg());
|
||||
t(n.isZero());
|
||||
t(n.isInt());
|
||||
t(n.equals('0.000'));
|
||||
t(n.greaterThan(-1));
|
||||
t(!n.greaterThanOrEqualTo(0.1));
|
||||
t(!n.lessThan(0));
|
||||
t(!n.lessThan(0, 36));
|
||||
t(n.lessThan(0.1));
|
||||
t(n.lessThanOrEqualTo(0));
|
||||
t(n.valueOf() === '-0' && n.toString() === '0');
|
||||
|
||||
n = new Decimal('NaN');
|
||||
n = new Decimal('NaN');
|
||||
|
||||
t(!n.isFinite());
|
||||
t(n.isNaN());
|
||||
t(!n.isNegative());
|
||||
t(!n.isZero());
|
||||
t(!n.isInteger());
|
||||
t(!n.eq(NaN));
|
||||
t(!n.eq(Infinity));
|
||||
t(!n.gt(0));
|
||||
t(!n.gte(0));
|
||||
t(!n.lt(1));
|
||||
t(!n.lte(-0));
|
||||
t(!n.lte(-1));
|
||||
t(n.toString() === n.valueOf());
|
||||
t(!n.isFinite());
|
||||
t(n.isNaN());
|
||||
t(!n.isNegative());
|
||||
t(!n.isZero());
|
||||
t(!n.isInteger());
|
||||
t(!n.eq(NaN));
|
||||
t(!n.eq(Infinity));
|
||||
t(!n.gt(0));
|
||||
t(!n.gte(0));
|
||||
t(!n.lt(1));
|
||||
t(!n.lte(-0));
|
||||
t(!n.lte(-1));
|
||||
t(n.toString() === n.valueOf());
|
||||
|
||||
n = new Decimal('-1.234e+2');
|
||||
n = new Decimal('-1.234e+2');
|
||||
|
||||
t(n.isFinite());
|
||||
t(!n.isNaN());
|
||||
t(n.isNeg());
|
||||
t(!n.isZero());
|
||||
t(!n.isInt());
|
||||
t(n.eq(-123.4));
|
||||
t(n.gt('-0xff'));
|
||||
t(n.gte('-1.234e+3'));
|
||||
t(n.lt(-123.39999));
|
||||
t(n.lte('-123.4e+0'));
|
||||
t(n.toString() === n.valueOf());
|
||||
t(n.isFinite());
|
||||
t(!n.isNaN());
|
||||
t(n.isNeg());
|
||||
t(!n.isZero());
|
||||
t(!n.isInt());
|
||||
t(n.eq(-123.4));
|
||||
t(n.gt('-0xff'));
|
||||
t(n.gte('-1.234e+3'));
|
||||
t(n.lt(-123.39999));
|
||||
t(n.lte('-123.4e+0'));
|
||||
t(n.toString() === n.valueOf());
|
||||
|
||||
n = new Decimal('5e-200');
|
||||
n = new Decimal('5e-200');
|
||||
|
||||
t(n.isFinite());
|
||||
t(!n.isNaN());
|
||||
t(!n.isNegative());
|
||||
t(!n.isZero());
|
||||
t(!n.isInteger());
|
||||
t(n.equals(5e-200));
|
||||
t(n.greaterThan(5e-201));
|
||||
t(!n.greaterThanOrEqualTo(1));
|
||||
t(n.lessThan(6e-200));
|
||||
t(n.lessThanOrEqualTo(5.1e-200));
|
||||
t(n.toString() === n.valueOf());
|
||||
t(n.isFinite());
|
||||
t(!n.isNaN());
|
||||
t(!n.isNegative());
|
||||
t(!n.isZero());
|
||||
t(!n.isInteger());
|
||||
t(n.equals(5e-200));
|
||||
t(n.greaterThan(5e-201));
|
||||
t(!n.greaterThanOrEqualTo(1));
|
||||
t(n.lessThan(6e-200));
|
||||
t(n.lessThanOrEqualTo(5.1e-200));
|
||||
t(n.toString() === n.valueOf());
|
||||
|
||||
n = new Decimal('1');
|
||||
n = new Decimal('1');
|
||||
|
||||
t(n.equals(n));
|
||||
t(n.equals(n.toString()));
|
||||
t(n.equals(n.toString()));
|
||||
t(n.equals(n.valueOf()));
|
||||
t(n.equals(n.toFixed()));
|
||||
t(n.equals(1));
|
||||
t(n.equals('1e+0'));
|
||||
t(!n.equals(-1));
|
||||
t(!n.equals(0.1));
|
||||
t(n.equals(n));
|
||||
t(n.equals(n.toString()));
|
||||
t(n.equals(n.toString()));
|
||||
t(n.equals(n.valueOf()));
|
||||
t(n.equals(n.toFixed()));
|
||||
t(n.equals(1));
|
||||
t(n.equals('1e+0'));
|
||||
t(!n.equals(-1));
|
||||
t(!n.equals(0.1));
|
||||
|
||||
t(!new Decimal(NaN).equals(0));
|
||||
t(!new Decimal(Infinity).equals(0));
|
||||
t(!new Decimal(0.1).equals(0));
|
||||
t(!new Decimal(1e9 + 1).equals(1e9));
|
||||
t(!new Decimal(1e9 - 1).equals(1e9));
|
||||
t(new Decimal(1e9 + 1).equals(1e9 + 1));
|
||||
t(new Decimal(1).equals(1));
|
||||
t(!new Decimal(1).equals(-1));
|
||||
t(!new Decimal(NaN).equals(NaN));
|
||||
t(!new Decimal('NaN').equals('NaN'));
|
||||
t(!new Decimal(NaN).equals(0));
|
||||
t(!new Decimal(Infinity).equals(0));
|
||||
t(!new Decimal(0.1).equals(0));
|
||||
t(!new Decimal(1e9 + 1).equals(1e9));
|
||||
t(!new Decimal(1e9 - 1).equals(1e9));
|
||||
t(new Decimal(1e9 + 1).equals(1e9 + 1));
|
||||
t(new Decimal(1).equals(1));
|
||||
t(!new Decimal(1).equals(-1));
|
||||
t(!new Decimal(NaN).equals(NaN));
|
||||
t(!new Decimal('NaN').equals('NaN'));
|
||||
|
||||
t(!new Decimal(NaN).greaterThan(NaN));
|
||||
t(!new Decimal(NaN).lessThan(NaN));
|
||||
t(new Decimal('0xa').lessThanOrEqualTo('0xff'));
|
||||
t(new Decimal('0xb').greaterThanOrEqualTo('0x9'));
|
||||
t(!new Decimal(NaN).greaterThan(NaN));
|
||||
t(!new Decimal(NaN).lessThan(NaN));
|
||||
t(new Decimal('0xa').lessThanOrEqualTo('0xff'));
|
||||
t(new Decimal('0xb').greaterThanOrEqualTo('0x9'));
|
||||
|
||||
t(!new Decimal(10).greaterThan(10));
|
||||
t(!new Decimal(10).lessThan(10));
|
||||
t(!new Decimal(NaN).lessThan(NaN));
|
||||
t(!new Decimal(Infinity).lessThan(-Infinity));
|
||||
t(!new Decimal(Infinity).lessThan(Infinity));
|
||||
t(new Decimal(Infinity).lessThanOrEqualTo(Infinity));
|
||||
t(!new Decimal(NaN).greaterThanOrEqualTo(NaN));
|
||||
t(new Decimal(Infinity).greaterThanOrEqualTo(Infinity));
|
||||
t(new Decimal(Infinity).greaterThanOrEqualTo(-Infinity));
|
||||
t(!new Decimal(NaN).greaterThanOrEqualTo(-Infinity));
|
||||
t(new Decimal(-Infinity).greaterThanOrEqualTo(-Infinity));
|
||||
t(!new Decimal(10).greaterThan(10));
|
||||
t(!new Decimal(10).lessThan(10));
|
||||
t(!new Decimal(NaN).lessThan(NaN));
|
||||
t(!new Decimal(Infinity).lessThan(-Infinity));
|
||||
t(!new Decimal(Infinity).lessThan(Infinity));
|
||||
t(new Decimal(Infinity).lessThanOrEqualTo(Infinity));
|
||||
t(!new Decimal(NaN).greaterThanOrEqualTo(NaN));
|
||||
t(new Decimal(Infinity).greaterThanOrEqualTo(Infinity));
|
||||
t(new Decimal(Infinity).greaterThanOrEqualTo(-Infinity));
|
||||
t(!new Decimal(NaN).greaterThanOrEqualTo(-Infinity));
|
||||
t(new Decimal(-Infinity).greaterThanOrEqualTo(-Infinity));
|
||||
|
||||
t(!new Decimal(2).greaterThan(10));
|
||||
t(!new Decimal(10).lessThan(2));
|
||||
t(new Decimal(255).lessThanOrEqualTo('0xff'));
|
||||
t(new Decimal('0xa').greaterThanOrEqualTo('0x9'));
|
||||
t(!new Decimal(0).lessThanOrEqualTo('NaN'));
|
||||
t(!new Decimal(0).greaterThanOrEqualTo(NaN));
|
||||
t(!new Decimal(NaN).lessThanOrEqualTo('NaN'));
|
||||
t(!new Decimal(NaN).greaterThanOrEqualTo(NaN));
|
||||
t(!new Decimal(0).lessThanOrEqualTo(-Infinity));
|
||||
t(new Decimal(0).greaterThanOrEqualTo(-Infinity));
|
||||
t(new Decimal(0).lessThanOrEqualTo('Infinity'));
|
||||
t(!new Decimal(0).greaterThanOrEqualTo('Infinity'));
|
||||
t(new Decimal(10).lessThanOrEqualTo(20));
|
||||
t(!new Decimal(10).greaterThanOrEqualTo(20));
|
||||
t(!new Decimal(2).greaterThan(10));
|
||||
t(!new Decimal(10).lessThan(2));
|
||||
t(new Decimal(255).lessThanOrEqualTo('0xff'));
|
||||
t(new Decimal('0xa').greaterThanOrEqualTo('0x9'));
|
||||
t(!new Decimal(0).lessThanOrEqualTo('NaN'));
|
||||
t(!new Decimal(0).greaterThanOrEqualTo(NaN));
|
||||
t(!new Decimal(NaN).lessThanOrEqualTo('NaN'));
|
||||
t(!new Decimal(NaN).greaterThanOrEqualTo(NaN));
|
||||
t(!new Decimal(0).lessThanOrEqualTo(-Infinity));
|
||||
t(new Decimal(0).greaterThanOrEqualTo(-Infinity));
|
||||
t(new Decimal(0).lessThanOrEqualTo('Infinity'));
|
||||
t(!new Decimal(0).greaterThanOrEqualTo('Infinity'));
|
||||
t(new Decimal(10).lessThanOrEqualTo(20));
|
||||
t(!new Decimal(10).greaterThanOrEqualTo(20));
|
||||
|
||||
t(!new Decimal(1.23001e-2).lessThan(1.23e-2));
|
||||
t(new Decimal(1.23e-2).lt(1.23001e-2));
|
||||
t(!new Decimal(1e-2).lessThan(9.999999e-3));
|
||||
t(new Decimal(9.999999e-3).lt(1e-2));
|
||||
t(!new Decimal(1.23001e-2).lessThan(1.23e-2));
|
||||
t(new Decimal(1.23e-2).lt(1.23001e-2));
|
||||
t(!new Decimal(1e-2).lessThan(9.999999e-3));
|
||||
t(new Decimal(9.999999e-3).lt(1e-2));
|
||||
|
||||
t(!new Decimal(1.23001e+2).lessThan(1.23e+2));
|
||||
t(new Decimal(1.23e+2).lt(1.23001e+2));
|
||||
t(new Decimal(9.999999e+2).lessThan(1e+3));
|
||||
t(!new Decimal(1e+3).lt(9.9999999e+2));
|
||||
t(!new Decimal(1.23001e+2).lessThan(1.23e+2));
|
||||
t(new Decimal(1.23e+2).lt(1.23001e+2));
|
||||
t(new Decimal(9.999999e+2).lessThan(1e+3));
|
||||
t(!new Decimal(1e+3).lt(9.9999999e+2));
|
||||
|
||||
t(!new Decimal(1.23001e-2).lessThanOrEqualTo(1.23e-2));
|
||||
t(new Decimal(1.23e-2).lte(1.23001e-2));
|
||||
t(!new Decimal(1e-2).lessThanOrEqualTo(9.999999e-3));
|
||||
t(new Decimal(9.999999e-3).lte(1e-2));
|
||||
t(!new Decimal(1.23001e-2).lessThanOrEqualTo(1.23e-2));
|
||||
t(new Decimal(1.23e-2).lte(1.23001e-2));
|
||||
t(!new Decimal(1e-2).lessThanOrEqualTo(9.999999e-3));
|
||||
t(new Decimal(9.999999e-3).lte(1e-2));
|
||||
|
||||
t(!new Decimal(1.23001e+2).lessThanOrEqualTo(1.23e+2));
|
||||
t(new Decimal(1.23e+2).lte(1.23001e+2));
|
||||
t(new Decimal(9.999999e+2).lessThanOrEqualTo(1e+3));
|
||||
t(!new Decimal(1e+3).lte(9.9999999e+2));
|
||||
t(!new Decimal(1.23001e+2).lessThanOrEqualTo(1.23e+2));
|
||||
t(new Decimal(1.23e+2).lte(1.23001e+2));
|
||||
t(new Decimal(9.999999e+2).lessThanOrEqualTo(1e+3));
|
||||
t(!new Decimal(1e+3).lte(9.9999999e+2));
|
||||
|
||||
t(new Decimal(1.23001e-2).greaterThan(1.23e-2));
|
||||
t(!new Decimal(1.23e-2).gt(1.23001e-2));
|
||||
t(new Decimal(1e-2).greaterThan(9.999999e-3));
|
||||
t(!new Decimal(9.999999e-3).gt(1e-2));
|
||||
t(new Decimal(1.23001e-2).greaterThan(1.23e-2));
|
||||
t(!new Decimal(1.23e-2).gt(1.23001e-2));
|
||||
t(new Decimal(1e-2).greaterThan(9.999999e-3));
|
||||
t(!new Decimal(9.999999e-3).gt(1e-2));
|
||||
|
||||
t(new Decimal(1.23001e+2).greaterThan(1.23e+2));
|
||||
t(!new Decimal(1.23e+2).gt(1.23001e+2));
|
||||
t(!new Decimal(9.999999e+2).greaterThan(1e+3));
|
||||
t(new Decimal(1e+3).gt(9.9999999e+2));
|
||||
t(new Decimal(1.23001e+2).greaterThan(1.23e+2));
|
||||
t(!new Decimal(1.23e+2).gt(1.23001e+2));
|
||||
t(!new Decimal(9.999999e+2).greaterThan(1e+3));
|
||||
t(new Decimal(1e+3).gt(9.9999999e+2));
|
||||
|
||||
t(new Decimal(1.23001e-2).greaterThanOrEqualTo(1.23e-2));
|
||||
t(!new Decimal(1.23e-2).gte(1.23001e-2));
|
||||
t(new Decimal(1e-2).greaterThanOrEqualTo(9.999999e-3));
|
||||
t(!new Decimal(9.999999e-3).gte(1e-2));
|
||||
t(new Decimal(1.23001e-2).greaterThanOrEqualTo(1.23e-2));
|
||||
t(!new Decimal(1.23e-2).gte(1.23001e-2));
|
||||
t(new Decimal(1e-2).greaterThanOrEqualTo(9.999999e-3));
|
||||
t(!new Decimal(9.999999e-3).gte(1e-2));
|
||||
|
||||
t(new Decimal(1.23001e+2).greaterThanOrEqualTo(1.23e+2));
|
||||
t(!new Decimal(1.23e+2).gte(1.23001e+2));
|
||||
t(!new Decimal(9.999999e+2).greaterThanOrEqualTo(1e+3));
|
||||
t(new Decimal(1e+3).gte(9.9999999e+2));
|
||||
t(new Decimal(1.23001e+2).greaterThanOrEqualTo(1.23e+2));
|
||||
t(!new Decimal(1.23e+2).gte(1.23001e+2));
|
||||
t(!new Decimal(9.999999e+2).greaterThanOrEqualTo(1e+3));
|
||||
t(new Decimal(1e+3).gte(9.9999999e+2));
|
||||
|
||||
t(!new Decimal('1.0000000000000000000001').isInteger());
|
||||
t(!new Decimal('0.999999999999999999999').isInteger());
|
||||
t(new Decimal('4e4').isInteger());
|
||||
t(new Decimal('-4e4').isInteger());
|
||||
t(!new Decimal('1.0000000000000000000001').isInteger());
|
||||
t(!new Decimal('0.999999999999999999999').isInteger());
|
||||
t(new Decimal('4e4').isInteger());
|
||||
t(new Decimal('-4e4').isInteger());
|
||||
|
||||
T.stop();
|
||||
T.stop();
|
||||
})();
|
||||
|
1039
test/modules/ln.js
1039
test/modules/ln.js
File diff suppressed because it is too large
Load Diff
@ -1,280 +1,279 @@
|
||||
if (typeof T === 'undefined') require('../setup');
|
||||
|
||||
(function () {
|
||||
T('log');
|
||||
T('log');
|
||||
|
||||
function t(n, base, expected, sd, rm) {
|
||||
Decimal.precision = sd;
|
||||
Decimal.rounding = rm;
|
||||
T.assertEqual(expected, new Decimal(n).log(base).valueOf());
|
||||
//T.assertEqual(expected, Decimal.log(n, base).valueOf());
|
||||
}
|
||||
function t(n, base, expected, sd, rm) {
|
||||
Decimal.precision = sd;
|
||||
Decimal.rounding = rm;
|
||||
T.assertEqual(expected, new Decimal(n).log(base).valueOf());
|
||||
}
|
||||
|
||||
Decimal.config({
|
||||
precision: 40,
|
||||
rounding: 4,
|
||||
toExpNeg: -9e15,
|
||||
toExpPos: 9e15,
|
||||
minE: -9e15,
|
||||
maxE: 9e15
|
||||
});
|
||||
Decimal.config({
|
||||
precision: 40,
|
||||
rounding: 4,
|
||||
toExpNeg: -9e15,
|
||||
toExpPos: 9e15,
|
||||
minE: -9e15,
|
||||
maxE: 9e15
|
||||
});
|
||||
|
||||
/*
|
||||
Example of a log that will fail.
|
||||
It results in 2.6 due to having 15 or more zeros from the first rounding digit.
|
||||
t('4503599627370502', '1048576', '2.7', 2, 2); // 2.60000000000000009610279511444746656225...
|
||||
*/
|
||||
/*
|
||||
Example of a log that will fail.
|
||||
It results in 2.6 due to having 15 or more zeros from the first rounding digit.
|
||||
t('4503599627370502', '1048576', '2.7', 2, 2); // 2.60000000000000009610279511444746656225...
|
||||
*/
|
||||
|
||||
t('0', '10', '-Infinity', 40, 4);
|
||||
t('-0', '10', '-Infinity', 40, 4);
|
||||
t('1', '10', '0', 40, 4);
|
||||
t('-1', '10', 'NaN', 40, 4);
|
||||
t('Infinity', '10', 'Infinity', 40, 4);
|
||||
t('Infinity', '0', 'NaN', 40, 4);
|
||||
t('-Infinity', 'Infinity', 'NaN', 40, 4);
|
||||
t('NaN', '10', 'NaN', 40, 4);
|
||||
t('0', '10', '-Infinity', 40, 4);
|
||||
t('-0', '10', '-Infinity', 40, 4);
|
||||
t('1', '10', '0', 40, 4);
|
||||
t('-1', '10', 'NaN', 40, 4);
|
||||
t('Infinity', '10', 'Infinity', 40, 4);
|
||||
t('Infinity', '0', 'NaN', 40, 4);
|
||||
t('-Infinity', 'Infinity', 'NaN', 40, 4);
|
||||
t('NaN', '10', 'NaN', 40, 4);
|
||||
|
||||
t('1', '0', 'NaN', 40, 4); // Math.log(1) / Math.log(0) == -0
|
||||
t('10', '0', 'NaN', 40, 4); // Math.log(10) / Math.log(0) == -0
|
||||
t('10', '-0', 'NaN', 40, 4); // Math.log(10) / Math.log(-0) == -0
|
||||
t('10', '1', 'NaN', 40, 4); // Math.log(10) / Math.log(1) == Infinity
|
||||
t('10', '-1', 'NaN', 40, 4);
|
||||
t('10', 'Infinity', 'NaN', 40, 4); // Math.log(10) / Math.log(Infinity) == 0
|
||||
t('10', '-Infinity', 'NaN', 40, 4);
|
||||
t('10', 'NaN', 'NaN', 40, 4);
|
||||
t('-1', '-1', 'NaN', 40, 4);
|
||||
t('0', '0', 'NaN', 40, 4);
|
||||
t('1', '0', 'NaN', 40, 4); // Math.log(1) / Math.log(0) == -0
|
||||
t('10', '0', 'NaN', 40, 4); // Math.log(10) / Math.log(0) == -0
|
||||
t('10', '-0', 'NaN', 40, 4); // Math.log(10) / Math.log(-0) == -0
|
||||
t('10', '1', 'NaN', 40, 4); // Math.log(10) / Math.log(1) == Infinity
|
||||
t('10', '-1', 'NaN', 40, 4);
|
||||
t('10', 'Infinity', 'NaN', 40, 4); // Math.log(10) / Math.log(Infinity) == 0
|
||||
t('10', '-Infinity', 'NaN', 40, 4);
|
||||
t('10', 'NaN', 'NaN', 40, 4);
|
||||
t('-1', '-1', 'NaN', 40, 4);
|
||||
t('0', '0', 'NaN', 40, 4);
|
||||
|
||||
t('7625597484987', '59049', '2.7', 2, 5);
|
||||
t('839756321.64088511', '28', '6.16667503', 9, 0);
|
||||
t('94143178827', '3486784401', '1.15', 3, 0);
|
||||
t('243', '9', '3', 1, 4);
|
||||
t('512', '16', '2.25', 7, 0);
|
||||
t('512', '16', '2.25', 7, 2);
|
||||
t('512', '16', '2.2', 2, 5);
|
||||
t('512', '16', '2.2', 2, 6);
|
||||
t('7625597484987', '59049', '2.7', 2, 5);
|
||||
t('839756321.64088511', '28', '6.16667503', 9, 0);
|
||||
t('94143178827', '3486784401', '1.15', 3, 0);
|
||||
t('243', '9', '3', 1, 4);
|
||||
t('512', '16', '2.25', 7, 0);
|
||||
t('512', '16', '2.25', 7, 2);
|
||||
t('512', '16', '2.2', 2, 5);
|
||||
t('512', '16', '2.2', 2, 6);
|
||||
|
||||
t('16', '2', '4', 7, 0);
|
||||
t('16', '2', '4', 7, 2);
|
||||
t('243', '3', '5', 7, 1);
|
||||
t('243', '9', '2.5', 7, 1);
|
||||
t('243', '3', '5', 7, 3);
|
||||
t('243', '9', '2.5', 7, 3);
|
||||
t('32', '4', '2.5', 7, 0);
|
||||
t('32', '4', '2.5', 7, 2);
|
||||
t('4', '2', '2', 1, 2);
|
||||
t('8', '2', '3', 2, 0);
|
||||
t('16', '2', '4', 2, 0);
|
||||
t('32', '2', '5', 3, 0);
|
||||
t('64', '2', '6', 3, 0);
|
||||
t('64', '2', '6', 2, 0);
|
||||
t('64', '2', '6', 1, 2);
|
||||
t('128', '2', '7', 1, 0);
|
||||
t('256', '2', '8', 1, 2);
|
||||
t('1024', '2', '10', 2, 0);
|
||||
t('1024', '2', '10', 10, 0);
|
||||
t('16384', '2', '14', 2, 0);
|
||||
t('16384', '2', '14', 10, 0);
|
||||
t('243', '3', '5', 7, 4);
|
||||
t('243', '9', '2.5', 7, 4);
|
||||
t('243', '3', '5', 7, 4);
|
||||
t('243', '9', '2.5', 7, 4);
|
||||
t('16', '2', '4', 7, 4);
|
||||
t('32', '4', '2.5', 7, 4);
|
||||
t('16', '2', '4', 7, 4);
|
||||
t('32', '4', '2.5', 7, 4);
|
||||
t('16', '2', '4', 7, 0);
|
||||
t('16', '2', '4', 7, 2);
|
||||
t('243', '3', '5', 7, 1);
|
||||
t('243', '9', '2.5', 7, 1);
|
||||
t('243', '3', '5', 7, 3);
|
||||
t('243', '9', '2.5', 7, 3);
|
||||
t('32', '4', '2.5', 7, 0);
|
||||
t('32', '4', '2.5', 7, 2);
|
||||
t('4', '2', '2', 1, 2);
|
||||
t('8', '2', '3', 2, 0);
|
||||
t('16', '2', '4', 2, 0);
|
||||
t('32', '2', '5', 3, 0);
|
||||
t('64', '2', '6', 3, 0);
|
||||
t('64', '2', '6', 2, 0);
|
||||
t('64', '2', '6', 1, 2);
|
||||
t('128', '2', '7', 1, 0);
|
||||
t('256', '2', '8', 1, 2);
|
||||
t('1024', '2', '10', 2, 0);
|
||||
t('1024', '2', '10', 10, 0);
|
||||
t('16384', '2', '14', 2, 0);
|
||||
t('16384', '2', '14', 10, 0);
|
||||
t('243', '3', '5', 7, 4);
|
||||
t('243', '9', '2.5', 7, 4);
|
||||
t('243', '3', '5', 7, 4);
|
||||
t('243', '9', '2.5', 7, 4);
|
||||
t('16', '2', '4', 7, 4);
|
||||
t('32', '4', '2.5', 7, 4);
|
||||
t('16', '2', '4', 7, 4);
|
||||
t('32', '4', '2.5', 7, 4);
|
||||
|
||||
t('1.2589254117', 10, '0.1', 1, 2);
|
||||
t('1.023292992', 10, '0.01', 1, 2);
|
||||
t('1.258925411794167210423954106395800606', 10, '0.1', 1, 4);
|
||||
t('1.25892541179416721', 10, '0.1', 1, 0);
|
||||
t('1.258925411', 10, '0.1', 1, 5);
|
||||
t('1.258925411794167210423954', 10, '0.1', 1, 4);
|
||||
t('1.2589254117', 10, '0.1', 1, 2);
|
||||
t('1.023292992', 10, '0.01', 1, 2);
|
||||
t('1.258925411794167210423954106395800606', 10, '0.1', 1, 4);
|
||||
t('1.25892541179416721', 10, '0.1', 1, 0);
|
||||
t('1.258925411', 10, '0.1', 1, 5);
|
||||
t('1.258925411794167210423954', 10, '0.1', 1, 4);
|
||||
|
||||
/*
|
||||
6.166675020000903537297764507632802193308677149
|
||||
28^6.16667502 = 839756321.6383567959704282429971526703012698
|
||||
28^6.16667503 = 839756349.6207552863005150010387178739013142
|
||||
*/
|
||||
t('839756321.64088511', '28', '6.16667503', 9, 0);
|
||||
t('576306512.96177', '985212731.27158', '0.9742', 4, 2);
|
||||
t('97.65625', '6.25', '2.5', 3, 0);
|
||||
t('223677472.0384754303304727631735', '26', '5.900904252190486450814', 22, 5);
|
||||
t('2063000845.3020737243910803079', '35', '6.0324410183892767982149330415', 29, 0);
|
||||
t('302381977.956021650184952836276441035025875682714942', '2623', '2.4805663226398755020289647999', 29, 6);
|
||||
t('456870693.58', '238920772.66', '1.0336035877093034523', 21, 4);
|
||||
t('16', '2', '4', 10, 4);
|
||||
t('32', '4', '2.5', 10, 1);
|
||||
t('316.2277660168379331998893544432645719585553021316022642247511089459022980600999502961482777894980004', '10', '2.49999999999999999999', 21, 1);
|
||||
/*
|
||||
6.166675020000903537297764507632802193308677149
|
||||
28^6.16667502 = 839756321.6383567959704282429971526703012698
|
||||
28^6.16667503 = 839756349.6207552863005150010387178739013142
|
||||
*/
|
||||
t('839756321.64088511', '28', '6.16667503', 9, 0);
|
||||
t('576306512.96177', '985212731.27158', '0.9742', 4, 2);
|
||||
t('97.65625', '6.25', '2.5', 3, 0);
|
||||
t('223677472.0384754303304727631735', '26', '5.900904252190486450814', 22, 5);
|
||||
t('2063000845.3020737243910803079', '35', '6.0324410183892767982149330415', 29, 0);
|
||||
t('302381977.956021650184952836276441035025875682714942', '2623', '2.4805663226398755020289647999', 29, 6);
|
||||
t('456870693.58', '238920772.66', '1.0336035877093034523', 21, 4);
|
||||
t('16', '2', '4', 10, 4);
|
||||
t('32', '4', '2.5', 10, 1);
|
||||
t('316.2277660168379331998893544432645719585553021316022642247511089459022980600999502961482777894980004', '10', '2.49999999999999999999', 21, 1);
|
||||
|
||||
// Base 10 therefore the following tests pass despite 15 or more zeros or nines as the rounding digits.
|
||||
// Base 10 therefore the following tests pass despite 15 or more zeros or nines as the rounding digits.
|
||||
|
||||
// 4.0000000000000000000173...
|
||||
t('10000.0000000000000004', 10, '4.01', 3, 2);
|
||||
// 4.0000000000000000000173...
|
||||
t('10000.0000000000000004', 10, '4.01', 3, 2);
|
||||
|
||||
// 4.00000000000000000173...
|
||||
t('10000.00000000000004', 10, '4.01', 3, 2);
|
||||
// 4.00000000000000000173...
|
||||
t('10000.00000000000004', 10, '4.01', 3, 2);
|
||||
|
||||
// 2.000000000000000000000004342944...
|
||||
t('100.000000000000000000001', 10, '2.1', 2, 0);
|
||||
// 2.000000000000000000000004342944...
|
||||
t('100.000000000000000000001', 10, '2.1', 2, 0);
|
||||
|
||||
// 2.00000000000000004342944...
|
||||
t('100.00000000000001', 10, '2.1', 2, 0);
|
||||
// 2.00000000000000004342944...
|
||||
t('100.00000000000001', 10, '2.1', 2, 0);
|
||||
|
||||
// 4.9999999999999999999960913...
|
||||
t('99999.9999999999999991', 10, '4.999', 4, 1);
|
||||
// 4.9999999999999999999960913...
|
||||
t('99999.9999999999999991', 10, '4.999', 4, 1);
|
||||
|
||||
// 0.09360000000000000000000000020197...
|
||||
t('124050.923004222533485495840', 10, '5.093601', 7, 2);
|
||||
// 0.09360000000000000000000000020197...
|
||||
t('124050.923004222533485495840', 10, '5.093601', 7, 2);
|
||||
|
||||
// 0.09999999999999999999999999999972381...
|
||||
// 10^0.1 = 1.258925411794167210423954106395800606093617409466...
|
||||
t('1.258925411794167210423954106395', 10, '0.09999', 4, 1);
|
||||
// 0.09999999999999999999999999999972381...
|
||||
// 10^0.1 = 1.258925411794167210423954106395800606093617409466...
|
||||
t('1.258925411794167210423954106395', 10, '0.09999', 4, 1);
|
||||
|
||||
// 8.959609629999999999999999999999431251938064
|
||||
t('911191437.48166728043529900000', 10, '8.959609629999999999999999', 25, 3);
|
||||
// 8.959609629999999999999999999999431251938064
|
||||
t('911191437.48166728043529900000', 10, '8.959609629999999999999999', 25, 3);
|
||||
|
||||
// 2.4038746000000000000000000000000268051243...
|
||||
t('253.4396732554691740503010363220', 10, '2.403874600001', 13, 2);
|
||||
// 2.4038746000000000000000000000000268051243...
|
||||
t('253.4396732554691740503010363220', 10, '2.403874600001', 13, 2);
|
||||
|
||||
// 3.391702100000000000000000000000000025534271040...
|
||||
t('2464.348361986885121671329250344224', 10, '3.3917021', 18, 1);
|
||||
t('2464.348361986885121671329250344224', 10, '3.39170210000000001', 18, 0);
|
||||
// 3.391702100000000000000000000000000025534271040...
|
||||
t('2464.348361986885121671329250344224', 10, '3.3917021', 18, 1);
|
||||
t('2464.348361986885121671329250344224', 10, '3.39170210000000001', 18, 0);
|
||||
|
||||
// 4.0000000000000000173...
|
||||
t('10000.0000000000004', 10, '4.01', 3, 2);
|
||||
// 4.0000000000000000173...
|
||||
t('10000.0000000000004', 10, '4.01', 3, 2);
|
||||
|
||||
// 4.00000000000000173...
|
||||
t('10000.00000000004', 10, '4.01', 3, 2);
|
||||
// 4.00000000000000173...
|
||||
t('10000.00000000004', 10, '4.01', 3, 2);
|
||||
|
||||
// 2.0000000000000004342944...
|
||||
t('100.0000000000001', 10, '2.1', 2, 0);
|
||||
// 2.0000000000000004342944...
|
||||
t('100.0000000000001', 10, '2.1', 2, 0);
|
||||
|
||||
// 4.99999999999999999960913...
|
||||
t('99999.99999999999991', 10, '4.999', 4, 1);
|
||||
// 4.99999999999999999960913...
|
||||
t('99999.99999999999991', 10, '4.999', 4, 1);
|
||||
|
||||
// 4.9999999999999999960913...
|
||||
t('99999.9999999999991', 10, '4.999', 4, 1);
|
||||
// 4.9999999999999999960913...
|
||||
t('99999.9999999999991', 10, '4.999', 4, 1);
|
||||
|
||||
// 4.99999999999960913...
|
||||
t('99999.99999991', 10, '4.999', 4, 1);
|
||||
// 4.99999999999960913...
|
||||
t('99999.99999991', 10, '4.999', 4, 1);
|
||||
|
||||
t('6.626757835589191227753975149737456562020794782', 10, '0.8213011002743699999999999999999999999999999', 43, 1);
|
||||
t('4.20732041199815040736678139715312481859825562145776045079', 10, '0.6240055873352599999999999999999999999999999999999999', 52, 3);
|
||||
t('64513410281785809574142282220919135969.8537876292904158501590880', 10, '37.80964999999999999999', 22, 1);
|
||||
t('33.51145738694771448172942314968136067036971739113975569076629', 10, '1.5251933153717162999999999999999999999999999999999999999', 56, 3);
|
||||
t('10232.9299228075413096627', 10, '4.009999999999999', 16, 1);
|
||||
t('1.258925411794167210423954106395', 10, '0.099999999999999999999999999999723814', 35, 0);
|
||||
t('1.29891281037500', 10, '0.11357', 5, 1);
|
||||
t('16.399137225681149762104868844', 10, '1.21482099999999999999999', 24, 3);
|
||||
t('0.01', 10, '-2', 17, 3);
|
||||
t('0.0000000001', 10, '-10', 4, 2);
|
||||
t('0.00001', 10, '-5', 35, 3);
|
||||
t('0.00000001', 10, '-8', 24, 2);
|
||||
t('0.0000100000000000010000005060000000000800030000000400908', 10, '-4.99', 3, 1);
|
||||
t('6.626757835589191227753975149737456562020794782', 10, '0.8213011002743699999999999999999999999999999', 43, 1);
|
||||
t('4.20732041199815040736678139715312481859825562145776045079', 10, '0.6240055873352599999999999999999999999999999999999999', 52, 3);
|
||||
t('64513410281785809574142282220919135969.8537876292904158501590880', 10, '37.80964999999999999999', 22, 1);
|
||||
t('33.51145738694771448172942314968136067036971739113975569076629', 10, '1.5251933153717162999999999999999999999999999999999999999', 56, 3);
|
||||
t('10232.9299228075413096627', 10, '4.009999999999999', 16, 1);
|
||||
t('1.258925411794167210423954106395', 10, '0.099999999999999999999999999999723814', 35, 0);
|
||||
t('1.29891281037500', 10, '0.11357', 5, 1);
|
||||
t('16.399137225681149762104868844', 10, '1.21482099999999999999999', 24, 3);
|
||||
t('0.01', 10, '-2', 17, 3);
|
||||
t('0.0000000001', 10, '-10', 4, 2);
|
||||
t('0.00001', 10, '-5', 35, 3);
|
||||
t('0.00000001', 10, '-8', 24, 2);
|
||||
t('0.0000100000000000010000005060000000000800030000000400908', 10, '-4.99', 3, 1);
|
||||
|
||||
t('94143178827', '3486784401', '1.15', 3, 0);
|
||||
t('15625', '3125', '1.2', 2, 3);
|
||||
t('3', '3486784401', '0.05', 1, 8);
|
||||
t('268435456', '1048576', '1.4', 2, 3);
|
||||
t('25', '9765625', '0.2', 1, 7);
|
||||
t('524288', '256', '2.375', 4, 8);
|
||||
t('177147', '81', '2.75', 3, 5);
|
||||
t('531441', '59049', '1.2', 2, 8);
|
||||
t('387420489', '59049', '1.8', 2, 6);
|
||||
t('16384', '65536', '0.875', 3, 6);
|
||||
t('31381059609', '59049', '2.2', 2, 5);
|
||||
t('8589934592', '65536', '2.0625', 5, 3);
|
||||
t('33554432', '256', '3.125', 4, 3);
|
||||
t('4503599627370496', '65536', '3.25', 3, 3);
|
||||
t('68630377364883', '59049', '2.9', 2, 3);
|
||||
t('68630377364883', '847288609443', '1.16', 3, 5);
|
||||
t('16', '1125899906842624', '0.08', 1, 2);
|
||||
t('3814697265625', '390625', '2.25', 3, 8);
|
||||
t('8', '4294967296', '0.09375', 4, 1);
|
||||
t('22876792454961', '59049', '2.8', 2, 2);
|
||||
t('32', '33554432', '0.2', 1, 2);
|
||||
t('16', '1125899906842624', '0.08', 1, 2);
|
||||
t('16777216', '1024', '2.4', 2, 2);
|
||||
t('31381059609', '3486784401', '1.1', 2, 4);
|
||||
t('131072', '16', '4.25', 3, 7);
|
||||
t('17179869184', '65536', '2.125', 4, 2);
|
||||
t('131072', '32', '3.4', 2, 5);
|
||||
t('31381059609', '6561', '2.75', 3, 4);
|
||||
t('1162261467', '81', '4.75', 3, 2);
|
||||
t('5', '152587890625', '0.0625', 3, 8);
|
||||
t('4', '1024', '0.2', 1, 2);
|
||||
t('268435456', '1048576', '1.4', 2, 8);
|
||||
t('94143178827', '3486784401', '1.15', 3, 0);
|
||||
t('15625', '3125', '1.2', 2, 3);
|
||||
t('3', '3486784401', '0.05', 1, 8);
|
||||
t('268435456', '1048576', '1.4', 2, 3);
|
||||
t('25', '9765625', '0.2', 1, 7);
|
||||
t('524288', '256', '2.375', 4, 8);
|
||||
t('177147', '81', '2.75', 3, 5);
|
||||
t('531441', '59049', '1.2', 2, 8);
|
||||
t('387420489', '59049', '1.8', 2, 6);
|
||||
t('16384', '65536', '0.875', 3, 6);
|
||||
t('31381059609', '59049', '2.2', 2, 5);
|
||||
t('8589934592', '65536', '2.0625', 5, 3);
|
||||
t('33554432', '256', '3.125', 4, 3);
|
||||
t('4503599627370496', '65536', '3.25', 3, 3);
|
||||
t('68630377364883', '59049', '2.9', 2, 3);
|
||||
t('68630377364883', '847288609443', '1.16', 3, 5);
|
||||
t('16', '1125899906842624', '0.08', 1, 2);
|
||||
t('3814697265625', '390625', '2.25', 3, 8);
|
||||
t('8', '4294967296', '0.09375', 4, 1);
|
||||
t('22876792454961', '59049', '2.8', 2, 2);
|
||||
t('32', '33554432', '0.2', 1, 2);
|
||||
t('16', '1125899906842624', '0.08', 1, 2);
|
||||
t('16777216', '1024', '2.4', 2, 2);
|
||||
t('31381059609', '3486784401', '1.1', 2, 4);
|
||||
t('131072', '16', '4.25', 3, 7);
|
||||
t('17179869184', '65536', '2.125', 4, 2);
|
||||
t('131072', '32', '3.4', 2, 5);
|
||||
t('31381059609', '6561', '2.75', 3, 4);
|
||||
t('1162261467', '81', '4.75', 3, 2);
|
||||
t('5', '152587890625', '0.0625', 3, 8);
|
||||
t('4', '1024', '0.2', 1, 2);
|
||||
t('268435456', '1048576', '1.4', 2, 8);
|
||||
|
||||
t('456870693.58', '238920772.66', '1.0336035877093034523', 21, 4);
|
||||
t('575547956.8582', '824684975.3545', '0.98248076', 8, 4);
|
||||
t('82275648.874341603', '959190115.624130088', '0.88124641544168894893181429200832363', 35, 4);
|
||||
t('74257343.4', '743703514.4', '0.88720377341908842250463392057841865999040289364224', 50, 4);
|
||||
t('617556576.22', '1390349767.37', '0.96145220002205342499', 20, 4);
|
||||
t('385659206.402956', '306197094.245356', '1.0118079926535367225661814147003237994862', 41, 4);
|
||||
t('1739848017', '139741504', '1.134455757605027173760473871049514546484', 40, 4);
|
||||
t('684413372.332', '749444030.62', '0.99556', 5, 4);
|
||||
t('1276559129.76358811', '1814329747.19301894', '0.983510102095361604388', 21, 4);
|
||||
t('470873324.56', '770017206.95', '0.975963952980122531477453931545461086248352', 42, 4);
|
||||
t('142843622.855', '188030025.676', '0.985573716314165', 15, 4);
|
||||
t('208762187.506204', '15673510.715596', '1.1563', 5, 4);
|
||||
t('1066260899.1963', '954219284.761', '1.005369396783858165862954752482856604', 37, 4);
|
||||
t('98615189.15', '75483684.05', '1.0147363402964731399253', 23, 4);
|
||||
t('134306349.93018997', '262971762.95484809', '0.965342550919082621945239', 24, 4);
|
||||
t('964681161.089224', '1910911588.814815', '0.9680153968863558918522522557796148', 34, 4);
|
||||
t('9303669', '272208139', '0.8262', 4, 4);
|
||||
t('388804210', '196979048', '1.035603565223696855965', 22, 4);
|
||||
t('699589959.2322617', '574032511.7854473', '1.0098079347111332288609', 23, 4);
|
||||
t('100575245.36', '172874206.82', '0.971443699412905370317336892965778', 33, 4);
|
||||
t('188632711.8541175', '1056627336.0975408', '0.9170754305183363941127042', 25, 4);
|
||||
t('267522787.94', '528716571.79', '0.966083390988836341228896', 24, 4);
|
||||
t('145509306.43395', '472783713.04935', '0.941003844701466585568051857', 28, 4);
|
||||
t('991525965.6381098', '609527830.0476525', '1.024053580832128', 16, 4);
|
||||
t('1023653880.6218838', '953120602.1428507', '1.00345303146', 13, 4);
|
||||
t('55755796.19', '1330531177.01', '0.84899920538009273', 17, 4);
|
||||
t('334096229.1342503', '563056758.6770503', '0.97409528', 8, 4);
|
||||
t('9635164', '231514430', '0.834932623823994616103829175346875687708', 39, 4);
|
||||
t('131654133.157309973', '115412751.259558256', '1.007092396906741330059871530698890891053443', 43, 4);
|
||||
t('456870693.58', '238920772.66', '1.0336035877093034523', 21, 4);
|
||||
t('575547956.8582', '824684975.3545', '0.98248076', 8, 4);
|
||||
t('82275648.874341603', '959190115.624130088', '0.88124641544168894893181429200832363', 35, 4);
|
||||
t('74257343.4', '743703514.4', '0.88720377341908842250463392057841865999040289364224', 50, 4);
|
||||
t('617556576.22', '1390349767.37', '0.96145220002205342499', 20, 4);
|
||||
t('385659206.402956', '306197094.245356', '1.0118079926535367225661814147003237994862', 41, 4);
|
||||
t('1739848017', '139741504', '1.134455757605027173760473871049514546484', 40, 4);
|
||||
t('684413372.332', '749444030.62', '0.99556', 5, 4);
|
||||
t('1276559129.76358811', '1814329747.19301894', '0.983510102095361604388', 21, 4);
|
||||
t('470873324.56', '770017206.95', '0.975963952980122531477453931545461086248352', 42, 4);
|
||||
t('142843622.855', '188030025.676', '0.985573716314165', 15, 4);
|
||||
t('208762187.506204', '15673510.715596', '1.1563', 5, 4);
|
||||
t('1066260899.1963', '954219284.761', '1.005369396783858165862954752482856604', 37, 4);
|
||||
t('98615189.15', '75483684.05', '1.0147363402964731399253', 23, 4);
|
||||
t('134306349.93018997', '262971762.95484809', '0.965342550919082621945239', 24, 4);
|
||||
t('964681161.089224', '1910911588.814815', '0.9680153968863558918522522557796148', 34, 4);
|
||||
t('9303669', '272208139', '0.8262', 4, 4);
|
||||
t('388804210', '196979048', '1.035603565223696855965', 22, 4);
|
||||
t('699589959.2322617', '574032511.7854473', '1.0098079347111332288609', 23, 4);
|
||||
t('100575245.36', '172874206.82', '0.971443699412905370317336892965778', 33, 4);
|
||||
t('188632711.8541175', '1056627336.0975408', '0.9170754305183363941127042', 25, 4);
|
||||
t('267522787.94', '528716571.79', '0.966083390988836341228896', 24, 4);
|
||||
t('145509306.43395', '472783713.04935', '0.941003844701466585568051857', 28, 4);
|
||||
t('991525965.6381098', '609527830.0476525', '1.024053580832128', 16, 4);
|
||||
t('1023653880.6218838', '953120602.1428507', '1.00345303146', 13, 4);
|
||||
t('55755796.19', '1330531177.01', '0.84899920538009273', 17, 4);
|
||||
t('334096229.1342503', '563056758.6770503', '0.97409528', 8, 4);
|
||||
t('9635164', '231514430', '0.834932623823994616103829175346875687708', 39, 4);
|
||||
t('131654133.157309973', '115412751.259558256', '1.007092396906741330059871530698890891053443', 43, 4);
|
||||
|
||||
// base 2
|
||||
t('26880.2432276408875624', 2, '14.7142585720457255', 19, 3);
|
||||
t('18216.8140929585641372', 2, '14.152983050314836771855701', 26, 1);
|
||||
t('28062.73494235358182', 2, '14.776367997755111083362495', 26, 0);
|
||||
t('7408.82842447993', 2, '12.8550297084583087071', 21, 1);
|
||||
t('395.067', 2, '8.62595353', 9, 3);
|
||||
t('27442.6587462411378', 2, '14.74414', 7, 0);
|
||||
t('29259.23925137426', 2, '14.83660463902', 13, 1);
|
||||
t('31809.09321', 2, '14.95715162', 10, 3);
|
||||
t('21088.306138691278', 2, '14.3641556', 9, 4);
|
||||
t('21417.99322', 2, '14.386535691235055367', 20, 4);
|
||||
t('30749.008158228314845157', 2, '14.9', 3, 3);
|
||||
t('11701.5', 2, '13.51440585840535244680127', 25, 0);
|
||||
t('31737.6741', 2, '14.954', 5, 2);
|
||||
t('1688.88816886', 2, '10.7218580867075137099751634', 27, 3);
|
||||
t('31553.4', 2, '14.945507849063278420302384', 26, 1);
|
||||
t('28215.19', 2, '14.7841844442', 12, 3);
|
||||
t('6080.97', 2, '12.57008575', 10, 1);
|
||||
t('575.881932366571406', 2, '9.16962924962079798', 18, 1);
|
||||
t('4573.55560689675', 2, '12.1591004766309775332', 21, 1);
|
||||
t('24202.85989198517539', 2, '15', 2, 4);
|
||||
t('18334.9', 2, '14.16230477704721387108079127958', 31, 4);
|
||||
t('20179.623017', 2, '14.4', 3, 0);
|
||||
t('8607.97004888426002071', 2, '13.07145734276093159769689946319', 31, 1);
|
||||
t('27231.463745', 2, '14.732986911725376996874804951679', 32, 3);
|
||||
t('24325.08', 2, '14.57015693', 10, 0);
|
||||
t('826.3541073', 2, '9.69', 3, 3);
|
||||
t('6877.51851488', 2, '12.7476724030697', 15, 3);
|
||||
t('13510.031', 2, '13.7217433646123774736072103937', 30, 4);
|
||||
t('559.1647711259', 2, '9.12712965971023632', 18, 1);
|
||||
t('1262.018796786493279', 2, '10.30151768', 10, 3);
|
||||
t('31897.9889', 2, '14.9611778475691091525075', 24, 1);
|
||||
t('24187.818942357666924548', 2, '14.561', 5, 3);
|
||||
t('7233.846688339241', 2, '12.820547306996872048936910678432', 32, 3);
|
||||
t('10162.3041', 2, '13.31093992111', 13, 4);
|
||||
t('9091.859714971663525', 2, '13.1503597085807068872335', 24, 1);
|
||||
t('16205.492', 2, '13.984195201', 11, 3);
|
||||
t('17578.3501161869916711', 2, '14.101512046680555', 18, 3);
|
||||
t('5661.58', 2, '12.466989012642603919950322048', 29, 1);
|
||||
// base 2
|
||||
t('26880.2432276408875624', 2, '14.7142585720457255', 19, 3);
|
||||
t('18216.8140929585641372', 2, '14.152983050314836771855701', 26, 1);
|
||||
t('28062.73494235358182', 2, '14.776367997755111083362495', 26, 0);
|
||||
t('7408.82842447993', 2, '12.8550297084583087071', 21, 1);
|
||||
t('395.067', 2, '8.62595353', 9, 3);
|
||||
t('27442.6587462411378', 2, '14.74414', 7, 0);
|
||||
t('29259.23925137426', 2, '14.83660463902', 13, 1);
|
||||
t('31809.09321', 2, '14.95715162', 10, 3);
|
||||
t('21088.306138691278', 2, '14.3641556', 9, 4);
|
||||
t('21417.99322', 2, '14.386535691235055367', 20, 4);
|
||||
t('30749.008158228314845157', 2, '14.9', 3, 3);
|
||||
t('11701.5', 2, '13.51440585840535244680127', 25, 0);
|
||||
t('31737.6741', 2, '14.954', 5, 2);
|
||||
t('1688.88816886', 2, '10.7218580867075137099751634', 27, 3);
|
||||
t('31553.4', 2, '14.945507849063278420302384', 26, 1);
|
||||
t('28215.19', 2, '14.7841844442', 12, 3);
|
||||
t('6080.97', 2, '12.57008575', 10, 1);
|
||||
t('575.881932366571406', 2, '9.16962924962079798', 18, 1);
|
||||
t('4573.55560689675', 2, '12.1591004766309775332', 21, 1);
|
||||
t('24202.85989198517539', 2, '15', 2, 4);
|
||||
t('18334.9', 2, '14.16230477704721387108079127958', 31, 4);
|
||||
t('20179.623017', 2, '14.4', 3, 0);
|
||||
t('8607.97004888426002071', 2, '13.07145734276093159769689946319', 31, 1);
|
||||
t('27231.463745', 2, '14.732986911725376996874804951679', 32, 3);
|
||||
t('24325.08', 2, '14.57015693', 10, 0);
|
||||
t('826.3541073', 2, '9.69', 3, 3);
|
||||
t('6877.51851488', 2, '12.7476724030697', 15, 3);
|
||||
t('13510.031', 2, '13.7217433646123774736072103937', 30, 4);
|
||||
t('559.1647711259', 2, '9.12712965971023632', 18, 1);
|
||||
t('1262.018796786493279', 2, '10.30151768', 10, 3);
|
||||
t('31897.9889', 2, '14.9611778475691091525075', 24, 1);
|
||||
t('24187.818942357666924548', 2, '14.561', 5, 3);
|
||||
t('7233.846688339241', 2, '12.820547306996872048936910678432', 32, 3);
|
||||
t('10162.3041', 2, '13.31093992111', 13, 4);
|
||||
t('9091.859714971663525', 2, '13.1503597085807068872335', 24, 1);
|
||||
t('16205.492', 2, '13.984195201', 11, 3);
|
||||
t('17578.3501161869916711', 2, '14.101512046680555', 18, 3);
|
||||
t('5661.58', 2, '12.466989012642603919950322048', 29, 1);
|
||||
|
||||
T.stop();
|
||||
T.stop();
|
||||
})();
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,178 +1,178 @@
|
||||
if (typeof T === 'undefined') require('../setup');
|
||||
|
||||
(function () {
|
||||
T('log2');
|
||||
T('log2');
|
||||
|
||||
function t(n, expected, sd, rm) {
|
||||
Decimal.precision = sd;
|
||||
Decimal.rounding = rm;
|
||||
T.assertEqual(expected, Decimal.log2(n).valueOf());
|
||||
}
|
||||
function t(n, expected, sd, rm) {
|
||||
Decimal.precision = sd;
|
||||
Decimal.rounding = rm;
|
||||
T.assertEqual(expected, Decimal.log2(n).valueOf());
|
||||
}
|
||||
|
||||
Decimal.config({
|
||||
precision: 40,
|
||||
rounding: 4,
|
||||
toExpNeg: -9e15,
|
||||
toExpPos: 9e15,
|
||||
minE: -9e15,
|
||||
maxE: 9e15
|
||||
});
|
||||
Decimal.config({
|
||||
precision: 40,
|
||||
rounding: 4,
|
||||
toExpNeg: -9e15,
|
||||
toExpPos: 9e15,
|
||||
minE: -9e15,
|
||||
maxE: 9e15
|
||||
});
|
||||
|
||||
t('NaN', 'NaN', 40, 4);
|
||||
t('-1e-234', 'NaN', 40, 4);
|
||||
t('0', '-Infinity', 40, 4);
|
||||
t('-0', '-Infinity', 40, 4);
|
||||
t('1', '0', 40, 4);
|
||||
t('Infinity', 'Infinity', 40, 4);
|
||||
t('NaN', 'NaN', 40, 4);
|
||||
t('-1e-234', 'NaN', 40, 4);
|
||||
t('0', '-Infinity', 40, 4);
|
||||
t('-0', '-Infinity', 40, 4);
|
||||
t('1', '0', 40, 4);
|
||||
t('Infinity', 'Infinity', 40, 4);
|
||||
|
||||
// Test powers of 2
|
||||
for ( var i = 0; i < 54; i++ ) {
|
||||
t(String(Math.pow(2, i)), String(i), 40, 4);
|
||||
}
|
||||
// Test powers of 2
|
||||
for ( var i = 0; i < 54; i++ ) {
|
||||
t(String(Math.pow(2, i)), String(i), 40, 4);
|
||||
}
|
||||
|
||||
Decimal.toExpNeg = Decimal.toExpPos = 0;
|
||||
Decimal.toExpNeg = Decimal.toExpPos = 0;
|
||||
|
||||
t('7.47572e73', '2.4e+2', 2, 3);
|
||||
t('2.4e1', '4.5849626e+0', 8, 0);
|
||||
t('4.443333e5', '1.9e+1', 2, 2);
|
||||
t('5e-2', '-4.321928094e+0', 10, 2);
|
||||
t('3.89999999999999996202830641978029954e-2', '-4.68038206e+0', 9, 2);
|
||||
t('4.087056706550000000000000000000000000459999999999994e-839', '-2.7850666e+3', 8, 5);
|
||||
t('7.103772438222211905867777771222222222222222288888888806e-81', '-2.66e+2', 3, 6);
|
||||
t('2e-1', '-2.321928095e+0', 10, 5);
|
||||
t('7.0327e30', '1.02e+2', 3, 3);
|
||||
t('7.74113385511898770142564798256591111493439379377358402241596885033503e2', '9.5965e+0', 5, 0);
|
||||
t('5.0168236102e-7', '-2.092672e+1', 7, 1);
|
||||
t('3.88888888888888888888888888888888888888888888888888888888888885105520953776999999999999999959888e626', '2.09e+3', 3, 0);
|
||||
t('3.33333341e-109', '-3.603532e+2', 8, 3);
|
||||
t('9e7', '2.64234e+1', 6, 5);
|
||||
t('9.9e-7', '-1.9946e+1', 5, 1);
|
||||
t('2.9998837933e43', '1.4443e+2', 5, 6);
|
||||
t('2.280014556961415390190701451555357370581333198813706555078628347239292735244389509334786213e3', '1.1155e+1', 5, 4);
|
||||
t('9.5e-90', '-2.957e+2', 4, 6);
|
||||
t('2e893', '2.9674818e+3', 8, 6);
|
||||
t('8e-27', '-9e+1', 1, 5);
|
||||
t('1.37e910', '3.0234e+3', 5, 4);
|
||||
t('8.12836e-7', '-2e+1', 2, 4);
|
||||
t('1.74e-601', '-2e+3', 2, 3);
|
||||
t('2e-66', '-2.1824e+2', 5, 2);
|
||||
t('4.647228466399999999999999999999999999999999999999999999999999999998943563999999999999999999999999999999919327168257748860613941487999999999999999999999e-80', '-2.6353787e+2', 8, 2);
|
||||
t('6.414199e737', '2.5e+3', 2, 6);
|
||||
t('9.17e305', '1.01e+3', 3, 1);
|
||||
t('2.239999999999999999999999933510665347417652e-99', '-3.27707382e+2', 9, 2);
|
||||
t('1.3897263212335753192678233873729694699999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999e-233', '-7.74e+2', 3, 3);
|
||||
t('1e29', '9.63e+1', 3, 3);
|
||||
t('1e-4', '-1.329e+1', 4, 4);
|
||||
t('3.2e-67', '-2.208912e+2', 7, 3);
|
||||
t('8e94', '3.1526124e+2', 9, 1);
|
||||
t('7.106731e51', '1.722475e+2', 7, 4);
|
||||
t('6.8249734444444444444444444444444444348116222222222222222222222222222222274858072062638524585118791096784e-3', '-7.195e+0', 4, 5);
|
||||
t('7.9313e-38', '-1.2e+2', 2, 2);
|
||||
t('9.463228512135835081894413860589e-58', '-1.8943e+2', 6, 3);
|
||||
t('9.9e-71', '-2.4e+2', 2, 3);
|
||||
t('3e-96', '-4e+2', 1, 3);
|
||||
t('6.99448765077869176308972395456786641951135010547854119007664428296218e94', '3.1e+2', 2, 1);
|
||||
t('6e-473', '-1.568687e+3', 7, 2);
|
||||
t('8e-36', '-1.165e+2', 4, 1);
|
||||
t('3.2289084e203', '6.760424e+2', 7, 1);
|
||||
t('7.22e8', '2.94274236e+1', 9, 0);
|
||||
t('2.255555555555555830850499999e-684', '-2.2710253e+3', 8, 2);
|
||||
t('6.1558656863559636e853', '2.836e+3', 4, 3);
|
||||
t('6.47999624483501572920131e2', '1e+1', 1, 2);
|
||||
t('8e2', '9.64385619e+0', 10, 4);
|
||||
t('3.7087506033220685595355297226e77', '3e+2', 1, 5);
|
||||
t('2.999e-2', '-5.059375e+0', 7, 6);
|
||||
t('7.622e972', '3e+3', 1, 4);
|
||||
t('9e897', '2e+3', 1, 1);
|
||||
t('1.11782576e-27', '-8.9531363e+1', 8, 1);
|
||||
t('4.2e579', '1.9254668e+3', 8, 6);
|
||||
t('4.29366e-6', '-1.78293607e+1', 9, 3);
|
||||
t('2.5e11', '3.786314e+1', 7, 0);
|
||||
t('2.2e6', '2.10690721e+1', 10, 0);
|
||||
t('4.4284847498990825381935141920011840774884214901069306287301873764242619177749447748037035404379e-85', '-2.802e+2', 4, 5);
|
||||
t('1e3', '9.96578e+0', 6, 1);
|
||||
t('6.6e-7', '-2.0532e+1', 5, 0);
|
||||
t('8.690141627234254718597780859040018785362077868070223409444967282935124914698055875807134592002580083956972525898044027571687514089085870800669920198834746935239137077743100824925289e7', '2.63728764e+1', 9, 6);
|
||||
t('8.713956786790365525728798671055089827452503531619162658e-1', '-1.9860013e-1', 8, 1);
|
||||
t('5.252777777777777777777777777820165941111111162978472887747802033488044444444444444444444444444444e1', '5.71501e+0', 6, 5);
|
||||
t('9.69573459777908e-362', '-1.1992e+3', 5, 2);
|
||||
t('7.5569e-740', '-2.45531e+3', 6, 5);
|
||||
t('9.74035e-490', '-1.6e+3', 2, 1);
|
||||
t('8e-9', '-2.68973529e+1', 9, 0);
|
||||
t('1e344', '1.14e+3', 3, 1);
|
||||
t('3.3e-557', '-1.848591483e+3', 10, 3);
|
||||
t('2.73e60', '2.0076459e+2', 8, 5);
|
||||
t('7.6e1', '6.2e+0', 2, 3);
|
||||
t('7.0060379466068591e-849', '-2.817508354e+3', 10, 3);
|
||||
t('7e917', '3.049e+3', 5, 5);
|
||||
t('1.64573410691885658042240459216310152314034696136140858593166940573494665902734186270099e26', '8.708886174e+1', 10, 2);
|
||||
t('7.796e-44', '-1.4321e+2', 5, 0);
|
||||
t('5e7', '2.55754247e+1', 9, 1);
|
||||
t('8.0569e-32', '-1.033e+2', 4, 0);
|
||||
t('2.28881e-557', '-1.8491e+3', 5, 2);
|
||||
t('7.09e-724', '-2.4022502e+3', 8, 6);
|
||||
t('1.59e3', '1.063481105e+1', 10, 4);
|
||||
t('1.8e-537', '-1.783e+3', 5, 4);
|
||||
t('5.02569e-2', '-4.3145345e+0', 9, 1);
|
||||
t('9.999979e-51', '-1.66096e+2', 6, 5);
|
||||
t('9.95e10', '3.65e+1', 3, 5);
|
||||
t('3.1e652', '2.168e+3', 4, 5);
|
||||
t('7e-182', '-6.017835583e+2', 10, 2);
|
||||
t('5.99999309522985100000000000000000099e5', '1.919460131e+1', 10, 4);
|
||||
t('9.9e460', '1.53139436e+3', 9, 2);
|
||||
t('1.1447008929998e5', '1.6805e+1', 5, 4);
|
||||
t('9.097e-19', '-5.9e+1', 2, 2);
|
||||
t('6.5e52', '1.75e+2', 3, 1);
|
||||
t('9.1022e-66', '-2.16061039e+2', 9, 6);
|
||||
t('5.5e26', '8.9e+1', 2, 2);
|
||||
t('5.9747169006993667897425525812121903668273701374897278125927633480174019986342932352404691395386370402376825534060778783e-14', '-4.39282e+1', 6, 3);
|
||||
t('1.94061431409530657832815982480968096203289511358215661231397940293523261488675432814243049614887343783e8', '2.753e+1', 4, 3);
|
||||
t('9.1129e87', '2.922e+2', 4, 0);
|
||||
t('8e-6', '-1.6931569e+1', 8, 0);
|
||||
t('6.958e-344', '-1.14e+3', 3, 6);
|
||||
t('7.6e5', '1.9535e+1', 5, 3);
|
||||
t('8.96822222222222222222222222119508e-1', '-1.57106e-1', 6, 4);
|
||||
t('7.1e7', '2.6e+1', 2, 3);
|
||||
t('9e-157', '-5.1837e+2', 5, 5);
|
||||
t('7.3000000000000004188645678064142e249', '8.30028e+2', 8, 0);
|
||||
t('3e482', '1.602754e+3', 7, 3);
|
||||
t('4e-393', '-1.30352e+3', 6, 0);
|
||||
t('8.0683580222567551105228998180452489561929821735260733495394659472e-8', '-2.35e+1', 3, 1);
|
||||
t('2.5571e4', '1.46422e+1', 6, 5);
|
||||
t('6e-6', '-1.7e+1', 2, 6);
|
||||
t('1.863556445038493157629183718741040476555555567232e-19', '-6.221857529e+1', 10, 4);
|
||||
t('3.4999322222222222222222222222222222e6', '2.1739e+1', 5, 0);
|
||||
t('8.29442480297413880904354267107722332538975e7', '2.63057e+1', 6, 2);
|
||||
t('1.6075e519', '1.7247655e+3', 9, 5);
|
||||
t('5.1e1', '5.67242535e+0', 9, 0);
|
||||
t('9e64', '2.158e+2', 4, 5);
|
||||
t('1e-64', '-2.126034e+2', 8, 4);
|
||||
t('1.2e9', '3.0160387e+1', 8, 6);
|
||||
t('7.05241041246611819500000000000000000054212400000000000000000000000000000000000042232977062045088556972000000790972e6', '2.27496851e+1', 9, 0);
|
||||
t('9.99e6', '2.325205325e+1', 10, 2);
|
||||
t('5.5e8', '2.9034e+1', 5, 1);
|
||||
t('7.47572e73', '2.4e+2', 2, 3);
|
||||
t('2.4e1', '4.5849626e+0', 8, 0);
|
||||
t('4.443333e5', '1.9e+1', 2, 2);
|
||||
t('5e-2', '-4.321928094e+0', 10, 2);
|
||||
t('3.89999999999999996202830641978029954e-2', '-4.68038206e+0', 9, 2);
|
||||
t('4.087056706550000000000000000000000000459999999999994e-839', '-2.7850666e+3', 8, 5);
|
||||
t('7.103772438222211905867777771222222222222222288888888806e-81', '-2.66e+2', 3, 6);
|
||||
t('2e-1', '-2.321928095e+0', 10, 5);
|
||||
t('7.0327e30', '1.02e+2', 3, 3);
|
||||
t('7.74113385511898770142564798256591111493439379377358402241596885033503e2', '9.5965e+0', 5, 0);
|
||||
t('5.0168236102e-7', '-2.092672e+1', 7, 1);
|
||||
t('3.88888888888888888888888888888888888888888888888888888888888885105520953776999999999999999959888e626', '2.09e+3', 3, 0);
|
||||
t('3.33333341e-109', '-3.603532e+2', 8, 3);
|
||||
t('9e7', '2.64234e+1', 6, 5);
|
||||
t('9.9e-7', '-1.9946e+1', 5, 1);
|
||||
t('2.9998837933e43', '1.4443e+2', 5, 6);
|
||||
t('2.280014556961415390190701451555357370581333198813706555078628347239292735244389509334786213e3', '1.1155e+1', 5, 4);
|
||||
t('9.5e-90', '-2.957e+2', 4, 6);
|
||||
t('2e893', '2.9674818e+3', 8, 6);
|
||||
t('8e-27', '-9e+1', 1, 5);
|
||||
t('1.37e910', '3.0234e+3', 5, 4);
|
||||
t('8.12836e-7', '-2e+1', 2, 4);
|
||||
t('1.74e-601', '-2e+3', 2, 3);
|
||||
t('2e-66', '-2.1824e+2', 5, 2);
|
||||
t('4.647228466399999999999999999999999999999999999999999999999999999998943563999999999999999999999999999999919327168257748860613941487999999999999999999999e-80', '-2.6353787e+2', 8, 2);
|
||||
t('6.414199e737', '2.5e+3', 2, 6);
|
||||
t('9.17e305', '1.01e+3', 3, 1);
|
||||
t('2.239999999999999999999999933510665347417652e-99', '-3.27707382e+2', 9, 2);
|
||||
t('1.3897263212335753192678233873729694699999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999e-233', '-7.74e+2', 3, 3);
|
||||
t('1e29', '9.63e+1', 3, 3);
|
||||
t('1e-4', '-1.329e+1', 4, 4);
|
||||
t('3.2e-67', '-2.208912e+2', 7, 3);
|
||||
t('8e94', '3.1526124e+2', 9, 1);
|
||||
t('7.106731e51', '1.722475e+2', 7, 4);
|
||||
t('6.8249734444444444444444444444444444348116222222222222222222222222222222274858072062638524585118791096784e-3', '-7.195e+0', 4, 5);
|
||||
t('7.9313e-38', '-1.2e+2', 2, 2);
|
||||
t('9.463228512135835081894413860589e-58', '-1.8943e+2', 6, 3);
|
||||
t('9.9e-71', '-2.4e+2', 2, 3);
|
||||
t('3e-96', '-4e+2', 1, 3);
|
||||
t('6.99448765077869176308972395456786641951135010547854119007664428296218e94', '3.1e+2', 2, 1);
|
||||
t('6e-473', '-1.568687e+3', 7, 2);
|
||||
t('8e-36', '-1.165e+2', 4, 1);
|
||||
t('3.2289084e203', '6.760424e+2', 7, 1);
|
||||
t('7.22e8', '2.94274236e+1', 9, 0);
|
||||
t('2.255555555555555830850499999e-684', '-2.2710253e+3', 8, 2);
|
||||
t('6.1558656863559636e853', '2.836e+3', 4, 3);
|
||||
t('6.47999624483501572920131e2', '1e+1', 1, 2);
|
||||
t('8e2', '9.64385619e+0', 10, 4);
|
||||
t('3.7087506033220685595355297226e77', '3e+2', 1, 5);
|
||||
t('2.999e-2', '-5.059375e+0', 7, 6);
|
||||
t('7.622e972', '3e+3', 1, 4);
|
||||
t('9e897', '2e+3', 1, 1);
|
||||
t('1.11782576e-27', '-8.9531363e+1', 8, 1);
|
||||
t('4.2e579', '1.9254668e+3', 8, 6);
|
||||
t('4.29366e-6', '-1.78293607e+1', 9, 3);
|
||||
t('2.5e11', '3.786314e+1', 7, 0);
|
||||
t('2.2e6', '2.10690721e+1', 10, 0);
|
||||
t('4.4284847498990825381935141920011840774884214901069306287301873764242619177749447748037035404379e-85', '-2.802e+2', 4, 5);
|
||||
t('1e3', '9.96578e+0', 6, 1);
|
||||
t('6.6e-7', '-2.0532e+1', 5, 0);
|
||||
t('8.690141627234254718597780859040018785362077868070223409444967282935124914698055875807134592002580083956972525898044027571687514089085870800669920198834746935239137077743100824925289e7', '2.63728764e+1', 9, 6);
|
||||
t('8.713956786790365525728798671055089827452503531619162658e-1', '-1.9860013e-1', 8, 1);
|
||||
t('5.252777777777777777777777777820165941111111162978472887747802033488044444444444444444444444444444e1', '5.71501e+0', 6, 5);
|
||||
t('9.69573459777908e-362', '-1.1992e+3', 5, 2);
|
||||
t('7.5569e-740', '-2.45531e+3', 6, 5);
|
||||
t('9.74035e-490', '-1.6e+3', 2, 1);
|
||||
t('8e-9', '-2.68973529e+1', 9, 0);
|
||||
t('1e344', '1.14e+3', 3, 1);
|
||||
t('3.3e-557', '-1.848591483e+3', 10, 3);
|
||||
t('2.73e60', '2.0076459e+2', 8, 5);
|
||||
t('7.6e1', '6.2e+0', 2, 3);
|
||||
t('7.0060379466068591e-849', '-2.817508354e+3', 10, 3);
|
||||
t('7e917', '3.049e+3', 5, 5);
|
||||
t('1.64573410691885658042240459216310152314034696136140858593166940573494665902734186270099e26', '8.708886174e+1', 10, 2);
|
||||
t('7.796e-44', '-1.4321e+2', 5, 0);
|
||||
t('5e7', '2.55754247e+1', 9, 1);
|
||||
t('8.0569e-32', '-1.033e+2', 4, 0);
|
||||
t('2.28881e-557', '-1.8491e+3', 5, 2);
|
||||
t('7.09e-724', '-2.4022502e+3', 8, 6);
|
||||
t('1.59e3', '1.063481105e+1', 10, 4);
|
||||
t('1.8e-537', '-1.783e+3', 5, 4);
|
||||
t('5.02569e-2', '-4.3145345e+0', 9, 1);
|
||||
t('9.999979e-51', '-1.66096e+2', 6, 5);
|
||||
t('9.95e10', '3.65e+1', 3, 5);
|
||||
t('3.1e652', '2.168e+3', 4, 5);
|
||||
t('7e-182', '-6.017835583e+2', 10, 2);
|
||||
t('5.99999309522985100000000000000000099e5', '1.919460131e+1', 10, 4);
|
||||
t('9.9e460', '1.53139436e+3', 9, 2);
|
||||
t('1.1447008929998e5', '1.6805e+1', 5, 4);
|
||||
t('9.097e-19', '-5.9e+1', 2, 2);
|
||||
t('6.5e52', '1.75e+2', 3, 1);
|
||||
t('9.1022e-66', '-2.16061039e+2', 9, 6);
|
||||
t('5.5e26', '8.9e+1', 2, 2);
|
||||
t('5.9747169006993667897425525812121903668273701374897278125927633480174019986342932352404691395386370402376825534060778783e-14', '-4.39282e+1', 6, 3);
|
||||
t('1.94061431409530657832815982480968096203289511358215661231397940293523261488675432814243049614887343783e8', '2.753e+1', 4, 3);
|
||||
t('9.1129e87', '2.922e+2', 4, 0);
|
||||
t('8e-6', '-1.6931569e+1', 8, 0);
|
||||
t('6.958e-344', '-1.14e+3', 3, 6);
|
||||
t('7.6e5', '1.9535e+1', 5, 3);
|
||||
t('8.96822222222222222222222222119508e-1', '-1.57106e-1', 6, 4);
|
||||
t('7.1e7', '2.6e+1', 2, 3);
|
||||
t('9e-157', '-5.1837e+2', 5, 5);
|
||||
t('7.3000000000000004188645678064142e249', '8.30028e+2', 8, 0);
|
||||
t('3e482', '1.602754e+3', 7, 3);
|
||||
t('4e-393', '-1.30352e+3', 6, 0);
|
||||
t('8.0683580222567551105228998180452489561929821735260733495394659472e-8', '-2.35e+1', 3, 1);
|
||||
t('2.5571e4', '1.46422e+1', 6, 5);
|
||||
t('6e-6', '-1.7e+1', 2, 6);
|
||||
t('1.863556445038493157629183718741040476555555567232e-19', '-6.221857529e+1', 10, 4);
|
||||
t('3.4999322222222222222222222222222222e6', '2.1739e+1', 5, 0);
|
||||
t('8.29442480297413880904354267107722332538975e7', '2.63057e+1', 6, 2);
|
||||
t('1.6075e519', '1.7247655e+3', 9, 5);
|
||||
t('5.1e1', '5.67242535e+0', 9, 0);
|
||||
t('9e64', '2.158e+2', 4, 5);
|
||||
t('1e-64', '-2.126034e+2', 8, 4);
|
||||
t('1.2e9', '3.0160387e+1', 8, 6);
|
||||
t('7.05241041246611819500000000000000000054212400000000000000000000000000000000000042232977062045088556972000000790972e6', '2.27496851e+1', 9, 0);
|
||||
t('9.99e6', '2.325205325e+1', 10, 2);
|
||||
t('5.5e8', '2.9034e+1', 5, 1);
|
||||
|
||||
t('2.29000000000000000000000000000000941e-6064216', '-2.01448883085178626255335140463713074934932720849229068205713832098265563766344027535592e+7', 87, 0);
|
||||
t('2.98121814045205686710601835e22573260', '7.4e+7', 2, 3);
|
||||
t('8.5e-26514', '-8.80745140450022749520253952874708807185261282873713855273316844696e+4', 66, 3);
|
||||
t('4.27277644444444444445229244718482e59564', '1.9786942021770672585709275516796947196558597384271229335e+5', 56, 5);
|
||||
t('9.30924698789794524252424189e-7268098', '-2.41440957239301736069970890748362821264083887286824083322114198346358e+7', 69, 2);
|
||||
t('6.82822995960930271945935479943097116891923770438150513664283749e-73845404', '-2.4530911945439596112646746942354967782562830688718370848616148064936766e+8', 71, 3);
|
||||
t('5.84609801261197461197367777868584502410357518694058115837e53773873', '1.786329420370789890141941994715176283881591558233e+8', 49, 0);
|
||||
t('8.688278e-5896', '-1.9582968977189900276130445857722403691239834352860488495115901049392035059e+4', 74, 3);
|
||||
t('7.49799999999999999e773359', '2.6e+6', 2, 0);
|
||||
t('6.0058011661556442485511374048366250078225418753938770464520434234268903107102453944e10744', '3.56933818082e+4', 12, 5);
|
||||
t('8.68630429338007830362222222222222222222222222222222222222224311111492169e-9760', '-3.2418899463607355742502233209726140919e+4', 38, 1);
|
||||
t('9.52746022222222222222222222222222215664191409361214604694703455030696517727356425411864400894463350397433931235528e804991', '2.67412547112315240639400188262314420772255929501992193312106238120468244451376588594e+6', 84, 1);
|
||||
t('6.911111111111111111666e1', '6.1108457686882901783628093e+0', 27, 1);
|
||||
t('8.753466841179514488439739259716095758693108071675972857e23', '7.95342006969539499843372117e+1', 27, 6);
|
||||
t('6.9293897393471771424368590682187732e-4011970', '-1.33274730661169490860155583127171941591541636281413977719351949586860441308997446e+7', 82, 4);
|
||||
t('7.248721120952201811052791965700072860844575521374565607742276202674760812016031176300339165917842693831800259732548923e81275591', '2.69991672029200938697950079481902822412413739547133179600205778809e+8', 66, 6);
|
||||
t('8.839e-750866', '-2.494319717012534627980253814671911210803171821097666700403887940328806381876e+6', 76, 6);
|
||||
t('2.019694038441111111055555e78', '2.601245281582228388774544331608154321133400916160739209330622912088316832563990039571098875e+2', 91, 0);
|
||||
t('6.999992707421e-9095', '-3.02101286695814990981946878100430318253824323913669024362543485421644529066733767002654624094e+4', 93, 6);
|
||||
t('6.573152030373740763721111111111111111111111111111111111111111111111056e-77071', '-2.56021603615710387e+5', 18, 1);
|
||||
t('7.000003608682e589878', '1.959535108111633331253094708685915889078e+6', 40, 2);
|
||||
t('2.29000000000000000000000000000000941e-6064216', '-2.01448883085178626255335140463713074934932720849229068205713832098265563766344027535592e+7', 87, 0);
|
||||
t('2.98121814045205686710601835e22573260', '7.4e+7', 2, 3);
|
||||
t('8.5e-26514', '-8.80745140450022749520253952874708807185261282873713855273316844696e+4', 66, 3);
|
||||
t('4.27277644444444444445229244718482e59564', '1.9786942021770672585709275516796947196558597384271229335e+5', 56, 5);
|
||||
t('9.30924698789794524252424189e-7268098', '-2.41440957239301736069970890748362821264083887286824083322114198346358e+7', 69, 2);
|
||||
t('6.82822995960930271945935479943097116891923770438150513664283749e-73845404', '-2.4530911945439596112646746942354967782562830688718370848616148064936766e+8', 71, 3);
|
||||
t('5.84609801261197461197367777868584502410357518694058115837e53773873', '1.786329420370789890141941994715176283881591558233e+8', 49, 0);
|
||||
t('8.688278e-5896', '-1.9582968977189900276130445857722403691239834352860488495115901049392035059e+4', 74, 3);
|
||||
t('7.49799999999999999e773359', '2.6e+6', 2, 0);
|
||||
t('6.0058011661556442485511374048366250078225418753938770464520434234268903107102453944e10744', '3.56933818082e+4', 12, 5);
|
||||
t('8.68630429338007830362222222222222222222222222222222222222224311111492169e-9760', '-3.2418899463607355742502233209726140919e+4', 38, 1);
|
||||
t('9.52746022222222222222222222222222215664191409361214604694703455030696517727356425411864400894463350397433931235528e804991', '2.67412547112315240639400188262314420772255929501992193312106238120468244451376588594e+6', 84, 1);
|
||||
t('6.911111111111111111666e1', '6.1108457686882901783628093e+0', 27, 1);
|
||||
t('8.753466841179514488439739259716095758693108071675972857e23', '7.95342006969539499843372117e+1', 27, 6);
|
||||
t('6.9293897393471771424368590682187732e-4011970', '-1.33274730661169490860155583127171941591541636281413977719351949586860441308997446e+7', 82, 4);
|
||||
t('7.248721120952201811052791965700072860844575521374565607742276202674760812016031176300339165917842693831800259732548923e81275591', '2.69991672029200938697950079481902822412413739547133179600205778809e+8', 66, 6);
|
||||
t('8.839e-750866', '-2.494319717012534627980253814671911210803171821097666700403887940328806381876e+6', 76, 6);
|
||||
t('2.019694038441111111055555e78', '2.601245281582228388774544331608154321133400916160739209330622912088316832563990039571098875e+2', 91, 0);
|
||||
t('6.999992707421e-9095', '-3.02101286695814990981946878100430318253824323913669024362543485421644529066733767002654624094e+4', 93, 6);
|
||||
t('6.573152030373740763721111111111111111111111111111111111111111111111056e-77071', '-2.56021603615710387e+5', 18, 1);
|
||||
t('7.000003608682e589878', '1.959535108111633331253094708685915889078e+6', 40, 2);
|
||||
|
||||
T.stop();
|
||||
T.stop();
|
||||
})();
|
||||
|
@ -1,78 +1,78 @@
|
||||
if (typeof T === 'undefined') require('../setup');
|
||||
|
||||
(function () {
|
||||
T('min and max');
|
||||
T('min and max');
|
||||
|
||||
function t(min, max, arr) {
|
||||
T.assertEqual(new Decimal(max).valueOf(), Decimal.max.apply(Decimal, arr).valueOf());
|
||||
T.assertEqual(new Decimal(min).valueOf(), Decimal.min.apply(Decimal, arr).valueOf());
|
||||
}
|
||||
function t(min, max, arr) {
|
||||
T.assertEqual(new Decimal(max).valueOf(), Decimal.max.apply(Decimal, arr).valueOf());
|
||||
T.assertEqual(new Decimal(min).valueOf(), Decimal.min.apply(Decimal, arr).valueOf());
|
||||
}
|
||||
|
||||
Decimal.config({
|
||||
precision: 20,
|
||||
rounding: 4,
|
||||
toExpNeg: -7,
|
||||
toExpPos: 21,
|
||||
minE: -9e15,
|
||||
maxE: 9e15
|
||||
});
|
||||
Decimal.config({
|
||||
precision: 20,
|
||||
rounding: 4,
|
||||
toExpNeg: -7,
|
||||
toExpPos: 21,
|
||||
minE: -9e15,
|
||||
maxE: 9e15
|
||||
});
|
||||
|
||||
t(NaN, NaN, [NaN]);
|
||||
t(NaN, NaN, [-2, 0, -1, NaN]);
|
||||
t(NaN, NaN, [-2, NaN, 0, -1]);
|
||||
t(NaN, NaN, [NaN, -2, 0, -1]);
|
||||
t(NaN, NaN, [NaN, -2, 0, -1]);
|
||||
t(NaN, NaN, [-2, 0, -1, new Decimal(NaN)]);
|
||||
t(NaN, NaN, [-2, 0, -1, new Decimal(NaN)]);
|
||||
t(NaN, NaN, [Infinity, -2, 'NaN', 0, -1, -Infinity]);
|
||||
t(NaN, NaN, ['NaN', Infinity, -2, 0, -1, -Infinity]);
|
||||
t(NaN, NaN, [Infinity, -2, NaN, 0, -1, -Infinity]);
|
||||
t(NaN, NaN, [NaN]);
|
||||
t(NaN, NaN, [-2, 0, -1, NaN]);
|
||||
t(NaN, NaN, [-2, NaN, 0, -1]);
|
||||
t(NaN, NaN, [NaN, -2, 0, -1]);
|
||||
t(NaN, NaN, [NaN, -2, 0, -1]);
|
||||
t(NaN, NaN, [-2, 0, -1, new Decimal(NaN)]);
|
||||
t(NaN, NaN, [-2, 0, -1, new Decimal(NaN)]);
|
||||
t(NaN, NaN, [Infinity, -2, 'NaN', 0, -1, -Infinity]);
|
||||
t(NaN, NaN, ['NaN', Infinity, -2, 0, -1, -Infinity]);
|
||||
t(NaN, NaN, [Infinity, -2, NaN, 0, -1, -Infinity]);
|
||||
|
||||
t(0, 0, [0, 0, 0]);
|
||||
t(-2, Infinity, [-2, 0, -1, Infinity]);
|
||||
t(-Infinity, 0, [-2, 0, -1, -Infinity]);
|
||||
t(-Infinity, Infinity, [-Infinity, -2, 0, -1, Infinity]);
|
||||
t(-Infinity, Infinity, [Infinity, -2, 0, -1, -Infinity]);
|
||||
t(-Infinity, Infinity, [-Infinity, -2, 0, new Decimal(Infinity)]);
|
||||
t(0, 0, [0, 0, 0]);
|
||||
t(-2, Infinity, [-2, 0, -1, Infinity]);
|
||||
t(-Infinity, 0, [-2, 0, -1, -Infinity]);
|
||||
t(-Infinity, Infinity, [-Infinity, -2, 0, -1, Infinity]);
|
||||
t(-Infinity, Infinity, [Infinity, -2, 0, -1, -Infinity]);
|
||||
t(-Infinity, Infinity, [-Infinity, -2, 0, new Decimal(Infinity)]);
|
||||
|
||||
t(-2, 0, [-2, 0, -1]);
|
||||
t(-2, 0, [-2, -1, 0]);
|
||||
t(-2, 0, [0, -2, -1]);
|
||||
t(-2, 0, [0, -1, -2]);
|
||||
t(-2, 0, [-1, -2, 0]);
|
||||
t(-2, 0, [-1, 0, -2]);
|
||||
t(-2, 0, [-2, 0, -1]);
|
||||
t(-2, 0, [-2, -1, 0]);
|
||||
t(-2, 0, [0, -2, -1]);
|
||||
t(-2, 0, [0, -1, -2]);
|
||||
t(-2, 0, [-1, -2, 0]);
|
||||
t(-2, 0, [-1, 0, -2]);
|
||||
|
||||
t(-1, 1, [-1, 0, 1]);
|
||||
t(-1, 1, [-1, 1, 0]);
|
||||
t(-1, 1, [0, -1, 1]);
|
||||
t(-1, 1, [0, 1, -1]);
|
||||
t(-1, 1, [1, -1, 0]);
|
||||
t(-1, 1, [1, 0, -1]);
|
||||
t(-1, 1, [-1, 0, 1]);
|
||||
t(-1, 1, [-1, 1, 0]);
|
||||
t(-1, 1, [0, -1, 1]);
|
||||
t(-1, 1, [0, 1, -1]);
|
||||
t(-1, 1, [1, -1, 0]);
|
||||
t(-1, 1, [1, 0, -1]);
|
||||
|
||||
t(0, 2, [0, 1, 2]);
|
||||
t(0, 2, [0, 2, 1]);
|
||||
t(0, 2, [1, 0, 2]);
|
||||
t(0, 2, [1, 2, 0]);
|
||||
t(0, 2, [2, 1, 0]);
|
||||
t(0, 2, [2, 0, 1]);
|
||||
t(0, 2, [0, 1, 2]);
|
||||
t(0, 2, [0, 2, 1]);
|
||||
t(0, 2, [1, 0, 2]);
|
||||
t(0, 2, [1, 2, 0]);
|
||||
t(0, 2, [2, 1, 0]);
|
||||
t(0, 2, [2, 0, 1]);
|
||||
|
||||
t(-1, 1, ['-1', 0, new Decimal(1)]);
|
||||
t(-1, 1, ['-1', new Decimal(1)]);
|
||||
t(-1, 1, [0, '-1', new Decimal(1)]);
|
||||
t(0, 1, [0, new Decimal(1)]);
|
||||
t(1, 1, [new Decimal(1)]);
|
||||
t(-1, -1, [new Decimal(-1)]);
|
||||
t(-1, 1, ['-1', 0, new Decimal(1)]);
|
||||
t(-1, 1, ['-1', new Decimal(1)]);
|
||||
t(-1, 1, [0, '-1', new Decimal(1)]);
|
||||
t(0, 1, [0, new Decimal(1)]);
|
||||
t(1, 1, [new Decimal(1)]);
|
||||
t(-1, -1, [new Decimal(-1)]);
|
||||
|
||||
t(0.0009999, 0.0010001, [0.001, 0.0009999, 0.0010001]);
|
||||
t(-0.0010001, -0.0009999, [-0.001, -0.0009999, -0.0010001]);
|
||||
t(-0.000001, 999.001, [2, -0, '1e-9000000000000000', 324.32423423, -0.000001, '999.001', 10]);
|
||||
t('-9.99999e+9000000000000000', Infinity, [10, '-9.99999e+9000000000000000', new Decimal(Infinity), '9.99999e+9000000000000000', 0]);
|
||||
t('-9.999999e+9000000000000000', '1.01e+9000000000000000', ['-9.99998e+9000000000000000', '-9.999999e+9000000000000000', '9e+8999999999999999', '1.01e+9000000000000000', 1e+300]);
|
||||
t(1, Infinity, [1, '1e+9000000000000001', 1e200]);
|
||||
t(-Infinity, 1, [1, '-1e+9000000000000001', -1e200]);
|
||||
t(0, 1, [1, '1e-9000000000000001', 1e-200]);
|
||||
t(-0, 1, [1, '-1e-9000000000000001', 1e-200]);
|
||||
t(-3, 3, [1, '2', 3, '-1', -2, '-3']);
|
||||
t(0.0009999, 0.0010001, [0.001, 0.0009999, 0.0010001]);
|
||||
t(-0.0010001, -0.0009999, [-0.001, -0.0009999, -0.0010001]);
|
||||
t(-0.000001, 999.001, [2, -0, '1e-9000000000000000', 324.32423423, -0.000001, '999.001', 10]);
|
||||
t('-9.99999e+9000000000000000', Infinity, [10, '-9.99999e+9000000000000000', new Decimal(Infinity), '9.99999e+9000000000000000', 0]);
|
||||
t('-9.999999e+9000000000000000', '1.01e+9000000000000000', ['-9.99998e+9000000000000000', '-9.999999e+9000000000000000', '9e+8999999999999999', '1.01e+9000000000000000', 1e+300]);
|
||||
t(1, Infinity, [1, '1e+9000000000000001', 1e200]);
|
||||
t(-Infinity, 1, [1, '-1e+9000000000000001', -1e200]);
|
||||
t(0, 1, [1, '1e-9000000000000001', 1e-200]);
|
||||
t(-0, 1, [1, '-1e-9000000000000001', 1e-200]);
|
||||
t(-3, 3, [1, '2', 3, '-1', -2, '-3']);
|
||||
|
||||
T.stop();
|
||||
T.stop();
|
||||
})();
|
||||
|
File diff suppressed because it is too large
Load Diff
2090
test/modules/mod.js
2090
test/modules/mod.js
File diff suppressed because it is too large
Load Diff
@ -1,226 +1,226 @@
|
||||
if (typeof T === 'undefined') require('../setup');
|
||||
|
||||
(function () {
|
||||
T('negated');
|
||||
T('negated');
|
||||
|
||||
function t(expected, n) {
|
||||
T.assertEqual(expected, new Decimal(n).neg().valueOf());
|
||||
}
|
||||
function t(expected, n) {
|
||||
T.assertEqual(expected, new Decimal(n).neg().valueOf());
|
||||
}
|
||||
|
||||
Decimal.config({
|
||||
precision: 20,
|
||||
rounding: 4,
|
||||
toExpNeg: -7,
|
||||
toExpPos: 21,
|
||||
minE: -9e15,
|
||||
maxE: 9e15
|
||||
});
|
||||
Decimal.config({
|
||||
precision: 20,
|
||||
rounding: 4,
|
||||
toExpNeg: -7,
|
||||
toExpPos: 21,
|
||||
minE: -9e15,
|
||||
maxE: 9e15
|
||||
});
|
||||
|
||||
t('-4', 4);
|
||||
t('-2147483648', 2147483648);
|
||||
t('-0.25', 0.25);
|
||||
t('-0.0625', 0.0625);
|
||||
t('-1', 1);
|
||||
t('1', -1);
|
||||
t('-0', 0);
|
||||
t('0', -0);
|
||||
t('-0', '0');
|
||||
t('0', '-0');
|
||||
t('NaN', NaN);
|
||||
t('NaN', 'NaN');
|
||||
t('-Infinity', Infinity);
|
||||
t('Infinity', -Infinity);
|
||||
t('-Infinity', 'Infinity');
|
||||
t('Infinity', '-Infinity');
|
||||
t('-4', 4);
|
||||
t('-2147483648', 2147483648);
|
||||
t('-0.25', 0.25);
|
||||
t('-0.0625', 0.0625);
|
||||
t('-1', 1);
|
||||
t('1', -1);
|
||||
t('-0', 0);
|
||||
t('0', -0);
|
||||
t('-0', '0');
|
||||
t('0', '-0');
|
||||
t('NaN', NaN);
|
||||
t('NaN', 'NaN');
|
||||
t('-Infinity', Infinity);
|
||||
t('Infinity', -Infinity);
|
||||
t('-Infinity', 'Infinity');
|
||||
t('Infinity', '-Infinity');
|
||||
|
||||
t('-9.99e+9000000000000000', '9.99e+9000000000000000');
|
||||
t('9.99e+9000000000000000', '-9.99e+9000000000000000');
|
||||
t('-Infinity', '1e+9000000000000001');
|
||||
t('Infinity', '-1e+9000000000000001');
|
||||
t('-1e-9000000000000000', '1e-9000000000000000');
|
||||
t('1e-9000000000000000', '-1e-9000000000000000');
|
||||
t('0', '-1e-9000000000000001');
|
||||
t('-9.99e+9000000000000000', '9.99e+9000000000000000');
|
||||
t('9.99e+9000000000000000', '-9.99e+9000000000000000');
|
||||
t('-Infinity', '1e+9000000000000001');
|
||||
t('Infinity', '-1e+9000000000000001');
|
||||
t('-1e-9000000000000000', '1e-9000000000000000');
|
||||
t('1e-9000000000000000', '-1e-9000000000000000');
|
||||
t('0', '-1e-9000000000000001');
|
||||
|
||||
t('-238', '238');
|
||||
t('1.3e-11', '-0.000000000013');
|
||||
t('-33.1', '33.1');
|
||||
t('2.61', '-2.61');
|
||||
t('-4', '4.0');
|
||||
t('-5.8', '5.8');
|
||||
t('-3.52e-7', '0.000000352');
|
||||
t('190', '-190');
|
||||
t('4.47', '-4.47');
|
||||
t('6.9525e-12', '-0.0000000000069525');
|
||||
t('1.3', '-1.3');
|
||||
t('-6.21', '6.21');
|
||||
t('2', '-2');
|
||||
t('-1', '1');
|
||||
t('147.857', '-147.857');
|
||||
t('-26.517', '26.517');
|
||||
t('-3', '3');
|
||||
t('5', '-5');
|
||||
t('204', '-204');
|
||||
t('2.1e-8', '-0.000000021');
|
||||
t('3.7015e-7', '-0.00000037015');
|
||||
t('-50.1839', '50.1839');
|
||||
t('44768.1', '-44768.1');
|
||||
t('3.8e-15', '-0.0000000000000038');
|
||||
t('-7.4379', '7.4379');
|
||||
t('1.5', '-1.5');
|
||||
t('6.0399', '-6.0399');
|
||||
t('109.07', '-109.070');
|
||||
t('1582', '-1582');
|
||||
t('-772', '772');
|
||||
t('-6.7824e-14', '0.000000000000067824');
|
||||
t('-1.819e-8', '0.00000001819');
|
||||
t('-3e-15', '0.0000000000000030');
|
||||
t('-424120', '424120');
|
||||
t('-1814.54', '1814.54');
|
||||
t('-4.295e-17', '0.00000000000000004295');
|
||||
t('-5', '5');
|
||||
t('2152', '-2152');
|
||||
t('4.6', '-4.6');
|
||||
t('1.9', '-1.9');
|
||||
t('-2', '2.0');
|
||||
t('-0.00036', '0.00036');
|
||||
t('-0.000006962', '0.000006962');
|
||||
t('3.6', '-3.6');
|
||||
t('-1.1495e-14', '0.000000000000011495');
|
||||
t('-312.4', '312.4');
|
||||
t('4.3e-10', '-0.00000000043');
|
||||
t('5', '-5');
|
||||
t('-1.8911e-8', '0.000000018911');
|
||||
t('4963.53', '-4963.53');
|
||||
t('-4.3934e-10', '0.00000000043934');
|
||||
t('-1.3', '1.30');
|
||||
t('-1', '1.0');
|
||||
t('-68.32', '68.32');
|
||||
t('0.014836', '-0.014836');
|
||||
t('8', '-8');
|
||||
t('2.1351', '-2.13510');
|
||||
t('162224', '-162224');
|
||||
t('3e-19', '-0.00000000000000000030');
|
||||
t('0.00004985', '-0.00004985');
|
||||
t('28.9321', '-28.9321');
|
||||
t('-2', '2');
|
||||
t('-16688', '16688');
|
||||
t('-1', '1');
|
||||
t('5', '-5');
|
||||
t('-20', '20.0');
|
||||
t('-1.9', '1.9');
|
||||
t('3', '-3');
|
||||
t('185640', '-185640');
|
||||
t('-0.0000058', '0.0000058');
|
||||
t('9.67e-13', '-0.000000000000967');
|
||||
t('-707.98', '707.98');
|
||||
t('2.57917', '-2.57917');
|
||||
t('-1.3', '1.3');
|
||||
t('-4.2655', '4.2655');
|
||||
t('-149.6', '149.6');
|
||||
t('-1.32383', '1.32383');
|
||||
t('-26.925', '26.925');
|
||||
t('-0.00013', '0.00013');
|
||||
t('-6868', '6868');
|
||||
t('7', '-7');
|
||||
t('-5e-9', '0.0000000050');
|
||||
t('3.2555e-16', '-0.00000000000000032555');
|
||||
t('1.42768e-13', '-0.000000000000142768');
|
||||
t('11.2962', '-11.2962');
|
||||
t('3186.7', '-3186.7');
|
||||
t('-6.9', '6.9');
|
||||
t('-6.2618e-7', '0.00000062618');
|
||||
t('8', '-8');
|
||||
t('-8.04', '8.04');
|
||||
t('-22', '22');
|
||||
t('-750.6', '750.6');
|
||||
t('12.803', '-12.803');
|
||||
t('-20513.4', '20513.4');
|
||||
t('114781', '-114781');
|
||||
t('-16.9046', '16.9046');
|
||||
t('4.6e-7', '-0.00000046');
|
||||
t('-31399', '31399');
|
||||
t('1.04', '-1.04');
|
||||
t('-51.2544', '51.2544');
|
||||
t('1.023e-15', '-0.000000000000001023');
|
||||
t('281', '-281');
|
||||
t('-128315', '128315');
|
||||
t('20.2', '-20.2');
|
||||
t('9', '-9');
|
||||
t('-10', '10');
|
||||
t('-1.92262e-17', '0.0000000000000000192262');
|
||||
t('-0.0023', '0.0023');
|
||||
t('5', '-5');
|
||||
t('7', '-7');
|
||||
t('13.72', '-13.72');
|
||||
t('98068', '-98068');
|
||||
t('3.2', '-3.2');
|
||||
t('1.1', '-1.1');
|
||||
t('-3.97e-18', '0.000000000000000003970');
|
||||
t('0.00334824', '-0.00334824');
|
||||
t('-5.4892e-8', '0.000000054892');
|
||||
t('-1', '1.0');
|
||||
t('-2.8135e-8', '0.000000028135');
|
||||
t('-1.816e-13', '0.0000000000001816');
|
||||
t('199724', '-199724');
|
||||
t('-19.4', '19.40');
|
||||
t('-12.74', '12.74');
|
||||
t('-2171.8', '2171.8');
|
||||
t('-2.7', '2.7');
|
||||
t('1', '-1.0');
|
||||
t('21779', '-21779');
|
||||
t('8.9e-12', '-0.0000000000089');
|
||||
t('-4.51', '4.51');
|
||||
t('2.6', '-2.6');
|
||||
t('-0.00016', '0.000160');
|
||||
t('6', '-6');
|
||||
t('50.566', '-50.566');
|
||||
t('-16.2', '16.2');
|
||||
t('-9444', '9444');
|
||||
t('21.4', '-21.4');
|
||||
t('2.5', '-2.5');
|
||||
t('489311', '-489311');
|
||||
t('6.8', '-6.8');
|
||||
t('4.29', '-4.29');
|
||||
t('23982', '-23982.0');
|
||||
t('-0.0111781', '0.0111781');
|
||||
t('4.96e-20', '-0.0000000000000000000496');
|
||||
t('-40.5481', '40.5481');
|
||||
t('-32.52', '32.52');
|
||||
t('-7.4', '7.4');
|
||||
t('-5', '5.0');
|
||||
t('-2463.4', '2463.4');
|
||||
t('7.363', '-7.363');
|
||||
t('2.8', '-2.8');
|
||||
t('-14498', '14498');
|
||||
t('201', '-201');
|
||||
t('-238', '238');
|
||||
t('1.3e-11', '-0.000000000013');
|
||||
t('-33.1', '33.1');
|
||||
t('2.61', '-2.61');
|
||||
t('-4', '4.0');
|
||||
t('-5.8', '5.8');
|
||||
t('-3.52e-7', '0.000000352');
|
||||
t('190', '-190');
|
||||
t('4.47', '-4.47');
|
||||
t('6.9525e-12', '-0.0000000000069525');
|
||||
t('1.3', '-1.3');
|
||||
t('-6.21', '6.21');
|
||||
t('2', '-2');
|
||||
t('-1', '1');
|
||||
t('147.857', '-147.857');
|
||||
t('-26.517', '26.517');
|
||||
t('-3', '3');
|
||||
t('5', '-5');
|
||||
t('204', '-204');
|
||||
t('2.1e-8', '-0.000000021');
|
||||
t('3.7015e-7', '-0.00000037015');
|
||||
t('-50.1839', '50.1839');
|
||||
t('44768.1', '-44768.1');
|
||||
t('3.8e-15', '-0.0000000000000038');
|
||||
t('-7.4379', '7.4379');
|
||||
t('1.5', '-1.5');
|
||||
t('6.0399', '-6.0399');
|
||||
t('109.07', '-109.070');
|
||||
t('1582', '-1582');
|
||||
t('-772', '772');
|
||||
t('-6.7824e-14', '0.000000000000067824');
|
||||
t('-1.819e-8', '0.00000001819');
|
||||
t('-3e-15', '0.0000000000000030');
|
||||
t('-424120', '424120');
|
||||
t('-1814.54', '1814.54');
|
||||
t('-4.295e-17', '0.00000000000000004295');
|
||||
t('-5', '5');
|
||||
t('2152', '-2152');
|
||||
t('4.6', '-4.6');
|
||||
t('1.9', '-1.9');
|
||||
t('-2', '2.0');
|
||||
t('-0.00036', '0.00036');
|
||||
t('-0.000006962', '0.000006962');
|
||||
t('3.6', '-3.6');
|
||||
t('-1.1495e-14', '0.000000000000011495');
|
||||
t('-312.4', '312.4');
|
||||
t('4.3e-10', '-0.00000000043');
|
||||
t('5', '-5');
|
||||
t('-1.8911e-8', '0.000000018911');
|
||||
t('4963.53', '-4963.53');
|
||||
t('-4.3934e-10', '0.00000000043934');
|
||||
t('-1.3', '1.30');
|
||||
t('-1', '1.0');
|
||||
t('-68.32', '68.32');
|
||||
t('0.014836', '-0.014836');
|
||||
t('8', '-8');
|
||||
t('2.1351', '-2.13510');
|
||||
t('162224', '-162224');
|
||||
t('3e-19', '-0.00000000000000000030');
|
||||
t('0.00004985', '-0.00004985');
|
||||
t('28.9321', '-28.9321');
|
||||
t('-2', '2');
|
||||
t('-16688', '16688');
|
||||
t('-1', '1');
|
||||
t('5', '-5');
|
||||
t('-20', '20.0');
|
||||
t('-1.9', '1.9');
|
||||
t('3', '-3');
|
||||
t('185640', '-185640');
|
||||
t('-0.0000058', '0.0000058');
|
||||
t('9.67e-13', '-0.000000000000967');
|
||||
t('-707.98', '707.98');
|
||||
t('2.57917', '-2.57917');
|
||||
t('-1.3', '1.3');
|
||||
t('-4.2655', '4.2655');
|
||||
t('-149.6', '149.6');
|
||||
t('-1.32383', '1.32383');
|
||||
t('-26.925', '26.925');
|
||||
t('-0.00013', '0.00013');
|
||||
t('-6868', '6868');
|
||||
t('7', '-7');
|
||||
t('-5e-9', '0.0000000050');
|
||||
t('3.2555e-16', '-0.00000000000000032555');
|
||||
t('1.42768e-13', '-0.000000000000142768');
|
||||
t('11.2962', '-11.2962');
|
||||
t('3186.7', '-3186.7');
|
||||
t('-6.9', '6.9');
|
||||
t('-6.2618e-7', '0.00000062618');
|
||||
t('8', '-8');
|
||||
t('-8.04', '8.04');
|
||||
t('-22', '22');
|
||||
t('-750.6', '750.6');
|
||||
t('12.803', '-12.803');
|
||||
t('-20513.4', '20513.4');
|
||||
t('114781', '-114781');
|
||||
t('-16.9046', '16.9046');
|
||||
t('4.6e-7', '-0.00000046');
|
||||
t('-31399', '31399');
|
||||
t('1.04', '-1.04');
|
||||
t('-51.2544', '51.2544');
|
||||
t('1.023e-15', '-0.000000000000001023');
|
||||
t('281', '-281');
|
||||
t('-128315', '128315');
|
||||
t('20.2', '-20.2');
|
||||
t('9', '-9');
|
||||
t('-10', '10');
|
||||
t('-1.92262e-17', '0.0000000000000000192262');
|
||||
t('-0.0023', '0.0023');
|
||||
t('5', '-5');
|
||||
t('7', '-7');
|
||||
t('13.72', '-13.72');
|
||||
t('98068', '-98068');
|
||||
t('3.2', '-3.2');
|
||||
t('1.1', '-1.1');
|
||||
t('-3.97e-18', '0.000000000000000003970');
|
||||
t('0.00334824', '-0.00334824');
|
||||
t('-5.4892e-8', '0.000000054892');
|
||||
t('-1', '1.0');
|
||||
t('-2.8135e-8', '0.000000028135');
|
||||
t('-1.816e-13', '0.0000000000001816');
|
||||
t('199724', '-199724');
|
||||
t('-19.4', '19.40');
|
||||
t('-12.74', '12.74');
|
||||
t('-2171.8', '2171.8');
|
||||
t('-2.7', '2.7');
|
||||
t('1', '-1.0');
|
||||
t('21779', '-21779');
|
||||
t('8.9e-12', '-0.0000000000089');
|
||||
t('-4.51', '4.51');
|
||||
t('2.6', '-2.6');
|
||||
t('-0.00016', '0.000160');
|
||||
t('6', '-6');
|
||||
t('50.566', '-50.566');
|
||||
t('-16.2', '16.2');
|
||||
t('-9444', '9444');
|
||||
t('21.4', '-21.4');
|
||||
t('2.5', '-2.5');
|
||||
t('489311', '-489311');
|
||||
t('6.8', '-6.8');
|
||||
t('4.29', '-4.29');
|
||||
t('23982', '-23982.0');
|
||||
t('-0.0111781', '0.0111781');
|
||||
t('4.96e-20', '-0.0000000000000000000496');
|
||||
t('-40.5481', '40.5481');
|
||||
t('-32.52', '32.52');
|
||||
t('-7.4', '7.4');
|
||||
t('-5', '5.0');
|
||||
t('-2463.4', '2463.4');
|
||||
t('7.363', '-7.363');
|
||||
t('2.8', '-2.8');
|
||||
t('-14498', '14498');
|
||||
t('201', '-201');
|
||||
|
||||
Decimal.toExpNeg = Decimal.toExpPos = 0;
|
||||
Decimal.toExpNeg = Decimal.toExpPos = 0;
|
||||
|
||||
t('-5.0600621890668482322956892808849303e+20', '5.0600621890668482322956892808849303e+20');
|
||||
t('7e+0', '-7e+0');
|
||||
t('-6.1095374220609e+13', '6.1095374220609e+13');
|
||||
t('9.01e+2', '-9.01e+2');
|
||||
t('-1.016984074247269470395836690098169093010136836967e+39', '1.016984074247269470395836690098169093010136836967e+39');
|
||||
t('-1.497639134680472576e+18', '1.497639134680472576e+18');
|
||||
t('-4.1717657571404248e+16', '4.1717657571404248e+16');
|
||||
t('8.983272e+1', '-8.983272e+1');
|
||||
t('-5.308416e+6', '5.308416e+6');
|
||||
t('-2.09764e+3', '2.09764e+3');
|
||||
t('-3.83432050166120236679168e+23', '3.83432050166120236679168e+23');
|
||||
t('-4.096e+3', '4.096e+3');
|
||||
t('2.679971527468745095582058350756311201706813294321409e+51', '-2.679971527468745095582058350756311201706813294321409e+51');
|
||||
t('-5.067853299870089529116832768e+2', '5.067853299870089529116832768e+2');
|
||||
t('-3.48822062687911109850066182676769e+32', '3.48822062687911109850066182676769e+32');
|
||||
t('-1e+0', '1e+0');
|
||||
t('4.2773e+0', '-4.2773e+0');
|
||||
t('5.8169306081172252508071119604378757744768e+12', '-5.8169306081172252508071119604378757744768e+12');
|
||||
t('-1e+0', '1e+0');
|
||||
t('1.51655708279450944384385164853883404204414169862685507e+46', '-1.51655708279450944384385164853883404204414169862685507e+46');
|
||||
t('-8.1e+1', '8.1e+1');
|
||||
t('-1.296e+3', '1.296e+3');
|
||||
t('-2.9e+0', '2.9e+0');
|
||||
t('-1.764e+3', '1.764e+3');
|
||||
t('9.3418332730097368870513138581415704704611459349313e+49', '-9.3418332730097368870513138581415704704611459349313e+49');
|
||||
t('-5.0600621890668482322956892808849303e+20', '5.0600621890668482322956892808849303e+20');
|
||||
t('7e+0', '-7e+0');
|
||||
t('-6.1095374220609e+13', '6.1095374220609e+13');
|
||||
t('9.01e+2', '-9.01e+2');
|
||||
t('-1.016984074247269470395836690098169093010136836967e+39', '1.016984074247269470395836690098169093010136836967e+39');
|
||||
t('-1.497639134680472576e+18', '1.497639134680472576e+18');
|
||||
t('-4.1717657571404248e+16', '4.1717657571404248e+16');
|
||||
t('8.983272e+1', '-8.983272e+1');
|
||||
t('-5.308416e+6', '5.308416e+6');
|
||||
t('-2.09764e+3', '2.09764e+3');
|
||||
t('-3.83432050166120236679168e+23', '3.83432050166120236679168e+23');
|
||||
t('-4.096e+3', '4.096e+3');
|
||||
t('2.679971527468745095582058350756311201706813294321409e+51', '-2.679971527468745095582058350756311201706813294321409e+51');
|
||||
t('-5.067853299870089529116832768e+2', '5.067853299870089529116832768e+2');
|
||||
t('-3.48822062687911109850066182676769e+32', '3.48822062687911109850066182676769e+32');
|
||||
t('-1e+0', '1e+0');
|
||||
t('4.2773e+0', '-4.2773e+0');
|
||||
t('5.8169306081172252508071119604378757744768e+12', '-5.8169306081172252508071119604378757744768e+12');
|
||||
t('-1e+0', '1e+0');
|
||||
t('1.51655708279450944384385164853883404204414169862685507e+46', '-1.51655708279450944384385164853883404204414169862685507e+46');
|
||||
t('-8.1e+1', '8.1e+1');
|
||||
t('-1.296e+3', '1.296e+3');
|
||||
t('-2.9e+0', '2.9e+0');
|
||||
t('-1.764e+3', '1.764e+3');
|
||||
t('9.3418332730097368870513138581415704704611459349313e+49', '-9.3418332730097368870513138581415704704611459349313e+49');
|
||||
|
||||
T.stop();
|
||||
T.stop();
|
||||
})();
|
||||
|
2056
test/modules/plus.js
2056
test/modules/plus.js
File diff suppressed because it is too large
Load Diff
@ -1,133 +1,132 @@
|
||||
if (typeof T === 'undefined') require('../setup');
|
||||
|
||||
(function () {
|
||||
T('pow');
|
||||
T('pow');
|
||||
|
||||
t = function (base, exp, expected, sd, rm) {
|
||||
Decimal.precision = sd;
|
||||
Decimal.rounding = rm;
|
||||
T.assertEqual(expected, Decimal.pow(base, exp).valueOf());
|
||||
T.assertEqual(expected, new Decimal(base).pow(exp).valueOf());
|
||||
}
|
||||
t = function (base, exp, expected, sd, rm) {
|
||||
Decimal.precision = sd;
|
||||
Decimal.rounding = rm;
|
||||
T.assertEqual(expected, new Decimal(base).pow(exp).valueOf());
|
||||
}
|
||||
|
||||
Decimal.config({
|
||||
precision: 40,
|
||||
rounding: 4,
|
||||
toExpNeg: -9e15,
|
||||
toExpPos: 9e15,
|
||||
minE: -9e15,
|
||||
maxE: 9e15
|
||||
});
|
||||
Decimal.config({
|
||||
precision: 40,
|
||||
rounding: 4,
|
||||
toExpNeg: -9e15,
|
||||
toExpPos: 9e15,
|
||||
minE: -9e15,
|
||||
maxE: 9e15
|
||||
});
|
||||
|
||||
t('9', '0.5', '3', 7, 4);
|
||||
t('9', '0.5', '3', 26, 4);
|
||||
t('0.9999999999', '6', '0.999999999400000000149999999980000000001', 39, 4);
|
||||
t('2.56', '6.5', '450.3599627370496', 16, 1);
|
||||
t('1.96', '1.5', '2.744', 15, 1);
|
||||
t('2.25', '9.5', '2216.8378200531005859375', 23, 1);
|
||||
t('11.05', '2.00000000000000007', '122.103', 6, 4);
|
||||
t('10.5', '3.000000000000000002', '1157.63', 6, 4);
|
||||
t('1.00000000000000000003', '4.00000005', '1.000000000000000000120000002', 28, 4);
|
||||
t('6.0000005', '1.00000000000000006', '6.000001', 7, 4);
|
||||
t('1.0000000000000000000005', '49.0000000000000000000002', '1.000000000000000000025', 22, 4);
|
||||
t('15.333333333333333333', '28.33333333333333', '3917746643938779840069598486694964.98308568625045', 49, 4);
|
||||
t('7.537714', '7.9', '8515169.08260507715975', 21, 4);
|
||||
t('6.951', '9.225', '58598464.57', 10, 4);
|
||||
t('6.01093', '9.8911', '50651225.3819968681522216250662534915', 36, 4);
|
||||
t('8.7587', '4.23', '9694.37298592397372', 18, 4);
|
||||
t('5.1749', '7.7267995', '328229.2815443039852', 19, 4);
|
||||
t('0.16', '-0.9999999999999', '6.2', 2, 4);
|
||||
t('0.4', '-20', '90949470.1772928237915039063', 27, 4);
|
||||
t('0.5', '22', '0.000000238418579101563', 15, 4);
|
||||
t('32', '0.4', '4', 1, 4);
|
||||
t('4', '2.5', '32', 11, 4);
|
||||
t('4', '5.5', '2048', 27, 4);
|
||||
t('16', '23.5', '19807040628566084398385987584', 29, 4);
|
||||
t('16', '26.5', '81129638414606681695789005144064', 35, 4);
|
||||
t('25', '13.5', '7450580596923828125', 39, 4);
|
||||
t('32', '28.2', '2787593149816327892691964784081045188247552', 43, 4);
|
||||
t('32', '3.6', '262144', 35, 4);
|
||||
t('25', '21.5', '1136868377216160297393798828125', 31, 4);
|
||||
t('9', '8.5', '129140163', 19, 4);
|
||||
t('4', '7.5', '32768', 13, 4);
|
||||
t('4', '6.5', '8192', 10, 4);
|
||||
t('6.034', '0.25964', '2', 1, 4);
|
||||
t('9', '4.5', '19683', 16, 4);
|
||||
t('9', '1.5', '27', 5, 4);
|
||||
t('9.61', '3.5', '2751.2614111', 12, 4);
|
||||
t('4', '6.5', '8192', 8, 4);
|
||||
t('4', '7.5', '32768', 11, 4);
|
||||
t('9', '4.5', '19683', 5, 4);
|
||||
t('9', '0.5', '3', 7, 4);
|
||||
t('9', '0.5', '3', 26, 4);
|
||||
t('0.9999999999', '6', '0.999999999400000000149999999980000000001', 39, 4);
|
||||
t('2.56', '6.5', '450.3599627370496', 16, 1);
|
||||
t('1.96', '1.5', '2.744', 15, 1);
|
||||
t('2.25', '9.5', '2216.8378200531005859375', 23, 1);
|
||||
t('11.05', '2.00000000000000007', '122.103', 6, 4);
|
||||
t('10.5', '3.000000000000000002', '1157.63', 6, 4);
|
||||
t('1.00000000000000000003', '4.00000005', '1.000000000000000000120000002', 28, 4);
|
||||
t('6.0000005', '1.00000000000000006', '6.000001', 7, 4);
|
||||
t('1.0000000000000000000005', '49.0000000000000000000002', '1.000000000000000000025', 22, 4);
|
||||
t('15.333333333333333333', '28.33333333333333', '3917746643938779840069598486694964.98308568625045', 49, 4);
|
||||
t('7.537714', '7.9', '8515169.08260507715975', 21, 4);
|
||||
t('6.951', '9.225', '58598464.57', 10, 4);
|
||||
t('6.01093', '9.8911', '50651225.3819968681522216250662534915', 36, 4);
|
||||
t('8.7587', '4.23', '9694.37298592397372', 18, 4);
|
||||
t('5.1749', '7.7267995', '328229.2815443039852', 19, 4);
|
||||
t('0.16', '-0.9999999999999', '6.2', 2, 4);
|
||||
t('0.4', '-20', '90949470.1772928237915039063', 27, 4);
|
||||
t('0.5', '22', '0.000000238418579101563', 15, 4);
|
||||
t('32', '0.4', '4', 1, 4);
|
||||
t('4', '2.5', '32', 11, 4);
|
||||
t('4', '5.5', '2048', 27, 4);
|
||||
t('16', '23.5', '19807040628566084398385987584', 29, 4);
|
||||
t('16', '26.5', '81129638414606681695789005144064', 35, 4);
|
||||
t('25', '13.5', '7450580596923828125', 39, 4);
|
||||
t('32', '28.2', '2787593149816327892691964784081045188247552', 43, 4);
|
||||
t('32', '3.6', '262144', 35, 4);
|
||||
t('25', '21.5', '1136868377216160297393798828125', 31, 4);
|
||||
t('9', '8.5', '129140163', 19, 4);
|
||||
t('4', '7.5', '32768', 13, 4);
|
||||
t('4', '6.5', '8192', 10, 4);
|
||||
t('6.034', '0.25964', '2', 1, 4);
|
||||
t('9', '4.5', '19683', 16, 4);
|
||||
t('9', '1.5', '27', 5, 4);
|
||||
t('9.61', '3.5', '2751.2614111', 12, 4);
|
||||
t('4', '6.5', '8192', 8, 4);
|
||||
t('4', '7.5', '32768', 11, 4);
|
||||
t('9', '4.5', '19683', 5, 4);
|
||||
|
||||
t('48.9262695992662373981', '1.0', '48.926269599266237', 17, 1);
|
||||
t('1.21', '0.5', '1.1', 2, 1);
|
||||
t('12.96', '0.5', '3.6', 2, 3);
|
||||
t('3.24', '0.5', '1.8', 2, 1);
|
||||
t('70.56', '0.5', '8.4', 2, 3);
|
||||
t('4.41', '6.5', '15447.2377739119461', 32, 3);
|
||||
t('11.05', '2.00000000000000007', '122.103', 6, 4);
|
||||
t('10.5', '3.000000000000000002', '1157.63', 6, 4);
|
||||
t('1.00000000000000000003', '4.00000005', '1.000000000000000000120000002', 28, 4);
|
||||
t('6.0000005', '1.00000000000000006', '6.000001', 7, 4);
|
||||
t('1.0000000000000000000005', '49.0000000000000000000002', '1.000000000000000000025', 22, 4);
|
||||
t('5344.87762641765349023882127126550721', '1.0625', '9139.7407411741874683083843738640173291', 38, 1);
|
||||
t('28', '6.166675020000903537297764507632802193308677149', '839756321.64088511', 17, 0);
|
||||
t('91.180153837', '0.5', '9.54882997214842023704943457512609', 33, 1);
|
||||
t('16', '26.5', '81129638414606681695789005144064', 35, 4);
|
||||
t('25', '13.5', '7450580596923828125', 39, 4);
|
||||
t('4.3985903', '20.9956530307', '32120869378609.033520730996715368034448124619', 44, 2);
|
||||
t('2.858368', '48.97', '21682301291468972839895.193017121528607658932', 44, 5);
|
||||
t('91.145', '23.8479557348417627', '54402923894673605836306983589686900000000000000', 33, 1);
|
||||
t('48.9262695992662373981', '1.0', '48.926269599266237', 17, 1);
|
||||
t('1.21', '0.5', '1.1', 2, 1);
|
||||
t('12.96', '0.5', '3.6', 2, 3);
|
||||
t('3.24', '0.5', '1.8', 2, 1);
|
||||
t('70.56', '0.5', '8.4', 2, 3);
|
||||
t('4.41', '6.5', '15447.2377739119461', 32, 3);
|
||||
t('11.05', '2.00000000000000007', '122.103', 6, 4);
|
||||
t('10.5', '3.000000000000000002', '1157.63', 6, 4);
|
||||
t('1.00000000000000000003', '4.00000005', '1.000000000000000000120000002', 28, 4);
|
||||
t('6.0000005', '1.00000000000000006', '6.000001', 7, 4);
|
||||
t('1.0000000000000000000005', '49.0000000000000000000002', '1.000000000000000000025', 22, 4);
|
||||
t('5344.87762641765349023882127126550721', '1.0625', '9139.7407411741874683083843738640173291', 38, 1);
|
||||
t('28', '6.166675020000903537297764507632802193308677149', '839756321.64088511', 17, 0);
|
||||
t('91.180153837', '0.5', '9.54882997214842023704943457512609', 33, 1);
|
||||
t('16', '26.5', '81129638414606681695789005144064', 35, 4);
|
||||
t('25', '13.5', '7450580596923828125', 39, 4);
|
||||
t('4.3985903', '20.9956530307', '32120869378609.033520730996715368034448124619', 44, 2);
|
||||
t('2.858368', '48.97', '21682301291468972839895.193017121528607658932', 44, 5);
|
||||
t('91.145', '23.8479557348417627', '54402923894673605836306983589686900000000000000', 33, 1);
|
||||
|
||||
t('5.379973182', '2.65', '86.4', 3, 6);
|
||||
t('625', '4.5', '3814697265625', 13, 0);
|
||||
t('65536', '1.25', '1048576', 7, 5);
|
||||
t('9', '1.5', '27', 2, 8);
|
||||
t('256', '1.625', '8192', 4, 8);
|
||||
t('65536', '1.875', '1073741824', 10, 6);
|
||||
t('65536', '2.5', '1099511627776', 13, 1);
|
||||
t('625', '5.25', '476837158203125', 15, 4);
|
||||
t('5.379973182', '2.65', '86.4', 3, 6);
|
||||
t('625', '4.5', '3814697265625', 13, 0);
|
||||
t('65536', '1.25', '1048576', 7, 5);
|
||||
t('9', '1.5', '27', 2, 8);
|
||||
t('256', '1.625', '8192', 4, 8);
|
||||
t('65536', '1.875', '1073741824', 10, 6);
|
||||
t('65536', '2.5', '1099511627776', 13, 1);
|
||||
t('625', '5.25', '476837158203125', 15, 4);
|
||||
|
||||
t('0.16', '-0.9999999999999', '6.2', 2, 4);
|
||||
t('3.6361', '-0.06', '0.92547', 5, 4);
|
||||
t('8.7881541', '-0.00000006', '0.999999869595727123998', 22, 4);
|
||||
t('5.812', '-0.99999', '0.17206083953928505581714758136682954', 35, 4);
|
||||
t('6.06737421654397', '-0.000000000001', '0.99999999999819707407228698', 26, 4);
|
||||
t('5.57197470953405387', '-0.9', '0.213', 3, 4);
|
||||
t('8.4297580531324', '-0.000000000000002', '0.99999999999999573646385819', 26, 4);
|
||||
t('1.746122696164', '-0.9', '0.605526', 6, 4);
|
||||
t('5.74274073282643192871', '-0.000000000000004', '0.999999999999993008253696156596264156', 36, 4);
|
||||
t('9.66306878602393217324', '-0.999', '0.1037217997755957147', 19, 4);
|
||||
t('5', '-0.9999999', '0.200000032188760838972540436', 28, 4);
|
||||
t('0.16', '-0.9999999999999', '6.2', 2, 4);
|
||||
t('3.6361', '-0.06', '0.92547', 5, 4);
|
||||
t('8.7881541', '-0.00000006', '0.999999869595727123998', 22, 4);
|
||||
t('5.812', '-0.99999', '0.17206083953928505581714758136682954', 35, 4);
|
||||
t('6.06737421654397', '-0.000000000001', '0.99999999999819707407228698', 26, 4);
|
||||
t('5.57197470953405387', '-0.9', '0.213', 3, 4);
|
||||
t('8.4297580531324', '-0.000000000000002', '0.99999999999999573646385819', 26, 4);
|
||||
t('1.746122696164', '-0.9', '0.605526', 6, 4);
|
||||
t('5.74274073282643192871', '-0.000000000000004', '0.999999999999993008253696156596264156', 36, 4);
|
||||
t('9.66306878602393217324', '-0.999', '0.1037217997755957147', 19, 4);
|
||||
t('5', '-0.9999999', '0.200000032188760838972540436', 28, 4);
|
||||
|
||||
t('21.8005326254960840089', '14.99999999999999999999', '119400615273418803650.1362563340821916898208389', 46, 4);
|
||||
t('46.80102307015', '4.000001', '4797589.19437982876031', 21, 4);
|
||||
t('29.255206217375', '9.9999999999999999999999999', '459231465846284.22207', 20, 4);
|
||||
t('0.72591761772', '6.999999999999999999999', '0.106221237503302998', 18, 4);
|
||||
t('0.3928066161887', '32.0002', '0.00000000000010319062643292561810866879769121849802', 38, 4);
|
||||
t('24.798046085018648753453', '5.9999999999999999', '232543806.207', 12, 4);
|
||||
t('20.485568584242', '18.99999999999999999999999', '8270131718672851271097903.87621818958353436851582', 48, 4);
|
||||
t('969.0', '-1', '0.0010319917440660474716202', 23, 4);
|
||||
t('8.97', '-1', '0.111482720178', 12, 3);
|
||||
t('61766796871807246.3278075', '-1', '0.00000000000000001618993', 7, 0);
|
||||
t('21.8005326254960840089', '14.99999999999999999999', '119400615273418803650.1362563340821916898208389', 46, 4);
|
||||
t('46.80102307015', '4.000001', '4797589.19437982876031', 21, 4);
|
||||
t('29.255206217375', '9.9999999999999999999999999', '459231465846284.22207', 20, 4);
|
||||
t('0.72591761772', '6.999999999999999999999', '0.106221237503302998', 18, 4);
|
||||
t('0.3928066161887', '32.0002', '0.00000000000010319062643292561810866879769121849802', 38, 4);
|
||||
t('24.798046085018648753453', '5.9999999999999999', '232543806.207', 12, 4);
|
||||
t('20.485568584242', '18.99999999999999999999999', '8270131718672851271097903.87621818958353436851582', 48, 4);
|
||||
t('969.0', '-1', '0.0010319917440660474716202', 23, 4);
|
||||
t('8.97', '-1', '0.111482720178', 12, 3);
|
||||
t('61766796871807246.3278075', '-1', '0.00000000000000001618993', 7, 0);
|
||||
|
||||
Decimal.toExpNeg = Decimal.toExpPos = 0;
|
||||
Decimal.toExpNeg = Decimal.toExpPos = 0;
|
||||
|
||||
t('9.9999999999999', '2220.75', '5.623413251778e+2220', 13, 1);
|
||||
t('0.9999999999999999991999999999019999949909999999', '2220.75', '9.999999999999982233999997e-1', 25, 1);
|
||||
t('987504387560932846509387650789.49807365', '981459.4903857', '9.876e+29438424', 4, 4);
|
||||
t('9.9999999999999', '2220.75', '5.623413251778e+2220', 13, 1);
|
||||
t('0.9999999999999999991999999999019999949909999999', '2220.75', '9.999999999999982233999997e-1', 25, 1);
|
||||
t('987504387560932846509387650789.49807365', '981459.4903857', '9.876e+29438424', 4, 4);
|
||||
|
||||
t('-2', '1001', '-2.1430172143725346418e+301', 20, 1);
|
||||
t('-2', 1e6, '9.9006562292958982506979236164e+301029', 29, 0);
|
||||
t('-2', '1001', '-2.1430172143725346418e+301', 20, 1);
|
||||
t('-2', 1e6, '9.9006562292958982506979236164e+301029', 29, 0);
|
||||
|
||||
t('5.0771598579583468811E-101844', '7064449.87442997380369702938801116641723585825702571602', '3.907934864857193219594361275098983e-719466848189', 34, 1);
|
||||
t('5.80246472674775E+21125581', '0.00077726506294426495082193497633668602085', '1.5018938138904125617523547e+16420', 26, 3);
|
||||
t('1.66630944E+74', '6980757669.9081156729942256', '3.74152e+518124090060', 6, 5);
|
||||
t('5.9E+6', '3456.7700', '1.8971788927235700943477592799711063194e+23405', 38, 0);
|
||||
t('93720986.7819907489497420190553708041564963922285117', '39.580', '3.3e+315', 2, 1);
|
||||
t('908948247.896330216349750387912923575076135766138', '11.38907521122213262858256836', '1.0702278292293091784680297675223031e+102', 35, 3);
|
||||
t('4.485925762349120387154391E+47', '1677945.16766265206929939', '8.53959030215133943e+79957194', 18, 5);
|
||||
t('2.8448989811706207675566E+89', '2.368592228588521845032068137267440272102614', '7.58940197453762187722508511706932e+211', 33, 5);
|
||||
t('5.0771598579583468811E-101844', '7064449.87442997380369702938801116641723585825702571602', '3.907934864857193219594361275098983e-719466848189', 34, 1);
|
||||
t('5.80246472674775E+21125581', '0.00077726506294426495082193497633668602085', '1.5018938138904125617523547e+16420', 26, 3);
|
||||
t('1.66630944E+74', '6980757669.9081156729942256', '3.74152e+518124090060', 6, 5);
|
||||
t('5.9E+6', '3456.7700', '1.8971788927235700943477592799711063194e+23405', 38, 0);
|
||||
t('93720986.7819907489497420190553708041564963922285117', '39.580', '3.3e+315', 2, 1);
|
||||
t('908948247.896330216349750387912923575076135766138', '11.38907521122213262858256836', '1.0702278292293091784680297675223031e+102', 35, 3);
|
||||
t('4.485925762349120387154391E+47', '1677945.16766265206929939', '8.53959030215133943e+79957194', 18, 5);
|
||||
t('2.8448989811706207675566E+89', '2.368592228588521845032068137267440272102614', '7.58940197453762187722508511706932e+211', 33, 5);
|
||||
|
||||
T.stop();
|
||||
T.stop();
|
||||
})();
|
||||
|
@ -1,42 +1,42 @@
|
||||
if (typeof T === 'undefined') require('../setup');
|
||||
|
||||
(function () {
|
||||
T('pow against sqrt');
|
||||
T('pow against sqrt');
|
||||
|
||||
Decimal.config({
|
||||
toExpNeg: -7,
|
||||
toExpPos: 21,
|
||||
minE: -9e15,
|
||||
maxE: 9e15
|
||||
});
|
||||
Decimal.config({
|
||||
toExpNeg: -7,
|
||||
toExpPos: 21,
|
||||
minE: -9e15,
|
||||
maxE: 9e15
|
||||
});
|
||||
|
||||
for (var e, n, p, r, s; total < 10000; ) {
|
||||
for (var e, n, p, r, s; total < 10000; ) {
|
||||
|
||||
// Get a random value in the range [0,1) with a random number of significant digits
|
||||
// in the range [1, 40], as a string in exponential format.
|
||||
e = Decimal.random( Math.random() * 40 + 1 | 0 ).toExponential();
|
||||
// Get a random value in the range [0,1) with a random number of significant digits
|
||||
// in the range [1, 40], as a string in exponential format.
|
||||
e = Decimal.random( Math.random() * 40 + 1 | 0 ).toExponential();
|
||||
|
||||
// Change exponent to a non-zero value of random length in the range (-9e15, 9e15).
|
||||
r = new Decimal(e.slice(0, e.indexOf('e') + 1) + ( Math.random() < 0.5 ? '-' : '' ) +
|
||||
( n = Math.floor( Math.random() * 9e15 ) + '' ).slice( Math.random() * n.length | 0 ));
|
||||
//T.write(' r: ' + r);
|
||||
// Change exponent to a non-zero value of random length in the range (-9e15, 9e15).
|
||||
r = new Decimal(e.slice(0, e.indexOf('e') + 1) + ( Math.random() < 0.5 ? '-' : '' ) +
|
||||
( n = Math.floor( Math.random() * 9e15 ) + '' ).slice( Math.random() * n.length | 0 ));
|
||||
//console.log(' r: ' + r);
|
||||
|
||||
// Random rounding mode.
|
||||
Decimal.rounding = Math.random() * 9 | 0;
|
||||
// Random rounding mode.
|
||||
Decimal.rounding = Math.random() * 9 | 0;
|
||||
|
||||
// Random precision in the range [1, 40].
|
||||
Decimal.precision = Math.random() * 40 + 1 | 0;
|
||||
// Random precision in the range [1, 40].
|
||||
Decimal.precision = Math.random() * 40 + 1 | 0;
|
||||
|
||||
p = r.pow(0.5);
|
||||
//T.write(' r.pow(0.5): ' + p);
|
||||
p = r.pow(0.5);
|
||||
//console.log(' r.pow(0.5): ' + p);
|
||||
|
||||
// sqrt is much faster than pow(0.5)
|
||||
s = r.sqrt();
|
||||
//T.write(' r.sqrt(): ' + s);
|
||||
// sqrt is much faster than pow(0.5)
|
||||
s = r.sqrt();
|
||||
//console.log(' r.sqrt(): ' + s);
|
||||
|
||||
T.assertEqual(p.valueOf(), s.valueOf());
|
||||
}
|
||||
T.assertEqual(p.valueOf(), s.valueOf());
|
||||
}
|
||||
|
||||
T.stop();
|
||||
T.stop();
|
||||
})();
|
||||
|
||||
|
@ -1,32 +1,32 @@
|
||||
if (typeof T === 'undefined') require('../setup');
|
||||
|
||||
(function () {
|
||||
T('random');
|
||||
T('random');
|
||||
|
||||
function tx(fn, msg) {
|
||||
T.assertException(fn, msg);
|
||||
function tx(fn, msg) {
|
||||
T.assertException(fn, msg);
|
||||
}
|
||||
|
||||
var i, sd, maxDigits = 100;
|
||||
|
||||
for (i = 0; i < 996; i++) {
|
||||
Decimal.crypto = Math.random() > 0.5;
|
||||
sd = Math.random() * maxDigits + 1 | 0;
|
||||
|
||||
if (Math.random() > 0.5) {
|
||||
Decimal.precision = sd;
|
||||
r = Decimal.random();
|
||||
} else {
|
||||
r = Decimal.random(sd);
|
||||
}
|
||||
|
||||
var i, sd, maxDigits = 100;
|
||||
T.assert(r.sd() <= sd && r.gte(0) && r.lt(1) && r.eq(r) && r.eq(r.valueOf()));
|
||||
}
|
||||
|
||||
for (i = 0; i < 996; i++) {
|
||||
Decimal.crypto = Math.random() > 0.5;
|
||||
sd = Math.random() * maxDigits + 1 | 0;
|
||||
tx(function () { Decimal.random(Infinity) }, 'Infinity');
|
||||
tx(function () { Decimal.random('-Infinity') }, "'-Infinity'");
|
||||
tx(function () { Decimal.random(NaN) }, 'NaN');
|
||||
tx(function () { Decimal.random(null) }, 'null');
|
||||
|
||||
if (Math.random() > 0.5) {
|
||||
Decimal.precision = sd;
|
||||
r = Decimal.random();
|
||||
} else {
|
||||
r = Decimal.random(sd);
|
||||
}
|
||||
|
||||
T.assert(r.sd() <= sd && r.gte(0) && r.lt(1) && r.eq(r) && r.eq(r.valueOf()));
|
||||
}
|
||||
|
||||
tx(function () { Decimal.random(Infinity) }, 'Infinity');
|
||||
tx(function () { Decimal.random('-Infinity') }, "'-Infinity'");
|
||||
tx(function () { Decimal.random(NaN) }, 'NaN');
|
||||
tx(function () { Decimal.random(null) }, 'null');
|
||||
|
||||
T.stop();
|
||||
T.stop();
|
||||
})();
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,30 +1,30 @@
|
||||
if (typeof T === 'undefined') require('../setup');
|
||||
|
||||
(function () {
|
||||
T('sign');
|
||||
T('sign');
|
||||
|
||||
function t(n, expected) {
|
||||
T.assertEqual(expected, Decimal.sign(n));
|
||||
}
|
||||
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(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.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('0', 0);
|
||||
t('-0', -0);
|
||||
t('1', 1);
|
||||
t('-1', -1);
|
||||
t('9.99', 1);
|
||||
t('-9.99', -1);
|
||||
|
||||
T.stop();
|
||||
T.stop();
|
||||
})();
|
||||
|
@ -1,131 +1,125 @@
|
||||
if (typeof T === 'undefined') require('../setup');
|
||||
|
||||
(function () {
|
||||
T('sin');
|
||||
T('sin');
|
||||
|
||||
function t(n, pr, rm, expected) {
|
||||
Decimal.precision = pr;
|
||||
Decimal.rounding = rm;
|
||||
var x = new Decimal(n);
|
||||
T.assertEqual(expected, x.sin().valueOf());
|
||||
T.assertEqual(expected, Decimal.sin(n).valueOf());
|
||||
T.assert(x.eq(n) || x.isNaN());
|
||||
}
|
||||
function t(n, pr, rm, expected) {
|
||||
Decimal.precision = pr;
|
||||
Decimal.rounding = rm;
|
||||
T.assertEqual(expected, new Decimal(n).sin().valueOf());
|
||||
}
|
||||
|
||||
Decimal.config({
|
||||
precision: 40,
|
||||
rounding: 4,
|
||||
toExpNeg: -9e15,
|
||||
toExpPos: 9e15,
|
||||
minE: -9e15,
|
||||
maxE: 9e15
|
||||
});
|
||||
Decimal.config({
|
||||
precision: 40,
|
||||
rounding: 4,
|
||||
toExpNeg: -9e15,
|
||||
toExpPos: 9e15,
|
||||
minE: -9e15,
|
||||
maxE: 9e15
|
||||
});
|
||||
|
||||
t('NaN', 40, 4, 'NaN');
|
||||
t('0', 20, 4, '0');
|
||||
t('-0', 20, 4, '-0');
|
||||
t('Infinity', 40, 4, 'NaN');
|
||||
t('-Infinity', 40, 4, 'NaN');
|
||||
t('NaN', 40, 4, 'NaN');
|
||||
t('0', 20, 4, '0');
|
||||
t('-0', 20, 4, '-0');
|
||||
t('Infinity', 40, 4, 'NaN');
|
||||
t('-Infinity', 40, 4, 'NaN');
|
||||
|
||||
t('93332358216', 48, 5, '0.000816283943127306029649893248669685836695194145277');
|
||||
t('766737078569022420173292205068953186848344673451240027655054631094318050', 18, 6, '0.00111135055272494455');
|
||||
t('93332358216', 48, 5, '0.000816283943127306029649893248669685836695194145277');
|
||||
t('766737078569022420173292205068953186848344673451240027655054631094318050', 18, 6, '0.00111135055272494455');
|
||||
|
||||
t('-93332358216', 48, 5, '-0.000816283943127306029649893248669685836695194145277');
|
||||
t('-766737078569022420173292205068953186848344673451240027655054631094318050', 18, 6, '-0.00111135055272494455');
|
||||
t('0.359136383962093189473162700700590970518456985109181875257764726415814563424613193774806585890478208084275468196568294033', 38, 1, '0.35146584650000000000000000000000000006');
|
||||
t('3202222222227222222222222222222224222222222222222222222222.222222222222222222222222222', 7, 0, '0.5499568');
|
||||
t('8', 5, 6, '0.98936');
|
||||
t('0.15865555', 6, 0, '0.157991');
|
||||
t('4.752', 5, 5, '-0.99922');
|
||||
t('82315980453524767298085693995239044972', 5, 6, '0.18971');
|
||||
t('9975666666', 10, 4, '-0.1932244457');
|
||||
t('8111111111111111222222222222222.1118', 8, 4, '0.93383768');
|
||||
t('1582389099446045988.444444444164077777777777777777', 3, 5, '0.145');
|
||||
t('42.29499991999999919999999919', 2, 5, '-0.99');
|
||||
t('2', 3, 1, '0.909');
|
||||
t('225204831071708162873414430801935442203', 3, 4, '-0.367');
|
||||
t('70387777777777777777', 6, 6, '-0.903662');
|
||||
t('0.000009960105486531367489163480390414384530151948706557615588133070855712559603', 5, 3, '0.0000099601');
|
||||
t('2.3', 1, 5, '0.7');
|
||||
t('0.0369897655941305860082440964', 1, 0, '0.04');
|
||||
t('93333333333.1111111113333335607254506018497853948241554833333333', 1, 4, '1');
|
||||
t('0.81475726', 10, 2, '0.7275590895');
|
||||
t('0.0020719', 5, 2, '0.0020719');
|
||||
t('0.822309454290117043180146453820530722', 3, 2, '0.733');
|
||||
t('811801481366184919659088.161679696898591', 8, 0, '-0.33739172');
|
||||
t('82222222239', 6, 1, '0.85357');
|
||||
t('0.671515352458', 4, 1, '0.6221');
|
||||
t('0.1', 10, 2, '0.09983341665');
|
||||
t('30.4507', 5, 0, '-0.82218');
|
||||
t('82539', 1, 6, '0.06');
|
||||
t('7904297312438003184', 8, 1, '0.88548151');
|
||||
t('1555591677261255189013625216076301609467761280', 4, 4, '0.6012');
|
||||
t('0.206', 5, 0, '0.20455');
|
||||
t('47.85', 4, 3, '-0.664');
|
||||
t('354522', 6, 0, '-0.432959');
|
||||
t('57111.555555555551111', 9, 1, '-0.51645502');
|
||||
t('5084117035723528870966332457.91693481159599044107', 10, 0, '0.5456651665');
|
||||
t('66', 3, 2, '-0.0265');
|
||||
t('4415133931290705273393593393689.69701970681754754956578240920056', 3, 4, '0.651');
|
||||
t('4641', 4, 1, '-0.7628');
|
||||
t('60782.222222', 3, 0, '-0.967');
|
||||
t('9295.7', 4, 1, '0.2692');
|
||||
t('660060.8', 5, 6, '-0.3736');
|
||||
t('86', 7, 0, '-0.9234585');
|
||||
t('0.867224365334893476015547423881141062327495194226274166759019810427983958472019', 7, 0, '0.7625362');
|
||||
t('35', 9, 4, '-0.428182669');
|
||||
t('6.4522', 4, 2, '0.1683');
|
||||
t('74298341154961724283464838063126436742467617925325544', 6, 5, '0.381838');
|
||||
t('98.9', 1, 3, '-1');
|
||||
t('8719985534823285.8450271997', 5, 4, '-0.43915');
|
||||
t('0.9528405', 9, 0, '0.815064492');
|
||||
t('3007.440843', 1, 3, '-0.9');
|
||||
t('8821000', 9, 3, '-0.999820738');
|
||||
t('0.7244', 2, 5, '0.66');
|
||||
t('223798525254185007541841321707204622.59819179923', 16, 1, '0.7304638404669184');
|
||||
t('29832077939805655500490926756388', 31, 5, '0.9999881003434971787558628446047');
|
||||
t('13555555555555.00000000000000000472565', 49, 1, '0.6767787926553990715415556952412713237217924208783');
|
||||
t('899998709983400169781485597598985275361858454653904477166', 80, 0, '-0.9619682988852763093696947825524296540074948329137260856105387448568258894882118');
|
||||
t('39826881720735191122621609200399853', 63, 6, '0.808868299975611790138921415253062939870563699821120858587818528');
|
||||
t('0.005341982048471623278003226810889859381173803701969742990587783072822', 70, 4, '0.005341956641353734027312587021500975661701907307617983686735841700502311');
|
||||
t('277.9997777777777716692059399741498679999', 30, 6, '0.999514190524582708045097875864');
|
||||
t('61429536536284373.1373681766492167', 72, 0, '-0.987289391477952440400357263926723647295916567423922849613191038848150249');
|
||||
t('7499999999909999997.909999999999', 71, 4, '0.34301339416705489181513042461845425762147177499632116466434976820897798');
|
||||
t('349999995999999999939992999.92', 78, 4, '0.470719374558628137654141208065693026899676258865423797523069796274766223234845');
|
||||
t('44510000000002060000000000000000.0200000008', 20, 5, '0.94842545081726504808');
|
||||
t('62222222222293973777.555555555555577777777777', 20, 1, '0.97474440584787996681');
|
||||
t('0.00000075952439582097539633', 49, 6, '0.0000007595243958209023709318824206298992320090760083707');
|
||||
t('6466917226846635097989717000204.490981137498768', 23, 6, '-0.5067890798594245927272');
|
||||
t('90000000000000007122', 12, 0, '-0.953061948465');
|
||||
t('0.422029137363394323', 22, 5, '0.4096123952171808560627');
|
||||
t('818.843', 70, 1, '0.8968883045810930941510638401062405075664719019866066309176929107557629');
|
||||
t('30000000000000000200000000000003000000000000005.0000009', 50, 2, '-0.12313481713171373142907951990491671356466363502241');
|
||||
t('975675853314022371079225', 48, 5, '0.880137190184686438889125592539968640170534430859');
|
||||
t('0.00000066558889026', 77, 6, '0.00000066558889025995085640282676346670712623242127613563915036627009080674622220984');
|
||||
t('69299999.9999999999999', 46, 5, '-0.3462252058608000475638742067375334366431550575');
|
||||
t('8111111111267488711.9286432453434826269588597', 62, 4, '-0.99113853372157352283292183868051054140090305817866106070973511');
|
||||
t('82', 71, 0, '0.31322878243308515263353199729481870255069002611658346075413062493460387');
|
||||
t('488826170909042284127242210428971', 76, 6, '0.8995289099301142050732477297866877720021805553317366849920338096104233105207');
|
||||
t('9092229227242222522222222222.66', 18, 0, '-0.935465793019682237');
|
||||
t('5805959970379373082098495883210891370.0067111', 46, 6, '0.2201197700332631564419599177639647998475543596');
|
||||
t('926600000000000000590', 41, 2, '0.81228550764810620054247659502626219692234');
|
||||
t('619490746366110587736593084360', 65, 1, '0.21194121003724604936564767272815880572843184525364715905320674006');
|
||||
t('5473424', 25, 0, '0.09262060997310434002923837');
|
||||
t('5666666666666666666666666666666666666666666666616666626.6666', 87, 4, '-0.977239495645491722400759456250446932597508047794151805593705662875402907345001472700784');
|
||||
t('499999.99999899999999999999999999999999999', 78, 5, '0.177832185579176104658571003320627225266903968719990210539163985433843099469721');
|
||||
t('900000', 117, 3, '0.316282026370992050734738815532587276379228020456998295610327862506624971973233544404550831654146703508761520381016242');
|
||||
t('83027766684462236825322.62114650623171519639122521318', 12, 4, '-0.476316326483');
|
||||
t('925910897623', 129, 5, '0.792868652237225000804927754028414838623611710010734993138551247754919869022556217868513568705036768423332287103460206126685907362');
|
||||
t('2918961308828646648994639730677467564302490828837720043486456401538236854705425586479512418277497121841759061091363', 23, 0, '-0.80586906475943044297492');
|
||||
t('800000000000000', 13, 2, '0.9931677199759');
|
||||
t('18400003.16100000000000032', 8, 6, '0.27307495');
|
||||
t('99.999999999999999999999999999999999999999999999993', 63, 4, '-0.506365641109758793656557610459785432065032721296693555549406261');
|
||||
t('20694757397464803355324887435556580472151471', 24, 6, '-0.0958707304545699270391254');
|
||||
t('333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333.33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333335', 171, 3, '0.999861104212610844432827649084650490692662683912806434297051730891484017620891490814751729807506108594451118885277110368312661669230716203945478379798471281336247356157603');
|
||||
t('22011131111011111.111111611113111111111151111111', 143, 2, '0.82582504036277799386306063085803210583251158969990606609364360685569588545519071481543672724620118406694191888115120286393881609546697317692404');
|
||||
t('996270725099515169352424536636186062915113219400094989.8763797268889422850038402633796294758036260533902551191769915343780424028900449342752548782035', 46, 2, '0.6613706114081017074779805460666900787572253475');
|
||||
t('0.780360750628373', 37, 5, '0.7035358359376557390803090830882458906');
|
||||
|
||||
t('0.359136383962093189473162700700590970518456985109181875257764726415814563424613193774806585890478208084275468196568294033', 38, 1, '0.35146584650000000000000000000000000006');
|
||||
t('3202222222227222222222222222222224222222222222222222222222.222222222222222222222222222', 7, 0, '0.5499568');
|
||||
t('8', 5, 6, '0.98936');
|
||||
t('0.15865555', 6, 0, '0.157991');
|
||||
t('4.752', 5, 5, '-0.99922');
|
||||
t('82315980453524767298085693995239044972', 5, 6, '0.18971');
|
||||
t('9975666666', 10, 4, '-0.1932244457');
|
||||
t('8111111111111111222222222222222.1118', 8, 4, '0.93383768');
|
||||
t('1582389099446045988.444444444164077777777777777777', 3, 5, '0.145');
|
||||
t('42.29499991999999919999999919', 2, 5, '-0.99');
|
||||
t('2', 3, 1, '0.909');
|
||||
t('225204831071708162873414430801935442203', 3, 4, '-0.367');
|
||||
t('70387777777777777777', 6, 6, '-0.903662');
|
||||
t('0.000009960105486531367489163480390414384530151948706557615588133070855712559603', 5, 3, '0.0000099601');
|
||||
t('2.3', 1, 5, '0.7');
|
||||
t('0.0369897655941305860082440964', 1, 0, '0.04');
|
||||
t('93333333333.1111111113333335607254506018497853948241554833333333', 1, 4, '1');
|
||||
t('0.81475726', 10, 2, '0.7275590895');
|
||||
t('0.0020719', 5, 2, '0.0020719');
|
||||
t('0.822309454290117043180146453820530722', 3, 2, '0.733');
|
||||
t('811801481366184919659088.161679696898591', 8, 0, '-0.33739172');
|
||||
t('82222222239', 6, 1, '0.85357');
|
||||
t('0.671515352458', 4, 1, '0.6221');
|
||||
t('0.1', 10, 2, '0.09983341665');
|
||||
t('30.4507', 5, 0, '-0.82218');
|
||||
t('82539', 1, 6, '0.06');
|
||||
t('7904297312438003184', 8, 1, '0.88548151');
|
||||
t('1555591677261255189013625216076301609467761280', 4, 4, '0.6012');
|
||||
t('0.206', 5, 0, '0.20455');
|
||||
t('47.85', 4, 3, '-0.664');
|
||||
t('354522', 6, 0, '-0.432959');
|
||||
t('57111.555555555551111', 9, 1, '-0.51645502');
|
||||
t('5084117035723528870966332457.91693481159599044107', 10, 0, '0.5456651665');
|
||||
t('66', 3, 2, '-0.0265');
|
||||
t('4415133931290705273393593393689.69701970681754754956578240920056', 3, 4, '0.651');
|
||||
t('4641', 4, 1, '-0.7628');
|
||||
t('60782.222222', 3, 0, '-0.967');
|
||||
t('9295.7', 4, 1, '0.2692');
|
||||
t('660060.8', 5, 6, '-0.3736');
|
||||
t('86', 7, 0, '-0.9234585');
|
||||
t('0.867224365334893476015547423881141062327495194226274166759019810427983958472019', 7, 0, '0.7625362');
|
||||
t('35', 9, 4, '-0.428182669');
|
||||
t('6.4522', 4, 2, '0.1683');
|
||||
t('74298341154961724283464838063126436742467617925325544', 6, 5, '0.381838');
|
||||
t('98.9', 1, 3, '-1');
|
||||
t('8719985534823285.8450271997', 5, 4, '-0.43915');
|
||||
t('0.9528405', 9, 0, '0.815064492');
|
||||
t('3007.440843', 1, 3, '-0.9');
|
||||
t('8821000', 9, 3, '-0.999820738');
|
||||
t('0.7244', 2, 5, '0.66');
|
||||
t('223798525254185007541841321707204622.59819179923', 16, 1, '0.7304638404669184');
|
||||
t('29832077939805655500490926756388', 31, 5, '0.9999881003434971787558628446047');
|
||||
t('13555555555555.00000000000000000472565', 49, 1, '0.6767787926553990715415556952412713237217924208783');
|
||||
t('899998709983400169781485597598985275361858454653904477166', 80, 0, '-0.9619682988852763093696947825524296540074948329137260856105387448568258894882118');
|
||||
t('39826881720735191122621609200399853', 63, 6, '0.808868299975611790138921415253062939870563699821120858587818528');
|
||||
t('0.005341982048471623278003226810889859381173803701969742990587783072822', 70, 4, '0.005341956641353734027312587021500975661701907307617983686735841700502311');
|
||||
t('277.9997777777777716692059399741498679999', 30, 6, '0.999514190524582708045097875864');
|
||||
t('61429536536284373.1373681766492167', 72, 0, '-0.987289391477952440400357263926723647295916567423922849613191038848150249');
|
||||
t('7499999999909999997.909999999999', 71, 4, '0.34301339416705489181513042461845425762147177499632116466434976820897798');
|
||||
t('349999995999999999939992999.92', 78, 4, '0.470719374558628137654141208065693026899676258865423797523069796274766223234845');
|
||||
t('44510000000002060000000000000000.0200000008', 20, 5, '0.94842545081726504808');
|
||||
t('62222222222293973777.555555555555577777777777', 20, 1, '0.97474440584787996681');
|
||||
t('0.00000075952439582097539633', 49, 6, '0.0000007595243958209023709318824206298992320090760083707');
|
||||
t('6466917226846635097989717000204.490981137498768', 23, 6, '-0.5067890798594245927272');
|
||||
t('90000000000000007122', 12, 0, '-0.953061948465');
|
||||
t('0.422029137363394323', 22, 5, '0.4096123952171808560627');
|
||||
t('818.843', 70, 1, '0.8968883045810930941510638401062405075664719019866066309176929107557629');
|
||||
t('30000000000000000200000000000003000000000000005.0000009', 50, 2, '-0.12313481713171373142907951990491671356466363502241');
|
||||
t('975675853314022371079225', 48, 5, '0.880137190184686438889125592539968640170534430859');
|
||||
t('0.00000066558889026', 77, 6, '0.00000066558889025995085640282676346670712623242127613563915036627009080674622220984');
|
||||
t('69299999.9999999999999', 46, 5, '-0.3462252058608000475638742067375334366431550575');
|
||||
t('8111111111267488711.9286432453434826269588597', 62, 4, '-0.99113853372157352283292183868051054140090305817866106070973511');
|
||||
t('82', 71, 0, '0.31322878243308515263353199729481870255069002611658346075413062493460387');
|
||||
t('488826170909042284127242210428971', 76, 6, '0.8995289099301142050732477297866877720021805553317366849920338096104233105207');
|
||||
t('9092229227242222522222222222.66', 18, 0, '-0.935465793019682237');
|
||||
t('5805959970379373082098495883210891370.0067111', 46, 6, '0.2201197700332631564419599177639647998475543596');
|
||||
t('926600000000000000590', 41, 2, '0.81228550764810620054247659502626219692234');
|
||||
t('619490746366110587736593084360', 65, 1, '0.21194121003724604936564767272815880572843184525364715905320674006');
|
||||
t('5473424', 25, 0, '0.09262060997310434002923837');
|
||||
t('5666666666666666666666666666666666666666666666616666626.6666', 87, 4, '-0.977239495645491722400759456250446932597508047794151805593705662875402907345001472700784');
|
||||
t('499999.99999899999999999999999999999999999', 78, 5, '0.177832185579176104658571003320627225266903968719990210539163985433843099469721');
|
||||
t('900000', 117, 3, '0.316282026370992050734738815532587276379228020456998295610327862506624971973233544404550831654146703508761520381016242');
|
||||
t('83027766684462236825322.62114650623171519639122521318', 12, 4, '-0.476316326483');
|
||||
t('925910897623', 129, 5, '0.792868652237225000804927754028414838623611710010734993138551247754919869022556217868513568705036768423332287103460206126685907362');
|
||||
t('2918961308828646648994639730677467564302490828837720043486456401538236854705425586479512418277497121841759061091363', 23, 0, '-0.80586906475943044297492');
|
||||
t('800000000000000', 13, 2, '0.9931677199759');
|
||||
t('18400003.16100000000000032', 8, 6, '0.27307495');
|
||||
t('99.999999999999999999999999999999999999999999999993', 63, 4, '-0.506365641109758793656557610459785432065032721296693555549406261');
|
||||
t('20694757397464803355324887435556580472151471', 24, 6, '-0.0958707304545699270391254');
|
||||
t('333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333.33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333335', 171, 3, '0.999861104212610844432827649084650490692662683912806434297051730891484017620891490814751729807506108594451118885277110368312661669230716203945478379798471281336247356157603');
|
||||
t('22011131111011111.111111611113111111111151111111', 143, 2, '0.82582504036277799386306063085803210583251158969990606609364360685569588545519071481543672724620118406694191888115120286393881609546697317692404');
|
||||
t('996270725099515169352424536636186062915113219400094989.8763797268889422850038402633796294758036260533902551191769915343780424028900449342752548782035', 46, 2, '0.6613706114081017074779805460666900787572253475');
|
||||
t('0.780360750628373', 37, 5, '0.7035358359376557390803090830882458906');
|
||||
|
||||
T.stop();
|
||||
T.stop();
|
||||
})();
|
||||
|
@ -1,125 +1,124 @@
|
||||
if (typeof T === 'undefined') require('../setup');
|
||||
|
||||
(function () {
|
||||
T('sinh');
|
||||
T('sinh');
|
||||
|
||||
function t(n, pr, rm, expected) {
|
||||
Decimal.precision = pr;
|
||||
Decimal.rounding = rm;
|
||||
T.assertEqual(expected, Decimal.sinh(n).valueOf());
|
||||
T.assertEqual(expected, new Decimal(n).sinh().valueOf());
|
||||
}
|
||||
function t(n, pr, rm, expected) {
|
||||
Decimal.precision = pr;
|
||||
Decimal.rounding = rm;
|
||||
T.assertEqual(expected, new Decimal(n).sinh().valueOf());
|
||||
}
|
||||
|
||||
Decimal.config({
|
||||
precision: 40,
|
||||
rounding: 4,
|
||||
toExpNeg: -9e15,
|
||||
toExpPos: 9e15,
|
||||
minE: -9e15,
|
||||
maxE: 9e15
|
||||
});
|
||||
Decimal.config({
|
||||
precision: 40,
|
||||
rounding: 4,
|
||||
toExpNeg: -9e15,
|
||||
toExpPos: 9e15,
|
||||
minE: -9e15,
|
||||
maxE: 9e15
|
||||
});
|
||||
|
||||
t('NaN', 40, 4, 'NaN');
|
||||
t('0', 20, 4, '0');
|
||||
t('-0', 20, 4, '-0');
|
||||
t('Infinity', 40, 4, 'Infinity');
|
||||
t('-Infinity', 40, 4, '-Infinity');
|
||||
t('NaN', 40, 4, 'NaN');
|
||||
t('0', 20, 4, '0');
|
||||
t('-0', 20, 4, '-0');
|
||||
t('Infinity', 40, 4, 'Infinity');
|
||||
t('-Infinity', 40, 4, '-Infinity');
|
||||
|
||||
t('-0.01117212161', 7, 3, '-0.01117236');
|
||||
t('-0.01', 3, 6, '-0.01');
|
||||
t('0.4855939', 4, 0, '0.505');
|
||||
t('-0.35', 4, 6, '-0.3572');
|
||||
t('0.595', 3, 0, '0.631');
|
||||
t('-0.7', 10, 1, '-0.7585837018');
|
||||
t('0.477765550220420530146451989244265', 1, 5, '0.5');
|
||||
t('-0.6', 4, 6, '-0.6367');
|
||||
t('-0.7298937853748771062243', 8, 1, '-0.79645001');
|
||||
t('0.6654323353551357716363059061801908595169', 9, 2, '0.715640069');
|
||||
t('-0.822057582744136479779814788208915217619870720324021379213318423992919063068', 2, 6, '-0.92');
|
||||
t('0.930187069407449026594918410064', 8, 6, '1.0702517');
|
||||
t('-0.71551536', 7, 1, '-0.7781501');
|
||||
t('-0.02477', 9, 2, '-0.024772533');
|
||||
t('-0.5092804474897748330778251373356860713', 5, 3, '-0.53159');
|
||||
t('-0.88527349524064252', 7, 3, '-1.005523');
|
||||
t('0.92', 1, 5, '1');
|
||||
t('0.9', 9, 5, '1.02651673');
|
||||
t('0.01952', 4, 6, '0.01952');
|
||||
t('-0.7', 6, 5, '-0.758584');
|
||||
t('-0.9367', 1, 4, '-1');
|
||||
t('0.713075', 2, 1, '0.77');
|
||||
t('-0.80641', 4, 5, '-0.8967');
|
||||
t('0.1', 7, 3, '0.1001667');
|
||||
t('0.742', 4, 3, '0.8119');
|
||||
t('0.19164777', 8, 5, '0.19282309');
|
||||
t('-0.959128669199452184605687414702700501745933588051855', 5, 3, '-1.1131');
|
||||
t('-0.82', 3, 5, '-0.915');
|
||||
t('-0.54', 3, 4, '-0.567');
|
||||
t('0.6187', 9, 3, '0.658934392');
|
||||
t('0.5', 1, 1, '0.5');
|
||||
t('0.1713', 1, 6, '0.2');
|
||||
t('-0.09', 3, 2, '-0.0901');
|
||||
t('-0.149', 9, 4, '-0.149551937');
|
||||
t('-0.54', 1, 1, '-0.5');
|
||||
t('0.5286', 2, 5, '0.55');
|
||||
t('-0.2218560302782240024444484', 3, 1, '-0.223');
|
||||
t('0.4206503074024213359239066760263937373', 4, 3, '0.4331');
|
||||
t('-0.90343297229335446769185848339321460217', 7, 6, '-1.031443');
|
||||
t('0.29824', 3, 3, '0.302');
|
||||
t('0.970160998338313076097814326701945459022', 8, 2, '1.1296736');
|
||||
t('0.9', 1, 5, '1');
|
||||
t('0.66968', 7, 6, '0.7208699');
|
||||
t('-0.73978789', 4, 6, '-0.8091');
|
||||
t('0.4', 1, 5, '0.4');
|
||||
t('-0.33319', 2, 2, '-0.33');
|
||||
t('-0.05094763', 6, 6, '-0.0509697');
|
||||
t('0.147', 2, 4, '0.15');
|
||||
t('-0.7521', 3, 1, '-0.825');
|
||||
t('0.966', 2, 1, '1.1');
|
||||
t('-0.2', 6, 4, '-0.201336');
|
||||
t('0.3', 5, 6, '0.30452');
|
||||
t('0.2297417916367587719174729947877594919', 4, 2, '0.2318');
|
||||
t('0.7409761', 8, 4, '0.81066696');
|
||||
t('-0.09', 9, 6, '-0.0901215492');
|
||||
t('-0.18', 10, 4, '-0.1809735759');
|
||||
t('-0.5', 74, 0, '-0.5210953054937473616224256264114915591059289826114805279460935764528022509');
|
||||
t('0.949452626313209516617699142908712', 60, 1, '1.09867096195815727081614237630458180228025051136935234032153');
|
||||
t('-0.82630505', 54, 4, '-0.923598615474838199854541207197320474034631988093767029');
|
||||
t('-0.14360721351237246987568757034881684526233784917328314', 51, 6, '-0.144101325429405622590434840215545338787652919410578');
|
||||
t('-0.4733', 23, 1, '-0.49116986771004112197472');
|
||||
t('-0.5044771449885283269', 58, 3, '-0.5261490899404374562669581230733559491094381606214659786475');
|
||||
t('0.5292602', 35, 4, '0.55431766127533774367181438483674235');
|
||||
t('0.3540955931426128907807', 61, 2, '0.361541756843620905162708539502960691569195176490187925093063');
|
||||
t('-0.10396270844781004445623314451335288', 42, 5, '-0.104150085412880845209759850184027732716498');
|
||||
t('0.34005327', 75, 6, '0.346645013173896201527795410362292912629770127776147273389479491565524413729');
|
||||
t('-0.465', 56, 3, '-0.48193954184873018412767665045542782421613788403587256476');
|
||||
t('0.6', 31, 4, '0.6366535821482412711234543754651');
|
||||
t('-0.5481208052771', 80, 6, '-0.57598196281877562249156649817140676025943322140952007665313949431943795521753859');
|
||||
t('0.4658', 43, 2, '0.4828277558817488705330396156695883903876349');
|
||||
t('0.658924', 67, 0, '0.7076519258213409489258117150888493713909348882371351431016717177769');
|
||||
t('0.84095', 76, 4, '0.9436339889105945408359964397732399439736824767663826815978864604057978720873');
|
||||
t('0.1', 42, 1, '0.10016675001984402582372938352190502351492');
|
||||
t('-0.546469309180216992488477103741682161392', 53, 0, '-0.57407689286989186234869758011224724765162964238150871');
|
||||
t('0.952940960228', 79, 6, '1.103860008709590589328393540207693314047991810042822431557364905168130459211928');
|
||||
t('0.5412557', 49, 6, '0.5680730254090400844499466841744626100138640781665');
|
||||
t('-0.4', 48, 2, '-0.410752325802815508540210013844698104353150924363');
|
||||
t('0.40959', 40, 2, '0.4211388569626912767627807558369832974574');
|
||||
t('-0.2071333563131394184890351', 55, 5, '-0.2086176863728173404729808287424406991153510048007845957');
|
||||
t('-0.006158312564838233045293421864257772700745093081', 113, 5, '-0.0061583514903881113191917490082260881905532636435605944044826372766861550655521768577200191192576920019205813951089');
|
||||
t('-0.94735419679918088022811807376056681040587805226146', 33, 0, '-1.09555590192578368678418405664044');
|
||||
t('0.3858706779532718096507434549', 90, 4, '0.395517999377232409663582197928235951630498131157951753386415315480929149180554295455429916');
|
||||
t('-0.54290785843486103750513205980437253195531977198208721625688182147166538076323037457917540157093128639', 47, 6, '-0.56997393244891117340616510127151254831177604424');
|
||||
t('-0.557397920603136432530648049076469730271228686196969657', 23, 0, '-0.58671285120863734551043');
|
||||
t('-0.116426108886043214339286002636572559104915423316062689133928015970375', 86, 0, '-0.11668931394827265385287124886310892715353176113654298509501455004648909379387424934137');
|
||||
t('0.20004668', 65, 4, '0.20138361947662140883950941306502243833641683553233187922633602303');
|
||||
t('-0.72854338143449469754924045207742119688876235959260851289818192195120823675633348027917164866022227116150939180735340401518132565983221327345338239572304554973', 57, 0, '-0.794724373946660205913430120299005955752529862100864743743');
|
||||
t('0.7075348682409645', 33, 3, '0.768062858516298468179764221964258');
|
||||
t('0.9656450627407202186276140853108319189098662197785614356229', 112, 6, '1.122871917243193329250848114954520140832952763020717131988745064541821469254295854275194543068093878175092993757');
|
||||
t('-0.3074887163636747690696589824464611540801585', 75, 5, '-0.312357149174629557268287563048266380887783749410576774474545432310552964774');
|
||||
t('0.35414105198707877919833655237627933385061464419', 75, 3, '0.361590095862779887666259058403870675910577905319211259160227815980416737104');
|
||||
t('-0.22861250504316830507', 15, 4, '-0.230609070338079');
|
||||
t('0.3531311134837489181774304448792305788668900001541312879645273208393370689493465894263207269785178211563373399080451907494623164005742217451839584169072958609799133150259273', 104, 0, '0.36051634575023901465038196038262241500129988486533222911437937013660152976667815350655235742420924031229');
|
||||
t('0.04434967092552732411292905', 99, 2, '0.0443642108672289452509083305837598955470962269229557910757510910026528522969230426477915847556546583');
|
||||
t('-0.20001290733229792426683137634566153903', 21, 4, '-0.201349168898446405328');
|
||||
t('-0.01117212161', 7, 3, '-0.01117236');
|
||||
t('-0.01', 3, 6, '-0.01');
|
||||
t('0.4855939', 4, 0, '0.505');
|
||||
t('-0.35', 4, 6, '-0.3572');
|
||||
t('0.595', 3, 0, '0.631');
|
||||
t('-0.7', 10, 1, '-0.7585837018');
|
||||
t('0.477765550220420530146451989244265', 1, 5, '0.5');
|
||||
t('-0.6', 4, 6, '-0.6367');
|
||||
t('-0.7298937853748771062243', 8, 1, '-0.79645001');
|
||||
t('0.6654323353551357716363059061801908595169', 9, 2, '0.715640069');
|
||||
t('-0.822057582744136479779814788208915217619870720324021379213318423992919063068', 2, 6, '-0.92');
|
||||
t('0.930187069407449026594918410064', 8, 6, '1.0702517');
|
||||
t('-0.71551536', 7, 1, '-0.7781501');
|
||||
t('-0.02477', 9, 2, '-0.024772533');
|
||||
t('-0.5092804474897748330778251373356860713', 5, 3, '-0.53159');
|
||||
t('-0.88527349524064252', 7, 3, '-1.005523');
|
||||
t('0.92', 1, 5, '1');
|
||||
t('0.9', 9, 5, '1.02651673');
|
||||
t('0.01952', 4, 6, '0.01952');
|
||||
t('-0.7', 6, 5, '-0.758584');
|
||||
t('-0.9367', 1, 4, '-1');
|
||||
t('0.713075', 2, 1, '0.77');
|
||||
t('-0.80641', 4, 5, '-0.8967');
|
||||
t('0.1', 7, 3, '0.1001667');
|
||||
t('0.742', 4, 3, '0.8119');
|
||||
t('0.19164777', 8, 5, '0.19282309');
|
||||
t('-0.959128669199452184605687414702700501745933588051855', 5, 3, '-1.1131');
|
||||
t('-0.82', 3, 5, '-0.915');
|
||||
t('-0.54', 3, 4, '-0.567');
|
||||
t('0.6187', 9, 3, '0.658934392');
|
||||
t('0.5', 1, 1, '0.5');
|
||||
t('0.1713', 1, 6, '0.2');
|
||||
t('-0.09', 3, 2, '-0.0901');
|
||||
t('-0.149', 9, 4, '-0.149551937');
|
||||
t('-0.54', 1, 1, '-0.5');
|
||||
t('0.5286', 2, 5, '0.55');
|
||||
t('-0.2218560302782240024444484', 3, 1, '-0.223');
|
||||
t('0.4206503074024213359239066760263937373', 4, 3, '0.4331');
|
||||
t('-0.90343297229335446769185848339321460217', 7, 6, '-1.031443');
|
||||
t('0.29824', 3, 3, '0.302');
|
||||
t('0.970160998338313076097814326701945459022', 8, 2, '1.1296736');
|
||||
t('0.9', 1, 5, '1');
|
||||
t('0.66968', 7, 6, '0.7208699');
|
||||
t('-0.73978789', 4, 6, '-0.8091');
|
||||
t('0.4', 1, 5, '0.4');
|
||||
t('-0.33319', 2, 2, '-0.33');
|
||||
t('-0.05094763', 6, 6, '-0.0509697');
|
||||
t('0.147', 2, 4, '0.15');
|
||||
t('-0.7521', 3, 1, '-0.825');
|
||||
t('0.966', 2, 1, '1.1');
|
||||
t('-0.2', 6, 4, '-0.201336');
|
||||
t('0.3', 5, 6, '0.30452');
|
||||
t('0.2297417916367587719174729947877594919', 4, 2, '0.2318');
|
||||
t('0.7409761', 8, 4, '0.81066696');
|
||||
t('-0.09', 9, 6, '-0.0901215492');
|
||||
t('-0.18', 10, 4, '-0.1809735759');
|
||||
t('-0.5', 74, 0, '-0.5210953054937473616224256264114915591059289826114805279460935764528022509');
|
||||
t('0.949452626313209516617699142908712', 60, 1, '1.09867096195815727081614237630458180228025051136935234032153');
|
||||
t('-0.82630505', 54, 4, '-0.923598615474838199854541207197320474034631988093767029');
|
||||
t('-0.14360721351237246987568757034881684526233784917328314', 51, 6, '-0.144101325429405622590434840215545338787652919410578');
|
||||
t('-0.4733', 23, 1, '-0.49116986771004112197472');
|
||||
t('-0.5044771449885283269', 58, 3, '-0.5261490899404374562669581230733559491094381606214659786475');
|
||||
t('0.5292602', 35, 4, '0.55431766127533774367181438483674235');
|
||||
t('0.3540955931426128907807', 61, 2, '0.361541756843620905162708539502960691569195176490187925093063');
|
||||
t('-0.10396270844781004445623314451335288', 42, 5, '-0.104150085412880845209759850184027732716498');
|
||||
t('0.34005327', 75, 6, '0.346645013173896201527795410362292912629770127776147273389479491565524413729');
|
||||
t('-0.465', 56, 3, '-0.48193954184873018412767665045542782421613788403587256476');
|
||||
t('0.6', 31, 4, '0.6366535821482412711234543754651');
|
||||
t('-0.5481208052771', 80, 6, '-0.57598196281877562249156649817140676025943322140952007665313949431943795521753859');
|
||||
t('0.4658', 43, 2, '0.4828277558817488705330396156695883903876349');
|
||||
t('0.658924', 67, 0, '0.7076519258213409489258117150888493713909348882371351431016717177769');
|
||||
t('0.84095', 76, 4, '0.9436339889105945408359964397732399439736824767663826815978864604057978720873');
|
||||
t('0.1', 42, 1, '0.10016675001984402582372938352190502351492');
|
||||
t('-0.546469309180216992488477103741682161392', 53, 0, '-0.57407689286989186234869758011224724765162964238150871');
|
||||
t('0.952940960228', 79, 6, '1.103860008709590589328393540207693314047991810042822431557364905168130459211928');
|
||||
t('0.5412557', 49, 6, '0.5680730254090400844499466841744626100138640781665');
|
||||
t('-0.4', 48, 2, '-0.410752325802815508540210013844698104353150924363');
|
||||
t('0.40959', 40, 2, '0.4211388569626912767627807558369832974574');
|
||||
t('-0.2071333563131394184890351', 55, 5, '-0.2086176863728173404729808287424406991153510048007845957');
|
||||
t('-0.006158312564838233045293421864257772700745093081', 113, 5, '-0.0061583514903881113191917490082260881905532636435605944044826372766861550655521768577200191192576920019205813951089');
|
||||
t('-0.94735419679918088022811807376056681040587805226146', 33, 0, '-1.09555590192578368678418405664044');
|
||||
t('0.3858706779532718096507434549', 90, 4, '0.395517999377232409663582197928235951630498131157951753386415315480929149180554295455429916');
|
||||
t('-0.54290785843486103750513205980437253195531977198208721625688182147166538076323037457917540157093128639', 47, 6, '-0.56997393244891117340616510127151254831177604424');
|
||||
t('-0.557397920603136432530648049076469730271228686196969657', 23, 0, '-0.58671285120863734551043');
|
||||
t('-0.116426108886043214339286002636572559104915423316062689133928015970375', 86, 0, '-0.11668931394827265385287124886310892715353176113654298509501455004648909379387424934137');
|
||||
t('0.20004668', 65, 4, '0.20138361947662140883950941306502243833641683553233187922633602303');
|
||||
t('-0.72854338143449469754924045207742119688876235959260851289818192195120823675633348027917164866022227116150939180735340401518132565983221327345338239572304554973', 57, 0, '-0.794724373946660205913430120299005955752529862100864743743');
|
||||
t('0.7075348682409645', 33, 3, '0.768062858516298468179764221964258');
|
||||
t('0.9656450627407202186276140853108319189098662197785614356229', 112, 6, '1.122871917243193329250848114954520140832952763020717131988745064541821469254295854275194543068093878175092993757');
|
||||
t('-0.3074887163636747690696589824464611540801585', 75, 5, '-0.312357149174629557268287563048266380887783749410576774474545432310552964774');
|
||||
t('0.35414105198707877919833655237627933385061464419', 75, 3, '0.361590095862779887666259058403870675910577905319211259160227815980416737104');
|
||||
t('-0.22861250504316830507', 15, 4, '-0.230609070338079');
|
||||
t('0.3531311134837489181774304448792305788668900001541312879645273208393370689493465894263207269785178211563373399080451907494623164005742217451839584169072958609799133150259273', 104, 0, '0.36051634575023901465038196038262241500129988486533222911437937013660152976667815350655235742420924031229');
|
||||
t('0.04434967092552732411292905', 99, 2, '0.0443642108672289452509083305837598955470962269229557910757510910026528522969230426477915847556546583');
|
||||
t('-0.20001290733229792426683137634566153903', 21, 4, '-0.201349168898446405328');
|
||||
|
||||
T.stop();
|
||||
T.stop();
|
||||
})();
|
||||
|
1047
test/modules/sqrt.js
1047
test/modules/sqrt.js
File diff suppressed because it is too large
Load Diff
@ -1,129 +1,124 @@
|
||||
if (typeof T === 'undefined') require('../setup');
|
||||
|
||||
(function () {
|
||||
T('tan');
|
||||
T('tan');
|
||||
|
||||
function t(n, pr, rm, expected) {
|
||||
Decimal.precision = pr;
|
||||
Decimal.rounding = rm;
|
||||
var x = new Decimal(n);
|
||||
T.assertEqual(expected, x.tan().valueOf());
|
||||
T.assertEqual(expected, Decimal.tan(n).valueOf());
|
||||
T.assert(x.eq(n) || x.isNaN());
|
||||
}
|
||||
function t(n, pr, rm, expected) {
|
||||
Decimal.precision = pr;
|
||||
Decimal.rounding = rm;
|
||||
T.assertEqual(expected, new Decimal(n).tan().valueOf());
|
||||
}
|
||||
|
||||
Decimal.config({
|
||||
precision: 40,
|
||||
rounding: 4,
|
||||
toExpNeg: -9e15,
|
||||
toExpPos: 9e15,
|
||||
minE: -9e15,
|
||||
maxE: 9e15
|
||||
});
|
||||
Decimal.config({
|
||||
precision: 40,
|
||||
rounding: 4,
|
||||
toExpNeg: -9e15,
|
||||
toExpPos: 9e15,
|
||||
minE: -9e15,
|
||||
maxE: 9e15
|
||||
});
|
||||
|
||||
t('NaN', 40, 4, 'NaN');
|
||||
t('0', 20, 4, '0');
|
||||
t('-0', 20, 4, '-0');
|
||||
t('Infinity', 40, 4, 'NaN');
|
||||
t('-Infinity', 40, 4, 'NaN');
|
||||
t('NaN', 40, 4, 'NaN');
|
||||
t('0', 20, 4, '0');
|
||||
t('-0', 20, 4, '-0');
|
||||
t('Infinity', 40, 4, 'NaN');
|
||||
t('-Infinity', 40, 4, 'NaN');
|
||||
|
||||
t('3', 5, 5, '-0.14255');
|
||||
t('-3', 5, 5, '0.14255');
|
||||
t('0.8', 7, 6, '1.029639');
|
||||
t('539998661123466984649191689138494900416386817996524', 7, 6, '32.04695');
|
||||
t('-539998661123466984649191689138494900416386817996524', 7, 6, '-32.04695');
|
||||
t('0.5172293543584894071801901902', 5, 1, '0.56888');
|
||||
t('5', 10, 5, '-3.380515006');
|
||||
t('0.5283979979897015', 1, 4, '0.6');
|
||||
t('0.032294', 4, 5, '0.03231');
|
||||
t('6339441327243052114957865586706124503.386166832963015135918043343179', 7, 0, '-0.06666567');
|
||||
t('0.9483926380646355642560348839879277', 4, 6, '1.394');
|
||||
t('0.4989999', 7, 6, '0.5450046');
|
||||
t('80', 8, 6, '9.0036549');
|
||||
t('9', 2, 0, '-0.46');
|
||||
t('710.0571640039', 2, 2, '0.058');
|
||||
t('2485', 2, 0, '0.00022');
|
||||
t('1', 8, 1, '1.5574077');
|
||||
t('1683930704126586032365374681825182443446390958574678366195884605194996193', 6, 1, '-0.540063');
|
||||
t('4', 7, 2, '1.157822');
|
||||
t('488888888888999.88888888406189896488888888888', 9, 0, '5.10971582');
|
||||
t('0.76322415', 7, 0, '0.9566071');
|
||||
t('0.005', 4, 2, '0.005001');
|
||||
t('0.313', 9, 6, '0.323638526');
|
||||
t('9798000000100000070000000000010007300', 5, 0, '1.1308');
|
||||
t('0.0000002', 2, 0, '0.00000021');
|
||||
t('7.9548', 4, 1, '-9.885');
|
||||
t('7', 5, 1, '0.87144');
|
||||
t('50080000', 10, 3, '0.3252122977');
|
||||
t('1687619439340503284670339680.931590414877', 6, 6, '-4.69126');
|
||||
t('60970535.5', 3, 1, '0.804');
|
||||
t('0.17', 3, 2, '0.172');
|
||||
t('0.5', 5, 6, '0.5463');
|
||||
t('976.8', 2, 0, '-0.24');
|
||||
t('5957.69', 6, 0, '2.82277');
|
||||
t('3859393443331162786655368.87986161531415848272022672234461227844', 3, 6, '0.47');
|
||||
t('0.5', 1, 5, '0.5');
|
||||
t('468455006548968895675682202443647176252098177665257898933', 5, 5, '-1.4111');
|
||||
t('26588816756666', 1, 2, '0.07');
|
||||
t('0.239424045403994683949187909216', 5, 2, '0.24411');
|
||||
t('810209.109', 6, 6, '-4.52238');
|
||||
t('799063368.11558288974072', 1, 2, '-0.9');
|
||||
t('72.3640503', 7, 2, '0.1078344');
|
||||
t('843003462755848631687717888604', 5, 5, '-1.1699');
|
||||
t('90706.61', 3, 2, '-0.676');
|
||||
t('0.1', 7, 5, '0.1003347');
|
||||
t('29555.88888888888885555555', 9, 5, '-0.218161582');
|
||||
t('3079999999999999999999.999949999999999999999999999999999999999999999', 2, 5, '1.6');
|
||||
t('6', 3, 4, '-0.291');
|
||||
t('9.648589238187519', 7, 0, '0.2276248');
|
||||
t('590.89', 7, 1, '0.2773838');
|
||||
t('807876335', 9, 2, '0.965588602');
|
||||
t('32099561.989', 8, 4, '-0.24584079');
|
||||
t('7743398777777777777777733.77', 3, 2, '-0.526');
|
||||
t('45.52', 5, 2, '30.207');
|
||||
t('399999999999999999999999999999999999999999999999909999999999.99999999999999', 4, 4, '1.742');
|
||||
t('32400', 3, 2, '0.941');
|
||||
t('4152914444444444444444444544444444444444444444444444444.944444444440444442444494444444444', 9, 0, '-0.101470716');
|
||||
t('90000000000508319.117628510842726222', 5, 0, '5.1435');
|
||||
t('0.0074072', 8, 3, '0.0074073354');
|
||||
t('0.413272', 4, 5, '0.4385');
|
||||
t('0.8633', 10, 3, '1.169338115');
|
||||
t('33333333333333333333333333333.33333333333333333333', 8, 2, '0.5813679');
|
||||
t('562', 10, 0, '-0.3594685138');
|
||||
t('6433373233.39333336638333334', 5, 4, '-1.383');
|
||||
t('233333333331549444444444.09076555555555555', 10, 4, '-5.305366526');
|
||||
t('40', 9, 2, '-1.11721493');
|
||||
t('906287052558597992196230844623', 10, 1, '0.3528425701');
|
||||
t('900000', 4, 6, '-0.3334');
|
||||
t('57777777777.88888888887777777428970596211366', 13, 1, '4.620958871418');
|
||||
t('33109173612614237', 15, 1, '0.697054002938309');
|
||||
t('446571', 8, 4, '-0.11299979');
|
||||
t('55.33', 25, 1, '-2.721513818553435443556001');
|
||||
t('0.6874', 3, 4, '0.821');
|
||||
t('97415551555.55555655655655554555555855555', 38, 6, '0.63497857004739965579501336949790595112');
|
||||
t('3052744161971196989887333333333333333', 15, 0, '2.3893665412711');
|
||||
t('20083.4596122', 37, 0, '-0.9171727446291034528773430723329592848');
|
||||
t('9200', 30, 3, '6.43843719089952501300840146253');
|
||||
t('1', 23, 0, '1.557407724654902230507');
|
||||
t('78887888588.8', 15, 5, '-0.0613791279629461');
|
||||
t('1147231', 8, 4, '-0.097582634');
|
||||
t('0.000553763344', 27, 4, '0.000553763400604559119913346525');
|
||||
t('68', 24, 1, '-2.04008159801594615389349');
|
||||
t('49999999999999999999999999999999999999999999999999999999.399999999999999999992702', 15, 2, '-4.12257063808152');
|
||||
t('49999999999999999999999999999999999999999999999999999.99999999999999999999999999999', 38, 6, '-0.41507238166911582158673379470559517419');
|
||||
t('0.00000391163258651029507727', 31, 2, '0.000003911632586530245537172208314767');
|
||||
t('0.17183171313', 36, 4, '0.173543103883274147884533120728007237');
|
||||
t('861646.5732966967557082', 34, 2, '-2.464947656728891301675656852697406');
|
||||
t('47777777777777777.410171', 105, 5, '-13.74058038972407219477409398839850580956304359987902889186211451339313466403485175336849944968942741891');
|
||||
t('0.390071731702448005162815294909486174474947036240529240590971978418532990165699316733956931596883519677657915509998387416505531185920438999174869181240110048120035540672577', 63, 1, '0.411138769556421473902517663320961167226706740351370710111315144');
|
||||
t('23174769554', 70, 3, '0.2212756420749658903960662285747816321880538429001022336777294070264195');
|
||||
t('0.5592', 74, 1, '0.625835640923790139625307834841776614566589496394316390500913130105766275');
|
||||
t('6661489439437775791.114329793186996632507954406585491', 17, 5, '-1.5847845023422794');
|
||||
t('4391137181720764819571909798888888888888888888', 86, 1, '-0.8685635418477878118403689813703497084174127945629019783498553011616589497613259649227');
|
||||
t('300000000000000000000000000000000000000000000000000000000000000000000000000200000000400300000000000000000000000000000.0000000000000000000000000000000000000000000000000003', 122, 3, '-1.5903229154055637520787252214804110216069360069379104488574199058901135519171083962076619886567087892277814852998414939069');
|
||||
t('6587685840713754402278094276205491723366077405819490595067025408026873250375623638673063957701601231', 107, 3, '0.88106648906135934944047838538886082156746682725824571546159607795133625640190620741982638843180493222615294');
|
||||
t('0.524217411165998018391262237830297491516856805040463896080592290487405064611025001607311512479709354535407130581948832593516281243820812174844723190311545869854968531247730387537943969800839367585396013641826800875467649274673709974876292276089324234102809573076731030535244688816', 76, 3, '0.5781754114340578960371795632804762026798421163023137415437904934165060267084');
|
||||
t('323646192595.4845', 127, 6, '-0.3747612268270038347175054875779625030989108207803221587812055629899198693615407534041949990189331417585285760850333254670480789');
|
||||
t('3', 5, 5, '-0.14255');
|
||||
t('0.8', 7, 6, '1.029639');
|
||||
t('539998661123466984649191689138494900416386817996524', 7, 6, '32.04695');
|
||||
t('0.5172293543584894071801901902', 5, 1, '0.56888');
|
||||
t('5', 10, 5, '-3.380515006');
|
||||
t('0.5283979979897015', 1, 4, '0.6');
|
||||
t('0.032294', 4, 5, '0.03231');
|
||||
t('6339441327243052114957865586706124503.386166832963015135918043343179', 7, 0, '-0.06666567');
|
||||
t('0.9483926380646355642560348839879277', 4, 6, '1.394');
|
||||
t('0.4989999', 7, 6, '0.5450046');
|
||||
t('80', 8, 6, '9.0036549');
|
||||
t('9', 2, 0, '-0.46');
|
||||
t('710.0571640039', 2, 2, '0.058');
|
||||
t('2485', 2, 0, '0.00022');
|
||||
t('1', 8, 1, '1.5574077');
|
||||
t('1683930704126586032365374681825182443446390958574678366195884605194996193', 6, 1, '-0.540063');
|
||||
t('4', 7, 2, '1.157822');
|
||||
t('488888888888999.88888888406189896488888888888', 9, 0, '5.10971582');
|
||||
t('0.76322415', 7, 0, '0.9566071');
|
||||
t('0.005', 4, 2, '0.005001');
|
||||
t('0.313', 9, 6, '0.323638526');
|
||||
t('9798000000100000070000000000010007300', 5, 0, '1.1308');
|
||||
t('0.0000002', 2, 0, '0.00000021');
|
||||
t('7.9548', 4, 1, '-9.885');
|
||||
t('7', 5, 1, '0.87144');
|
||||
t('50080000', 10, 3, '0.3252122977');
|
||||
t('1687619439340503284670339680.931590414877', 6, 6, '-4.69126');
|
||||
t('60970535.5', 3, 1, '0.804');
|
||||
t('0.17', 3, 2, '0.172');
|
||||
t('0.5', 5, 6, '0.5463');
|
||||
t('976.8', 2, 0, '-0.24');
|
||||
t('5957.69', 6, 0, '2.82277');
|
||||
t('3859393443331162786655368.87986161531415848272022672234461227844', 3, 6, '0.47');
|
||||
t('0.5', 1, 5, '0.5');
|
||||
t('468455006548968895675682202443647176252098177665257898933', 5, 5, '-1.4111');
|
||||
t('26588816756666', 1, 2, '0.07');
|
||||
t('0.239424045403994683949187909216', 5, 2, '0.24411');
|
||||
t('810209.109', 6, 6, '-4.52238');
|
||||
t('799063368.11558288974072', 1, 2, '-0.9');
|
||||
t('72.3640503', 7, 2, '0.1078344');
|
||||
t('843003462755848631687717888604', 5, 5, '-1.1699');
|
||||
t('90706.61', 3, 2, '-0.676');
|
||||
t('0.1', 7, 5, '0.1003347');
|
||||
t('29555.88888888888885555555', 9, 5, '-0.218161582');
|
||||
t('3079999999999999999999.999949999999999999999999999999999999999999999', 2, 5, '1.6');
|
||||
t('6', 3, 4, '-0.291');
|
||||
t('9.648589238187519', 7, 0, '0.2276248');
|
||||
t('590.89', 7, 1, '0.2773838');
|
||||
t('807876335', 9, 2, '0.965588602');
|
||||
t('32099561.989', 8, 4, '-0.24584079');
|
||||
t('7743398777777777777777733.77', 3, 2, '-0.526');
|
||||
t('45.52', 5, 2, '30.207');
|
||||
t('399999999999999999999999999999999999999999999999909999999999.99999999999999', 4, 4, '1.742');
|
||||
t('32400', 3, 2, '0.941');
|
||||
t('4152914444444444444444444544444444444444444444444444444.944444444440444442444494444444444', 9, 0, '-0.101470716');
|
||||
t('90000000000508319.117628510842726222', 5, 0, '5.1435');
|
||||
t('0.0074072', 8, 3, '0.0074073354');
|
||||
t('0.413272', 4, 5, '0.4385');
|
||||
t('0.8633', 10, 3, '1.169338115');
|
||||
t('33333333333333333333333333333.33333333333333333333', 8, 2, '0.5813679');
|
||||
t('562', 10, 0, '-0.3594685138');
|
||||
t('6433373233.39333336638333334', 5, 4, '-1.383');
|
||||
t('233333333331549444444444.09076555555555555', 10, 4, '-5.305366526');
|
||||
t('40', 9, 2, '-1.11721493');
|
||||
t('906287052558597992196230844623', 10, 1, '0.3528425701');
|
||||
t('900000', 4, 6, '-0.3334');
|
||||
t('57777777777.88888888887777777428970596211366', 13, 1, '4.620958871418');
|
||||
t('33109173612614237', 15, 1, '0.697054002938309');
|
||||
t('446571', 8, 4, '-0.11299979');
|
||||
t('55.33', 25, 1, '-2.721513818553435443556001');
|
||||
t('0.6874', 3, 4, '0.821');
|
||||
t('97415551555.55555655655655554555555855555', 38, 6, '0.63497857004739965579501336949790595112');
|
||||
t('3052744161971196989887333333333333333', 15, 0, '2.3893665412711');
|
||||
t('20083.4596122', 37, 0, '-0.9171727446291034528773430723329592848');
|
||||
t('9200', 30, 3, '6.43843719089952501300840146253');
|
||||
t('1', 23, 0, '1.557407724654902230507');
|
||||
t('78887888588.8', 15, 5, '-0.0613791279629461');
|
||||
t('1147231', 8, 4, '-0.097582634');
|
||||
t('0.000553763344', 27, 4, '0.000553763400604559119913346525');
|
||||
t('68', 24, 1, '-2.04008159801594615389349');
|
||||
t('49999999999999999999999999999999999999999999999999999999.399999999999999999992702', 15, 2, '-4.12257063808152');
|
||||
t('49999999999999999999999999999999999999999999999999999.99999999999999999999999999999', 38, 6, '-0.41507238166911582158673379470559517419');
|
||||
t('0.00000391163258651029507727', 31, 2, '0.000003911632586530245537172208314767');
|
||||
t('0.17183171313', 36, 4, '0.173543103883274147884533120728007237');
|
||||
t('861646.5732966967557082', 34, 2, '-2.464947656728891301675656852697406');
|
||||
t('47777777777777777.410171', 105, 5, '-13.74058038972407219477409398839850580956304359987902889186211451339313466403485175336849944968942741891');
|
||||
t('0.390071731702448005162815294909486174474947036240529240590971978418532990165699316733956931596883519677657915509998387416505531185920438999174869181240110048120035540672577', 63, 1, '0.411138769556421473902517663320961167226706740351370710111315144');
|
||||
t('23174769554', 70, 3, '0.2212756420749658903960662285747816321880538429001022336777294070264195');
|
||||
t('0.5592', 74, 1, '0.625835640923790139625307834841776614566589496394316390500913130105766275');
|
||||
t('6661489439437775791.114329793186996632507954406585491', 17, 5, '-1.5847845023422794');
|
||||
t('4391137181720764819571909798888888888888888888', 86, 1, '-0.8685635418477878118403689813703497084174127945629019783498553011616589497613259649227');
|
||||
t('300000000000000000000000000000000000000000000000000000000000000000000000000200000000400300000000000000000000000000000.0000000000000000000000000000000000000000000000000003', 122, 3, '-1.5903229154055637520787252214804110216069360069379104488574199058901135519171083962076619886567087892277814852998414939069');
|
||||
t('6587685840713754402278094276205491723366077405819490595067025408026873250375623638673063957701601231', 107, 3, '0.88106648906135934944047838538886082156746682725824571546159607795133625640190620741982638843180493222615294');
|
||||
t('0.524217411165998018391262237830297491516856805040463896080592290487405064611025001607311512479709354535407130581948832593516281243820812174844723190311545869854968531247730387537943969800839367585396013641826800875467649274673709974876292276089324234102809573076731030535244688816', 76, 3, '0.5781754114340578960371795632804762026798421163023137415437904934165060267084');
|
||||
t('323646192595.4845', 127, 6, '-0.3747612268270038347175054875779625030989108207803221587812055629899198693615407534041949990189331417585285760850333254670480789');
|
||||
|
||||
T.stop();
|
||||
T.stop();
|
||||
})();
|
||||
|
@ -1,126 +1,125 @@
|
||||
if (typeof T === 'undefined') require('../setup');
|
||||
|
||||
(function () {
|
||||
T('tanh');
|
||||
T('tanh');
|
||||
|
||||
function t(n, pr, rm, expected) {
|
||||
Decimal.precision = pr;
|
||||
Decimal.rounding = rm;
|
||||
T.assertEqual(expected, Decimal.tanh(n).valueOf());
|
||||
T.assertEqual(expected, new Decimal(n).tanh().valueOf());
|
||||
}
|
||||
function t(n, pr, rm, expected) {
|
||||
Decimal.precision = pr;
|
||||
Decimal.rounding = rm;
|
||||
T.assertEqual(expected, new Decimal(n).tanh().valueOf());
|
||||
}
|
||||
|
||||
Decimal.config({
|
||||
precision: 40,
|
||||
rounding: 4,
|
||||
toExpNeg: -9e15,
|
||||
toExpPos: 9e15,
|
||||
minE: -9e15,
|
||||
maxE: 9e15
|
||||
});
|
||||
Decimal.config({
|
||||
precision: 40,
|
||||
rounding: 4,
|
||||
toExpNeg: -9e15,
|
||||
toExpPos: 9e15,
|
||||
minE: -9e15,
|
||||
maxE: 9e15
|
||||
});
|
||||
|
||||
t('NaN', 40, 4, 'NaN');
|
||||
t('0', 20, 4, '0');
|
||||
t('-0', 20, 4, '-0');
|
||||
t('Infinity', 40, 4, '1');
|
||||
t('-Infinity', 40, 4, '-1');
|
||||
t('NaN', 40, 4, 'NaN');
|
||||
t('0', 20, 4, '0');
|
||||
t('-0', 20, 4, '-0');
|
||||
t('Infinity', 40, 4, '1');
|
||||
t('-Infinity', 40, 4, '-1');
|
||||
|
||||
t('0.20269', 1, 0, '0.2');
|
||||
t('0.42', 6, 5, '0.39693');
|
||||
t('-0.35339119', 8, 1, '-0.33937958');
|
||||
t('0.153', 8, 1, '0.15181721');
|
||||
t('0.26', 1, 1, '0.2');
|
||||
t('-0.5', 4, 4, '-0.4621');
|
||||
t('0.5301167511', 10, 0, '0.4854703307');
|
||||
t('0.1', 6, 2, '0.099668');
|
||||
t('-0.1947', 8, 6, '-0.19227651');
|
||||
t('0.62055680437965736490569245685566214324448351639', 9, 3, '0.551515589');
|
||||
t('0.8653929782497126681556355800799811365862905422680464', 2, 5, '0.7');
|
||||
t('-0.223453445837184', 10, 6, '-0.2198071371');
|
||||
t('0.6228344', 3, 6, '0.553');
|
||||
t('0.3860621505234646348994570686682533147396620957827359578508068456', 2, 1, '0.36');
|
||||
t('0.5499', 3, 2, '0.501');
|
||||
t('0.27', 4, 0, '0.2637');
|
||||
t('-0.20874419', 6, 0, '-0.205765');
|
||||
t('-0.9', 9, 0, '-0.716297871');
|
||||
t('-0.66', 10, 0, '-0.5783634131');
|
||||
t('0.5', 8, 1, '0.46211715');
|
||||
t('-0.8730255767917122199088529', 5, 1, '-0.7029');
|
||||
t('-0.3', 6, 4, '-0.291313');
|
||||
t('0.0772947', 5, 6, '0.077141');
|
||||
t('-0.1', 5, 4, '-0.099668');
|
||||
t('-0.5530719666927749554276959', 5, 2, '-0.50281');
|
||||
t('-0.76695591420216557012230781', 7, 0, '-0.6451559');
|
||||
t('-0.28931973768077305489831982152049', 1, 3, '-0.3');
|
||||
t('-0.631664433177866683720536966087102', 3, 5, '-0.559');
|
||||
t('0.4647093', 9, 2, '0.433914635');
|
||||
t('-0.293097', 2, 0, '-0.29');
|
||||
t('0.39968', 6, 2, '0.379676');
|
||||
t('-0.56478323116711527', 10, 5, '-0.5115177648');
|
||||
t('-0.60158', 2, 2, '-0.53');
|
||||
t('-0.566', 5, 6, '-0.51242');
|
||||
t('-0.5455', 1, 1, '-0.4');
|
||||
t('0.181743184255049315571704802510832099', 6, 5, '0.179768');
|
||||
t('-0.7', 2, 3, '-0.61');
|
||||
t('-0.410626', 8, 6, '-0.38900408');
|
||||
t('0.32', 10, 1, '0.3095069212');
|
||||
t('0.478', 9, 0, '0.444640449');
|
||||
t('-0.2127882653536975970432160655692', 1, 0, '-0.3');
|
||||
t('0.668', 9, 2, '0.583662747');
|
||||
t('0.1054319768894549379656717', 6, 5, '0.105043');
|
||||
t('-0.2159146041935965', 6, 3, '-0.212621');
|
||||
t('-0.53', 5, 6, '-0.48538');
|
||||
t('0.35', 10, 1, '0.3363755443');
|
||||
t('0.3', 3, 2, '0.292');
|
||||
t('0.38276035385122733156525463', 1, 1, '0.3');
|
||||
t('-0.751550287803356896438162105272645', 31, 0, '-0.6360729215504306567971084126656');
|
||||
t('0.2958626290477698111067628542902641468424491987425491552317600599757584700042', 33, 4, '0.287521804057197325874867763687105');
|
||||
t('-0.1624241525', 60, 5, '-0.161010729348804314083016365256060397030839070169914629959771');
|
||||
t('-0.3246133', 23, 0, '-0.3136723151870226491541');
|
||||
t('0.7574510519751273', 52, 2, '0.6395731248592590736391239000170979980280431536354096');
|
||||
t('0.52677087', 9, 5, '0.482908861');
|
||||
t('0.01504298596871499648833185964254026', 19, 0, '0.01504185137182836531');
|
||||
t('-0.66543541401805503420777', 66, 4, '-0.581969286944420744706095110187298812957954793212156080645254407938');
|
||||
t('0.016497376645717697522865', 24, 0, '0.0164958801477289569077129');
|
||||
t('0.79228702880353249365', 45, 0, '0.659702681921377249169326566285194050648896939');
|
||||
t('-0.32047744', 35, 3, '-0.30993856125352144923141124282332793');
|
||||
t('0.78607526651121', 28, 5, '0.6561799353543745431928429623');
|
||||
t('-0.130782154855323731897567604029773075178369276247566438028657144457559876456195235141546572', 80, 3, '-0.13004158964612601126893011628900193563954656630020761998126577892190799298653838');
|
||||
t('0.543888568', 52, 5, '0.495925821522156920755419346170717806152690266078471');
|
||||
t('0.595946834719509046130665028731095130596', 61, 0, '0.5341591488247401589317435849855958281981025417248174269032896');
|
||||
t('0.8180710003422039739052425209159024776836992576782', 75, 5, '0.674018589934549659108491437885993668870523407722879795457767225797625110655');
|
||||
t('0.2002343534718092035', 32, 2, '0.19760053356302078332195382537244');
|
||||
t('0.4316', 73, 2, '0.4066575843743152347702788188048559212155195983052915894345749387848887185');
|
||||
t('0.0297026', 47, 0, '0.029693868096821512437865399347977108636469769826');
|
||||
t('0.53196297398345769364909690685747648864854530119854', 56, 1, '0.48688016788770163925717272861291678368256194265983517854');
|
||||
t('-0.86540495196', 57, 4, '-0.699031973057205236065847483268440159156292260431585544883');
|
||||
t('-0.0218982341955013979387277630591838547', 66, 6, '-0.021894734560604770532346703409220449766736745588134181835811694617');
|
||||
t('-0.3503134189235148094342514029278811316170849354159958798993', 78, 4, '-0.336653471066707838641123262575513511831303224617968974634023553683297404695416');
|
||||
t('-0.666924383326373492780403568920198080574', 25, 5, '-0.5829531066013566651422653');
|
||||
t('-0.44325150067844726483860902210607088446679462', 1, 1, '-0.4');
|
||||
t('0.9034751706768019789827', 60, 6, '0.717985782691067206453512080792613565326893708313975428005223');
|
||||
t('0.2172485076904694895179', 63, 4, '0.213894002682974109904624836689545795117673726509639521578182275');
|
||||
t('-0.348534855137810830366231027941', 31, 3, '-0.3350755386644384737516713339319');
|
||||
t('-0.4255195', 45, 5, '-0.401570102011929569917989543792334637564089692');
|
||||
t('-0.886162172614361731', 29, 2, '-0.70949297599079569125232530876');
|
||||
t('-0.7', 78, 5, '-0.604367777117163496308687183103826475015566647416860888612419993599538639474122');
|
||||
t('0.757119675718', 66, 2, '0.639377257808623037769808128229970838858747391194193471609343942998');
|
||||
t('0.2642178764761', 55, 6, '0.2582364046844679768754362197481015404352489557723913895');
|
||||
t('0.321329', 74, 6, '0.31070811547650274839857700104600776395241041487409731293147237247772091748');
|
||||
t('0.1682695184810800667294209270614384694422368505868903621013683783929', 16, 0, '0.1666991388738522');
|
||||
t('-0.409858192536257152668045191854122303323410295894', 43, 0, '-0.3883522664291927890893297914389310714602415');
|
||||
t('0.2880615', 120, 0, '0.280349643265659497705660848534086455056558585660980017680059937512840019825269028854239781634733893540906928184561638591');
|
||||
t('-0.2803292668048951604355466058306354327579221441238441133669431820221412822995', 69, 4, '-0.2732097971115351269678804248529217531253775527585485646027761857336');
|
||||
t('0.209183180524407073852661413214033433796240391516313838917745903006946400344329579472178537414263299679577464721107342550013722994343049', 3, 0, '0.207');
|
||||
t('-0.21323411415637447', 100, 3, '-0.2100599987497949082863636944922996664334987508835646248560687414181626030840090573861293885022227807');
|
||||
t('-0.934150529137316227495052114810154290011321681684010680698706327964978851230256', 97, 1, '-0.7325231466730630602965757839383259193306031234060675020081884134754348821771511575580397417734494');
|
||||
t('0.612797', 135, 6, '0.546092981987055113177270374342598658047265622605927205095448291249934086020550572905344645120234563581014732729130051050396440278747926');
|
||||
t('-0.18273791076980028567544728336113017263732539776346366568034574', 45, 2, '-0.180730653506873097396527854034699651896910694');
|
||||
t('0.5288356309407208928920467515068426806', 107, 2, '0.48449053794065651739672070077375035256792292259097100512145231251249909428817259447380109781326377031262135');
|
||||
t('-0.50752591', 24, 5, '-0.468015268006387507893896');
|
||||
t('-0.54917290836787549931392', 88, 4, '-0.49990006636857985687649939062630289074578706968740926592041362893811220431493732027711');
|
||||
t('0.91999661041886666', 17, 6, '0.72589581132601256');
|
||||
t('0.20269', 1, 0, '0.2');
|
||||
t('0.42', 6, 5, '0.39693');
|
||||
t('-0.35339119', 8, 1, '-0.33937958');
|
||||
t('0.153', 8, 1, '0.15181721');
|
||||
t('0.26', 1, 1, '0.2');
|
||||
t('-0.5', 4, 4, '-0.4621');
|
||||
t('0.5301167511', 10, 0, '0.4854703307');
|
||||
t('0.1', 6, 2, '0.099668');
|
||||
t('-0.1947', 8, 6, '-0.19227651');
|
||||
t('0.62055680437965736490569245685566214324448351639', 9, 3, '0.551515589');
|
||||
t('0.8653929782497126681556355800799811365862905422680464', 2, 5, '0.7');
|
||||
t('-0.223453445837184', 10, 6, '-0.2198071371');
|
||||
t('0.6228344', 3, 6, '0.553');
|
||||
t('0.3860621505234646348994570686682533147396620957827359578508068456', 2, 1, '0.36');
|
||||
t('0.5499', 3, 2, '0.501');
|
||||
t('0.27', 4, 0, '0.2637');
|
||||
t('-0.20874419', 6, 0, '-0.205765');
|
||||
t('-0.9', 9, 0, '-0.716297871');
|
||||
t('-0.66', 10, 0, '-0.5783634131');
|
||||
t('0.5', 8, 1, '0.46211715');
|
||||
t('-0.8730255767917122199088529', 5, 1, '-0.7029');
|
||||
t('-0.3', 6, 4, '-0.291313');
|
||||
t('0.0772947', 5, 6, '0.077141');
|
||||
t('-0.1', 5, 4, '-0.099668');
|
||||
t('-0.5530719666927749554276959', 5, 2, '-0.50281');
|
||||
t('-0.76695591420216557012230781', 7, 0, '-0.6451559');
|
||||
t('-0.28931973768077305489831982152049', 1, 3, '-0.3');
|
||||
t('-0.631664433177866683720536966087102', 3, 5, '-0.559');
|
||||
t('0.4647093', 9, 2, '0.433914635');
|
||||
t('-0.293097', 2, 0, '-0.29');
|
||||
t('0.39968', 6, 2, '0.379676');
|
||||
t('-0.56478323116711527', 10, 5, '-0.5115177648');
|
||||
t('-0.60158', 2, 2, '-0.53');
|
||||
t('-0.566', 5, 6, '-0.51242');
|
||||
t('-0.5455', 1, 1, '-0.4');
|
||||
t('0.181743184255049315571704802510832099', 6, 5, '0.179768');
|
||||
t('-0.7', 2, 3, '-0.61');
|
||||
t('-0.410626', 8, 6, '-0.38900408');
|
||||
t('0.32', 10, 1, '0.3095069212');
|
||||
t('0.478', 9, 0, '0.444640449');
|
||||
t('-0.2127882653536975970432160655692', 1, 0, '-0.3');
|
||||
t('0.668', 9, 2, '0.583662747');
|
||||
t('0.1054319768894549379656717', 6, 5, '0.105043');
|
||||
t('-0.2159146041935965', 6, 3, '-0.212621');
|
||||
t('-0.53', 5, 6, '-0.48538');
|
||||
t('0.35', 10, 1, '0.3363755443');
|
||||
t('0.3', 3, 2, '0.292');
|
||||
t('0.38276035385122733156525463', 1, 1, '0.3');
|
||||
t('-0.751550287803356896438162105272645', 31, 0, '-0.6360729215504306567971084126656');
|
||||
t('0.2958626290477698111067628542902641468424491987425491552317600599757584700042', 33, 4, '0.287521804057197325874867763687105');
|
||||
t('-0.1624241525', 60, 5, '-0.161010729348804314083016365256060397030839070169914629959771');
|
||||
t('-0.3246133', 23, 0, '-0.3136723151870226491541');
|
||||
t('0.7574510519751273', 52, 2, '0.6395731248592590736391239000170979980280431536354096');
|
||||
t('0.52677087', 9, 5, '0.482908861');
|
||||
t('0.01504298596871499648833185964254026', 19, 0, '0.01504185137182836531');
|
||||
t('-0.66543541401805503420777', 66, 4, '-0.581969286944420744706095110187298812957954793212156080645254407938');
|
||||
t('0.016497376645717697522865', 24, 0, '0.0164958801477289569077129');
|
||||
t('0.79228702880353249365', 45, 0, '0.659702681921377249169326566285194050648896939');
|
||||
t('-0.32047744', 35, 3, '-0.30993856125352144923141124282332793');
|
||||
t('0.78607526651121', 28, 5, '0.6561799353543745431928429623');
|
||||
t('-0.130782154855323731897567604029773075178369276247566438028657144457559876456195235141546572', 80, 3, '-0.13004158964612601126893011628900193563954656630020761998126577892190799298653838');
|
||||
t('0.543888568', 52, 5, '0.495925821522156920755419346170717806152690266078471');
|
||||
t('0.595946834719509046130665028731095130596', 61, 0, '0.5341591488247401589317435849855958281981025417248174269032896');
|
||||
t('0.8180710003422039739052425209159024776836992576782', 75, 5, '0.674018589934549659108491437885993668870523407722879795457767225797625110655');
|
||||
t('0.2002343534718092035', 32, 2, '0.19760053356302078332195382537244');
|
||||
t('0.4316', 73, 2, '0.4066575843743152347702788188048559212155195983052915894345749387848887185');
|
||||
t('0.0297026', 47, 0, '0.029693868096821512437865399347977108636469769826');
|
||||
t('0.53196297398345769364909690685747648864854530119854', 56, 1, '0.48688016788770163925717272861291678368256194265983517854');
|
||||
t('-0.86540495196', 57, 4, '-0.699031973057205236065847483268440159156292260431585544883');
|
||||
t('-0.0218982341955013979387277630591838547', 66, 6, '-0.021894734560604770532346703409220449766736745588134181835811694617');
|
||||
t('-0.3503134189235148094342514029278811316170849354159958798993', 78, 4, '-0.336653471066707838641123262575513511831303224617968974634023553683297404695416');
|
||||
t('-0.666924383326373492780403568920198080574', 25, 5, '-0.5829531066013566651422653');
|
||||
t('-0.44325150067844726483860902210607088446679462', 1, 1, '-0.4');
|
||||
t('0.9034751706768019789827', 60, 6, '0.717985782691067206453512080792613565326893708313975428005223');
|
||||
t('0.2172485076904694895179', 63, 4, '0.213894002682974109904624836689545795117673726509639521578182275');
|
||||
t('-0.348534855137810830366231027941', 31, 3, '-0.3350755386644384737516713339319');
|
||||
t('-0.4255195', 45, 5, '-0.401570102011929569917989543792334637564089692');
|
||||
t('-0.886162172614361731', 29, 2, '-0.70949297599079569125232530876');
|
||||
t('-0.7', 78, 5, '-0.604367777117163496308687183103826475015566647416860888612419993599538639474122');
|
||||
t('0.757119675718', 66, 2, '0.639377257808623037769808128229970838858747391194193471609343942998');
|
||||
t('0.2642178764761', 55, 6, '0.2582364046844679768754362197481015404352489557723913895');
|
||||
t('0.321329', 74, 6, '0.31070811547650274839857700104600776395241041487409731293147237247772091748');
|
||||
t('0.1682695184810800667294209270614384694422368505868903621013683783929', 16, 0, '0.1666991388738522');
|
||||
t('-0.409858192536257152668045191854122303323410295894', 43, 0, '-0.3883522664291927890893297914389310714602415');
|
||||
t('0.2880615', 120, 0, '0.280349643265659497705660848534086455056558585660980017680059937512840019825269028854239781634733893540906928184561638591');
|
||||
t('-0.2803292668048951604355466058306354327579221441238441133669431820221412822995', 69, 4, '-0.2732097971115351269678804248529217531253775527585485646027761857336');
|
||||
t('0.209183180524407073852661413214033433796240391516313838917745903006946400344329579472178537414263299679577464721107342550013722994343049', 3, 0, '0.207');
|
||||
t('-0.21323411415637447', 100, 3, '-0.2100599987497949082863636944922996664334987508835646248560687414181626030840090573861293885022227807');
|
||||
t('-0.934150529137316227495052114810154290011321681684010680698706327964978851230256', 97, 1, '-0.7325231466730630602965757839383259193306031234060675020081884134754348821771511575580397417734494');
|
||||
t('0.612797', 135, 6, '0.546092981987055113177270374342598658047265622605927205095448291249934086020550572905344645120234563581014732729130051050396440278747926');
|
||||
t('-0.18273791076980028567544728336113017263732539776346366568034574', 45, 2, '-0.180730653506873097396527854034699651896910694');
|
||||
t('0.5288356309407208928920467515068426806', 107, 2, '0.48449053794065651739672070077375035256792292259097100512145231251249909428817259447380109781326377031262135');
|
||||
t('-0.50752591', 24, 5, '-0.468015268006387507893896');
|
||||
t('-0.54917290836787549931392', 88, 4, '-0.49990006636857985687649939062630289074578706968740926592041362893811220431493732027711');
|
||||
t('0.91999661041886666', 17, 6, '0.72589581132601256');
|
||||
|
||||
T.stop();
|
||||
T.stop();
|
||||
})();
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
1032
test/modules/toDP.js
1032
test/modules/toDP.js
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,234 +1,234 @@
|
||||
if (typeof T === 'undefined') require('../setup');
|
||||
|
||||
(function () {
|
||||
T('toFraction');
|
||||
T('toFraction');
|
||||
|
||||
function t(expected, n, maxDenominator) {
|
||||
T.assertEqual(expected, new Decimal(n).toFraction(maxDenominator).toString());
|
||||
}
|
||||
function t(expected, n, maxDenominator) {
|
||||
T.assertEqual(expected, new Decimal(n).toFraction(maxDenominator).toString());
|
||||
}
|
||||
|
||||
function tx(fn, msg) {
|
||||
T.assertException(fn, msg);
|
||||
}
|
||||
function tx(fn, msg) {
|
||||
T.assertException(fn, msg);
|
||||
}
|
||||
|
||||
Decimal.config({
|
||||
precision: 20,
|
||||
rounding: 4,
|
||||
toExpNeg: -9e15,
|
||||
toExpPos: 9e15,
|
||||
minE: -9e15,
|
||||
maxE: 9e15
|
||||
});
|
||||
Decimal.config({
|
||||
precision: 20,
|
||||
rounding: 4,
|
||||
toExpNeg: -9e15,
|
||||
toExpPos: 9e15,
|
||||
minE: -9e15,
|
||||
maxE: 9e15
|
||||
});
|
||||
|
||||
t('1,10', '0.1');
|
||||
t('-1,10', '-0.1');
|
||||
t('1,100', '0.01');
|
||||
t('-1,100', '-0.01');
|
||||
t('1,1000', '0.001');
|
||||
t('-1,1000', '-0.001');
|
||||
t('54301793,100000', '543.017930');
|
||||
t('-484693350148251574449,1000000000000', '-484693350.1482515744490');
|
||||
t('-200111074540568980159529,25000000000000', '-8004442981.622759206381160');
|
||||
t('-5965700213104829,1000000000000000', '-5.965700213104829');
|
||||
t('-5124110209739113904928179,100000000000000', '-51241102097.39113904928179');
|
||||
t('-1655017182533520595664837541,200000000000000', '-8275085912667.602978324187705');
|
||||
t('-5,8', '-0.625');
|
||||
t('-42394617,200000000', '-0.211973085');
|
||||
t('-147453708173963291829,2500000000000000000', '-58.9814832695853167316');
|
||||
t('-2733,100', '-27.33');
|
||||
t('0,1', '0.0');
|
||||
t('-2599897551866392365731491641,10000000000', '-259989755186639236.5731491641');
|
||||
t('-9326331230765073371,5000000000000000', '-1865.2662461530146742');
|
||||
t('-2483061,10000', '-248.3061');
|
||||
t('-92864854181,10000000', '-9286.4854181');
|
||||
t('-758516850228215193,100000000000000000', '-7.5851685022821519300');
|
||||
t('-19570408085559589,20000000000', '-978520.404277979450');
|
||||
t('-211,100', '-2.11');
|
||||
t('-4789334439841,10000000000', '-478.9334439841');
|
||||
t('2978320663077,10000000000000', '0.2978320663077');
|
||||
t('-1221,25', '-48.84');
|
||||
t('12456254053601331,5000000000000', '2491.25081072026620');
|
||||
t('31969983,100000', '319.69983');
|
||||
t('31852901149,400000000000', '0.0796322528725');
|
||||
t('-456674099059,10000000000', '-45.6674099059');
|
||||
t('-361907787,5000000', '-72.3815574');
|
||||
t('-6521,100', '-65.21');
|
||||
t('1,10', '0.1');
|
||||
t('-1,10', '-0.1');
|
||||
t('1,100', '0.01');
|
||||
t('-1,100', '-0.01');
|
||||
t('1,1000', '0.001');
|
||||
t('-1,1000', '-0.001');
|
||||
t('54301793,100000', '543.017930');
|
||||
t('-484693350148251574449,1000000000000', '-484693350.1482515744490');
|
||||
t('-200111074540568980159529,25000000000000', '-8004442981.622759206381160');
|
||||
t('-5965700213104829,1000000000000000', '-5.965700213104829');
|
||||
t('-5124110209739113904928179,100000000000000', '-51241102097.39113904928179');
|
||||
t('-1655017182533520595664837541,200000000000000', '-8275085912667.602978324187705');
|
||||
t('-5,8', '-0.625');
|
||||
t('-42394617,200000000', '-0.211973085');
|
||||
t('-147453708173963291829,2500000000000000000', '-58.9814832695853167316');
|
||||
t('-2733,100', '-27.33');
|
||||
t('0,1', '0.0');
|
||||
t('-2599897551866392365731491641,10000000000', '-259989755186639236.5731491641');
|
||||
t('-9326331230765073371,5000000000000000', '-1865.2662461530146742');
|
||||
t('-2483061,10000', '-248.3061');
|
||||
t('-92864854181,10000000', '-9286.4854181');
|
||||
t('-758516850228215193,100000000000000000', '-7.5851685022821519300');
|
||||
t('-19570408085559589,20000000000', '-978520.404277979450');
|
||||
t('-211,100', '-2.11');
|
||||
t('-4789334439841,10000000000', '-478.9334439841');
|
||||
t('2978320663077,10000000000000', '0.2978320663077');
|
||||
t('-1221,25', '-48.84');
|
||||
t('12456254053601331,5000000000000', '2491.25081072026620');
|
||||
t('31969983,100000', '319.69983');
|
||||
t('31852901149,400000000000', '0.0796322528725');
|
||||
t('-456674099059,10000000000', '-45.6674099059');
|
||||
t('-361907787,5000000', '-72.3815574');
|
||||
t('-6521,100', '-65.21');
|
||||
|
||||
t('5,1', '5.1582612935891', '3');
|
||||
t('14645,1797', '8.14969395596340', '4682');
|
||||
t('350921,81990', '4.28004634702', '82418');
|
||||
t('923754598113149102531799372705758450549,100000000', '9237545981131491025317993727057.58450549');
|
||||
t('23665467152910525354658972818814752082,49447', '478602688796297558085606261629921.9787246948249979233505266225354557384', '57466');
|
||||
t('12401124714135748113774134798397,2', '6200562357067874056887067399198.66971421701', '2');
|
||||
t('5747456325233732815460960864983211610837351385715799969377,100000000000000000000000000000', '57474563252337328154609608649.83211610837351385715799969377');
|
||||
t('4744,61', '77.7705294446793765233206385561288346447', '86');
|
||||
t('230406626515463254737498487452583023685806305331639,100000000000000000000000000', '2304066265154632547374984.87452583023685806305331639');
|
||||
t('8452816572418429518944119647,5000', '1690563314483685903788823.9294');
|
||||
t('48239499471878294436129777581,10000000000000000', '4823949947187.82944361297775810');
|
||||
t('45172634468362586403517152343110493066053,74300', '607976237797612199239800166125309462.530995962577562', '89241');
|
||||
t('245629009658126699398365025147112883705717,1250000000000000000000000000000', '196503207726.5013595186920201176903069645736');
|
||||
t('19575206081236584421562241755643406299,500000000000000000000000000000000000', '39.150412162473168843124483511286812598');
|
||||
t('124335953351113119989680198250484096210027176457861877,20000000000000000000000', '6216797667555655999484009912524.20481050135882289309385');
|
||||
t('62359286968916651021817694022163661098254437249041482587,100000000000000000000000000', '623592869689166510218176940221.63661098254437249041482587');
|
||||
t('1406253392003122107350210973,50', '28125067840062442147004219.46', '90');
|
||||
t('736337826,1', '736337826.0', '1');
|
||||
t('2294354321,3019', '759971.62007285863174441704674479534091075', '5946');
|
||||
t('342555042697121035185957633789368546657896318423873,50000000000000000000000000', '6851100853942420703719152.67578737093315792636847746');
|
||||
t('3511582655801640591,52', '67530435688493088.2885316751682999639624370547426320', '73');
|
||||
t('1190687310674838338273481559,50000', '23813746213496766765469.63118');
|
||||
t('31747884008318370382077439489,40', '793697100207959259551935987.225181146039', '45');
|
||||
t('39451289109544785156061546711681,59993', '657598204949657212609163514.271348320970259397527780637349273932', '61325');
|
||||
t('3859539118592118171061,65', '59377524901417202631.7076617756627530296590420377861', '248');
|
||||
t('2529860848590369124121129138,36761', '68819152052184900414056.449443703377131320899467509', '59208');
|
||||
t('17331073,2', '8665536.3781112033855216846406980971689', '2');
|
||||
t('11088761069693879,25000', '443550442787.75516');
|
||||
t('37298162459148947522489,474', '78688106453900733169.80801275320205353359142143262532', '517');
|
||||
t('12411782390212011049587005051032466579057,100000000000000000000000000000000000000', '124.11782390212011049587005051032466579057');
|
||||
t('288377889236302421024476469650301879883847,50000000000000000000000', '5767557784726048420.48952939300603759767694');
|
||||
t('64269805556832147,1', '64269805556832146.8921574533060466484388410550211', '2');
|
||||
t('1019428223041680221,2', '509714111520840110.44623631764611004359625363775303233110', '2');
|
||||
t('5,1', '5.1582612935891', '3');
|
||||
t('14645,1797', '8.14969395596340', '4682');
|
||||
t('350921,81990', '4.28004634702', '82418');
|
||||
t('923754598113149102531799372705758450549,100000000', '9237545981131491025317993727057.58450549');
|
||||
t('23665467152910525354658972818814752082,49447', '478602688796297558085606261629921.9787246948249979233505266225354557384', '57466');
|
||||
t('12401124714135748113774134798397,2', '6200562357067874056887067399198.66971421701', '2');
|
||||
t('5747456325233732815460960864983211610837351385715799969377,100000000000000000000000000000', '57474563252337328154609608649.83211610837351385715799969377');
|
||||
t('4744,61', '77.7705294446793765233206385561288346447', '86');
|
||||
t('230406626515463254737498487452583023685806305331639,100000000000000000000000000', '2304066265154632547374984.87452583023685806305331639');
|
||||
t('8452816572418429518944119647,5000', '1690563314483685903788823.9294');
|
||||
t('48239499471878294436129777581,10000000000000000', '4823949947187.82944361297775810');
|
||||
t('45172634468362586403517152343110493066053,74300', '607976237797612199239800166125309462.530995962577562', '89241');
|
||||
t('245629009658126699398365025147112883705717,1250000000000000000000000000000', '196503207726.5013595186920201176903069645736');
|
||||
t('19575206081236584421562241755643406299,500000000000000000000000000000000000', '39.150412162473168843124483511286812598');
|
||||
t('124335953351113119989680198250484096210027176457861877,20000000000000000000000', '6216797667555655999484009912524.20481050135882289309385');
|
||||
t('62359286968916651021817694022163661098254437249041482587,100000000000000000000000000', '623592869689166510218176940221.63661098254437249041482587');
|
||||
t('1406253392003122107350210973,50', '28125067840062442147004219.46', '90');
|
||||
t('736337826,1', '736337826.0', '1');
|
||||
t('2294354321,3019', '759971.62007285863174441704674479534091075', '5946');
|
||||
t('342555042697121035185957633789368546657896318423873,50000000000000000000000000', '6851100853942420703719152.67578737093315792636847746');
|
||||
t('3511582655801640591,52', '67530435688493088.2885316751682999639624370547426320', '73');
|
||||
t('1190687310674838338273481559,50000', '23813746213496766765469.63118');
|
||||
t('31747884008318370382077439489,40', '793697100207959259551935987.225181146039', '45');
|
||||
t('39451289109544785156061546711681,59993', '657598204949657212609163514.271348320970259397527780637349273932', '61325');
|
||||
t('3859539118592118171061,65', '59377524901417202631.7076617756627530296590420377861', '248');
|
||||
t('2529860848590369124121129138,36761', '68819152052184900414056.449443703377131320899467509', '59208');
|
||||
t('17331073,2', '8665536.3781112033855216846406980971689', '2');
|
||||
t('11088761069693879,25000', '443550442787.75516');
|
||||
t('37298162459148947522489,474', '78688106453900733169.80801275320205353359142143262532', '517');
|
||||
t('12411782390212011049587005051032466579057,100000000000000000000000000000000000000', '124.11782390212011049587005051032466579057');
|
||||
t('288377889236302421024476469650301879883847,50000000000000000000000', '5767557784726048420.48952939300603759767694');
|
||||
t('64269805556832147,1', '64269805556832146.8921574533060466484388410550211', '2');
|
||||
t('1019428223041680221,2', '509714111520840110.44623631764611004359625363775303233110', '2');
|
||||
|
||||
t('-535739501101785482356483511,20000000000000000', '-26786975055.08927411782417555');
|
||||
t('-2189002367733133,500000000000000', '-4.378004735466266');
|
||||
t('-4135862533810979636019397675000,1', '-4.135862533810979636019397675E+30');
|
||||
t('-14984699501047789,1000000000000', '-14984.699501047789');
|
||||
t('-2644213426631746862661931503,10000', '-264421342663174686266193.1503');
|
||||
t('-2092299259157497414090361017,5', '-418459851831499482818072203.4');
|
||||
t('-77,100', '-0.77');
|
||||
t('-54276151887,1000000000', '-54.276151887');
|
||||
t('-389683579126928886377631531,2500000000000000', '-155873431650.7715545510526124');
|
||||
t('46789726161807116524384304297700033991397937633588752307,10000000000000000000000000000000000000', '4678972616180711652.4384304297700033991397937633588752307');
|
||||
t('-9196858034762943045297291137,10000', '-919685803476294304529729.1137');
|
||||
t('-12757819,25000', '-510.31276');
|
||||
t('-2751580109664699528322719473,50', '-55031602193293990566454389.46');
|
||||
t('-1397067073903866232334961397,200000000000', '-6985335369519331.161674806985');
|
||||
t('-10827300142961420614583582960000000000000000000000000000000000000000000,1', '-1.082730014296142061458358296E+70');
|
||||
t('488478745829,50000000', '9769.57491658');
|
||||
t('-2319703638146144907642415179,250000000000000000000000000', '-9.278814552584579630569660716');
|
||||
t('8199609,1000000', '8.199609');
|
||||
t('-1132520281920903148966859641,50000000000', '-22650405638418062.97933719282');
|
||||
t('-9435372448691264711,10000000000', '-943537244.8691264711');
|
||||
t('-5430432705270926972283794348000000000000000,1', '-5.430432705270926972283794348E+42');
|
||||
t('2547106921,10000000', '254.7106921');
|
||||
t('-2013361060932518973304030049,250000000000', '-8053444243730075.893216120196');
|
||||
t('-299071373209294751127694543,4000', '-74767843302323687781923.63575');
|
||||
t('161261,5000', '32.2522');
|
||||
t('-2149015945426180798371334522,1', '-2149015945426180798371334522');
|
||||
t('-1219052557726696173105236523,1250000000000000', '-975242046181.3569384841892184');
|
||||
t('-6635702255618430700913831019,1000000', '-6635702255618430700913.831019');
|
||||
t('-4229092410987972953057006873,100', '-42290924109879729530570068.73');
|
||||
t('800876757958087347097942687332875742929708200305858327085977609,100000000000000000000000000000000000', '8008767579580873470979426873.32875742929708200305858327085977609');
|
||||
t('-2665484396670548074136945193,50', '-53309687933410961482738903.86');
|
||||
t('-535739501101785482356483511,20000000000000000', '-26786975055.08927411782417555');
|
||||
t('-2189002367733133,500000000000000', '-4.378004735466266');
|
||||
t('-4135862533810979636019397675000,1', '-4.135862533810979636019397675E+30');
|
||||
t('-14984699501047789,1000000000000', '-14984.699501047789');
|
||||
t('-2644213426631746862661931503,10000', '-264421342663174686266193.1503');
|
||||
t('-2092299259157497414090361017,5', '-418459851831499482818072203.4');
|
||||
t('-77,100', '-0.77');
|
||||
t('-54276151887,1000000000', '-54.276151887');
|
||||
t('-389683579126928886377631531,2500000000000000', '-155873431650.7715545510526124');
|
||||
t('46789726161807116524384304297700033991397937633588752307,10000000000000000000000000000000000000', '4678972616180711652.4384304297700033991397937633588752307');
|
||||
t('-9196858034762943045297291137,10000', '-919685803476294304529729.1137');
|
||||
t('-12757819,25000', '-510.31276');
|
||||
t('-2751580109664699528322719473,50', '-55031602193293990566454389.46');
|
||||
t('-1397067073903866232334961397,200000000000', '-6985335369519331.161674806985');
|
||||
t('-10827300142961420614583582960000000000000000000000000000000000000000000,1', '-1.082730014296142061458358296E+70');
|
||||
t('488478745829,50000000', '9769.57491658');
|
||||
t('-2319703638146144907642415179,250000000000000000000000000', '-9.278814552584579630569660716');
|
||||
t('8199609,1000000', '8.199609');
|
||||
t('-1132520281920903148966859641,50000000000', '-22650405638418062.97933719282');
|
||||
t('-9435372448691264711,10000000000', '-943537244.8691264711');
|
||||
t('-5430432705270926972283794348000000000000000,1', '-5.430432705270926972283794348E+42');
|
||||
t('2547106921,10000000', '254.7106921');
|
||||
t('-2013361060932518973304030049,250000000000', '-8053444243730075.893216120196');
|
||||
t('-299071373209294751127694543,4000', '-74767843302323687781923.63575');
|
||||
t('161261,5000', '32.2522');
|
||||
t('-2149015945426180798371334522,1', '-2149015945426180798371334522');
|
||||
t('-1219052557726696173105236523,1250000000000000', '-975242046181.3569384841892184');
|
||||
t('-6635702255618430700913831019,1000000', '-6635702255618430700913.831019');
|
||||
t('-4229092410987972953057006873,100', '-42290924109879729530570068.73');
|
||||
t('800876757958087347097942687332875742929708200305858327085977609,100000000000000000000000000000000000', '8008767579580873470979426873.32875742929708200305858327085977609');
|
||||
t('-2665484396670548074136945193,50', '-53309687933410961482738903.86');
|
||||
|
||||
t('30396,38195', '0.79581097', '74409');
|
||||
t('2125057574,3289', '646110.5424140842277760913716223149175043516912866283522989430448583852673477181054', '4314');
|
||||
t('18251,16', '1140.688086121119279582816178812726653910', '37');
|
||||
t('61348765027081784476232889631422618917241085602257,2', '30674382513540892238116444815711309458620542801128.559859020834676491532682063017825303001913079937413732204504474950978211332225018371420', '2');
|
||||
t('238354711696434965227174225040046402291933791409568617910,25981', '9174193129457486826033417691391647830796882006449660.0558100148468970808679278895365813792370050009058167954469', '61710');
|
||||
t('7355967799241738309628763754835483150582416687842544374137,8', '919495974905217288703595469354435393822802085980318046767.1338999658963927824509929378965804777221331548975659545056488845295998946309871474144010438', '9');
|
||||
t('1125354937387110207464744146511518,247481', '4547237716782743755943866989.8356560705677241346146759866583370949', '863202');
|
||||
t('58400904696,8737', '6684320.09797413893379904985072385250774250364224704531308514779353223', '14426');
|
||||
t('4765998700799,481932', '9889359.28886025414277', '551989');
|
||||
t('84446319074008288318841993796319916,1', '84446319074008288318841993796319916.4290214679797552828327089099139280188', '1');
|
||||
t('208579935771852505416338,29', '7192411578339741566080.621098672624218880520368888346887640903578755437931806539999680994582938', '38');
|
||||
t('1006862373895650813218257996159822111779222738385202718573234201031,335', '3005559325061644218561964167641260035161858920552843936039505077.70447752609278095294701366298104650604976387611568135143174113323780682', '7063');
|
||||
t('12180512204,290477', '41932.7940043445804168810482554121918927813650259', '895566');
|
||||
t('972851014381591,18170', '53541607836.080957621939096312239677792878740188648258030024875', '31555');
|
||||
t('383576424003665,59', '6501295322096.01707059843465672720153308', '88');
|
||||
t('456059695649,731697', '623290.372447884850674344473049816049238992052574671', '770999');
|
||||
t('1,2', '0.5716202415873544262986953173753852278285193332218646822626651', '2');
|
||||
t('13802410789886736953383903846755867001633124596437299605748175709981308048573814,2523', '5470634478750193005701111314607953627282253109963257869896225013864965536493.782798186996737913044082377221550214034629772236938011947896897722075720890727218714', '2580');
|
||||
t('1720546690653497270570006270472130851,1', '1720546690653497270570006270472130851.14006845543964920673232647491053082791301585407937041734157349507526701334664232654756777642845206', '1');
|
||||
t('275492732803212658371830121443811803,6273', '43917221872024973437243762385431.5005579559793624838126175850466341579997661657132448932942532299', '11453');
|
||||
t('88013352536654826423613115136850148349568967,93', '946380134802740069071108764912367186554505.02139414761736578247940104106009403877307019264568966335689948628094', '100');
|
||||
t('0,1', '0.16188799510329961', '2');
|
||||
t('31257777609885493076027897164441747647216000811363789460,63', '496155200156912588508379320070503930908190489069266499.364683462978985476107209780379101750930177884309470340386147403736530', '73');
|
||||
t('30396,38195', '0.79581097', '74409');
|
||||
t('2125057574,3289', '646110.5424140842277760913716223149175043516912866283522989430448583852673477181054', '4314');
|
||||
t('18251,16', '1140.688086121119279582816178812726653910', '37');
|
||||
t('61348765027081784476232889631422618917241085602257,2', '30674382513540892238116444815711309458620542801128.559859020834676491532682063017825303001913079937413732204504474950978211332225018371420', '2');
|
||||
t('238354711696434965227174225040046402291933791409568617910,25981', '9174193129457486826033417691391647830796882006449660.0558100148468970808679278895365813792370050009058167954469', '61710');
|
||||
t('7355967799241738309628763754835483150582416687842544374137,8', '919495974905217288703595469354435393822802085980318046767.1338999658963927824509929378965804777221331548975659545056488845295998946309871474144010438', '9');
|
||||
t('1125354937387110207464744146511518,247481', '4547237716782743755943866989.8356560705677241346146759866583370949', '863202');
|
||||
t('58400904696,8737', '6684320.09797413893379904985072385250774250364224704531308514779353223', '14426');
|
||||
t('4765998700799,481932', '9889359.28886025414277', '551989');
|
||||
t('84446319074008288318841993796319916,1', '84446319074008288318841993796319916.4290214679797552828327089099139280188', '1');
|
||||
t('208579935771852505416338,29', '7192411578339741566080.621098672624218880520368888346887640903578755437931806539999680994582938', '38');
|
||||
t('1006862373895650813218257996159822111779222738385202718573234201031,335', '3005559325061644218561964167641260035161858920552843936039505077.70447752609278095294701366298104650604976387611568135143174113323780682', '7063');
|
||||
t('12180512204,290477', '41932.7940043445804168810482554121918927813650259', '895566');
|
||||
t('972851014381591,18170', '53541607836.080957621939096312239677792878740188648258030024875', '31555');
|
||||
t('383576424003665,59', '6501295322096.01707059843465672720153308', '88');
|
||||
t('456059695649,731697', '623290.372447884850674344473049816049238992052574671', '770999');
|
||||
t('1,2', '0.5716202415873544262986953173753852278285193332218646822626651', '2');
|
||||
t('13802410789886736953383903846755867001633124596437299605748175709981308048573814,2523', '5470634478750193005701111314607953627282253109963257869896225013864965536493.782798186996737913044082377221550214034629772236938011947896897722075720890727218714', '2580');
|
||||
t('1720546690653497270570006270472130851,1', '1720546690653497270570006270472130851.14006845543964920673232647491053082791301585407937041734157349507526701334664232654756777642845206', '1');
|
||||
t('275492732803212658371830121443811803,6273', '43917221872024973437243762385431.5005579559793624838126175850466341579997661657132448932942532299', '11453');
|
||||
t('88013352536654826423613115136850148349568967,93', '946380134802740069071108764912367186554505.02139414761736578247940104106009403877307019264568966335689948628094', '100');
|
||||
t('0,1', '0.16188799510329961', '2');
|
||||
t('31257777609885493076027897164441747647216000811363789460,63', '496155200156912588508379320070503930908190489069266499.364683462978985476107209780379101750930177884309470340386147403736530', '73');
|
||||
|
||||
t('-2991910323532143367251432461,50000000', '-59838206470642867345.02864922');
|
||||
t('-972745200863972039012044288500000000000000000000000000000,1', '-9.727452008639720390120442885E+56');
|
||||
t('-759,100', '-7.59');
|
||||
t('-27827258151452494934863201,100', '-278272581514524949348632.0100');
|
||||
t('-284626800809,50000000', '-5692.53601618');
|
||||
t('-74421663208247269188483431,80000000000000000', '-930270790.1030908648560428875');
|
||||
t('-1082016448333999416859837516000,1', '-1.082016448333999416859837516E+30');
|
||||
t('-21,25', '-0.84');
|
||||
t('-67246554173689300336047211,8000000', '-8405819271711162542.005901375');
|
||||
t('-2196812392790282979771359770000000000000,1', '-2.196812392790282979771359770E+39');
|
||||
t('-93367638440645772883402889310000,1', '-9.336763844064577288340288931E+31');
|
||||
t('-35989199713272470893896397640000000000,1', '-3.598919971327247089389639764E+37');
|
||||
t('-21641213684333939876179569040,1', '-2.164121368433393987617956904E+28');
|
||||
t('-91309127692139566014327039220000000000000000000000000000000000000,1', '-9.130912769213956601432703922E+64');
|
||||
t('-1991444477322661912100056959,50000000000', '-39828889546453238.24200113918');
|
||||
t('-553515865616749148505592781,10000000000000000000000000', '-55.35158656167491485055927810');
|
||||
t('-2736653830100392487693621031,500000', '-5473307660200784975387.242062');
|
||||
t('-1434910778309587281399577109,5000000000', '-286982155661917456.2799154218');
|
||||
t('-2991910323532143367251432461,50000000', '-59838206470642867345.02864922');
|
||||
t('-972745200863972039012044288500000000000000000000000000000,1', '-9.727452008639720390120442885E+56');
|
||||
t('-759,100', '-7.59');
|
||||
t('-27827258151452494934863201,100', '-278272581514524949348632.0100');
|
||||
t('-284626800809,50000000', '-5692.53601618');
|
||||
t('-74421663208247269188483431,80000000000000000', '-930270790.1030908648560428875');
|
||||
t('-1082016448333999416859837516000,1', '-1.082016448333999416859837516E+30');
|
||||
t('-21,25', '-0.84');
|
||||
t('-67246554173689300336047211,8000000', '-8405819271711162542.005901375');
|
||||
t('-2196812392790282979771359770000000000000,1', '-2.196812392790282979771359770E+39');
|
||||
t('-93367638440645772883402889310000,1', '-9.336763844064577288340288931E+31');
|
||||
t('-35989199713272470893896397640000000000,1', '-3.598919971327247089389639764E+37');
|
||||
t('-21641213684333939876179569040,1', '-2.164121368433393987617956904E+28');
|
||||
t('-91309127692139566014327039220000000000000000000000000000000000000,1', '-9.130912769213956601432703922E+64');
|
||||
t('-1991444477322661912100056959,50000000000', '-39828889546453238.24200113918');
|
||||
t('-553515865616749148505592781,10000000000000000000000000', '-55.35158656167491485055927810');
|
||||
t('-2736653830100392487693621031,500000', '-5473307660200784975387.242062');
|
||||
t('-1434910778309587281399577109,5000000000', '-286982155661917456.2799154218');
|
||||
|
||||
t('7325643,10000000', '0.7325643');
|
||||
t('8129753468709152191211051855224273832281,100000000000000000000000', '81297534687091521.91211051855224273832281');
|
||||
t('26846080372036394639591396,6672793', '4023214922452471497.25630571786057289667012386513324609', '72150416');
|
||||
t('151169465630612379481675652813336817561189321,200000000000000000000000000000000000000', '755847.328153061897408378264066684087805946605');
|
||||
t('48650152878444478499756261104359,1000000', '48650152878444478499756261.104359');
|
||||
t('310291026486294288245548,3136069', '98942665638509321.1423434879780971949357099446690852', '4194429');
|
||||
t('281148949800335203180214,28247', '9953232194581201656.11264913171363754779711915', '40003');
|
||||
t('8070991737,10', '807099173.7');
|
||||
t('2105837647496797835243555428994974365746550495259,2500000000000000000000000', '842335058998719134097422.1715979897462986201981036');
|
||||
t('7050549406715449007260719040610995681,100000000000000000000', '70505494067154490.07260719040610995681');
|
||||
t('1485521639981158765714509531187624755829128849,100000000000000000000000', '14855216399811587657145.09531187624755829128849');
|
||||
t('179195624045698698709602380291841534992963,397', '451374367873296470301265441541162556657.33752912', '654');
|
||||
t('60786881043136,81', '750455321520.1975303545477874468301224681956212', '6955');
|
||||
t('54350058946186575767248586,111', '489640170686365547452689.9639497075875189553277274425649764720088', '136');
|
||||
t('207448313353211937938706154109749,2500000000000000000000000', '82979325.34128477517548246164389960');
|
||||
t('18637328030895697373,20000000000', '931866401.54478486865');
|
||||
t('77127230808472816894238711,10000000000000000', '7712723080.8472816894238711');
|
||||
t('29126173556928305215214880165709856062,7', '4160881936704043602173554309387122294.5709328', '7');
|
||||
t('43333053556734019842,614489', '70518843391393.531604308619475952242596538499476346', '675048');
|
||||
t('53377793855957,559250504', '95445.231562915140439462747444833608100863907', '1363996915');
|
||||
t('347448038601,1158528605', '299.9045833667611513140004251012084', '3206002475');
|
||||
t('7325643,10000000', '0.7325643');
|
||||
t('8129753468709152191211051855224273832281,100000000000000000000000', '81297534687091521.91211051855224273832281');
|
||||
t('26846080372036394639591396,6672793', '4023214922452471497.25630571786057289667012386513324609', '72150416');
|
||||
t('151169465630612379481675652813336817561189321,200000000000000000000000000000000000000', '755847.328153061897408378264066684087805946605');
|
||||
t('48650152878444478499756261104359,1000000', '48650152878444478499756261.104359');
|
||||
t('310291026486294288245548,3136069', '98942665638509321.1423434879780971949357099446690852', '4194429');
|
||||
t('281148949800335203180214,28247', '9953232194581201656.11264913171363754779711915', '40003');
|
||||
t('8070991737,10', '807099173.7');
|
||||
t('2105837647496797835243555428994974365746550495259,2500000000000000000000000', '842335058998719134097422.1715979897462986201981036');
|
||||
t('7050549406715449007260719040610995681,100000000000000000000', '70505494067154490.07260719040610995681');
|
||||
t('1485521639981158765714509531187624755829128849,100000000000000000000000', '14855216399811587657145.09531187624755829128849');
|
||||
t('179195624045698698709602380291841534992963,397', '451374367873296470301265441541162556657.33752912', '654');
|
||||
t('60786881043136,81', '750455321520.1975303545477874468301224681956212', '6955');
|
||||
t('54350058946186575767248586,111', '489640170686365547452689.9639497075875189553277274425649764720088', '136');
|
||||
t('207448313353211937938706154109749,2500000000000000000000000', '82979325.34128477517548246164389960');
|
||||
t('18637328030895697373,20000000000', '931866401.54478486865');
|
||||
t('77127230808472816894238711,10000000000000000', '7712723080.8472816894238711');
|
||||
t('29126173556928305215214880165709856062,7', '4160881936704043602173554309387122294.5709328', '7');
|
||||
t('43333053556734019842,614489', '70518843391393.531604308619475952242596538499476346', '675048');
|
||||
t('53377793855957,559250504', '95445.231562915140439462747444833608100863907', '1363996915');
|
||||
t('347448038601,1158528605', '299.9045833667611513140004251012084', '3206002475');
|
||||
|
||||
t('4723559025392992686163722415183139,100000000000000000000', '47235590253929.92686163722415183139');
|
||||
t('178091379773085237300450763077988415217238,1811184275', '98328691470714782625004163686209.3533896422549273776361277', '1811232885');
|
||||
t('805514724831305204420874185699445105715750883,100000000000000', '8055147248313052044208741856994.45105715750883');
|
||||
t('65819,6849', '9.610016056348', '8529');
|
||||
t('319168767950612554460346534967,625000000000000', '510670028720980.0871365544559472');
|
||||
t('5710296907,88986', '64170.7336772078034895641687140263', '92775');
|
||||
t('556588363946502498333308725135986051213680185539426551525214239244852201,500000000000000000000000000000000000000', '1113176727893004996666617450271972.102427360371078853103050428478489704402');
|
||||
t('20826873980146981695459788919411033,31250000', '666459967364703414254713245.421153056');
|
||||
t('2499361049528080561202511540068978284974386343138634241,1000000000000000000000000000000000000', '2499361049528080561.202511540068978284974386343138634241');
|
||||
t('418298807255269058527019236340986131039447727889611856636829077,50000000000000000000000000000000000', '8365976145105381170540384726.81972262078895455779223713273658154');
|
||||
t('6913324275323537689724784638569909,100000000000000', '69133242753235376897.24784638569909');
|
||||
t('13962383460375585294405129665013837633,2000', '6981191730187792647202564832506918.8165');
|
||||
t('4723559025392992686163722415183139,100000000000000000000', '47235590253929.92686163722415183139');
|
||||
t('178091379773085237300450763077988415217238,1811184275', '98328691470714782625004163686209.3533896422549273776361277', '1811232885');
|
||||
t('805514724831305204420874185699445105715750883,100000000000000', '8055147248313052044208741856994.45105715750883');
|
||||
t('65819,6849', '9.610016056348', '8529');
|
||||
t('319168767950612554460346534967,625000000000000', '510670028720980.0871365544559472');
|
||||
t('5710296907,88986', '64170.7336772078034895641687140263', '92775');
|
||||
t('556588363946502498333308725135986051213680185539426551525214239244852201,500000000000000000000000000000000000000', '1113176727893004996666617450271972.102427360371078853103050428478489704402');
|
||||
t('20826873980146981695459788919411033,31250000', '666459967364703414254713245.421153056');
|
||||
t('2499361049528080561202511540068978284974386343138634241,1000000000000000000000000000000000000', '2499361049528080561.202511540068978284974386343138634241');
|
||||
t('418298807255269058527019236340986131039447727889611856636829077,50000000000000000000000000000000000', '8365976145105381170540384726.81972262078895455779223713273658154');
|
||||
t('6913324275323537689724784638569909,100000000000000', '69133242753235376897.24784638569909');
|
||||
t('13962383460375585294405129665013837633,2000', '6981191730187792647202564832506918.8165');
|
||||
|
||||
t('2469,20', '123.45');
|
||||
t('2469,20', '123.45', null);
|
||||
t('2469,20', '123.45', '2.1e1');
|
||||
t('1111,9', '123.45', new Decimal(10));
|
||||
t('2469,20', '123.45', new Decimal('123e399'));
|
||||
t('2469,20', '123.45', new Decimal('123'));
|
||||
t('2469,20', '123.45');
|
||||
t('2469,20', '123.45', null);
|
||||
t('2469,20', '123.45', '2.1e1');
|
||||
t('1111,9', '123.45', new Decimal(10));
|
||||
t('2469,20', '123.45', new Decimal('123e399'));
|
||||
t('2469,20', '123.45', new Decimal('123'));
|
||||
|
||||
tx(function () {new Decimal('123.45').toFraction('')}, ".toFraction('')");
|
||||
tx(function () {new Decimal('123.45').toFraction(' ')}, ".toFraction(' ')");
|
||||
tx(function () {new Decimal('123.45').toFraction('\t')}, ".toFraction('\t')");
|
||||
tx(function () {new Decimal('123.45').toFraction(NaN)}, ".toFraction(NaN)");
|
||||
tx(function () {new Decimal('123.45').toFraction('NaN')}, ".toFraction('NaN')");
|
||||
tx(function () {new Decimal('123.45').toFraction('hello')}, ".toFraction('hello')");
|
||||
tx(function () {new Decimal('123.45').toFraction([])}, ".toFraction([])");
|
||||
tx(function () {new Decimal('123.45').toFraction({})}, ".toFraction({})");
|
||||
tx(function () {new Decimal('123.45').toFraction(true)}, ".toFraction(true)");
|
||||
tx(function () {new Decimal('123.45').toFraction(false)}, ".toFraction(false)");
|
||||
tx(function () {new Decimal('123.45').toFraction(function (){})}, ".toFraction(function (){})");
|
||||
tx(function () {new Decimal('123.45').toFraction(new Number)}, ".toFraction(new Number)");
|
||||
tx(function () {new Decimal('123.45').toFraction(new String)}, ".toFraction(new String)");
|
||||
tx(function () {new Decimal('123.45').toFraction(new Date)},".toFraction(new Date)");
|
||||
tx(function () {new Decimal('123.45').toFraction(new RegExp)}, ".toFraction(new RegExp)");
|
||||
tx(function () {new Decimal('123.45').toFraction('')}, ".toFraction('')");
|
||||
tx(function () {new Decimal('123.45').toFraction(' ')}, ".toFraction(' ')");
|
||||
tx(function () {new Decimal('123.45').toFraction('\t')}, ".toFraction('\t')");
|
||||
tx(function () {new Decimal('123.45').toFraction(NaN)}, ".toFraction(NaN)");
|
||||
tx(function () {new Decimal('123.45').toFraction('NaN')}, ".toFraction('NaN')");
|
||||
tx(function () {new Decimal('123.45').toFraction('hello')}, ".toFraction('hello')");
|
||||
tx(function () {new Decimal('123.45').toFraction([])}, ".toFraction([])");
|
||||
tx(function () {new Decimal('123.45').toFraction({})}, ".toFraction({})");
|
||||
tx(function () {new Decimal('123.45').toFraction(true)}, ".toFraction(true)");
|
||||
tx(function () {new Decimal('123.45').toFraction(false)}, ".toFraction(false)");
|
||||
tx(function () {new Decimal('123.45').toFraction(function (){})}, ".toFraction(function (){})");
|
||||
tx(function () {new Decimal('123.45').toFraction(new Number)}, ".toFraction(new Number)");
|
||||
tx(function () {new Decimal('123.45').toFraction(new String)}, ".toFraction(new String)");
|
||||
tx(function () {new Decimal('123.45').toFraction(new Date)},".toFraction(new Date)");
|
||||
tx(function () {new Decimal('123.45').toFraction(new RegExp)}, ".toFraction(new RegExp)");
|
||||
|
||||
tx(function () {new Decimal('123.45').toFraction(7.5)}, ".toFraction(7.5)");
|
||||
tx(function () {new Decimal('123.45').toFraction(new Decimal('225.435435'))}, ".toFraction(new Decimal('225.435435'))");
|
||||
tx(function () {new Decimal('123.45').toFraction(0)}, ".toFraction(0)");
|
||||
tx(function () {new Decimal('123.45').toFraction('0.99')}, ".toFraction('0.99')");
|
||||
tx(function () {new Decimal('123.45').toFraction(-1)}, ".toFraction(-1)");
|
||||
tx(function () {new Decimal('123.45').toFraction(-23)}, ".toFraction(-23)");
|
||||
tx(function () {new Decimal('123.45').toFraction(Infinity)}, ".toFraction(Infinity)");
|
||||
tx(function () {new Decimal('123.45').toFraction('-Infinity')}, ".toFraction('-Infinity')");
|
||||
tx(function () {new Decimal('123.45').toFraction(7.5)}, ".toFraction(7.5)");
|
||||
tx(function () {new Decimal('123.45').toFraction(new Decimal('225.435435'))}, ".toFraction(new Decimal('225.435435'))");
|
||||
tx(function () {new Decimal('123.45').toFraction(0)}, ".toFraction(0)");
|
||||
tx(function () {new Decimal('123.45').toFraction('0.99')}, ".toFraction('0.99')");
|
||||
tx(function () {new Decimal('123.45').toFraction(-1)}, ".toFraction(-1)");
|
||||
tx(function () {new Decimal('123.45').toFraction(-23)}, ".toFraction(-23)");
|
||||
tx(function () {new Decimal('123.45').toFraction(Infinity)}, ".toFraction(Infinity)");
|
||||
tx(function () {new Decimal('123.45').toFraction('-Infinity')}, ".toFraction('-Infinity')");
|
||||
|
||||
T.stop();
|
||||
T.stop();
|
||||
})();
|
||||
|
@ -1,157 +1,157 @@
|
||||
if (typeof T === 'undefined') require('../setup');
|
||||
|
||||
(function () {
|
||||
T('toNearest');
|
||||
T('toNearest');
|
||||
|
||||
function isMinusZero(n) {
|
||||
return n.isZero() && n.isNegative();
|
||||
}
|
||||
function isMinusZero(n) {
|
||||
return n.isZero() && n.isNegative();
|
||||
}
|
||||
|
||||
Decimal.config({
|
||||
precision: 20,
|
||||
rounding: 4,
|
||||
toExpNeg: -9e15,
|
||||
toExpPos: 9e15,
|
||||
minE: -9e15,
|
||||
maxE: 9e15
|
||||
});
|
||||
Decimal.config({
|
||||
precision: 20,
|
||||
rounding: 4,
|
||||
toExpNeg: -9e15,
|
||||
toExpPos: 9e15,
|
||||
minE: -9e15,
|
||||
maxE: 9e15
|
||||
});
|
||||
|
||||
var t = function (actual) {
|
||||
T.assert(actual);
|
||||
}
|
||||
var t = function (actual) {
|
||||
T.assert(actual);
|
||||
}
|
||||
|
||||
t(!isMinusZero(new Decimal(0).toNearest(0)));
|
||||
t( isMinusZero(new Decimal(-1).toNearest(0)));
|
||||
t( isMinusZero(new Decimal(-0).toNearest(0)));
|
||||
t(!isMinusZero(new Decimal(1).toNearest(0)));
|
||||
t(!isMinusZero(new Decimal(1).toNearest(-0)));
|
||||
t(!isMinusZero(new Decimal(1).toNearest(-3)));
|
||||
t( isMinusZero(new Decimal(-1).toNearest(-3)));
|
||||
t(!isMinusZero(new Decimal(0).toNearest(0)));
|
||||
t( isMinusZero(new Decimal(-1).toNearest(0)));
|
||||
t( isMinusZero(new Decimal(-0).toNearest(0)));
|
||||
t(!isMinusZero(new Decimal(1).toNearest(0)));
|
||||
t(!isMinusZero(new Decimal(1).toNearest(-0)));
|
||||
t(!isMinusZero(new Decimal(1).toNearest(-3)));
|
||||
t( isMinusZero(new Decimal(-1).toNearest(-3)));
|
||||
|
||||
t = function (expected, n, v, sd, rm) {
|
||||
if (sd) Decimal.precision = sd;
|
||||
T.assertEqual(expected, new Decimal(n).toNearest(v, rm).valueOf());
|
||||
}
|
||||
t = function (expected, n, v, sd, rm) {
|
||||
if (sd) Decimal.precision = sd;
|
||||
T.assertEqual(expected, new Decimal(n).toNearest(v, rm).valueOf());
|
||||
}
|
||||
|
||||
t('Infinity', Infinity);
|
||||
t('-Infinity', -Infinity);
|
||||
t('NaN', NaN);
|
||||
t('NaN', NaN, NaN);
|
||||
t('NaN', NaN, Infinity);
|
||||
t('NaN', NaN, -Infinity);
|
||||
t('NaN', NaN, 0);
|
||||
t('NaN', NaN, -0);
|
||||
t('Infinity', Infinity);
|
||||
t('-Infinity', -Infinity);
|
||||
t('NaN', NaN);
|
||||
t('NaN', NaN, NaN);
|
||||
t('NaN', NaN, Infinity);
|
||||
t('NaN', NaN, -Infinity);
|
||||
t('NaN', NaN, 0);
|
||||
t('NaN', NaN, -0);
|
||||
|
||||
t('Infinity', '9.999e+9000000000000000', '1e+9000000000000001');
|
||||
t('Infinity', '9.999e+9000000000000000', '-1e+9000000000000001');
|
||||
t('-Infinity', '-9.999e+9000000000000000', '1e+9000000000000001');
|
||||
t('-Infinity', '-9.999e+9000000000000000', '-1e+9000000000000001');
|
||||
t('9.999e+9000000000000000', '9.999e+9000000000000000');
|
||||
t('-9.999e+9000000000000000', '-9.999e+9000000000000000');
|
||||
t('Infinity', '9.999e+9000000000000000', '1e+9000000000000001');
|
||||
t('Infinity', '9.999e+9000000000000000', '-1e+9000000000000001');
|
||||
t('-Infinity', '-9.999e+9000000000000000', '1e+9000000000000001');
|
||||
t('-Infinity', '-9.999e+9000000000000000', '-1e+9000000000000001');
|
||||
t('9.999e+9000000000000000', '9.999e+9000000000000000');
|
||||
t('-9.999e+9000000000000000', '-9.999e+9000000000000000');
|
||||
|
||||
t('NaN', 123.456, NaN);
|
||||
t('Infinity', 123.456, Infinity);
|
||||
t('Infinity', 123.456, -Infinity);
|
||||
t('0', 123.456, 0);
|
||||
t('0', 123.456, '-0');
|
||||
t('NaN', 123.456, NaN);
|
||||
t('Infinity', 123.456, Infinity);
|
||||
t('Infinity', 123.456, -Infinity);
|
||||
t('0', 123.456, 0);
|
||||
t('0', 123.456, '-0');
|
||||
|
||||
t('NaN', -123.456, NaN);
|
||||
t('-Infinity', -123.456, Infinity);
|
||||
t('-Infinity', -123.456, -Infinity);
|
||||
t('-0', -123.456, '-0');
|
||||
t('NaN', -123.456, NaN);
|
||||
t('-Infinity', -123.456, Infinity);
|
||||
t('-Infinity', -123.456, -Infinity);
|
||||
t('-0', -123.456, '-0');
|
||||
|
||||
t('0', 0, 0);
|
||||
t('Infinity', 0, Infinity);
|
||||
t('Infinity', 0, -Infinity);
|
||||
t('-Infinity', -0, Infinity);
|
||||
t('-Infinity', -0, -Infinity);
|
||||
t('0', 0, 0);
|
||||
t('Infinity', 0, Infinity);
|
||||
t('Infinity', 0, -Infinity);
|
||||
t('-Infinity', -0, Infinity);
|
||||
t('-Infinity', -0, -Infinity);
|
||||
|
||||
t('0', 1, -3);
|
||||
t('-0', -1, -3);
|
||||
t('3', 1.5, -3, 20, 0);
|
||||
t('-0', -1.5, -3, 20, 1);
|
||||
t('-3', -1.5, -3, 20, 2);
|
||||
t('0', 1, -3);
|
||||
t('-0', -1, -3);
|
||||
t('3', 1.5, -3, 20, 0);
|
||||
t('-0', -1.5, -3, 20, 1);
|
||||
t('-3', -1.5, -3, 20, 2);
|
||||
|
||||
t('123', 123.456);
|
||||
t('123', 123.456, 1);
|
||||
t('123.5', 123.456, 0.1);
|
||||
t('123.46', 123.456, 0.01);
|
||||
t('123.456', 123.456, 0.001);
|
||||
t('123', 123.456);
|
||||
t('123', 123.456, 1);
|
||||
t('123.5', 123.456, 0.1);
|
||||
t('123.46', 123.456, 0.01);
|
||||
t('123.456', 123.456, 0.001);
|
||||
|
||||
t('123', 123.456, -1);
|
||||
t('123.5', 123.456, -0.1);
|
||||
t('123.46', 123.456, -0.01);
|
||||
t('123.456', 123.456, -0.001);
|
||||
t('123', 123.456, -1);
|
||||
t('123.5', 123.456, -0.1);
|
||||
t('123.46', 123.456, -0.01);
|
||||
t('123.456', 123.456, -0.001);
|
||||
|
||||
t('124', 123.456, '-2');
|
||||
t('123.4', 123.456, '-0.2');
|
||||
t('123.46', 123.456, '-0.02');
|
||||
t('123.456', 123.456, '-0.002');
|
||||
t('124', 123.456, '-2');
|
||||
t('123.4', 123.456, '-0.2');
|
||||
t('123.46', 123.456, '-0.02');
|
||||
t('123.456', 123.456, '-0.002');
|
||||
|
||||
t('83105511540', '83105511539.5', 1, 11, 4);
|
||||
t('83105511539', '83105511539.499999999999999999999999999999', 1, 11, 4);
|
||||
t('83105511539', '83105511539.5', '1', 11, 5);
|
||||
t('83105511540', '83105511539.5000000000000000000001', 1, 11, 5);
|
||||
t('83105511540', '83105511539.5', 1, 11, 4);
|
||||
t('83105511539', '83105511539.499999999999999999999999999999', 1, 11, 4);
|
||||
t('83105511539', '83105511539.5', '1', 11, 5);
|
||||
t('83105511540', '83105511539.5000000000000000000001', 1, 11, 5);
|
||||
|
||||
t('83105511540', '83105511539.5', new Decimal(1), 3, 4);
|
||||
t('83105511539', '83105511539.499999999999999999999999999999', 1, 3, 4);
|
||||
t('83105511539', '83105511539.5', new Decimal('1'), 3, 5);
|
||||
t('83105511540', '83105511539.5000000000000000000001', 1, 3, 5);
|
||||
t('83105511540', '83105511539.5', new Decimal(1), 3, 4);
|
||||
t('83105511539', '83105511539.499999999999999999999999999999', 1, 3, 4);
|
||||
t('83105511539', '83105511539.5', new Decimal('1'), 3, 5);
|
||||
t('83105511540', '83105511539.5000000000000000000001', 1, 3, 5);
|
||||
|
||||
t('83105511540', '83105511539.5', Decimal.ONE, 30, 4);
|
||||
t('83105511539', '83105511539.499999999999999999999999999999', 1, 30, 4);
|
||||
t('83105511539', '83105511539.5', 1, 30, 5);
|
||||
t('83105511540', '83105511539.5000000000000000000001', 1, 30, 5);
|
||||
t('83105511540', '83105511539.5', Decimal.ONE, 30, 4);
|
||||
t('83105511539', '83105511539.499999999999999999999999999999', 1, 30, 4);
|
||||
t('83105511539', '83105511539.5', 1, 30, 5);
|
||||
t('83105511540', '83105511539.5000000000000000000001', 1, 30, 5);
|
||||
|
||||
t('83105511540', '83105511539.5', -1, 11, 4);
|
||||
t('83105511539', '83105511539.499999999999999999999999999999', -1, 11, 4);
|
||||
t('83105511539', '83105511539.5', '-1', 11, 5);
|
||||
t('83105511540', '83105511539.5000000000000000000001', -1, 11, 5);
|
||||
t('83105511540', '83105511539.5', -1, 11, 4);
|
||||
t('83105511539', '83105511539.499999999999999999999999999999', -1, 11, 4);
|
||||
t('83105511539', '83105511539.5', '-1', 11, 5);
|
||||
t('83105511540', '83105511539.5000000000000000000001', -1, 11, 5);
|
||||
|
||||
t('83105511540', '83105511539.5', new Decimal(-1), 3, 4);
|
||||
t('83105511539', '83105511539.499999999999999999999999999999', 1, 3, 4);
|
||||
t('83105511539', '83105511539.5', new Decimal('-1'), 3, 5);
|
||||
t('83105511540', '83105511539.5000000000000000000001', -1, 3, 5);
|
||||
t('83105511540', '83105511539.5', new Decimal(-1), 3, 4);
|
||||
t('83105511539', '83105511539.499999999999999999999999999999', 1, 3, 4);
|
||||
t('83105511539', '83105511539.5', new Decimal('-1'), 3, 5);
|
||||
t('83105511540', '83105511539.5000000000000000000001', -1, 3, 5);
|
||||
|
||||
t('83105511540', '83105511539.5', 1, 30, 0);
|
||||
t('83105511539', '83105511539.5', 1, 30, 1);
|
||||
t('83105511540', '83105511539.5', 1, 30, 2);
|
||||
t('83105511539', '83105511539.5', 1, 30, 3);
|
||||
t('83105511540', '83105511539.5', 1, 30, 4);
|
||||
t('83105511539', '83105511539.5', 1, 30, 5);
|
||||
t('83105511540', '83105511539.5', 1, 30, 6);
|
||||
t('83105511540', '83105511539.5', 1, 30, 7);
|
||||
t('83105511539', '83105511539.5', 1, 30, 8);
|
||||
t('83105511539', '83105511539.499999999999999999999999999999', void 0, 30, 0);
|
||||
t('83105511539', '83105511539.499999999999999999999999999999', 1, 30, 1);
|
||||
t('83105511539', '83105511539.499999999999999999999999999999', void 0, 30, 2);
|
||||
t('83105511539', '83105511539.499999999999999999999999999999', 1, 30, 3);
|
||||
t('83105511539', '83105511539.499999999999999999999999999999', void 0, 30, 4);
|
||||
t('83105511539', '83105511539.499999999999999999999999999999', 1, 30, 5);
|
||||
t('83105511539', '83105511539.499999999999999999999999999999', void 0, 30, 6);
|
||||
t('83105511539', '83105511539.499999999999999999999999999999', 1, 30, 7);
|
||||
t('83105511539', '83105511539.499999999999999999999999999999', void 0, 30, 8);
|
||||
t('83105511540', '83105511539.5000000000000000000001', void 0, 30, 0);
|
||||
t('83105511540', '83105511539.5000000000000000000001', 1, 30, 1);
|
||||
t('83105511540', '83105511539.5000000000000000000001', void 0, 30, 2);
|
||||
t('83105511540', '83105511539.5000000000000000000001', 1, 30, 3);
|
||||
t('83105511540', '83105511539.5000000000000000000001', void 0, 30, 4);
|
||||
t('83105511540', '83105511539.5000000000000000000001', 1, 30, 5);
|
||||
t('83105511540', '83105511539.5000000000000000000001', void 0, 30, 6);
|
||||
t('83105511540', '83105511539.5000000000000000000001', 1, 30, 7);
|
||||
t('83105511540', '83105511539.5000000000000000000001', void 0, 30, 8);
|
||||
t('83105511540', '83105511539.5', 1, 30, 0);
|
||||
t('83105511539', '83105511539.5', 1, 30, 1);
|
||||
t('83105511540', '83105511539.5', 1, 30, 2);
|
||||
t('83105511539', '83105511539.5', 1, 30, 3);
|
||||
t('83105511540', '83105511539.5', 1, 30, 4);
|
||||
t('83105511539', '83105511539.5', 1, 30, 5);
|
||||
t('83105511540', '83105511539.5', 1, 30, 6);
|
||||
t('83105511540', '83105511539.5', 1, 30, 7);
|
||||
t('83105511539', '83105511539.5', 1, 30, 8);
|
||||
t('83105511539', '83105511539.499999999999999999999999999999', void 0, 30, 0);
|
||||
t('83105511539', '83105511539.499999999999999999999999999999', 1, 30, 1);
|
||||
t('83105511539', '83105511539.499999999999999999999999999999', void 0, 30, 2);
|
||||
t('83105511539', '83105511539.499999999999999999999999999999', 1, 30, 3);
|
||||
t('83105511539', '83105511539.499999999999999999999999999999', void 0, 30, 4);
|
||||
t('83105511539', '83105511539.499999999999999999999999999999', 1, 30, 5);
|
||||
t('83105511539', '83105511539.499999999999999999999999999999', void 0, 30, 6);
|
||||
t('83105511539', '83105511539.499999999999999999999999999999', 1, 30, 7);
|
||||
t('83105511539', '83105511539.499999999999999999999999999999', void 0, 30, 8);
|
||||
t('83105511540', '83105511539.5000000000000000000001', void 0, 30, 0);
|
||||
t('83105511540', '83105511539.5000000000000000000001', 1, 30, 1);
|
||||
t('83105511540', '83105511539.5000000000000000000001', void 0, 30, 2);
|
||||
t('83105511540', '83105511539.5000000000000000000001', 1, 30, 3);
|
||||
t('83105511540', '83105511539.5000000000000000000001', void 0, 30, 4);
|
||||
t('83105511540', '83105511539.5000000000000000000001', 1, 30, 5);
|
||||
t('83105511540', '83105511539.5000000000000000000001', void 0, 30, 6);
|
||||
t('83105511540', '83105511539.5000000000000000000001', 1, 30, 7);
|
||||
t('83105511540', '83105511539.5000000000000000000001', void 0, 30, 8);
|
||||
|
||||
Decimal.rounding = 0;
|
||||
t('83105511540', '83105511539.5', void 0, 11);
|
||||
Decimal.rounding = 0;
|
||||
t('83105511540', '83105511539.5', void 0, 11);
|
||||
|
||||
Decimal.rounding = 1;
|
||||
t('83105511539', '83105511539.5', void 0, 11);
|
||||
Decimal.rounding = 1;
|
||||
t('83105511539', '83105511539.5', void 0, 11);
|
||||
|
||||
t('3847560', '3847561.00000749', 10, 11, 0);
|
||||
t('42840000000000000', '42835000000000001', '1e+13', 2, 0);
|
||||
t('42840000000000000', '42835000000000001', '1e+13', 2, 1);
|
||||
t('42840000000000000', '42835000000000000.0002', '1e+13', 200, 0);
|
||||
t('42840000000000000', '42835000000000000.0002', '1e+13', 200, 1);
|
||||
t('3847560', '3847561.00000749', 10, 11, 0);
|
||||
t('42840000000000000', '42835000000000001', '1e+13', 2, 0);
|
||||
t('42840000000000000', '42835000000000001', '1e+13', 2, 1);
|
||||
t('42840000000000000', '42835000000000000.0002', '1e+13', 200, 0);
|
||||
t('42840000000000000', '42835000000000000.0002', '1e+13', 200, 1);
|
||||
|
||||
T.stop();
|
||||
T.stop();
|
||||
})();
|
||||
|
@ -1,80 +1,80 @@
|
||||
if (typeof T === 'undefined') require('../setup');
|
||||
|
||||
(function () {
|
||||
T('toNumber');
|
||||
T('toNumber');
|
||||
|
||||
Decimal.config({
|
||||
precision: 20,
|
||||
rounding: 4,
|
||||
toExpNeg: -7,
|
||||
toExpPos: 21,
|
||||
minE: -9e15,
|
||||
maxE: 9e15
|
||||
});
|
||||
Decimal.config({
|
||||
precision: 20,
|
||||
rounding: 4,
|
||||
toExpNeg: -7,
|
||||
toExpPos: 21,
|
||||
minE: -9e15,
|
||||
maxE: 9e15
|
||||
});
|
||||
|
||||
// Positive zero
|
||||
var t = function (n) {
|
||||
T.assert(1 / new Decimal(n).toNumber() === Infinity);
|
||||
}
|
||||
// Positive zero
|
||||
var t = function (n) {
|
||||
T.assert(1 / new Decimal(n).toNumber() === Infinity);
|
||||
}
|
||||
|
||||
t('0');
|
||||
t('0.0');
|
||||
t('0.000000000000');
|
||||
t('0e+0');
|
||||
t('0e-0');
|
||||
t('1e-9000000000000000')
|
||||
t('0');
|
||||
t('0.0');
|
||||
t('0.000000000000');
|
||||
t('0e+0');
|
||||
t('0e-0');
|
||||
t('1e-9000000000000000')
|
||||
|
||||
// Negative zero
|
||||
t = function (n) {
|
||||
T.assert(1 / new Decimal(n).toNumber() === -Infinity);
|
||||
}
|
||||
// Negative zero
|
||||
t = function (n) {
|
||||
T.assert(1 / new Decimal(n).toNumber() === -Infinity);
|
||||
}
|
||||
|
||||
t('-0');
|
||||
t('-0.0');
|
||||
t('-0.000000000000');
|
||||
t('-0e+0');
|
||||
t('-0e-0');
|
||||
t('-1e-9000000000000000')
|
||||
t('-0');
|
||||
t('-0.0');
|
||||
t('-0.000000000000');
|
||||
t('-0e+0');
|
||||
t('-0e-0');
|
||||
t('-1e-9000000000000000')
|
||||
|
||||
t = function (n, expected) {
|
||||
T.assertEqual(expected, new Decimal(n).toNumber());
|
||||
}
|
||||
t = function (n, expected) {
|
||||
T.assertEqual(expected, new Decimal(n).toNumber());
|
||||
}
|
||||
|
||||
t(Infinity, 1 / 0);
|
||||
t('Infinity', 1 / 0);
|
||||
t(-Infinity, -1 / 0);
|
||||
t('-Infinity', -1 / 0);
|
||||
t(NaN, NaN);
|
||||
t('NaN', NaN);
|
||||
t(Infinity, 1 / 0);
|
||||
t('Infinity', 1 / 0);
|
||||
t(-Infinity, -1 / 0);
|
||||
t('-Infinity', -1 / 0);
|
||||
t(NaN, NaN);
|
||||
t('NaN', NaN);
|
||||
|
||||
t(1, 1);
|
||||
t('1', 1);
|
||||
t('1.0', 1);
|
||||
t('1e+0', 1);
|
||||
t('1e-0', 1);
|
||||
t(1, 1);
|
||||
t('1', 1);
|
||||
t('1.0', 1);
|
||||
t('1e+0', 1);
|
||||
t('1e-0', 1);
|
||||
|
||||
t(-1, -1);
|
||||
t('-1', -1);
|
||||
t('-1.0', -1);
|
||||
t('-1e+0', -1);
|
||||
t('-1e-0', -1);
|
||||
t(-1, -1);
|
||||
t('-1', -1);
|
||||
t('-1.0', -1);
|
||||
t('-1e+0', -1);
|
||||
t('-1e-0', -1);
|
||||
|
||||
t('123.456789876543', 123.456789876543);
|
||||
t('-123.456789876543', -123.456789876543);
|
||||
t('123.456789876543', 123.456789876543);
|
||||
t('-123.456789876543', -123.456789876543);
|
||||
|
||||
t('1.1102230246251565e-16', 1.1102230246251565e-16);
|
||||
t('-1.1102230246251565e-16', -1.1102230246251565e-16);
|
||||
t('1.1102230246251565e-16', 1.1102230246251565e-16);
|
||||
t('-1.1102230246251565e-16', -1.1102230246251565e-16);
|
||||
|
||||
t('9007199254740991', 9007199254740991);
|
||||
t('-9007199254740991', -9007199254740991);
|
||||
t('9007199254740991', 9007199254740991);
|
||||
t('-9007199254740991', -9007199254740991);
|
||||
|
||||
t('5e-324', 5e-324);
|
||||
t('1.7976931348623157e+308', 1.7976931348623157e+308);
|
||||
t('5e-324', 5e-324);
|
||||
t('1.7976931348623157e+308', 1.7976931348623157e+308);
|
||||
|
||||
t('9.999999e+9000000000000000', 1 / 0);
|
||||
t('-9.999999e+9000000000000000', -1 / 0);
|
||||
t('1e-9000000000000000', 0);
|
||||
t('-1e-9000000000000000', -0);
|
||||
t('9.999999e+9000000000000000', 1 / 0);
|
||||
t('-9.999999e+9000000000000000', -1 / 0);
|
||||
t('1e-9000000000000000', 0);
|
||||
t('-1e-9000000000000000', -0);
|
||||
|
||||
T.stop();
|
||||
T.stop();
|
||||
})();
|
||||
|
File diff suppressed because it is too large
Load Diff
1056
test/modules/toSD.js
1056
test/modules/toSD.js
File diff suppressed because it is too large
Load Diff
@ -1,365 +1,365 @@
|
||||
if (typeof T === 'undefined') require('../setup');
|
||||
|
||||
(function () {
|
||||
T('toString');
|
||||
T('toString');
|
||||
|
||||
function t(expected, n) {
|
||||
T.assertEqual(expected, new Decimal(n).toString());
|
||||
}
|
||||
function t(expected, n) {
|
||||
T.assertEqual(expected, new Decimal(n).toString());
|
||||
}
|
||||
|
||||
Decimal.config({
|
||||
precision: 20,
|
||||
rounding: 4,
|
||||
toExpNeg: -9e15,
|
||||
toExpPos: 9e15,
|
||||
minE: -9e15,
|
||||
maxE: 9e15
|
||||
});
|
||||
Decimal.config({
|
||||
precision: 20,
|
||||
rounding: 4,
|
||||
toExpNeg: -9e15,
|
||||
toExpPos: 9e15,
|
||||
minE: -9e15,
|
||||
maxE: 9e15
|
||||
});
|
||||
|
||||
t('0', 0);
|
||||
t('0', '0');
|
||||
t('NaN', NaN);
|
||||
t('NaN', 'NaN');
|
||||
t('Infinity', 1/0);
|
||||
t('Infinity', 'Infinity');
|
||||
t('1', 1);
|
||||
t('9', 9);
|
||||
t('90', 90);
|
||||
t('90.12', 90.12);
|
||||
t('0.1', 0.1);
|
||||
t('0.01', 0.01);
|
||||
t('0.0123', 0.0123);
|
||||
t('111111111111111111111', '111111111111111111111');
|
||||
t('1111111111111111111111', '1111111111111111111111');
|
||||
t('11111111111111111111111', '11111111111111111111111');
|
||||
t('0.00001', 0.00001);
|
||||
t('0.000001', 0.000001);
|
||||
t('0', 0);
|
||||
t('0', '0');
|
||||
t('NaN', NaN);
|
||||
t('NaN', 'NaN');
|
||||
t('Infinity', 1/0);
|
||||
t('Infinity', 'Infinity');
|
||||
t('1', 1);
|
||||
t('9', 9);
|
||||
t('90', 90);
|
||||
t('90.12', 90.12);
|
||||
t('0.1', 0.1);
|
||||
t('0.01', 0.01);
|
||||
t('0.0123', 0.0123);
|
||||
t('111111111111111111111', '111111111111111111111');
|
||||
t('1111111111111111111111', '1111111111111111111111');
|
||||
t('11111111111111111111111', '11111111111111111111111');
|
||||
t('0.00001', 0.00001);
|
||||
t('0.000001', 0.000001);
|
||||
|
||||
t('0', -0);
|
||||
t('0', '-0');
|
||||
t('-Infinity', -1/0);
|
||||
t('-Infinity', '-Infinity');
|
||||
t('-1', -1);
|
||||
t('-9', -9);
|
||||
t('-90', -90);
|
||||
t('-90.12', -90.12);
|
||||
t('-0.1', -0.1);
|
||||
t('-0.01', -0.01);
|
||||
t('-0.0123', -0.0123);
|
||||
t('-111111111111111111111', '-111111111111111111111');
|
||||
t('-1111111111111111111111', '-1111111111111111111111');
|
||||
t('-11111111111111111111111', '-11111111111111111111111');
|
||||
t('-0.00001', -0.00001);
|
||||
t('-0.000001', -0.000001);
|
||||
t('0', -0);
|
||||
t('0', '-0');
|
||||
t('-Infinity', -1/0);
|
||||
t('-Infinity', '-Infinity');
|
||||
t('-1', -1);
|
||||
t('-9', -9);
|
||||
t('-90', -90);
|
||||
t('-90.12', -90.12);
|
||||
t('-0.1', -0.1);
|
||||
t('-0.01', -0.01);
|
||||
t('-0.0123', -0.0123);
|
||||
t('-111111111111111111111', '-111111111111111111111');
|
||||
t('-1111111111111111111111', '-1111111111111111111111');
|
||||
t('-11111111111111111111111', '-11111111111111111111111');
|
||||
t('-0.00001', -0.00001);
|
||||
t('-0.000001', -0.000001);
|
||||
|
||||
// Exponential format
|
||||
Decimal.toExpNeg = Decimal.toExpPos = 0;
|
||||
// Exponential format
|
||||
Decimal.toExpNeg = Decimal.toExpPos = 0;
|
||||
|
||||
t('1e-7', 0.0000001);
|
||||
t('1.2e-7', 0.00000012);
|
||||
t('1.23e-7', 0.000000123);
|
||||
t('1e-8', 0.00000001);
|
||||
t('1.2e-8', 0.000000012);
|
||||
t('1.23e-8', 0.0000000123);
|
||||
t('-1e-7', -0.0000001);
|
||||
t('-1.2e-7', -0.00000012);
|
||||
t('-1.23e-7', -0.000000123);
|
||||
t('-1e-8', -0.00000001);
|
||||
t('-1.2e-8', -0.000000012);
|
||||
t('-1.23e-8', -0.0000000123);
|
||||
t('1e-7', 0.0000001);
|
||||
t('1.2e-7', 0.00000012);
|
||||
t('1.23e-7', 0.000000123);
|
||||
t('1e-8', 0.00000001);
|
||||
t('1.2e-8', 0.000000012);
|
||||
t('1.23e-8', 0.0000000123);
|
||||
t('-1e-7', -0.0000001);
|
||||
t('-1.2e-7', -0.00000012);
|
||||
t('-1.23e-7', -0.000000123);
|
||||
t('-1e-8', -0.00000001);
|
||||
t('-1.2e-8', -0.000000012);
|
||||
t('-1.23e-8', -0.0000000123);
|
||||
|
||||
t('5.73447902457635174479825134e+14', '573447902457635.174479825134');
|
||||
t('1.07688e+1', '10.7688');
|
||||
t('3.171194102379077141557759899307946350455841e+27', '3171194102379077141557759899.307946350455841');
|
||||
t('4.924353466898191177698653319742594890634579e+37', '49243534668981911776986533197425948906.34579');
|
||||
t('6.85558243926569397328633907445409866949445343654692955e+18', '6855582439265693973.28633907445409866949445343654692955');
|
||||
t('1e+0', '1');
|
||||
t('2.1320000803e+7', '21320000.803');
|
||||
t('5.0878741e+4', '50878.741');
|
||||
t('5.1932898288391e+8', '519328982.88391');
|
||||
t('5.690616778176956027307884725933410349604387915634524e+49', '56906167781769560273078847259334103496043879156345.24');
|
||||
t('3.25099780528575457273246693147645e+15', '3250997805285754.572732466931476450');
|
||||
t('3e+0', '3');
|
||||
t('2.5811494197573291905990947355226e+13', '25811494197573.291905990947355226');
|
||||
t('5.60372259169833930471746454125e+13', '56037225916983.3930471746454125');
|
||||
t('1.2615810663732236602461593613783e+7', '12615810.663732236602461593613783');
|
||||
t('1.4654366449266911507705477499035407722184965108377032e+11', '146543664492.66911507705477499035407722184965108377032');
|
||||
t('6.4986735507448912857131832908423940757e+38', '649867355074489128571318329084239407570.0');
|
||||
t('3.6146989180120676857245474944e+3', '3614.6989180120676857245474944');
|
||||
t('9.928654762302286149994896625074e+4', '99286.54762302286149994896625074');
|
||||
t('3.46424170787806074650506079e+3', '3464.24170787806074650506079');
|
||||
t('1.25934313355319666474752550204680303068865719647e+33', '1259343133553196664747525502046803.03068865719647');
|
||||
t('1.23014105337660651106978059198916100450966081493207e+27', '1230141053376606511069780591.98916100450966081493207');
|
||||
t('1.386164712267169624993434287237e+23', '138616471226716962499343.4287237');
|
||||
t('2.66076369930322488334961932e+3', '2660.76369930322488334961932');
|
||||
t('9.37582568e+4', '93758.2568');
|
||||
t('1.39853642894726883996875746770529e+28', '13985364289472688399687574677.0529');
|
||||
t('3.19099e+5', '319099.0');
|
||||
t('3.04557106798789396303998723e+19', '30455710679878939630.3998723');
|
||||
t('1.3024612569115368830867934222004329653604418e+9', '1302461256.9115368830867934222004329653604418');
|
||||
t('2.358787483447172786e+5', '235878.7483447172786');
|
||||
t('5.10614446965318674547416709785208086304398889160563e+28', '51061444696531867454741670978.5208086304398889160563');
|
||||
t('1.46685947134456101512731611558e+23', '146685947134456101512731.6115580');
|
||||
t('3.69960105771344554151928256518906564810300119e+25', '36996010577134455415192825.6518906564810300119');
|
||||
t('2.68683153074628e+10', '26868315307.4628');
|
||||
t('2.35656504568492312232737219553793859212e+15', '2356565045684923.12232737219553793859212');
|
||||
t('7.753292442361215e+14', '775329244236121.5');
|
||||
t('1.56e+0', '1.56');
|
||||
t('1.272818730367215461852227991200704e+21', '1272818730367215461852.227991200704');
|
||||
t('1.13900700292988027871648046839423153789e+7', '11390070.0292988027871648046839423153789');
|
||||
t('3.3431e+0', '3.3431');
|
||||
t('1.4546654966819402705e+14', '145466549668194.02705');
|
||||
t('3.05345735395805567424714891401667575466462830113819e+48', '3053457353958055674247148914016675754664628301138.19');
|
||||
t('5.1218945854639324441304933666460587e+2', '512.18945854639324441304933666460587');
|
||||
t('9.95299900896e+5', '995299.9008960');
|
||||
t('1.21564537151562431991786620635e+0', '1.21564537151562431991786620635');
|
||||
t('4.016e+1', '40.16');
|
||||
t('1.86570326e+7', '18657032.6');
|
||||
t('1.3381001727e+5', '133810.01727');
|
||||
t('2.639841700687441886800225725227e+12', '2639841700687.441886800225725227');
|
||||
t('2.45e+0', '2.45');
|
||||
t('2.8945e+2', '289.45');
|
||||
t('1.23e+0', '1.23');
|
||||
t('1.559806666149836070330006415033e+24', '1559806666149836070330006.415033');
|
||||
t('3.14984566145310751826289711761375061645611777700983e+3', '3149.84566145310751826289711761375061645611777700983');
|
||||
t('3.0940691333892283249774116223987e+5', '309406.91333892283249774116223987');
|
||||
t('6.572766274013360381079275191108732606370177179594282e+5', '657276.6274013360381079275191108732606370177179594282');
|
||||
t('1.470126973337024e+6', '1470126.973337024');
|
||||
t('5.6499e+2', '564.99');
|
||||
t('2.8416297367859233303497847667971781197616950846e+28', '28416297367859233303497847667.971781197616950846');
|
||||
t('2.1364951568189836563102481625533538320051163977e+41', '213649515681898365631024816255335383200511.63977');
|
||||
t('8.76108618687537137080904679797e+19', '87610861868753713708.0904679797');
|
||||
t('6.27683573474251182408654509953633505286e+6', '6276835.73474251182408654509953633505286');
|
||||
t('8.91411e+0', '8.91411');
|
||||
t('9.034542832410912578330021146413119399e+28', '90345428324109125783300211464.13119399');
|
||||
t('7.026094393430852002585511641212897686956090955e+39', '7026094393430852002585511641212897686956.090955');
|
||||
t('1.8812221093491505758565988678062e+11', '188122210934.91505758565988678062');
|
||||
t('9.435538492497050138580201734902181057468044875e+43', '94355384924970501385802017349021810574680448.75');
|
||||
t('5.36793419620790391866461e+20', '536793419620790391866.461');
|
||||
t('2.315089265590404012562599592854156357726817712e+26', '231508926559040401256259959.2854156357726817712');
|
||||
t('7.499170741828885273030006066196546588710962e+17', '749917074182888527.3030006066196546588710962');
|
||||
t('3.3962128305986e+5', '339621.28305986');
|
||||
t('8.17980456510031304e+9', '8179804565.10031304');
|
||||
t('4.394575876858124185382e+13', '43945758768581.24185382');
|
||||
t('7.881617323629751701107428e+9', '7881617323.629751701107428');
|
||||
t('4.89e+0', '4.89');
|
||||
t('9.85209894663520857685703881781194082356123765e+39', '9852098946635208576857038817811940823561.23765');
|
||||
t('6.849329685e+5', '684932.9685');
|
||||
t('2.8262252277815736355279617243060700437627773361e+7', '28262252.277815736355279617243060700437627773361');
|
||||
t('1.503736721902e+9', '1503736721.902');
|
||||
t('2.65213505469049775997232325076980590625670234690917845e+41', '265213505469049775997232325076980590625670.234690917845');
|
||||
t('4.23752645959719196604760963802412828187442060555521e+2', '423.752645959719196604760963802412828187442060555521');
|
||||
t('9.023159535576504097005203913521871601640521009e+36', '9023159535576504097005203913521871601.640521009');
|
||||
t('4.69339457186380276410136272120035011198438772754725e+14', '469339457186380.276410136272120035011198438772754725');
|
||||
t('1.2819429130391792511503973184804508867728894e+6', '1281942.9130391792511503973184804508867728894');
|
||||
t('1.9778e+3', '1977.8');
|
||||
t('2.456680359828937628024631306792185367572610021e+43', '24566803598289376280246313067921853675726100.21');
|
||||
t('5.25389225018085571689046925802871155628e+1', '52.5389225018085571689046925802871155628');
|
||||
t('1.733700532107e+8', '173370053.2107');
|
||||
t('1.9561099921e+5', '195610.99921');
|
||||
t('3.3409e+2', '334.09');
|
||||
t('6.09858715556186e+0', '6.09858715556186');
|
||||
t('3.20634106832106387482375790792609337383007782520694e+24', '3206341068321063874823757.90792609337383007782520694');
|
||||
t('1.46347126003930100207988814e+20', '146347126003930100207.98881400');
|
||||
t('2.717780449744210117995586561524987067807146882e+43', '27177804497442101179955865615249870678071468.82');
|
||||
t('2.86757572635270377540170639151e+22', '28675757263527037754017.0639151');
|
||||
t('1.3488325541508602487577920722101277063863557818e+14', '134883255415086.02487577920722101277063863557818');
|
||||
t('1.96013732736436392e+13', '19601373273643.6392');
|
||||
t('4.798185890466e+2', '479.8185890466');
|
||||
t('1.696622337138949329874242519485119916519994150606e+39', '1696622337138949329874242519485119916519.994150606');
|
||||
t('5.50000572984970761183142593570950897913860587074643e+13', '55000057298497.0761183142593570950897913860587074643');
|
||||
t('4.9e+1', '49');
|
||||
t('2.353405108244768666141e+9', '2353405108.2447686661410');
|
||||
t('1.237978927714857736527530290155529e+0', '1.237978927714857736527530290155529');
|
||||
t('5.54113012e+1', '55.411301200');
|
||||
t('1.639709023131e+11', '163970902313.1');
|
||||
t('2.15324060127001207725970506357881e+19', '21532406012700120772.5970506357881');
|
||||
t('2.373532121822929762731612214095513784533409e+29', '237353212182292976273161221409.5513784533409');
|
||||
t('4.5883026736677354807679611737881799804e+16', '45883026736677354.807679611737881799804');
|
||||
t('2.5996714820346689325468319633061e+21', '2599671482034668932546.8319633061');
|
||||
t('8.22641928e+6', '8226419.280');
|
||||
t('2.56006014528479284199702229871263269e+20', '256006014528479284199.702229871263269');
|
||||
t('4.301260132991159779386275268219519443685e+24', '4301260132991159779386275.268219519443685');
|
||||
t('1.052721790360165649330888881e+22', '10527217903601656493308.88881');
|
||||
t('6.85257703973809064426443728e+0', '6.85257703973809064426443728');
|
||||
t('1.341206836e+5', '134120.6836');
|
||||
t('1.293696083809745995580141432072678134217648017629e+25', '12936960838097459955801414.32072678134217648017629');
|
||||
t('9.81886611183e+9', '9818866111.83');
|
||||
t('1.3e+1', '13');
|
||||
t('2.185212134168411755342025405260683400574952243371e+1', '21.8521213416841175534202540526068340057495224337100');
|
||||
t('5.09812942277266e+1', '50.9812942277266');
|
||||
t('1.15841228150473459450904593187073359993e+37', '11584122815047345945090459318707335999.3');
|
||||
t('2.946408e+1', '29.46408');
|
||||
t('7.8843253757257e+6', '7884325.3757257');
|
||||
t('4.149829532631829e+7', '41498295.32631829');
|
||||
t('9.76844406944663415436782518894675931581135161845733e+46', '97684440694466341543678251889467593158113516184.5733');
|
||||
t('1.320634109357604978481e+7', '13206341.09357604978481');
|
||||
t('1.2300117044692162331376535732386421937e+8', '123001170.44692162331376535732386421937');
|
||||
t('1.79343822239530391558796001578394154846951511735e+42', '1793438222395303915587960015783941548469515.11735');
|
||||
t('3.46227335968923941657647562338569e+7', '34622733.5968923941657647562338569');
|
||||
t('3.6081901133629252234652167e+18', '3608190113362925223.4652167');
|
||||
t('3.41769614577210353834283168068494e+24', '3417696145772103538342831.68068494');
|
||||
t('1.036693895e+8', '103669389.5');
|
||||
t('9.840862048026534392868878603161623504069221701e+27', '9840862048026534392868878603.161623504069221701');
|
||||
t('2.56437211238605e+10', '25643721123.86050');
|
||||
t('2.645333616435501e+6', '2645333.616435501');
|
||||
t('3.75834254646606787747061360998e+1', '37.5834254646606787747061360998');
|
||||
t('1.21582101247e+6', '1215821.01247');
|
||||
t('5.43e+1', '54.3');
|
||||
t('3.1461380403028457753654142032015e+27', '3146138040302845775365414203.2015');
|
||||
t('2.73039e+4', '27303.9');
|
||||
t('3.349112077000398203735762417e+25', '33491120770003982037357624.170');
|
||||
t('2.293912475527946909960963698602754526495697363e+31', '22939124755279469099609636986027.54526495697363');
|
||||
t('7.800578368e+8', '780057836.8');
|
||||
t('3.503304265046835170500513083432983735273e+28', '35033042650468351705005130834.32983735273');
|
||||
t('6.521027589563589728e+9', '6521027589.563589728');
|
||||
t('1.26604818273232e+3', '1266.04818273232');
|
||||
t('4.5844253800756959854340115e+7', '45844253.800756959854340115');
|
||||
t('2.5103887704609158215979351198183e+20', '251038877046091582159.79351198183');
|
||||
t('6.5170765018089001398157674630438543e+17', '651707650180890013.98157674630438543');
|
||||
t('7.85679659655762637941070216699747e+18', '7856796596557626379.41070216699747');
|
||||
t('6.55113755834849587145e+18', '6551137558348495871.45');
|
||||
t('1.37856413555592382324487860882977704999616e+32', '137856413555592382324487860882977.704999616');
|
||||
t('7.51530486314140193e+5', '751530.486314140193');
|
||||
t('1.3712642461229590011e+7', '13712642.4612295900110');
|
||||
t('8.945222111405724e+2', '894.5222111405724');
|
||||
t('1.74501389497524149414213254563953197394499747444317e+44', '174501389497524149414213254563953197394499747.444317');
|
||||
t('7.1583294041845987824307132e+11', '715832940418.45987824307132');
|
||||
t('1.282007923703783860923747442697572540049e+13', '12820079237037.83860923747442697572540049');
|
||||
t('5.660625174793381639446229222e+11', '566062517479.3381639446229222');
|
||||
t('2.094745267e+4', '20947.45267');
|
||||
t('8.4497877437844686621097450218313191175e+13', '84497877437844.6866210974502183131911750');
|
||||
t('1.707217105197425488000493702652714920318758323999364e+23', '170721710519742548800049.3702652714920318758323999364');
|
||||
t('2.5487434814078948112667918801256335353406914111636153e+36', '2548743481407894811266791880125633535.3406914111636153');
|
||||
t('7.975944255792483246376368330364e+8', '797594425.5792483246376368330364');
|
||||
t('1.1038710051127692465453332862048e+20', '110387100511276924654.53332862048');
|
||||
t('2.0214122542287381656860062564183697682e+13', '20214122542287.381656860062564183697682');
|
||||
t('7.853012025112e+4', '78530.12025112');
|
||||
t('7.97061651146928e+3', '7970.61651146928');
|
||||
t('1.5712956919727392305361179349388e+10', '15712956919.727392305361179349388');
|
||||
t('8.2480059e+3', '8248.0059');
|
||||
t('2.71929146422591231877279340940781443961397491e+19', '27192914642259123187.7279340940781443961397491');
|
||||
t('2.131e+2', '213.10');
|
||||
t('5.53443299017925367e+6', '5534432.99017925367');
|
||||
t('9.0599636453e+8', '905996364.53');
|
||||
t('2.86841011915001378943e+0', '2.86841011915001378943');
|
||||
t('3.50691916034642635201767965866239485795145676493e+28', '35069191603464263520176796586.6239485795145676493');
|
||||
t('1.20268235416561427028396813141142129291e+18', '1202682354165614270.283968131411421292910');
|
||||
t('4.8878729e+4', '48878.7290');
|
||||
t('9.04344910891e+4', '90434.4910891');
|
||||
t('3.87232843764031e+2', '387.232843764031');
|
||||
t('2.246212201353343e+11', '224621220135.33430');
|
||||
t('4.92916234816086643529027167741689023e+4', '49291.6234816086643529027167741689023');
|
||||
t('2.1773818234639052045922630496e+22', '21773818234639052045922.630496');
|
||||
t('4.78705362683815125848e+0', '4.787053626838151258480');
|
||||
t('2.700762078698436846755198719005e+28', '27007620786984368467551987190.05');
|
||||
t('3.04897901998664513240359358574664525651334171e+36', '3048979019986645132403593585746645256.51334171');
|
||||
t('3.807300704307638993582e+18', '3807300704307638993.582');
|
||||
t('7.9846840795076707340124614425632613353204e+3', '7984.6840795076707340124614425632613353204');
|
||||
t('6.69918558928e+4', '66991.8558928');
|
||||
t('5.11e+1', '51.1');
|
||||
t('1.8e+1', '18');
|
||||
t('2.629676971e+2', '262.9676971');
|
||||
t('6.8402048967767212280354493672372347369800788279670097e+39', '6840204896776721228035449367237234736980.0788279670097');
|
||||
t('4.684145127602661593941009299096573092581e+21', '4684145127602661593941.009299096573092581');
|
||||
t('1.3010133600355313564757759338788842e+18', '1301013360035531356.4757759338788842');
|
||||
t('1.58527974113934732993372979240170059e+30', '1585279741139347329933729792401.70059');
|
||||
t('1.8249338722142728063286e+2', '182.49338722142728063286');
|
||||
t('1.5941e+0', '1.59410');
|
||||
t('2.0337546838170082473539926326926478252219475e+29', '203375468381700824735399263269.26478252219475');
|
||||
t('4.626173e+3', '4626.173');
|
||||
t('6.04857e+0', '6.04857');
|
||||
t('9.55039030589038069713466331e+0', '9.55039030589038069713466331');
|
||||
t('3.13977842e+6', '3139778.42');
|
||||
t('4.4046554138751e+10', '44046554138.751');
|
||||
t('2.27133088062335544441002965096e+25', '22713308806233554444100296.5096');
|
||||
t('1.72895143e+4', '17289.5143');
|
||||
t('2.59665963383099309886519729836757e+20', '259665963383099309886.5197298367570');
|
||||
t('5.42804375404301025317704270939778493719619031067122726e+24', '5428043754043010253177042.70939778493719619031067122726');
|
||||
t('4.0526054186532354119711729303068171063825508e+2', '405.26054186532354119711729303068171063825508');
|
||||
t('1.26960267394273418410687782475849e+9', '1269602673.94273418410687782475849');
|
||||
t('5.657206212494798707700546288522044895183104747814298e+7', '56572062.12494798707700546288522044895183104747814298');
|
||||
t('4.80834664047405196104320584899449259286e+21', '4808346640474051961043.20584899449259286');
|
||||
t('5.6639294733687553228095e+12', '5663929473368.7553228095');
|
||||
t('3.08469899797006019074738182718775120203832280411e+44', '308469899797006019074738182718775120203832280.4110');
|
||||
t('6.7324018330891115163882850963905830707247414517739e+20', '673240183308911151638.82850963905830707247414517739');
|
||||
t('7.8e+1', '78');
|
||||
t('3.7511576e+4', '37511.576');
|
||||
t('4.9744737445922007872559411117007e+20', '497447374459220078725.59411117007');
|
||||
t('1.4264855114407053894401398660016825255242638071603e+2', '142.64855114407053894401398660016825255242638071603');
|
||||
t('1.7972e+1', '17.972');
|
||||
t('1.08223075909551421423442320791403363148864e+12', '1082230759095.51421423442320791403363148864');
|
||||
t('1.27992032328728568e+16', '12799203232872856.8');
|
||||
t('3.23410998756876789482263723951851692122375679e+9', '3234109987.56876789482263723951851692122375679');
|
||||
t('8.309058187826413886051933894555524364e+5', '830905.8187826413886051933894555524364');
|
||||
t('5.9126904485324084868266487306831291316268437628598e+40', '59126904485324084868266487306831291316268.437628598');
|
||||
t('3.579918283412251816470339246643e+16', '35799182834122518.16470339246643');
|
||||
t('8.292403288e+1', '82.92403288');
|
||||
t('7.39431e+2', '739.431');
|
||||
t('3.880259e+2', '388.0259');
|
||||
t('8.356612898392420429137009991722851e+18', '8356612898392420429.137009991722851');
|
||||
t('5.395903069e+4', '53959.03069');
|
||||
t('2.084656696443025813e+12', '2084656696443.025813');
|
||||
t('7.54671420639507228408101673007042651462774881888e+46', '75467142063950722840810167300704265146277488188.8');
|
||||
t('6.9e+1', '69');
|
||||
t('8.921e+2', '892.10');
|
||||
t('2.51196408e+4', '25119.6408');
|
||||
t('4.2502325992166027236666111862782e+15', '4250232599216602.7236666111862782');
|
||||
t('1.48181688637265610577148846528720697801886e+17', '148181688637265610.577148846528720697801886');
|
||||
t('6.578849006577789439801702e+0', '6.578849006577789439801702');
|
||||
t('4.346905625146927213132990652e+22', '43469056251469272131329.90652');
|
||||
t('5.5037893e+0', '5.5037893');
|
||||
t('2.47731675267438120023934691987e+15', '2477316752674381.20023934691987');
|
||||
t('3.37487366652276710575333974697197457e+9', '3374873666.52276710575333974697197457');
|
||||
t('1.0385387059229329627650733271e+0', '1.0385387059229329627650733271');
|
||||
t('9.83004944893186643985967600066862369294062e+17', '983004944893186643.985967600066862369294062');
|
||||
t('4.24581658127100743607231740518633563667839856744e+26', '424581658127100743607231740.518633563667839856744');
|
||||
t('3.14222253457223322124561584676953981561133e+2', '314.222253457223322124561584676953981561133');
|
||||
t('1.1553833141891499623566322265502695096447390786748e+48', '1155383314189149962356632226550269509644739078674.8');
|
||||
t('5.2811e+1', '52.811');
|
||||
t('9.925202445922857021945001443270353221818473047344e+2', '992.5202445922857021945001443270353221818473047344');
|
||||
t('1.5758941e+4', '15758.9410');
|
||||
t('6.6630010328564980059488916358767e+30', '6663001032856498005948891635876.7');
|
||||
t('1.49898377473153728100588907982263779724221092732531e+44', '149898377473153728100588907982263779724221092.732531');
|
||||
t('4.175238908185616536855e+20', '417523890818561653685.5');
|
||||
t('1.192838736272799853174021036238e+21', '1192838736272799853174.021036238');
|
||||
t('1.145038e+3', '1145.038');
|
||||
t('4.0973786626728889384598402998014750474268e+9', '4097378662.6728889384598402998014750474268');
|
||||
t('5.5038104e+4', '55038.104');
|
||||
t('6.83895535917805849194871290958068199407518e+2', '683.895535917805849194871290958068199407518');
|
||||
t('2.9716066182e+0', '2.9716066182');
|
||||
t('1e+0', '1');
|
||||
t('1.78063428481384259205331358231117935e+0', '1.780634284813842592053313582311179350');
|
||||
t('6.277714976103425712837719e+22', '62777149761034257128377.1900');
|
||||
t('1.37376909692642287134486582232200547809845780076e+26', '137376909692642287134486582.232200547809845780076');
|
||||
t('7.0255659498942180908195e+16', '70255659498942180.908195');
|
||||
t('1.36758412477e+6', '1367584.12477');
|
||||
t('2.8993016541323392639291954727329719281958174e+23', '289930165413233926392919.54727329719281958174');
|
||||
t('2.44e+0', '2.44');
|
||||
t('5.39870374073212675286058196342904027304008232e+40', '53987037407321267528605819634290402730400.8232');
|
||||
t('6.4507160654825e+9', '6450716065.4825');
|
||||
t('1.21664e+3', '1216.64');
|
||||
t('3.13108416362400780440861428855476299376486503e+0', '3.13108416362400780440861428855476299376486503');
|
||||
t('7.2960499529336221198242592384915903149558006256202995e+17', '729604995293362211.98242592384915903149558006256202995');
|
||||
t('5.67239328846178836850536139916737284448973e+0', '5.67239328846178836850536139916737284448973');
|
||||
t('7.20020305957519743064e+3', '7200.203059575197430640');
|
||||
t('1.85115423780064073715032545790701546649748120114e+27', '1851154237800640737150325457.90701546649748120114');
|
||||
t('1.25021250836778893386687012660759710902e+21', '1250212508367788933866.87012660759710902');
|
||||
t('2.3323707491301665555664068537483355865980611e+25', '23323707491301665555664068.5374833558659806110');
|
||||
t('2.5088131581298507401113299236e+4', '25088.131581298507401113299236');
|
||||
t('9.612326850563943155774866e+17', '961232685056394315.5774866');
|
||||
t('1.54114517176248297154289225338049499367447824e+22', '15411451717624829715428.9225338049499367447824');
|
||||
t('5.22e+0', '5.22');
|
||||
t('4.04698305476309533783897e+21', '4046983054763095337838.97');
|
||||
t('2.620876536774240989563272117908814902188002596311e+24', '2620876536774240989563272.117908814902188002596311');
|
||||
t('1.7290754650750439926458970782158e+10', '17290754650.750439926458970782158');
|
||||
t('8.570789332248e+6', '8570789.332248');
|
||||
t('1.21e+1', '12.1');
|
||||
t('9.749134061639126502181192178140679940393318673720443e+45', '9749134061639126502181192178140679940393318673.720443');
|
||||
t('1.26878e+5', '126878.0');
|
||||
t('1.2391599841950849289559651456348e+9', '1239159984.1950849289559651456348');
|
||||
t('1.72220118427662724614289256133342842086e+22', '17222011842766272461428.9256133342842086');
|
||||
t('1.512063585971680294584184272035496e+15', '1512063585971680.294584184272035496');
|
||||
t('5.73447902457635174479825134e+14', '573447902457635.174479825134');
|
||||
t('1.07688e+1', '10.7688');
|
||||
t('3.171194102379077141557759899307946350455841e+27', '3171194102379077141557759899.307946350455841');
|
||||
t('4.924353466898191177698653319742594890634579e+37', '49243534668981911776986533197425948906.34579');
|
||||
t('6.85558243926569397328633907445409866949445343654692955e+18', '6855582439265693973.28633907445409866949445343654692955');
|
||||
t('1e+0', '1');
|
||||
t('2.1320000803e+7', '21320000.803');
|
||||
t('5.0878741e+4', '50878.741');
|
||||
t('5.1932898288391e+8', '519328982.88391');
|
||||
t('5.690616778176956027307884725933410349604387915634524e+49', '56906167781769560273078847259334103496043879156345.24');
|
||||
t('3.25099780528575457273246693147645e+15', '3250997805285754.572732466931476450');
|
||||
t('3e+0', '3');
|
||||
t('2.5811494197573291905990947355226e+13', '25811494197573.291905990947355226');
|
||||
t('5.60372259169833930471746454125e+13', '56037225916983.3930471746454125');
|
||||
t('1.2615810663732236602461593613783e+7', '12615810.663732236602461593613783');
|
||||
t('1.4654366449266911507705477499035407722184965108377032e+11', '146543664492.66911507705477499035407722184965108377032');
|
||||
t('6.4986735507448912857131832908423940757e+38', '649867355074489128571318329084239407570.0');
|
||||
t('3.6146989180120676857245474944e+3', '3614.6989180120676857245474944');
|
||||
t('9.928654762302286149994896625074e+4', '99286.54762302286149994896625074');
|
||||
t('3.46424170787806074650506079e+3', '3464.24170787806074650506079');
|
||||
t('1.25934313355319666474752550204680303068865719647e+33', '1259343133553196664747525502046803.03068865719647');
|
||||
t('1.23014105337660651106978059198916100450966081493207e+27', '1230141053376606511069780591.98916100450966081493207');
|
||||
t('1.386164712267169624993434287237e+23', '138616471226716962499343.4287237');
|
||||
t('2.66076369930322488334961932e+3', '2660.76369930322488334961932');
|
||||
t('9.37582568e+4', '93758.2568');
|
||||
t('1.39853642894726883996875746770529e+28', '13985364289472688399687574677.0529');
|
||||
t('3.19099e+5', '319099.0');
|
||||
t('3.04557106798789396303998723e+19', '30455710679878939630.3998723');
|
||||
t('1.3024612569115368830867934222004329653604418e+9', '1302461256.9115368830867934222004329653604418');
|
||||
t('2.358787483447172786e+5', '235878.7483447172786');
|
||||
t('5.10614446965318674547416709785208086304398889160563e+28', '51061444696531867454741670978.5208086304398889160563');
|
||||
t('1.46685947134456101512731611558e+23', '146685947134456101512731.6115580');
|
||||
t('3.69960105771344554151928256518906564810300119e+25', '36996010577134455415192825.6518906564810300119');
|
||||
t('2.68683153074628e+10', '26868315307.4628');
|
||||
t('2.35656504568492312232737219553793859212e+15', '2356565045684923.12232737219553793859212');
|
||||
t('7.753292442361215e+14', '775329244236121.5');
|
||||
t('1.56e+0', '1.56');
|
||||
t('1.272818730367215461852227991200704e+21', '1272818730367215461852.227991200704');
|
||||
t('1.13900700292988027871648046839423153789e+7', '11390070.0292988027871648046839423153789');
|
||||
t('3.3431e+0', '3.3431');
|
||||
t('1.4546654966819402705e+14', '145466549668194.02705');
|
||||
t('3.05345735395805567424714891401667575466462830113819e+48', '3053457353958055674247148914016675754664628301138.19');
|
||||
t('5.1218945854639324441304933666460587e+2', '512.18945854639324441304933666460587');
|
||||
t('9.95299900896e+5', '995299.9008960');
|
||||
t('1.21564537151562431991786620635e+0', '1.21564537151562431991786620635');
|
||||
t('4.016e+1', '40.16');
|
||||
t('1.86570326e+7', '18657032.6');
|
||||
t('1.3381001727e+5', '133810.01727');
|
||||
t('2.639841700687441886800225725227e+12', '2639841700687.441886800225725227');
|
||||
t('2.45e+0', '2.45');
|
||||
t('2.8945e+2', '289.45');
|
||||
t('1.23e+0', '1.23');
|
||||
t('1.559806666149836070330006415033e+24', '1559806666149836070330006.415033');
|
||||
t('3.14984566145310751826289711761375061645611777700983e+3', '3149.84566145310751826289711761375061645611777700983');
|
||||
t('3.0940691333892283249774116223987e+5', '309406.91333892283249774116223987');
|
||||
t('6.572766274013360381079275191108732606370177179594282e+5', '657276.6274013360381079275191108732606370177179594282');
|
||||
t('1.470126973337024e+6', '1470126.973337024');
|
||||
t('5.6499e+2', '564.99');
|
||||
t('2.8416297367859233303497847667971781197616950846e+28', '28416297367859233303497847667.971781197616950846');
|
||||
t('2.1364951568189836563102481625533538320051163977e+41', '213649515681898365631024816255335383200511.63977');
|
||||
t('8.76108618687537137080904679797e+19', '87610861868753713708.0904679797');
|
||||
t('6.27683573474251182408654509953633505286e+6', '6276835.73474251182408654509953633505286');
|
||||
t('8.91411e+0', '8.91411');
|
||||
t('9.034542832410912578330021146413119399e+28', '90345428324109125783300211464.13119399');
|
||||
t('7.026094393430852002585511641212897686956090955e+39', '7026094393430852002585511641212897686956.090955');
|
||||
t('1.8812221093491505758565988678062e+11', '188122210934.91505758565988678062');
|
||||
t('9.435538492497050138580201734902181057468044875e+43', '94355384924970501385802017349021810574680448.75');
|
||||
t('5.36793419620790391866461e+20', '536793419620790391866.461');
|
||||
t('2.315089265590404012562599592854156357726817712e+26', '231508926559040401256259959.2854156357726817712');
|
||||
t('7.499170741828885273030006066196546588710962e+17', '749917074182888527.3030006066196546588710962');
|
||||
t('3.3962128305986e+5', '339621.28305986');
|
||||
t('8.17980456510031304e+9', '8179804565.10031304');
|
||||
t('4.394575876858124185382e+13', '43945758768581.24185382');
|
||||
t('7.881617323629751701107428e+9', '7881617323.629751701107428');
|
||||
t('4.89e+0', '4.89');
|
||||
t('9.85209894663520857685703881781194082356123765e+39', '9852098946635208576857038817811940823561.23765');
|
||||
t('6.849329685e+5', '684932.9685');
|
||||
t('2.8262252277815736355279617243060700437627773361e+7', '28262252.277815736355279617243060700437627773361');
|
||||
t('1.503736721902e+9', '1503736721.902');
|
||||
t('2.65213505469049775997232325076980590625670234690917845e+41', '265213505469049775997232325076980590625670.234690917845');
|
||||
t('4.23752645959719196604760963802412828187442060555521e+2', '423.752645959719196604760963802412828187442060555521');
|
||||
t('9.023159535576504097005203913521871601640521009e+36', '9023159535576504097005203913521871601.640521009');
|
||||
t('4.69339457186380276410136272120035011198438772754725e+14', '469339457186380.276410136272120035011198438772754725');
|
||||
t('1.2819429130391792511503973184804508867728894e+6', '1281942.9130391792511503973184804508867728894');
|
||||
t('1.9778e+3', '1977.8');
|
||||
t('2.456680359828937628024631306792185367572610021e+43', '24566803598289376280246313067921853675726100.21');
|
||||
t('5.25389225018085571689046925802871155628e+1', '52.5389225018085571689046925802871155628');
|
||||
t('1.733700532107e+8', '173370053.2107');
|
||||
t('1.9561099921e+5', '195610.99921');
|
||||
t('3.3409e+2', '334.09');
|
||||
t('6.09858715556186e+0', '6.09858715556186');
|
||||
t('3.20634106832106387482375790792609337383007782520694e+24', '3206341068321063874823757.90792609337383007782520694');
|
||||
t('1.46347126003930100207988814e+20', '146347126003930100207.98881400');
|
||||
t('2.717780449744210117995586561524987067807146882e+43', '27177804497442101179955865615249870678071468.82');
|
||||
t('2.86757572635270377540170639151e+22', '28675757263527037754017.0639151');
|
||||
t('1.3488325541508602487577920722101277063863557818e+14', '134883255415086.02487577920722101277063863557818');
|
||||
t('1.96013732736436392e+13', '19601373273643.6392');
|
||||
t('4.798185890466e+2', '479.8185890466');
|
||||
t('1.696622337138949329874242519485119916519994150606e+39', '1696622337138949329874242519485119916519.994150606');
|
||||
t('5.50000572984970761183142593570950897913860587074643e+13', '55000057298497.0761183142593570950897913860587074643');
|
||||
t('4.9e+1', '49');
|
||||
t('2.353405108244768666141e+9', '2353405108.2447686661410');
|
||||
t('1.237978927714857736527530290155529e+0', '1.237978927714857736527530290155529');
|
||||
t('5.54113012e+1', '55.411301200');
|
||||
t('1.639709023131e+11', '163970902313.1');
|
||||
t('2.15324060127001207725970506357881e+19', '21532406012700120772.5970506357881');
|
||||
t('2.373532121822929762731612214095513784533409e+29', '237353212182292976273161221409.5513784533409');
|
||||
t('4.5883026736677354807679611737881799804e+16', '45883026736677354.807679611737881799804');
|
||||
t('2.5996714820346689325468319633061e+21', '2599671482034668932546.8319633061');
|
||||
t('8.22641928e+6', '8226419.280');
|
||||
t('2.56006014528479284199702229871263269e+20', '256006014528479284199.702229871263269');
|
||||
t('4.301260132991159779386275268219519443685e+24', '4301260132991159779386275.268219519443685');
|
||||
t('1.052721790360165649330888881e+22', '10527217903601656493308.88881');
|
||||
t('6.85257703973809064426443728e+0', '6.85257703973809064426443728');
|
||||
t('1.341206836e+5', '134120.6836');
|
||||
t('1.293696083809745995580141432072678134217648017629e+25', '12936960838097459955801414.32072678134217648017629');
|
||||
t('9.81886611183e+9', '9818866111.83');
|
||||
t('1.3e+1', '13');
|
||||
t('2.185212134168411755342025405260683400574952243371e+1', '21.8521213416841175534202540526068340057495224337100');
|
||||
t('5.09812942277266e+1', '50.9812942277266');
|
||||
t('1.15841228150473459450904593187073359993e+37', '11584122815047345945090459318707335999.3');
|
||||
t('2.946408e+1', '29.46408');
|
||||
t('7.8843253757257e+6', '7884325.3757257');
|
||||
t('4.149829532631829e+7', '41498295.32631829');
|
||||
t('9.76844406944663415436782518894675931581135161845733e+46', '97684440694466341543678251889467593158113516184.5733');
|
||||
t('1.320634109357604978481e+7', '13206341.09357604978481');
|
||||
t('1.2300117044692162331376535732386421937e+8', '123001170.44692162331376535732386421937');
|
||||
t('1.79343822239530391558796001578394154846951511735e+42', '1793438222395303915587960015783941548469515.11735');
|
||||
t('3.46227335968923941657647562338569e+7', '34622733.5968923941657647562338569');
|
||||
t('3.6081901133629252234652167e+18', '3608190113362925223.4652167');
|
||||
t('3.41769614577210353834283168068494e+24', '3417696145772103538342831.68068494');
|
||||
t('1.036693895e+8', '103669389.5');
|
||||
t('9.840862048026534392868878603161623504069221701e+27', '9840862048026534392868878603.161623504069221701');
|
||||
t('2.56437211238605e+10', '25643721123.86050');
|
||||
t('2.645333616435501e+6', '2645333.616435501');
|
||||
t('3.75834254646606787747061360998e+1', '37.5834254646606787747061360998');
|
||||
t('1.21582101247e+6', '1215821.01247');
|
||||
t('5.43e+1', '54.3');
|
||||
t('3.1461380403028457753654142032015e+27', '3146138040302845775365414203.2015');
|
||||
t('2.73039e+4', '27303.9');
|
||||
t('3.349112077000398203735762417e+25', '33491120770003982037357624.170');
|
||||
t('2.293912475527946909960963698602754526495697363e+31', '22939124755279469099609636986027.54526495697363');
|
||||
t('7.800578368e+8', '780057836.8');
|
||||
t('3.503304265046835170500513083432983735273e+28', '35033042650468351705005130834.32983735273');
|
||||
t('6.521027589563589728e+9', '6521027589.563589728');
|
||||
t('1.26604818273232e+3', '1266.04818273232');
|
||||
t('4.5844253800756959854340115e+7', '45844253.800756959854340115');
|
||||
t('2.5103887704609158215979351198183e+20', '251038877046091582159.79351198183');
|
||||
t('6.5170765018089001398157674630438543e+17', '651707650180890013.98157674630438543');
|
||||
t('7.85679659655762637941070216699747e+18', '7856796596557626379.41070216699747');
|
||||
t('6.55113755834849587145e+18', '6551137558348495871.45');
|
||||
t('1.37856413555592382324487860882977704999616e+32', '137856413555592382324487860882977.704999616');
|
||||
t('7.51530486314140193e+5', '751530.486314140193');
|
||||
t('1.3712642461229590011e+7', '13712642.4612295900110');
|
||||
t('8.945222111405724e+2', '894.5222111405724');
|
||||
t('1.74501389497524149414213254563953197394499747444317e+44', '174501389497524149414213254563953197394499747.444317');
|
||||
t('7.1583294041845987824307132e+11', '715832940418.45987824307132');
|
||||
t('1.282007923703783860923747442697572540049e+13', '12820079237037.83860923747442697572540049');
|
||||
t('5.660625174793381639446229222e+11', '566062517479.3381639446229222');
|
||||
t('2.094745267e+4', '20947.45267');
|
||||
t('8.4497877437844686621097450218313191175e+13', '84497877437844.6866210974502183131911750');
|
||||
t('1.707217105197425488000493702652714920318758323999364e+23', '170721710519742548800049.3702652714920318758323999364');
|
||||
t('2.5487434814078948112667918801256335353406914111636153e+36', '2548743481407894811266791880125633535.3406914111636153');
|
||||
t('7.975944255792483246376368330364e+8', '797594425.5792483246376368330364');
|
||||
t('1.1038710051127692465453332862048e+20', '110387100511276924654.53332862048');
|
||||
t('2.0214122542287381656860062564183697682e+13', '20214122542287.381656860062564183697682');
|
||||
t('7.853012025112e+4', '78530.12025112');
|
||||
t('7.97061651146928e+3', '7970.61651146928');
|
||||
t('1.5712956919727392305361179349388e+10', '15712956919.727392305361179349388');
|
||||
t('8.2480059e+3', '8248.0059');
|
||||
t('2.71929146422591231877279340940781443961397491e+19', '27192914642259123187.7279340940781443961397491');
|
||||
t('2.131e+2', '213.10');
|
||||
t('5.53443299017925367e+6', '5534432.99017925367');
|
||||
t('9.0599636453e+8', '905996364.53');
|
||||
t('2.86841011915001378943e+0', '2.86841011915001378943');
|
||||
t('3.50691916034642635201767965866239485795145676493e+28', '35069191603464263520176796586.6239485795145676493');
|
||||
t('1.20268235416561427028396813141142129291e+18', '1202682354165614270.283968131411421292910');
|
||||
t('4.8878729e+4', '48878.7290');
|
||||
t('9.04344910891e+4', '90434.4910891');
|
||||
t('3.87232843764031e+2', '387.232843764031');
|
||||
t('2.246212201353343e+11', '224621220135.33430');
|
||||
t('4.92916234816086643529027167741689023e+4', '49291.6234816086643529027167741689023');
|
||||
t('2.1773818234639052045922630496e+22', '21773818234639052045922.630496');
|
||||
t('4.78705362683815125848e+0', '4.787053626838151258480');
|
||||
t('2.700762078698436846755198719005e+28', '27007620786984368467551987190.05');
|
||||
t('3.04897901998664513240359358574664525651334171e+36', '3048979019986645132403593585746645256.51334171');
|
||||
t('3.807300704307638993582e+18', '3807300704307638993.582');
|
||||
t('7.9846840795076707340124614425632613353204e+3', '7984.6840795076707340124614425632613353204');
|
||||
t('6.69918558928e+4', '66991.8558928');
|
||||
t('5.11e+1', '51.1');
|
||||
t('1.8e+1', '18');
|
||||
t('2.629676971e+2', '262.9676971');
|
||||
t('6.8402048967767212280354493672372347369800788279670097e+39', '6840204896776721228035449367237234736980.0788279670097');
|
||||
t('4.684145127602661593941009299096573092581e+21', '4684145127602661593941.009299096573092581');
|
||||
t('1.3010133600355313564757759338788842e+18', '1301013360035531356.4757759338788842');
|
||||
t('1.58527974113934732993372979240170059e+30', '1585279741139347329933729792401.70059');
|
||||
t('1.8249338722142728063286e+2', '182.49338722142728063286');
|
||||
t('1.5941e+0', '1.59410');
|
||||
t('2.0337546838170082473539926326926478252219475e+29', '203375468381700824735399263269.26478252219475');
|
||||
t('4.626173e+3', '4626.173');
|
||||
t('6.04857e+0', '6.04857');
|
||||
t('9.55039030589038069713466331e+0', '9.55039030589038069713466331');
|
||||
t('3.13977842e+6', '3139778.42');
|
||||
t('4.4046554138751e+10', '44046554138.751');
|
||||
t('2.27133088062335544441002965096e+25', '22713308806233554444100296.5096');
|
||||
t('1.72895143e+4', '17289.5143');
|
||||
t('2.59665963383099309886519729836757e+20', '259665963383099309886.5197298367570');
|
||||
t('5.42804375404301025317704270939778493719619031067122726e+24', '5428043754043010253177042.70939778493719619031067122726');
|
||||
t('4.0526054186532354119711729303068171063825508e+2', '405.26054186532354119711729303068171063825508');
|
||||
t('1.26960267394273418410687782475849e+9', '1269602673.94273418410687782475849');
|
||||
t('5.657206212494798707700546288522044895183104747814298e+7', '56572062.12494798707700546288522044895183104747814298');
|
||||
t('4.80834664047405196104320584899449259286e+21', '4808346640474051961043.20584899449259286');
|
||||
t('5.6639294733687553228095e+12', '5663929473368.7553228095');
|
||||
t('3.08469899797006019074738182718775120203832280411e+44', '308469899797006019074738182718775120203832280.4110');
|
||||
t('6.7324018330891115163882850963905830707247414517739e+20', '673240183308911151638.82850963905830707247414517739');
|
||||
t('7.8e+1', '78');
|
||||
t('3.7511576e+4', '37511.576');
|
||||
t('4.9744737445922007872559411117007e+20', '497447374459220078725.59411117007');
|
||||
t('1.4264855114407053894401398660016825255242638071603e+2', '142.64855114407053894401398660016825255242638071603');
|
||||
t('1.7972e+1', '17.972');
|
||||
t('1.08223075909551421423442320791403363148864e+12', '1082230759095.51421423442320791403363148864');
|
||||
t('1.27992032328728568e+16', '12799203232872856.8');
|
||||
t('3.23410998756876789482263723951851692122375679e+9', '3234109987.56876789482263723951851692122375679');
|
||||
t('8.309058187826413886051933894555524364e+5', '830905.8187826413886051933894555524364');
|
||||
t('5.9126904485324084868266487306831291316268437628598e+40', '59126904485324084868266487306831291316268.437628598');
|
||||
t('3.579918283412251816470339246643e+16', '35799182834122518.16470339246643');
|
||||
t('8.292403288e+1', '82.92403288');
|
||||
t('7.39431e+2', '739.431');
|
||||
t('3.880259e+2', '388.0259');
|
||||
t('8.356612898392420429137009991722851e+18', '8356612898392420429.137009991722851');
|
||||
t('5.395903069e+4', '53959.03069');
|
||||
t('2.084656696443025813e+12', '2084656696443.025813');
|
||||
t('7.54671420639507228408101673007042651462774881888e+46', '75467142063950722840810167300704265146277488188.8');
|
||||
t('6.9e+1', '69');
|
||||
t('8.921e+2', '892.10');
|
||||
t('2.51196408e+4', '25119.6408');
|
||||
t('4.2502325992166027236666111862782e+15', '4250232599216602.7236666111862782');
|
||||
t('1.48181688637265610577148846528720697801886e+17', '148181688637265610.577148846528720697801886');
|
||||
t('6.578849006577789439801702e+0', '6.578849006577789439801702');
|
||||
t('4.346905625146927213132990652e+22', '43469056251469272131329.90652');
|
||||
t('5.5037893e+0', '5.5037893');
|
||||
t('2.47731675267438120023934691987e+15', '2477316752674381.20023934691987');
|
||||
t('3.37487366652276710575333974697197457e+9', '3374873666.52276710575333974697197457');
|
||||
t('1.0385387059229329627650733271e+0', '1.0385387059229329627650733271');
|
||||
t('9.83004944893186643985967600066862369294062e+17', '983004944893186643.985967600066862369294062');
|
||||
t('4.24581658127100743607231740518633563667839856744e+26', '424581658127100743607231740.518633563667839856744');
|
||||
t('3.14222253457223322124561584676953981561133e+2', '314.222253457223322124561584676953981561133');
|
||||
t('1.1553833141891499623566322265502695096447390786748e+48', '1155383314189149962356632226550269509644739078674.8');
|
||||
t('5.2811e+1', '52.811');
|
||||
t('9.925202445922857021945001443270353221818473047344e+2', '992.5202445922857021945001443270353221818473047344');
|
||||
t('1.5758941e+4', '15758.9410');
|
||||
t('6.6630010328564980059488916358767e+30', '6663001032856498005948891635876.7');
|
||||
t('1.49898377473153728100588907982263779724221092732531e+44', '149898377473153728100588907982263779724221092.732531');
|
||||
t('4.175238908185616536855e+20', '417523890818561653685.5');
|
||||
t('1.192838736272799853174021036238e+21', '1192838736272799853174.021036238');
|
||||
t('1.145038e+3', '1145.038');
|
||||
t('4.0973786626728889384598402998014750474268e+9', '4097378662.6728889384598402998014750474268');
|
||||
t('5.5038104e+4', '55038.104');
|
||||
t('6.83895535917805849194871290958068199407518e+2', '683.895535917805849194871290958068199407518');
|
||||
t('2.9716066182e+0', '2.9716066182');
|
||||
t('1e+0', '1');
|
||||
t('1.78063428481384259205331358231117935e+0', '1.780634284813842592053313582311179350');
|
||||
t('6.277714976103425712837719e+22', '62777149761034257128377.1900');
|
||||
t('1.37376909692642287134486582232200547809845780076e+26', '137376909692642287134486582.232200547809845780076');
|
||||
t('7.0255659498942180908195e+16', '70255659498942180.908195');
|
||||
t('1.36758412477e+6', '1367584.12477');
|
||||
t('2.8993016541323392639291954727329719281958174e+23', '289930165413233926392919.54727329719281958174');
|
||||
t('2.44e+0', '2.44');
|
||||
t('5.39870374073212675286058196342904027304008232e+40', '53987037407321267528605819634290402730400.8232');
|
||||
t('6.4507160654825e+9', '6450716065.4825');
|
||||
t('1.21664e+3', '1216.64');
|
||||
t('3.13108416362400780440861428855476299376486503e+0', '3.13108416362400780440861428855476299376486503');
|
||||
t('7.2960499529336221198242592384915903149558006256202995e+17', '729604995293362211.98242592384915903149558006256202995');
|
||||
t('5.67239328846178836850536139916737284448973e+0', '5.67239328846178836850536139916737284448973');
|
||||
t('7.20020305957519743064e+3', '7200.203059575197430640');
|
||||
t('1.85115423780064073715032545790701546649748120114e+27', '1851154237800640737150325457.90701546649748120114');
|
||||
t('1.25021250836778893386687012660759710902e+21', '1250212508367788933866.87012660759710902');
|
||||
t('2.3323707491301665555664068537483355865980611e+25', '23323707491301665555664068.5374833558659806110');
|
||||
t('2.5088131581298507401113299236e+4', '25088.131581298507401113299236');
|
||||
t('9.612326850563943155774866e+17', '961232685056394315.5774866');
|
||||
t('1.54114517176248297154289225338049499367447824e+22', '15411451717624829715428.9225338049499367447824');
|
||||
t('5.22e+0', '5.22');
|
||||
t('4.04698305476309533783897e+21', '4046983054763095337838.97');
|
||||
t('2.620876536774240989563272117908814902188002596311e+24', '2620876536774240989563272.117908814902188002596311');
|
||||
t('1.7290754650750439926458970782158e+10', '17290754650.750439926458970782158');
|
||||
t('8.570789332248e+6', '8570789.332248');
|
||||
t('1.21e+1', '12.1');
|
||||
t('9.749134061639126502181192178140679940393318673720443e+45', '9749134061639126502181192178140679940393318673.720443');
|
||||
t('1.26878e+5', '126878.0');
|
||||
t('1.2391599841950849289559651456348e+9', '1239159984.1950849289559651456348');
|
||||
t('1.72220118427662724614289256133342842086e+22', '17222011842766272461428.9256133342842086');
|
||||
t('1.512063585971680294584184272035496e+15', '1512063585971680.294584184272035496');
|
||||
|
||||
T.stop();
|
||||
T.stop();
|
||||
})();
|
||||
|
@ -1,131 +1,130 @@
|
||||
if (typeof T === 'undefined') require('../setup');
|
||||
|
||||
(function () {
|
||||
T('trunc');
|
||||
T('trunc');
|
||||
|
||||
function t(expected, n) {
|
||||
T.assertEqual(expected, Decimal.trunc(n).valueOf());
|
||||
T.assertEqual(expected, new Decimal(n).trunc().valueOf());
|
||||
}
|
||||
function t(expected, n) {
|
||||
T.assertEqual(expected, Decimal.trunc(n).valueOf());
|
||||
}
|
||||
|
||||
Decimal.config({
|
||||
precision: 20,
|
||||
rounding: 4,
|
||||
toExpNeg: -1e3,
|
||||
toExpPos: 1e3,
|
||||
minE: -9e15,
|
||||
maxE: 9e15
|
||||
});
|
||||
Decimal.config({
|
||||
precision: 20,
|
||||
rounding: 4,
|
||||
toExpNeg: -1e3,
|
||||
toExpPos: 1e3,
|
||||
minE: -9e15,
|
||||
maxE: 9e15
|
||||
});
|
||||
|
||||
t('0', 0);
|
||||
t('-0', -0);
|
||||
t('0', '0.000');
|
||||
t('Infinity', Infinity);
|
||||
t('-Infinity', -Infinity);
|
||||
t('NaN', NaN);
|
||||
t('0', 0);
|
||||
t('-0', -0);
|
||||
t('0', '0.000');
|
||||
t('Infinity', Infinity);
|
||||
t('-Infinity', -Infinity);
|
||||
t('NaN', NaN);
|
||||
|
||||
t('0', 0.1);
|
||||
t('0', '0.49999999999999994');
|
||||
t('0', 0.5);
|
||||
t('0', 0.7);
|
||||
t('-0', -0.1);
|
||||
t('-0', '-0.49999999999999994');
|
||||
t('-0', -0.5);
|
||||
t('-0', -0.7);
|
||||
t('1', 1);
|
||||
t('1', 1.1);
|
||||
t('1', 1.5);
|
||||
t('1', 1.7);
|
||||
t('-1', -1);
|
||||
t('-1', -1.1);
|
||||
t('-1', -1.5);
|
||||
t('-1', -1.7);
|
||||
t('0', 0.1);
|
||||
t('0', '0.49999999999999994');
|
||||
t('0', 0.5);
|
||||
t('0', 0.7);
|
||||
t('-0', -0.1);
|
||||
t('-0', '-0.49999999999999994');
|
||||
t('-0', -0.5);
|
||||
t('-0', -0.7);
|
||||
t('1', 1);
|
||||
t('1', 1.1);
|
||||
t('1', 1.5);
|
||||
t('1', 1.7);
|
||||
t('-1', -1);
|
||||
t('-1', -1.1);
|
||||
t('-1', -1.5);
|
||||
t('-1', -1.7);
|
||||
|
||||
t('1', '1.9999999999');
|
||||
t('-1', '-1.9999999999');
|
||||
t('1', '1.9999999999');
|
||||
t('-1', '-1.9999999999');
|
||||
|
||||
t('-2075364', '-2075364.364286541923');
|
||||
t('60593539780450631', '60593539780450631');
|
||||
t('65937898671515', '65937898671515');
|
||||
t('-39719494751819198566798', '-39719494751819198566798.578');
|
||||
t('92627382695288166556', '92627382695288166556.8683774524284866028260448205069');
|
||||
t('-881574', '-881574');
|
||||
t('-3633239209', '-3633239209.654526163275621746013315304191073405508491056');
|
||||
t('-23970335459820625362', '-23970335459820625362');
|
||||
t('131869457416154038', '131869457416154038');
|
||||
t('-4542227860', '-4542227860.9511298545226');
|
||||
t('2416872281', '2416872281.963955669484225137349193306323379254936827');
|
||||
t('-757684868752087594264588207655', '-757684868752087594264588207655.27838048392835556');
|
||||
t('-438798503526', '-438798503526.2317623894721299587561697');
|
||||
t('801625782231888715214665', '801625782231888715214665');
|
||||
t('327765350218284325239839632046', '327765350218284325239839632046.91682741746683081459605386');
|
||||
t('-7469045007691432294', '-7469045007691432294.362757245');
|
||||
t('8365540212937142194319515218789', '8365540212937142194319515218789.4106658678537421977827');
|
||||
t('-14108', '-14108.495051214515');
|
||||
t('49104501', '49104501.10055989379655329194309526150310568683504206945625');
|
||||
t('131370406', '131370406.330005158136313262837556068534122953');
|
||||
t('-689', '-689.6944252229740521128820354989299283');
|
||||
t('73441822178', '73441822178.572653');
|
||||
t('-2329', '-2329.42655772223486531483602927572548264457');
|
||||
t('-834103872107533086', '-834103872107533086');
|
||||
t('-1501493189970435', '-1501493189970435.74866616700317');
|
||||
t('70591', '70591.2244675522123484658978887');
|
||||
t('4446128540401735117', '4446128540401735117.435836700611264749985822486641350492901');
|
||||
t('-597273', '-597273');
|
||||
t('729117', '729117');
|
||||
t('-6581532150677269472829', '-6581532150677269472829.38194951340848938896000325718062365494');
|
||||
t('-131279182164804751', '-131279182164804751.430589952021038264');
|
||||
t('2949426983040959', '2949426983040959.8911208825380208568451907');
|
||||
t('25166', '25166.125888418871654557352055849116604612621573251770362');
|
||||
t('4560569286495', '4560569286495.98300685103599898554605198');
|
||||
t('13', '13.763105480576616251068323541559825687');
|
||||
t('9050999219306', '9050999219306.7846946346757664893036971777');
|
||||
t('20962819101135667464733349383', '20962819101135667464733349383.8959025798517496777183');
|
||||
t('4125789711001606948191', '4125789711001606948191.4707575965791242737346836');
|
||||
t('-6935501', '-6935501.294727166142750626019282');
|
||||
t('-1', '-1.518418076611593764852321765899');
|
||||
t('-35416', '-35416');
|
||||
t('6912783515683955988122411164548', '6912783515683955988122411164548.393');
|
||||
t('657', '657.0353902852');
|
||||
t('0', '0.00000000000000000000000017921822306362413915');
|
||||
t('1483059355427939255846407887', '1483059355427939255846407887.011361095342689876');
|
||||
t('0', '0.00000005');
|
||||
t('8551283060956479352', '8551283060956479352.5707396');
|
||||
t('0', '0.000000000000000000000000019904267');
|
||||
t('321978830777554620127500539', '321978830777554620127500539.339278568133088682532238002577');
|
||||
t('2073', '2073.532654804291079327244387978249477171032485250998396');
|
||||
t('677676305591', '677676305591.2');
|
||||
t('0', '0.0000000000006');
|
||||
t('39181479479778357', '39181479479778357');
|
||||
t('0', '0.00000000000000000087964700066672916651');
|
||||
t('896', '896');
|
||||
t('115083055948552475', '115083055948552475');
|
||||
t('9105942082143427451223', '9105942082143427451223');
|
||||
t('0', '0.0000000000000009');
|
||||
t('0', '0.00000000000000000000004');
|
||||
t('0', '0.000250427721966583680168028884692015623739');
|
||||
t('0', '0.000000000001585613219016120158734661293405081934');
|
||||
t('0', '0.000000090358252973411013592234');
|
||||
t('276312604693909858427', '276312604693909858427.21965306055697011390137926559');
|
||||
t('0', '0.0000252');
|
||||
t('-2075364', '-2075364.364286541923');
|
||||
t('60593539780450631', '60593539780450631');
|
||||
t('65937898671515', '65937898671515');
|
||||
t('-39719494751819198566798', '-39719494751819198566798.578');
|
||||
t('92627382695288166556', '92627382695288166556.8683774524284866028260448205069');
|
||||
t('-881574', '-881574');
|
||||
t('-3633239209', '-3633239209.654526163275621746013315304191073405508491056');
|
||||
t('-23970335459820625362', '-23970335459820625362');
|
||||
t('131869457416154038', '131869457416154038');
|
||||
t('-4542227860', '-4542227860.9511298545226');
|
||||
t('2416872281', '2416872281.963955669484225137349193306323379254936827');
|
||||
t('-757684868752087594264588207655', '-757684868752087594264588207655.27838048392835556');
|
||||
t('-438798503526', '-438798503526.2317623894721299587561697');
|
||||
t('801625782231888715214665', '801625782231888715214665');
|
||||
t('327765350218284325239839632046', '327765350218284325239839632046.91682741746683081459605386');
|
||||
t('-7469045007691432294', '-7469045007691432294.362757245');
|
||||
t('8365540212937142194319515218789', '8365540212937142194319515218789.4106658678537421977827');
|
||||
t('-14108', '-14108.495051214515');
|
||||
t('49104501', '49104501.10055989379655329194309526150310568683504206945625');
|
||||
t('131370406', '131370406.330005158136313262837556068534122953');
|
||||
t('-689', '-689.6944252229740521128820354989299283');
|
||||
t('73441822178', '73441822178.572653');
|
||||
t('-2329', '-2329.42655772223486531483602927572548264457');
|
||||
t('-834103872107533086', '-834103872107533086');
|
||||
t('-1501493189970435', '-1501493189970435.74866616700317');
|
||||
t('70591', '70591.2244675522123484658978887');
|
||||
t('4446128540401735117', '4446128540401735117.435836700611264749985822486641350492901');
|
||||
t('-597273', '-597273');
|
||||
t('729117', '729117');
|
||||
t('-6581532150677269472829', '-6581532150677269472829.38194951340848938896000325718062365494');
|
||||
t('-131279182164804751', '-131279182164804751.430589952021038264');
|
||||
t('2949426983040959', '2949426983040959.8911208825380208568451907');
|
||||
t('25166', '25166.125888418871654557352055849116604612621573251770362');
|
||||
t('4560569286495', '4560569286495.98300685103599898554605198');
|
||||
t('13', '13.763105480576616251068323541559825687');
|
||||
t('9050999219306', '9050999219306.7846946346757664893036971777');
|
||||
t('20962819101135667464733349383', '20962819101135667464733349383.8959025798517496777183');
|
||||
t('4125789711001606948191', '4125789711001606948191.4707575965791242737346836');
|
||||
t('-6935501', '-6935501.294727166142750626019282');
|
||||
t('-1', '-1.518418076611593764852321765899');
|
||||
t('-35416', '-35416');
|
||||
t('6912783515683955988122411164548', '6912783515683955988122411164548.393');
|
||||
t('657', '657.0353902852');
|
||||
t('0', '0.00000000000000000000000017921822306362413915');
|
||||
t('1483059355427939255846407887', '1483059355427939255846407887.011361095342689876');
|
||||
t('0', '0.00000005');
|
||||
t('8551283060956479352', '8551283060956479352.5707396');
|
||||
t('0', '0.000000000000000000000000019904267');
|
||||
t('321978830777554620127500539', '321978830777554620127500539.339278568133088682532238002577');
|
||||
t('2073', '2073.532654804291079327244387978249477171032485250998396');
|
||||
t('677676305591', '677676305591.2');
|
||||
t('0', '0.0000000000006');
|
||||
t('39181479479778357', '39181479479778357');
|
||||
t('0', '0.00000000000000000087964700066672916651');
|
||||
t('896', '896');
|
||||
t('115083055948552475', '115083055948552475');
|
||||
t('9105942082143427451223', '9105942082143427451223');
|
||||
t('0', '0.0000000000000009');
|
||||
t('0', '0.00000000000000000000004');
|
||||
t('0', '0.000250427721966583680168028884692015623739');
|
||||
t('0', '0.000000000001585613219016120158734661293405081934');
|
||||
t('0', '0.000000090358252973411013592234');
|
||||
t('276312604693909858427', '276312604693909858427.21965306055697011390137926559');
|
||||
t('0', '0.0000252');
|
||||
|
||||
Decimal.toExpNeg = -100;
|
||||
Decimal.toExpPos = 100;
|
||||
Decimal.toExpNeg = -100;
|
||||
Decimal.toExpPos = 100;
|
||||
|
||||
t('-0', -1e-308);
|
||||
t('-1e+308', -1e308);
|
||||
t('2.1e+308', '2.1e308');
|
||||
t('-0', '-1e-999');
|
||||
t('0', '1e-999');
|
||||
t('0', '1e-9000000000000000');
|
||||
t('-0', '-1e-9000000000000000');
|
||||
t('-0', '-9.9e-9000000000000001'); // underflow to zero
|
||||
t('9.999999e+9000000000000000', '9.999999e+9000000000000000');
|
||||
t('-9.999999e+9000000000000000', '-9.999999e+9000000000000000');
|
||||
t('Infinity', '1E9000000000000001');
|
||||
t('-Infinity', '-1e+9000000000000001');
|
||||
t('5.5879983320336874473209567979e+287894365', '5.5879983320336874473209567979e+287894365');
|
||||
t('-5.5879983320336874473209567979e+287894365', '-5.5879983320336874473209567979e+287894365');
|
||||
t('-0', -1e-308);
|
||||
t('-1e+308', -1e308);
|
||||
t('2.1e+308', '2.1e308');
|
||||
t('-0', '-1e-999');
|
||||
t('0', '1e-999');
|
||||
t('0', '1e-9000000000000000');
|
||||
t('-0', '-1e-9000000000000000');
|
||||
t('-0', '-9.9e-9000000000000001'); // underflow to zero
|
||||
t('9.999999e+9000000000000000', '9.999999e+9000000000000000');
|
||||
t('-9.999999e+9000000000000000', '-9.999999e+9000000000000000');
|
||||
t('Infinity', '1E9000000000000001');
|
||||
t('-Infinity', '-1e+9000000000000001');
|
||||
t('5.5879983320336874473209567979e+287894365', '5.5879983320336874473209567979e+287894365');
|
||||
t('-5.5879983320336874473209567979e+287894365', '-5.5879983320336874473209567979e+287894365');
|
||||
|
||||
T.stop();
|
||||
T.stop();
|
||||
})();
|
||||
|
@ -1,68 +1,68 @@
|
||||
if (typeof T === 'undefined') require('../setup');
|
||||
|
||||
(function () {
|
||||
T('valueOf');
|
||||
T('valueOf');
|
||||
|
||||
function t(expected, n) {
|
||||
T.assertEqual(expected, new Decimal(n).valueOf());
|
||||
}
|
||||
function t(expected, n) {
|
||||
T.assertEqual(expected, new Decimal(n).valueOf());
|
||||
}
|
||||
|
||||
Decimal.config({
|
||||
precision: 20,
|
||||
rounding: 4,
|
||||
toExpNeg: -9e15,
|
||||
toExpPos: 9e15,
|
||||
minE: -9e15,
|
||||
maxE: 9e15
|
||||
});
|
||||
Decimal.config({
|
||||
precision: 20,
|
||||
rounding: 4,
|
||||
toExpNeg: -9e15,
|
||||
toExpPos: 9e15,
|
||||
minE: -9e15,
|
||||
maxE: 9e15
|
||||
});
|
||||
|
||||
t('0', 0);
|
||||
t('0', '0');
|
||||
t('NaN', NaN);
|
||||
t('NaN', 'NaN');
|
||||
t('Infinity', 1/0);
|
||||
t('Infinity', 'Infinity');
|
||||
t('1', 1);
|
||||
t('9', 9);
|
||||
t('90', 90);
|
||||
t('90.12', 90.12);
|
||||
t('0.1', 0.1);
|
||||
t('0.01', 0.01);
|
||||
t('0.0123', 0.0123);
|
||||
t('111111111111111111111', '111111111111111111111');
|
||||
t('0.00001', 0.00001);
|
||||
t('0', 0);
|
||||
t('0', '0');
|
||||
t('NaN', NaN);
|
||||
t('NaN', 'NaN');
|
||||
t('Infinity', 1/0);
|
||||
t('Infinity', 'Infinity');
|
||||
t('1', 1);
|
||||
t('9', 9);
|
||||
t('90', 90);
|
||||
t('90.12', 90.12);
|
||||
t('0.1', 0.1);
|
||||
t('0.01', 0.01);
|
||||
t('0.0123', 0.0123);
|
||||
t('111111111111111111111', '111111111111111111111');
|
||||
t('0.00001', 0.00001);
|
||||
|
||||
t('-0', -0);
|
||||
t('-0', '-0');
|
||||
t('-Infinity', -1/0);
|
||||
t('-Infinity', '-Infinity');
|
||||
t('-1', -1);
|
||||
t('-9', -9);
|
||||
t('-90', -90);
|
||||
t('-90.12', -90.12);
|
||||
t('-0.1', -0.1);
|
||||
t('-0.01', -0.01);
|
||||
t('-0.0123', -0.0123);
|
||||
t('-111111111111111111111', '-111111111111111111111');
|
||||
t('-0.00001', -0.00001);
|
||||
t('-0', -0);
|
||||
t('-0', '-0');
|
||||
t('-Infinity', -1/0);
|
||||
t('-Infinity', '-Infinity');
|
||||
t('-1', -1);
|
||||
t('-9', -9);
|
||||
t('-90', -90);
|
||||
t('-90.12', -90.12);
|
||||
t('-0.1', -0.1);
|
||||
t('-0.01', -0.01);
|
||||
t('-0.0123', -0.0123);
|
||||
t('-111111111111111111111', '-111111111111111111111');
|
||||
t('-0.00001', -0.00001);
|
||||
|
||||
// Exponential format
|
||||
Decimal.toExpNeg = Decimal.toExpPos = 0;
|
||||
// Exponential format
|
||||
Decimal.toExpNeg = Decimal.toExpPos = 0;
|
||||
|
||||
t('1e-7', 0.0000001);
|
||||
t('1.23e-7', 0.000000123);
|
||||
t('1.2e-8', 0.000000012);
|
||||
t('-1e-7', -0.0000001);
|
||||
t('-1.23e-7', -0.000000123);
|
||||
t('-1.2e-8', -0.000000012);
|
||||
t('1e-7', 0.0000001);
|
||||
t('1.23e-7', 0.000000123);
|
||||
t('1.2e-8', 0.000000012);
|
||||
t('-1e-7', -0.0000001);
|
||||
t('-1.23e-7', -0.000000123);
|
||||
t('-1.2e-8', -0.000000012);
|
||||
|
||||
t('5.73447902457635174479825134e+14', '573447902457635.174479825134');
|
||||
t('1.07688e+1', '10.7688');
|
||||
t('3.171194102379077141557759899307946350455841e+27', '3171194102379077141557759899.307946350455841');
|
||||
t('4.924353466898191177698653319742594890634579e+37', '49243534668981911776986533197425948906.34579');
|
||||
t('6.85558243926569397328633907445409866949445343654692955e+18', '6855582439265693973.28633907445409866949445343654692955');
|
||||
t('1e+0', '1');
|
||||
t('5.73447902457635174479825134e+14', '573447902457635.174479825134');
|
||||
t('1.07688e+1', '10.7688');
|
||||
t('3.171194102379077141557759899307946350455841e+27', '3171194102379077141557759899.307946350455841');
|
||||
t('4.924353466898191177698653319742594890634579e+37', '49243534668981911776986533197425948906.34579');
|
||||
t('6.85558243926569397328633907445409866949445343654692955e+18', '6855582439265693973.28633907445409866949445343654692955');
|
||||
t('1e+0', '1');
|
||||
|
||||
T.stop();
|
||||
T.stop();
|
||||
})();
|
||||
|
||||
|
@ -36,7 +36,29 @@ T = (function () {
|
||||
}
|
||||
};
|
||||
|
||||
T.assertDecimal = function (digits, exponent, sign, n) {
|
||||
T.assertEqual = function (expected, actual) {
|
||||
++testNumber;
|
||||
if (expected === actual || expected !== expected && actual !== actual) {
|
||||
++passed;
|
||||
} else {
|
||||
writeError('\n Test number ' + testNumber + ' failed: assertEqual');
|
||||
writeError(' Expected: ' + expected);
|
||||
writeError(' Actual: ' + actual);
|
||||
}
|
||||
};
|
||||
|
||||
T.assertEqualDecimal = function (x, y) {
|
||||
++testNumber;
|
||||
if (x.eq(y) || x.isNaN() && y.isNaN()) {
|
||||
++passed;
|
||||
} else {
|
||||
writeError('\n Test number ' + testNumber + ' failed: assertEqualDecimal');
|
||||
writeError(' x: ' + x.valueOf());
|
||||
writeError(' y: ' + y.valueOf());
|
||||
}
|
||||
};
|
||||
|
||||
T.assertEqualProps = function (digits, exponent, sign, n) {
|
||||
var i = 0,
|
||||
len = digits.length;
|
||||
++testNumber;
|
||||
@ -44,27 +66,13 @@ T = (function () {
|
||||
if (i === len && i === n.d.length && exponent === n.e && sign === n.s) {
|
||||
++passed;
|
||||
} else {
|
||||
writeError('\n Test number ' + testNumber + ' failed: assertDecimal');
|
||||
writeError('\n Test number ' + testNumber + ' failed: assertEqualProps');
|
||||
writeError(' Expected digits: ' + digits);
|
||||
writeError(' Expected exponent: ' + exponent);
|
||||
writeError(' Expected sign: ' + sign);
|
||||
writeError(' Actual digits: ' + n.d);
|
||||
writeError(' Actual exponent: ' + n.e);
|
||||
writeError(' Actual sign: ' + n.s);
|
||||
//process.exit();
|
||||
}
|
||||
};
|
||||
|
||||
T.assertEqual = function (expected, actual) {
|
||||
++testNumber;
|
||||
if (expected === actual || expected !== expected && actual !== actual) {
|
||||
++passed;
|
||||
//write('\n Expected and actual: ' + actual);
|
||||
} else {
|
||||
writeError('\n Test number ' + testNumber + ' failed: assertEqual');
|
||||
writeError(' Expected: ' + expected);
|
||||
writeError(' Actual: ' + actual);
|
||||
//process.exit();
|
||||
}
|
||||
};
|
||||
|
||||
@ -78,12 +86,10 @@ T = (function () {
|
||||
}
|
||||
if (actual instanceof Error && /DecimalError/.test(actual.message)) {
|
||||
++passed;
|
||||
//write('\n Expected and actual: ' + actual);
|
||||
} else {
|
||||
writeError('\n Test number ' + testNumber + ' failed: assertException');
|
||||
writeError(' Expected: ' + msg + ' to raise a [DecimalError].');
|
||||
writeError(' Actual: ' + (actual || 'no exception'));
|
||||
//process.exit();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -41,6 +41,7 @@
|
||||
'exp',
|
||||
'floor',
|
||||
'hypot',
|
||||
'immutability',
|
||||
'intPow',
|
||||
'isFiniteEtc',
|
||||
'ln',
|
||||
|
@ -27,6 +27,7 @@ console.log('\n Testing decimal.js\n');
|
||||
'exp',
|
||||
'floor',
|
||||
'hypot',
|
||||
'immutability',
|
||||
'intPow',
|
||||
'isFiniteEtc',
|
||||
'ln',
|
||||
|
Loading…
Reference in New Issue
Block a user