1/*
2 * Copyright (c) 2024 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/**
17 * @file Defines the Decimal for ArkTS. Decimal support arbitrary precision decimal operation.
18 * @kit ArkTS
19 */
20
21/**
22 * The type uesd to set rounding
23 *
24 * @syscap SystemCapability.Utils.Lang
25 * @atomicservice
26 * @since 12
27 */
28type Rounding = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
29
30/**
31 * The type uesd to set modulo
32 *
33 * @syscap SystemCapability.Utils.Lang
34 * @atomicservice
35 * @since 12
36 */
37type Modulo = Rounding | 9;
38
39/**
40 * The type uesd to denote decimal value
41 *
42 * @syscap SystemCapability.Utils.Lang
43 * @atomicservice
44 * @since 12
45 */
46type Value = string | number | Decimal;
47
48/**
49 * Provides configuration for decimal.
50 *
51 * @interface DecimalConfig
52 * @syscap SystemCapability.Utils.Lang
53 * @atomicservice
54 * @since 12
55 */
56interface DecimalConfig {
57  /**
58   * The maximum number of significant digits of the result of an operation.
59   * Default value: 20
60   *
61   * @type { number } integer, 1 to 1e+9 inclusive
62   * @syscap SystemCapability.Utils.Lang
63   * @atomicservice
64   * @since 12
65   */
66  precision?: number;
67  /**
68   * The default rounding mode used when rounding the result of an operation to precision significant digits,
69   * and when rounding the return value of the round, toBinary, toDecimalPlaces, toExponential, toFixed,
70   * toHexadecimal, toNearest, toOctal, toPrecision and toSignificantDigits methods.
71   * Default value: 4 (ROUND_HALF_UP)
72   *
73   * @type { number } integer, integer, 0 to 8 inclusive
74   * @syscap SystemCapability.Utils.Lang
75   * @atomicservice
76   * @since 12
77   */
78  rounding?: Rounding;
79  /**
80   * The negative exponent value at and below which toString returns exponential notation.
81   * Default value: -7
82   *
83   * @type { number } integer, -9e15 to 0 inclusive
84   * @syscap SystemCapability.Utils.Lang
85   * @atomicservice
86   * @since 12
87   */
88  toExpNeg?: number;
89  /**
90   * The positive exponent value at and above which toString returns exponential notation.
91   * Default value: 20
92   *
93   * @type { number } integer, 0 to 9e15 inclusive
94   * @syscap SystemCapability.Utils.Lang
95   * @atomicservice
96   * @since 12
97   */
98  toExpPos?: number;
99  /**
100   * The negative exponent limit, i.e. the exponent value below which underflow to zero occurs.
101   * Default value: -9e15
102   *
103   * @type { number } integer, -9e15 to 0 inclusive
104   * @syscap SystemCapability.Utils.Lang
105   * @atomicservice
106   * @since 12
107   */
108  minE?: number;
109  /**
110   * The positive exponent limit, i.e. the exponent value above which overflow to Infinity occurs.
111   * Default value: 9e15
112   *
113   * @type { number } integer, 0 to 9e15 inclusive
114   * @syscap SystemCapability.Utils.Lang
115   * @atomicservice
116   * @since 12
117   */
118  maxE?: number;
119  /**
120   * The value that determines whether cryptographically-secure pseudo-random number generation is used.
121   * Default value: false
122   *
123   * @type { boolean }
124   * @syscap SystemCapability.Utils.Lang
125   * @atomicservice
126   * @since 12
127   */
128  crypto?: boolean;
129  /**
130   * The modulo mode used when calculating the modulus: a mod n.
131   * Default value: 1 (ROUND_DOWN)
132   *
133   * @type { number } integer, 0 to 9 inclusive
134   * @syscap SystemCapability.Utils.Lang
135   * @atomicservice
136   * @since 12
137   */
138  modulo?: Modulo;
139  /**
140   * If object has a 'defaults' property with value true then the new constructor will use the default configuration.
141   * Default value: false
142   *
143   * @type { boolean }
144   * @syscap SystemCapability.Utils.Lang
145   * @atomicservice
146   * @since 12
147   */
148  defaults?: boolean;
149}
150
151/**
152 * An arbitrary-precision Decimal type
153 *
154 * @syscap SystemCapability.Utils.Lang
155 * @atomicservice
156 * @since 12
157 */
158declare class Decimal {
159  /**
160   * The numbers of decimal digits.
161   *
162   * @type { number[] }
163   * @readonly
164   * @syscap SystemCapability.Utils.Lang
165   * @atomicservice
166   * @since 12
167   */
168  readonly d: number[];
169
170  /**
171   * The number of decimal exponent.
172   *
173   * @type { number }
174   * @readonly
175   * @syscap SystemCapability.Utils.Lang
176   * @atomicservice
177   * @since 12
178   */
179  readonly e: number;
180
181  /**
182   * The number of decimal sign.
183   *
184   * @type { number }
185   * @readonly
186   * @syscap SystemCapability.Utils.Lang
187   * @atomicservice
188   * @since 12
189   */
190  readonly s: number;
191
192  /**
193   * Return a new Decimal whose value is the absolute value of this Decimal.
194   *
195   * @param { Value } n {number | string | Decimal}
196   * @throws { BusinessError } 401 - Parameter error. Possible causes:
197   *                                    1. Incorrect parameter types;
198   *                                    2. Parameter verification failed.
199   * @syscap SystemCapability.Utils.Lang
200   * @atomicservice
201   * @since 12
202   */
203  constructor(n: Value);
204
205  /**
206   * Return a new Decimal whose value is the absolute value of this Decimal.
207   *
208   * @returns { Decimal } the Decimal type
209   * @syscap SystemCapability.Utils.Lang
210   * @atomicservice
211   * @since 12
212   */
213  abs(): Decimal;
214
215  /**
216   * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the
217   * direction of negative Infinity.
218   *
219   * @returns { Decimal } the Decimal type
220   * @syscap SystemCapability.Utils.Lang
221   * @atomicservice
222   * @since 12
223   */
224  floor(): Decimal;
225
226  /**
227   * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the
228   * direction of positive Infinity.
229   *
230   * @returns { Decimal } the Decimal type
231   * @syscap SystemCapability.Utils.Lang
232   * @atomicservice
233   * @since 12
234   */
235  ceil(): Decimal;
236
237  /**
238   * Return a new Decimal whose value is the value of this Decimal truncated to a whole number.
239   *
240   * @returns { Decimal } the Decimal type
241   * @syscap SystemCapability.Utils.Lang
242   * @atomicservice
243   * @since 12
244   */
245  trunc(): Decimal;
246
247  /**
248   * Return a new Decimal whose value is the value of this Decimal clamped to the range
249   * delineated by `min` and `max`.
250   *
251   * @param { Value } min {number | string | Decimal}
252   * @param { Value } max {number | string | Decimal}
253   * @returns { Decimal } the Decimal type
254   * @throws { BusinessError } 401 - Parameter error. Possible causes:
255   *                                    1. Incorrect parameter types;
256   *                                    2. Parameter verification failed.
257   * @throws { BusinessError } 10200001 - The value of `min` is out of range.
258   * @syscap SystemCapability.Utils.Lang
259   * @atomicservice
260   * @since 12
261   */
262  clamp(min: Value, max: Value): Decimal;
263
264  /**
265   * Return a new Decimal whose value is the value of this Decimal plus `n`, rounded to `precision`
266   * significant digits using rounding mode `rounding`.
267   *
268   * @param { Value } n {number | string | Decimal}
269   * @returns { Decimal } the Decimal type
270   * @throws { BusinessError } 401 - Parameter error. Possible causes:
271   *                                    1. Incorrect parameter types;
272   *                                    2. Parameter verification failed.
273   * @syscap SystemCapability.Utils.Lang
274   * @atomicservice
275   * @since 12
276   */
277  add(n: Value): Decimal;
278
279  /**
280   * Return a new Decimal whose value is the value of this Decimal minus `n`, rounded to `precision`
281   * significant digits using rounding mode `rounding`.
282   *
283   * @param { Value } n {number | string | Decimal}
284   * @returns { Decimal } the Decimal type
285   * @throws { BusinessError } 401 - Parameter error. Possible causes:
286   *                                    1. Incorrect parameter types;
287   *                                    2. Parameter verification failed.
288   * @syscap SystemCapability.Utils.Lang
289   * @atomicservice
290   * @since 12
291   */
292  sub(n: Value): Decimal;
293
294  /**
295   * Return a new Decimal whose value is this Decimal times `n`, rounded to `precision` significant
296   * digits using rounding mode `rounding`.
297   *
298   * @param { Value } n {number | string | Decimal}
299   * @returns { Decimal } the Decimal type
300   * @throws { BusinessError } 401 - Parameter error. Possible causes:
301   *                                    1. Incorrect parameter types;
302   *                                    2. Parameter verification failed.
303   * @syscap SystemCapability.Utils.Lang
304   * @atomicservice
305   * @since 12
306   */
307  mul(n: Value): Decimal;
308
309  /**
310   * Return a new Decimal whose value is the value of this Decimal divided by `n`, rounded to
311   * `precision` significant digits using rounding mode `rounding`.
312   *
313   * @param { Value } n {number | string | Decimal}
314   * @returns { Decimal } the Decimal type
315   * @throws { BusinessError } 401 - Parameter error. Possible causes:
316   *                                    1. Incorrect parameter types;
317   *                                    2. Parameter verification failed.
318   * @syscap SystemCapability.Utils.Lang
319   * @atomicservice
320   * @since 12
321   */
322  div(n: Value): Decimal;
323
324  /**
325   * Return a new Decimal whose value is the value of this Decimal modulo `n`, rounded to
326   * `precision` significant digits using rounding mode `rounding`.
327   *
328   * @param { Value } n {number | string | Decimal}
329   * @returns { Decimal }the Decimal type
330   * @throws { BusinessError } 401 - Parameter error. Possible causes:
331   *                                    1. Incorrect parameter types;
332   *                                    2. Parameter verification failed.
333   * @syscap SystemCapability.Utils.Lang
334   * @atomicservice
335   * @since 12
336   */
337  mod(n: Value): Decimal;
338
339  /**
340   * Return a new Decimal whose value is the square root of this Decimal, rounded to `precision`
341   * significant digits using rounding mode `rounding`.
342   *
343   * @returns { Decimal } the Decimal type
344   * @syscap SystemCapability.Utils.Lang
345   * @atomicservice
346   * @since 12
347   */
348  sqrt(): Decimal;
349
350  /**
351   * Return a new Decimal whose value is the cube root of the value of this Decimal, rounded to
352   * `precision` significant digits using rounding mode `rounding`.
353   *
354   * @returns { Decimal } the Decimal type
355   * @syscap SystemCapability.Utils.Lang
356   * @atomicservice
357   * @since 12
358   */
359  cbrt(): Decimal;
360
361  /**
362   * Return a new Decimal whose value is the value of this Decimal raised to the power `n`, rounded
363   * to `precision` significant digits using rounding mode `rounding`.
364   *
365   * @param { Value } n {number | string | Decimal}
366   * @returns { Decimal } the Decimal type
367   * @throws { BusinessError } 401 - Parameter error. Possible causes:
368   *                                    1. Incorrect parameter types;
369   *                                    2. Parameter verification failed.
370   * @throws { BusinessError } 10200060 - Precision limit exceeded.
371   * @syscap SystemCapability.Utils.Lang
372   * @atomicservice
373   * @since 12
374   */
375  pow(n: Value): Decimal;
376
377  /**
378   * Return a new Decimal whose value is the natural exponential of the value of this Decimal,
379   * i.e. the base e raised to the power the value of this Decimal, rounded to `precision`
380   * significant digits using rounding mode `rounding`.
381   *
382   * @returns { Decimal } the Decimal type
383   * @throws { BusinessError } 10200060 - Precision limit exceeded.
384   * @syscap SystemCapability.Utils.Lang
385   * @atomicservice
386   * @since 12
387   */
388  exp(): Decimal;
389
390  /**
391   * Return the logarithm of the value of this Decimal to the specified base, rounded to `precision`
392   * significant digits using rounding mode `rounding`.
393   *
394   * @param { Value } n {number | string | Decimal}
395   * @returns { Decimal } the Decimal type
396   * @throws { BusinessError } 401 - Parameter error. Possible causes:
397   *                                    1. Incorrect parameter types;
398   *                                    2. Parameter verification failed.
399   * @throws { BusinessError } 10200060 - Precision limit exceeded.
400   * @syscap SystemCapability.Utils.Lang
401   * @atomicservice
402   * @since 12
403   */
404  log(n: Value): Decimal;
405
406  /**
407   * Return a new Decimal whose value is the natural logarithm of the value of this Decimal,
408   * rounded to `precision` significant digits using rounding mode `rounding`.
409   *
410   * @returns { Decimal } the Decimal type
411   * @throws { BusinessError } 10200060 - Precision limit exceeded.
412   * @syscap SystemCapability.Utils.Lang
413   * @atomicservice
414   * @since 12
415   */
416  ln(): Decimal;
417
418  /**
419   * Return a new Decimal whose value is the cosine of the value in radians of this Decimal.
420   *
421   * @returns { Decimal } the Decimal type
422   * @syscap SystemCapability.Utils.Lang
423   * @atomicservice
424   * @since 12
425   */
426  cos(): Decimal;
427
428  /**
429   * Return a new Decimal whose value is the sine of the value in radians of this Decimal.
430   *
431   * @returns { Decimal } the Decimal type
432   * @syscap SystemCapability.Utils.Lang
433   * @atomicservice
434   * @since 12
435   */
436  sin(): Decimal;
437
438  /**
439   * Return a new Decimal whose value is the tangent of the value in radians of this Decimal.
440   *
441   * @returns { Decimal } the Decimal type
442   * @syscap SystemCapability.Utils.Lang
443   * @atomicservice
444   * @since 12
445   */
446  tan(): Decimal;
447
448  /**
449   * Return a new Decimal whose value is the hyperbolic cosine of the value in radians of this
450   * Decimal.
451   *
452   * @returns { Decimal } the Decimal type
453   * @syscap SystemCapability.Utils.Lang
454   * @atomicservice
455   * @since 12
456   */
457  cosh(): Decimal;
458
459  /**
460   * Return a new Decimal whose value is the hyperbolic sine of the value in radians of this Decimal.
461   *
462   * @returns { Decimal } the Decimal type
463   * @syscap SystemCapability.Utils.Lang
464   * @atomicservice
465   * @since 12
466   */
467  sinh(): Decimal;
468
469  /**
470   * Return a new Decimal whose value is the hyperbolic tangent of the value in radians of this Decimal.
471   *
472   * @returns { Decimal } the Decimal type
473   * @syscap SystemCapability.Utils.Lang
474   * @atomicservice
475   * @since 12
476   */
477  tanh(): Decimal;
478
479  /**
480   * Return a new Decimal whose value is the arccosine (inverse cosine) in radians of the value of this Decimal.
481   *
482   * @returns { Decimal } the Decimal type
483   * @throws { BusinessError } 10200060 - Precision limit exceeded.
484   * @syscap SystemCapability.Utils.Lang
485   * @atomicservice
486   * @since 12
487   */
488  acos(): Decimal;
489
490  /**
491   * Return a new Decimal whose value is the arcsine (inverse sine) in radians of the value of this
492   * Decimal.
493   *
494   * @returns { Decimal } the Decimal type
495   * @throws { BusinessError } 10200060 - Precision limit exceeded.
496   * @syscap SystemCapability.Utils.Lang
497   * @atomicservice
498   * @since 12
499   */
500  asin(): Decimal;
501
502  /**
503   * Return a new Decimal whose value is the arctangent (inverse tangent) in radians of the value of this Decimal.
504   *
505   * @returns { Decimal } the Decimal type
506   * @throws { BusinessError } 10200060 - Precision limit exceeded.
507   * @syscap SystemCapability.Utils.Lang
508   * @atomicservice
509   * @since 12
510   */
511  atan(): Decimal;
512
513  /**
514   * Return a new Decimal whose value is the inverse of the hyperbolic cosine in radians of the
515   * value of this Decimal.
516   *
517   * @returns { Decimal } the Decimal type
518   * @throws { BusinessError } 10200060 - Precision limit exceeded.
519   * @syscap SystemCapability.Utils.Lang
520   * @atomicservice
521   * @since 12
522   */
523  acosh(): Decimal;
524
525  /**
526   * Return a new Decimal whose value is the inverse of the hyperbolic sine in radians of the value
527   * of this Decimal.
528   *
529   * @returns { Decimal } the Decimal type
530   * @throws { BusinessError } 10200060 - Precision limit exceeded.
531   * @syscap SystemCapability.Utils.Lang
532   * @atomicservice
533   * @since 12
534   */
535  asinh(): Decimal;
536
537  /**
538   * Return a new Decimal whose value is the inverse of the hyperbolic tangent in radians of the
539   * value of this Decimal.
540   *
541   * @returns { Decimal } the Decimal type
542   * @throws { BusinessError } 10200060 - Precision limit exceeded.
543   * @syscap SystemCapability.Utils.Lang
544   * @atomicservice
545   * @since 12
546   */
547  atanh(): Decimal;
548
549  /**
550   * Return
551   *   1    if the value of this Decimal is greater than the value of `n`,
552   *  -1    if the value of this Decimal is less than the value of `n`,
553   *   0    if they have the same value,
554   *   NaN  if the value of either Decimal is NaN.
555   *
556   * @param { Value } n {number | string | Decimal}
557   * @returns { number } the number type
558   * @throws { BusinessError } 401 - Parameter error. Possible causes:
559   *                                    1. Incorrect parameter types;
560   *                                    2. Parameter verification failed.
561   * @syscap SystemCapability.Utils.Lang
562   * @atomicservice
563   * @since 12
564   */
565  comparedTo(n: Value): number;
566
567  /**
568   * Return true if the value of this Decimal is equal to the value of `n`, otherwise return false.
569   *
570   * @param { Value } n {number | string | Decimal}
571   * @returns { boolean } the boolean type
572   * @throws { BusinessError } 401 - Parameter error. Possible causes:
573   *                                    1. Incorrect parameter types;
574   *                                    2. Parameter verification failed.
575   * @syscap SystemCapability.Utils.Lang
576   * @atomicservice
577   * @since 12
578   */
579  equals(n: Value): boolean;
580
581  /**
582   * Return true if the value of this Decimal is greater than the value of `n`, otherwise return false.
583   *
584   * @param { Value } n {number | string | Decimal}
585   * @returns { boolean } the boolean type
586   * @throws { BusinessError } 401 - Parameter error. Possible causes:
587   *                                    1. Incorrect parameter types;
588   *                                    2. Parameter verification failed.
589   * @syscap SystemCapability.Utils.Lang
590   * @atomicservice
591   * @since 12
592   */
593  greaterThan(n: Value): boolean;
594
595  /**
596   * Return true if the value of this Decimal is greater than or equal to the value of `n`,
597   * otherwise return false.
598   *
599   * @param { Value } n {number | string | Decimal}
600   * @returns { boolean } the boolean type
601   * @throws { BusinessError } 401 - Parameter error. Possible causes:
602   *                                    1. Incorrect parameter types;
603   *                                    2. Parameter verification failed.
604   * @syscap SystemCapability.Utils.Lang
605   * @atomicservice
606   * @since 12
607   */
608  greaterThanOrEqualTo(n: Value): boolean;
609
610  /**
611   * Return true if the value of this Decimal is less than `n`, otherwise return false.
612   *
613   * @param { Value } n {number | string | Decimal}
614   * @returns { boolean } the boolean type
615   * @throws { BusinessError } 401 - Parameter error. Possible causes:
616   *                                    1. Incorrect parameter types;
617   *                                    2. Parameter verification failed.
618   * @syscap SystemCapability.Utils.Lang
619   * @atomicservice
620   * @since 12
621   */
622  lessThan(n: Value): boolean;
623
624  /**
625   * Return true if the value of this Decimal is less than or equal to `n`, otherwise return false.
626   *
627   * @param { Value } n {number | string | Decimal}
628   * @returns { boolean } the boolean type
629   * @throws { BusinessError } 401 - Parameter error. Possible causes:
630   *                                    1. Incorrect parameter types;
631   *                                    2. Parameter verification failed.
632   * @syscap SystemCapability.Utils.Lang
633   * @atomicservice
634   * @since 12
635   */
636  lessThanOrEqualTo(n: Value): boolean;
637
638  /**
639   * Return true if the value of this Decimal is a finite number, otherwise return false.
640   *
641   * @returns { boolean } the boolean type
642   * @syscap SystemCapability.Utils.Lang
643   * @atomicservice
644   * @since 12
645   */
646  isFinite(): boolean;
647
648  /**
649   * Return true if the value of this Decimal is an integer, otherwise return false.
650   *
651   * @returns { boolean } the boolean type
652   * @syscap SystemCapability.Utils.Lang
653   * @atomicservice
654   * @since 12
655   */
656  isInteger(): boolean;
657
658  /**
659   * Return true if the value of this Decimal is NaN, otherwise return false.
660   *
661   * @returns { boolean } the boolean type
662   * @syscap SystemCapability.Utils.Lang
663   * @atomicservice
664   * @since 12
665   */
666  isNaN(): boolean;
667
668  /**
669   * Return true if the value of this Decimal is negative, otherwise return false.
670   *
671   * @returns { boolean } the boolean type
672   * @syscap SystemCapability.Utils.Lang
673   * @atomicservice
674   * @since 12
675   */
676  isNegative(): boolean;
677
678  /**
679   * Return true if the value of this Decimal is positive, otherwise return false.
680   *
681   * @returns { boolean } the boolean type
682   * @syscap SystemCapability.Utils.Lang
683   * @atomicservice
684   * @since 12
685   */
686  isPositive(): boolean;
687
688  /**
689   * Return true if the value of this Decimal is 0 or -0, otherwise return false.
690   *
691   * @returns { boolean } the boolean type
692   * @syscap SystemCapability.Utils.Lang
693   * @atomicservice
694   * @since 12
695   */
696  isZero(): boolean;
697
698  /**
699   * Return a new Decimal whose value is the integer part of dividing the value of this Decimal
700   * by the value of `n`, rounded to `precision` significant digits using rounding mode `rounding`.
701   *
702   * @param { Value } n {number | string | Decimal}
703   * @returns { Decimal } the Decimal type
704   * @throws { BusinessError } 401 - Parameter error. Possible causes:
705   *                                    1. Incorrect parameter types;
706   *                                    2. Parameter verification failed.
707   * @syscap SystemCapability.Utils.Lang
708   * @atomicservice
709   * @since 12
710   */
711  dividedToIntegerBy(n: Value): Decimal;
712
713  /**
714   * Return a new Decimal whose value is the value of this Decimal negated, i.e. as if multiplied by -1.
715   *
716   * @returns { Decimal } the Decimal type
717   * @syscap SystemCapability.Utils.Lang
718   * @atomicservice
719   * @since 12
720   */
721  negate(): Decimal;
722
723  /**
724   * Return a string representing the value of this Decimal in base 2.
725   *
726   * @returns { string } the string type
727   * @syscap SystemCapability.Utils.Lang
728   * @atomicservice
729   * @since 12
730   */
731  toBinary(): string;
732
733  /**
734   * Return a string representing the value of this Decimal in base 2, round to `significantDigits`
735   * significant digits.
736   *
737   * @param { number } significantDigits Significant digits. Integer, 1 to MAX_DIGITS inclusive.
738   * @returns { string } the string type
739   * @throws { BusinessError } 10200001 - The value of `significantDigits` is out of range.
740   * @syscap SystemCapability.Utils.Lang
741   * @atomicservice
742   * @since 12
743   */
744  toBinary(significantDigits: number): string;
745
746  /**
747   * Return a string representing the value of this Decimal in base 2, round to `significantDigits`
748   * significant digits using rounding mode `rounding`.
749   *
750   * @param { number } significantDigits Significant digits. Integer, 1 to MAX_DIGITS inclusive.
751   * @param { Rounding } rounding Rounding mode. Integer, 0 to 8 inclusive.
752   * @returns { string } the string type
753   * @throws { BusinessError } 10200001 - The value of `significantDigits | rounding` is out of range.
754   * @syscap SystemCapability.Utils.Lang
755   * @atomicservice
756   * @since 12
757   */
758  toBinary(significantDigits: number, rounding: Rounding): string;
759
760  /**
761   * Return a string representing the value of this Decimal in base 8.
762   *
763   * @returns { string } the string type
764   * @syscap SystemCapability.Utils.Lang
765   * @atomicservice
766   * @since 12
767   */
768  toOctal(): string;
769
770  /**
771   * Return a string representing the value of this Decimal in base 8, round to `significantDigits` significant.
772   *
773   * @param { number } significantDigits {number | string | Decimal}
774   * @returns { string } the string type
775   * @throws { BusinessError } 10200001 - The value of `significantDigits` is out of range.
776   * @syscap SystemCapability.Utils.Lang
777   * @atomicservice
778   * @since 12
779   */
780  toOctal(significantDigits: number): string;
781
782  /**
783   * Return a string representing the value of this Decimal in base 8, round to `significantDigits` significant
784   * digits using rounding mode `rounding`.
785   *
786   * @param { number } significantDigits {number | string | Decimal}
787   * @param { Rounding } rounding Rounding mode. Integer, 0 to 8 inclusive.
788   * @returns { string } the string type
789   * @throws { BusinessError } 10200001 - The value of `significantDigits | rounding` is out of range.
790   * @syscap SystemCapability.Utils.Lang
791   * @atomicservice
792   * @since 12
793   */
794  toOctal(significantDigits: number, rounding: Rounding): string;
795
796  /**
797   * Return a string representing the value of this Decimal in base 16
798   *
799   * @returns { string } the string type
800   * @syscap SystemCapability.Utils.Lang
801   * @atomicservice
802   * @since 12
803   */
804  toHexadecimal(): string;
805
806  /**
807   * Return a string representing the value of this Decimal in base 16, round to `significantDigits` significant.
808   *
809   * @param { number } significantDigits Significant digits. Integer, 1 to MAX_DIGITS inclusive.
810   * @returns { string } the string type
811   * @throws { BusinessError } 10200001 - The value of `significantDigits` is out of range.
812   * @syscap SystemCapability.Utils.Lang
813   * @atomicservice
814   * @since 12
815   */
816  toHexadecimal(significantDigits: number): string;
817
818  /**
819   * Return a string representing the value of this Decimal in base 16, round to `significantDigits` significant
820   * digits using rounding mode `rounding`.
821   *
822   * @param { number } significantDigits Significant digits. Integer, 1 to MAX_DIGITS inclusive.
823   * @param { Rounding } rounding Rounding mode. Integer, 0 to 8 inclusive.
824   * @returns { string } the string type
825   * @throws { BusinessError } 10200001 - The value of `significantDigits | rounding` is out of range.
826   * @syscap SystemCapability.Utils.Lang
827   * @atomicservice
828   * @since 12
829   */
830  toHexadecimal(significantDigits: number, rounding: Rounding): string;
831
832  /**
833   * Return a new Decimal whose value is the value of this Decimal.
834   *
835   * @returns { Decimal } the Decimal type
836   * @syscap SystemCapability.Utils.Lang
837   * @atomicservice
838   * @since 12
839   */
840  toDecimalPlaces(): Decimal;
841
842  /**
843   * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `decimalPlaces`
844   * decimal places.
845   *
846   * @param { number } decimalPlaces Significant digits. Integer, 1 to MAX_DIGITS inclusive.
847   * @returns { Decimal } the Decimal type
848   * @throws { BusinessError } 10200001 - The value of `decimalPlaces` is out of range.
849   * @syscap SystemCapability.Utils.Lang
850   * @atomicservice
851   * @since 12
852   */
853  toDecimalPlaces(decimalPlaces: number): Decimal;
854
855  /**
856   * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `decimalPlaces`
857   * decimal places using rounding mode `rounding`.
858   *
859   * @param { number } decimalPlaces Significant digits. Integer, 1 to MAX_DIGITS inclusive.
860   * @param { Rounding } rounding Rounding mode. Integer, 0 to 8 inclusive.
861   * @returns { Decimal } the Decimal type
862   * @throws { BusinessError } 10200001 - The value of `decimalPlaces | rounding` is out of range.
863   * @syscap SystemCapability.Utils.Lang
864   * @atomicservice
865   * @since 12
866   */
867  toDecimalPlaces(decimalPlaces: number, rounding: Rounding): Decimal;
868
869  /**
870   * Return a string representing the value of this Decimal in exponential notation.
871   *
872   * @returns { string } the string type
873   * @syscap SystemCapability.Utils.Lang
874   * @atomicservice
875   * @since 12
876   */
877  toExponential(): string;
878
879  /**
880   * Return a string representing the value of this Decimal in exponential notation rounded to
881   * `decimalPlaces` fixed decimal places.
882   *
883   * @param { number } decimalPlaces Decimal places. Integer, 0 to MAX_DIGITS inclusive.
884   * @returns { string } the string type
885   * @throws { BusinessError } 10200001 - The value of `decimalPlaces` is out of range.
886   * @syscap SystemCapability.Utils.Lang
887   * @atomicservice
888   * @since 12
889   */
890  toExponential(decimalPlaces: number): string;
891
892  /**
893   * Return a string representing the value of this Decimal in exponential notation rounded to
894   * `decimalPlaces` fixed decimal places using rounding mode `rounding`.
895   *
896   * @param { number } decimalPlaces Decimal places. Integer, 0 to MAX_DIGITS inclusive.
897   * @param { Rounding } rounding Rounding mode. Integer, 0 to 8 inclusive.
898   * @returns { string } the string type
899   * @throws { BusinessError } 10200001 - The value of `decimalPlaces | rounding` is out of range.
900   * @syscap SystemCapability.Utils.Lang
901   * @atomicservice
902   * @since 12
903   */
904  toExponential(decimalPlaces: number, rounding: Rounding): string;
905
906  /**
907   * Return a string representing the value of this Decimal in normal (fixed-point).
908   *
909   * @returns { string } the string type
910   * @syscap SystemCapability.Utils.Lang
911   * @atomicservice
912   * @since 12
913   */
914  toFixed(): string;
915
916  /**
917   * Return a string representing the value of this Decimal in normal (fixed-point) notation to
918   * `decimalPlaces` fixed decimal places.
919   *
920   * @param { number } decimalPlaces Decimal places. Integer, 0 to MAX_DIGITS inclusive.
921   * @returns { string } the string type
922   * @throws { BusinessError } 10200001 - The value of `decimalPlaces` is out of range.
923   * @atomicservice
924   * @since 12
925   */
926  toFixed(decimalPlaces: number): string;
927
928  /**
929   * Return a string representing the value of this Decimal in normal (fixed-point) notation to
930   * `decimalPlaces` fixed decimal places and rounded using rounding mode `rounding`.
931   *
932   * @param { number } decimalPlaces Decimal places. Integer, 0 to MAX_DIGITS inclusive.
933   * @param { Rounding } rounding Rounding mode. Integer, 0 to 8 inclusive.
934   * @returns { string } the string type
935   * @throws { BusinessError } 10200001 - The value of `decimalPlaces | rounding` is out of range.
936   * @syscap SystemCapability.Utils.Lang
937   * @atomicservice
938   * @since 12
939   */
940  toFixed(decimalPlaces: number, rounding: Rounding): string;
941
942  /**
943   * Return an array representing the value of this Decimal as a simple fraction with an integer
944   * numerator and an integer denominator.
945   *
946   * @returns { Decimal[] } the Decimal[] type
947   * @syscap SystemCapability.Utils.Lang
948   * @atomicservice
949   * @since 12
950   */
951  toFraction(): Decimal[];
952
953  /**
954   * Return an array representing the value of this Decimal as a simple fraction with an integer
955   * numerator and an integer denominator. The denominator will be a positive non-zero value
956   * less than or equal to `max_denominator`.
957   *
958   * @param { Value } maxDenominator {number | string | Decimal}
959   * @returns { Decimal[] } the Decimal[] type
960   * @throws { BusinessError } 401 - Parameter error. Possible causes:
961   *                                    1. Incorrect parameter types;
962   *                                    2. Parameter verification failed.
963   * @syscap SystemCapability.Utils.Lang
964   * @atomicservice
965   * @since 12
966   */
967  toFraction(maxDenominator: Value): Decimal[];
968
969  /**
970   * Returns a new Decimal whose value is the nearest multiple of `n`.
971   *
972   * @param { Value } n {number | string | Decimal}
973   * @returns { Decimal } the Decimal type
974   * @throws { BusinessError } 401 - Parameter error. Possible causes:
975   *                                    1. Incorrect parameter types;
976   *                                    2. Parameter verification failed.
977   * @syscap SystemCapability.Utils.Lang
978   * @atomicservice
979   * @since 12
980   */
981  toNearest(n: Value): Decimal;
982
983  /**
984   * Returns a new Decimal whose value is the nearest multiple of `n` in the direction of rounding
985   * mode `rounding`, to the value of this Decimal.
986   *
987   * @param { Value } n {number | string | Decimal}
988   * @param { Rounding } rounding Rounding mode. Integer, 0 to 8 inclusive.
989   * @returns { Decimal } the Decimal type
990   * @throws { BusinessError } 401 - Parameter error. Possible causes:
991   *                                    1. Incorrect parameter types;
992   *                                    2. Parameter verification failed.
993   * @throws { BusinessError } 10200001 - The value of `rounding` is out of range.
994   * @syscap SystemCapability.Utils.Lang
995   * @atomicservice
996   * @since 12
997   */
998  toNearest(n: Value, rounding: Rounding): Decimal;
999
1000  /**
1001   * Return a string representing the value of this Decimal.
1002   *
1003   * @returns { string } the string type
1004   * @syscap SystemCapability.Utils.Lang
1005   * @atomicservice
1006   * @since 12
1007   */
1008  toPrecision(): string;
1009
1010  /**
1011   * Return a string representing the value of this Decimal rounded to `significantDigits` significant digits.
1012   *
1013   * @param { number } significantDigits Significant digits. Integer, 1 to MAX_DIGITS inclusive.
1014   * @returns { string } the string type
1015   * @throws { BusinessError } 10200001 - The value of `significantDigits` is out of range.
1016   * @syscap SystemCapability.Utils.Lang
1017   * @atomicservice
1018   * @since 12
1019   */
1020  toPrecision(significantDigits: number): string;
1021
1022  /**
1023   * Return a string representing the value of this Decimal rounded to `significantDigits` significant digits
1024   * using rounding mode `rounding`.
1025   *
1026   * @param { number } significantDigits Significant digits. Integer, 1 to MAX_DIGITS inclusive.
1027   * @param { Rounding } rounding Rounding mode. Integer, 0 to 8 inclusive.
1028   * @returns { string } the string type
1029   * @throws { BusinessError } 10200001 - The value of `significantDigits | rounding` is out of range.
1030   * @syscap SystemCapability.Utils.Lang
1031   * @atomicservice
1032   * @since 12
1033   */
1034  toPrecision(significantDigits: number, rounding: Rounding): string;
1035
1036  /**
1037   * Return a new Decimal whose value is the value of this Decimal.
1038   *
1039   * @returns { Decimal } the Decimal type
1040   * @syscap SystemCapability.Utils.Lang
1041   * @atomicservice
1042   * @since 12
1043   */
1044  toSignificantDigits(): Decimal;
1045
1046  /**
1047   * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `significantDigits`
1048   * significant digits.
1049   *
1050   * @param { number } significantDigits Significant digits. Integer, 1 to MAX_DIGITS inclusive.
1051   * @returns { Decimal } the Decimal type
1052   * @throws { BusinessError } 10200001 - The value of `significantDigits` is out of range.
1053   * @syscap SystemCapability.Utils.Lang
1054   * @atomicservice
1055   * @since 12
1056   */
1057  toSignificantDigits(significantDigits: number): Decimal;
1058
1059  /**
1060   * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `significantDigits`
1061   * significant digits using rounding mode `rounding`.
1062   *
1063   * @param { number } significantDigits Significant digits. Integer, 1 to MAX_DIGITS inclusive.
1064   * @param { Rounding } rounding Rounding mode. Integer, 0 to 8 inclusive.
1065   * @returns { Decimal } the Decimal type
1066   * @throws { BusinessError } 10200001 - The value of `significantDigits | rounding` is out of range.
1067   * @syscap SystemCapability.Utils.Lang
1068   * @atomicservice
1069   * @since 12
1070   */
1071  toSignificantDigits(significantDigits: number, rounding: Rounding): Decimal;
1072
1073  /**
1074   * Return the value of this Decimal converted to a number primitive. Zero keeps its sign.
1075   *
1076   * @returns { number } the number type
1077   * @syscap SystemCapability.Utils.Lang
1078   * @atomicservice
1079   * @since 12
1080   */
1081  toNumber(): number;
1082
1083  /**
1084   * Return a string representing the value of this Decimal.
1085   * Return exponential notation if this Decimal has a positive exponent equal to or greater than
1086   * `toExpPos`, or a negative exponent equal to or less than `toExpNeg`.
1087   *
1088   * @returns { string } the string type
1089   * @syscap SystemCapability.Utils.Lang
1090   * @atomicservice
1091   * @since 12
1092   */
1093  toString(): string;
1094
1095  /**
1096   * Return a string representing the value of this Decimal.
1097   * Unlike `toString`, negative zero will include the minus sign.
1098   *
1099   * @returns { string } the string type
1100   * @syscap SystemCapability.Utils.Lang
1101   * @atomicservice
1102   * @since 12
1103   */
1104  valueOf(): string;
1105
1106  /**
1107   * Return the number of decimal places of the value of this Decimal.
1108   *
1109   * @returns { number } the number type
1110   * @syscap SystemCapability.Utils.Lang
1111   * @atomicservice
1112   * @since 12
1113   */
1114  decimalPlaces(): number;
1115
1116  /**
1117   * Return the number of significant digits of the value of this Decimal.
1118   *
1119   * @returns { number } the number type
1120   * @syscap SystemCapability.Utils.Lang
1121   * @atomicservice
1122   * @since 12
1123   */
1124  precision(): number;
1125
1126  /**
1127   * Return the number of significant digits of the value of this Decimal, whether to count 
1128   * integer-part trailing zeros.
1129   *
1130   * @param { boolean | number } includeZeros Whether to count integer-part trailing zeros: true, false,
1131   * 1 or 0.
1132   * @returns { number } the number type
1133   * @throws { BusinessError } 10200001 - The value of `includeZeros` is out of range.
1134   * @syscap SystemCapability.Utils.Lang
1135   * @atomicservice
1136   * @since 12
1137   */
1138  precision(includeZeros: boolean | number): number;
1139
1140  /**
1141   * Return a new Decimal whose value is the absolute value of `n`.
1142   *
1143   * @param { Value } n {number | string | Decimal}
1144   * @returns { Decimal } the Decimal type
1145   * @throws { BusinessError } 401 - Parameter error. Possible causes:
1146   *                                    1. Incorrect parameter types;
1147   *                                    2. Parameter verification failed.
1148   * @static
1149   * @syscap SystemCapability.Utils.Lang
1150   * @atomicservice
1151   * @since 12
1152   */
1153  static abs(n: Value): Decimal;
1154
1155  /**
1156   * Return a new Decimal whose value is `n` round to an integer using `ROUND_FLOOR`.
1157   *
1158   * @param { Value } n {number | string | Decimal}
1159   * @returns { Decimal } the Decimal type
1160   * @throws { BusinessError } 401 - Parameter error. Possible causes:
1161   *                                    1. Incorrect parameter types;
1162   *                                    2. Parameter verification failed.
1163   * @static
1164   * @syscap SystemCapability.Utils.Lang
1165   * @atomicservice
1166   * @since 12
1167   */
1168  static floor(n: Value): Decimal;
1169
1170  /**
1171   * Return a new Decimal whose value is `n` rounded to an integer using `ROUND_CEIL`.
1172   *
1173   * @param { Value } n {number | string | Decimal}
1174   * @returns { Decimal } the Decimal type
1175   * @throws { BusinessError } 401 - Parameter error. Possible causes:
1176   *                                    1. Incorrect parameter types;
1177   *                                    2. Parameter verification failed.
1178   * @static
1179   * @syscap SystemCapability.Utils.Lang
1180   * @atomicservice
1181   * @since 12
1182   */
1183  static ceil(n: Value): Decimal;
1184
1185  /**
1186   * Return a new Decimal whose value is `n` truncated to an integer.
1187   *
1188   * @param { Value } n {number | string | Decimal}
1189   * @returns { Decimal } the Decimal type
1190   * @throws { BusinessError } 401 - Parameter error. Possible causes:
1191   *                                    1. Incorrect parameter types;
1192   *                                    2. Parameter verification failed.
1193   * @static
1194   * @syscap SystemCapability.Utils.Lang
1195   * @atomicservice
1196   * @since 12
1197   */
1198  static trunc(n: Value): Decimal;
1199
1200  /**
1201   * Return a new Decimal whose value is `n` clamped to the range delineated by `min` and `max`.
1202   *
1203   * @param { Value } n {number | string | Decimal}
1204   * @param { Value } min {number | string | Decimal}
1205   * @param { Value } max {number | string | Decimal}
1206   * @returns { Decimal } the Decimal type
1207   * @throws { BusinessError } 401 - Parameter error. Possible causes:
1208   *                                    1. Incorrect parameter types;
1209   *                                    2. Parameter verification failed.
1210   * @throws { BusinessError } 10200001 - The value of `min` is out of range.
1211   * @static
1212   * @syscap SystemCapability.Utils.Lang
1213   * @atomicservice
1214   * @since 12
1215   */
1216  static clamp(n: Value, min: Value, max: Value): Decimal;
1217
1218  /**
1219   * Return a new Decimal whose value is the sum of `x` and `y`, rounded to `precision` significant
1220   * digits using rounding mode `rounding`.
1221   *
1222   * @param { Value } x {number | string | Decimal}
1223   * @param { Value } y {number | string | Decimal}
1224   * @returns { Decimal } the Decimal type
1225   * @throws { BusinessError } 401 - Parameter error. Possible causes:
1226   *                                    1. Incorrect parameter types;
1227   *                                    2. Parameter verification failed.
1228   * @static
1229   * @syscap SystemCapability.Utils.Lang
1230   * @atomicservice
1231   * @since 12
1232   */
1233  static add(x: Value, y: Value): Decimal;
1234
1235  /**
1236   * Return a new Decimal whose value is the sum of the arguments, rounded to `precision`
1237   * significant digits using rounding mode `rounding`.
1238   *
1239   * Only the result is rounded, not the intermediate calculations.
1240   *
1241   * @param { Value[] } n {number | string | Decimal}
1242   * @returns { Decimal } the Decimal type
1243   * @throws { BusinessError } 401 - Parameter error. Possible causes:
1244   *                                    1. Incorrect parameter types;
1245   *                                    2. Parameter verification failed.
1246   * @static
1247   * @syscap SystemCapability.Utils.Lang
1248   * @atomicservice
1249   * @since 12
1250   */
1251  static sum(...n: Value[]): Decimal;
1252
1253  /**
1254   * Return a new Decimal whose value is `x` minus `y`, rounded to `precision` significant digits
1255   * using rounding mode `rounding`.
1256   *
1257   * @param { Value } x {number | string | Decimal}
1258   * @param { Value } y {number | string | Decimal}
1259   * @returns { Decimal } the Decimal type
1260   * @throws { BusinessError } 401 - Parameter error. Possible causes:
1261   *                                    1. Incorrect parameter types;
1262   *                                    2. Parameter verification failed.
1263   * @static
1264   * @syscap SystemCapability.Utils.Lang
1265   * @atomicservice
1266   * @since 12
1267   */
1268  static sub(x: Value, y: Value): Decimal;
1269
1270  /**
1271   * Return a new Decimal whose value is `x` multiplied by `y`, rounded to `precision` significant
1272   * digits using rounding mode `rounding`.
1273   *
1274   * @param { Value } x {number | string | Decimal}
1275   * @param { Value } y {number | string | Decimal}
1276   * @returns { Decimal } the Decimal type
1277   * @throws { BusinessError } 401 - Parameter error. Possible causes:
1278   *                                    1. Incorrect parameter types;
1279   *                                    2. Parameter verification failed.
1280   * @static
1281   * @syscap SystemCapability.Utils.Lang
1282   * @atomicservice
1283   * @since 12
1284   */
1285  static mul(x: Value, y: Value): Decimal;
1286
1287  /**
1288   * Return a new Decimal whose value is `x` divided by `y`, rounded to `precision` significant
1289   * digits using rounding mode `rounding`.
1290   *
1291   * @param { Value } x {number | string | Decimal}
1292   * @param { Value } y {number | string | Decimal}
1293   * @returns { Decimal } the Decimal type
1294   * @throws { BusinessError } 401 - Parameter error. Possible causes:
1295   *                                    1. Incorrect parameter types;
1296   *                                    2. Parameter verification failed.
1297   * @static
1298   * @syscap SystemCapability.Utils.Lang
1299   * @atomicservice
1300   * @since 12
1301   */
1302  static div(x: Value, y: Value): Decimal;
1303
1304  /**
1305   * Return a new Decimal whose value is `x` modulo `y`, rounded to `precision` significant digits
1306   * using rounding mode `rounding`.
1307   *
1308   * @param { Value } x {number | string | Decimal}
1309   * @param { Value } y {number | string | Decimal}
1310   * @returns { Decimal } the Decimal type
1311   * @throws { BusinessError } 401 - Parameter error. Possible causes:
1312   *                                    1. Incorrect parameter types;
1313   *                                    2. Parameter verification failed.
1314   * @static
1315   * @syscap SystemCapability.Utils.Lang
1316   * @atomicservice
1317   * @since 12
1318   */
1319  static mod(x: Value, y: Value): Decimal;
1320
1321  /**
1322   * Return a new Decimal whose value is the square root of `n`, rounded to `precision` significant
1323   * digits using rounding mode `rounding`.
1324   *
1325   * @param { Value } n {number | string | Decimal}
1326   * @returns { Decimal } the Decimal type
1327   * @throws { BusinessError } 401 - Parameter error. Possible causes:
1328   *                                    1. Incorrect parameter types;
1329   *                                    2. Parameter verification failed.
1330   * @static
1331   * @syscap SystemCapability.Utils.Lang
1332   * @atomicservice
1333   * @since 12
1334   */
1335  static sqrt(n: Value): Decimal;
1336
1337  /**
1338   * Return a new Decimal whose value is the cube root of `n`, rounded to `precision` significant
1339   * digits using rounding mode `rounding`.
1340   *
1341   * @param { Value } n {number | string | Decimal}
1342   * @returns { Decimal } the Decimal type
1343   * @throws { BusinessError } 401 - Parameter error. Possible causes:
1344   *                                    1. Incorrect parameter types;
1345   *                                    2. Parameter verification failed.
1346   * @static
1347   * @syscap SystemCapability.Utils.Lang
1348   * @atomicservice
1349   * @since 12
1350   */
1351  static cbrt(n: Value): Decimal;
1352
1353  /**
1354   * Return a new Decimal whose value is `base` raised to the power `exponent`, rounded to precision
1355   * significant digits using rounding mode `rounding`.
1356   *
1357   * @param { Value } base {number | string | Decimal} The base.
1358   * @param { Value } exponent {number | string | Decimal} The exponent.
1359   * @returns { Decimal } the Decimal type
1360   * @throws { BusinessError } 401 - Parameter error. Possible causes:
1361   *                                    1. Incorrect parameter types;
1362   *                                    2. Parameter verification failed.
1363   * @throws { BusinessError } 10200060 - Precision limit exceeded.
1364   * @static
1365   * @syscap SystemCapability.Utils.Lang
1366   * @atomicservice
1367   * @since 12
1368   */
1369  static pow(base: Value, exponent: Value): Decimal;
1370
1371  /**
1372   * Return a new Decimal whose value is the natural exponential of `n`, rounded to `precision`
1373   * significant digits using rounding mode `rounding`.
1374   *
1375   * @param { Value } n {number | string | Decimal}
1376   * @returns { Decimal } the Decimal type
1377   * @throws { BusinessError } 401 - Parameter error. Possible causes:
1378   *                                    1. Incorrect parameter types;
1379   *                                    2. Parameter verification failed.
1380   * @throws { BusinessError } 10200060 - Precision limit exceeded.
1381   * @static
1382   * @syscap SystemCapability.Utils.Lang
1383   * @atomicservice
1384   * @since 12
1385   */
1386  static exp(n: Value): Decimal;
1387
1388  /**
1389   * Return a new Decimal whose value is the log of `n` to the base `base`, rounded to `precision`
1390   * significant digits using rounding mode `rounding`.
1391   *
1392   * @param { Value } n {number | string | Decimal}
1393   * @param { Value } base {number | string | Decimal}
1394   * @returns { Decimal } the Decimal type
1395   * @throws { BusinessError } 401 - Parameter error. Possible causes:
1396   *                                    1. Incorrect parameter types;
1397   *                                    2. Parameter verification failed.
1398   * @throws { BusinessError } 10200060 - Precision limit exceeded.
1399   * @static
1400   * @syscap SystemCapability.Utils.Lang
1401   * @atomicservice
1402   * @since 12
1403   */
1404  static log(n: Value, base: Value): Decimal;
1405
1406  /**
1407   * Return a new Decimal whose value is the natural logarithm of `n`, rounded to `precision`
1408   * significant digits using rounding mode `rounding`.
1409   *
1410   * @param { Value } n {number | string | Decimal}
1411   * @returns { Decimal } the Decimal type
1412   * @throws { BusinessError } 401 - Parameter error. Possible causes:
1413   *                                    1. Incorrect parameter types;
1414   *                                    2. Parameter verification failed.
1415   * @throws { BusinessError } 10200060 - Precision limit exceeded.
1416   * @static
1417   * @syscap SystemCapability.Utils.Lang
1418   * @atomicservice
1419   * @since 12
1420   */
1421  static ln(n: Value): Decimal;
1422
1423  /**
1424   * Return a new Decimal whose value is the base 2 logarithm of `n`, rounded to `precision`
1425   * significant digits using rounding mode `rounding`.
1426   *
1427   * @param { Value } n {number | string | Decimal}
1428   * @returns { Decimal } the Decimal type
1429   * @throws { BusinessError } 401 - Parameter error. Possible causes:
1430   *                                    1. Incorrect parameter types;
1431   *                                    2. Parameter verification failed.
1432   * @throws { BusinessError } 10200060 - Precision limit exceeded.
1433   * @static
1434   * @syscap SystemCapability.Utils.Lang
1435   * @atomicservice
1436   * @since 12
1437   */
1438  static log2(n: Value): Decimal;
1439
1440  /**
1441   * Return a new Decimal whose value is the base 10 logarithm of `n`, rounded to `precision`
1442   * significant digits using rounding mode `rounding`.
1443   *
1444   * @param { Value } n {number | string | Decimal}
1445   * @returns { Decimal } the Decimal type
1446   * @throws { BusinessError } 401 - Parameter error. Possible causes:
1447   *                                    1. Incorrect parameter types;
1448   *                                    2. Parameter verification failed.
1449   * @throws { BusinessError } 10200060 - Precision limit exceeded.
1450   * @static
1451   * @syscap SystemCapability.Utils.Lang
1452   * @atomicservice
1453   * @since 12
1454   */
1455  static log10(n: Value): Decimal;
1456
1457  /**
1458   * Return a new Decimal whose value is the cosine of `n`, rounded to `precision` significant
1459   * digits using rounding mode `rounding`
1460   *
1461   * @param { Value } n {number | string | Decimal} A value in radians.
1462   * @returns { Decimal } the Decimal type
1463   * @throws { BusinessError } 401 - Parameter error. Possible causes:
1464   *                                    1. Incorrect parameter types;
1465   *                                    2. Parameter verification failed.
1466   * @static
1467   * @syscap SystemCapability.Utils.Lang
1468   * @atomicservice
1469   * @since 12
1470   */
1471  static cos(n: Value): Decimal;
1472
1473  /**
1474   * Return a new Decimal whose value is the sine of `n`, rounded to `precision` significant digits
1475   * using rounding mode `rounding`.
1476   *
1477   * @param { Value } n {number | string | Decimal} A value in radians.
1478   * @returns { Decimal } the Decimal type
1479   * @throws { BusinessError } 401 - Parameter error. Possible causes:
1480   *                                    1. Incorrect parameter types;
1481   *                                    2. Parameter verification failed.
1482   * @static
1483   * @syscap SystemCapability.Utils.Lang
1484   * @atomicservice
1485   * @since 12
1486   */
1487  static sin(n: Value): Decimal;
1488
1489  /**
1490   * Return a new Decimal whose value is the tangent of `n`, rounded to `precision` significant
1491   * digits using rounding mode `rounding`.
1492   *
1493   * @param { Value } n {number | string | Decimal} A value in radians.
1494   * @returns { Decimal } the Decimal type
1495   * @throws { BusinessError } 401 - Parameter error. Possible causes:
1496   *                                    1. Incorrect parameter types;
1497   *                                    2. Parameter verification failed.
1498   * @static
1499   * @syscap SystemCapability.Utils.Lang
1500   * @atomicservice
1501   * @since 12
1502   */
1503  static tan(n: Value): Decimal;
1504
1505  /**
1506   * Return a new Decimal whose value is the hyperbolic cosine of `n`, rounded to precision
1507   * significant digits using rounding mode `rounding`.
1508   *
1509   * @param { Value } n {number | string | Decimal} A value in radians.
1510   * @returns { Decimal } the Decimal type
1511   * @throws { BusinessError } 401 - Parameter error. Possible causes:
1512   *                                    1. Incorrect parameter types;
1513   *                                    2. Parameter verification failed.
1514   * @static
1515   * @syscap SystemCapability.Utils.Lang
1516   * @atomicservice
1517   * @since 12
1518   */
1519  static cosh(n: Value): Decimal;
1520
1521  /**
1522   * Return a new Decimal whose value is the hyperbolic sine of `n`, rounded to `precision`
1523   * significant digits using rounding mode `rounding`.
1524   *
1525   * @param { Value } n {number | string | Decimal}
1526   * @returns { Decimal } the Decimal type
1527   * @throws { BusinessError } 401 - Parameter error. Possible causes:
1528   *                                    1. Incorrect parameter types;
1529   *                                    2. Parameter verification failed.
1530   * @static
1531   * @syscap SystemCapability.Utils.Lang
1532   * @atomicservice
1533   * @since 12
1534   */
1535  static sinh(n: Value): Decimal;
1536
1537  /**
1538   * Return a new Decimal whose value is the hyperbolic tangent of `n`, rounded to `precision`
1539   * significant digits using rounding mode `rounding`.
1540   *
1541   * @param { Value } n {number | string | Decimal} A value in radians.
1542   * @returns { Decimal } the Decimal type
1543   * @throws { BusinessError } 401 - Parameter error. Possible causes:
1544   *                                    1. Incorrect parameter types;
1545   *                                    2. Parameter verification failed.
1546   * @static
1547   * @syscap SystemCapability.Utils.Lang
1548   * @atomicservice
1549   * @since 12
1550   */
1551  static tanh(n: Value): Decimal;
1552
1553  /**
1554   * Return a new Decimal whose value is the arccosine in radians of `n`.
1555   *
1556   * @param { Value } n {number | string | Decimal}
1557   * @returns { Decimal } the Decimal type
1558   * @throws { BusinessError } 401 - Parameter error. Possible causes:
1559   *                                    1. Incorrect parameter types;
1560   *                                    2. Parameter verification failed.
1561   * @throws { BusinessError } 10200060 - Precision limit exceeded.
1562   * @static
1563   * @syscap SystemCapability.Utils.Lang
1564   * @atomicservice
1565   * @since 12
1566   */
1567  static acos(n: Value): Decimal;
1568
1569  /**
1570   * Return a new Decimal whose value is the arcsine in radians of `n`, rounded to `precision`
1571   * significant digits using rounding mode `rounding`.
1572   *
1573   * @param { Value } n {number | string | Decimal}
1574   * @returns { Decimal } the Decimal type
1575   * @throws { BusinessError } 401 - Parameter error. Possible causes:
1576   *                                    1. Incorrect parameter types;
1577   *                                    2. Parameter verification failed.
1578   * @throws { BusinessError } 10200060 - Precision limit exceeded.
1579   * @static
1580   * @syscap SystemCapability.Utils.Lang
1581   * @atomicservice
1582   * @since 12
1583   */
1584  static asin(n: Value): Decimal;
1585
1586  /**
1587   * Return a new Decimal whose value is the arctangent in radians of `n`, rounded to `precision`
1588   * significant digits using rounding mode `rounding`.
1589   *
1590   * @param { Value } n {number | string | Decimal}
1591   * @returns { Decimal } the Decimal type
1592   * @throws { BusinessError } 401 - Parameter error. Possible causes:
1593   *                                    1. Incorrect parameter types;
1594   *                                    2. Parameter verification failed.
1595   * @throws { BusinessError } 10200060 - Precision limit exceeded.
1596   * @static
1597   * @syscap SystemCapability.Utils.Lang
1598   * @atomicservice
1599   * @since 12
1600   */
1601  static atan(n: Value): Decimal;
1602
1603  /**
1604   * Return a new Decimal whose value is the inverse of the hyperbolic cosine of `n`, rounded to
1605   * `precision` significant digits using rounding mode `rounding`.
1606   *
1607   * @param { Value } n {number | string | Decimal}
1608   * @returns { Decimal } the Decimal type
1609   * @throws { BusinessError } 401 - Parameter error. Possible causes:
1610   *                                    1. Incorrect parameter types;
1611   *                                    2. Parameter verification failed.
1612   * @throws { BusinessError } 10200060 - Precision limit exceeded.
1613   * @static
1614   * @syscap SystemCapability.Utils.Lang
1615   * @atomicservice
1616   * @since 12
1617   */
1618  static acosh(n: Value): Decimal;
1619
1620  /**
1621   * Return a new Decimal whose value is the inverse of the hyperbolic sine of `n`, rounded to
1622   * `precision` significant digits using rounding mode `rounding`.
1623   *
1624   * @param { Value } n {number | string | Decimal} A value in radians.
1625   * @returns { Decimal } the Decimal type
1626   * @throws { BusinessError } 401 - Parameter error. Possible causes:
1627   *                                    1. Incorrect parameter types;
1628   *                                    2. Parameter verification failed.
1629   * @throws { BusinessError } 10200060 - Precision limit exceeded.
1630   * @static
1631   * @syscap SystemCapability.Utils.Lang
1632   * @atomicservice
1633   * @since 12
1634   */
1635  static asinh(n: Value): Decimal;
1636
1637  /**
1638   * Return a new Decimal whose value is the inverse of the hyperbolic tangent of `n`, rounded to
1639   * `precision` significant digits using rounding mode `rounding`.
1640   *
1641   * @param { Value } n {number | string | Decimal} A value in radians.
1642   * @returns { Decimal } the Decimal type
1643   * @throws { BusinessError } 401 - Parameter error. Possible causes:
1644   *                                    1. Incorrect parameter types;
1645   *                                    2. Parameter verification failed.
1646   * @throws { BusinessError } 10200060 - Precision limit exceeded.
1647   * @static
1648   * @syscap SystemCapability.Utils.Lang
1649   * @atomicservice
1650   * @since 12
1651   */
1652  static atanh(n: Value): Decimal;
1653
1654  /**
1655   * Return a new Decimal whose value is the arctangent in radians of `y/x` in the range -pi to pi
1656   * (inclusive), rounded to `precision` significant digits using rounding mode `rounding`.
1657   *
1658   * @param { Value } y {number | string | Decimal} The y-coordinate.
1659   * @param { Value } x {number | string | Decimal} The x-coordinate.
1660   * @returns { Decimal } the Decimal type
1661   * @throws { BusinessError } 401 - Parameter error. Possible causes:
1662   *                                    1. Incorrect parameter types;
1663   *                                    2. Parameter verification failed.
1664   * @throws { BusinessError } 10200060 - Precision limit exceeded.
1665   * @static
1666   * @syscap SystemCapability.Utils.Lang
1667   * @atomicservice
1668   * @since 12
1669   */
1670  static atan2(y: Value, x: Value): Decimal;
1671
1672  /**
1673   * Return a new Decimal whose value is the square root of the sum of the squares of the arguments,
1674   * rounded to `precision` significant digits using rounding mode `rounding`.
1675   *
1676   * @param { Value[] } n {number | string | Decimal} Decimal
1677   * @returns { Decimal } the Decimal type
1678   * @throws { BusinessError } 401 - Parameter error. Possible causes:
1679   *                                    1. Incorrect parameter types;
1680   *                                    2. Parameter verification failed.
1681   * @static
1682   * @syscap SystemCapability.Utils.Lang
1683   * @atomicservice
1684   * @since 12
1685   */
1686  static hypot(...n: Value[]): Decimal;
1687
1688  /**
1689   * Return a new Decimal whose value is the maximum of the arguments.
1690   *
1691   * @param { Value[] } n {number | string | Decimal}
1692   * @returns { Decimal } the Decimal type
1693   * @throws { BusinessError } 401 - Parameter error. Possible causes:
1694   *                                    1. Incorrect parameter types;
1695   *                                    2. Parameter verification failed.
1696   * @static
1697   * @syscap SystemCapability.Utils.Lang
1698   * @atomicservice
1699   * @since 12
1700   */
1701  static max(...n: Value[]): Decimal;
1702
1703  /**
1704   * Return a new Decimal whose value is the minimum of the arguments.
1705   *
1706   * @param { Value[] } n {number | string | Decimal}
1707   * @returns { Decimal } the Decimal type
1708   * @throws { BusinessError } 401 - Parameter error. Possible causes:
1709   *                                    1. Incorrect parameter types;
1710   *                                    2. Parameter verification failed.
1711   * @static
1712   * @syscap SystemCapability.Utils.Lang
1713   * @atomicservice
1714   * @since 12
1715   */
1716  static min(...n: Value[]): Decimal;
1717
1718  /**
1719   * Returns a new Decimal with a random value equal to or greater than 0 and less than 1.
1720   *
1721   * @returns { Decimal } the Decimal type
1722   * @throws { BusinessError } 10200061 - Crypto unavailable
1723   * @static
1724   * @syscap SystemCapability.Utils.Lang
1725   * @atomicservice
1726   * @since 12
1727   */
1728  static random(): Decimal;
1729
1730  /**
1731   * Returns a new Decimal with a random value equal to or greater than 0 and less than 1, and with
1732   * `significantDigits` significant digits (or less if trailing zeros are produced).
1733   *
1734   * @param { Value } significantDigits {number} Significant digits. Integer, 0 to MAX_DIGITS inclusive.
1735   * @returns { Decimal } the Decimal type
1736   * @throws { BusinessError } 401 - Parameter error. Possible causes:
1737   *                                    1. Incorrect parameter types;
1738   *                                    2. Parameter verification failed.
1739   * @throws { BusinessError } 10200061 - Crypto unavailable
1740   * @static
1741   * @syscap SystemCapability.Utils.Lang
1742   * @atomicservice
1743   * @since 12
1744   */
1745  static random(significantDigits: number): Decimal;
1746
1747  /**
1748   * Return the sign of the passed value to the method.
1749   *   1    if x > 0,
1750   *  -1    if x < 0,
1751   *   0    if x is 0,
1752   *  -0    if x is -0,
1753   *   NaN  otherwise
1754   *
1755   * @param { Value } n {number | string | Decimal}
1756   * @returns { Decimal } the Decimal type
1757   * @throws { BusinessError } 401 - Parameter error. Possible causes:
1758   *                                    1. Incorrect parameter types;
1759   *                                    2. Parameter verification failed.
1760   * @static
1761   * @syscap SystemCapability.Utils.Lang
1762   * @atomicservice
1763   * @since 12
1764   */
1765  static sign(n: Value): number;
1766
1767  /**
1768   * Return a new Decimal whose value is `n` rounded to an integer using rounding mode `rounding`.
1769   *
1770   * @param { Value } n {number | string | Decimal}
1771   * @returns { Decimal } the Decimal type
1772   * @throws { BusinessError } 401 - Parameter error. Possible causes:
1773   *                                    1. Incorrect parameter types;
1774   *                                    2. Parameter verification failed.
1775   * @static
1776   * @syscap SystemCapability.Utils.Lang
1777   * @atomicservice
1778   * @since 12
1779   */
1780  static round(n: Value): Decimal;
1781
1782  /**
1783   * Configures the 'global' settings for this particular Decimal constructor.
1784   *
1785   * @param { DecimalConfig } An object with one or more of the following properties,
1786   *   precision  {number}
1787   *   rounding   {number}
1788   *   toExpNeg   {number}
1789   *   toExpPos   {number}
1790   *   maxE       {number}
1791   *   minE       {number}
1792   *   modulo     {number}
1793   *   crypto     {boolean|number}
1794   *   defaults   {true}
1795   * @returns { void }
1796   * @throws { BusinessError } 401 - Parameter error. Possible causes:
1797   *                                    1. Incorrect parameter types;
1798   *                                    2. Parameter verification failed.
1799   * @throws { BusinessError } 10200001 - The value of `DecimalConfig.properties` is out of range.
1800   * @throws { BusinessError } 10200061 - Crypto unavailable
1801   * @static
1802   * @syscap SystemCapability.Utils.Lang
1803   * @atomicservice
1804   * @since 12
1805   */
1806  static set(config: DecimalConfig): void;
1807
1808  /**
1809   * Rounds away from zero
1810   *
1811   * @readonly
1812   * @static
1813   * @syscap SystemCapability.Utils.Lang
1814   * @atomicservice
1815   * @since 12
1816   */
1817  static readonly ROUND_UP : 0;
1818
1819  /**
1820   * Rounds towards zero
1821   *
1822   * @readonly
1823   * @static
1824   * @syscap SystemCapability.Utils.Lang
1825   * @atomicservice
1826   * @since 12
1827   */
1828  static readonly ROUND_DOWN : 1;
1829
1830  /**
1831   * Rounds towards Infinity
1832   *
1833   * @readonly
1834   * @static
1835   * @syscap SystemCapability.Utils.Lang
1836   * @atomicservice
1837   * @since 12
1838   */
1839  static readonly ROUND_CEILING : 2;
1840
1841  /**
1842   * Rounds towards -Infinity
1843   *
1844   * @readonly
1845   * @static
1846   * @syscap SystemCapability.Utils.Lang
1847   * @atomicservice
1848   * @since 12
1849   */
1850  static readonly ROUND_FLOOR : 3;
1851
1852  /**
1853   * Rounds towards nearest neighbour. If equidistant, rounds away from zero
1854   *
1855   * @readonly
1856   * @static
1857   * @syscap SystemCapability.Utils.Lang
1858   * @atomicservice
1859   * @since 12
1860   */
1861  static readonly ROUND_HALF_UP : 4;
1862
1863  /**
1864   * Rounds towards nearest neighbour. If equidistant, rounds towards zero
1865   *
1866   * @readonly
1867   * @static
1868   * @syscap SystemCapability.Utils.Lang
1869   * @atomicservice
1870   * @since 12
1871   */
1872  static readonly ROUND_HALF_DOWN : 5;
1873
1874  /**
1875   * Rounds towards nearest neighbour. If equidistant, rounds towards even neighbour
1876   *
1877   * @readonly
1878   * @static
1879   * @syscap SystemCapability.Utils.Lang
1880   * @atomicservice
1881   * @since 12
1882   */
1883  static readonly ROUND_HALF_EVEN : 6;
1884
1885  /**
1886   * Rounds towards nearest neighbour. If equidistant, rounds towards Infinity
1887   *
1888   * @readonly
1889   * @static
1890   * @syscap SystemCapability.Utils.Lang
1891   * @atomicservice
1892   * @since 12
1893   */
1894  static readonly ROUND_HALF_CEILING : 7;
1895
1896  /**
1897   * Rounds towards nearest neighbour. If equidistant, rounds towards -Infinity
1898   *
1899   * @readonly
1900   * @static
1901   * @syscap SystemCapability.Utils.Lang
1902   * @atomicservice
1903   * @since 12
1904   */
1905  static readonly ROUND_HALF_FLOOR : 8;
1906
1907  /**
1908   * Not a rounding mode, see modulo
1909   *
1910   * @readonly
1911   * @static
1912   * @syscap SystemCapability.Utils.Lang
1913   * @atomicservice
1914   * @since 12
1915   */
1916  static readonly EUCLIDEAN : 9;
1917}
1918export default Decimal;
1919