1.0.5 • Published 5 years ago
four-arithmetic v1.0.5
four-arithmetic
js的四则运算精确版工具,解决IEEE754浮点数标准带来的计算误差。同时支持超大数的四则运算。
下载方式
npm install four-arithmetic --save
使用
import Arithmetic from 'four-arithmetic'
方法说明
1. Arithmetic.plus
/**
* 加法
* @param a
* @param b
* @return {String}
*/
public static plus(a: string, b: string): string {
}
2. Arithmetic.minus
/**
* 减法
* @param a 被减数
* @param b 减数
* @return {String}
*/
public static minus(a: string, b: string): string {
}
3. Arithmetic.mult
/**
* 乘法
* @param a
* @param b
* @return {String}
*/
public static mult(a: string, b: string): string {
}
4. Arithmetic.devide
/**
* 除法
* @param a 被除数
* @param b 除数
* @param decNum 保留多少位小数 默认为5位
* @param maxEachNum 内部运算次数最大值,超过该次数则停止运算,默认为10000次
* @return {String}
*/
public static devide(a: string, b: string, decNum: number = 5, maxEachNum: number = Math.pow(10, 4)): string {
}
作者 wbrong 306408943@qq.com 2019 年 03月 05日