calculation_formula
v1.0.8
Published
YDT
Downloads
23
Readme
js计算公共仓库
安装:cnpm i calculation_formula
具体方法:
版本1.0.1新增
1.计算公式:支持带括号和计算次方(^)
import {compute} from 'calculation_formula';
//@param str 字符串如:'(100^2-587)*100+(1024*2+1)+0.05*3*100'
//return number
compute(str);
2.解决运算精度丢失问题——加法
import {add} from 'calculation_formula';
//@param arg1 被加数
//@param arg2 加数
//return number
add(arg1,arg2)
3.解决运算精度丢失问题——减法
import {cut} from 'calculation_formula';
//@param arg1 被减数1
//@param arg2 减数2
//return number
cut(arg1,arg2)
4.解决运算精度丢失问题——乘法
import {multiple} from 'calculation_formula';
//@param arg1 被乘数
//@param arg2 乘数
//return number
multiple(arg1,arg2)
5.解决运算精度丢失问题——除数
import {divide} from 'calculation_formula';
//@param arg1 被除数
//@param arg2 除数
//return number
divide(arg1,arg2)
6.四舍五入保留小数
import {keepDecimal} from 'calculation_formula';
//@param num 数值
//@param decimal 小数位数
//return number
keepDecimal(num,decimal)
7.最小为0
import {lowestZero} from 'calculation_formula';
//@param num 数值
//return number
lowestZero(num)
8.是否为浮点数
import {isFloat} from 'calculation_formula';
//@param num 数值
//return number
isFloat(num)
版本1.0.2新增
9.数字千分位
import {formatNumberToThousand} from 'calculation_formula';
//@param num 数值
//return string
formatNumberToThousand(num)
版本1.0.3新增
10.平均数
import {calculationAvg} from 'calculation_formula';
// @param Array 数组
// @returns number
calculationAvg(array)
11.方差
import {calculationVar} from 'calculation_formula';
// @param Array 数组
// @returns number
calculationVar(array)
12.协方差
import {calculationCovariance} from 'calculation_formula';
// @param arrayX:Array,arrayY:Array 数组
// @returns number
calculationCovariance(arrayX,arrayY)
13.相关性系数
import {calculationCorrelation} from 'calculation_formula';
// @param arrayX:Array,arrayY:Array 数组
// @returns number
calculationCorrelation(arrayX,arrayY)
14.相关性矩阵
import {calculationCorrelationMatrix} from 'calculation_formula';
// @param Array 二位数组 示例:[[第一列],[第二列],[第三列],[第四列]]
// @returns Array 示例:[[第一行],[第二行],[第三行],[第四行]]
calculationCorrelationMatrix()
版本1.0.4新增
15.标准差
import {calculationStandardDeviation} from 'calculation_formula';
// @param Array 数组
// @returns number
calculationStandardDeviation(array)