bignumber.js任意精度の小数と非進算術JavaScriptライブラリのためのツールであります

インストール

NPM bignumber.jsをインストール

導入

'bignumber.js' からインポート{なBigNumber}

方法の例

追加:PLUS

0.1 + 0.2                        // 0.30000000000000004 
X =なBigNumber(0.1 
Y = x.plus(0.2)                  // '0.3'

減算:マイナス

0.3から0.1                        // 0.19999999999999998 
X =なBigNumber(0.3 
x.minus( 0.1)                     // '0.2'

乗算:multipliedBy

0.6 * 3                          // 1.7999999999999998 
X =なBigNumber(0.6 
Y = x.multipliedBy(3)            // '1.8'

おすすめ

転載: www.cnblogs.com/adbg/p/12091457.html