bignumber.d.ts
61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
// Type definitions for bignumber.js >=6.0.0
// Project: https://github.com/MikeMcl/bignumber.js
// Definitions by: Michael Mclaughlin <https://github.com/MikeMcl>
// Definitions: https://github.com/MikeMcl/bignumber.js
// Documentation: http://mikemcl.github.io/bignumber.js/
//
// Exports:
//
// class BigNumber (default export)
// type BigNumber.Constructor
// type BigNumber.Instance
// type BigNumber.ModuloMode
// type BigNumber.RoundingMOde
// type BigNumber.Value
// interface BigNumber.Config
// interface BigNumber.Format
//
// Example (alternative syntax commented-out):
//
// import {BigNumber} from "bignumber.js"
// //import BigNumber from "bignumber.js"
//
// let rm: BigNumber.RoundingMode = BigNumber.ROUND_UP;
// let f: BigNumber.Format = { decimalSeparator: ',' };
// let c: BigNumber.Config = { DECIMAL_PLACES: 4, ROUNDING_MODE: rm, FORMAT: f };
// BigNumber.config(c);
//
// let v: BigNumber.Value = '12345.6789';
// let b: BigNumber = new BigNumber(v);
// //let b: BigNumber.Instance = new BigNumber(v);
//
// The use of compiler option `--strictNullChecks` is recommended.
export default BigNumber;
export namespace BigNumber {
/**
* See `BigNumber.config` and `BigNumber.clone`.
*/
export interface Config {
/**
* An integer, 0 to 1e+9. Default value: 20.
*
* The maximum number of decimal places of the result of operations involving division, i.e.
* division, square root and base conversion operations, and exponentiation when the exponent is
* negative.
*
* ```ts
* BigNumber.config({ DECIMAL_PLACES: 5 })
* BigNumber.set({ DECIMAL_PLACES: 5 })
* ```
*/
DECIMAL_PLACES?: number;
/**
* An integer, 0 to 8. Default value: `BigNumber.ROUND_HALF_UP` (4).
*
* The rounding mode used in operations that involve division (see `DECIMAL_PLACES`) and the
* default rounding mode of the `decimalPlaces`, `precision`, `toExponential`, `toFixed`,
* `toFormat` and `toPrecision` methods.
*
* The modes are available as enumerated properties of the BigNumber constructor.
*
* ```ts
* BigNumber.config({ ROUNDING_MODE: 0 })
* BigNumber.set({ ROUNDING_MODE: BigNumber.ROUND_UP })
* ```
*/
ROUNDING_MODE?: BigNumber.RoundingMode;
/**
* An integer, 0 to 1e+9, or an array, [-1e+9 to 0, 0 to 1e+9].
* Default value: `[-7, 20]`.
*
* The exponent value(s) at which `toString` returns exponential notation.
*
* If a single number is assigned, the value is the exponent magnitude.
*
* If an array of two numbers is assigned then the first number is the negative exponent value at
* and beneath which exponential notation is used, and the second number is the positive exponent
* value at and above which exponential notation is used.
*
* For example, to emulate JavaScript numbers in terms of the exponent values at which they begin
* to use exponential notation, use `[-7, 20]`.
*
* ```ts
* BigNumber.config({ EXPONENTIAL_AT: 2 })
* new BigNumber(12.3) // '12.3' e is only 1
* new BigNumber(123) // '1.23e+2'
* new BigNumber(0.123) // '0.123' e is only -1
* new BigNumber(0.0123) // '1.23e-2'
*
* BigNumber.config({ EXPONENTIAL_AT: [-7, 20] })
* new BigNumber(123456789) // '123456789' e is only 8
* new BigNumber(0.000000123) // '1.23e-7'
*
* // Almost never return exponential notation:
* BigNumber.config({ EXPONENTIAL_AT: 1e+9 })
*
* // Always return exponential notation:
* BigNumber.config({ EXPONENTIAL_AT: 0 })
* ```
*
* Regardless of the value of `EXPONENTIAL_AT`, the `toFixed` method will always return a value in
* normal notation and the `toExponential` method will always return a value in exponential form.
* Calling `toString` with a base argument, e.g. `toString(10)`, will also always return normal
* notation.
*/
EXPONENTIAL_AT?: number|[number, number];
/**
* An integer, magnitude 1 to 1e+9, or an array, [-1e+9 to -1, 1 to 1e+9].
* Default value: `[-1e+9, 1e+9]`.
*
* The exponent value(s) beyond which overflow to Infinity and underflow to zero occurs.
*
* If a single number is assigned, it is the maximum exponent magnitude: values wth a positive
* exponent of greater magnitude become Infinity and those with a negative exponent of greater
* magnitude become zero.
*
* If an array of two numbers is assigned then the first number is the negative exponent limit and
* the second number is the positive exponent limit.
*
* For example, to emulate JavaScript numbers in terms of the exponent values at which they
* become zero and Infinity, use [-324, 308].
*
* ```ts
* BigNumber.config({ RANGE: 500 })
* BigNumber.config().RANGE // [ -500, 500 ]
* new BigNumber('9.999e499') // '9.999e+499'
* new BigNumber('1e500') // 'Infinity'
* new BigNumber('1e-499') // '1e-499'
* new BigNumber('1e-500') // '0'
*
* BigNumber.config({ RANGE: [-3, 4] })
* new BigNumber(99999) // '99999' e is only 4
* new BigNumber(100000) // 'Infinity' e is 5
* new BigNumber(0.001) // '0.01' e is only -3
* new BigNumber(0.0001) // '0' e is -4
* ```
* The largest possible magnitude of a finite BigNumber is 9.999...e+1000000000.
* The smallest possible magnitude of a non-zero BigNumber is 1e-1000000000.
*/
RANGE?: number|[number, number];
/**
* A boolean: `true` or `false`. Default value: `false`.
*
* The value that determines whether cryptographically-secure pseudo-random number generation is
* used. If `CRYPTO` is set to true then the random method will generate random digits using
* `crypto.getRandomValues` in browsers that support it, or `crypto.randomBytes` if using a
* version of Node.js that supports it.
*
* If neither function is supported by the host environment then attempting to set `CRYPTO` to
* `true` will fail and an exception will be thrown.
*
* If `CRYPTO` is `false` then the source of randomness used will be `Math.random` (which is
* assumed to generate at least 30 bits of randomness).
*
* See `BigNumber.random`.
*
* ```ts
* BigNumber.config({ CRYPTO: true })
* BigNumber.config().CRYPTO // true
* BigNumber.random() // 0.54340758610486147524
* ```
*/
CRYPTO?: boolean;
/**
* An integer, 0, 1, 3, 6 or 9. Default value: `BigNumber.ROUND_DOWN` (1).
*
* The modulo mode used when calculating the modulus: `a mod n`.
* The quotient, `q = a / n`, is calculated according to the `ROUNDING_MODE` that corresponds to
* the chosen `MODULO_MODE`.
* The remainder, `r`, is calculated as: `r = a - n * q`.
*
* The modes that are most commonly used for the modulus/remainder operation are shown in the
* following table. Although the other rounding modes can be used, they may not give useful
* results.
*
* Property | Value | Description
* :------------------|:------|:------------------------------------------------------------------
* `ROUND_UP` | 0 | The remainder is positive if the dividend is negative.
* `ROUND_DOWN` | 1 | The remainder has the same sign as the dividend.
* | | Uses 'truncating division' and matches JavaScript's `%` operator .
* `ROUND_FLOOR` | 3 | The remainder has the same sign as the divisor.
* | | This matches Python's `%` operator.
* `ROUND_HALF_EVEN` | 6 | The IEEE 754 remainder function.
* `EUCLID` | 9 | The remainder is always positive.
* | | Euclidian division: `q = sign(n) * floor(a / abs(n))`
*
* The rounding/modulo modes are available as enumerated properties of the BigNumber constructor.
*
* See `modulo`.
*
* ```ts
* BigNumber.config({ MODULO_MODE: BigNumber.EUCLID })
* BigNumber.set({ MODULO_MODE: 9 }) // equivalent
* ```
*/
MODULO_MODE?: BigNumber.ModuloMode;
/**
* An integer, 0 to 1e+9. Default value: 0.
*
* The maximum precision, i.e. number of significant digits, of the result of the power operation
* - unless a modulus is specified.
*
* If set to 0, the number of significant digits will not be limited.
*
* See `exponentiatedBy`.
*
* ```ts
* BigNumber.config({ POW_PRECISION: 100 })
* ```
*/
POW_PRECISION?: number;
/**
* An object including any number of the properties shown below.
*
* The object configures the format of the string returned by the `toFormat` method.
* The example below shows the properties of the object that are recognised, and
* their default values.
*
* Unlike the other configuration properties, the values of the properties of the `FORMAT` object
* will not be checked for validity - the existing object will simply be replaced by the object
* that is passed in.
*
* See `toFormat`.
*
* ```ts
* BigNumber.config({
* FORMAT: {
* // the decimal separator
* decimalSeparator: '.',
* // the grouping separator of the integer part
* groupSeparator: ',',
* // the primary grouping size of the integer part
* groupSize: 3,
* // the secondary grouping size of the integer part
* secondaryGroupSize: 0,
* // the grouping separator of the fraction part
* fractionGroupSeparator: ' ',
* // the grouping size of the fraction part
* fractionGroupSize: 0
* }
* })
* ```
*/
FORMAT?: BigNumber.Format;
/**
* A string representing the alphabet used for base conversion.
* Default value: `'0123456789abcdefghijklmnopqrstuvwxyz'`.
*
* The length of the alphabet corresponds to the maximum value of the base argument that can be
* passed to the BigNumber constructor or `toString`. There is no maximum length, but it must be
* at least 2 characters long, and it must not contain a repeated character, or `'.'` - the
* decimal separator for all values whatever their base.
*
* ```ts
* // duodecimal (base 12)
* BigNumber.config({ ALPHABET: '0123456789TE' })
* x = new BigNumber('T', 12)
* x.toString() // '10'
* x.toString(12) // 'T'
* ```
*/
ALPHABET?: string;
}
export type Constructor = typeof BigNumber;
/**
* See `FORMAT` and `toFormat`.
*/
export interface Format {
/**
* The decimal separator.
*/
decimalSeparator?: string;
/**
* The grouping separator of the integer part.
*/
groupSeparator?: string;
/**
* The primary grouping size of the integer part.
*/
groupSize?: number;
/**
* The secondary grouping size of the integer part.
*/
secondaryGroupSize?: number;
/**
* The grouping separator of the fraction part.
*/
fractionGroupSeparator?: string;
/**
* The grouping size of the fraction part.
*/
fractionGroupSize?: number;
}
export type Instance = BigNumber;
export type ModuloMode = 0 | 1 | 3 | 6 | 9;
export type RoundingMode = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
export type Value = string | number | BigNumber;
}
export declare class BigNumber {
/**
* Used internally by the `BigNumber.isBigNumber` method.
*/
private readonly _isBigNumber: true;
/**
* The coefficient of the value of this BigNumber, an array of base 1e14 integer numbers.
*/
readonly c: number[];
/**
* The exponent of the value of this BigNumber, an integer number, -1000000000 to 1000000000.
*/
readonly e: number;
/**
* The sign of the value of this BigNumber, -1 or 1.
*/
readonly s: number;
/**
* Returns a new instance of a BigNumber object with value `n`, where `n` is a numeric value in
* the specified `base`, or base 10 if `base` is omitted or is `null` or `undefined`.
*
* ```ts
* x = new BigNumber(123.4567) // '123.4567'
* // 'new' is optional
* y = BigNumber(x) // '123.4567'
* ```
*
* If `n` is a base 10 value it can be in normal (fixed-point) or exponential notation.
* Values in other bases must be in normal notation. Values in any base can have fraction digits,
* i.e. digits after the decimal point.
*
* ```ts
* new BigNumber(43210) // '43210'
* new BigNumber('4.321e+4') // '43210'
* new BigNumber('-735.0918e-430') // '-7.350918e-428'
* new BigNumber('123412421.234324', 5) // '607236.557696'
* ```
*
* Signed `0`, signed `Infinity` and `NaN` are supported.
*
* ```ts
* new BigNumber('-Infinity') // '-Infinity'
* new BigNumber(NaN) // 'NaN'
* new BigNumber(-0) // '0'
* new BigNumber('.5') // '0.5'
* new BigNumber('+2') // '2'
* ```
*
* String values in hexadecimal literal form, e.g. `'0xff'`, are valid, as are string values with
* the octal and binary prefixs `'0o'` and `'0b'`. String values in octal literal form without the
* prefix will be interpreted as decimals, e.g. `'011'` is interpreted as 11, not 9.
*
* ```ts
* new BigNumber(-10110100.1, 2) // '-180.5'
* new BigNumber('-0b10110100.1') // '-180.5'
* new BigNumber('ff.8', 16) // '255.5'
* new BigNumber('0xff.8') // '255.5'
* ```
*
* If a base is specified, `n` is rounded according to the current `DECIMAL_PLACES` and
* `ROUNDING_MODE` settings. This includes base 10, so don't include a `base` parameter for decimal
* values unless this behaviour is desired.
*
* ```ts
* BigNumber.config({ DECIMAL_PLACES: 5 })
* new BigNumber(1.23456789) // '1.23456789'
* new BigNumber(1.23456789, 10) // '1.23457'
* ```
*
* An error is thrown if `base` is invalid.
*
* There is no limit to the number of digits of a value of type string (other than that of
* JavaScript's maximum array size). See `RANGE` to set the maximum and minimum possible exponent
* value of a BigNumber.
*
* ```ts
* new BigNumber('5032485723458348569331745.33434346346912144534543')
* new BigNumber('4.321e10000000')
* ```
*
* BigNumber `NaN` is returned if `n` is invalid (unless `BigNumber.DEBUG` is `true`, see below).
*
* ```ts
* new BigNumber('.1*') // 'NaN'
* new BigNumber('blurgh') // 'NaN'
* new BigNumber(9, 2) // 'NaN'
* ```
*
* To aid in debugging, if `BigNumber.DEBUG` is `true` then an error will be thrown on an
* invalid `n`. An error will also be thrown if `n` is of type number with more than 15
* significant digits, as calling `toString` or `valueOf` on these numbers may not result in the
* intended value.
*
* ```ts
* console.log(823456789123456.3) // 823456789123456.2
* new BigNumber(823456789123456.3) // '823456789123456.2'
* BigNumber.DEBUG = true
* // 'Error: Number has more than 15 significant digits'
* new BigNumber(823456789123456.3)
* // 'Error: Not a base 2 number'
* new BigNumber(9, 2)
* ```
*
* @param n A numeric value.
* @param base The base of `n`, integer, 2 to 36 (or `ALPHABET.length`, see `ALPHABET`).
*/
constructor(n: BigNumber.Value, base?: number);
/**
* Returns a BigNumber whose value is the absolute value, i.e. the magnitude, of the value of this
* BigNumber.
*
* The return value is always exact and unrounded.
*
* ```ts
* x = new BigNumber(-0.8)
* x.absoluteValue() // '0.8'
* ```
*/
absoluteValue(): BigNumber;
/**
* Returns a BigNumber whose value is the absolute value, i.e. the magnitude, of the value of this
* BigNumber.
*
* The return value is always exact and unrounded.
*
* ```ts
* x = new BigNumber(-0.8)
* x.abs() // '0.8'
* ```
*/
abs(): BigNumber;
/**
* Returns | |
* :-------:|:--------------------------------------------------------------|
* 1 | If the value of this BigNumber is greater than the value of `n`
* -1 | If the value of this BigNumber is less than the value of `n`
* 0 | If this BigNumber and `n` have the same value
* `null` | If the value of either this BigNumber or `n` is `NaN`
*
* ```ts
*
* x = new BigNumber(Infinity)
* y = new BigNumber(5)
* x.comparedTo(y) // 1
* x.comparedTo(x.minus(1)) // 0
* y.comparedTo(NaN) // null
* y.comparedTo('110', 2) // -1
* ```
* @param n A numeric value.
* @param [base] The base of n.
*/
comparedTo(n: BigNumber.Value, base?: number): number;
/**
* Returns a BigNumber whose value is the value of this BigNumber rounded by rounding mode
* `roundingMode` to a maximum of `decimalPlaces` decimal places.
*
* If `decimalPlaces` is omitted, or is `null` or `undefined`, the return value is the number of
* decimal places of the value of this BigNumber, or `null` if the value of this BigNumber is
* ±`Infinity` or `NaN`.
*
* If `roundingMode` is omitted, or is `null` or `undefined`, `ROUNDING_MODE` is used.
*
* Throws if `decimalPlaces` or `roundingMode` is invalid.
*
* ```ts
* x = new BigNumber(1234.56)
* x.decimalPlaces() // 2
* x.decimalPlaces(1) // '1234.6'
* x.decimalPlaces(2) // '1234.56'
* x.decimalPlaces(10) // '1234.56'
* x.decimalPlaces(0, 1) // '1234'
* x.decimalPlaces(0, 6) // '1235'
* x.decimalPlaces(1, 1) // '1234.5'
* x.decimalPlaces(1, BigNumber.ROUND_HALF_EVEN) // '1234.6'
* x // '1234.56'
* y = new BigNumber('9.9e-101')
* y.decimalPlaces() // 102
* ```
*
* @param [decimalPlaces] Decimal places, integer, 0 to 1e+9.
* @param [roundingMode] Rounding mode, integer, 0 to 8.
*/
decimalPlaces(): number;
decimalPlaces(decimalPlaces: number, roundingMode?: BigNumber.RoundingMode): BigNumber;
/**
* Returns a BigNumber whose value is the value of this BigNumber rounded by rounding mode
* `roundingMode` to a maximum of `decimalPlaces` decimal places.
*
* If `decimalPlaces` is omitted, or is `null` or `undefined`, the return value is the number of
* decimal places of the value of this BigNumber, or `null` if the value of this BigNumber is
* ±`Infinity` or `NaN`.
*
* If `roundingMode` is omitted, or is `null` or `undefined`, `ROUNDING_MODE` is used.
*
* Throws if `decimalPlaces` or `roundingMode` is invalid.
*
* ```ts
* x = new BigNumber(1234.56)
* x.dp() // 2
* x.dp(1) // '1234.6'
* x.dp(2) // '1234.56'
* x.dp(10) // '1234.56'
* x.dp(0, 1) // '1234'
* x.dp(0, 6) // '1235'
* x.dp(1, 1) // '1234.5'
* x.dp(1, BigNumber.ROUND_HALF_EVEN) // '1234.6'
* x // '1234.56'
* y = new BigNumber('9.9e-101')
* y.dp() // 102
* ```
*
* @param [decimalPlaces] Decimal places, integer, 0 to 1e+9.
* @param [roundingMode] Rounding mode, integer, 0 to 8.
*/
dp(): number;
dp(decimalPlaces: number, roundingMode?: BigNumber.RoundingMode): BigNumber;
/**
* Returns a BigNumber whose value is the value of this BigNumber divided by `n`, rounded
* according to the current `DECIMAL_PLACES` and `ROUNDING_MODE` settings.
*
* ```ts
* x = new BigNumber(355)
* y = new BigNumber(113)
* x.dividedBy(y) // '3.14159292035398230088'
* x.dividedBy(5) // '71'
* x.dividedBy(47, 16) // '5'
* ```
*
* @param n A numeric value.
* @param [base] The base of n.
*/
dividedBy(n: BigNumber.Value, base?: number): BigNumber;
/**
* Returns a BigNumber whose value is the value of this BigNumber divided by `n`, rounded
* according to the current `DECIMAL_PLACES` and `ROUNDING_MODE` settings.
*
* ```ts
* x = new BigNumber(355)
* y = new BigNumber(113)
* x.div(y) // '3.14159292035398230088'
* x.div(5) // '71'
* x.div(47, 16) // '5'
* ```
*
* @param n A numeric value.
* @param [base] The base of n.
*/
div(n: BigNumber.Value, base?: number): BigNumber;
/**
* Returns a BigNumber whose value is the integer part of dividing the value of this BigNumber by
* `n`.
*
* ```ts
* x = new BigNumber(5)
* y = new BigNumber(3)
* x.dividedToIntegerBy(y) // '1'
* x.dividedToIntegerBy(0.7) // '7'
* x.dividedToIntegerBy('0.f', 16) // '5'
* ```
*
* @param n A numeric value.
* @param [base] The base of n.
*/
dividedToIntegerBy(n: BigNumber.Value, base?: number): BigNumber;
/**
* Returns a BigNumber whose value is the integer part of dividing the value of this BigNumber by
* `n`.
*
* ```ts
* x = new BigNumber(5)
* y = new BigNumber(3)
* x.idiv(y) // '1'
* x.idiv(0.7) // '7'
* x.idiv('0.f', 16) // '5'
* ```
*
* @param n A numeric value.
* @param [base] The base of n.
*/
idiv(n: BigNumber.Value, base?: number): BigNumber;
/**
* Returns a BigNumber whose value is the value of this BigNumber exponentiated by `n`, i.e.
* raised to the power `n`, and optionally modulo a modulus `m`.
*
* If `n` is negative the result is rounded according to the current `DECIMAL_PLACES` and
* `ROUNDING_MODE` settings.
*
* As the number of digits of the result of the power operation can grow so large so quickly,
* e.g. 123.456**10000 has over 50000 digits, the number of significant digits calculated is
* limited to the value of the `POW_PRECISION` setting (unless a modulus `m` is specified).
*
* By default `POW_PRECISION` is set to 0. This means that an unlimited number of significant
* digits will be calculated, and that the method's performance will decrease dramatically for
* larger exponents.
*
* If `m` is specified and the value of `m`, `n` and this BigNumber are integers and `n` is
* positive, then a fast modular exponentiation algorithm is used, otherwise the operation will
* be performed as `x.exponentiatedBy(n).modulo(m)` with a `POW_PRECISION` of 0.
*
* Throws if `n` is not an integer.
*
* ```ts
* Math.pow(0.7, 2) // 0.48999999999999994
* x = new BigNumber(0.7)
* x.exponentiatedBy(2) // '0.49'
* BigNumber(3).exponentiatedBy(-2) // '0.11111111111111111111'
* ```
*
* @param n The exponent, an integer.
* @param [m] The modulus.
*/
exponentiatedBy(n: number, m?: BigNumber.Value): BigNumber;
/**
* Returns a BigNumber whose value is the value of this BigNumber exponentiated by `n`, i.e.
* raised to the power `n`, and optionally modulo a modulus `m`.
*
* If `n` is negative the result is rounded according to the current `DECIMAL_PLACES` and
* `ROUNDING_MODE` settings.
*
* As the number of digits of the result of the power operation can grow so large so quickly,
* e.g. 123.456**10000 has over 50000 digits, the number of significant digits calculated is
* limited to the value of the `POW_PRECISION` setting (unless a modulus `m` is specified).
*
* By default `POW_PRECISION` is set to 0. This means that an unlimited number of significant
* digits will be calculated, and that the method's performance will decrease dramatically for
* larger exponents.
*
* If `m` is specified and the value of `m`, `n` and this BigNumber are integers and `n` is
* positive, then a fast modular exponentiation algorithm is used, otherwise the operation will
* be performed as `x.pow(n).modulo(m)` with a `POW_PRECISION` of 0.
*
* Throws if `n` is not an integer.
*
* ```ts
* Math.pow(0.7, 2) // 0.48999999999999994
* x = new BigNumber(0.7)
* x.pow(2) // '0.49'
* BigNumber(3).pow(-2) // '0.11111111111111111111'
* ```
*
* @param n The exponent, an integer.
* @param [m] The modulus.
*/
pow(n: number, m?: BigNumber.Value): BigNumber;
/**
* Returns a BigNumber whose value is the value of this BigNumber rounded to an integer using
* rounding mode `rm`.
*
* If `rm` is omitted, or is `null` or `undefined`, `ROUNDING_MODE` is used.
*
* Throws if `rm` is invalid.
*
* ```ts
* x = new BigNumber(123.456)
* x.integerValue() // '123'
* x.integerValue(BigNumber.ROUND_CEIL) // '124'
* y = new BigNumber(-12.7)
* y.integerValue() // '-13'
* x.integerValue(BigNumber.ROUND_DOWN) // '-12'
* ```
*
* @param {BigNumber.RoundingMode} [rm] The roundng mode, an integer, 0 to 8.
*/
integerValue(rm?: BigNumber.RoundingMode): BigNumber;
/**
* Returns `true` if the value of this BigNumber is equal to the value of `n`, otherwise returns
* `false`.
*
* As with JavaScript, `NaN` does not equal `NaN`.
*
* ```ts
* 0 === 1e-324 // true
* x = new BigNumber(0)
* x.isEqualTo('1e-324') // false
* BigNumber(-0).isEqualTo(x) // true ( -0 === 0 )
* BigNumber(255).isEqualTo('ff', 16) // true
*
* y = new BigNumber(NaN)
* y.isEqualTo(NaN) // false
* ```
*
* @param n A numeric value.
* @param [base] The base of n.
*/
isEqualTo(n: BigNumber.Value, base?: number): boolean;
/**
* Returns `true` if the value of this BigNumber is equal to the value of `n`, otherwise returns
* `false`.
*
* As with JavaScript, `NaN` does not equal `NaN`.
*
* ```ts
* 0 === 1e-324 // true
* x = new BigNumber(0)
* x.eq('1e-324') // false
* BigNumber(-0).eq(x) // true ( -0 === 0 )
* BigNumber(255).eq('ff', 16) // true
*
* y = new BigNumber(NaN)
* y.eq(NaN) // false
* ```
*
* @param n A numeric value.
* @param [base] The base of n.
*/
eq(n: BigNumber.Value, base?: number): boolean;
/**
* Returns `true` if the value of this BigNumber is a finite number, otherwise returns `false`.
*
* The only possible non-finite values of a BigNumber are `NaN`, `Infinity` and `-Infinity`.
*
* ```ts
* x = new BigNumber(1)
* x.isFinite() // true
* y = new BigNumber(Infinity)
* y.isFinite() // false
* ```
*/
isFinite(): boolean;
/**
* Returns `true` if the value of this BigNumber is greater than the value of `n`, otherwise
* returns `false`.
*
* ```ts
* 0.1 > (0.3 - 0.2) // true
* x = new BigNumber(0.1)
* x.isGreaterThan(BigNumber(0.3).minus(0.2)) // false
* BigNumber(0).isGreaterThan(x) // false
* BigNumber(11, 3).isGreaterThan(11.1, 2) // true
* ```
*
* @param n A numeric value.
* @param [base] The base of n.
*/
isGreaterThan(n: BigNumber.Value, base?: number): boolean;
/**
* Returns `true` if the value of this BigNumber is greater than the value of `n`, otherwise
* returns `false`.
*
* ```ts
* 0.1 > (0.3 - 0 // true
* x = new BigNumber(0.1)
* x.gt(BigNumber(0.3).minus(0.2)) // false
* BigNumber(0).gt(x) // false
* BigNumber(11, 3).gt(11.1, 2) // true
* ```
*
* @param n A numeric value.
* @param [base] The base of n.
*/
gt(n: BigNumber.Value, base?: number): boolean;
/**
* Returns `true` if the value of this BigNumber is greater than or equal to the value of `n`,
* otherwise returns `false`.
*
* ```ts
* (0.3 - 0.2) >= 0.1 // false
* x = new BigNumber(0.3).minus(0.2)
* x.isGreaterThanOrEqualTo(0.1) // true
* BigNumber(1).isGreaterThanOrEqualTo(x) // true
* BigNumber(10, 18).isGreaterThanOrEqualTo('i', 36) // true
* ```
*
* @param n A numeric value.
* @param [base] The base of n.
*/
isGreaterThanOrEqualTo(n: BigNumber.Value, base?: number): boolean;
/**
* Returns `true` if the value of this BigNumber is greater than or equal to the value of `n`,
* otherwise returns `false`.
*
* ```ts
* (0.3 - 0.2) >= 0.1 // false
* x = new BigNumber(0.3).minus(0.2)
* x.gte(0.1) // true
* BigNumber(1).gte(x) // true
* BigNumber(10, 18).gte('i', 36) // true
* ```
*
* @param n A numeric value.
* @param [base] The base of n.
*/
gte(n: BigNumber.Value, base?: number): boolean;
/**
* Returns `true` if the value of this BigNumber is an integer, otherwise returns `false`.
*
* ```ts
* x = new BigNumber(1)
* x.isInteger() // true
* y = new BigNumber(123.456)
* y.isInteger() // false
* ```
*/
isInteger(): boolean;
/**
* Returns `true` if the value of this BigNumber is less than the value of `n`, otherwise returns
* `false`.
*
* ```ts
* (0.3 - 0.2) < 0.1 // true
* x = new BigNumber(0.3).minus(0.2)
* x.isLessThan(0.1) // false
* BigNumber(0).isLessThan(x) // true
* BigNumber(11.1, 2).isLessThan(11, 3) // true
* ```
*
* @param n A numeric value.
* @param [base] The base of n.
*/
isLessThan(n: BigNumber.Value, base?: number): boolean;
/**
* Returns `true` if the value of this BigNumber is less than the value of `n`, otherwise returns
* `false`.
*
* ```ts
* (0.3 - 0.2) < 0.1 // true
* x = new BigNumber(0.3).minus(0.2)
* x.lt(0.1) // false
* BigNumber(0).lt(x) // true
* BigNumber(11.1, 2).lt(11, 3) // true
* ```
*
* @param n A numeric value.
* @param [base] The base of n.
*/
lt(n: BigNumber.Value, base?: number): boolean;
/**
* Returns `true` if the value of this BigNumber is less than or equal to the value of `n`,
* otherwise returns `false`.
*
* ```ts
* 0.1 <= (0.3 - 0.2) // false
* x = new BigNumber(0.1)
* x.isLessThanOrEqualTo(BigNumber(0.3).minus(0.2)) // true
* BigNumber(-1).isLessThanOrEqualTo(x) // true
* BigNumber(10, 18).isLessThanOrEqualTo('i', 36) // true
* ```
*
* @param n A numeric value.
* @param [base] The base of n.
*/
isLessThanOrEqualTo(n: BigNumber.Value, base?: number): boolean;
/**
* Returns `true` if the value of this BigNumber is less than or equal to the value of `n`,
* otherwise returns `false`.
*
* ```ts
* 0.1 <= (0.3 - 0.2) // false
* x = new BigNumber(0.1)
* x.lte(BigNumber(0.3).minus(0.2)) // true
* BigNumber(-1).lte(x) // true
* BigNumber(10, 18).lte('i', 36) // true
* ```
*
* @param n A numeric value.
* @param [base] The base of n.
*/
lte(n: BigNumber.Value, base?: number): boolean;
/**
* Returns `true` if the value of this BigNumber is `NaN`, otherwise returns `false`.
*
* ```ts
* x = new BigNumber(NaN)
* x.isNaN() // true
* y = new BigNumber('Infinity')
* y.isNaN() // false
* ```
*/
isNaN(): boolean;
/**
* Returns `true` if the value of this BigNumber is negative, otherwise returns `false`.
*
* ```ts
* x = new BigNumber(-0)
* x.isNegative() // true
* y = new BigNumber(2)
* y.isNegative() // false
* ```
*/
isNegative(): boolean;
/**
* Returns `true` if the value of this BigNumber is positive, otherwise returns `false`.
*
* ```ts
* x = new BigNumber(-0)
* x.isPositive() // false
* y = new BigNumber(2)
* y.isPositive() // true
* ```
*/
isPositive(): boolean;
/**
* Returns `true` if the value of this BigNumber is zero or minus zero, otherwise returns `false`.
*
* ```ts
* x = new BigNumber(-0)
* x.isZero() // true
* ```
*/
isZero(): boolean;
/**
* Returns a BigNumber whose value is the value of this BigNumber minus `n`.
*
* The return value is always exact and unrounded.
*
* ```ts
* 0.3 - 0.1 // 0.19999999999999998
* x = new BigNumber(0.3)
* x.minus(0.1) // '0.2'
* x.minus(0.6, 20) // '0'
* ```
*
* @param n A numeric value.
* @param [base] The base of n.
*/
minus(n: BigNumber.Value, base?: number): BigNumber;
/**
* Returns a BigNumber whose value is the value of this BigNumber modulo `n`, i.e. the integer
* remainder of dividing this BigNumber by `n`.
*
* The value returned, and in particular its sign, is dependent on the value of the `MODULO_MODE`
* setting of this BigNumber constructor. If it is 1 (default value), the result will have the
* same sign as this BigNumber, and it will match that of Javascript's `%` operator (within the
* limits of double precision) and BigDecimal's `remainder` method.
*
* The return value is always exact and unrounded.
*
* See `MODULO_MODE` for a description of the other modulo modes.
*
* ```ts
* 1 % 0.9 // 0.09999999999999998
* x = new BigNumber(1)
* x.modulo(0.9) // '0.1'
* y = new BigNumber(33)
* y.modulo('a', 33) // '3'
* ```
*
* @param n A numeric value.
* @param [base] The base of n.
*/
modulo(n: BigNumber.Value, base?: number): BigNumber;
/**
* Returns a BigNumber whose value is the value of this BigNumber modulo `n`, i.e. the integer
* remainder of dividing this BigNumber by `n`.
*
* The value returned, and in particular its sign, is dependent on the value of the `MODULO_MODE`
* setting of this BigNumber constructor. If it is 1 (default value), the result will have the
* same sign as this BigNumber, and it will match that of Javascript's `%` operator (within the
* limits of double precision) and BigDecimal's `remainder` method.
*
* The return value is always exact and unrounded.
*
* See `MODULO_MODE` for a description of the other modulo modes.
*
* ```ts
* 1 % 0.9 // 0.09999999999999998
* x = new BigNumber(1)
* x.mod(0.9) // '0.1'
* y = new BigNumber(33)
* y.mod('a', 33) // '3'
* ```
*
* @param n A numeric value.
* @param [base] The base of n.
*/
mod(n: BigNumber.Value, base?: number): BigNumber;
/**
* Returns a BigNumber whose value is the value of this BigNumber multiplied by `n`.
*
* The return value is always exact and unrounded.
*
* ```ts
* 0.6 * 3 // 1.7999999999999998
* x = new BigNumber(0.6)
* y = x.multipliedBy(3) // '1.8'
* BigNumber('7e+500').multipliedBy(y) // '1.26e+501'
* x.multipliedBy('-a', 16) // '-6'
* ```
*
* @param n A numeric value.
* @param [base] The base of n.
*/
multipliedBy(n: BigNumber.Value, base?: number) : BigNumber;
/**
* Returns a BigNumber whose value is the value of this BigNumber multiplied by `n`.
*
* The return value is always exact and unrounded.
*
* ```ts
* 0.6 * 3 // 1.7999999999999998
* x = new BigNumber(0.6)
* y = x.times(3) // '1.8'
* BigNumber('7e+500').times(y) // '1.26e+501'
* x.times('-a', 16) // '-6'
* ```
*
* @param n A numeric value.
* @param [base] The base of n.
*/
times(n: BigNumber.Value, base?: number): BigNumber;
/**
* Returns a BigNumber whose value is the value of this BigNumber negated, i.e. multiplied by -1.
*
* ```ts
* x = new BigNumber(1.8)
* x.negated() // '-1.8'
* y = new BigNumber(-1.3)
* y.negated() // '1.3'
* ```
*/
negated(): BigNumber;
/**
* Returns a BigNumber whose value is the value of this BigNumber plus `n`.
*
* The return value is always exact and unrounded.
*
* ```ts
* 0.1 + 0.2 // 0.30000000000000004
* x = new BigNumber(0.1)
* y = x.plus(0.2) // '0.3'
* BigNumber(0.7).plus(x).plus(y) // '1'
* x.plus('0.1', 8) // '0.225'
* ```
*
* @param n A numeric value.
* @param [base] The base of n.
*/
plus(n: BigNumber.Value, base?: number): BigNumber;
/**
* Returns the number of significant digits of the value of this BigNumber, or `null` if the value
* of this BigNumber is ±`Infinity` or `NaN`.
*
* If `includeZeros` is true then any trailing zeros of the integer part of the value of this
* BigNumber are counted as significant digits, otherwise they are not.
*
* Throws if `includeZeros` is invalid.
*
* ```ts
* x = new BigNumber(9876.54321)
* x.precision() // 9
* y = new BigNumber(987000)
* y.precision(false) // 3
* y.precision(true) // 6
* ```
*
* @param [includeZeros] Whether to include integer trailing zeros in the significant digit count.
*/
precision(includeZeros?: boolean): number;
/**
* Returns a BigNumber whose value is the value of this BigNumber rounded to a precision of
* `significantDigits` significant digits using rounding mode `roundingMode`.
*
* If `roundingMode` is omitted or is `null` or `undefined`, `ROUNDING_MODE` will be used.
*
* Throws if `significantDigits` or `roundingMode` is invalid.
*
* ```ts
* x = new BigNumber(9876.54321)
* x.precision(6) // '9876.54'
* x.precision(6, BigNumber.ROUND_UP) // '9876.55'
* x.precision(2) // '9900'
* x.precision(2, 1) // '9800'
* x // '9876.54321'
* ```
*
* @param significantDigits Significant digits, integer, 1 to 1e+9.
* @param [roundingMode] Rounding mode, integer, 0 to 8.
*/
precision(significantDigits: number, roundingMode?: BigNumber.RoundingMode): BigNumber;
/**
* Returns the number of significant digits of the value of this BigNumber,
* or `null` if the value of this BigNumber is ±`Infinity` or `NaN`.
*
* If `includeZeros` is true then any trailing zeros of the integer part of
* the value of this BigNumber are counted as significant digits, otherwise
* they are not.
*
* Throws if `includeZeros` is invalid.
*
* ```ts
* x = new BigNumber(9876.54321)
* x.sd() // 9
* y = new BigNumber(987000)
* y.sd(false) // 3
* y.sd(true) // 6
* ```
*
* @param [includeZeros] Whether to include integer trailing zeros in the significant digit count.
*/
sd(includeZeros?: boolean): number;
/*
* Returns a BigNumber whose value is the value of this BigNumber rounded to a precision of
* `significantDigits` significant digits using rounding mode `roundingMode`.
*
* If `roundingMode` is omitted or is `null` or `undefined`, `ROUNDING_MODE` will be used.
*
* Throws if `significantDigits` or `roundingMode` is invalid.
*
* ```ts
* x = new BigNumber(9876.54321)
* x.sd(6) // '9876.54'
* x.sd(6, BigNumber.ROUND_UP) // '9876.55'
* x.sd(2) // '9900'
* x.sd(2, 1) // '9800'
* x // '9876.54321'
* ```
*
* @param significantDigits Significant digits, integer, 1 to 1e+9.
* @param [roundingMode] Rounding mode, integer, 0 to 8.
*/
sd(significantDigits: number, roundingMode?: BigNumber.RoundingMode): BigNumber;
/**
* Returns a BigNumber whose value is the value of this BigNumber shifted by `n` places.
*
* The shift is of the decimal point, i.e. of powers of ten, and is to the left if `n` is negative
* or to the right if `n` is positive.
*
* The return value is always exact and unrounded.
*
* Throws if `n` is invalid.
*
* ```ts
* x = new BigNumber(1.23)
* x.shiftedBy(3) // '1230'
* x.shiftedBy(-3) // '0.00123'
* ```
*
* @param n The shift value, integer, -9007199254740991 to 9007199254740991.
*/
shiftedBy(n: number): BigNumber;
/**
* Returns a BigNumber whose value is the square root of the value of this BigNumber, rounded
* according to the current `DECIMAL_PLACES` and `ROUNDING_MODE` settings.
*
* The return value will be correctly rounded, i.e. rounded as if the result was first calculated
* to an infinite number of correct digits before rounding.
*
* ```ts
* x = new BigNumber(16)
* x.squareRoot() // '4'
* y = new BigNumber(3)
* y.squareRoot() // '1.73205080756887729353'
* ```
*/
squareRoot(): BigNumber;
/**
* Returns a BigNumber whose value is the square root of the value of this BigNumber, rounded
* according to the current `DECIMAL_PLACES` and `ROUNDING_MODE` settings.
*
* The return value will be correctly rounded, i.e. rounded as if the result was first calculated
* to an infinite number of correct digits before rounding.
*
* ```ts
* x = new BigNumber(16)
* x.sqrt() // '4'
* y = new BigNumber(3)
* y.sqrt() // '1.73205080756887729353'
* ```
*/
sqrt(): BigNumber;
/**
* Returns a string representing the value of this BigNumber in exponential notation rounded using
* rounding mode `roundingMode` to `decimalPlaces` decimal places, i.e with one digit before the
* decimal point and `decimalPlaces` digits after it.
*
* If the value of this BigNumber in exponential notation has fewer than `decimalPlaces` fraction
* digits, the return value will be appended with zeros accordingly.
*
* If `decimalPlaces` is omitted, or is `null` or `undefined`, the number of digits after the
* decimal point defaults to the minimum number of digits necessary to represent the value
* exactly.
*
* If `roundingMode` is omitted or is `null` or `undefined`, `ROUNDING_MODE` is used.
*
* Throws if `decimalPlaces` or `roundingMode` is invalid.
*
* ```ts
* x = 45.6
* y = new BigNumber(x)
* x.toExponential() // '4.56e+1'
* y.toExponential() // '4.56e+1'
* x.toExponential(0) // '5e+1'
* y.toExponential(0) // '5e+1'
* x.toExponential(1) // '4.6e+1'
* y.toExponential(1) // '4.6e+1'
* y.toExponential(1, 1) // '4.5e+1' (ROUND_DOWN)
* x.toExponential(3) // '4.560e+1'
* y.toExponential(3) // '4.560e+1'
* ```
*
* @param [decimalPlaces] Decimal places, integer, 0 to 1e+9.
* @param [roundingMode] Rounding mode, integer, 0 to 8.
*/
toExponential(decimalPlaces?: number, roundingMode?: BigNumber.RoundingMode): string;
/**
* Returns a string representing the value of this BigNumber in normal (fixed-point) notation
* rounded to `decimalPlaces` decimal places using rounding mode `roundingMode`.
*
* If the value of this BigNumber in normal notation has fewer than `decimalPlaces` fraction
* digits, the return value will be appended with zeros accordingly.
*
* Unlike `Number.prototype.toFixed`, which returns exponential notation if a number is greater or
* equal to 10**21, this method will always return normal notation.
*
* If `decimalPlaces` is omitted or is `null` or `undefined`, the return value will be unrounded
* and in normal notation. This is also unlike `Number.prototype.toFixed`, which returns the value
* to zero decimal places. It is useful when normal notation is required and the current
* `EXPONENTIAL_AT` setting causes `toString` to return exponential notation.
*
* If `roundingMode` is omitted or is `null` or `undefined`, `ROUNDING_MODE` is used.
*
* Throws if `decimalPlaces` or `roundingMode` is invalid.
*
* ```ts
* x = 3.456
* y = new BigNumber(x)
* x.toFixed() // '3'
* y.toFixed() // '3.456'
* y.toFixed(0) // '3'
* x.toFixed(2) // '3.46'
* y.toFixed(2) // '3.46'
* y.toFixed(2, 1) // '3.45' (ROUND_DOWN)
* x.toFixed(5) // '3.45600'
* y.toFixed(5) // '3.45600'
* ```
*
* @param [decimalPlaces] Decimal places, integer, 0 to 1e+9.
* @param [roundingMode] Rounding mode, integer, 0 to 8.
*/
toFixed(decimalPlaces?: number, roundingMode?: BigNumber.RoundingMode): string;
/**
* Returns a string representing the value of this BigNumber in normal (fixed-point) notation
* rounded to `decimalPlaces` decimal places using rounding mode `roundingMode`, and formatted
* according to the properties of the `FORMAT` object.
*
* The properties of the `FORMAT` object are shown in the examples below.
*
* If `decimalPlaces` is omitted or is `null` or `undefined`, then the return value is not
* rounded to a fixed number of decimal places.
*
* If `roundingMode` is omitted or is `null` or `undefined`, `ROUNDING_MODE` is used.
*
* Throws if `decimalPlaces` or `roundingMode` is invalid.
*
* ```ts
* format = {
* decimalSeparator: '.',
* groupSeparator: ',',
* groupSize: 3,
* secondaryGroupSize: 0,
* fractionGroupSeparator: ' ',
* fractionGroupSize: 0
* }
* BigNumber.config({ FORMAT: format })
*
* x = new BigNumber('123456789.123456789')
* x.toFormat() // '123,456,789.123456789'
* x.toFormat(1) // '123,456,789.1'
*
* format.groupSeparator = ' '
* format.fractionGroupSize = 5
* x.toFormat() // '123 456 789.12345 6789'
*
* BigNumber.config({
* FORMAT: {
* decimalSeparator: ',',
* groupSeparator: '.',
* groupSize: 3,
* secondaryGroupSize: 2
* }
* })
*
* x.toFormat(6) // '12.34.56.789,123'
* ```
*
* @param [decimalPlaces] Decimal places, integer, 0 to 1e+9.
* @param [roundingMode] Rounding mode, integer, 0 to 8.
*/
toFormat(decimalPlaces?: number, roundingMode?: BigNumber.RoundingMode): string;
/**
* Returns a string array representing the value of this BigNumber as a simple fraction with an
* integer numerator and an integer denominator. The denominator will be a positive non-zero value
* less than or equal to `max_denominator`.
*
* If a maximum denominator, `max_denominator`, is not specified, or is `null` or `undefined`, the
* denominator will be the lowest value necessary to represent the number exactly.
*
* Throws if `max_denominator` is invalid.
*
* ```ts
* x = new BigNumber(1.75)
* x.toFraction() // '7, 4'
*
* pi = new BigNumber('3.14159265358')
* pi.toFraction() // '157079632679,50000000000'
* pi.toFraction(100000) // '312689, 99532'
* pi.toFraction(10000) // '355, 113'
* pi.toFraction(100) // '311, 99'
* pi.toFraction(10) // '22, 7'
* pi.toFraction(1) // '3, 1'
* ```
*
* @param [max_denominator] The maximum denominator, integer > 0, or Infinity.
*/
toFraction(max_denominator?: BigNumber.Value): BigNumber[];
/**
* As `valueOf`.
*/
toJSON(): string;
/**
* Returns the value of this BigNumber as a JavaScript primitive number.
*
* Using the unary plus operator gives the same result.
*
* ```ts
* x = new BigNumber(456.789)
* x.toNumber() // 456.789
* +x // 456.789
*
* y = new BigNumber('45987349857634085409857349856430985')
* y.toNumber() // 4.598734985763409e+34
*
* z = new BigNumber(-0)
* 1 / z.toNumber() // -Infinity
* 1 / +z // -Infinity
* ```
*/
toNumber(): number;
/**
* Returns a string representing the value of this BigNumber rounded to `significantDigits`
* significant digits using rounding mode `roundingMode`.
*
* If `significantDigits` is less than the number of digits necessary to represent the integer
* part of the value in normal (fixed-point) notation, then exponential notation is used.
*
* If `significantDigits` is omitted, or is `null` or `undefined`, then the return value is the
* same as `n.toString()`.
*
* If `roundingMode` is omitted or is `null` or `undefined`, `ROUNDING_MODE` is used.
*
* Throws if `significantDigits` or `roundingMode` is invalid.
*
* ```ts
* x = 45.6
* y = new BigNumber(x)
* x.toPrecision() // '45.6'
* y.toPrecision() // '45.6'
* x.toPrecision(1) // '5e+1'
* y.toPrecision(1) // '5e+1'
* y.toPrecision(2, 0) // '4.6e+1' (ROUND_UP)
* y.toPrecision(2, 1) // '4.5e+1' (ROUND_DOWN)
* x.toPrecision(5) // '45.600'
* y.toPrecision(5) // '45.600'
* ```
*
* @param [significantDigits] Significant digits, integer, 1 to 1e+9.
* @param [roundingMode] Rounding mode, integer 0 to 8.
*/
toPrecision(significantDigits?: number, roundingMode?: BigNumber.RoundingMode): string;
/**
* Returns a string representing the value of this BigNumber in base `base`, or base 10 if `base`
* is omitted or is `null` or `undefined`.
*
* For bases above 10, and using the default base conversion alphabet (see `ALPHABET`), values
* from 10 to 35 are represented by a-z (the same as `Number.prototype.toString`).
*
* If a base is specified the value is rounded according to the current `DECIMAL_PLACES` and
* `ROUNDING_MODE` settings, otherwise it is not.
*
* If a base is not specified, and this BigNumber has a positive exponent that is equal to or
* greater than the positive component of the current `EXPONENTIAL_AT` setting, or a negative
* exponent equal to or less than the negative component of the setting, then exponential notation
* is returned.
*
* If `base` is `null` or `undefined` it is ignored.
*
* Throws if `base` is invalid.
*
* ```ts
* x = new BigNumber(750000)
* x.toString() // '750000'
* BigNumber.config({ EXPONENTIAL_AT: 5 })
* x.toString() // '7.5e+5'
*
* y = new BigNumber(362.875)
* y.toString(2) // '101101010.111'
* y.toString(9) // '442.77777777777777777778'
* y.toString(32) // 'ba.s'
*
* BigNumber.config({ DECIMAL_PLACES: 4 });
* z = new BigNumber('1.23456789')
* z.toString() // '1.23456789'
* z.toString(10) // '1.2346'
* ```
*
* @param [base] The base, integer, 2 to 36 (or `ALPHABET.length`, see `ALPHABET`).
*/
toString(base?: number): string;
/**
* As `toString`, but does not accept a base argument and includes the minus sign for negative
* zero.
*
* ``ts
* x = new BigNumber('-0')
* x.toString() // '0'
* x.valueOf() // '-0'
* y = new BigNumber('1.777e+457')
* y.valueOf() // '1.777e+457'
* ```
*/
valueOf(): string;
/**
* Returns a new independent BigNumber constructor with configuration as described by `object`, or
* with the default configuration if object is `null` or `undefined`.
*
* Throws if `object` is not an object.
*
* ```ts
* BigNumber.config({ DECIMAL_PLACES: 5 })
* BN = BigNumber.clone({ DECIMAL_PLACES: 9 })
*
* x = new BigNumber(1)
* y = new BN(1)
*
* x.div(3) // 0.33333
* y.div(3) // 0.333333333
*
* // BN = BigNumber.clone({ DECIMAL_PLACES: 9 }) is equivalent to:
* BN = BigNumber.clone()
* BN.config({ DECIMAL_PLACES: 9 })
* ```
*
* @param [object] The configuration object.
*/
static clone(object?: BigNumber.Config): BigNumber.Constructor;
/**
* Configures the settings that apply to this BigNumber constructor.
*
* The configuration object, `object`, contains any number of the properties shown in the example
* below.
*
* Returns an object with the above properties and their current values.
*
* Throws if `object` is not an object, or if an invalid value is assigned to one or more of the
* properties.
*
* ```ts
* BigNumber.config({
* DECIMAL_PLACES: 40,
* ROUNDING_MODE: BigNumber.ROUND_HALF_CEIL,
* EXPONENTIAL_AT: [-10, 20],
* RANGE: [-500, 500],
* CRYPTO: true,
* MODULO_MODE: BigNumber.ROUND_FLOOR,
* POW_PRECISION: 80,
* FORMAT: {
* groupSize: 3,
* groupSeparator: ' ',
* decimalSeparator: ','
* },
* ALPHABET: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_'
* });
*
* BigNumber.config().DECIMAL_PLACES // 40
* ```
*
* @param object The configuration object.
*/
static config(object: BigNumber.Config): BigNumber.Config;
/**
* Returns `true` if `value` is a BigNumber instance, otherwise returns `false`.
*
* ```ts
* x = 42
* y = new BigNumber(x)
*
* BigNumber.isBigNumber(x) // false
* y instanceof BigNumber // true
* BigNumber.isBigNumber(y) // true
*
* BN = BigNumber.clone();
* z = new BN(x)
* z instanceof BigNumber // false
* BigNumber.isBigNumber(z) // true
* ```
*
* @param value The value to test.
*/
static isBigNumber(value: any): boolean;
/**
*
* Returns a BigNumber whose value is the maximum of the arguments.
*
* Accepts either an argument list or an array of values.
*
* The return value is always exact and unrounded.
*
* ```ts
* x = new BigNumber('3257869345.0378653')
* BigNumber.maximum(4e9, x, '123456789.9') // '4000000000'
*
* arr = [12, '13', new BigNumber(14)]
* BigNumber.maximum(arr) // '14'
* ```
*
* @param n A numeric value.
*/
static maximum(...n: BigNumber.Value[]): BigNumber;
/**
* Returns a BigNumber whose value is the maximum of the arguments.
*
* Accepts either an argument list or an array of values.
*
* The return value is always exact and unrounded.
*
* ```ts
* x = new BigNumber('3257869345.0378653')
* BigNumber.max(4e9, x, '123456789.9') // '4000000000'
*
* arr = [12, '13', new BigNumber(14)]
* BigNumber.max(arr) // '14'
* ```
*
* @param n A numeric value.
*/
static max(...n: BigNumber.Value[]): BigNumber;
/**
* Returns a BigNumber whose value is the minimum of the arguments.
*
* Accepts either an argument list or an array of values.
*
* The return value is always exact and unrounded.
*
* ```ts
* x = new BigNumber('3257869345.0378653')
* BigNumber.minimum(4e9, x, '123456789.9') // '123456789.9'
*
* arr = [2, new BigNumber(-14), '-15.9999', -12]
* BigNumber.minimum(arr) // '-15.9999'
* ```
*
* @param n A numeric value.
*/
static minimum(...n: BigNumber.Value[]): BigNumber;
/**
* Returns a BigNumber whose value is the minimum of the arguments.
*
* Accepts either an argument list or an array of values.
*
* The return value is always exact and unrounded.
*
* ```ts
* x = new BigNumber('3257869345.0378653')
* BigNumber.min(4e9, x, '123456789.9') // '123456789.9'
*
* arr = [2, new BigNumber(-14), '-15.9999', -12]
* BigNumber.min(arr) // '-15.9999'
* ```
*
* @param n A numeric value.
*/
static min(...n: BigNumber.Value[]): BigNumber;
/**
* Returns a new BigNumber with a pseudo-random value equal to or greater than 0 and less than 1.
*
* The return value will have `decimalPlaces` decimal places, or less if trailing zeros are
* produced. If `decimalPlaces` is omitted, the current `DECIMAL_PLACES` setting will be used.
*
* Depending on the value of this BigNumber constructor's `CRYPTO` setting and the support for the
* `crypto` object in the host environment, the random digits of the return value are generated by
* either `Math.random` (fastest), `crypto.getRandomValues` (Web Cryptography API in recent
* browsers) or `crypto.randomBytes` (Node.js).
*
* If `CRYPTO` is true, i.e. one of the `crypto` methods is to be used, the value of a returned
* BigNumber should be cryptographically secure and statistically indistinguishable from a random
* value.
*
* Throws if `decimalPlaces` is invalid.
*
* ```ts
* BigNumber.config({ DECIMAL_PLACES: 10 })
* BigNumber.random() // '0.4117936847'
* BigNumber.random(20) // '0.78193327636914089009'
* ```
*
* @param [decimalPlaces] Decimal places, integer, 0 to 1e+9.
*/
static random(decimalPlaces?: number): BigNumber;
/**
* Configures the settings that apply to this BigNumber constructor.
*
* The configuration object, `object`, contains any number of the properties shown in the example
* below.
*
* Returns an object with the above properties and their current values.
*
* Throws if `object` is not an object, or if an invalid value is assigned to one or more of the
* properties.
*
* ```ts
* BigNumber.set({
* DECIMAL_PLACES: 40,
* ROUNDING_MODE: BigNumber.ROUND_HALF_CEIL,
* EXPONENTIAL_AT: [-10, 20],
* RANGE: [-500, 500],
* CRYPTO: true,
* MODULO_MODE: BigNumber.ROUND_FLOOR,
* POW_PRECISION: 80,
* FORMAT: {
* groupSize: 3,
* groupSeparator: ' ',
* decimalSeparator: ','
* },
* ALPHABET: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_'
* });
*
* BigNumber.set().DECIMAL_PLACES // 40
* ```
*
* @param object The configuration object.
*/
static set(object: BigNumber.Config): BigNumber.Config;
/**
* Helps ES6 import.
*/
private static readonly default?: BigNumber.Constructor;
/**
* Helps ES6 import.
*/
private static readonly BigNumber?: BigNumber.Constructor;
/**
* Rounds away from zero.
*/
static readonly ROUND_UP: 0;
/**
* Rounds towards zero.
*/
static readonly ROUND_DOWN: 1;
/**
* Rounds towards Infinity.
*/
static readonly ROUND_CEIL: 2;
/**
* Rounds towards -Infinity.
*/
static readonly ROUND_FLOOR: 3;
/**
* Rounds towards nearest neighbour. If equidistant, rounds away from zero .
*/
static readonly ROUND_HALF_UP: 4;
/**
* Rounds towards nearest neighbour. If equidistant, rounds towards zero.
*/
static readonly ROUND_HALF_DOWN: 5;
/**
* Rounds towards nearest neighbour. If equidistant, rounds towards even neighbour.
*/
static readonly ROUND_HALF_EVEN: 6;
/**
* Rounds towards nearest neighbour. If equidistant, rounds towards Infinity.
*/
static readonly ROUND_HALF_CEIL: 7;
/**
* Rounds towards nearest neighbour. If equidistant, rounds towards -Infinity.
*/
static readonly ROUND_HALF_FLOOR: 8;
/**
* See `MODULO_MODE`.
*/
static readonly EUCLID: 9;
/**
* To aid in debugging, if a `BigNumber.DEBUG` property is `true` then an error will be thrown
* on an invalid `BigNumber.Value`.
*
* ```ts
* // No error, and BigNumber NaN is returned.
* new BigNumber('blurgh') // 'NaN'
* new BigNumber(9, 2) // 'NaN'
* BigNumber.DEBUG = true
* new BigNumber('blurgh') // '[BigNumber Error] Not a number'
* new BigNumber(9, 2) // '[BigNumber Error] Not a base 2 number'
* ```
*
* An error will also be thrown if a `BigNumber.Value` is of type number with more than 15
* significant digits, as calling `toString` or `valueOf` on such numbers may not result
* in the intended value.
*
* ```ts
* console.log(823456789123456.3) // 823456789123456.2
* // No error, and the returned BigNumber does not have the same value as the number literal.
* new BigNumber(823456789123456.3) // '823456789123456.2'
* BigNumber.DEBUG = true
* new BigNumber(823456789123456.3)
* // '[BigNumber Error] Number primitive has more than 15 significant digits'
* ```
*
*/
static DEBUG?: boolean;
}