eie20260764
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "eie20260764" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-8b40b70826d810ebcfc94d3fa61215b25440397525cc26f02b7924018d454dde. Verify the upstream source and version against https://skillhub.cn/skills/user_f1b049da/eie20260764 before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
skillhub.cn
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
Performs high-precision decimal arithmetic and rounding in the browser using decimal.js, suitable for scenarios sensitive to decimal accuracy such as contract amounts and KPI aggregation. Use when Decimal.js, decimal math, or contract-amount aggregation is required.
Introduction source: third_party · user_f1b049da · 1.0.0 Reference
SkillPi interpretation
- Tasks
- Translation pending; see source documentation.
- Testing
- Not tested
Browse files
Frontmatter
name: eie20260764
slug: eie20260764
displayName: Decimal.js十进制
version: 1.0.0
summary: 用 Decimal.js 做更完整的十进制数学,适合合同金额与 KPI 汇总。
license: MIT
description: 用 decimal.js 在浏览器内做高精度十进制运算与舍入,适合合同金额、KPI 汇总。当用户要 Decimal.js、十进制数学、合同金额汇总时使用。Decimal.js 十进制数学(decimal.js)
灵感:能力工具箱 decimaljs(pkg: decimal.js)。
小四原创:比 Big.js 更完整的舍入/幂/模等能力;合同金额与 KPI 汇总优先字符串入参。与 Big.js / currency.js 项目内择一为主。
何时使用
- 合同金额多级汇总、税率试算链路
- KPI 环比需要稳定小数
- 需要明确舍入模式(四舍五入到分等)
硬约束
- 使用
decimal.js;金额用 string 构造。 - 配置
precision/rounding写进模块常量,勿散落魔法数。 - 除零与非法输入返回中文错误,不抛到白屏。
- 实现要点注释标 小四原创。
- 已用 Big.js 的链路不要中途换成 Decimal 却不统一舍入。
推荐实现
import { Decimal } from 'decimal.js'
Decimal.set({ precision: 20, rounding: Decimal.ROUND_HALF_UP })
// 小四原创:KPI 汇总(分→元展示)
export function sumMoney(values: string[]) {
try {
const total = values.reduce((a, v) => a.plus(v || '0'), new Decimal(0))
return { ok: true as const, yuan: total.toFixed(2) }
} catch {
return { ok: false as const, error: '存在非法金额' }
}
}
// 小四原创:含税拆分(税率如 0.06 / 6%)
export function splitTaxInclusive(total: string, taxRate: string) {
try {
const T = new Decimal(total)
const r = new Decimal(taxRate)
const rate = r.gt(1) ? r.div(100) : r
const ex = T.div(rate.plus(1))
const tax = T.minus(ex)
return {
ok: true as const,
exclusive: ex.toFixed(2),
tax: tax.toFixed(2),
inclusive: T.toFixed(2),
}
} catch {
return { ok: false as const, error: '金额或税率无效' }
}
}
Agent 步骤
- 统一
Decimal.set;封装sumMoney/ 业务公式。 - UI 绑定字符串;展示
toFixed(2)。 - 自测:汇总、含税拆分、非法输入。
- 文档注明与
bigjs-money-math的选型关系。
不要做
- 用
number累加 KPI 再「差不多」展示。 - 把财务制度级审计承诺写进前端试算文案。
附加
Current listing version
1.0.0
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 解决合同金额、KPI 汇总等场景下的浮点数精度痛点
- 提供含税拆分、多级汇总等实用业务函数
Highlights
- 触发词精准覆盖 'Decimal.js'、'十进制数学'、'合同金额汇总'
Highlights
- 文档结构清晰,包含使用场景、约束、实现示例与步骤
- frontmatter 完整,代码示例规范
Areas to improve
-
Missing referenced files Reported severity: Minor
SKILL.md 引用了 [README.md]、[reference.md]、[templates/usage.md] 但未传入对应文件
Recommendation: 建议补充被引用的文档文件,或移除无法提供的链接
Highlights
- 工具来源明确,异常处理完善,返回中文错误提示
- 配置集中管理,避免魔法数散落
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
These common operations were not identified in the main document. This does not mean no permissions or risks exist.
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.