# decimal.js_cn **Repository Path**: weixiaoyun/decimal.js_cn ## Basic Information - **Project Name**: decimal.js_cn - **Description**: decimal.js 中文文档 - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2021-09-10 - **Last Updated**: 2021-09-10 ## Categories & Tags **Categories**: Uncategorized **Tags**: 工具 ## README # 简单说两句吧 > 原生JavaScript在计算乘法和除法上会有精度的问题,如果涉及到数学计算建议使用 decimal.js 库。 **举个栗子:** ```javascript console.log(7 * 0.8); //- 输出:5.6000000000000005 console.log(0.1 + 0.2); //- 输出:0.30000000000000004 console.log(1 - 0.9); //- 输出:0.09999999999999998 ``` > 如果使用 decimal.js 来计算就不会有这些问题。 > > github上也有库的api文档,但是只有英文的,没找到中文版的,于是就像翻译一下吧,下面是原版地址。 > > 在翻译中,我会使用 gitee 替换 github,github在国内太慢了。 [github](https://github.com/MikeMcl/decimal.js.git) | [gitee](https://gitee.com/mirrors_addons/decimal.js.git) | [英文](en/index.html) | [中文](cn/index.html)