UNPKG

@numio/bigmath

Version:

@numio/bigmath is an arbitrary-precision arithmetic library. It can be used for basic operations with decimal numbers (integers and float)

12 lines (11 loc) 397 B
import { bi2s, s2bi } from "../../shared/utils.js"; import { calcInner } from "../../shared/utils.js"; /** This function subtracts numbers (as string). */ export function sub(array) { const arrayInner = Array(array.length); for (let i = 0; i < array.length; i++) { arrayInner[i] = s2bi(array[i]); } const bi = calcInner(arrayInner, (a, b) => a - b); return bi2s(bi); }