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

333 lines
25 KiB
JavaScript
Raw Normal View History

2014-04-02 15:28:08 +00:00
var count = (function baseIn(Decimal) {
var start = +new Date(),
log,
error,
undefined,
passed = 0,
total = 0;
if (typeof window === 'undefined') {
log = console.log;
error = console.error;
} else {
log = function (str) { document.body.innerHTML += str.replace('\n', '<br>') };
error = function (str) { document.body.innerHTML += '<div style="color: red">' +
str.replace('\n', '<br>') + '</div>' };
}
if (!Decimal && typeof require === 'function') Decimal = require('../decimal');
function assert(expected, actual) {
total++;
if (expected !== actual) {
error('\n Test number: ' + total + ' failed');
error(' Expected: ' + expected);
error(' Actual: ' + actual);
//process.exit();
} else {
passed++;
//log('\n Expected and actual: ' + actual);
}
}
function assertException(func, message) {
var actual;
total++;
try {
func();
} catch (e) {
actual = e;
}
if (actual && actual.name == 'Decimal Error') {
passed++;
//log('\n Expected and actual: ' + actual);
} else {
error('\n Test number: ' + total + ' failed');
error('\n Expected: ' + message + ' to raise a Decimal Error.');
error(' Actual: ' + (actual || 'no exception'));
//process.exit();
}
}
function T(expected, value, base, pr, rm) {
Decimal.precision = pr;
Decimal.rounding = rm;
assert(expected, new Decimal(value, base).toString())
}
log('\n Testing baseIn...');
Decimal.config({
toExpNeg: -9e15,
toExpPos: 9e15,
minE: -9e15,
maxE: 9e15,
errors: true
});
// Test integers of bases 2 - 36 against Number.prototype.toString(base).
for (var i = 2; i < 37; i++) {
for (var j = -70; j < 70; j++) {
T(j.toString(), j.toString(i), i, 20, 4);
var k = Math.floor(Math.random() * Math.pow(2, Math.floor(Math.random() * 52) + 1));
T(k.toString(), k.toString(i), i, 20, 4);
}
}
T('0', 0, 2, 20, 4);
T('0', 0, 10, 20, 4);
T('0', -0, 36, 20, 4);
T('-5', -101, 2, 20, 4);
T('-101', -101, 10, 20, 4);
T('2', '1.1', 2, 1, 0);
T('-2', '-1.1', 2, 1, 0);
T('1000', '999.5', 10, 1, 0);
T('-1000', '-999.5', 10, 1, 0);
T('1', '1.1', 2, 1, 1);
T('-1', '-1.1', 2, 1, 1);
T('900', '999.5', 10, 1, 1);
T('-900', '-999.5', 10, 1, 1);
T('2', '1.1', 2, 1, 2);
T('-1', '-1.1', 2, 1, 2);
T('1000', '999.5', 10, 1, 2);
T('-900', '-999.5', 10, 1, 2);
T('1', '1.1', 2, 1, 3);
T('-2', '-1.1', 2, 1, 3);
T('900', '999.5', 10, 1, 3);
T('-1000', '-999.5', 10, 1, 3);
T('2', '1.1', 2, 1, 4);
T('-2', '-1.1', 2, 1, 4);
T('1000', '999.5', 10, 1, 4);
T('-1000', '-999.5', 10, 1, 4);
T('1', '1.1', 2, 1, 5);
T('-1', '-1.1', 2, 1, 5);
T('1000', '999.5', 10, 1, 5);
T('-1000', '-999.5', 10, 1, 5);
T('2', '1.1', 2, 1, 6);
T('-2', '-1.1', 2, 1, 6);
T('1000', '999.5', 10, 1, 6);
T('-1000', '-999.5', 10, 1, 6);
T('1000', '999.4', 10, 1, 6);
T('-1000', '-999.4', 10, 1, 6);
T('1000', '999.500001', 10, 1, 6);
T('-1000', '-999.500001', 10, 1, 6);
T('2', '1.1', 2, 1, 7);
T('-1', '-1.1', 2, 1, 7);
T('1000', '999.5', 10, 1, 7);
T('-1000', '-999.5', 10, 1, 7);
T('1', '1.1', 2, 1, 8);
T('-2', '-1.1', 2, 1, 8);
T('1000', '999.5', 10, 1, 8);
T('-1000', '-999.5', 10, 1, 8);
T('546141272243.39871532041499605905', '111111100101000100011100111100010110011.011001100001001000110101000011011001100010111000110000101011000010100010110111100010010000011010100100001111010010100', 2, 32, 3);
T('18181', '100011100000101.00', 2, 5, 3);
T('-12.5', '-1100.10', 2, 3, 3);
T('-50063197524405820261198.16624174237994681863', '-1010100110011110111001101110101001100100001000111000001111110000001101001110.001010101000111011010001100111101100000001111110011001111100001101111001', 2, 43, 3);
T('12659149135078325508.50965366452082459802', '1010111110101110010101010001000100111011000010010111110100000100.100000100111100010101001100111010110011101001011100101110', 2, 40, 3);
T('-6387062313767439324325.28595431079156696797', '-1010110100011111001001011101001100100001111011000110000100101010010100101.0100100100110100010011010011110100', 2, 42, 3);
T('1396.09066858848154879524', '10101110100.0001011100110110000011100111111001001101100', 2, 24, 3);
T('-13243297892469.48301514260489275543', '-11000000101101110010000100010000100001110101.0111101110100110111000010110000011110101111101100110', 2, 34, 3);
T('343872.5', '1010011111101000000.10', 2, 7, 3);
T('-328.28125', '-101001000.010010', 2, 8, 6);
T('-1236693955.36249679178679391345', '-1001001101101100111001111000011.010111001100110010010110111110011010000100010011010101010111111100000101001010101', 2, 30, 6);
T('6881574.93937801730607199391', '11010010000000100100110.1111000001111011000100111110011011101001001100001101001011001010111', 2, 27, 6);
T('-341919.144535064697265625', '-1010011011110011111.0010010100000000010', 2, 24, 6);
T('97.10482025146484375', '1100001.000110101101010110000', 2, 19, 6);
T('-120914.40625', '-11101100001010010.01101', 2, 11, 6);
T('8080777260861123367657', '1101101100000111101001111111010001111010111011001010100101001001011101001', 2, 22, 6);
T('-284229731050264281.85682739554010822758', '-1111110001110010010110111100111001110110110001011011011001.11011011010110010000101001001010001010010110', 2, 38, 6);
T('-729.0001524157902758725803993293705227861606', '-1000000.00000001', 3, 43, 2);
T('-4096.0000152587890625', '-1000000.00000001', 4, 20, 2);
T('-15625.00000256', '-1000000.00000001', 5, 13, 2);
T('-46656.0000005953741807651272671848803536046334', '-1000000.00000001', 6, 45, 2);
T('-117649.0000001734665255574303432156634721649541', '-1000000.00000001', 7, 46, 2);
T('-262144.000000059604644775390625', '-1000000.00000001', 8, 30, 2);
T('-531441.0000000232305731254187746379102835730507', '-1000000.00000001', 9, 46, 2);
T('-1000000.00000001', '-1000000.00000001', 10, 15, 2);
T('-1771561.0000000046650738020973341431092840981941', '-1000000.00000001', 11, 47, 2);
T('-2985984.000000002325680393613778387440938881268', '-1000000.00000001', 12, 46, 2);
T('-4826809.0000000012258947398402566721524761600832', '-1000000.00000001', 13, 47, 2);
T('-7529536.0000000006776036154587122781861854381443', '-1000000.00000001', 14, 47, 2);
T('-11390625.0000000003901844231062338058222831885383', '-1000000.00000001', 15, 48, 2);
T('-16777216.00000000023283064365386962890625', '-1000000.00000001', 16, 40, 2);
T('-24137569.0000000001433536083296850401481727781882', '-1000000.00000001', 17, 48, 2);
T('-34012224.0000000000907444262711670884293370452072', '-1000000.00000001', 18, 48, 2);
T('-47045881.0000000000588804597472215429921222500439', '-1000000.00000001', 19, 48, 2);
T('-64000000.0000000000390625', '-1000000.00000001', 20, 24, 2);
T('-85766121.0000000000264390375792455941496210138949', '-1000000.00000001', 21, 48, 2);
T('-113379904.0000000000182229445394427114965206410085', '-1000000.00000001', 22, 49, 2);
T('-148035889.0000000000127696005408659110598172017909', '-1000000.00000001', 23, 49, 2);
T('-191102976.0000000000090846890375538218259411675049', '-1000000.00000001', 24, 49, 2);
T('-244140625.0000000000065536', '-1000000.00000001', 25, 25, 2);
T('-308915776.0000000000047886513275010026255956100003', '-1000000.00000001', 26, 49, 2);
T('-387420489.0000000000035407061614721497695336509027', '-1000000.00000001', 27, 49, 2);
T('-481890304.0000000000026468891228855948366647868677', '-1000000.00000001', 28, 49, 2);
T('-594823321.000000000001999014833671504164315094574', '-1000000.00000001', 29, 48, 2);
T('-729000000.0000000000015241579027587258039932937052', '-1000000.00000001', 30, 49, 2);
T('-887503681.0000000000011724827159637921277158030113', '-1000000.00000001', 31, 49, 2);
T('-1073741824.0000000000009094947017729282379150390625', '-1000000.00000001', 32, 50, 2);
T('-1291467969.0000000000007110309102419347878538765581', '-1000000.00000001', 33, 50, 2);
T('-1544804416.0000000000005599750325378321880787999147', '-1000000.00000001', 34, 50, 2);
T('-1838265625.0000000000004440743054270216786320984887', '-1000000.00000001', 35, 50, 2);
T('-2176782336.0000000000003544704151217464391770978328', '-1000000.00000001', 36, 50, 2);
T('0', '0', 2, 1, 4);
T('3', '3', 24, 1, 4);
T('0.037037', '0.1', 27, 5, 4);
T('15398955012055570438.9425184', 'ST87ST87ST87S.S87TS87TS87TS', 30, 27, 4);
T('2126934655697951.030303', '11111111111.1111111111111', 34, 22, 4);
T('-288494149172542947905560340081675757349.9789739', '-P98IJYP96JHYP95DPHJWPH09Y.Y98HO8WH58HW', 35, 46, 4);
T('175', '67', 28, 3, 4);
T('683674717563732788139425742102304147', '23BXVQVK5NK29XCNPM7JWQQC', 35, 36, 4);
T('7371249.07083', '93089.23M993NGABNLEP', 30, 12, 4);
T('26234523211578269977959969', 'LMDG5KNKLAUCSCNH1.0', 32, 26, 4);
T('572315667420.390625', '10250053005734.31', 8, 18, 4);
T('19121180169114878494408529193061279888621355', '30130433145052134410320001411315120554033203511455405455', 6, 44, 4);
T('121756633', '1I0JBBC.F628AF202451951181911H3HGID95I855056I', 20, 9, 4);
T('3943269', '7370130.225184', 9, 7, 4);
T('491578', '1700072.2013436326', 8, 6, 4);
T('7793119763346', '6A06CF7K7G.58CD39A32GE', 22, 13, 4);
T('7529497809730458840', '4BI52A83H0F7720.6G912C3J4I6H7HI1I41', 20, 19, 4);
T('46865454464741700656', 'BF6CDEA9FDBKKB.6G9A74QO718PHAK', 27, 20, 4);
T('304', 'F4.18180D', 20, 3, 4);
T('744', '453.61845741C18C5B7AC08A', 13, 3, 4);
T('246', '77.MS', 34, 3, 4);
T('191110529149', '2617704640174.75763527113244751520622', 8, 12, 4);
T('6', '6.8E2FCGH', 18, 1, 4);
T('11952558583', '49E4EDC8C.C86', 15, 11, 4);
T('1486467157880871503427980640713668', 'C0776B7908614278DD33549496D36.539A196725', 14, 34, 4);
T('13069', '5C43.B25BB7338', 13, 5, 4);
T('811', 'R1.6', 30, 3, 4);
T('1092443496', '1443DA51.G5FHF0121H2F', 19, 10, 4);
T('995982886869648407459143', '1HJAHK0FKDN4LN29FI.3DDG4GCBBFJGOM648JBCCCBE5', 25, 24, 4);
T('2563', '42D.9MBNBD3CHC961K4', 25, 4, 4);
T('5165465768912078514086932864', '5165465768912078514086932864.15061794310893065985169641395', 10, 28, 4);
T('133262758349237628352120716402.993431117739119', '3bkobquqthhfbndsmv3i.vp8o0sc4ldtji02mmgqr7blpdjgk', 32, 45, 4);
//T('198496092814270915085258754228681831655498041942', '24310400201333231203024322334002413400114320223240014320424444320232', 5, 48, 4);
//T('-761392382117509615082995635394.835132598876953125', '-1001100111000011000100000100010111000100100100101110010100101000000110101101100101101101010011000010.110101011100101101000', 2, 48, 3);
//T('43058907596428432974475252.68192645050244227178', '10001110011110000101000000111011011100000010011100000001111011111011101110111111110100.10101110100100101011101101011011001011110111001101', 2, 46, 3);
//T('1334535467.5658391510074236740492770511046811319813437111801', '45033235646.365040260503443445435151335014', 7, 59, 4);
//T('90182851032808914967166718343839124510737262515334936.05372908711433410645', '11110001000010011001110001010101001001001000011011110000101001011001110011010100000001001000011000010101101101000111110111101000001101000101100000101011100110000010111100011000.0000110111000001001100001', 2, 73, 6);
//T('606266547022938105478897519250152.63383591632958904971', '1110111100100001010001101110110111100101000011011110001111001011010010100111110100011000101110100101011101000.1010001001000011000100100001001110101010011100000110001', 2, 53, 6);
//T('4839094569478687835499021764036676797809986482983355.46', '9G041CFCPN92FSECBIHHL1F1I74FJMGAKTR.EAJ7JQ', 31, 54, 4);
//T('9464300204295306111422098057.77248824166891668678144149703717008528', '25473f3dbce5cf3hg8318d7.dg52d120b14ea966a7ag06a2gh03', 18, 66, 4);
//T('42689628837110945219.60963984922125154547359100149049425936', 'D37AFB2193DJ265.CGHI7F1BK1I9GJ', 21, 58, 4);
//T('72783.559378210242248003991012349918599484318629885897', '11c4f.8f33690f15e13146d99092446da', 16, 53, 4);
//T('325927753012307620476767402981591827744994693483231017778102969592507', 'c16de7aa5bf90c3755ef4dea45e982b351b6e00cd25a82dcfe0646abb', 16, 69, 4);
//T('8535432796511493691316991730196733707212461.36382685871580896850891461623808', '9l0ah4mf8a0kcgn44oji4kh7l6fbenb.929jlggo43612jfn', 25, 75, 4);
//T('1072424547177.982891327541533302850175278158817253467459228776101', 'donxvwix.zdts', 36, 64, 4);
//T('171510920999634527633.53051379043557196404057602235264411208736518600450525086556631034', '1fqecn4264r1is.ijur8yj41twl9', 35, 86, 4);
//T('27603501710202437282037.4945845176631161140013607910579053986520224457133', '42545302442500101544532043113.254455200225412543300022520330204033', 6, 72, 4);
//T('5955289028666603391738616069969.70235175643053599414353772852590894151261634747374296179598348968', '8qp28dk3js2iqksmqaqnq.lntnif5qh', 31, 96, 4);
//T('9560389177469634483515162.499335215204179931606951906984830542647805834768203380512715304247460734647288652625', '195qdkkqsa8shmhp9e.edr89', 29, 109, 4);
//T('824178538787196749922434027872451367594239056.93473392033316110609748881918323116875731371037529199959272159196515804304815690839727', '402kfhkd37bt5n8scr1ir9ndlrnipig.s17oe7rkhi91bh', 30, 131, 4);
//T('101412023101671912143604060399016691636944374947585694881897391246499475847835837224977373985157443438754012038820105175407623679155088073411120684342336808325631625647896282357928709212286943830565579566232670291284084535962556769836340401310575784301282705195128879424575312893.9', '999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999.99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999991999999999999999999999999999999999999', 11, 280, 4);
//T('4060090888512781039564383580983002345701981946441239.3428571428571428571428571428571', '4hv6vl92gvkmumr0a6ley0dhkwmwfe35oo.c', 35, 83, 4);
//T('20398136837.975941624007641435905199481124700109083958314345873245346912136478926756110974638825468924', '5MI4K5MF.MA66B0L4HK8DK35LI3D0G9JFF7LBB27LAKH3E4FCEJM', 23, 101, 4);
//T('893835640746065892983175797034880314945754459977061255725623898879842611', '4231231434203102220114420330232412332321132204022241104411014023324140104333412232222433424401214430421', 5, 72, 4);
//T('16165422251964685360633312857381850497426314130782805.0722805578590765752365085976081394656988159695365026477063128458', '184254BE3B14F86L7HPKEOIIJKHCQ3DDBCPG5.20IJJ', 28, 117, 4);
//T('321903599394345741344181790866033344020400577177.313819548430693134687858394581066124770210878514089611637812764975', 'GKE2D93H4K55C41EA627I1867CEFFCHBHE8I.6C85JF7D0BFDJFK4K', 21, 114, 4);
//T('21872738004815869.777777777777777777777777777777777777777777777777777777777777778', 'E8NB0D88AN2D.IG', 24, 80, 4);
//T('799580158552527670.51524163982781306375625835799992154433181428013', '1C5C994CD5A7E49A.7ADE19484CE921B8EE7', 15, 65, 4);
//T('66906978329149775053912152738679.85034153550858840284188803538614532877', '2011110022202010100200021000121022200222101110012102220102212010111.21122122002110012111112102002110221102120102', 3, 70, 4);
//T('135378457250661080667637636173904073793598540954140', '1002012000221022001212121111002202200112011211012200211202012002222102020101100001022121022011000222110010.012011121', 3, 51, 4);
//T('6022239845523628300792137851333617197616053606580805361460444571405159915948416057193556599026984420186847535714193186506779546.4556236443314904837690988442526483819662784595647130183235303721602800222055794108199556123586653329881581592267846680610823474921246464969258477077863650868277185531976912497464940550929773250950050770236216838431410765360978643096764020310745468760588741279409615791352862685370605644685588153154519500073466513391957805846390165913652324415980859737890626644332175845493981646519212629534228056888012396060513441600232198198852922861889869707278977208029134247830435144084773894461272045689824171792429896700817125285435586945018816640830269916255105452815913191289529893819734761670265980240407320918160953632792158728830042103387411456542536810796652244645485593100591730413693590843275488305682826306154908896513516956968445600847754198206612309103396887758443228143137981534112541338835066525253798074904113105187829104017356463238259663404898152949724412637819869935282983483575103344690271376544303237661785198116618209645693891440053055791222608736298044098057846024623105545677810400641552772726014409590312727541941480734914730470740525454342754483898273145533492752142180612079978569432320375612391685343190871609016138987629898103413280466343756475335476863962116865860010248617771068531725150685893638106151632345615414770808480730336814678808916807793065852344247399508874232577322683969505139800248661676789784248590054774434213345522678589550623903526565361893640064097416875282430412551403875044431271490763361817199135542943175943995230707647781721710597994457073386977015830701991388959079759816513975480721543307662340015150380086236057816829078898225059856552413350284116816305096063307302308659037797102860725413670258852677741995890327403256818732415071501390970220730451988544268424615442478276389602953573085364390692962604528040634571844764384836564245479443620018455938410451445504647491669885354248714139337350431547285993288393841278293002129297680748312623276153161826252909914877078640262539416528508074081437238593768096163670806233855109290443174331707266420308590167872439171480325467921522046200228482718981421584297447992498560298573684034666228738832029798389127798435121543079567948019011853734562636802299013989476950515575455831212693295267141477431620237906652742316854138488846620921431415465666225458069481419780029863865682131427599553321630505877230919953243450363594301612137724039745488329675049185046073768080814947421511552514789392432849559302423412424192309943956473192218429595034856403546516926684059130233090968959273105440637609620452121285667863859532625326685359600979376954055247257654658562361051460387346784222321838341346951931169830197453152423738407265029362156387793965438213660951859260299897552578349741198133227875407764679114825491068021571657195984779499999024715590484338025188114533021023050370868752191294035509482943329767147962125995229105045150706986151627768985265212082407422640824469546677612899444570693728350162674257483239925735878492507061337473344392331804567248524375248196013206631647798246777278265256440122509303950992167405724450325162899488610833280925378783880708704529234908481315341873751414165108439035386174049324872616805814095261827715638895574492089840123314472999530589181523638163109275254977346582592518727074756481627832093335067462764164838466356242719799091123410944285275491922996671609047639104834219348383386200353279289863781914689213718885906625790220706881488790417221316157169855409250987079190460350015481586813512039037535289291579056205726910499898661617031008706396209617091204531116949920593847077672331961317425009722508442567669085698240700088005672462081882450306112572546168439949825512731345226996409760915240436273285650388336100791137541790094004463459280353971412553340290683522814650335103764350656522693704094403938662704690236015712065918893144811013338120513317052745548880252707700177685634649314750794749028702927774457877552737292325699541986429967842950742638992295340312748350751547932744298825188896145392297230151064356321
assertException(function () {new Decimal('2', 0).toString()}, "('2', 0)");
assertException(function () {new Decimal('2', 2).toString()}, "('2', 2)");
assertException(function () {new Decimal('2', '-2').toString()}, "('2', '-2')");
assertException(function () {new Decimal('0.000g', 16).toString()}, "('0.000g', 16)");
assertException(function () {new Decimal('453.43', 4).toString()}, "('453.43', 4)");
assertException(function () {new Decimal('1', 1).toString()}, "('1', 1)");
assertException(function () {new Decimal('1.23', 36.01).toString()}, "('1.23', 36.01)");
assertException(function () {new Decimal('1.23', 65).toString()}, "('1.23', 65)");
assertException(function () {new Decimal(12.345, NaN).toString()}, "(12.345, NaN)");
assertException(function () {new Decimal(12.345, 'NaN').toString()}, "(12.345, 'NaN')");
assertException(function () {new Decimal(12.345, []).toString()}, "(12.345, [])");
assertException(function () {new Decimal(12.345, {}).toString()}, "(12.345, {})");
assertException(function () {new Decimal(12.345, '').toString()}, "(12.345, '')");
assertException(function () {new Decimal(12.345, ' ').toString()}, "(12.345, ' ')");
assertException(function () {new Decimal(12.345, 'hello').toString()}, "(12.345, 'hello')");
assertException(function () {new Decimal(12.345, '\t').toString()}, "(12.345, '\t')");
assertException(function () {new Decimal(12.345, new Date).toString()}, "(12.345, new Date)");
assertException(function () {new Decimal(12.345, new RegExp).toString()}, "(12.345, new RegExp)");
assertException(function () {new Decimal(101, 2.02).toString()}, "(101, 2.02)");
assertException(function () {new Decimal(12.345, 10.5).toString()}, "(12.345, 10.5)");
T('NaN', 'NaN', undefined, 20, 4);
T('NaN', 'NaN', null, 20, 4);
T('NaN', NaN, 2, 20, 4);
T('NaN', '-NaN', 2, 20, 4);
T('NaN', -NaN, 10, 20, 4);
T('NaN', 'NaN', 10, 20, 4);
T('12.345', 12.345, new Decimal(10), 20, 4);
T('12.345', 12.345, null, 20, 4);
T('12.345', 12.345, '1e1', 20, 4);
T('12.345', 12.345, undefined, 20, 4);
T('Infinity', 'Infinity', 2, 20, 4);
T('Infinity', 'Infinity', 10, 20, 4);
T('-Infinity', '-Infinity', 2, 20, 4);
T('-Infinity', '-Infinity', 10, 20, 4);
T('101725686101180', '101725686101180', undefined, 20, 4);
T('101725686101180', '101725686101180', 10, 20, 4);
Decimal.errors = false;
T('2', '2', 0, 20, 4);
T('NaN', '2', 2, 20, 4);
T('2', '2', '-2', 20, 4);
T('NaN', '0.000g', 16, 20, 4);
T('NaN', '453.43', 4, 20, 4);
T('1', '1', 1, 20, 4);
T('1.23', '1.23', 65, 20, 4);
T('NaN', 'NaN', 'NaN', 20, 4);
T('NaN', 'NaN', undefined, 20, 4);
T('NaN', 'NaN', null, 20, 4);
T('NaN', NaN, 2, 20, 4);
T('NaN', '-NaN', 2, 20, 4);
T('NaN', -NaN, 10, 20, 4);
T('NaN', 'NaN', 10, 20, 4);
T('12.345', 12.345, new Decimal(10), 20, 4);
T('12.345', 12.345, null, 20, 4);
T('12.345', 12.345, undefined, 20, 4);
T('12.345', 12.345, NaN, 20, 4);
T('12.345', 12.345, 'NaN', 20, 4);
T('12.345', 12.345, [], 20, 4);
T('12.345', 12.345, {}, 20, 4);
T('12.345', 12.345, '', 20, 4);
T('12.345', 12.345, ' ', 20, 4);
T('12.345', 12.345, 'hello', 20, 4);
T('12.345', 12.345, '\t', 20, 4);
T('12.345', 12.345, new Date, 20, 4);
T('12.345', 12.345, new RegExp, 20, 4);
T('5', 101, 2.02, 20, 4);
T('12.345', 12.345, 10.5, 20, 4);
T('12.345', 12.345, '1e1', 20, 4);
T('Infinity', 'Infinity', 2, 20, 4);
T('Infinity', Infinity, 10, 20, 4);
T('-Infinity', -Infinity, 2, 20, 4);
T('-Infinity', '-Infinity', 10, 20, 4);
T('101725686101180', '101725686101180', undefined, 20, 4);
T('101725686101180', '101725686101180', 10, 20, 4);
log('\n ' + passed + ' of ' + total + ' tests passed in ' + (+new Date() - start) + ' ms \n');
return [passed, total];
})(this.Decimal);
if (typeof module !== 'undefined' && module.exports) module.exports = count;