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) 452 B
import { bi2s, s2bi } from "../../shared/utils.js"; import { divInner } from "./utils.js"; /** This function should divide numbers (as string). */ export const div = (array, precision = 20) => { const arrayInner = Array(array.length); for (let i = 0; i < array.length; i++) { arrayInner[i] = s2bi(array[i]); } const bi = divInner(arrayInner, precision !== null && precision !== void 0 ? precision : 20); return bi2s(bi); };