数学表达式计算
math-calculator
使用 shell 命令计算简单数学表达式。当用户要求执行加减乘除或更复杂的数学表达式等算术计算时使用。
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-13
- Stars
- ★ 491
- Forks
- 184
01 前言 Front Matter
- name
- math-calculator
- license
- Apache-2.0
- description
- Calculate simple mathematical expressions using shell commands. Use when the user asks to perform arithmetic calculations like addition, subtraction, multiplication, division, or more complex math expressions.
- compatibility
- Requires bash with bc (basic calculator)
03 SKILL.md 正文
Math Calculator Skill
This skill provides the ability to calculate mathematical expressions using shell commands.
When to Use
Use this skill when:
- Performing arithmetic calculations (add, subtract, multiply, divide)
- Evaluating mathematical expressions with parentheses
- Computing percentages or powers
- Any numeric computation requested by the user
Methods
Using bc (Basic Calculator)
The bc command is a powerful calculator that supports:
- Basic arithmetic:
+,-,*,/ - Power:
^ - Parentheses for grouping
- Scale for decimal precision
Example:
echo "2 + 3 * 4" | bc
# Output: 14
echo "scale=2; 10 / 3" | bc
# Output: 3.33
echo "(2 + 3) * 4" | bc
# Output: 20
Supported Operations
| Operation | Symbol | Example |
|---|---|---|
| Addition | + |
5 + 3 = 8 |
| Subtraction | - |
10 - 4 = 6 |
| Multiplication | * |
6 * 7 = 42 |
| Division | / |
15 / 3 = 5 |
| Power | ^ (bc) or ** (Python) |
2 ^ 3 = 8 |
| Modulo | % |
17 % 5 = 2 |
| Square Root | sqrt() (bc) |
sqrt(16) = 4 |
Notes
- Use
scale=Ninbcto set decimal precision (default is 0, integer only) - For floating-point division, always set
scaleinbc
04 同仓库更多 Skills
Nano Banana Pro 图像生成与编辑
nano-banana-pro
使用 Nano Banana Pro(Gemini 3 Pro Image)生成/编辑图像。适用于图像创建或修改请求(含编辑)。支持文生图 + 图生图;1K/2K/4K;使用 --input-image 参数。
GitHub 仓库协作管理
github
使用 `gh` CLI 与 GitHub 交互。使用 `gh issue`、`gh pr`、`gh run` 和 `gh api` 处理议题(issue)、PR、CI 运行及高级查询。
Nano Banana Pro 图像生成与编辑
nano-banana-pro
使用 Nano Banana Pro(Gemini 3 Pro Image)生成或编辑图像。用于图像创建、修改(含编辑)请求。支持文生图与图生图;支持 1K/2K/4K 分辨率;使用 --input-image 指定输入图像。
GitHub 仓库协作管理
github
使用 `gh` CLI 与 GitHub 交互。使用 `gh issue`、`gh pr`、`gh run` 和 `gh api` 处理议题(issue)、PR、CI 运行及高级查询。
数学表达式计算
math-calculator
使用 shell 命令计算数学表达式。当用户要求进行加法、减法、乘法、除法或乘方等算术计算时使用。
猫咪笑话生成
joke-generator
讲一个关于猫的笑话。