BigNumber.js 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644
  1. if (typeof Test === 'undefined') require('../tester');
  2. Test('bigNumber', function () {
  3. var t = function (expected, value){
  4. Test.areEqual(expected, String(value));
  5. }
  6. function tx(fn, msg){
  7. Test.isException(fn, msg);
  8. }
  9. BigNumber.config({
  10. DECIMAL_PLACES: 20,
  11. ROUNDING_MODE: 4,
  12. EXPONENTIAL_AT: 1E9,
  13. RANGE: 1E9,
  14. ALPHABET: '0123456789abcdefghijklmnopqrstuvwxyz'
  15. });
  16. // Parsing tests
  17. t('Infinity', new BigNumber('1e10000000000'));
  18. t('-Infinity', new BigNumber('-1e10000000000'));
  19. t('0', new BigNumber('1e-10000000000'));
  20. t('0', new BigNumber('-1e-10000000000'));
  21. t('NaN', new BigNumber(NaN));
  22. t('NaN', new BigNumber(-NaN));
  23. t('NaN', new BigNumber(+NaN));
  24. t('NaN', new BigNumber('NaN'));
  25. t('NaN', new BigNumber(' NaN'));
  26. t('NaN', new BigNumber('NaN '));
  27. t('NaN', new BigNumber(' NaN '));
  28. t('NaN', new BigNumber('+NaN'));
  29. t('NaN', new BigNumber(' +NaN'));
  30. t('NaN', new BigNumber('+NaN '));
  31. t('NaN', new BigNumber(' +NaN '));
  32. t('NaN', new BigNumber('-NaN'));
  33. t('NaN', new BigNumber(' -NaN'));
  34. t('NaN', new BigNumber('-NaN '));
  35. t('NaN', new BigNumber(' -NaN '));
  36. tx(function () {new BigNumber('+ NaN')}, "+ NaN");
  37. tx(function () {new BigNumber('- NaN')}, "- NaN");
  38. tx(function () {new BigNumber(' + NaN')}, " + NaN");
  39. tx(function () {new BigNumber(' - NaN')}, " - NaN");
  40. tx(function () {new BigNumber('. NaN')}, ". NaN");
  41. tx(function () {new BigNumber('.-NaN')}, ".-NaN");
  42. tx(function () {new BigNumber('.+NaN')}, ".+NaN");
  43. tx(function () {new BigNumber('-.NaN')}, "-.NaN");
  44. tx(function () {new BigNumber('+.NaN')}, "+.NaN");
  45. t('Infinity', new BigNumber(Infinity));
  46. t('-Infinity', new BigNumber(-Infinity));
  47. t('Infinity', new BigNumber(+Infinity));
  48. t('Infinity', new BigNumber('Infinity'));
  49. t('Infinity', new BigNumber(' Infinity'));
  50. t('Infinity', new BigNumber('Infinity '));
  51. t('Infinity', new BigNumber(' Infinity '));
  52. t('Infinity', new BigNumber('+Infinity'));
  53. t('Infinity', new BigNumber(' +Infinity'));
  54. t('Infinity', new BigNumber('+Infinity '));
  55. t('Infinity', new BigNumber(' +Infinity '));
  56. t('-Infinity', new BigNumber('-Infinity'));
  57. t('-Infinity', new BigNumber(' -Infinity'));
  58. t('-Infinity', new BigNumber('-Infinity '));
  59. t('-Infinity', new BigNumber(' -Infinity '));
  60. tx(function () {new BigNumber('+ Infinity')}, "+ Infinity");
  61. tx(function () {new BigNumber(' + Infinity')}, " + Infinity");
  62. tx(function () {new BigNumber('- Infinity')}, "- Infinity");
  63. tx(function () {new BigNumber(' - Infinity')}, " - Infinity");
  64. tx(function () {new BigNumber('.Infinity')}, ".Infinity");
  65. tx(function () {new BigNumber('. Infinity')}, ". Infinity");
  66. tx(function () {new BigNumber('.-Infinity')}, ".-Infinity");
  67. tx(function () {new BigNumber('.+Infinity')}, ".+Infinity");
  68. tx(function () {new BigNumber('-.Infinity')}, "-.Infinity");
  69. tx(function () {new BigNumber('+.Infinity')}, "+.Infinity");
  70. t('0', new BigNumber(0));
  71. t('0', new BigNumber(-0));
  72. t('0', new BigNumber('.0'));
  73. t('0', new BigNumber('0.'));
  74. t('0', new BigNumber('-0.'));
  75. t('0', new BigNumber('+0.'));
  76. t('0', new BigNumber('+0'));
  77. t('0', new BigNumber('-0'));
  78. t('0', new BigNumber(' +0'));
  79. t('0', new BigNumber(' -0'));
  80. t('0', new BigNumber(' +0 '));
  81. t('0', new BigNumber(' -0 '));
  82. t('0', new BigNumber('+.0'));
  83. t('0', new BigNumber('-.0'));
  84. t('0', new BigNumber(' +.0'));
  85. t('0', new BigNumber(' -.0'));
  86. t('0', new BigNumber(' +.0 '));
  87. t('0', new BigNumber(' -.0 '));
  88. tx(function () {new BigNumber('+-0')}, "+-0");
  89. tx(function () {new BigNumber('-+0')}, "-+0");
  90. tx(function () {new BigNumber('--0')}, "--0");
  91. tx(function () {new BigNumber('++0')}, "++0");
  92. tx(function () {new BigNumber('.-0')}, ".-0");
  93. tx(function () {new BigNumber('.+0')}, ".+0");
  94. tx(function () {new BigNumber('0 .')}, "0 .");
  95. tx(function () {new BigNumber('. 0')}, ". 0");
  96. tx(function () {new BigNumber('..0')}, "..0");
  97. tx(function () {new BigNumber('+.-0')}, "+.-0");
  98. tx(function () {new BigNumber('-.+0')}, "-.+0");
  99. tx(function () {new BigNumber('+. 0')}, "+. 0");
  100. tx(function () {new BigNumber('-. 0')}, "-. 0");
  101. t('2', new BigNumber('+2'));
  102. t('-2', new BigNumber('-2'));
  103. t('2', new BigNumber(' +2'));
  104. t('-2', new BigNumber(' -2'));
  105. t('2', new BigNumber(' +2 '));
  106. t('-2', new BigNumber(' -2 '));
  107. t('0.2', new BigNumber('.2'));
  108. t('2', new BigNumber('2.'));
  109. t('-2', new BigNumber('-2.'));
  110. t('2', new BigNumber('+2.'));
  111. t('0.2', new BigNumber('+.2'));
  112. t('-0.2', new BigNumber('-.2'));
  113. t('0.2', new BigNumber(' +.2'));
  114. t('-0.2', new BigNumber(' -.2'));
  115. t('0.2', new BigNumber(' +.2 '));
  116. t('-0.2', new BigNumber(' -.2 '));
  117. tx(function () {new BigNumber('+-2')}, "+-2");
  118. tx(function () {new BigNumber('-+2')}, "-+2");
  119. tx(function () {new BigNumber('--2')}, "--2");
  120. tx(function () {new BigNumber('++2')}, "++2");
  121. tx(function () {new BigNumber('.-2')}, ".-2");
  122. tx(function () {new BigNumber('.+2')}, ".+2");
  123. tx(function () {new BigNumber('2 .')}, "2 .");
  124. tx(function () {new BigNumber('. 2')}, ". 2");
  125. tx(function () {new BigNumber('..2')}, "..2");
  126. tx(function () {new BigNumber('+.-2')}, "+.-2");
  127. tx(function () {new BigNumber('-.+2')}, "-.+2");
  128. tx(function () {new BigNumber('+. 2')}, "+. 2");
  129. tx(function () {new BigNumber('-. 2')}, "-. 2");
  130. tx(function () {new BigNumber('+2..')}, "+2..");
  131. tx(function () {new BigNumber('-2..')}, "-2..");
  132. tx(function () {new BigNumber('-.2.')}, "-.2.");
  133. tx(function () {new BigNumber('+.2.')}, "+.2.");
  134. tx(function () {new BigNumber('.-20.')}, ".-20.");
  135. tx(function () {new BigNumber('.+20.')}, ".+20.");
  136. tx(function () {new BigNumber('. 20.')}, ". 20.");
  137. tx(function () {new BigNumber(undefined)}, "undefined");
  138. tx(function () {new BigNumber([])}, "[]");
  139. tx(function () {new BigNumber('')}, "''");
  140. tx(function () {new BigNumber(null)}, "null");
  141. tx(function () {new BigNumber(' ')}, "' '");
  142. tx(function () {new BigNumber('nan')}, "nan");
  143. tx(function () {new BigNumber('23er')}, "23er");
  144. tx(function () {new BigNumber('e4')}, "e4");
  145. tx(function () {new BigNumber('0x')}, "0x");
  146. tx(function () {new BigNumber('0x.')}, "0x.");
  147. tx(function () {new BigNumber('+0x')}, "+0x");
  148. tx(function () {new BigNumber('.0x1')}, ".0x1");
  149. tx(function () {new BigNumber('.0x1', 16)}, ".0x1, 16");
  150. tx(function () {new BigNumber('. 0x1')}, ". 0x1");
  151. tx(function () {new BigNumber('0x1', 15)}, "0x1, 15");
  152. tx(function () {new BigNumber('0b')}, "0b");
  153. tx(function () {new BigNumber('+0b')}, "+0b");
  154. tx(function () {new BigNumber('0b.')}, "0b.");
  155. tx(function () {new BigNumber('.0b1')}, ".0b1");
  156. tx(function () {new BigNumber('. 0b1 ')}, ". 0b1 ");
  157. tx(function () {new BigNumber('0b1', 3)}, "0b1, 3");
  158. tx(function () {new BigNumber('0o')}, "0o");
  159. tx(function () {new BigNumber('0o.')}, "0o.");
  160. tx(function () {new BigNumber('.0o1')}, ".0o1");
  161. tx(function () {new BigNumber('.0o1')}, ".0o1");
  162. tx(function () {new BigNumber('0 o1')}, "0 o1");
  163. tx(function () {new BigNumber('0o 1')}, "0o 1");
  164. tx(function () {new BigNumber('0-o1')}, "0o-1");
  165. tx(function () {new BigNumber('0o1', 16)}, "0o1, 16");
  166. tx(function () {new BigNumber('--45')}, "--45");
  167. tx(function () {new BigNumber('+-2')}, "+-2");
  168. tx(function () {new BigNumber('0 0')}, "0 0");
  169. t('15', new BigNumber('0xf', 16));
  170. t('-10', new BigNumber('-0xa'));
  171. t('255', new BigNumber('0xff'));
  172. t('-3294', new BigNumber('-0xcde'));
  173. t('15.5', new BigNumber('0xf.8'));
  174. t('1', new BigNumber('0b1.', 2));
  175. t('0', new BigNumber('0b0'));
  176. t('-1', new BigNumber('-0b1'));
  177. t('3', new BigNumber('0b11'));
  178. t('-11', new BigNumber('-0b1011'));
  179. t('1.5', new BigNumber('0b1.1'));
  180. t('-1', new BigNumber(' -0o1 ', 8));
  181. t('0', new BigNumber('-0o0'));
  182. t('1', new BigNumber('0o1'));
  183. t('63', new BigNumber('0o77'));
  184. t('-102', new BigNumber('-0o146'));
  185. t('0.5', new BigNumber('0o0.4'));
  186. t('0', new BigNumber({ s: 1, e: 0, c: [0], _isBigNumber: true }));
  187. t('0', new BigNumber({ s: -1, e: 0, c: [0], _isBigNumber: true }));
  188. t('1', new BigNumber({ s: 1, e: 0, c: [1], _isBigNumber: true }));
  189. t('-1', new BigNumber({ s: -1, e: 0, c: [1], _isBigNumber: true }));
  190. t('99999999999999', new BigNumber({ s: 1, e: 13, c: [99999999999999], _isBigNumber: true }));
  191. t('-99999999999999', new BigNumber({ s: -1, e: 13, c: [99999999999999], _isBigNumber: true }));
  192. t('100000000000000', new BigNumber({ s: 1, e: 14, c: [1], _isBigNumber: true }));
  193. t('-100000000000000', new BigNumber({ s: -1, e: 14, c: [1], _isBigNumber: true }));
  194. t('99999999999999.9', new BigNumber({ s: 1, e: 13, c: [99999999999999, 90000000000000], _isBigNumber: true }));
  195. t('99999999999999.99', new BigNumber({ s: 1, e: 13, c: [99999999999999, 99000000000000], _isBigNumber: true }));
  196. t('99999999999999.999', new BigNumber({ s: 1, e: 13, c: [99999999999999, 99900000000000], _isBigNumber: true }));
  197. t('99999999999999.9999', new BigNumber({ s: 1, e: 13, c: [99999999999999, 99990000000000], _isBigNumber: true }));
  198. t('99999999999999.99999', new BigNumber({ s: 1, e: 13, c: [99999999999999, 99999000000000], _isBigNumber: true }));
  199. t('99999999999999.999999', new BigNumber({ s: 1, e: 13, c: [99999999999999, 99999900000000], _isBigNumber: true }));
  200. t('99999999999999.9999999', new BigNumber({ s: 1, e: 13, c: [99999999999999, 99999990000000], _isBigNumber: true }));
  201. t('99999999999999.99999999', new BigNumber({ s: 1, e: 13, c: [99999999999999, 99999999000000], _isBigNumber: true }));
  202. t('99999999999999.999999999', new BigNumber({ s: 1, e: 13, c: [99999999999999, 99999999900000], _isBigNumber: true }));
  203. t('99999999999999.9999999999', new BigNumber({ s: 1, e: 13, c: [99999999999999, 99999999990000], _isBigNumber: true }));
  204. t('99999999999999.99999999999', new BigNumber({ s: 1, e: 13, c: [99999999999999, 99999999999000], _isBigNumber: true }));
  205. t('99999999999999.999999999999', new BigNumber({ s: 1, e: 13, c: [99999999999999, 99999999999900], _isBigNumber: true }));
  206. t('99999999999999.9999999999999', new BigNumber({ s: 1, e: 13, c: [99999999999999, 99999999999990], _isBigNumber: true }));
  207. t('99999999999999.99999999999999', new BigNumber({ s: 1, e: 13, c: [99999999999999, 99999999999999], _isBigNumber: true }));
  208. t('99999999999999.00000000000009', new BigNumber({ s: 1, e: 13, c: [99999999999999, 9], _isBigNumber: true }));
  209. t('99999999999999.123456789876543', new BigNumber({ s: 1, e: 13, c: [99999999999999, 12345678987654, 30000000000000], _isBigNumber: true }));
  210. t('9999999.9999999123456789876543', new BigNumber({ s: 1, e: 6, c: [99999999999999, 12345678987654, 30000000000000], _isBigNumber: true })); // malformed
  211. t('9999999.9999999123456789876543', new BigNumber({ s: 1, e: 6, c: [9999999999999, 91234567898765, 43000000000000], _isBigNumber: true })); // malformed
  212. t('9999999.9999999123456789876543', new BigNumber({ s: 1, e: 6, c: [999999999999, 99123456789876, 54300000000000], _isBigNumber: true })); // malformed
  213. t('9999999.9999999123456789876543', new BigNumber({ s: 1, e: 6, c: [99999999999, 99912345678987, 65430000000000], _isBigNumber: true })); // malformed
  214. t('9999999.9999999123456789876543', new BigNumber({ s: 1, e: 6, c: [9999999999, 99991234567898, 76543000000000], _isBigNumber: true })); // malformed
  215. t('9999999.9999999123456789876543', new BigNumber({ s: 1, e: 6, c: [999999999, 99999123456789, 87654300000000], _isBigNumber: true })); // malformed
  216. t('9999999.9999999123456789876543', new BigNumber({ s: 1, e: 6, c: [99999999, 99999912345678, 98765430000000], _isBigNumber: true })); // malformed
  217. t('9999999.9999999123456789876543', new BigNumber({ s: 1, e: 6, c: [9999999, 99999991234567, 89876543000000], _isBigNumber: true })); // well-formed
  218. t('9999999.9999999123456789876543', new BigNumber({ s: 1, e: 6, c: [999999, 99999999123456, 78987654300000], _isBigNumber: true })); // malformed
  219. t('9999999.9999999123456789876543', new BigNumber({ s: 1, e: 6, c: [99999, 99999999912345, 67898765430000], _isBigNumber: true })); // malformed
  220. t('9999999.9999999123456789876543', new BigNumber({ s: 1, e: 6, c: [9999, 99999999991234, 56789876543000], _isBigNumber: true })); // malformed
  221. t('9999999.9999999123456789876543', new BigNumber({ s: 1, e: 6, c: [999, 99999999999123, 45678987654300], _isBigNumber: true })); // malformed
  222. t('9999999.9999999123456789876543', new BigNumber({ s: 1, e: 6, c: [99, 99999999999912, 34567898765430], _isBigNumber: true })); // malformed
  223. t('9999999.9999999123456789876543', new BigNumber({ s: 1, e: 6, c: [9, 99999999999991, 23456789876543], _isBigNumber: true })); // malformed
  224. t('9999999999999912345678.9876543', new BigNumber({ s: 1, e: 21, c: [99999999, 99999912345678, 98765430000000], _isBigNumber: true })); // well-formed
  225. t('100002222.2222333322', new BigNumber({ s: 1, e: 8, c: [100002222, 22223333220000], _isBigNumber: true }));
  226. t('7777777777.123123123', new BigNumber({ s: 1, e: 9, c: [7777777777, 12312312300000], _isBigNumber: true }));
  227. t('NaN', new BigNumber({ s: null, e: null, c: null, _isBigNumber: true }))
  228. t('Infinity', new BigNumber({ s: 1, e: null, c: null, _isBigNumber: true }))
  229. t('-Infinity', new BigNumber({ s: -1, e: null, c: null, _isBigNumber: true }))
  230. // Base-conversion tests
  231. //var alphabet = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_';
  232. t = function (expected, value, base) {
  233. //if (base) BigNumber.config({ ALPHABET: alphabet.slice(0, base) });
  234. Test.areEqual(expected, new BigNumber(value, base).toString())
  235. }
  236. // Test integers of all bases against Number.toString(base).
  237. for (var i = 2; i < 37; i++) {
  238. for (var j = -100; j < 101; j++) {
  239. t(j.toString(), j.toString(i), i);
  240. var k = Math.floor(Math.random() * Math.pow(2, Math.floor(Math.random() * 52) + 1));
  241. t(k.toString(), k.toString(i), i);
  242. }
  243. }
  244. t('0', 0, 2);
  245. t('0', 0, 10);
  246. t('0', -0, 36);
  247. t('-5', -101, 2);
  248. t('-101', -101, 10);
  249. // Test numbers with fraction digits
  250. // Test rounding.
  251. BigNumber.config({DECIMAL_PLACES: 0, ROUNDING_MODE: 0});
  252. t('1', '0.1', 2);
  253. t('-1', '-0.1', 2);
  254. t('1000', '999.5', 10);
  255. t('-1000', '-999.5', 10);
  256. BigNumber.config({ROUNDING_MODE: 1});
  257. t('0', '0.1', 2);
  258. t('0', '-0.1', 2);
  259. t('999', '999.5', 10);
  260. t('-999', '-999.5', 10);
  261. BigNumber.config({ROUNDING_MODE: 2});
  262. t('1', '0.1', 2);
  263. t('0', '-0.1', 2);
  264. t('1000', '999.5', 10);
  265. t('-999', '-999.5', 10);
  266. BigNumber.config({ROUNDING_MODE: 3});
  267. t('0', '0.1', 2);
  268. t('-1', '-0.1', 2);
  269. t('999', '999.5', 10);
  270. t('-1000', '-999.5', 10);
  271. BigNumber.config({ROUNDING_MODE: 4});
  272. t('1', '0.1', 2);
  273. t('-1', '-0.1', 2);
  274. t('1000', '999.5', 10);
  275. t('-1000', '-999.5', 10);
  276. BigNumber.config({ROUNDING_MODE: 5});
  277. t('0', '0.1', 2);
  278. t('0', '-0.1', 2);
  279. t('999', '999.5', 10);
  280. t('-999', '-999.5', 10);
  281. BigNumber.config({ROUNDING_MODE: 6});
  282. t('0', '0.1', 2);
  283. t('0', '-0.1', 2);
  284. t('1000', '999.5', 10);
  285. t('-1000', '-999.5', 10);
  286. t('999', '999.4', 10);
  287. t('-999', '-999.4', 10);
  288. t('1000', '999.500001', 10);
  289. t('-1000', '-999.500001', 10);
  290. BigNumber.config({ROUNDING_MODE: 7});
  291. t('1', '0.1', 2);
  292. t('0', '-0.1', 2);
  293. t('1000', '999.5', 10);
  294. t('-999', '-999.5', 10);
  295. BigNumber.config({ROUNDING_MODE: 8});
  296. t('0', '0.1', 2);
  297. t('-1', '-0.1', 2);
  298. t('999', '999.5', 10);
  299. t('-1000', '-999.5', 10);
  300. BigNumber.config({DECIMAL_PLACES: 20, ROUNDING_MODE: 3});
  301. t('546141272243.39871532041499605905', '111111100101000100011100111100010110011.011001100001001000110101000011011001100010111000110000101011000010100010110111100010010000011010100100001111010010100', 2);
  302. t('-761392382117509615082995635394.835132598876953125', '-1001100111000011000100000100010111000100100100101110010100101000000110101101100101101101010011000010.110101011100101101000', 2);
  303. t('18181', '100011100000101.00', 2);
  304. t('-12.5', '-1100.10', 2);
  305. t('43058907596428432974475252.68192645050244227178', '10001110011110000101000000111011011100000010011100000001111011111011101110111111110100.10101110100100101011101101011011001011110111001101', 2);
  306. t('-50063197524405820261198.16624174237994681863', '-1010100110011110111001101110101001100100001000111000001111110000001101001110.001010101000111011010001100111101100000001111110011001111100001101111001', 2);
  307. t('12659149135078325508.50965366452082459802', '1010111110101110010101010001000100111011000010010111110100000100.100000100111100010101001100111010110011101001011100101110', 2);
  308. t('-6387062313767439324325.28595431079156696797', '-1010110100011111001001011101001100100001111011000110000100101010010100101.0100100100110100010011010011110100', 2);
  309. t('1396.09066858848154879524', '10101110100.0001011100110110000011100111111001001101100', 2);
  310. t('-13243297892469.48301514260489275543', '-11000000101101110010000100010000100001110101.0111101110100110111000010110000011110101111101100110', 2);
  311. t('343872.5', '1010011111101000000.10', 2);
  312. t('-27858197522682350277663998.90234375', '-1011100001011001100111110100111101101100011110100111111111001110111101001110011111110.111001110', 2);
  313. t('11350269087477005972403595905463622183936313327592261705214528.375', '11100010000001100111100001010001011000011110001001101101000011011111011100111010110101011100111001110110111111001001000111101000100100011110011011110011001011101010001100001001111010111110010101001000000.011', 2);
  314. t('-4582111067006609431937422134.8848765093534893822', '-11101100111000111011110000101010101111000001100010100011111001000111010110000001001100110110.11100010100001110100010001010100101011', 2);
  315. t('517236958880385002164572266126922644', '11000111001110111000000001111111110000110111101111101110011100111000000111101011000000001100011110010000101001110010100', 2);
  316. t('-21553306071707458208211095787817816237164981584743591.29723221556402690258', '-111001100110110101111011010110011000011000100110010000110101110110101011101011100001010010101000000110111100101000110100111001000111001101111100100110111001010100110010100111.01001100000101110110100100010101001010100100010100101', 2);
  317. BigNumber.config({DECIMAL_PLACES: 20, ROUNDING_MODE: 6});
  318. t('90182851032808914967166718343839124510737262515334936.05372908711433410645', '11110001000010011001110001010101001001001000011011110000101001011001110011010100000001001000011000010101101101000111110111101000001101000101100000101011100110000010111100011000.0000110111000001001100001', 2);
  319. t('-328.28125', '-101001000.010010', 2);
  320. t('606266547022938105478897519250152.63383591632958904971', '1110111100100001010001101110110111100101000011011110001111001011010010100111110100011000101110100101011101000.1010001001000011000100100001001110101010011100000110001', 2);
  321. t('-1236693955.36249679178679391345', '-1001001101101100111001111000011.010111001100110010010110111110011010000100010011010101010111111100000101001010101', 2);
  322. t('6881574.93937801730607199391', '11010010000000100100110.1111000001111011000100111110011011101001001100001101001011001010111', 2);
  323. t('-341919.144535064697265625', '-1010011011110011111.0010010100000000010', 2);
  324. t('97.10482025146484375', '1100001.000110101101010110000', 2);
  325. t('-120914.40625', '-11101100001010010.01101', 2);
  326. t('8080777260861123367657', '1101101100000111101001111111010001111010111011001010100101001001011101001', 2);
  327. t('-284229731050264281.85682739554010822758', '-1111110001110010010110111100111001110110110001011011011001.11011011010110010000101001001010001010010110', 2);
  328. t('1243984453515709828041525111137171813652.844970703125', '1110100111110111101011000011100001010011001110000000111100101100010010000100010000101010011101011011001000001111100011010100010100.110110000101', 2);
  329. t('-4208558618976524911747722597.24609066132409893216', '-11011001100100111100111100111110001011100111101001010011111110000111001100101110110101100101.00111110111111111100110000101110001111001110111010101110000111110100111001110011010001101111001101011000001011100101111011110000001101001111000', 2);
  330. t('1268683183361093666211101090.703125', '1000001100101101110000111010010111000000111000111110001110111001010100000111111100110100010.10110100', 2);
  331. t('-105641.26311671037711231997', '-11001110010101001.010000110101101110011101111000100001100111001110000111000011001001001000110101110001101111001101000000111000011100001001011101111100001011101010111101100010010001110111001110101010110001101110010011', 2);
  332. t('473340007892909227396827894000137.5', '1011101010110011001000000110110101100101110011110011001100111100110101100011010101000010000000010101000001001.1000', 2);
  333. t('-32746.47657717438337214735', '-111111111101010.011110100000000011110110001100011111111100100101111010110001110100001011010010001011101111001100110011001010010110001000111100011100', 2);
  334. t('192.49070453643798828125', '11000000.01111101100111101101000', 2);
  335. t('-1379984360196.47138547711438150145', '-10100000101001101011110100100001100000100.01111000101011001011011111111000000001', 2);
  336. BigNumber.config({DECIMAL_PLACES: 40, ROUNDING_MODE: 2});
  337. t('-729.0001524157902758725803993293705227861606', '-1000000.00000001', 3);
  338. t('-4096.0000152587890625', '-1000000.00000001', 4);
  339. t('-15625.00000256', '-1000000.00000001', 5);
  340. t('-46656.0000005953741807651272671848803536046334', '-1000000.00000001', 6);
  341. t('-117649.0000001734665255574303432156634721649541', '-1000000.00000001', 7);
  342. t('-262144.000000059604644775390625', '-1000000.00000001', 8);
  343. t('-531441.0000000232305731254187746379102835730507', '-1000000.00000001', 9);
  344. t('-1000000.00000001', '-1000000.00000001', 10);
  345. t('-1771561.0000000046650738020973341431092840981941', '-1000000.00000001', 11);
  346. t('-2985984.000000002325680393613778387440938881268', '-1000000.00000001', 12);
  347. t('-4826809.0000000012258947398402566721524761600832', '-1000000.00000001', 13);
  348. t('-7529536.0000000006776036154587122781861854381443', '-1000000.00000001', 14);
  349. t('-11390625.0000000003901844231062338058222831885383', '-1000000.00000001', 15);
  350. t('-16777216.00000000023283064365386962890625', '-1000000.00000001', 16);
  351. t('-24137569.0000000001433536083296850401481727781882', '-1000000.00000001', 17);
  352. t('-34012224.0000000000907444262711670884293370452072', '-1000000.00000001', 18);
  353. t('-47045881.0000000000588804597472215429921222500439', '-1000000.00000001', 19);
  354. t('-64000000.0000000000390625', '-1000000.00000001', 20);
  355. t('-85766121.0000000000264390375792455941496210138949', '-1000000.00000001', 21);
  356. t('-113379904.0000000000182229445394427114965206410085', '-1000000.00000001', 22);
  357. t('-148035889.0000000000127696005408659110598172017909', '-1000000.00000001', 23);
  358. t('-191102976.0000000000090846890375538218259411675049', '-1000000.00000001', 24);
  359. t('-244140625.0000000000065536', '-1000000.00000001', 25);
  360. t('-308915776.0000000000047886513275010026255956100003', '-1000000.00000001', 26);
  361. t('-387420489.0000000000035407061614721497695336509027', '-1000000.00000001', 27);
  362. t('-481890304.0000000000026468891228855948366647868677', '-1000000.00000001', 28);
  363. t('-594823321.000000000001999014833671504164315094574', '-1000000.00000001', 29);
  364. t('-729000000.0000000000015241579027587258039932937052', '-1000000.00000001', 30);
  365. t('-887503681.0000000000011724827159637921277158030113', '-1000000.00000001', 31);
  366. t('-1073741824.0000000000009094947017729282379150390625', '-1000000.00000001', 32);
  367. t('-1291467969.0000000000007110309102419347878538765581', '-1000000.00000001', 33);
  368. t('-1544804416.0000000000005599750325378321880787999147', '-1000000.00000001', 34);
  369. t('-1838265625.0000000000004440743054270216786320984887', '-1000000.00000001', 35);
  370. t('-2176782336.0000000000003544704151217464391770978328', '-1000000.00000001', 36);
  371. BigNumber.config({DECIMAL_PLACES: 51, ROUNDING_MODE: 4});
  372. t('1072424547177.982891327541533302850175278158817253467459228776101', 'donxvwix.zdts', 36);
  373. BigNumber.config({DECIMAL_PLACES: 86});
  374. t('824178538787196749922434027872451367594239056.93473392033316110609748881918323116875731371037529199959272159196515804304815690839727', '402kfhkd37bt5n8scr1ir9ndlrnipig.s17oe7rkhi91bh', 30);
  375. BigNumber.config({DECIMAL_PLACES: 84});
  376. t('9560389177469634483515162.499335215204179931606951906984830542647805834768203380512715304247460734647288652625', '195qdkkqsa8shmhp9e.edr89', 29);
  377. BigNumber.config({DECIMAL_PLACES: 65});
  378. t('5955289028666603391738616069969.70235175643053599414353772852590894151261634747374296179598348968', '8qp28dk3js2iqksmqaqnq.lntnif5qh', 31);
  379. BigNumber.config({DECIMAL_PLACES: 49});
  380. t('27603501710202437282037.4945845176631161140013607910579053986520224457133', '42545302442500101544532043113.254455200225412543300022520330204033', 6);
  381. BigNumber.config({DECIMAL_PLACES: 39});
  382. t('9464300204295306111422098057.77248824166891668678144149703717008528', '25473f3dbce5cf3hg8318d7.dg52d120b14ea966a7ag06a2gh03', 18);
  383. BigNumber.config({DECIMAL_PLACES: 15});
  384. t('133262758349237628352120716402.993431117739119', '3bkobquqthhfbndsmv3i.vp8o0sc4ldtji02mmgqr7blpdjgk', 32);
  385. BigNumber.config({DECIMAL_PLACES: 65});
  386. t('171510920999634527633.53051379043557196404057602235264411208736518600450525086556631034', '1fqecn4264r1is.ijur8yj41twl9', 35);
  387. BigNumber.config({DECIMAL_PLACES: 48});
  388. t('325927753012307620476767402981591827744994693483231017778102969592507', 'c16de7aa5bf90c3755ef4dea45e982b351b6e00cd25a82dcfe0646abb', 16);
  389. BigNumber.config({DECIMAL_PLACES: 48});
  390. t('72783.559378210242248003991012349918599484318629885897', '11c4f.8f33690f15e13146d99092446da', 16);
  391. BigNumber.config({DECIMAL_PLACES: 81});
  392. t('8535432796511493691316991730196733707212461.36382685871580896850891461623808', '9l0ah4mf8a0kcgn44oji4kh7l6fbenb.929jlggo43612jfn', 25);
  393. BigNumber.config({DECIMAL_PLACES: 7});
  394. t('0', '0', 2);
  395. t('3', '3', 24);
  396. t('0.037037', '0.1', 27);
  397. t('101412023101671912143604060399016691636944374947585694881897391246499475847835837224977373985157443438754012038820105175407623679155088073411120684342336808325631625647896282357928709212286943830565579566232670291284084535962556769836340401310575784301282705195128879424575312893.9', '999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999.99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999991999999999999999999999999999999999999', 11);
  398. t('15398955012055570438.9425184', 'ST87ST87ST87S.S87TS87TS87TS', 30);
  399. t('2126934655697951.030303', '11111111111.1111111111111', 34);
  400. t('-288494149172542947905560340081675757349.9789739', '-P98IJYP96JHYP95DPHJWPH09Y.Y98HO8WH58HW', 35);
  401. BigNumber.config({DECIMAL_PLACES: 31});
  402. t('4060090888512781039564383580983002345701981946441239.3428571428571428571428571428571', '4hv6vl92gvkmumr0a6ley0dhkwmwfe35oo.c', 35);
  403. BigNumber.config({DECIMAL_PLACES: 90});
  404. t('20398136837.975941624007641435905199481124700109083958314345873245346912136478926756110974638825468924', '5MI4K5MF.MA66B0L4HK8DK35LI3D0G9JFF7LBB27LAKH3E4FCEJM', 23);
  405. BigNumber.config({DECIMAL_PLACES: 38});
  406. t('42689628837110945219.60963984922125154547359100149049425936', 'D37AFB2193DJ265.CGHI7F1BK1I9GJ', 21);
  407. BigNumber.config({DECIMAL_PLACES: 59});
  408. t('893835640746065892983175797034880314945754459977061255725623898879842611', '4231231434203102220114420330232412332321132204022241104411014023324140104333412232222433424401214430421', 5);
  409. BigNumber.config({DECIMAL_PLACES: 100});
  410. t('175', '67', 28);
  411. BigNumber.config({DECIMAL_PLACES: 59});
  412. t('683674717563732788139425742102304147', '23BXVQVK5NK29XCNPM7JWQQC', 35);
  413. BigNumber.config({DECIMAL_PLACES: 63});
  414. t('21872738004815869.777777777777777777777777777777777777777777777777777777777777778', 'E8NB0D88AN2D.IG', 24);
  415. BigNumber.config({DECIMAL_PLACES: 2});
  416. t('4839094569478687835499021764036676797809986482983355.46', '9G041CFCPN92FSECBIHHL1F1I74FJMGAKTR.EAJ7JQ', 31);
  417. BigNumber.config({DECIMAL_PLACES: 2});
  418. t('198496092814270915085258754228681831655498041942', '24310400201333231203024322334002413400114320223240014320424444320232', 5);
  419. BigNumber.config({DECIMAL_PLACES: 5});
  420. t('7371249.07083', '93089.23M993NGABNLEP', 30);
  421. BigNumber.config({DECIMAL_PLACES: 47});
  422. t('799580158552527670.51524163982781306375625835799992154433181428013', '1C5C994CD5A7E49A.7ADE19484CE921B8EE7', 15);
  423. BigNumber.config({DECIMAL_PLACES: 64});
  424. t('16165422251964685360633312857381850497426314130782805.0722805578590765752365085976081394656988159695365026477063128458', '184254BE3B14F86L7HPKEOIIJKHCQ3DDBCPG5.20IJJ', 28);
  425. BigNumber.config({DECIMAL_PLACES: 66});
  426. t('321903599394345741344181790866033344020400577177.313819548430693134687858394581066124770210878514089611637812764975', 'GKE2D93H4K55C41EA627I1867CEFFCHBHE8I.6C85JF7D0BFDJFK4K', 21);
  427. BigNumber.config({DECIMAL_PLACES: 38});
  428. t('66906978329149775053912152738679.85034153550858840284188803538614532877', '2011110022202010100200021000121022200222101110012102220102212010111.21122122002110012111112102002110221102120102', 3);
  429. BigNumber.config({DECIMAL_PLACES: 49});
  430. t('1334535467.5658391510074236740492770511046811319813437111801', '45033235646.365040260503443445435151335014', 7);
  431. BigNumber.config({DECIMAL_PLACES: 62});
  432. t('26234523211578269977959969', 'LMDG5KNKLAUCSCNH1.0', 32);
  433. BigNumber.config({DECIMAL_PLACES: 21});
  434. t('572315667420.390625', '10250053005734.31', 8);
  435. BigNumber.config({DECIMAL_PLACES: 0});
  436. t('135378457250661080667637636173904073793598540954140', '1002012000221022001212121111002202200112011211012200211202012002222102020101100001022121022011000222110010.012011121', 3);
  437. t('19121180169114878494408529193061279888621355', '30130433145052134410320001411315120554033203511455405455', 6);
  438. t('121756633', '1I0JBBC.F628AF202451951181911H3HGID95I855056I', 20);
  439. t('3943269', '7370130.225184', 9);
  440. t('491578', '1700072.2013436326', 8);
  441. t('7793119763346', '6A06CF7K7G.58CD39A32GE', 22);
  442. t('7529497809730458840', '4BI52A83H0F7720.6G912C3J4I6H7HI1I41', 20);
  443. t('46865454464741700656', 'BF6CDEA9FDBKKB.6G9A74QO718PHAK', 27);
  444. t('304', 'F4.18180D', 20);
  445. t('744', '453.61845741C18C5B7AC08A', 13);
  446. t('246', '77.MS', 34);
  447. t('191110529149', '2617704640174.75763527113244751520622', 8);
  448. t('6', '6.8E2FCGH', 18);
  449. t('11952558583', '49E4EDC8C.C86', 15);
  450. t('1486467157880871503427980640713668', 'C0776B7908614278DD33549496D36.539A196725', 14);
  451. t('13069', '5C43.B25BB7338', 13);
  452. t('811', 'R1.6', 30);
  453. t('1092443496', '1443DA51.G5FHF0121H2F', 19);
  454. t('995982886869648407459143', '1HJAHK0FKDN4LN29FI.3DDG4GCBBFJGOM648JBCCCBE5', 25);
  455. t('2563', '42D.9MBNBD3CHC961K4', 25);
  456. t('5165465768912078514086932864', '5165465768912078514086932864.15061794310893065985169641395', 10);
  457. t('5471', 'B6F.18F0HFAK', 22);
  458. t('10463269570005574', '2V0X3OKD7B9.VOFRSL', 36);
  459. t('303213556691515289188893743415846', '5AMIB6B7CEFJKJEL5H6CD1K5.H7996', 24);
  460. t('73885536580075722710224913630', '111011101011110010101110111100111100010011001101110011011001010001110110111100101100010011011101.1111100101011011100000101001010110110010001000000010100000111100001010100111110101', 2);
  461. t('72678037004728932464472011232185435761', '1J6F1EG58J959DDJ54HKBIHG6625B', 22);
  462. t('7', '111.01010000111000100001000010011011000100101010011111100110111011100011000000010110001010111000011000010110011101001010', 2);
  463. t('281006', '1000100100110101101.110001110000001100011001010100001110101111001100101111110011010100011110111010101000110000100010110010001011101010011000010000100001010100010100000000011010001011110101111110101101110100000000001', 2);
  464. t('8573576497511403672686', '1110100001100011001000110011111111011101101000100111100001101010001101101.11100010000011111000001110011100111', 2);
  465. t('40455365809845824222189300824558751', '1111100101010011010100000001111111110100101001001000000110111101001100011110001000011011101100010100100110010011110.10111100000011011111100110100101101111110001110100011100000000001111111001111100011011100011010', 2);
  466. t('46275491328393338072', '101000001000110011100100100010111101100011100011011101110011010111.10011001111111100010011010101101010001010001001000111100010101011101100011', 2);
  467. t('1433628110429482851535358742130957026457687710451052766168752', '11100100011000111101111111011100111100111011101101110010101011100111000110111010010011111010101010111010101011110111101010101000011010110011101111010011110011110111001010101001011010100000011010101111.10', 2);
  468. t('888', '1101111000.01110001001100110110011001000100101110001110101011110000100001101001000011010011111110111001001110100110001101011001011100101000000010010111111111111101101010110010101011010000101110000101100101100000101110011011000101110101', 2);
  469. t('1901556394517909524025875', '110010010101010111001010000100101110100000111100010000110000001011001001000010011.0010111010110101000001000001101010001100111101111100111010011011001000100000111010011011101110010000', 2);
  470. t('260195957172449000', '1110011100011001101101100000101111010000011010111011101000.000100000111110001011101010011011010100011100110111010101001010101000011110101100010100111100100110000110101', 2);
  471. t('654853', '10011111111000000101.000100010010100101001111011111101101010010001000100110110101110110010111010110000110010001001101010010110010110100101011100011101001110111000111000010001001100', 2);
  472. t('186', '10111001.11001111010', 2);
  473. t('45580573', '10101101111000000100011100.1010101100100100101110001110001111101010110011101110001000000100111011011101011011', 2);
  474. t('74504933', '100011100001101101011100100.1110010001101110101110100000110010010100000111101100100011011001011011111', 2);
  475. t('2', '10.001010111110111010100000011010000001011010110111001010001110100110111001100100001000011110101100101', 2);
  476. t('10653067', '101000101000110110001011.0001110000101000100000101011010100000001011100001111110001101001110110111011010000011011000000100011', 2);
  477. t('3103819016502701158728118887794', '100111001011001111101011101010010100101011001111011000001000110100100001001011110010001110010101110001.111111100111100100100111001000101011110011110011000000000001101010111101100010100010100001100000101110100111010000010011001', 2);
  478. t('70726621184417493343184041374', '111001001000011110110000100110010000100100000101010100001010011100110000100100110011010110011110.0101000011101101100111001110000111010111010111101101101100000101011010001011010111010', 2);
  479. t('4639750624206524979284798532410213523141234414', '11010000000011011011100110011110101101001101111100011101110100111010111000110000010010000001101010101110011101110011101101000111011101010000111011101101.11111111000111101101010110010011', 2);
  480. t('2377749182359', '100010100110011100111001010011011110010110.11010', 2);
  481. t('26', '11001.100111001011111001010011010101011000110110111100011100101101101111000001101001000011101', 2);
  482. t('389501027984', '101101010110000000100100000011010010000.01010001000000010100011101101100001111011001', 2);
  483. t('5169', '1010000110001.0010001010100001011111010000111010001110110111011111110001010000100100010110000110111001110101100011110100110100111001011100100111101000100011110001011011000011011000100001100000000100001010010001010110001010010010101011', 2);
  484. t('2072974714841016', '111010111010101110000001001100000011010011110110111.10011111010001011000011011010001100', 2);
  485. t('3', '10.11', 2);
  486. t('6569814675686107322725113', '10101101111001101100101111000000001011111101000101100011110001110110011001011111001.00100011110010001110011001100001000011000010100101011100101000100101111011011101000001110100101001001001100010100001001100011010011011', 2);
  487. t('984456092178345483540429', '11010000011101110111100011000000110111000100100101100011101001111001011111001100.10110000010110000110100110110001100010111001', 2);
  488. t('6729551587237203748588625739672573822682543614592964521541035860', '100000101101111001111011010110111111110111000100001010001101001110111111101100011101010001101011100011010110010100001100111110101010111110001111100010000111000010100001010011000111100000000000101001110011101010100', 2);
  489. t('329347347', '10011101000010111000100010011.0001101000000100000000011101110101011001000011111100110110000100100011110001110110010011001000011010001100010010000101010001111000110', 2);
  490. //BigNumber.config({DECIMAL_PLACES: 5000});
  491. //t('6022239845523628300792137851333617197616053606580805361460444571405159915948416057193556599026984420186847535714193186506779546.45562364433149048376909884425264838196627845956471301832353037216028002220557941081995561235866533298815815922678466806108234749212464649692584770778636508682771855319769124974649405509297732509500507702362168384314107653609786430967640203107454687605887412794096157913528626853706056446855881531545195000734665133919578058463901659136523244159808597378906266443321758454939816465192126295342280568880123960605134416002321981988529228618898697072789772080291342478304351440847738944612720456898241717924298967008171252854355869450188166408302699162551054528159131912895298938197347616702659802404073209181609536327921587288300421033874114565425368107966522446454855931005917304136935908432754883056828263061549088965135169569684456008477541982066123091033968877584432281431379815341125413388350665252537980749041131051878291040173564632382596634048981529497244126378198699352829834835751033446902713765443032376617851981166182096456938914400530557912226087362980440980578460246231055456778104006415527727260144095903127275419414807349147304707405254543427544838982731455334927521421806120799785694323203756123916853431908716090161389876298981034132804663437564753354768639621168658600102486177710685317251506858936381061516323456154147708084807303368146788089168077930658523442473995088742325773226839695051398002486616767897842485900547744342133455226785895506239035265653618936400640974168752824304125514038750444312714907633618171991355429431759439952307076477817217105979944570733869770158307019913889590797598165139754807215433076623400151503800862360578168290788982250598565524133502841168163050960633073023086590377971028607254136702588526777419958903274032568187324150715013909702207304519885442684246154424782763896029535730853643906929626045280406345718447643848365642454794436200184559384104514455046474916698853542487141393373504315472859932883938412782930021292976807483126232761531618262529099148770786402625394165285080740814372385937680961636708062338551092904431743317072664203085901678724391714803254679215220462002284827189814215842974479924985602985736840346662287388320297983891277984351215430795679480190118537345626368022990139894769505155754558312126932952671414774316202379066527423168541384888466209214314154656662254580694814197800298638656821314275995533216305058772309199532434503635943016121377240397454883296750491850460737680808149474215115525147893924328495593024234124241923099439564731922184295950348564035465169266840591302330909689592731054406376096204521212856678638595326253266853596009793769540552472576546585623610514603873467842223218383413469519311698301974531524237384072650293621563877939654382136609518592602998975525783497411981332278754077646791148254910680215716571959847794999990247155904843380251881145330210230503708687521912940355094829433297671479621259952291050451507069861516277689852652120824074226408244695466776128994445706937283501626742574832399257358784925070613374733443923318045672485243752481960132066316477982467772782652564401225093039509921674057244503251628994886108332809253787838807087045292349084813153418737514141651084390353861740493248726168058140952618277156388955744920898401233144729995305891815236381631092752549773465825925187270747564816278320933350674627641648384663562427197990911234109442852754919229966716090476391048342193483833862003532792898637819146892137188859066257902207068814887904172213161571698554092509870791904603500154815868135120390375352892915790562057269104998986616170310087063962096170912045311169499205938470776723319613174250097225084425676690856982407000880056724620818824503061125725461684399498255127313452269964097609152404362732856503883361007911375417900940044634592803539714125533402906835228146503351037643506565226937040944039386627046902360157120659188931448110133381205133170527455488802527077001776856346493147507947490287029277744578775527372923256995419864299678429507426389922953403127483507515479327442988251888961453922972301510643563216583092771781978061366034284974632235631032912241967179283080214267387399797724014498036440569206078211810225217786455419707373248180986740603131905953623973926533609693886155905704306604100315482559358455550018630679789876126218887092040393676456180793809957296390894821682732929521075917502388856575712596709103037671223414578669707747332478371632108168893761388532592606235363056704156483680099201459584177626289636906715420355110405019316492710052426228518585155223882424429151702414484321844004913577523588611847871639322325737509992577988369672218344719659244872142799432036756062631109614278597717292745716623038732618863518899700937188424653264323754203446589769545236970901181775744966400800101730416875793459251675109469665985644198416152029852905095989068691042302222376893958470550095432860142880876451168971479312433163514921818509750264250472945722655641064950528004153004188190549429918759335822341644887168398385954219498973215722761336436971169084930492144143419812959401754073906781284401436962270645729138821367459312144327', '58LURTSHGLIURSHG8O7YH8OG754YOG8O7YGYG75EOY5EYGO87EYOG87YG407Y87Y1IUHJROLIGKHGERGRE.GEHKRGUERYG0908Y76981YIUGHFIJVRBKOFUHEWO8T9343097', 36);
  492. BigNumber.config({DECIMAL_PLACES: 20});
  493. tx(function () {new BigNumber(1010101010101010, 2).toString()}, "(1010101010101010, 2)");
  494. tx(function () {new BigNumber('2', 0).toString()}, "('2', 0)");
  495. tx(function () {new BigNumber('2', 2).toString()}, "('2', 2)");
  496. tx(function () {new BigNumber('2', '-2').toString()}, "('2', '-2')");
  497. tx(function () {new BigNumber('0.000g', 16).toString()}, "('0.000g', 16)");
  498. tx(function () {new BigNumber('453.43', 4).toString()}, "('453.43', 4)");
  499. tx(function () {new BigNumber('1', 1).toString()}, "('1', 1)");
  500. tx(function () {new BigNumber('1.23', 36.01).toString()}, "('1.23', 36.01)");
  501. tx(function () {new BigNumber('1.23', 65).toString()}, "('1.23', 65)");
  502. tx(function () {new BigNumber(12.345, NaN).toString()}, "(12.345, NaN)");
  503. tx(function () {new BigNumber(12.345, 'NaN').toString()}, "(12.345, 'NaN')");
  504. tx(function () {new BigNumber(12.345, []).toString()}, "(12.345, [])");
  505. tx(function () {new BigNumber(12.345, {}).toString()}, "(12.345, {})");
  506. tx(function () {new BigNumber(12.345, '').toString()}, "(12.345, '')");
  507. tx(function () {new BigNumber(12.345, ' ').toString()}, "(12.345, ' ')");
  508. tx(function () {new BigNumber(12.345, 'hello').toString()}, "(12.345, 'hello')");
  509. tx(function () {new BigNumber(12.345, '\t').toString()}, "(12.345, '\t')");
  510. tx(function () {new BigNumber(12.345, new Date).toString()}, "(12.345, new Date)");
  511. tx(function () {new BigNumber(12.345, new RegExp).toString()}, "(12.345, new RegExp)");
  512. tx(function () {new BigNumber(101, 2.02).toString()}, "(101, 2.02)");
  513. tx(function () {new BigNumber(12.345, 10.5).toString()}, "(12.345, 10.5)");
  514. t('NaN', 'NaN', undefined);
  515. t('NaN', 'NaN', null);
  516. t('NaN', NaN, 2);
  517. t('NaN', '-NaN', 2);
  518. t('NaN', -NaN, 10);
  519. t('NaN', 'NaN', 10);
  520. t('12.345', 12.345, null);
  521. t('12.345', 12.345, undefined);
  522. t('Infinity', 'Infinity', 2);
  523. t('Infinity', 'Infinity', 10);
  524. t('-Infinity', '-Infinity', 2);
  525. t('-Infinity', '-Infinity', 10);
  526. t('101725686101180', '101725686101180', undefined);
  527. t('101725686101180', '101725686101180', 10);
  528. // Test ALPHABET
  529. // function t(expected, value, base) {
  530. // T.areEqual(expected, new BigNumber(value, base).toString())
  531. // }
  532. BigNumber.config({ALPHABET: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_'});
  533. t('635356108986960269840155289238139379273453551922021969747464031737829471932451727645074552025138332075241803866047', '1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_', 64);
  534. t('64163.091552734375', 'fGz.5T', 64);
  535. BigNumber.config({ALPHABET: 'xy'});
  536. t('1', 'y', 2); // 1
  537. t('2', 'yx', 2); // 10
  538. t('3', 'yy', 2); // 11
  539. t('4', 'yxx', 2); // 100
  540. t('5', 'yxy', 2); // 101
  541. t('2', 'YX', 2); // 10
  542. tx(function () {new BigNumber('xX', 2).toString()}, "('xX', 2)");
  543. BigNumber.config({ALPHABET: '0123456789*#'});
  544. t('10', '*', 12);
  545. t('11', '#', 12);
  546. t('144', '100', 12);
  547. t('144', '144', 10);
  548. // TODO: more ALPHABET tests.
  549. BigNumber.config({ALPHABET: '0123456789abcdefghijklmnopqrstuvwxyz'});
  550. });