js-precision
Version:
一个基于 Rust + WebAssembly 的高精度计算库,封装了 [`rust_decimal`](https://crates.io/crates/rust_decimal) 实现,支持链式调用、科学计数法和精度控制,适用于前端金融、加密等高精度场景。
15 lines (14 loc) • 384 B
TypeScript
/* tslint:disable */
/* eslint-disable */
export class Precise {
free(): void;
constructor(input: string);
static fromNumber(n: number): Precise;
with_precision(dp: number): Precise;
add(other: string): Precise;
sub(other: string): Precise;
mul(other: string): Precise;
div(other: string): Precise;
to_fixed(digits?: number | null): string;
to_number(): number;
}