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