| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 2 年前 | ||
| 11 个月前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 11 个月前 | ||
| 11 个月前 | ||
| 11 个月前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 2 年前 |
decimal_js
简介
An arbitrary-precision Decimal type for JavaScript.
下载安装
ohpm install decimal.js@10.5.0
OpenHarmony ohpm 环境配置等更多内容,请参考 如何安装OpenHarmony ohpm包 。
使用说明
import decimal from "decimal.js"
let x = new Decimal(123.4567);
x.add(33)
x.sub(33)
x.mul(2)
x.div(3)
x.pow(2)
x.abs()
x.floor()
x.ceil()
x.round()
x.toBinary()
x.toExponential(5)
x.toFixed(5)
x.toPrecision(5)
x.toFraction()
x.isZero()
单元测试用例详情见TEST.md
约束与限制
在下述版本验证通过:
- DevEco Studio 版本: 4.1 Canary(4.1.3.317),OpenHarmony SDK:API11 (4.1.0.36)。
目录结构
|---- decimal_js
| |---- entry # 示例代码文件夹
├── src
├── main
├── ets
├── pages
├── Index.ets sample代码
| |---- README.md # 安装使用方法
| |---- README_zh.md # 安装使用方法
贡献代码
使用过程中发现任何问题都可以提 Issue 给组件,当然也非常欢迎给发 PR共建 。
开源协议
本项目基于 MIT License,请自由地享受和参与开源。