1/* 2 * Copyright (c) 2024-2025 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 */ 28/** 29 * The type uesd to set rounding 30 * 31 * @syscap SystemCapability.Utils.Lang 32 * @crossplatform 33 * @atomicservice 34 * @since 18 35 */ 36type Rounding = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8; 37 38/** 39 * The type uesd to set rounding 40 * 41 * @syscap SystemCapability.Utils.Lang 42 * @crossplatform 43 * @atomicservice 44 * @since 20 45 * @arkts 1.2 46 */ 47type Rounding = number; 48 49/** 50 * The type uesd to set modulo 51 * 52 * @syscap SystemCapability.Utils.Lang 53 * @atomicservice 54 * @since 12 55 */ 56/** 57 * The type uesd to set modulo 58 * 59 * @syscap SystemCapability.Utils.Lang 60 * @crossplatform 61 * @atomicservice 62 * @since 18 63 */ 64type Modulo = Rounding | 9; 65 66/** 67 * The type uesd to denote decimal value 68 * 69 * @syscap SystemCapability.Utils.Lang 70 * @atomicservice 71 * @since 12 72 */ 73/** 74 * The type uesd to denote decimal value 75 * 76 * @syscap SystemCapability.Utils.Lang 77 * @crossplatform 78 * @atomicservice 79 * @since 18 80 */ 81type Value = string | number | Decimal; 82 83/** 84 * Provides configuration for decimal. 85 * 86 * @interface DecimalConfig 87 * @syscap SystemCapability.Utils.Lang 88 * @atomicservice 89 * @since 12 90 */ 91/** 92 * Provides configuration for decimal. 93 * 94 * @interface DecimalConfig 95 * @syscap SystemCapability.Utils.Lang 96 * @crossplatform 97 * @atomicservice 98 * @since 18 99 */ 100interface DecimalConfig { 101 /** 102 * The maximum number of significant digits of the result of an operation. 103 * Default value: 20 104 * 105 * @type { number } integer, 1 to 1e+9 inclusive 106 * @syscap SystemCapability.Utils.Lang 107 * @atomicservice 108 * @since 12 109 */ 110 /** 111 * The maximum number of significant digits of the result of an operation. 112 * Default value: 20 113 * 114 * @type { number } integer, 1 to 1e+9 inclusive 115 * @syscap SystemCapability.Utils.Lang 116 * @crossplatform 117 * @atomicservice 118 * @since 18 119 */ 120 precision?: number; 121 /** 122 * The default rounding mode used when rounding the result of an operation to precision significant digits, 123 * and when rounding the return value of the round, toBinary, toDecimalPlaces, toExponential, toFixed, 124 * toHexadecimal, toNearest, toOctal, toPrecision and toSignificantDigits methods. 125 * Default value: 4 (ROUND_HALF_UP) 126 * 127 * @type { number } integer, integer, 0 to 8 inclusive 128 * @syscap SystemCapability.Utils.Lang 129 * @atomicservice 130 * @since 12 131 */ 132 /** 133 * The default rounding mode used when rounding the result of an operation to precision significant digits, 134 * and when rounding the return value of the round, toBinary, toDecimalPlaces, toExponential, toFixed, 135 * toHexadecimal, toNearest, toOctal, toPrecision and toSignificantDigits methods. 136 * Default value: 4 (ROUND_HALF_UP) 137 * 138 * @type { number } integer, integer, 0 to 8 inclusive 139 * @syscap SystemCapability.Utils.Lang 140 * @crossplatform 141 * @atomicservice 142 * @since 18 143 */ 144 rounding?: Rounding; 145 /** 146 * The negative exponent value at and below which toString returns exponential notation. 147 * Default value: -7 148 * 149 * @type { number } integer, -9e15 to 0 inclusive 150 * @syscap SystemCapability.Utils.Lang 151 * @atomicservice 152 * @since 12 153 */ 154 /** 155 * The negative exponent value at and below which toString returns exponential notation. 156 * Default value: -7 157 * 158 * @type { number } integer, -9e15 to 0 inclusive 159 * @syscap SystemCapability.Utils.Lang 160 * @crossplatform 161 * @atomicservice 162 * @since 18 163 */ 164 toExpNeg?: number; 165 /** 166 * The positive exponent value at and above which toString returns exponential notation. 167 * Default value: 20 168 * 169 * @type { number } integer, 0 to 9e15 inclusive 170 * @syscap SystemCapability.Utils.Lang 171 * @atomicservice 172 * @since 12 173 */ 174 /** 175 * The positive exponent value at and above which toString returns exponential notation. 176 * Default value: 20 177 * 178 * @type { number } integer, 0 to 9e15 inclusive 179 * @syscap SystemCapability.Utils.Lang 180 * @crossplatform 181 * @atomicservice 182 * @since 18 183 */ 184 toExpPos?: number; 185 /** 186 * The negative exponent limit, i.e. the exponent value below which underflow to zero occurs. 187 * Default value: -9e15 188 * 189 * @type { number } integer, -9e15 to 0 inclusive 190 * @syscap SystemCapability.Utils.Lang 191 * @atomicservice 192 * @since 12 193 */ 194 /** 195 * The negative exponent limit, i.e. the exponent value below which underflow to zero occurs. 196 * Default value: -9e15 197 * 198 * @type { number } integer, -9e15 to 0 inclusive 199 * @syscap SystemCapability.Utils.Lang 200 * @crossplatform 201 * @atomicservice 202 * @since 18 203 */ 204 minE?: number; 205 /** 206 * The positive exponent limit, i.e. the exponent value above which overflow to Infinity occurs. 207 * Default value: 9e15 208 * 209 * @type { number } integer, 0 to 9e15 inclusive 210 * @syscap SystemCapability.Utils.Lang 211 * @atomicservice 212 * @since 12 213 */ 214 /** 215 * The positive exponent limit, i.e. the exponent value above which overflow to Infinity occurs. 216 * Default value: 9e15 217 * 218 * @type { number } integer, 0 to 9e15 inclusive 219 * @syscap SystemCapability.Utils.Lang 220 * @crossplatform 221 * @atomicservice 222 * @since 18 223 */ 224 maxE?: number; 225 /** 226 * The value that determines whether cryptographically-secure pseudo-random number generation is used. 227 * Default value: false 228 * 229 * @type { boolean } 230 * @syscap SystemCapability.Utils.Lang 231 * @atomicservice 232 * @since 12 233 */ 234 /** 235 * The value that determines whether cryptographically-secure pseudo-random number generation is used. 236 * Default value: false 237 * 238 * @type { boolean } 239 * @syscap SystemCapability.Utils.Lang 240 * @crossplatform 241 * @atomicservice 242 * @since 18 243 */ 244 crypto?: boolean; 245 /** 246 * The modulo mode used when calculating the modulus: a mod n. 247 * Default value: 1 (ROUND_DOWN) 248 * 249 * @type { number } integer, 0 to 9 inclusive 250 * @syscap SystemCapability.Utils.Lang 251 * @atomicservice 252 * @since 12 253 */ 254 /** 255 * The modulo mode used when calculating the modulus: a mod n. 256 * Default value: 1 (ROUND_DOWN) 257 * 258 * @type { number } integer, 0 to 9 inclusive 259 * @syscap SystemCapability.Utils.Lang 260 * @crossplatform 261 * @atomicservice 262 * @since 18 263 */ 264 modulo?: Modulo; 265 /** 266 * If object has a 'defaults' property with value true then the new constructor will use the default configuration. 267 * Default value: false 268 * 269 * @type { boolean } 270 * @syscap SystemCapability.Utils.Lang 271 * @atomicservice 272 * @since 12 273 */ 274 /** 275 * If object has a 'defaults' property with value true then the new constructor will use the default configuration. 276 * Default value: false 277 * 278 * @type { boolean } 279 * @syscap SystemCapability.Utils.Lang 280 * @crossplatform 281 * @atomicservice 282 * @since 18 283 */ 284 defaults?: boolean; 285} 286 287/** 288 * An arbitrary-precision Decimal type 289 * 290 * @syscap SystemCapability.Utils.Lang 291 * @atomicservice 292 * @since 12 293 */ 294/** 295 * An arbitrary-precision Decimal type 296 * 297 * @syscap SystemCapability.Utils.Lang 298 * @crossplatform 299 * @atomicservice 300 * @since 18 301 */ 302declare class Decimal { 303 /** 304 * The numbers of decimal digits. 305 * 306 * @type { number[] } 307 * @readonly 308 * @syscap SystemCapability.Utils.Lang 309 * @atomicservice 310 * @since 12 311 */ 312 /** 313 * The numbers of decimal digits. 314 * 315 * @type { number[] } 316 * @readonly 317 * @syscap SystemCapability.Utils.Lang 318 * @crossplatform 319 * @atomicservice 320 * @since 18 321 */ 322 readonly d: number[]; 323 324 /** 325 * The number of decimal exponent. 326 * 327 * @type { number } 328 * @readonly 329 * @syscap SystemCapability.Utils.Lang 330 * @atomicservice 331 * @since 12 332 */ 333 /** 334 * The number of decimal exponent. 335 * 336 * @type { number } 337 * @readonly 338 * @syscap SystemCapability.Utils.Lang 339 * @crossplatform 340 * @atomicservice 341 * @since 18 342 */ 343 readonly e: number; 344 345 /** 346 * The number of decimal sign. 347 * 348 * @type { number } 349 * @readonly 350 * @syscap SystemCapability.Utils.Lang 351 * @atomicservice 352 * @since 12 353 */ 354 /** 355 * The number of decimal sign. 356 * 357 * @type { number } 358 * @readonly 359 * @syscap SystemCapability.Utils.Lang 360 * @crossplatform 361 * @atomicservice 362 * @since 18 363 */ 364 readonly s: number; 365 366 /** 367 * Return a new Decimal whose value is the absolute value of this Decimal. 368 * 369 * @param { Value } n {number | string | Decimal} 370 * @throws { BusinessError } 401 - Parameter error. Possible causes: 371 * 1. Incorrect parameter types; 372 * 2. Parameter verification failed. 373 * @syscap SystemCapability.Utils.Lang 374 * @atomicservice 375 * @since 12 376 */ 377 /** 378 * Return a new Decimal whose value is the absolute value of this Decimal. 379 * 380 * @param { Value } n {number | string | Decimal} 381 * @throws { BusinessError } 401 - Parameter error. Possible causes: 382 * 1. Incorrect parameter types; 383 * 2. Parameter verification failed. 384 * @syscap SystemCapability.Utils.Lang 385 * @crossplatform 386 * @atomicservice 387 * @since 18 388 */ 389 constructor(n: Value); 390 391 /** 392 * Return a new Decimal whose value is the absolute value of this Decimal. 393 * 394 * @returns { Decimal } the Decimal type 395 * @syscap SystemCapability.Utils.Lang 396 * @atomicservice 397 * @since 12 398 */ 399 /** 400 * Return a new Decimal whose value is the absolute value of this Decimal. 401 * 402 * @returns { Decimal } the Decimal type 403 * @syscap SystemCapability.Utils.Lang 404 * @crossplatform 405 * @atomicservice 406 * @since 18 407 */ 408 abs(): Decimal; 409 410 /** 411 * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the 412 * direction of negative Infinity. 413 * 414 * @returns { Decimal } the Decimal type 415 * @syscap SystemCapability.Utils.Lang 416 * @atomicservice 417 * @since 12 418 */ 419 /** 420 * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the 421 * direction of negative Infinity. 422 * 423 * @returns { Decimal } the Decimal type 424 * @syscap SystemCapability.Utils.Lang 425 * @crossplatform 426 * @atomicservice 427 * @since 18 428 */ 429 floor(): Decimal; 430 431 /** 432 * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the 433 * direction of positive Infinity. 434 * 435 * @returns { Decimal } the Decimal type 436 * @syscap SystemCapability.Utils.Lang 437 * @atomicservice 438 * @since 12 439 */ 440 /** 441 * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the 442 * direction of positive Infinity. 443 * 444 * @returns { Decimal } the Decimal type 445 * @syscap SystemCapability.Utils.Lang 446 * @crossplatform 447 * @atomicservice 448 * @since 18 449 */ 450 ceil(): Decimal; 451 452 /** 453 * Return a new Decimal whose value is the value of this Decimal truncated to a whole number. 454 * 455 * @returns { Decimal } the Decimal type 456 * @syscap SystemCapability.Utils.Lang 457 * @atomicservice 458 * @since 12 459 */ 460 /** 461 * Return a new Decimal whose value is the value of this Decimal truncated to a whole number. 462 * 463 * @returns { Decimal } the Decimal type 464 * @syscap SystemCapability.Utils.Lang 465 * @crossplatform 466 * @atomicservice 467 * @since 18 468 */ 469 trunc(): Decimal; 470 471 /** 472 * Return a new Decimal whose value is the value of this Decimal clamped to the range 473 * delineated by `min` and `max`. 474 * 475 * @param { Value } min {number | string | Decimal} 476 * @param { Value } max {number | string | Decimal} 477 * @returns { Decimal } the Decimal type 478 * @throws { BusinessError } 401 - Parameter error. Possible causes: 479 * 1. Incorrect parameter types; 480 * 2. Parameter verification failed. 481 * @throws { BusinessError } 10200001 - The value of `min` is out of range. 482 * @syscap SystemCapability.Utils.Lang 483 * @atomicservice 484 * @since 12 485 */ 486 /** 487 * Return a new Decimal whose value is the value of this Decimal clamped to the range 488 * delineated by `min` and `max`. 489 * 490 * @param { Value } min {number | string | Decimal} 491 * @param { Value } max {number | string | Decimal} 492 * @returns { Decimal } the Decimal type 493 * @throws { BusinessError } 401 - Parameter error. Possible causes: 494 * 1. Incorrect parameter types; 495 * 2. Parameter verification failed. 496 * @throws { BusinessError } 10200001 - The value of `min` is out of range. 497 * @syscap SystemCapability.Utils.Lang 498 * @crossplatform 499 * @atomicservice 500 * @since 18 501 */ 502 clamp(min: Value, max: Value): Decimal; 503 504 /** 505 * Return a new Decimal whose value is the value of this Decimal plus `n`, rounded to `precision` 506 * significant digits using rounding mode `rounding`. 507 * 508 * @param { Value } n {number | string | Decimal} 509 * @returns { Decimal } the Decimal type 510 * @throws { BusinessError } 401 - Parameter error. Possible causes: 511 * 1. Incorrect parameter types; 512 * 2. Parameter verification failed. 513 * @syscap SystemCapability.Utils.Lang 514 * @atomicservice 515 * @since 12 516 */ 517 /** 518 * Return a new Decimal whose value is the value of this Decimal plus `n`, rounded to `precision` 519 * significant digits using rounding mode `rounding`. 520 * 521 * @param { Value } n {number | string | Decimal} 522 * @returns { Decimal } the Decimal type 523 * @throws { BusinessError } 401 - Parameter error. Possible causes: 524 * 1. Incorrect parameter types; 525 * 2. Parameter verification failed. 526 * @syscap SystemCapability.Utils.Lang 527 * @crossplatform 528 * @atomicservice 529 * @since 18 530 */ 531 add(n: Value): Decimal; 532 533 /** 534 * Return a new Decimal whose value is the value of this Decimal minus `n`, rounded to `precision` 535 * significant digits using rounding mode `rounding`. 536 * 537 * @param { Value } n {number | string | Decimal} 538 * @returns { Decimal } the Decimal type 539 * @throws { BusinessError } 401 - Parameter error. Possible causes: 540 * 1. Incorrect parameter types; 541 * 2. Parameter verification failed. 542 * @syscap SystemCapability.Utils.Lang 543 * @atomicservice 544 * @since 12 545 */ 546 /** 547 * Return a new Decimal whose value is the value of this Decimal minus `n`, rounded to `precision` 548 * significant digits using rounding mode `rounding`. 549 * 550 * @param { Value } n {number | string | Decimal} 551 * @returns { Decimal } the Decimal type 552 * @throws { BusinessError } 401 - Parameter error. Possible causes: 553 * 1. Incorrect parameter types; 554 * 2. Parameter verification failed. 555 * @syscap SystemCapability.Utils.Lang 556 * @crossplatform 557 * @atomicservice 558 * @since 18 559 */ 560 sub(n: Value): Decimal; 561 562 /** 563 * Return a new Decimal whose value is this Decimal times `n`, rounded to `precision` significant 564 * digits using rounding mode `rounding`. 565 * 566 * @param { Value } n {number | string | Decimal} 567 * @returns { Decimal } the Decimal type 568 * @throws { BusinessError } 401 - Parameter error. Possible causes: 569 * 1. Incorrect parameter types; 570 * 2. Parameter verification failed. 571 * @syscap SystemCapability.Utils.Lang 572 * @atomicservice 573 * @since 12 574 */ 575 /** 576 * Return a new Decimal whose value is this Decimal times `n`, rounded to `precision` significant 577 * digits using rounding mode `rounding`. 578 * 579 * @param { Value } n {number | string | Decimal} 580 * @returns { Decimal } the Decimal type 581 * @throws { BusinessError } 401 - Parameter error. Possible causes: 582 * 1. Incorrect parameter types; 583 * 2. Parameter verification failed. 584 * @syscap SystemCapability.Utils.Lang 585 * @crossplatform 586 * @atomicservice 587 * @since 18 588 */ 589 mul(n: Value): Decimal; 590 591 /** 592 * Return a new Decimal whose value is the value of this Decimal divided by `n`, rounded to 593 * `precision` significant digits using rounding mode `rounding`. 594 * 595 * @param { Value } n {number | string | Decimal} 596 * @returns { Decimal } the Decimal type 597 * @throws { BusinessError } 401 - Parameter error. Possible causes: 598 * 1. Incorrect parameter types; 599 * 2. Parameter verification failed. 600 * @syscap SystemCapability.Utils.Lang 601 * @atomicservice 602 * @since 12 603 */ 604 /** 605 * Return a new Decimal whose value is the value of this Decimal divided by `n`, rounded to 606 * `precision` significant digits using rounding mode `rounding`. 607 * 608 * @param { Value } n {number | string | Decimal} 609 * @returns { Decimal } the Decimal type 610 * @throws { BusinessError } 401 - Parameter error. Possible causes: 611 * 1. Incorrect parameter types; 612 * 2. Parameter verification failed. 613 * @syscap SystemCapability.Utils.Lang 614 * @crossplatform 615 * @atomicservice 616 * @since 18 617 */ 618 div(n: Value): Decimal; 619 620 /** 621 * Return a new Decimal whose value is the value of this Decimal modulo `n`, rounded to 622 * `precision` significant digits using rounding mode `rounding`. 623 * 624 * @param { Value } n {number | string | Decimal} 625 * @returns { Decimal }the Decimal type 626 * @throws { BusinessError } 401 - Parameter error. Possible causes: 627 * 1. Incorrect parameter types; 628 * 2. Parameter verification failed. 629 * @syscap SystemCapability.Utils.Lang 630 * @atomicservice 631 * @since 12 632 */ 633 /** 634 * Return a new Decimal whose value is the value of this Decimal modulo `n`, rounded to 635 * `precision` significant digits using rounding mode `rounding`. 636 * 637 * @param { Value } n {number | string | Decimal} 638 * @returns { Decimal }the Decimal type 639 * @throws { BusinessError } 401 - Parameter error. Possible causes: 640 * 1. Incorrect parameter types; 641 * 2. Parameter verification failed. 642 * @syscap SystemCapability.Utils.Lang 643 * @crossplatform 644 * @atomicservice 645 * @since 18 646 */ 647 mod(n: Value): Decimal; 648 649 /** 650 * Return a new Decimal whose value is the square root of this Decimal, rounded to `precision` 651 * significant digits using rounding mode `rounding`. 652 * 653 * @returns { Decimal } the Decimal type 654 * @syscap SystemCapability.Utils.Lang 655 * @atomicservice 656 * @since 12 657 */ 658 /** 659 * Return a new Decimal whose value is the square root of this Decimal, rounded to `precision` 660 * significant digits using rounding mode `rounding`. 661 * 662 * @returns { Decimal } the Decimal type 663 * @syscap SystemCapability.Utils.Lang 664 * @crossplatform 665 * @atomicservice 666 * @since 18 667 */ 668 sqrt(): Decimal; 669 670 /** 671 * Return a new Decimal whose value is the cube root of the value of this Decimal, rounded to 672 * `precision` significant digits using rounding mode `rounding`. 673 * 674 * @returns { Decimal } the Decimal type 675 * @syscap SystemCapability.Utils.Lang 676 * @atomicservice 677 * @since 12 678 */ 679 /** 680 * Return a new Decimal whose value is the cube root of the value of this Decimal, rounded to 681 * `precision` significant digits using rounding mode `rounding`. 682 * 683 * @returns { Decimal } the Decimal type 684 * @syscap SystemCapability.Utils.Lang 685 * @crossplatform 686 * @atomicservice 687 * @since 18 688 */ 689 cbrt(): Decimal; 690 691 /** 692 * Return a new Decimal whose value is the value of this Decimal raised to the power `n`, rounded 693 * to `precision` significant digits using rounding mode `rounding`. 694 * 695 * @param { Value } n {number | string | Decimal} 696 * @returns { Decimal } the Decimal type 697 * @throws { BusinessError } 401 - Parameter error. Possible causes: 698 * 1. Incorrect parameter types; 699 * 2. Parameter verification failed. 700 * @throws { BusinessError } 10200060 - Precision limit exceeded. 701 * @syscap SystemCapability.Utils.Lang 702 * @atomicservice 703 * @since 12 704 */ 705 /** 706 * Return a new Decimal whose value is the value of this Decimal raised to the power `n`, rounded 707 * to `precision` significant digits using rounding mode `rounding`. 708 * 709 * @param { Value } n {number | string | Decimal} 710 * @returns { Decimal } the Decimal type 711 * @throws { BusinessError } 401 - Parameter error. Possible causes: 712 * 1. Incorrect parameter types; 713 * 2. Parameter verification failed. 714 * @throws { BusinessError } 10200060 - Precision limit exceeded. 715 * @syscap SystemCapability.Utils.Lang 716 * @crossplatform 717 * @atomicservice 718 * @since 18 719 */ 720 pow(n: Value): Decimal; 721 722 /** 723 * Return a new Decimal whose value is the natural exponential of the value of this Decimal, 724 * i.e. the base e raised to the power the value of this Decimal, rounded to `precision` 725 * significant digits using rounding mode `rounding`. 726 * 727 * @returns { Decimal } the Decimal type 728 * @throws { BusinessError } 10200060 - Precision limit exceeded. 729 * @syscap SystemCapability.Utils.Lang 730 * @atomicservice 731 * @since 12 732 */ 733 /** 734 * Return a new Decimal whose value is the natural exponential of the value of this Decimal, 735 * i.e. the base e raised to the power the value of this Decimal, rounded to `precision` 736 * significant digits using rounding mode `rounding`. 737 * 738 * @returns { Decimal } the Decimal type 739 * @throws { BusinessError } 10200060 - Precision limit exceeded. 740 * @syscap SystemCapability.Utils.Lang 741 * @crossplatform 742 * @atomicservice 743 * @since 18 744 */ 745 exp(): Decimal; 746 747 /** 748 * Return the logarithm of the value of this Decimal to the specified base, rounded to `precision` 749 * significant digits using rounding mode `rounding`. 750 * 751 * @param { Value } n {number | string | Decimal} 752 * @returns { Decimal } the Decimal type 753 * @throws { BusinessError } 401 - Parameter error. Possible causes: 754 * 1. Incorrect parameter types; 755 * 2. Parameter verification failed. 756 * @throws { BusinessError } 10200060 - Precision limit exceeded. 757 * @syscap SystemCapability.Utils.Lang 758 * @atomicservice 759 * @since 12 760 */ 761 /** 762 * Return the logarithm of the value of this Decimal to the specified base, rounded to `precision` 763 * significant digits using rounding mode `rounding`. 764 * 765 * @param { Value } n {number | string | Decimal} 766 * @returns { Decimal } the Decimal type 767 * @throws { BusinessError } 401 - Parameter error. Possible causes: 768 * 1. Incorrect parameter types; 769 * 2. Parameter verification failed. 770 * @throws { BusinessError } 10200060 - Precision limit exceeded. 771 * @syscap SystemCapability.Utils.Lang 772 * @crossplatform 773 * @atomicservice 774 * @since 18 775 */ 776 log(n: Value): Decimal; 777 778 /** 779 * Return a new Decimal whose value is the natural logarithm of the value of this Decimal, 780 * rounded to `precision` significant digits using rounding mode `rounding`. 781 * 782 * @returns { Decimal } the Decimal type 783 * @throws { BusinessError } 10200060 - Precision limit exceeded. 784 * @syscap SystemCapability.Utils.Lang 785 * @atomicservice 786 * @since 12 787 */ 788 /** 789 * Return a new Decimal whose value is the natural logarithm of the value of this Decimal, 790 * rounded to `precision` significant digits using rounding mode `rounding`. 791 * 792 * @returns { Decimal } the Decimal type 793 * @throws { BusinessError } 10200060 - Precision limit exceeded. 794 * @syscap SystemCapability.Utils.Lang 795 * @crossplatform 796 * @atomicservice 797 * @since 18 798 */ 799 ln(): Decimal; 800 801 /** 802 * Return a new Decimal whose value is the cosine of the value in radians of this Decimal. 803 * 804 * @returns { Decimal } the Decimal type 805 * @syscap SystemCapability.Utils.Lang 806 * @atomicservice 807 * @since 12 808 */ 809 /** 810 * Return a new Decimal whose value is the cosine of the value in radians of this Decimal. 811 * 812 * @returns { Decimal } the Decimal type 813 * @syscap SystemCapability.Utils.Lang 814 * @crossplatform 815 * @atomicservice 816 * @since 18 817 */ 818 cos(): Decimal; 819 820 /** 821 * Return a new Decimal whose value is the sine of the value in radians of this Decimal. 822 * 823 * @returns { Decimal } the Decimal type 824 * @syscap SystemCapability.Utils.Lang 825 * @atomicservice 826 * @since 12 827 */ 828 /** 829 * Return a new Decimal whose value is the sine of the value in radians of this Decimal. 830 * 831 * @returns { Decimal } the Decimal type 832 * @syscap SystemCapability.Utils.Lang 833 * @crossplatform 834 * @atomicservice 835 * @since 18 836 */ 837 sin(): Decimal; 838 839 /** 840 * Return a new Decimal whose value is the tangent of the value in radians of this Decimal. 841 * 842 * @returns { Decimal } the Decimal type 843 * @syscap SystemCapability.Utils.Lang 844 * @atomicservice 845 * @since 12 846 */ 847 /** 848 * Return a new Decimal whose value is the tangent of the value in radians of this Decimal. 849 * 850 * @returns { Decimal } the Decimal type 851 * @syscap SystemCapability.Utils.Lang 852 * @crossplatform 853 * @atomicservice 854 * @since 18 855 */ 856 tan(): Decimal; 857 858 /** 859 * Return a new Decimal whose value is the hyperbolic cosine of the value in radians of this 860 * Decimal. 861 * 862 * @returns { Decimal } the Decimal type 863 * @syscap SystemCapability.Utils.Lang 864 * @atomicservice 865 * @since 12 866 */ 867 /** 868 * Return a new Decimal whose value is the hyperbolic cosine of the value in radians of this 869 * Decimal. 870 * 871 * @returns { Decimal } the Decimal type 872 * @syscap SystemCapability.Utils.Lang 873 * @crossplatform 874 * @atomicservice 875 * @since 18 876 */ 877 cosh(): Decimal; 878 879 /** 880 * Return a new Decimal whose value is the hyperbolic sine of the value in radians of this Decimal. 881 * 882 * @returns { Decimal } the Decimal type 883 * @syscap SystemCapability.Utils.Lang 884 * @atomicservice 885 * @since 12 886 */ 887 /** 888 * Return a new Decimal whose value is the hyperbolic sine of the value in radians of this Decimal. 889 * 890 * @returns { Decimal } the Decimal type 891 * @syscap SystemCapability.Utils.Lang 892 * @crossplatform 893 * @atomicservice 894 * @since 18 895 */ 896 sinh(): Decimal; 897 898 /** 899 * Return a new Decimal whose value is the hyperbolic tangent of the value in radians of this Decimal. 900 * 901 * @returns { Decimal } the Decimal type 902 * @syscap SystemCapability.Utils.Lang 903 * @atomicservice 904 * @since 12 905 */ 906 /** 907 * Return a new Decimal whose value is the hyperbolic tangent of the value in radians of this Decimal. 908 * 909 * @returns { Decimal } the Decimal type 910 * @syscap SystemCapability.Utils.Lang 911 * @crossplatform 912 * @atomicservice 913 * @since 18 914 */ 915 tanh(): Decimal; 916 917 /** 918 * Return a new Decimal whose value is the arccosine (inverse cosine) in radians of the value of this Decimal. 919 * 920 * @returns { Decimal } the Decimal type 921 * @throws { BusinessError } 10200060 - Precision limit exceeded. 922 * @syscap SystemCapability.Utils.Lang 923 * @atomicservice 924 * @since 12 925 */ 926 /** 927 * Return a new Decimal whose value is the arccosine (inverse cosine) in radians of the value of this Decimal. 928 * 929 * @returns { Decimal } the Decimal type 930 * @throws { BusinessError } 10200060 - Precision limit exceeded. 931 * @syscap SystemCapability.Utils.Lang 932 * @crossplatform 933 * @atomicservice 934 * @since 18 935 */ 936 acos(): Decimal; 937 938 /** 939 * Return a new Decimal whose value is the arcsine (inverse sine) in radians of the value of this 940 * Decimal. 941 * 942 * @returns { Decimal } the Decimal type 943 * @throws { BusinessError } 10200060 - Precision limit exceeded. 944 * @syscap SystemCapability.Utils.Lang 945 * @atomicservice 946 * @since 12 947 */ 948 /** 949 * Return a new Decimal whose value is the arcsine (inverse sine) in radians of the value of this 950 * Decimal. 951 * 952 * @returns { Decimal } the Decimal type 953 * @throws { BusinessError } 10200060 - Precision limit exceeded. 954 * @syscap SystemCapability.Utils.Lang 955 * @crossplatform 956 * @atomicservice 957 * @since 18 958 */ 959 asin(): Decimal; 960 961 /** 962 * Return a new Decimal whose value is the arctangent (inverse tangent) in radians of the value of this Decimal. 963 * 964 * @returns { Decimal } the Decimal type 965 * @throws { BusinessError } 10200060 - Precision limit exceeded. 966 * @syscap SystemCapability.Utils.Lang 967 * @atomicservice 968 * @since 12 969 */ 970 /** 971 * Return a new Decimal whose value is the arctangent (inverse tangent) in radians of the value of this Decimal. 972 * 973 * @returns { Decimal } the Decimal type 974 * @throws { BusinessError } 10200060 - Precision limit exceeded. 975 * @syscap SystemCapability.Utils.Lang 976 * @crossplatform 977 * @atomicservice 978 * @since 18 979 */ 980 atan(): Decimal; 981 982 /** 983 * Return a new Decimal whose value is the inverse of the hyperbolic cosine in radians of the 984 * value of this Decimal. 985 * 986 * @returns { Decimal } the Decimal type 987 * @throws { BusinessError } 10200060 - Precision limit exceeded. 988 * @syscap SystemCapability.Utils.Lang 989 * @atomicservice 990 * @since 12 991 */ 992 /** 993 * Return a new Decimal whose value is the inverse of the hyperbolic cosine in radians of the 994 * value of this Decimal. 995 * 996 * @returns { Decimal } the Decimal type 997 * @throws { BusinessError } 10200060 - Precision limit exceeded. 998 * @syscap SystemCapability.Utils.Lang 999 * @crossplatform 1000 * @atomicservice 1001 * @since 18 1002 */ 1003 acosh(): Decimal; 1004 1005 /** 1006 * Return a new Decimal whose value is the inverse of the hyperbolic sine in radians of the value 1007 * of this Decimal. 1008 * 1009 * @returns { Decimal } the Decimal type 1010 * @throws { BusinessError } 10200060 - Precision limit exceeded. 1011 * @syscap SystemCapability.Utils.Lang 1012 * @atomicservice 1013 * @since 12 1014 */ 1015 /** 1016 * Return a new Decimal whose value is the inverse of the hyperbolic sine in radians of the value 1017 * of this Decimal. 1018 * 1019 * @returns { Decimal } the Decimal type 1020 * @throws { BusinessError } 10200060 - Precision limit exceeded. 1021 * @syscap SystemCapability.Utils.Lang 1022 * @crossplatform 1023 * @atomicservice 1024 * @since 18 1025 */ 1026 asinh(): Decimal; 1027 1028 /** 1029 * Return a new Decimal whose value is the inverse of the hyperbolic tangent in radians of the 1030 * value of this Decimal. 1031 * 1032 * @returns { Decimal } the Decimal type 1033 * @throws { BusinessError } 10200060 - Precision limit exceeded. 1034 * @syscap SystemCapability.Utils.Lang 1035 * @atomicservice 1036 * @since 12 1037 */ 1038 /** 1039 * Return a new Decimal whose value is the inverse of the hyperbolic tangent in radians of the 1040 * value of this Decimal. 1041 * 1042 * @returns { Decimal } the Decimal type 1043 * @throws { BusinessError } 10200060 - Precision limit exceeded. 1044 * @syscap SystemCapability.Utils.Lang 1045 * @crossplatform 1046 * @atomicservice 1047 * @since 18 1048 */ 1049 atanh(): Decimal; 1050 1051 /** 1052 * Return 1053 * 1 if the value of this Decimal is greater than the value of `n`, 1054 * -1 if the value of this Decimal is less than the value of `n`, 1055 * 0 if they have the same value, 1056 * NaN if the value of either Decimal is NaN. 1057 * 1058 * @param { Value } n {number | string | Decimal} 1059 * @returns { number } the number type 1060 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1061 * 1. Incorrect parameter types; 1062 * 2. Parameter verification failed. 1063 * @syscap SystemCapability.Utils.Lang 1064 * @atomicservice 1065 * @since 12 1066 */ 1067 /** 1068 * Return 1069 * 1 if the value of this Decimal is greater than the value of `n`, 1070 * -1 if the value of this Decimal is less than the value of `n`, 1071 * 0 if they have the same value, 1072 * NaN if the value of either Decimal is NaN. 1073 * 1074 * @param { Value } n {number | string | Decimal} 1075 * @returns { number } the number type 1076 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1077 * 1. Incorrect parameter types; 1078 * 2. Parameter verification failed. 1079 * @syscap SystemCapability.Utils.Lang 1080 * @crossplatform 1081 * @atomicservice 1082 * @since 18 1083 */ 1084 comparedTo(n: Value): number; 1085 1086 /** 1087 * Return true if the value of this Decimal is equal to the value of `n`, otherwise return false. 1088 * 1089 * @param { Value } n {number | string | Decimal} 1090 * @returns { boolean } the boolean type 1091 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1092 * 1. Incorrect parameter types; 1093 * 2. Parameter verification failed. 1094 * @syscap SystemCapability.Utils.Lang 1095 * @atomicservice 1096 * @since 12 1097 */ 1098 /** 1099 * Return true if the value of this Decimal is equal to the value of `n`, otherwise return false. 1100 * 1101 * @param { Value } n {number | string | Decimal} 1102 * @returns { boolean } the boolean type 1103 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1104 * 1. Incorrect parameter types; 1105 * 2. Parameter verification failed. 1106 * @syscap SystemCapability.Utils.Lang 1107 * @crossplatform 1108 * @atomicservice 1109 * @since 18 1110 */ 1111 equals(n: Value): boolean; 1112 1113 /** 1114 * Return true if the value of this Decimal is greater than the value of `n`, otherwise return false. 1115 * 1116 * @param { Value } n {number | string | Decimal} 1117 * @returns { boolean } the boolean type 1118 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1119 * 1. Incorrect parameter types; 1120 * 2. Parameter verification failed. 1121 * @syscap SystemCapability.Utils.Lang 1122 * @atomicservice 1123 * @since 12 1124 */ 1125 /** 1126 * Return true if the value of this Decimal is greater than the value of `n`, otherwise return false. 1127 * 1128 * @param { Value } n {number | string | Decimal} 1129 * @returns { boolean } the boolean type 1130 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1131 * 1. Incorrect parameter types; 1132 * 2. Parameter verification failed. 1133 * @syscap SystemCapability.Utils.Lang 1134 * @crossplatform 1135 * @atomicservice 1136 * @since 18 1137 */ 1138 greaterThan(n: Value): boolean; 1139 1140 /** 1141 * Return true if the value of this Decimal is greater than or equal to the value of `n`, 1142 * otherwise return false. 1143 * 1144 * @param { Value } n {number | string | Decimal} 1145 * @returns { boolean } the boolean type 1146 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1147 * 1. Incorrect parameter types; 1148 * 2. Parameter verification failed. 1149 * @syscap SystemCapability.Utils.Lang 1150 * @atomicservice 1151 * @since 12 1152 */ 1153 /** 1154 * Return true if the value of this Decimal is greater than or equal to the value of `n`, 1155 * otherwise return false. 1156 * 1157 * @param { Value } n {number | string | Decimal} 1158 * @returns { boolean } the boolean type 1159 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1160 * 1. Incorrect parameter types; 1161 * 2. Parameter verification failed. 1162 * @syscap SystemCapability.Utils.Lang 1163 * @crossplatform 1164 * @atomicservice 1165 * @since 18 1166 */ 1167 greaterThanOrEqualTo(n: Value): boolean; 1168 1169 /** 1170 * Return true if the value of this Decimal is less than `n`, otherwise return false. 1171 * 1172 * @param { Value } n {number | string | Decimal} 1173 * @returns { boolean } the boolean type 1174 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1175 * 1. Incorrect parameter types; 1176 * 2. Parameter verification failed. 1177 * @syscap SystemCapability.Utils.Lang 1178 * @atomicservice 1179 * @since 12 1180 */ 1181 /** 1182 * Return true if the value of this Decimal is less than `n`, otherwise return false. 1183 * 1184 * @param { Value } n {number | string | Decimal} 1185 * @returns { boolean } the boolean type 1186 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1187 * 1. Incorrect parameter types; 1188 * 2. Parameter verification failed. 1189 * @syscap SystemCapability.Utils.Lang 1190 * @crossplatform 1191 * @atomicservice 1192 * @since 18 1193 */ 1194 lessThan(n: Value): boolean; 1195 1196 /** 1197 * Return true if the value of this Decimal is less than or equal to `n`, otherwise return false. 1198 * 1199 * @param { Value } n {number | string | Decimal} 1200 * @returns { boolean } the boolean type 1201 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1202 * 1. Incorrect parameter types; 1203 * 2. Parameter verification failed. 1204 * @syscap SystemCapability.Utils.Lang 1205 * @atomicservice 1206 * @since 12 1207 */ 1208 /** 1209 * Return true if the value of this Decimal is less than or equal to `n`, otherwise return false. 1210 * 1211 * @param { Value } n {number | string | Decimal} 1212 * @returns { boolean } the boolean type 1213 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1214 * 1. Incorrect parameter types; 1215 * 2. Parameter verification failed. 1216 * @syscap SystemCapability.Utils.Lang 1217 * @crossplatform 1218 * @atomicservice 1219 * @since 18 1220 */ 1221 lessThanOrEqualTo(n: Value): boolean; 1222 1223 /** 1224 * Return true if the value of this Decimal is a finite number, otherwise return false. 1225 * 1226 * @returns { boolean } the boolean type 1227 * @syscap SystemCapability.Utils.Lang 1228 * @atomicservice 1229 * @since 12 1230 */ 1231 /** 1232 * Return true if the value of this Decimal is a finite number, otherwise return false. 1233 * 1234 * @returns { boolean } the boolean type 1235 * @syscap SystemCapability.Utils.Lang 1236 * @crossplatform 1237 * @atomicservice 1238 * @since 18 1239 */ 1240 isFinite(): boolean; 1241 1242 /** 1243 * Return true if the value of this Decimal is an integer, otherwise return false. 1244 * 1245 * @returns { boolean } the boolean type 1246 * @syscap SystemCapability.Utils.Lang 1247 * @atomicservice 1248 * @since 12 1249 */ 1250 /** 1251 * Return true if the value of this Decimal is an integer, otherwise return false. 1252 * 1253 * @returns { boolean } the boolean type 1254 * @syscap SystemCapability.Utils.Lang 1255 * @crossplatform 1256 * @atomicservice 1257 * @since 18 1258 */ 1259 isInteger(): boolean; 1260 1261 /** 1262 * Return true if the value of this Decimal is NaN, otherwise return false. 1263 * 1264 * @returns { boolean } the boolean type 1265 * @syscap SystemCapability.Utils.Lang 1266 * @atomicservice 1267 * @since 12 1268 */ 1269 /** 1270 * Return true if the value of this Decimal is NaN, otherwise return false. 1271 * 1272 * @returns { boolean } the boolean type 1273 * @syscap SystemCapability.Utils.Lang 1274 * @crossplatform 1275 * @atomicservice 1276 * @since 18 1277 */ 1278 isNaN(): boolean; 1279 1280 /** 1281 * Return true if the value of this Decimal is negative, otherwise return false. 1282 * 1283 * @returns { boolean } the boolean type 1284 * @syscap SystemCapability.Utils.Lang 1285 * @atomicservice 1286 * @since 12 1287 */ 1288 /** 1289 * Return true if the value of this Decimal is negative, otherwise return false. 1290 * 1291 * @returns { boolean } the boolean type 1292 * @syscap SystemCapability.Utils.Lang 1293 * @crossplatform 1294 * @atomicservice 1295 * @since 18 1296 */ 1297 isNegative(): boolean; 1298 1299 /** 1300 * Return true if the value of this Decimal is positive, otherwise return false. 1301 * 1302 * @returns { boolean } the boolean type 1303 * @syscap SystemCapability.Utils.Lang 1304 * @atomicservice 1305 * @since 12 1306 */ 1307 /** 1308 * Return true if the value of this Decimal is positive, otherwise return false. 1309 * 1310 * @returns { boolean } the boolean type 1311 * @syscap SystemCapability.Utils.Lang 1312 * @crossplatform 1313 * @atomicservice 1314 * @since 18 1315 */ 1316 isPositive(): boolean; 1317 1318 /** 1319 * Return true if the value of this Decimal is 0 or -0, otherwise return false. 1320 * 1321 * @returns { boolean } the boolean type 1322 * @syscap SystemCapability.Utils.Lang 1323 * @atomicservice 1324 * @since 12 1325 */ 1326 /** 1327 * Return true if the value of this Decimal is 0 or -0, otherwise return false. 1328 * 1329 * @returns { boolean } the boolean type 1330 * @syscap SystemCapability.Utils.Lang 1331 * @crossplatform 1332 * @atomicservice 1333 * @since 18 1334 */ 1335 isZero(): boolean; 1336 1337 /** 1338 * Return a new Decimal whose value is the integer part of dividing the value of this Decimal 1339 * by the value of `n`, rounded to `precision` significant 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 * @syscap SystemCapability.Utils.Lang 1347 * @atomicservice 1348 * @since 12 1349 */ 1350 /** 1351 * Return a new Decimal whose value is the integer part of dividing the value of this Decimal 1352 * by the value of `n`, rounded to `precision` significant digits using rounding mode `rounding`. 1353 * 1354 * @param { Value } n {number | string | Decimal} 1355 * @returns { Decimal } the Decimal type 1356 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1357 * 1. Incorrect parameter types; 1358 * 2. Parameter verification failed. 1359 * @syscap SystemCapability.Utils.Lang 1360 * @crossplatform 1361 * @atomicservice 1362 * @since 18 1363 */ 1364 dividedToIntegerBy(n: Value): Decimal; 1365 1366 /** 1367 * Return a new Decimal whose value is the value of this Decimal negated, i.e. as if multiplied by -1. 1368 * 1369 * @returns { Decimal } the Decimal type 1370 * @syscap SystemCapability.Utils.Lang 1371 * @atomicservice 1372 * @since 12 1373 */ 1374 /** 1375 * Return a new Decimal whose value is the value of this Decimal negated, i.e. as if multiplied by -1. 1376 * 1377 * @returns { Decimal } the Decimal type 1378 * @syscap SystemCapability.Utils.Lang 1379 * @crossplatform 1380 * @atomicservice 1381 * @since 18 1382 */ 1383 negate(): Decimal; 1384 1385 /** 1386 * Return a string representing the value of this Decimal in base 2. 1387 * 1388 * @returns { string } the string type 1389 * @syscap SystemCapability.Utils.Lang 1390 * @atomicservice 1391 * @since 12 1392 */ 1393 /** 1394 * Return a string representing the value of this Decimal in base 2. 1395 * 1396 * @returns { string } the string type 1397 * @syscap SystemCapability.Utils.Lang 1398 * @crossplatform 1399 * @atomicservice 1400 * @since 18 1401 */ 1402 toBinary(): string; 1403 1404 /** 1405 * Return a string representing the value of this Decimal in base 2, round to `significantDigits` 1406 * significant digits. 1407 * 1408 * @param { number } significantDigits Significant digits. Integer, 1 to MAX_DIGITS inclusive. 1409 * @returns { string } the string type 1410 * @throws { BusinessError } 10200001 - The value of `significantDigits` is out of range. 1411 * @syscap SystemCapability.Utils.Lang 1412 * @atomicservice 1413 * @since 12 1414 */ 1415 /** 1416 * Return a string representing the value of this Decimal in base 2, round to `significantDigits` 1417 * significant digits. 1418 * 1419 * @param { number } significantDigits Significant digits. Integer, 1 to MAX_DIGITS inclusive. 1420 * @returns { string } the string type 1421 * @throws { BusinessError } 10200001 - The value of `significantDigits` is out of range. 1422 * @syscap SystemCapability.Utils.Lang 1423 * @crossplatform 1424 * @atomicservice 1425 * @since 18 1426 */ 1427 toBinary(significantDigits: number): string; 1428 1429 /** 1430 * Return a string representing the value of this Decimal in base 2, round to `significantDigits` 1431 * significant digits using rounding mode `rounding`. 1432 * 1433 * @param { number } significantDigits Significant digits. Integer, 1 to MAX_DIGITS inclusive. 1434 * @param { Rounding } rounding Rounding mode. Integer, 0 to 8 inclusive. 1435 * @returns { string } the string type 1436 * @throws { BusinessError } 10200001 - The value of `significantDigits | rounding` is out of range. 1437 * @syscap SystemCapability.Utils.Lang 1438 * @atomicservice 1439 * @since 12 1440 */ 1441 /** 1442 * Return a string representing the value of this Decimal in base 2, round to `significantDigits` 1443 * significant digits using rounding mode `rounding`. 1444 * 1445 * @param { number } significantDigits Significant digits. Integer, 1 to MAX_DIGITS inclusive. 1446 * @param { Rounding } rounding Rounding mode. Integer, 0 to 8 inclusive. 1447 * @returns { string } the string type 1448 * @throws { BusinessError } 10200001 - The value of `significantDigits | rounding` is out of range. 1449 * @syscap SystemCapability.Utils.Lang 1450 * @crossplatform 1451 * @atomicservice 1452 * @since 18 1453 */ 1454 toBinary(significantDigits: number, rounding: Rounding): string; 1455 1456 /** 1457 * Return a string representing the value of this Decimal in base 8. 1458 * 1459 * @returns { string } the string type 1460 * @syscap SystemCapability.Utils.Lang 1461 * @atomicservice 1462 * @since 12 1463 */ 1464 /** 1465 * Return a string representing the value of this Decimal in base 8. 1466 * 1467 * @returns { string } the string type 1468 * @syscap SystemCapability.Utils.Lang 1469 * @crossplatform 1470 * @atomicservice 1471 * @since 18 1472 */ 1473 toOctal(): string; 1474 1475 /** 1476 * Return a string representing the value of this Decimal in base 8, round to `significantDigits` significant. 1477 * 1478 * @param { number } significantDigits {number | string | Decimal} 1479 * @returns { string } the string type 1480 * @throws { BusinessError } 10200001 - The value of `significantDigits` is out of range. 1481 * @syscap SystemCapability.Utils.Lang 1482 * @atomicservice 1483 * @since 12 1484 */ 1485 /** 1486 * Return a string representing the value of this Decimal in base 8, round to `significantDigits` significant. 1487 * 1488 * @param { number } significantDigits {number | string | Decimal} 1489 * @returns { string } the string type 1490 * @throws { BusinessError } 10200001 - The value of `significantDigits` is out of range. 1491 * @syscap SystemCapability.Utils.Lang 1492 * @crossplatform 1493 * @atomicservice 1494 * @since 18 1495 */ 1496 toOctal(significantDigits: number): string; 1497 1498 /** 1499 * Return a string representing the value of this Decimal in base 8, round to `significantDigits` significant 1500 * digits using rounding mode `rounding`. 1501 * 1502 * @param { number } significantDigits {number | string | Decimal} 1503 * @param { Rounding } rounding Rounding mode. Integer, 0 to 8 inclusive. 1504 * @returns { string } the string type 1505 * @throws { BusinessError } 10200001 - The value of `significantDigits | rounding` is out of range. 1506 * @syscap SystemCapability.Utils.Lang 1507 * @atomicservice 1508 * @since 12 1509 */ 1510 /** 1511 * Return a string representing the value of this Decimal in base 8, round to `significantDigits` significant 1512 * digits using rounding mode `rounding`. 1513 * 1514 * @param { number } significantDigits {number | string | Decimal} 1515 * @param { Rounding } rounding Rounding mode. Integer, 0 to 8 inclusive. 1516 * @returns { string } the string type 1517 * @throws { BusinessError } 10200001 - The value of `significantDigits | rounding` is out of range. 1518 * @syscap SystemCapability.Utils.Lang 1519 * @crossplatform 1520 * @atomicservice 1521 * @since 18 1522 */ 1523 toOctal(significantDigits: number, rounding: Rounding): string; 1524 1525 /** 1526 * Return a string representing the value of this Decimal in base 16 1527 * 1528 * @returns { string } the string type 1529 * @syscap SystemCapability.Utils.Lang 1530 * @atomicservice 1531 * @since 12 1532 */ 1533 /** 1534 * Return a string representing the value of this Decimal in base 16 1535 * 1536 * @returns { string } the string type 1537 * @syscap SystemCapability.Utils.Lang 1538 * @crossplatform 1539 * @atomicservice 1540 * @since 18 1541 */ 1542 toHexadecimal(): string; 1543 1544 /** 1545 * Return a string representing the value of this Decimal in base 16, round to `significantDigits` significant. 1546 * 1547 * @param { number } significantDigits Significant digits. Integer, 1 to MAX_DIGITS inclusive. 1548 * @returns { string } the string type 1549 * @throws { BusinessError } 10200001 - The value of `significantDigits` is out of range. 1550 * @syscap SystemCapability.Utils.Lang 1551 * @atomicservice 1552 * @since 12 1553 */ 1554 /** 1555 * Return a string representing the value of this Decimal in base 16, round to `significantDigits` significant. 1556 * 1557 * @param { number } significantDigits Significant digits. Integer, 1 to MAX_DIGITS inclusive. 1558 * @returns { string } the string type 1559 * @throws { BusinessError } 10200001 - The value of `significantDigits` is out of range. 1560 * @syscap SystemCapability.Utils.Lang 1561 * @crossplatform 1562 * @atomicservice 1563 * @since 18 1564 */ 1565 toHexadecimal(significantDigits: number): string; 1566 1567 /** 1568 * Return a string representing the value of this Decimal in base 16, round to `significantDigits` significant 1569 * digits using rounding mode `rounding`. 1570 * 1571 * @param { number } significantDigits Significant digits. Integer, 1 to MAX_DIGITS inclusive. 1572 * @param { Rounding } rounding Rounding mode. Integer, 0 to 8 inclusive. 1573 * @returns { string } the string type 1574 * @throws { BusinessError } 10200001 - The value of `significantDigits | rounding` is out of range. 1575 * @syscap SystemCapability.Utils.Lang 1576 * @atomicservice 1577 * @since 12 1578 */ 1579 /** 1580 * Return a string representing the value of this Decimal in base 16, round to `significantDigits` significant 1581 * digits using rounding mode `rounding`. 1582 * 1583 * @param { number } significantDigits Significant digits. Integer, 1 to MAX_DIGITS inclusive. 1584 * @param { Rounding } rounding Rounding mode. Integer, 0 to 8 inclusive. 1585 * @returns { string } the string type 1586 * @throws { BusinessError } 10200001 - The value of `significantDigits | rounding` is out of range. 1587 * @syscap SystemCapability.Utils.Lang 1588 * @crossplatform 1589 * @atomicservice 1590 * @since 18 1591 */ 1592 toHexadecimal(significantDigits: number, rounding: Rounding): string; 1593 1594 /** 1595 * Return a new Decimal whose value is the value of this Decimal. 1596 * 1597 * @returns { Decimal } the Decimal type 1598 * @syscap SystemCapability.Utils.Lang 1599 * @atomicservice 1600 * @since 12 1601 */ 1602 /** 1603 * Return a new Decimal whose value is the value of this Decimal. 1604 * 1605 * @returns { Decimal } the Decimal type 1606 * @syscap SystemCapability.Utils.Lang 1607 * @crossplatform 1608 * @atomicservice 1609 * @since 18 1610 */ 1611 toDecimalPlaces(): Decimal; 1612 1613 /** 1614 * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `decimalPlaces` 1615 * decimal places. 1616 * 1617 * @param { number } decimalPlaces Significant digits. Integer, 1 to MAX_DIGITS inclusive. 1618 * @returns { Decimal } the Decimal type 1619 * @throws { BusinessError } 10200001 - The value of `decimalPlaces` is out of range. 1620 * @syscap SystemCapability.Utils.Lang 1621 * @atomicservice 1622 * @since 12 1623 */ 1624 /** 1625 * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `decimalPlaces` 1626 * decimal places. 1627 * 1628 * @param { number } decimalPlaces Significant digits. Integer, 1 to MAX_DIGITS inclusive. 1629 * @returns { Decimal } the Decimal type 1630 * @throws { BusinessError } 10200001 - The value of `decimalPlaces` is out of range. 1631 * @syscap SystemCapability.Utils.Lang 1632 * @crossplatform 1633 * @atomicservice 1634 * @since 18 1635 */ 1636 toDecimalPlaces(decimalPlaces: number): Decimal; 1637 1638 /** 1639 * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `decimalPlaces` 1640 * decimal places using rounding mode `rounding`. 1641 * 1642 * @param { number } decimalPlaces Significant digits. Integer, 1 to MAX_DIGITS inclusive. 1643 * @param { Rounding } rounding Rounding mode. Integer, 0 to 8 inclusive. 1644 * @returns { Decimal } the Decimal type 1645 * @throws { BusinessError } 10200001 - The value of `decimalPlaces | rounding` is out of range. 1646 * @syscap SystemCapability.Utils.Lang 1647 * @atomicservice 1648 * @since 12 1649 */ 1650 /** 1651 * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `decimalPlaces` 1652 * decimal places using rounding mode `rounding`. 1653 * 1654 * @param { number } decimalPlaces Significant digits. Integer, 1 to MAX_DIGITS inclusive. 1655 * @param { Rounding } rounding Rounding mode. Integer, 0 to 8 inclusive. 1656 * @returns { Decimal } the Decimal type 1657 * @throws { BusinessError } 10200001 - The value of `decimalPlaces | rounding` is out of range. 1658 * @syscap SystemCapability.Utils.Lang 1659 * @crossplatform 1660 * @atomicservice 1661 * @since 18 1662 */ 1663 toDecimalPlaces(decimalPlaces: number, rounding: Rounding): Decimal; 1664 1665 /** 1666 * Return a string representing the value of this Decimal in exponential notation. 1667 * 1668 * @returns { string } the string type 1669 * @syscap SystemCapability.Utils.Lang 1670 * @atomicservice 1671 * @since 12 1672 */ 1673 /** 1674 * Return a string representing the value of this Decimal in exponential notation. 1675 * 1676 * @returns { string } the string type 1677 * @syscap SystemCapability.Utils.Lang 1678 * @crossplatform 1679 * @atomicservice 1680 * @since 18 1681 */ 1682 toExponential(): string; 1683 1684 /** 1685 * Return a string representing the value of this Decimal in exponential notation rounded to 1686 * `decimalPlaces` fixed decimal places. 1687 * 1688 * @param { number } decimalPlaces Decimal places. Integer, 0 to MAX_DIGITS inclusive. 1689 * @returns { string } the string type 1690 * @throws { BusinessError } 10200001 - The value of `decimalPlaces` is out of range. 1691 * @syscap SystemCapability.Utils.Lang 1692 * @atomicservice 1693 * @since 12 1694 */ 1695 /** 1696 * Return a string representing the value of this Decimal in exponential notation rounded to 1697 * `decimalPlaces` fixed decimal places. 1698 * 1699 * @param { number } decimalPlaces Decimal places. Integer, 0 to MAX_DIGITS inclusive. 1700 * @returns { string } the string type 1701 * @throws { BusinessError } 10200001 - The value of `decimalPlaces` is out of range. 1702 * @syscap SystemCapability.Utils.Lang 1703 * @crossplatform 1704 * @atomicservice 1705 * @since 18 1706 */ 1707 toExponential(decimalPlaces: number): string; 1708 1709 /** 1710 * Return a string representing the value of this Decimal in exponential notation rounded to 1711 * `decimalPlaces` fixed decimal places using rounding mode `rounding`. 1712 * 1713 * @param { number } decimalPlaces Decimal places. Integer, 0 to MAX_DIGITS inclusive. 1714 * @param { Rounding } rounding Rounding mode. Integer, 0 to 8 inclusive. 1715 * @returns { string } the string type 1716 * @throws { BusinessError } 10200001 - The value of `decimalPlaces | rounding` is out of range. 1717 * @syscap SystemCapability.Utils.Lang 1718 * @atomicservice 1719 * @since 12 1720 */ 1721 /** 1722 * Return a string representing the value of this Decimal in exponential notation rounded to 1723 * `decimalPlaces` fixed decimal places using rounding mode `rounding`. 1724 * 1725 * @param { number } decimalPlaces Decimal places. Integer, 0 to MAX_DIGITS inclusive. 1726 * @param { Rounding } rounding Rounding mode. Integer, 0 to 8 inclusive. 1727 * @returns { string } the string type 1728 * @throws { BusinessError } 10200001 - The value of `decimalPlaces | rounding` is out of range. 1729 * @syscap SystemCapability.Utils.Lang 1730 * @crossplatform 1731 * @atomicservice 1732 * @since 18 1733 */ 1734 toExponential(decimalPlaces: number, rounding: Rounding): string; 1735 1736 /** 1737 * Return a string representing the value of this Decimal in normal (fixed-point). 1738 * 1739 * @returns { string } the string type 1740 * @syscap SystemCapability.Utils.Lang 1741 * @atomicservice 1742 * @since 12 1743 */ 1744 /** 1745 * Return a string representing the value of this Decimal in normal (fixed-point). 1746 * 1747 * @returns { string } the string type 1748 * @syscap SystemCapability.Utils.Lang 1749 * @crossplatform 1750 * @atomicservice 1751 * @since 18 1752 */ 1753 toFixed(): string; 1754 1755 /** 1756 * Return a string representing the value of this Decimal in normal (fixed-point) notation to 1757 * `decimalPlaces` fixed decimal places. 1758 * 1759 * @param { number } decimalPlaces Decimal places. Integer, 0 to MAX_DIGITS inclusive. 1760 * @returns { string } the string type 1761 * @throws { BusinessError } 10200001 - The value of `decimalPlaces` is out of range. 1762 * @atomicservice 1763 * @since 12 1764 */ 1765 /** 1766 * Return a string representing the value of this Decimal in normal (fixed-point) notation to 1767 * `decimalPlaces` fixed decimal places. 1768 * 1769 * @param { number } decimalPlaces Decimal places. Integer, 0 to MAX_DIGITS inclusive. 1770 * @returns { string } the string type 1771 * @throws { BusinessError } 10200001 - The value of `decimalPlaces` is out of range. 1772 * @crossplatform 1773 * @atomicservice 1774 * @since 18 1775 */ 1776 toFixed(decimalPlaces: number): string; 1777 1778 /** 1779 * Return a string representing the value of this Decimal in normal (fixed-point) notation to 1780 * `decimalPlaces` fixed decimal places and rounded using rounding mode `rounding`. 1781 * 1782 * @param { number } decimalPlaces Decimal places. Integer, 0 to MAX_DIGITS inclusive. 1783 * @param { Rounding } rounding Rounding mode. Integer, 0 to 8 inclusive. 1784 * @returns { string } the string type 1785 * @throws { BusinessError } 10200001 - The value of `decimalPlaces | rounding` is out of range. 1786 * @syscap SystemCapability.Utils.Lang 1787 * @atomicservice 1788 * @since 12 1789 */ 1790 /** 1791 * Return a string representing the value of this Decimal in normal (fixed-point) notation to 1792 * `decimalPlaces` fixed decimal places and rounded using rounding mode `rounding`. 1793 * 1794 * @param { number } decimalPlaces Decimal places. Integer, 0 to MAX_DIGITS inclusive. 1795 * @param { Rounding } rounding Rounding mode. Integer, 0 to 8 inclusive. 1796 * @returns { string } the string type 1797 * @throws { BusinessError } 10200001 - The value of `decimalPlaces | rounding` is out of range. 1798 * @syscap SystemCapability.Utils.Lang 1799 * @crossplatform 1800 * @atomicservice 1801 * @since 18 1802 */ 1803 toFixed(decimalPlaces: number, rounding: Rounding): string; 1804 1805 /** 1806 * Return an array representing the value of this Decimal as a simple fraction with an integer 1807 * numerator and an integer denominator. 1808 * 1809 * @returns { Decimal[] } the Decimal[] type 1810 * @syscap SystemCapability.Utils.Lang 1811 * @atomicservice 1812 * @since 12 1813 */ 1814 /** 1815 * Return an array representing the value of this Decimal as a simple fraction with an integer 1816 * numerator and an integer denominator. 1817 * 1818 * @returns { Decimal[] } the Decimal[] type 1819 * @syscap SystemCapability.Utils.Lang 1820 * @crossplatform 1821 * @atomicservice 1822 * @since 18 1823 */ 1824 toFraction(): Decimal[]; 1825 1826 /** 1827 * Return an array representing the value of this Decimal as a simple fraction with an integer 1828 * numerator and an integer denominator. The denominator will be a positive non-zero value 1829 * less than or equal to `max_denominator`. 1830 * 1831 * @param { Value } maxDenominator {number | string | Decimal} 1832 * @returns { Decimal[] } the Decimal[] type 1833 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1834 * 1. Incorrect parameter types; 1835 * 2. Parameter verification failed. 1836 * @syscap SystemCapability.Utils.Lang 1837 * @atomicservice 1838 * @since 12 1839 */ 1840 /** 1841 * Return an array representing the value of this Decimal as a simple fraction with an integer 1842 * numerator and an integer denominator. The denominator will be a positive non-zero value 1843 * less than or equal to `max_denominator`. 1844 * 1845 * @param { Value } maxDenominator {number | string | Decimal} 1846 * @returns { Decimal[] } the Decimal[] type 1847 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1848 * 1. Incorrect parameter types; 1849 * 2. Parameter verification failed. 1850 * @syscap SystemCapability.Utils.Lang 1851 * @crossplatform 1852 * @atomicservice 1853 * @since 18 1854 */ 1855 toFraction(maxDenominator: Value): Decimal[]; 1856 1857 /** 1858 * Returns a new Decimal whose value is the nearest multiple of `n`. 1859 * 1860 * @param { Value } n {number | string | Decimal} 1861 * @returns { Decimal } the Decimal type 1862 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1863 * 1. Incorrect parameter types; 1864 * 2. Parameter verification failed. 1865 * @syscap SystemCapability.Utils.Lang 1866 * @atomicservice 1867 * @since 12 1868 */ 1869 /** 1870 * Returns a new Decimal whose value is the nearest multiple of `n`. 1871 * 1872 * @param { Value } n {number | string | Decimal} 1873 * @returns { Decimal } the Decimal type 1874 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1875 * 1. Incorrect parameter types; 1876 * 2. Parameter verification failed. 1877 * @syscap SystemCapability.Utils.Lang 1878 * @crossplatform 1879 * @atomicservice 1880 * @since 18 1881 */ 1882 toNearest(n: Value): Decimal; 1883 1884 /** 1885 * Returns a new Decimal whose value is the nearest multiple of `n` in the direction of rounding 1886 * mode `rounding`, to the value of this Decimal. 1887 * 1888 * @param { Value } n {number | string | Decimal} 1889 * @param { Rounding } rounding Rounding mode. Integer, 0 to 8 inclusive. 1890 * @returns { Decimal } the Decimal type 1891 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1892 * 1. Incorrect parameter types; 1893 * 2. Parameter verification failed. 1894 * @throws { BusinessError } 10200001 - The value of `rounding` is out of range. 1895 * @syscap SystemCapability.Utils.Lang 1896 * @atomicservice 1897 * @since 12 1898 */ 1899 /** 1900 * Returns a new Decimal whose value is the nearest multiple of `n` in the direction of rounding 1901 * mode `rounding`, to the value of this Decimal. 1902 * 1903 * @param { Value } n {number | string | Decimal} 1904 * @param { Rounding } rounding Rounding mode. Integer, 0 to 8 inclusive. 1905 * @returns { Decimal } the Decimal type 1906 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1907 * 1. Incorrect parameter types; 1908 * 2. Parameter verification failed. 1909 * @throws { BusinessError } 10200001 - The value of `rounding` is out of range. 1910 * @syscap SystemCapability.Utils.Lang 1911 * @crossplatform 1912 * @atomicservice 1913 * @since 18 1914 */ 1915 toNearest(n: Value, rounding: Rounding): Decimal; 1916 1917 /** 1918 * Return a string representing the value of this Decimal. 1919 * 1920 * @returns { string } the string type 1921 * @syscap SystemCapability.Utils.Lang 1922 * @atomicservice 1923 * @since 12 1924 */ 1925 /** 1926 * Return a string representing the value of this Decimal. 1927 * 1928 * @returns { string } the string type 1929 * @syscap SystemCapability.Utils.Lang 1930 * @crossplatform 1931 * @atomicservice 1932 * @since 18 1933 */ 1934 toPrecision(): string; 1935 1936 /** 1937 * Return a string representing the value of this Decimal rounded to `significantDigits` significant digits. 1938 * 1939 * @param { number } significantDigits Significant digits. Integer, 1 to MAX_DIGITS inclusive. 1940 * @returns { string } the string type 1941 * @throws { BusinessError } 10200001 - The value of `significantDigits` is out of range. 1942 * @syscap SystemCapability.Utils.Lang 1943 * @atomicservice 1944 * @since 12 1945 */ 1946 /** 1947 * Return a string representing the value of this Decimal rounded to `significantDigits` significant digits. 1948 * 1949 * @param { number } significantDigits Significant digits. Integer, 1 to MAX_DIGITS inclusive. 1950 * @returns { string } the string type 1951 * @throws { BusinessError } 10200001 - The value of `significantDigits` is out of range. 1952 * @syscap SystemCapability.Utils.Lang 1953 * @crossplatform 1954 * @atomicservice 1955 * @since 18 1956 */ 1957 toPrecision(significantDigits: number): string; 1958 1959 /** 1960 * Return a string representing the value of this Decimal rounded to `significantDigits` significant digits 1961 * using rounding mode `rounding`. 1962 * 1963 * @param { number } significantDigits Significant digits. Integer, 1 to MAX_DIGITS inclusive. 1964 * @param { Rounding } rounding Rounding mode. Integer, 0 to 8 inclusive. 1965 * @returns { string } the string type 1966 * @throws { BusinessError } 10200001 - The value of `significantDigits | rounding` is out of range. 1967 * @syscap SystemCapability.Utils.Lang 1968 * @atomicservice 1969 * @since 12 1970 */ 1971 /** 1972 * Return a string representing the value of this Decimal rounded to `significantDigits` significant digits 1973 * using rounding mode `rounding`. 1974 * 1975 * @param { number } significantDigits Significant digits. Integer, 1 to MAX_DIGITS inclusive. 1976 * @param { Rounding } rounding Rounding mode. Integer, 0 to 8 inclusive. 1977 * @returns { string } the string type 1978 * @throws { BusinessError } 10200001 - The value of `significantDigits | rounding` is out of range. 1979 * @syscap SystemCapability.Utils.Lang 1980 * @crossplatform 1981 * @atomicservice 1982 * @since 18 1983 */ 1984 toPrecision(significantDigits: number, rounding: Rounding): string; 1985 1986 /** 1987 * Return a new Decimal whose value is the value of this Decimal. 1988 * 1989 * @returns { Decimal } the Decimal type 1990 * @syscap SystemCapability.Utils.Lang 1991 * @atomicservice 1992 * @since 12 1993 */ 1994 /** 1995 * Return a new Decimal whose value is the value of this Decimal. 1996 * 1997 * @returns { Decimal } the Decimal type 1998 * @syscap SystemCapability.Utils.Lang 1999 * @crossplatform 2000 * @atomicservice 2001 * @since 18 2002 */ 2003 toSignificantDigits(): Decimal; 2004 2005 /** 2006 * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `significantDigits` 2007 * significant digits. 2008 * 2009 * @param { number } significantDigits Significant digits. Integer, 1 to MAX_DIGITS inclusive. 2010 * @returns { Decimal } the Decimal type 2011 * @throws { BusinessError } 10200001 - The value of `significantDigits` is out of range. 2012 * @syscap SystemCapability.Utils.Lang 2013 * @atomicservice 2014 * @since 12 2015 */ 2016 /** 2017 * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `significantDigits` 2018 * significant digits. 2019 * 2020 * @param { number } significantDigits Significant digits. Integer, 1 to MAX_DIGITS inclusive. 2021 * @returns { Decimal } the Decimal type 2022 * @throws { BusinessError } 10200001 - The value of `significantDigits` is out of range. 2023 * @syscap SystemCapability.Utils.Lang 2024 * @crossplatform 2025 * @atomicservice 2026 * @since 18 2027 */ 2028 toSignificantDigits(significantDigits: number): Decimal; 2029 2030 /** 2031 * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `significantDigits` 2032 * significant digits using rounding mode `rounding`. 2033 * 2034 * @param { number } significantDigits Significant digits. Integer, 1 to MAX_DIGITS inclusive. 2035 * @param { Rounding } rounding Rounding mode. Integer, 0 to 8 inclusive. 2036 * @returns { Decimal } the Decimal type 2037 * @throws { BusinessError } 10200001 - The value of `significantDigits | rounding` is out of range. 2038 * @syscap SystemCapability.Utils.Lang 2039 * @atomicservice 2040 * @since 12 2041 */ 2042 /** 2043 * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `significantDigits` 2044 * significant digits using rounding mode `rounding`. 2045 * 2046 * @param { number } significantDigits Significant digits. Integer, 1 to MAX_DIGITS inclusive. 2047 * @param { Rounding } rounding Rounding mode. Integer, 0 to 8 inclusive. 2048 * @returns { Decimal } the Decimal type 2049 * @throws { BusinessError } 10200001 - The value of `significantDigits | rounding` is out of range. 2050 * @syscap SystemCapability.Utils.Lang 2051 * @crossplatform 2052 * @atomicservice 2053 * @since 18 2054 */ 2055 toSignificantDigits(significantDigits: number, rounding: Rounding): Decimal; 2056 2057 /** 2058 * Return the value of this Decimal converted to a number primitive. Zero keeps its sign. 2059 * 2060 * @returns { number } the number type 2061 * @syscap SystemCapability.Utils.Lang 2062 * @atomicservice 2063 * @since 12 2064 */ 2065 /** 2066 * Return the value of this Decimal converted to a number primitive. Zero keeps its sign. 2067 * 2068 * @returns { number } the number type 2069 * @syscap SystemCapability.Utils.Lang 2070 * @crossplatform 2071 * @atomicservice 2072 * @since 18 2073 */ 2074 toNumber(): number; 2075 2076 /** 2077 * Return a string representing the value of this Decimal. 2078 * Return exponential notation if this Decimal has a positive exponent equal to or greater than 2079 * `toExpPos`, or a negative exponent equal to or less than `toExpNeg`. 2080 * 2081 * @returns { string } the string type 2082 * @syscap SystemCapability.Utils.Lang 2083 * @atomicservice 2084 * @since 12 2085 */ 2086 /** 2087 * Return a string representing the value of this Decimal. 2088 * Return exponential notation if this Decimal has a positive exponent equal to or greater than 2089 * `toExpPos`, or a negative exponent equal to or less than `toExpNeg`. 2090 * 2091 * @returns { string } the string type 2092 * @syscap SystemCapability.Utils.Lang 2093 * @crossplatform 2094 * @atomicservice 2095 * @since 18 2096 */ 2097 toString(): string; 2098 2099 /** 2100 * Return a string representing the value of this Decimal. 2101 * Unlike `toString`, negative zero will include the minus sign. 2102 * 2103 * @returns { string } the string type 2104 * @syscap SystemCapability.Utils.Lang 2105 * @atomicservice 2106 * @since 12 2107 */ 2108 /** 2109 * Return a string representing the value of this Decimal. 2110 * Unlike `toString`, negative zero will include the minus sign. 2111 * 2112 * @returns { string } the string type 2113 * @syscap SystemCapability.Utils.Lang 2114 * @crossplatform 2115 * @atomicservice 2116 * @since 18 2117 */ 2118 valueOf(): string; 2119 2120 /** 2121 * Return the number of decimal places of the value of this Decimal. 2122 * 2123 * @returns { number } the number type 2124 * @syscap SystemCapability.Utils.Lang 2125 * @atomicservice 2126 * @since 12 2127 */ 2128 /** 2129 * Return the number of decimal places of the value of this Decimal. 2130 * 2131 * @returns { number } the number type 2132 * @syscap SystemCapability.Utils.Lang 2133 * @crossplatform 2134 * @atomicservice 2135 * @since 18 2136 */ 2137 decimalPlaces(): number; 2138 2139 /** 2140 * Return the number of significant digits of the value of this Decimal. 2141 * 2142 * @returns { number } the number type 2143 * @syscap SystemCapability.Utils.Lang 2144 * @atomicservice 2145 * @since 12 2146 */ 2147 /** 2148 * Return the number of significant digits of the value of this Decimal. 2149 * 2150 * @returns { number } the number type 2151 * @syscap SystemCapability.Utils.Lang 2152 * @crossplatform 2153 * @atomicservice 2154 * @since 18 2155 */ 2156 precision(): number; 2157 2158 /** 2159 * Return the number of significant digits of the value of this Decimal, whether to count 2160 * integer-part trailing zeros. 2161 * 2162 * @param { boolean | number } includeZeros Whether to count integer-part trailing zeros: true, false, 2163 * 1 or 0. 2164 * @returns { number } the number type 2165 * @throws { BusinessError } 10200001 - The value of `includeZeros` is out of range. 2166 * @syscap SystemCapability.Utils.Lang 2167 * @atomicservice 2168 * @since 12 2169 */ 2170 /** 2171 * Return the number of significant digits of the value of this Decimal, whether to count 2172 * integer-part trailing zeros. 2173 * 2174 * @param { boolean | number } includeZeros Whether to count integer-part trailing zeros: true, false, 2175 * 1 or 0. 2176 * @returns { number } the number type 2177 * @throws { BusinessError } 10200001 - The value of `includeZeros` is out of range. 2178 * @syscap SystemCapability.Utils.Lang 2179 * @crossplatform 2180 * @atomicservice 2181 * @since 18 2182 */ 2183 precision(includeZeros: boolean | number): number; 2184 2185 /** 2186 * Return a new Decimal whose value is the absolute value of `n`. 2187 * 2188 * @param { Value } n {number | string | Decimal} 2189 * @returns { Decimal } the Decimal type 2190 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2191 * 1. Incorrect parameter types; 2192 * 2. Parameter verification failed. 2193 * @static 2194 * @syscap SystemCapability.Utils.Lang 2195 * @atomicservice 2196 * @since 12 2197 */ 2198 /** 2199 * Return a new Decimal whose value is the absolute value of `n`. 2200 * 2201 * @param { Value } n {number | string | Decimal} 2202 * @returns { Decimal } the Decimal type 2203 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2204 * 1. Incorrect parameter types; 2205 * 2. Parameter verification failed. 2206 * @static 2207 * @syscap SystemCapability.Utils.Lang 2208 * @crossplatform 2209 * @atomicservice 2210 * @since 18 2211 */ 2212 static abs(n: Value): Decimal; 2213 2214 /** 2215 * Return a new Decimal whose value is `n` round to an integer using `ROUND_FLOOR`. 2216 * 2217 * @param { Value } n {number | string | Decimal} 2218 * @returns { Decimal } the Decimal type 2219 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2220 * 1. Incorrect parameter types; 2221 * 2. Parameter verification failed. 2222 * @static 2223 * @syscap SystemCapability.Utils.Lang 2224 * @atomicservice 2225 * @since 12 2226 */ 2227 /** 2228 * Return a new Decimal whose value is `n` round to an integer using `ROUND_FLOOR`. 2229 * 2230 * @param { Value } n {number | string | Decimal} 2231 * @returns { Decimal } the Decimal type 2232 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2233 * 1. Incorrect parameter types; 2234 * 2. Parameter verification failed. 2235 * @static 2236 * @syscap SystemCapability.Utils.Lang 2237 * @crossplatform 2238 * @atomicservice 2239 * @since 18 2240 */ 2241 static floor(n: Value): Decimal; 2242 2243 /** 2244 * Return a new Decimal whose value is `n` rounded to an integer using `ROUND_CEIL`. 2245 * 2246 * @param { Value } n {number | string | Decimal} 2247 * @returns { Decimal } the Decimal type 2248 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2249 * 1. Incorrect parameter types; 2250 * 2. Parameter verification failed. 2251 * @static 2252 * @syscap SystemCapability.Utils.Lang 2253 * @atomicservice 2254 * @since 12 2255 */ 2256 /** 2257 * Return a new Decimal whose value is `n` rounded to an integer using `ROUND_CEIL`. 2258 * 2259 * @param { Value } n {number | string | Decimal} 2260 * @returns { Decimal } the Decimal type 2261 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2262 * 1. Incorrect parameter types; 2263 * 2. Parameter verification failed. 2264 * @static 2265 * @syscap SystemCapability.Utils.Lang 2266 * @crossplatform 2267 * @atomicservice 2268 * @since 18 2269 */ 2270 static ceil(n: Value): Decimal; 2271 2272 /** 2273 * Return a new Decimal whose value is `n` truncated to an integer. 2274 * 2275 * @param { Value } n {number | string | Decimal} 2276 * @returns { Decimal } the Decimal type 2277 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2278 * 1. Incorrect parameter types; 2279 * 2. Parameter verification failed. 2280 * @static 2281 * @syscap SystemCapability.Utils.Lang 2282 * @atomicservice 2283 * @since 12 2284 */ 2285 /** 2286 * Return a new Decimal whose value is `n` truncated to an integer. 2287 * 2288 * @param { Value } n {number | string | Decimal} 2289 * @returns { Decimal } the Decimal type 2290 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2291 * 1. Incorrect parameter types; 2292 * 2. Parameter verification failed. 2293 * @static 2294 * @syscap SystemCapability.Utils.Lang 2295 * @crossplatform 2296 * @atomicservice 2297 * @since 18 2298 */ 2299 static trunc(n: Value): Decimal; 2300 2301 /** 2302 * Return a new Decimal whose value is `n` clamped to the range delineated by `min` and `max`. 2303 * 2304 * @param { Value } n {number | string | Decimal} 2305 * @param { Value } min {number | string | Decimal} 2306 * @param { Value } max {number | string | Decimal} 2307 * @returns { Decimal } the Decimal type 2308 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2309 * 1. Incorrect parameter types; 2310 * 2. Parameter verification failed. 2311 * @throws { BusinessError } 10200001 - The value of `min` is out of range. 2312 * @static 2313 * @syscap SystemCapability.Utils.Lang 2314 * @atomicservice 2315 * @since 12 2316 */ 2317 /** 2318 * Return a new Decimal whose value is `n` clamped to the range delineated by `min` and `max`. 2319 * 2320 * @param { Value } n {number | string | Decimal} 2321 * @param { Value } min {number | string | Decimal} 2322 * @param { Value } max {number | string | Decimal} 2323 * @returns { Decimal } the Decimal type 2324 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2325 * 1. Incorrect parameter types; 2326 * 2. Parameter verification failed. 2327 * @throws { BusinessError } 10200001 - The value of `min` is out of range. 2328 * @static 2329 * @syscap SystemCapability.Utils.Lang 2330 * @crossplatform 2331 * @atomicservice 2332 * @since 18 2333 */ 2334 static clamp(n: Value, min: Value, max: Value): Decimal; 2335 2336 /** 2337 * Return a new Decimal whose value is the sum of `x` and `y`, rounded to `precision` significant 2338 * digits using rounding mode `rounding`. 2339 * 2340 * @param { Value } x {number | string | Decimal} 2341 * @param { Value } y {number | string | Decimal} 2342 * @returns { Decimal } the Decimal type 2343 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2344 * 1. Incorrect parameter types; 2345 * 2. Parameter verification failed. 2346 * @static 2347 * @syscap SystemCapability.Utils.Lang 2348 * @atomicservice 2349 * @since 12 2350 */ 2351 /** 2352 * Return a new Decimal whose value is the sum of `x` and `y`, rounded to `precision` significant 2353 * digits using rounding mode `rounding`. 2354 * 2355 * @param { Value } x {number | string | Decimal} 2356 * @param { Value } y {number | string | Decimal} 2357 * @returns { Decimal } the Decimal type 2358 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2359 * 1. Incorrect parameter types; 2360 * 2. Parameter verification failed. 2361 * @static 2362 * @syscap SystemCapability.Utils.Lang 2363 * @crossplatform 2364 * @atomicservice 2365 * @since 18 2366 */ 2367 static add(x: Value, y: Value): Decimal; 2368 2369 /** 2370 * Return a new Decimal whose value is the sum of the arguments, rounded to `precision` 2371 * significant digits using rounding mode `rounding`. 2372 * 2373 * Only the result is rounded, not the intermediate calculations. 2374 * 2375 * @param { Value[] } n {number | string | Decimal} 2376 * @returns { Decimal } the Decimal type 2377 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2378 * 1. Incorrect parameter types; 2379 * 2. Parameter verification failed. 2380 * @static 2381 * @syscap SystemCapability.Utils.Lang 2382 * @atomicservice 2383 * @since 12 2384 */ 2385 /** 2386 * Return a new Decimal whose value is the sum of the arguments, rounded to `precision` 2387 * significant digits using rounding mode `rounding`. 2388 * 2389 * Only the result is rounded, not the intermediate calculations. 2390 * 2391 * @param { Value[] } n {number | string | Decimal} 2392 * @returns { Decimal } the Decimal type 2393 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2394 * 1. Incorrect parameter types; 2395 * 2. Parameter verification failed. 2396 * @static 2397 * @syscap SystemCapability.Utils.Lang 2398 * @crossplatform 2399 * @atomicservice 2400 * @since 18 2401 */ 2402 static sum(...n: Value[]): Decimal; 2403 2404 /** 2405 * Return a new Decimal whose value is `x` minus `y`, rounded to `precision` significant digits 2406 * using rounding mode `rounding`. 2407 * 2408 * @param { Value } x {number | string | Decimal} 2409 * @param { Value } y {number | string | Decimal} 2410 * @returns { Decimal } the Decimal type 2411 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2412 * 1. Incorrect parameter types; 2413 * 2. Parameter verification failed. 2414 * @static 2415 * @syscap SystemCapability.Utils.Lang 2416 * @atomicservice 2417 * @since 12 2418 */ 2419 /** 2420 * Return a new Decimal whose value is `x` minus `y`, rounded to `precision` significant digits 2421 * using rounding mode `rounding`. 2422 * 2423 * @param { Value } x {number | string | Decimal} 2424 * @param { Value } y {number | string | Decimal} 2425 * @returns { Decimal } the Decimal type 2426 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2427 * 1. Incorrect parameter types; 2428 * 2. Parameter verification failed. 2429 * @static 2430 * @syscap SystemCapability.Utils.Lang 2431 * @crossplatform 2432 * @atomicservice 2433 * @since 18 2434 */ 2435 static sub(x: Value, y: Value): Decimal; 2436 2437 /** 2438 * Return a new Decimal whose value is `x` multiplied by `y`, rounded to `precision` significant 2439 * digits using rounding mode `rounding`. 2440 * 2441 * @param { Value } x {number | string | Decimal} 2442 * @param { Value } y {number | string | Decimal} 2443 * @returns { Decimal } the Decimal type 2444 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2445 * 1. Incorrect parameter types; 2446 * 2. Parameter verification failed. 2447 * @static 2448 * @syscap SystemCapability.Utils.Lang 2449 * @atomicservice 2450 * @since 12 2451 */ 2452 /** 2453 * Return a new Decimal whose value is `x` multiplied by `y`, rounded to `precision` significant 2454 * digits using rounding mode `rounding`. 2455 * 2456 * @param { Value } x {number | string | Decimal} 2457 * @param { Value } y {number | string | Decimal} 2458 * @returns { Decimal } the Decimal type 2459 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2460 * 1. Incorrect parameter types; 2461 * 2. Parameter verification failed. 2462 * @static 2463 * @syscap SystemCapability.Utils.Lang 2464 * @crossplatform 2465 * @atomicservice 2466 * @since 18 2467 */ 2468 static mul(x: Value, y: Value): Decimal; 2469 2470 /** 2471 * Return a new Decimal whose value is `x` divided by `y`, rounded to `precision` significant 2472 * digits using rounding mode `rounding`. 2473 * 2474 * @param { Value } x {number | string | Decimal} 2475 * @param { Value } y {number | string | Decimal} 2476 * @returns { Decimal } the Decimal type 2477 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2478 * 1. Incorrect parameter types; 2479 * 2. Parameter verification failed. 2480 * @static 2481 * @syscap SystemCapability.Utils.Lang 2482 * @atomicservice 2483 * @since 12 2484 */ 2485 /** 2486 * Return a new Decimal whose value is `x` divided by `y`, rounded to `precision` significant 2487 * digits using rounding mode `rounding`. 2488 * 2489 * @param { Value } x {number | string | Decimal} 2490 * @param { Value } y {number | string | Decimal} 2491 * @returns { Decimal } the Decimal type 2492 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2493 * 1. Incorrect parameter types; 2494 * 2. Parameter verification failed. 2495 * @static 2496 * @syscap SystemCapability.Utils.Lang 2497 * @crossplatform 2498 * @atomicservice 2499 * @since 18 2500 */ 2501 static div(x: Value, y: Value): Decimal; 2502 2503 /** 2504 * Return a new Decimal whose value is `x` modulo `y`, rounded to `precision` significant digits 2505 * using rounding mode `rounding`. 2506 * 2507 * @param { Value } x {number | string | Decimal} 2508 * @param { Value } y {number | string | Decimal} 2509 * @returns { Decimal } the Decimal type 2510 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2511 * 1. Incorrect parameter types; 2512 * 2. Parameter verification failed. 2513 * @static 2514 * @syscap SystemCapability.Utils.Lang 2515 * @atomicservice 2516 * @since 12 2517 */ 2518 /** 2519 * Return a new Decimal whose value is `x` modulo `y`, rounded to `precision` significant digits 2520 * using rounding mode `rounding`. 2521 * 2522 * @param { Value } x {number | string | Decimal} 2523 * @param { Value } y {number | string | Decimal} 2524 * @returns { Decimal } the Decimal type 2525 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2526 * 1. Incorrect parameter types; 2527 * 2. Parameter verification failed. 2528 * @static 2529 * @syscap SystemCapability.Utils.Lang 2530 * @crossplatform 2531 * @atomicservice 2532 * @since 18 2533 */ 2534 static mod(x: Value, y: Value): Decimal; 2535 2536 /** 2537 * Return a new Decimal whose value is the square root of `n`, rounded to `precision` significant 2538 * digits using rounding mode `rounding`. 2539 * 2540 * @param { Value } n {number | string | Decimal} 2541 * @returns { Decimal } the Decimal type 2542 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2543 * 1. Incorrect parameter types; 2544 * 2. Parameter verification failed. 2545 * @static 2546 * @syscap SystemCapability.Utils.Lang 2547 * @atomicservice 2548 * @since 12 2549 */ 2550 /** 2551 * Return a new Decimal whose value is the square root of `n`, rounded to `precision` significant 2552 * digits using rounding mode `rounding`. 2553 * 2554 * @param { Value } n {number | string | Decimal} 2555 * @returns { Decimal } the Decimal type 2556 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2557 * 1. Incorrect parameter types; 2558 * 2. Parameter verification failed. 2559 * @static 2560 * @syscap SystemCapability.Utils.Lang 2561 * @crossplatform 2562 * @atomicservice 2563 * @since 18 2564 */ 2565 static sqrt(n: Value): Decimal; 2566 2567 /** 2568 * Return a new Decimal whose value is the cube root of `n`, rounded to `precision` significant 2569 * digits using rounding mode `rounding`. 2570 * 2571 * @param { Value } n {number | string | Decimal} 2572 * @returns { Decimal } the Decimal type 2573 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2574 * 1. Incorrect parameter types; 2575 * 2. Parameter verification failed. 2576 * @static 2577 * @syscap SystemCapability.Utils.Lang 2578 * @atomicservice 2579 * @since 12 2580 */ 2581 /** 2582 * Return a new Decimal whose value is the cube root of `n`, rounded to `precision` significant 2583 * digits using rounding mode `rounding`. 2584 * 2585 * @param { Value } n {number | string | Decimal} 2586 * @returns { Decimal } the Decimal type 2587 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2588 * 1. Incorrect parameter types; 2589 * 2. Parameter verification failed. 2590 * @static 2591 * @syscap SystemCapability.Utils.Lang 2592 * @crossplatform 2593 * @atomicservice 2594 * @since 18 2595 */ 2596 static cbrt(n: Value): Decimal; 2597 2598 /** 2599 * Return a new Decimal whose value is `base` raised to the power `exponent`, rounded to precision 2600 * significant digits using rounding mode `rounding`. 2601 * 2602 * @param { Value } base {number | string | Decimal} The base. 2603 * @param { Value } exponent {number | string | Decimal} The exponent. 2604 * @returns { Decimal } the Decimal type 2605 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2606 * 1. Incorrect parameter types; 2607 * 2. Parameter verification failed. 2608 * @throws { BusinessError } 10200060 - Precision limit exceeded. 2609 * @static 2610 * @syscap SystemCapability.Utils.Lang 2611 * @atomicservice 2612 * @since 12 2613 */ 2614 /** 2615 * Return a new Decimal whose value is `base` raised to the power `exponent`, rounded to precision 2616 * significant digits using rounding mode `rounding`. 2617 * 2618 * @param { Value } base {number | string | Decimal} The base. 2619 * @param { Value } exponent {number | string | Decimal} The exponent. 2620 * @returns { Decimal } the Decimal type 2621 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2622 * 1. Incorrect parameter types; 2623 * 2. Parameter verification failed. 2624 * @throws { BusinessError } 10200060 - Precision limit exceeded. 2625 * @static 2626 * @syscap SystemCapability.Utils.Lang 2627 * @crossplatform 2628 * @atomicservice 2629 * @since 18 2630 */ 2631 static pow(base: Value, exponent: Value): Decimal; 2632 2633 /** 2634 * Return a new Decimal whose value is the natural exponential of `n`, rounded to `precision` 2635 * significant digits using rounding mode `rounding`. 2636 * 2637 * @param { Value } n {number | string | Decimal} 2638 * @returns { Decimal } the Decimal type 2639 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2640 * 1. Incorrect parameter types; 2641 * 2. Parameter verification failed. 2642 * @throws { BusinessError } 10200060 - Precision limit exceeded. 2643 * @static 2644 * @syscap SystemCapability.Utils.Lang 2645 * @atomicservice 2646 * @since 12 2647 */ 2648 /** 2649 * Return a new Decimal whose value is the natural exponential of `n`, rounded to `precision` 2650 * significant digits using rounding mode `rounding`. 2651 * 2652 * @param { Value } n {number | string | Decimal} 2653 * @returns { Decimal } the Decimal type 2654 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2655 * 1. Incorrect parameter types; 2656 * 2. Parameter verification failed. 2657 * @throws { BusinessError } 10200060 - Precision limit exceeded. 2658 * @static 2659 * @syscap SystemCapability.Utils.Lang 2660 * @crossplatform 2661 * @atomicservice 2662 * @since 18 2663 */ 2664 static exp(n: Value): Decimal; 2665 2666 /** 2667 * Return a new Decimal whose value is the log of `n` to the base `base`, rounded to `precision` 2668 * significant digits using rounding mode `rounding`. 2669 * 2670 * @param { Value } n {number | string | Decimal} 2671 * @param { Value } base {number | string | Decimal} 2672 * @returns { Decimal } the Decimal type 2673 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2674 * 1. Incorrect parameter types; 2675 * 2. Parameter verification failed. 2676 * @throws { BusinessError } 10200060 - Precision limit exceeded. 2677 * @static 2678 * @syscap SystemCapability.Utils.Lang 2679 * @atomicservice 2680 * @since 12 2681 */ 2682 /** 2683 * Return a new Decimal whose value is the log of `n` to the base `base`, rounded to `precision` 2684 * significant digits using rounding mode `rounding`. 2685 * 2686 * @param { Value } n {number | string | Decimal} 2687 * @param { Value } base {number | string | Decimal} 2688 * @returns { Decimal } the Decimal type 2689 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2690 * 1. Incorrect parameter types; 2691 * 2. Parameter verification failed. 2692 * @throws { BusinessError } 10200060 - Precision limit exceeded. 2693 * @static 2694 * @syscap SystemCapability.Utils.Lang 2695 * @crossplatform 2696 * @atomicservice 2697 * @since 18 2698 */ 2699 static log(n: Value, base: Value): Decimal; 2700 2701 /** 2702 * Return a new Decimal whose value is the natural logarithm of `n`, rounded to `precision` 2703 * significant digits using rounding mode `rounding`. 2704 * 2705 * @param { Value } n {number | string | Decimal} 2706 * @returns { Decimal } the Decimal type 2707 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2708 * 1. Incorrect parameter types; 2709 * 2. Parameter verification failed. 2710 * @throws { BusinessError } 10200060 - Precision limit exceeded. 2711 * @static 2712 * @syscap SystemCapability.Utils.Lang 2713 * @atomicservice 2714 * @since 12 2715 */ 2716 /** 2717 * Return a new Decimal whose value is the natural logarithm of `n`, rounded to `precision` 2718 * significant digits using rounding mode `rounding`. 2719 * 2720 * @param { Value } n {number | string | Decimal} 2721 * @returns { Decimal } the Decimal type 2722 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2723 * 1. Incorrect parameter types; 2724 * 2. Parameter verification failed. 2725 * @throws { BusinessError } 10200060 - Precision limit exceeded. 2726 * @static 2727 * @syscap SystemCapability.Utils.Lang 2728 * @crossplatform 2729 * @atomicservice 2730 * @since 18 2731 */ 2732 static ln(n: Value): Decimal; 2733 2734 /** 2735 * Return a new Decimal whose value is the base 2 logarithm of `n`, rounded to `precision` 2736 * significant digits using rounding mode `rounding`. 2737 * 2738 * @param { Value } n {number | string | Decimal} 2739 * @returns { Decimal } the Decimal type 2740 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2741 * 1. Incorrect parameter types; 2742 * 2. Parameter verification failed. 2743 * @throws { BusinessError } 10200060 - Precision limit exceeded. 2744 * @static 2745 * @syscap SystemCapability.Utils.Lang 2746 * @atomicservice 2747 * @since 12 2748 */ 2749 /** 2750 * Return a new Decimal whose value is the base 2 logarithm of `n`, rounded to `precision` 2751 * significant digits using rounding mode `rounding`. 2752 * 2753 * @param { Value } n {number | string | Decimal} 2754 * @returns { Decimal } the Decimal type 2755 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2756 * 1. Incorrect parameter types; 2757 * 2. Parameter verification failed. 2758 * @throws { BusinessError } 10200060 - Precision limit exceeded. 2759 * @static 2760 * @syscap SystemCapability.Utils.Lang 2761 * @crossplatform 2762 * @atomicservice 2763 * @since 18 2764 */ 2765 static log2(n: Value): Decimal; 2766 2767 /** 2768 * Return a new Decimal whose value is the base 10 logarithm of `n`, rounded to `precision` 2769 * significant digits using rounding mode `rounding`. 2770 * 2771 * @param { Value } n {number | string | Decimal} 2772 * @returns { Decimal } the Decimal type 2773 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2774 * 1. Incorrect parameter types; 2775 * 2. Parameter verification failed. 2776 * @throws { BusinessError } 10200060 - Precision limit exceeded. 2777 * @static 2778 * @syscap SystemCapability.Utils.Lang 2779 * @atomicservice 2780 * @since 12 2781 */ 2782 /** 2783 * Return a new Decimal whose value is the base 10 logarithm of `n`, rounded to `precision` 2784 * significant digits using rounding mode `rounding`. 2785 * 2786 * @param { Value } n {number | string | Decimal} 2787 * @returns { Decimal } the Decimal type 2788 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2789 * 1. Incorrect parameter types; 2790 * 2. Parameter verification failed. 2791 * @throws { BusinessError } 10200060 - Precision limit exceeded. 2792 * @static 2793 * @syscap SystemCapability.Utils.Lang 2794 * @crossplatform 2795 * @atomicservice 2796 * @since 18 2797 */ 2798 static log10(n: Value): Decimal; 2799 2800 /** 2801 * Return a new Decimal whose value is the cosine of `n`, rounded to `precision` significant 2802 * digits using rounding mode `rounding` 2803 * 2804 * @param { Value } n {number | string | Decimal} A value in radians. 2805 * @returns { Decimal } the Decimal type 2806 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2807 * 1. Incorrect parameter types; 2808 * 2. Parameter verification failed. 2809 * @static 2810 * @syscap SystemCapability.Utils.Lang 2811 * @atomicservice 2812 * @since 12 2813 */ 2814 /** 2815 * Return a new Decimal whose value is the cosine of `n`, rounded to `precision` significant 2816 * digits using rounding mode `rounding` 2817 * 2818 * @param { Value } n {number | string | Decimal} A value in radians. 2819 * @returns { Decimal } the Decimal type 2820 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2821 * 1. Incorrect parameter types; 2822 * 2. Parameter verification failed. 2823 * @static 2824 * @syscap SystemCapability.Utils.Lang 2825 * @crossplatform 2826 * @atomicservice 2827 * @since 18 2828 */ 2829 static cos(n: Value): Decimal; 2830 2831 /** 2832 * Return a new Decimal whose value is the sine of `n`, rounded to `precision` significant digits 2833 * using rounding mode `rounding`. 2834 * 2835 * @param { Value } n {number | string | Decimal} A value in radians. 2836 * @returns { Decimal } the Decimal type 2837 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2838 * 1. Incorrect parameter types; 2839 * 2. Parameter verification failed. 2840 * @static 2841 * @syscap SystemCapability.Utils.Lang 2842 * @atomicservice 2843 * @since 12 2844 */ 2845 /** 2846 * Return a new Decimal whose value is the sine of `n`, rounded to `precision` significant digits 2847 * using rounding mode `rounding`. 2848 * 2849 * @param { Value } n {number | string | Decimal} A value in radians. 2850 * @returns { Decimal } the Decimal type 2851 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2852 * 1. Incorrect parameter types; 2853 * 2. Parameter verification failed. 2854 * @static 2855 * @syscap SystemCapability.Utils.Lang 2856 * @crossplatform 2857 * @atomicservice 2858 * @since 18 2859 */ 2860 static sin(n: Value): Decimal; 2861 2862 /** 2863 * Return a new Decimal whose value is the tangent of `n`, rounded to `precision` significant 2864 * digits using rounding mode `rounding`. 2865 * 2866 * @param { Value } n {number | string | Decimal} A value in radians. 2867 * @returns { Decimal } the Decimal type 2868 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2869 * 1. Incorrect parameter types; 2870 * 2. Parameter verification failed. 2871 * @static 2872 * @syscap SystemCapability.Utils.Lang 2873 * @atomicservice 2874 * @since 12 2875 */ 2876 /** 2877 * Return a new Decimal whose value is the tangent of `n`, rounded to `precision` significant 2878 * digits using rounding mode `rounding`. 2879 * 2880 * @param { Value } n {number | string | Decimal} A value in radians. 2881 * @returns { Decimal } the Decimal type 2882 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2883 * 1. Incorrect parameter types; 2884 * 2. Parameter verification failed. 2885 * @static 2886 * @syscap SystemCapability.Utils.Lang 2887 * @crossplatform 2888 * @atomicservice 2889 * @since 18 2890 */ 2891 static tan(n: Value): Decimal; 2892 2893 /** 2894 * Return a new Decimal whose value is the hyperbolic cosine of `n`, rounded to precision 2895 * significant digits using rounding mode `rounding`. 2896 * 2897 * @param { Value } n {number | string | Decimal} A value in radians. 2898 * @returns { Decimal } the Decimal type 2899 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2900 * 1. Incorrect parameter types; 2901 * 2. Parameter verification failed. 2902 * @static 2903 * @syscap SystemCapability.Utils.Lang 2904 * @atomicservice 2905 * @since 12 2906 */ 2907 /** 2908 * Return a new Decimal whose value is the hyperbolic cosine of `n`, rounded to precision 2909 * significant digits using rounding mode `rounding`. 2910 * 2911 * @param { Value } n {number | string | Decimal} A value in radians. 2912 * @returns { Decimal } the Decimal type 2913 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2914 * 1. Incorrect parameter types; 2915 * 2. Parameter verification failed. 2916 * @static 2917 * @syscap SystemCapability.Utils.Lang 2918 * @crossplatform 2919 * @atomicservice 2920 * @since 18 2921 */ 2922 static cosh(n: Value): Decimal; 2923 2924 /** 2925 * Return a new Decimal whose value is the hyperbolic sine of `n`, rounded to `precision` 2926 * significant digits using rounding mode `rounding`. 2927 * 2928 * @param { Value } n {number | string | Decimal} 2929 * @returns { Decimal } the Decimal type 2930 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2931 * 1. Incorrect parameter types; 2932 * 2. Parameter verification failed. 2933 * @static 2934 * @syscap SystemCapability.Utils.Lang 2935 * @atomicservice 2936 * @since 12 2937 */ 2938 /** 2939 * Return a new Decimal whose value is the hyperbolic sine of `n`, rounded to `precision` 2940 * significant digits using rounding mode `rounding`. 2941 * 2942 * @param { Value } n {number | string | Decimal} 2943 * @returns { Decimal } the Decimal type 2944 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2945 * 1. Incorrect parameter types; 2946 * 2. Parameter verification failed. 2947 * @static 2948 * @syscap SystemCapability.Utils.Lang 2949 * @crossplatform 2950 * @atomicservice 2951 * @since 18 2952 */ 2953 static sinh(n: Value): Decimal; 2954 2955 /** 2956 * Return a new Decimal whose value is the hyperbolic tangent of `n`, rounded to `precision` 2957 * significant digits using rounding mode `rounding`. 2958 * 2959 * @param { Value } n {number | string | Decimal} A value in radians. 2960 * @returns { Decimal } the Decimal type 2961 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2962 * 1. Incorrect parameter types; 2963 * 2. Parameter verification failed. 2964 * @static 2965 * @syscap SystemCapability.Utils.Lang 2966 * @atomicservice 2967 * @since 12 2968 */ 2969 /** 2970 * Return a new Decimal whose value is the hyperbolic tangent of `n`, rounded to `precision` 2971 * significant digits using rounding mode `rounding`. 2972 * 2973 * @param { Value } n {number | string | Decimal} A value in radians. 2974 * @returns { Decimal } the Decimal type 2975 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2976 * 1. Incorrect parameter types; 2977 * 2. Parameter verification failed. 2978 * @static 2979 * @syscap SystemCapability.Utils.Lang 2980 * @crossplatform 2981 * @atomicservice 2982 * @since 18 2983 */ 2984 static tanh(n: Value): Decimal; 2985 2986 /** 2987 * Return a new Decimal whose value is the arccosine in radians of `n`. 2988 * 2989 * @param { Value } n {number | string | Decimal} 2990 * @returns { Decimal } the Decimal type 2991 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2992 * 1. Incorrect parameter types; 2993 * 2. Parameter verification failed. 2994 * @throws { BusinessError } 10200060 - Precision limit exceeded. 2995 * @static 2996 * @syscap SystemCapability.Utils.Lang 2997 * @atomicservice 2998 * @since 12 2999 */ 3000 /** 3001 * Return a new Decimal whose value is the arccosine in radians of `n`. 3002 * 3003 * @param { Value } n {number | string | Decimal} 3004 * @returns { Decimal } the Decimal type 3005 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3006 * 1. Incorrect parameter types; 3007 * 2. Parameter verification failed. 3008 * @throws { BusinessError } 10200060 - Precision limit exceeded. 3009 * @static 3010 * @syscap SystemCapability.Utils.Lang 3011 * @crossplatform 3012 * @atomicservice 3013 * @since 18 3014 */ 3015 static acos(n: Value): Decimal; 3016 3017 /** 3018 * Return a new Decimal whose value is the arcsine in radians of `n`, rounded to `precision` 3019 * significant digits using rounding mode `rounding`. 3020 * 3021 * @param { Value } n {number | string | Decimal} 3022 * @returns { Decimal } the Decimal type 3023 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3024 * 1. Incorrect parameter types; 3025 * 2. Parameter verification failed. 3026 * @throws { BusinessError } 10200060 - Precision limit exceeded. 3027 * @static 3028 * @syscap SystemCapability.Utils.Lang 3029 * @atomicservice 3030 * @since 12 3031 */ 3032 /** 3033 * Return a new Decimal whose value is the arcsine in radians of `n`, rounded to `precision` 3034 * significant digits using rounding mode `rounding`. 3035 * 3036 * @param { Value } n {number | string | Decimal} 3037 * @returns { Decimal } the Decimal type 3038 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3039 * 1. Incorrect parameter types; 3040 * 2. Parameter verification failed. 3041 * @throws { BusinessError } 10200060 - Precision limit exceeded. 3042 * @static 3043 * @syscap SystemCapability.Utils.Lang 3044 * @crossplatform 3045 * @atomicservice 3046 * @since 18 3047 */ 3048 static asin(n: Value): Decimal; 3049 3050 /** 3051 * Return a new Decimal whose value is the arctangent in radians of `n`, rounded to `precision` 3052 * significant digits using rounding mode `rounding`. 3053 * 3054 * @param { Value } n {number | string | Decimal} 3055 * @returns { Decimal } the Decimal type 3056 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3057 * 1. Incorrect parameter types; 3058 * 2. Parameter verification failed. 3059 * @throws { BusinessError } 10200060 - Precision limit exceeded. 3060 * @static 3061 * @syscap SystemCapability.Utils.Lang 3062 * @atomicservice 3063 * @since 12 3064 */ 3065 /** 3066 * Return a new Decimal whose value is the arctangent in radians of `n`, rounded to `precision` 3067 * significant digits using rounding mode `rounding`. 3068 * 3069 * @param { Value } n {number | string | Decimal} 3070 * @returns { Decimal } the Decimal type 3071 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3072 * 1. Incorrect parameter types; 3073 * 2. Parameter verification failed. 3074 * @throws { BusinessError } 10200060 - Precision limit exceeded. 3075 * @static 3076 * @syscap SystemCapability.Utils.Lang 3077 * @crossplatform 3078 * @atomicservice 3079 * @since 18 3080 */ 3081 static atan(n: Value): Decimal; 3082 3083 /** 3084 * Return a new Decimal whose value is the inverse of the hyperbolic cosine of `n`, rounded to 3085 * `precision` significant digits using rounding mode `rounding`. 3086 * 3087 * @param { Value } n {number | string | Decimal} 3088 * @returns { Decimal } the Decimal type 3089 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3090 * 1. Incorrect parameter types; 3091 * 2. Parameter verification failed. 3092 * @throws { BusinessError } 10200060 - Precision limit exceeded. 3093 * @static 3094 * @syscap SystemCapability.Utils.Lang 3095 * @atomicservice 3096 * @since 12 3097 */ 3098 /** 3099 * Return a new Decimal whose value is the inverse of the hyperbolic cosine of `n`, rounded to 3100 * `precision` significant digits using rounding mode `rounding`. 3101 * 3102 * @param { Value } n {number | string | Decimal} 3103 * @returns { Decimal } the Decimal type 3104 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3105 * 1. Incorrect parameter types; 3106 * 2. Parameter verification failed. 3107 * @throws { BusinessError } 10200060 - Precision limit exceeded. 3108 * @static 3109 * @syscap SystemCapability.Utils.Lang 3110 * @crossplatform 3111 * @atomicservice 3112 * @since 18 3113 */ 3114 static acosh(n: Value): Decimal; 3115 3116 /** 3117 * Return a new Decimal whose value is the inverse of the hyperbolic sine of `n`, rounded to 3118 * `precision` significant digits using rounding mode `rounding`. 3119 * 3120 * @param { Value } n {number | string | Decimal} A value in radians. 3121 * @returns { Decimal } the Decimal type 3122 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3123 * 1. Incorrect parameter types; 3124 * 2. Parameter verification failed. 3125 * @throws { BusinessError } 10200060 - Precision limit exceeded. 3126 * @static 3127 * @syscap SystemCapability.Utils.Lang 3128 * @atomicservice 3129 * @since 12 3130 */ 3131 /** 3132 * Return a new Decimal whose value is the inverse of the hyperbolic sine of `n`, rounded to 3133 * `precision` significant digits using rounding mode `rounding`. 3134 * 3135 * @param { Value } n {number | string | Decimal} A value in radians. 3136 * @returns { Decimal } the Decimal type 3137 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3138 * 1. Incorrect parameter types; 3139 * 2. Parameter verification failed. 3140 * @throws { BusinessError } 10200060 - Precision limit exceeded. 3141 * @static 3142 * @syscap SystemCapability.Utils.Lang 3143 * @crossplatform 3144 * @atomicservice 3145 * @since 18 3146 */ 3147 static asinh(n: Value): Decimal; 3148 3149 /** 3150 * Return a new Decimal whose value is the inverse of the hyperbolic tangent of `n`, rounded to 3151 * `precision` significant digits using rounding mode `rounding`. 3152 * 3153 * @param { Value } n {number | string | Decimal} A value in radians. 3154 * @returns { Decimal } the Decimal type 3155 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3156 * 1. Incorrect parameter types; 3157 * 2. Parameter verification failed. 3158 * @throws { BusinessError } 10200060 - Precision limit exceeded. 3159 * @static 3160 * @syscap SystemCapability.Utils.Lang 3161 * @atomicservice 3162 * @since 12 3163 */ 3164 /** 3165 * Return a new Decimal whose value is the inverse of the hyperbolic tangent of `n`, rounded to 3166 * `precision` significant digits using rounding mode `rounding`. 3167 * 3168 * @param { Value } n {number | string | Decimal} A value in radians. 3169 * @returns { Decimal } the Decimal type 3170 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3171 * 1. Incorrect parameter types; 3172 * 2. Parameter verification failed. 3173 * @throws { BusinessError } 10200060 - Precision limit exceeded. 3174 * @static 3175 * @syscap SystemCapability.Utils.Lang 3176 * @crossplatform 3177 * @atomicservice 3178 * @since 18 3179 */ 3180 static atanh(n: Value): Decimal; 3181 3182 /** 3183 * Return a new Decimal whose value is the arctangent in radians of `y/x` in the range -pi to pi 3184 * (inclusive), rounded to `precision` significant digits using rounding mode `rounding`. 3185 * 3186 * @param { Value } y {number | string | Decimal} The y-coordinate. 3187 * @param { Value } x {number | string | Decimal} The x-coordinate. 3188 * @returns { Decimal } the Decimal type 3189 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3190 * 1. Incorrect parameter types; 3191 * 2. Parameter verification failed. 3192 * @throws { BusinessError } 10200060 - Precision limit exceeded. 3193 * @static 3194 * @syscap SystemCapability.Utils.Lang 3195 * @atomicservice 3196 * @since 12 3197 */ 3198 /** 3199 * Return a new Decimal whose value is the arctangent in radians of `y/x` in the range -pi to pi 3200 * (inclusive), rounded to `precision` significant digits using rounding mode `rounding`. 3201 * 3202 * @param { Value } y {number | string | Decimal} The y-coordinate. 3203 * @param { Value } x {number | string | Decimal} The x-coordinate. 3204 * @returns { Decimal } the Decimal type 3205 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3206 * 1. Incorrect parameter types; 3207 * 2. Parameter verification failed. 3208 * @throws { BusinessError } 10200060 - Precision limit exceeded. 3209 * @static 3210 * @syscap SystemCapability.Utils.Lang 3211 * @crossplatform 3212 * @atomicservice 3213 * @since 18 3214 */ 3215 static atan2(y: Value, x: Value): Decimal; 3216 3217 /** 3218 * Return a new Decimal whose value is the square root of the sum of the squares of the arguments, 3219 * rounded to `precision` significant digits using rounding mode `rounding`. 3220 * 3221 * @param { Value[] } n {number | string | Decimal} Decimal 3222 * @returns { Decimal } the Decimal type 3223 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3224 * 1. Incorrect parameter types; 3225 * 2. Parameter verification failed. 3226 * @static 3227 * @syscap SystemCapability.Utils.Lang 3228 * @atomicservice 3229 * @since 12 3230 */ 3231 /** 3232 * Return a new Decimal whose value is the square root of the sum of the squares of the arguments, 3233 * rounded to `precision` significant digits using rounding mode `rounding`. 3234 * 3235 * @param { Value[] } n {number | string | Decimal} Decimal 3236 * @returns { Decimal } the Decimal type 3237 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3238 * 1. Incorrect parameter types; 3239 * 2. Parameter verification failed. 3240 * @static 3241 * @syscap SystemCapability.Utils.Lang 3242 * @crossplatform 3243 * @atomicservice 3244 * @since 18 3245 */ 3246 static hypot(...n: Value[]): Decimal; 3247 3248 /** 3249 * Return a new Decimal whose value is the maximum of the arguments. 3250 * 3251 * @param { Value[] } n {number | string | Decimal} 3252 * @returns { Decimal } the Decimal type 3253 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3254 * 1. Incorrect parameter types; 3255 * 2. Parameter verification failed. 3256 * @static 3257 * @syscap SystemCapability.Utils.Lang 3258 * @atomicservice 3259 * @since 12 3260 */ 3261 /** 3262 * Return a new Decimal whose value is the maximum of the arguments. 3263 * 3264 * @param { Value[] } n {number | string | Decimal} 3265 * @returns { Decimal } the Decimal type 3266 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3267 * 1. Incorrect parameter types; 3268 * 2. Parameter verification failed. 3269 * @static 3270 * @syscap SystemCapability.Utils.Lang 3271 * @crossplatform 3272 * @atomicservice 3273 * @since 18 3274 */ 3275 static max(...n: Value[]): Decimal; 3276 3277 /** 3278 * Return a new Decimal whose value is the minimum of the arguments. 3279 * 3280 * @param { Value[] } n {number | string | Decimal} 3281 * @returns { Decimal } the Decimal type 3282 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3283 * 1. Incorrect parameter types; 3284 * 2. Parameter verification failed. 3285 * @static 3286 * @syscap SystemCapability.Utils.Lang 3287 * @atomicservice 3288 * @since 12 3289 */ 3290 /** 3291 * Return a new Decimal whose value is the minimum of the arguments. 3292 * 3293 * @param { Value[] } n {number | string | Decimal} 3294 * @returns { Decimal } the Decimal type 3295 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3296 * 1. Incorrect parameter types; 3297 * 2. Parameter verification failed. 3298 * @static 3299 * @syscap SystemCapability.Utils.Lang 3300 * @crossplatform 3301 * @atomicservice 3302 * @since 18 3303 */ 3304 static min(...n: Value[]): Decimal; 3305 3306 /** 3307 * Returns a new Decimal with a random value equal to or greater than 0 and less than 1. 3308 * 3309 * @returns { Decimal } the Decimal type 3310 * @throws { BusinessError } 10200061 - Crypto unavailable 3311 * @static 3312 * @syscap SystemCapability.Utils.Lang 3313 * @atomicservice 3314 * @since 12 3315 */ 3316 /** 3317 * Returns a new Decimal with a random value equal to or greater than 0 and less than 1. 3318 * 3319 * @returns { Decimal } the Decimal type 3320 * @throws { BusinessError } 10200061 - Crypto unavailable 3321 * @static 3322 * @syscap SystemCapability.Utils.Lang 3323 * @crossplatform 3324 * @atomicservice 3325 * @since 18 3326 */ 3327 static random(): Decimal; 3328 3329 /** 3330 * Returns a new Decimal with a random value equal to or greater than 0 and less than 1, and with 3331 * `significantDigits` significant digits (or less if trailing zeros are produced). 3332 * 3333 * @param { Value } significantDigits {number} Significant digits. Integer, 0 to MAX_DIGITS inclusive. 3334 * @returns { Decimal } the Decimal type 3335 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3336 * 1. Incorrect parameter types; 3337 * 2. Parameter verification failed. 3338 * @throws { BusinessError } 10200061 - Crypto unavailable 3339 * @static 3340 * @syscap SystemCapability.Utils.Lang 3341 * @atomicservice 3342 * @since 12 3343 */ 3344 /** 3345 * Returns a new Decimal with a random value equal to or greater than 0 and less than 1, and with 3346 * `significantDigits` significant digits (or less if trailing zeros are produced). 3347 * 3348 * @param { Value } significantDigits {number} Significant digits. Integer, 0 to MAX_DIGITS inclusive. 3349 * @returns { Decimal } the Decimal type 3350 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3351 * 1. Incorrect parameter types; 3352 * 2. Parameter verification failed. 3353 * @throws { BusinessError } 10200061 - Crypto unavailable 3354 * @static 3355 * @syscap SystemCapability.Utils.Lang 3356 * @crossplatform 3357 * @atomicservice 3358 * @since 18 3359 */ 3360 static random(significantDigits: number): Decimal; 3361 3362 /** 3363 * Return the sign of the passed value to the method. 3364 * 1 if x > 0, 3365 * -1 if x < 0, 3366 * 0 if x is 0, 3367 * -0 if x is -0, 3368 * NaN otherwise 3369 * 3370 * @param { Value } n {number | string | Decimal} 3371 * @returns { Decimal } the Decimal type 3372 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3373 * 1. Incorrect parameter types; 3374 * 2. Parameter verification failed. 3375 * @static 3376 * @syscap SystemCapability.Utils.Lang 3377 * @atomicservice 3378 * @since 12 3379 */ 3380 /** 3381 * Return the sign of the passed value to the method. 3382 * 1 if x > 0, 3383 * -1 if x < 0, 3384 * 0 if x is 0, 3385 * -0 if x is -0, 3386 * NaN otherwise 3387 * 3388 * @param { Value } n {number | string | Decimal} 3389 * @returns { Decimal } the Decimal type 3390 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3391 * 1. Incorrect parameter types; 3392 * 2. Parameter verification failed. 3393 * @static 3394 * @syscap SystemCapability.Utils.Lang 3395 * @crossplatform 3396 * @atomicservice 3397 * @since 18 3398 */ 3399 static sign(n: Value): number; 3400 3401 /** 3402 * Return a new Decimal whose value is `n` rounded to an integer using rounding mode `rounding`. 3403 * 3404 * @param { Value } n {number | string | Decimal} 3405 * @returns { Decimal } the Decimal type 3406 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3407 * 1. Incorrect parameter types; 3408 * 2. Parameter verification failed. 3409 * @static 3410 * @syscap SystemCapability.Utils.Lang 3411 * @atomicservice 3412 * @since 12 3413 */ 3414 /** 3415 * Return a new Decimal whose value is `n` rounded to an integer using rounding mode `rounding`. 3416 * 3417 * @param { Value } n {number | string | Decimal} 3418 * @returns { Decimal } the Decimal type 3419 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3420 * 1. Incorrect parameter types; 3421 * 2. Parameter verification failed. 3422 * @static 3423 * @syscap SystemCapability.Utils.Lang 3424 * @crossplatform 3425 * @atomicservice 3426 * @since 18 3427 */ 3428 static round(n: Value): Decimal; 3429 3430 /** 3431 * Configures the 'global' settings for this particular Decimal constructor. 3432 * 3433 * @param { DecimalConfig } An object with one or more of the following properties, 3434 * precision {number} 3435 * rounding {number} 3436 * toExpNeg {number} 3437 * toExpPos {number} 3438 * maxE {number} 3439 * minE {number} 3440 * modulo {number} 3441 * crypto {boolean|number} 3442 * defaults {true} 3443 * @returns { void } 3444 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3445 * 1. Incorrect parameter types; 3446 * 2. Parameter verification failed. 3447 * @throws { BusinessError } 10200001 - The value of `DecimalConfig.properties` is out of range. 3448 * @throws { BusinessError } 10200061 - Crypto unavailable 3449 * @static 3450 * @syscap SystemCapability.Utils.Lang 3451 * @atomicservice 3452 * @since 12 3453 */ 3454 /** 3455 * Configures the 'global' settings for this particular Decimal constructor. 3456 * 3457 * @param { DecimalConfig } An object with one or more of the following properties, 3458 * precision {number} 3459 * rounding {number} 3460 * toExpNeg {number} 3461 * toExpPos {number} 3462 * maxE {number} 3463 * minE {number} 3464 * modulo {number} 3465 * crypto {boolean|number} 3466 * defaults {true} 3467 * @returns { void } 3468 * @throws { BusinessError } 401 - Parameter error. Possible causes: 3469 * 1. Incorrect parameter types; 3470 * 2. Parameter verification failed. 3471 * @throws { BusinessError } 10200001 - The value of `DecimalConfig.properties` is out of range. 3472 * @throws { BusinessError } 10200061 - Crypto unavailable 3473 * @static 3474 * @syscap SystemCapability.Utils.Lang 3475 * @crossplatform 3476 * @atomicservice 3477 * @since 18 3478 */ 3479 static set(config: DecimalConfig): void; 3480 3481 /** 3482 * Rounds away from zero 3483 * 3484 * @readonly 3485 * @static 3486 * @syscap SystemCapability.Utils.Lang 3487 * @atomicservice 3488 * @since 12 3489 */ 3490 /** 3491 * Rounds away from zero 3492 * 3493 * @readonly 3494 * @static 3495 * @syscap SystemCapability.Utils.Lang 3496 * @crossplatform 3497 * @atomicservice 3498 * @since 18 3499 */ 3500 static readonly ROUND_UP : 0; 3501 3502 /** 3503 * Rounds towards zero 3504 * 3505 * @readonly 3506 * @static 3507 * @syscap SystemCapability.Utils.Lang 3508 * @atomicservice 3509 * @since 12 3510 */ 3511 /** 3512 * Rounds towards zero 3513 * 3514 * @readonly 3515 * @static 3516 * @syscap SystemCapability.Utils.Lang 3517 * @crossplatform 3518 * @atomicservice 3519 * @since 18 3520 */ 3521 static readonly ROUND_DOWN : 1; 3522 3523 /** 3524 * Rounds towards Infinity 3525 * 3526 * @readonly 3527 * @static 3528 * @syscap SystemCapability.Utils.Lang 3529 * @atomicservice 3530 * @since 12 3531 */ 3532 /** 3533 * Rounds towards Infinity 3534 * 3535 * @readonly 3536 * @static 3537 * @syscap SystemCapability.Utils.Lang 3538 * @crossplatform 3539 * @atomicservice 3540 * @since 18 3541 */ 3542 static readonly ROUND_CEILING : 2; 3543 3544 /** 3545 * Rounds towards -Infinity 3546 * 3547 * @readonly 3548 * @static 3549 * @syscap SystemCapability.Utils.Lang 3550 * @atomicservice 3551 * @since 12 3552 */ 3553 /** 3554 * Rounds towards -Infinity 3555 * 3556 * @readonly 3557 * @static 3558 * @syscap SystemCapability.Utils.Lang 3559 * @crossplatform 3560 * @atomicservice 3561 * @since 18 3562 */ 3563 static readonly ROUND_FLOOR : 3; 3564 3565 /** 3566 * Rounds towards nearest neighbour. If equidistant, rounds away from zero 3567 * 3568 * @readonly 3569 * @static 3570 * @syscap SystemCapability.Utils.Lang 3571 * @atomicservice 3572 * @since 12 3573 */ 3574 /** 3575 * Rounds towards nearest neighbour. If equidistant, rounds away from zero 3576 * 3577 * @readonly 3578 * @static 3579 * @syscap SystemCapability.Utils.Lang 3580 * @crossplatform 3581 * @atomicservice 3582 * @since 18 3583 */ 3584 static readonly ROUND_HALF_UP : 4; 3585 3586 /** 3587 * Rounds towards nearest neighbour. If equidistant, rounds towards zero 3588 * 3589 * @readonly 3590 * @static 3591 * @syscap SystemCapability.Utils.Lang 3592 * @atomicservice 3593 * @since 12 3594 */ 3595 /** 3596 * Rounds towards nearest neighbour. If equidistant, rounds towards zero 3597 * 3598 * @readonly 3599 * @static 3600 * @syscap SystemCapability.Utils.Lang 3601 * @crossplatform 3602 * @atomicservice 3603 * @since 18 3604 */ 3605 static readonly ROUND_HALF_DOWN : 5; 3606 3607 /** 3608 * Rounds towards nearest neighbour. If equidistant, rounds towards even neighbour 3609 * 3610 * @readonly 3611 * @static 3612 * @syscap SystemCapability.Utils.Lang 3613 * @atomicservice 3614 * @since 12 3615 */ 3616 /** 3617 * Rounds towards nearest neighbour. If equidistant, rounds towards even neighbour 3618 * 3619 * @readonly 3620 * @static 3621 * @syscap SystemCapability.Utils.Lang 3622 * @crossplatform 3623 * @atomicservice 3624 * @since 18 3625 */ 3626 static readonly ROUND_HALF_EVEN : 6; 3627 3628 /** 3629 * Rounds towards nearest neighbour. If equidistant, rounds towards Infinity 3630 * 3631 * @readonly 3632 * @static 3633 * @syscap SystemCapability.Utils.Lang 3634 * @atomicservice 3635 * @since 12 3636 */ 3637 /** 3638 * Rounds towards nearest neighbour. If equidistant, rounds towards Infinity 3639 * 3640 * @readonly 3641 * @static 3642 * @syscap SystemCapability.Utils.Lang 3643 * @crossplatform 3644 * @atomicservice 3645 * @since 18 3646 */ 3647 static readonly ROUND_HALF_CEILING : 7; 3648 3649 /** 3650 * Rounds towards nearest neighbour. If equidistant, rounds towards -Infinity 3651 * 3652 * @readonly 3653 * @static 3654 * @syscap SystemCapability.Utils.Lang 3655 * @atomicservice 3656 * @since 12 3657 */ 3658 /** 3659 * Rounds towards nearest neighbour. If equidistant, rounds towards -Infinity 3660 * 3661 * @readonly 3662 * @static 3663 * @syscap SystemCapability.Utils.Lang 3664 * @crossplatform 3665 * @atomicservice 3666 * @since 18 3667 */ 3668 static readonly ROUND_HALF_FLOOR : 8; 3669 3670 /** 3671 * Not a rounding mode, see modulo 3672 * 3673 * @readonly 3674 * @static 3675 * @syscap SystemCapability.Utils.Lang 3676 * @atomicservice 3677 * @since 12 3678 */ 3679 /** 3680 * Not a rounding mode, see modulo 3681 * 3682 * @readonly 3683 * @static 3684 * @syscap SystemCapability.Utils.Lang 3685 * @crossplatform 3686 * @atomicservice 3687 * @since 18 3688 */ 3689 static readonly EUCLIDEAN : 9; 3690} 3691export default Decimal; 3692