Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  1. // Type definitions for decimal.js >=7.0.0
  2. // Project: https://github.com/MikeMcl/decimal.js
  3. // Definitions by: Michael Mclaughlin <https://github.com/MikeMcl>
  4. // Definitions: https://github.com/MikeMcl/decimal.js
  5. //
  6. // Documentation: http://mikemcl.github.io/decimal.js/
  7. //
  8. // Exports:
  9. //
  10. // class Decimal (default export)
  11. // type Decimal.Constructor
  12. // type Decimal.Instance
  13. // type Decimal.Modulo
  14. // type Decimal.Rounding
  15. // type Decimal.Value
  16. // interface Decimal.Config
  17. //
  18. // Example (alternative syntax commented-out):
  19. //
  20. // import {Decimal} from "decimal.js"
  21. // //import Decimal from "decimal.js"
  22. //
  23. // let r: Decimal.Rounding = Decimal.ROUND_UP;
  24. // let c: Decimal.Configuration = {precision: 4, rounding: r};
  25. // Decimal.set(c);
  26. // let v: Decimal.Value = '12345.6789';
  27. // let d: Decimal = new Decimal(v);
  28. // //let d: Decimal.Instance = new Decimal(v);
  29. //
  30. // The use of compiler option `--strictNullChecks` is recommended.
  31. export default Decimal;
  32. export namespace Decimal {
  33. export type Constructor = typeof Decimal;
  34. export type Instance = Decimal;
  35. export type Rounding = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
  36. export type Modulo = Rounding | 9;
  37. export type Value = string | number | Decimal;
  38. // http://mikemcl.github.io/decimal.js/#constructor-properties
  39. export interface Config {
  40. precision?: number;
  41. rounding?: Rounding;
  42. toExpNeg?: number;
  43. toExpPos?: number;
  44. minE?: number;
  45. maxE?: number;
  46. crypto?: boolean;
  47. modulo?: Modulo;
  48. defaults?: boolean;
  49. }
  50. }
  51. export declare class Decimal {
  52. readonly d: number[];
  53. readonly e: number;
  54. readonly s: number;
  55. private readonly toStringTag: string;
  56. constructor(n: Decimal.Value);
  57. absoluteValue(): Decimal;
  58. abs(): Decimal;
  59. ceil(): Decimal;
  60. clampedTo(min: Decimal.Value, max: Decimal.Value): Decimal;
  61. clamp(min: Decimal.Value, max: Decimal.Value): Decimal;
  62. comparedTo(n: Decimal.Value): number;
  63. cmp(n: Decimal.Value): number;
  64. cosine(): Decimal;
  65. cos(): Decimal;
  66. cubeRoot(): Decimal;
  67. cbrt(): Decimal;
  68. decimalPlaces(): number;
  69. dp(): number;
  70. dividedBy(n: Decimal.Value): Decimal;
  71. div(n: Decimal.Value): Decimal;
  72. dividedToIntegerBy(n: Decimal.Value): Decimal;
  73. divToInt(n: Decimal.Value): Decimal;
  74. equals(n: Decimal.Value): boolean;
  75. eq(n: Decimal.Value): boolean;
  76. floor(): Decimal;
  77. greaterThan(n: Decimal.Value): boolean;
  78. gt(n: Decimal.Value): boolean;
  79. greaterThanOrEqualTo(n: Decimal.Value): boolean;
  80. gte(n: Decimal.Value): boolean;
  81. hyperbolicCosine(): Decimal;
  82. cosh(): Decimal;
  83. hyperbolicSine(): Decimal;
  84. sinh(): Decimal;
  85. hyperbolicTangent(): Decimal;
  86. tanh(): Decimal;
  87. inverseCosine(): Decimal;
  88. acos(): Decimal;
  89. inverseHyperbolicCosine(): Decimal;
  90. acosh(): Decimal;
  91. inverseHyperbolicSine(): Decimal;
  92. asinh(): Decimal;
  93. inverseHyperbolicTangent(): Decimal;
  94. atanh(): Decimal;
  95. inverseSine(): Decimal;
  96. asin(): Decimal;
  97. inverseTangent(): Decimal;
  98. atan(): Decimal;
  99. isFinite(): boolean;
  100. isInteger(): boolean;
  101. isInt(): boolean;
  102. isNaN(): boolean;
  103. isNegative(): boolean;
  104. isNeg(): boolean;
  105. isPositive(): boolean;
  106. isPos(): boolean;
  107. isZero(): boolean;
  108. lessThan(n: Decimal.Value): boolean;
  109. lt(n: Decimal.Value): boolean;
  110. lessThanOrEqualTo(n: Decimal.Value): boolean;
  111. lte(n: Decimal.Value): boolean;
  112. logarithm(n?: Decimal.Value): Decimal;
  113. log(n?: Decimal.Value): Decimal;
  114. minus(n: Decimal.Value): Decimal;
  115. sub(n: Decimal.Value): Decimal;
  116. modulo(n: Decimal.Value): Decimal;
  117. mod(n: Decimal.Value): Decimal;
  118. naturalExponential(): Decimal;
  119. exp(): Decimal;
  120. naturalLogarithm(): Decimal;
  121. ln(): Decimal;
  122. negated(): Decimal;
  123. neg(): Decimal;
  124. plus(n: Decimal.Value): Decimal;
  125. add(n: Decimal.Value): Decimal;
  126. precision(includeZeros?: boolean): number;
  127. sd(includeZeros?: boolean): number;
  128. round(): Decimal;
  129. sine() : Decimal;
  130. sin() : Decimal;
  131. squareRoot(): Decimal;
  132. sqrt(): Decimal;
  133. tangent() : Decimal;
  134. tan() : Decimal;
  135. times(n: Decimal.Value): Decimal;
  136. mul(n: Decimal.Value) : Decimal;
  137. toBinary(significantDigits?: number): string;
  138. toBinary(significantDigits: number, rounding: Decimal.Rounding): string;
  139. toDecimalPlaces(decimalPlaces?: number): Decimal;
  140. toDecimalPlaces(decimalPlaces: number, rounding: Decimal.Rounding): Decimal;
  141. toDP(decimalPlaces?: number): Decimal;
  142. toDP(decimalPlaces: number, rounding: Decimal.Rounding): Decimal;
  143. toExponential(decimalPlaces?: number): string;
  144. toExponential(decimalPlaces: number, rounding: Decimal.Rounding): string;
  145. toFixed(decimalPlaces?: number): string;
  146. toFixed(decimalPlaces: number, rounding: Decimal.Rounding): string;
  147. toFraction(max_denominator?: Decimal.Value): Decimal[];
  148. toHexadecimal(significantDigits?: number): string;
  149. toHexadecimal(significantDigits: number, rounding: Decimal.Rounding): string;
  150. toHex(significantDigits?: number): string;
  151. toHex(significantDigits: number, rounding?: Decimal.Rounding): string;
  152. toJSON(): string;
  153. toNearest(n: Decimal.Value, rounding?: Decimal.Rounding): Decimal;
  154. toNumber(): number;
  155. toOctal(significantDigits?: number): string;
  156. toOctal(significantDigits: number, rounding: Decimal.Rounding): string;
  157. toPower(n: Decimal.Value): Decimal;
  158. pow(n: Decimal.Value): Decimal;
  159. toPrecision(significantDigits?: number): string;
  160. toPrecision(significantDigits: number, rounding: Decimal.Rounding): string;
  161. toSignificantDigits(significantDigits?: number): Decimal;
  162. toSignificantDigits(significantDigits: number, rounding: Decimal.Rounding): Decimal;
  163. toSD(significantDigits?: number): Decimal;
  164. toSD(significantDigits: number, rounding: Decimal.Rounding): Decimal;
  165. toString(): string;
  166. truncated(): Decimal;
  167. trunc(): Decimal;
  168. valueOf(): string;
  169. static abs(n: Decimal.Value): Decimal;
  170. static acos(n: Decimal.Value): Decimal;
  171. static acosh(n: Decimal.Value): Decimal;
  172. static add(x: Decimal.Value, y: Decimal.Value): Decimal;
  173. static asin(n: Decimal.Value): Decimal;
  174. static asinh(n: Decimal.Value): Decimal;
  175. static atan(n: Decimal.Value): Decimal;
  176. static atanh(n: Decimal.Value): Decimal;
  177. static atan2(y: Decimal.Value, x: Decimal.Value): Decimal;
  178. static cbrt(n: Decimal.Value): Decimal;
  179. static ceil(n: Decimal.Value): Decimal;
  180. static clamp(n: Decimal.Value, min: Decimal.Value, max: Decimal.Value): Decimal;
  181. static clone(object?: Decimal.Config): Decimal.Constructor;
  182. static config(object: Decimal.Config): Decimal.Constructor;
  183. static cos(n: Decimal.Value): Decimal;
  184. static cosh(n: Decimal.Value): Decimal;
  185. static div(x: Decimal.Value, y: Decimal.Value): Decimal;
  186. static exp(n: Decimal.Value): Decimal;
  187. static floor(n: Decimal.Value): Decimal;
  188. static hypot(...n: Decimal.Value[]): Decimal;
  189. static isDecimal(object: any): object is Decimal;
  190. static ln(n: Decimal.Value): Decimal;
  191. static log(n: Decimal.Value, base?: Decimal.Value): Decimal;
  192. static log2(n: Decimal.Value): Decimal;
  193. static log10(n: Decimal.Value): Decimal;
  194. static max(...n: Decimal.Value[]): Decimal;
  195. static min(...n: Decimal.Value[]): Decimal;
  196. static mod(x: Decimal.Value, y: Decimal.Value): Decimal;
  197. static mul(x: Decimal.Value, y: Decimal.Value): Decimal;
  198. static noConflict(): Decimal.Constructor; // Browser only
  199. static pow(base: Decimal.Value, exponent: Decimal.Value): Decimal;
  200. static random(significantDigits?: number): Decimal;
  201. static round(n: Decimal.Value): Decimal;
  202. static set(object: Decimal.Config): Decimal.Constructor;
  203. static sign(n: Decimal.Value): number;
  204. static sin(n: Decimal.Value): Decimal;
  205. static sinh(n: Decimal.Value): Decimal;
  206. static sqrt(n: Decimal.Value): Decimal;
  207. static sub(x: Decimal.Value, y: Decimal.Value): Decimal;
  208. static sum(...n: Decimal.Value[]): Decimal;
  209. static tan(n: Decimal.Value): Decimal;
  210. static tanh(n: Decimal.Value): Decimal;
  211. static trunc(n: Decimal.Value): Decimal;
  212. static readonly default?: Decimal.Constructor;
  213. static readonly Decimal?: Decimal.Constructor;
  214. static readonly precision: number;
  215. static readonly rounding: Decimal.Rounding;
  216. static readonly toExpNeg: number;
  217. static readonly toExpPos: number;
  218. static readonly minE: number;
  219. static readonly maxE: number;
  220. static readonly crypto: boolean;
  221. static readonly modulo: Decimal.Modulo;
  222. static readonly ROUND_UP: 0;
  223. static readonly ROUND_DOWN: 1;
  224. static readonly ROUND_CEIL: 2;
  225. static readonly ROUND_FLOOR: 3;
  226. static readonly ROUND_HALF_UP: 4;
  227. static readonly ROUND_HALF_DOWN: 5;
  228. static readonly ROUND_HALF_EVEN: 6;
  229. static readonly ROUND_HALF_CEIL: 7;
  230. static readonly ROUND_HALF_FLOOR: 8;
  231. static readonly EUCLID: 9;
  232. }