Options
All
  • Public
  • Public/Protected
  • All
Menu

解决浮动运算问题,避免小数点后产生多数值和计算精度损失

example
const NP = new NumberPrecision();

NP.plus(0.1, 0.2);
>> 0.3

NP.times(0.1, 0.2);
>> 0.02

NP.minus(0.2, 0.1);
>> 0.1

NP.divide(0.2, 0.1);
>> 2

Hierarchy

  • NumberPrecision

Index

Constructors

Methods

Constructors

constructor

Methods

divide

  • divide(num1: number, num2: number, ...others: number[]): number

minus

  • minus(num1: number, num2: number, ...others: number[]): number

plus

  • plus(num1: number, num2: number, ...others: number[]): any

times

  • times(num1: number, num2: number, ...others: number[]): number

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc