← 返回
效率工具 中文

Calculator

Perform mathematical calculations and unit conversions. Use when the user needs to calculate expressions, convert units (length, mass, temperature, volume, a...
执行数学计算与单位换算(长度、质量、温度、体积等),适用于表达式计算及单位转换。
wushengbing
效率工具 clawhub v1.0.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 544
下载
💾 2
安装
1
版本
#latest

概述

Calculator Skill

Perform mathematical calculations and unit conversions.

Usage

Calculate Expressions

python3 scripts/calculator.py calc "<expression>"

Supported operations:

  • Basic arithmetic: +, -, , /, %, ^ (or *)
  • Parentheses for grouping: (2 + 3) * 4
  • Percentage: 50%0.5, 100 + 10%110

Math functions:

  • Trigonometric: sin(), cos(), tan(), asin(), acos(), atan()
  • Hyperbolic: sinh(), cosh(), tanh()
  • Logarithms: log() (natural), log10(), log2(), ln()
  • Powers/roots: sqrt(), pow(), exp()
  • Rounding: round(), floor(), ceil()
  • Other: abs(), max(), min(), factorial(), gcd()
  • Constants: pi, e
  • Angle conversion: degrees(), radians()

Examples:

python3 scripts/calculator.py calc "2 + 2"
python3 scripts/calculator.py calc "sin(pi/2)"
python3 scripts/calculator.py calc "sqrt(16) + log(10)"
python3 scripts/calculator.py calc "(100 - 20) * 1.5"
python3 scripts/calculator.py calc "2^10"
python3 scripts/calculator.py calc "50% of 200"

Unit Conversions

python3 scripts/calculator.py convert <value> <from_unit> <to_unit>

Supported categories:

CategoryUnits
-----------------
Lengthm, km, cm, mm, mi, yd, ft, in, nm
Massg, kg, mg, lb, oz, t/ton
Volumel, ml, gal, qt, pt, cup, fl oz, tbsp, tsp
Aream², km², cm², ha, acre, ft², in²
Times, min, h, d, wk, mo, y
Temperature°C, °F, K

Examples:

python3 scripts/calculator.py convert 100 km miles
python3 scripts/calculator.py convert 70 f c
python3 scripts/calculator.py convert 2.5 kg lb
python3 scripts/calculator.py convert 500 ml cups

Output Format

All commands output JSON:

{"result": 42}
{"result": 3.14159, "category": "length"}
{"error": "Division by zero"}

Error Handling

Common errors and their meanings:

  • Division by zero - Attempted to divide by zero
  • Invalid expression syntax - Malformed expression
  • Unknown function or variable - Used unsupported function/variable
  • Unsupported unit conversion - Units not in same category or not recognized

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-19 23:16 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

productivity

Weather

steipete
获取当前天气和预报(无需API密钥)
★ 446 📥 226,454
productivity

Nano Pdf

steipete
使用nano-pdf CLI通过自然语言指令编辑PDF
★ 275 📥 114,962
productivity

Obsidian

steipete
操作 Obsidian 仓库(纯 Markdown 笔记)并通过 obsidian-cli 自动化。
★ 433 📥 103,862