MathX具有链式API的灵活数学工具。
constructor(value?: number, precision?: number, rounding?: "half-up" | "up" | "down")value: 初始值。默认为 0。precision: 小数位数。默认为 2。rounding: 舍入模式。默认为 'half-up'。MathX 实例。set(value: number): thisvalue: 新的值。value(): numbersetPrecision(digits: number): thisdigits: 小数位数。setRounding(mode: "half-up" | "up" | "down"): thismode: 舍入模式 ('half-up', 'up', 'down')。clone(value?: number): MathXvalue: 可选的新值。MathX 实例。add(num: number): thisnum: 要相加的数字。subtract(num: number): thisnum: 要相减的数字。multiply(num: number): thisnum: 要相乘的数字。divide(num: number): thisnum: 除数。num 为 0。abs(): thissqrt(): thiscbrt(): thispow(exp: number): thisexp: 指数。floor(): thisceil(): thisround(): thissign(): thisdegToRad(): thisradToDeg(): thismax(...nums: number[]): thisnums: 要比较的数字。min(...nums: number[]): thisnums: 要比较的数字。sin(): thiscos(): thistan(): thisasin(): thisacos(): thisatan(): thislog(): thislog10(): thisexp(): thistoExponential(fractionDigits?: number): stringfractionDigits: 小数点后的位数。如果省略,则使用必要的位数。