🎁 Get the FREE AI Skills Starter Guide β€” Subscribe β†’
BytesAgainBytesAgain
πŸ¦€ ClawHub

Calculator

by @yukin1218

Accurate mathematical calculations. Use when user needs to compute: (1) Basic arithmetic (+, -, *, /), (2) Powers and roots (^, sqrt), (3) Percentages, (4) T...

Versionv1.0.1
Downloads3,318
Stars⭐ 1
TERMINAL
clawhub install calculator

πŸ“– About This Skill


name: calculator description: | Accurate mathematical calculations. Use when user needs to compute: (1) Basic arithmetic (+, -, *, /), (2) Powers and roots (^, sqrt), (3) Percentages, (4) Trigonometry (sin, cos, tan), (5) Logarithms (log, ln), (6) Complex expressions, (7) Unit conversions.

Calculator Skill

Perform accurate mathematical calculations using the calc.py script.

Usage

Run calculations directly with Python:

python3 /scripts/calc.py ""

Supported Operations

Basic Arithmetic

  • + Addition: 2 + 3 β†’ 5
  • - Subtraction: 10 - 4 β†’ 6
  • * Multiplication: 6 * 7 β†’ 42
  • / Division: 15 / 3 β†’ 5
  • Powers & Roots

  • ^ or ** Power: 2^10 β†’ 1024
  • sqrt() Square root: sqrt(16) β†’ 4
  • Percentages

  • 100 * 15% β†’ 15 (15% of 100)
  • 50 + 50 * 10% β†’ 55 (add 10%)
  • Trigonometry (radians)

  • sin(pi/2) β†’ 1
  • cos(pi) β†’ -1
  • tan(pi/4) β†’ 1
  • Logarithms

  • log(100) β†’ 2 (base 10)
  • ln(e) β†’ 1 (natural log)
  • Constants

  • pi β†’ 3.141592653589793
  • e β†’ 2.718281828459045
  • Other Functions

  • abs(-5) β†’ 5
  • round(3.7) β†’ 4
  • floor(3.9) β†’ 3
  • ceil(3.1) β†’ 4
  • pow(2, 8) β†’ 256
  • Examples

    python3 scripts/calc.py "2 + 3 * 4"        # 14
    python3 scripts/calc.py "(2 + 3) * 4"       # 20
    python3 scripts/calc.py "sqrt(144)"         # 12
    python3 scripts/calc.py "2^8"               # 256
    python3 scripts/calc.py "1000 * 5%"         # 50
    python3 scripts/calc.py "sin(0)"            # 0
    python3 scripts/calc.py "log(1000)"         # 3
    

    Notes

  • Implicit multiplication supported: 2(3) = 2*3
  • Use parentheses for grouping
  • Float results are rounded to 10 decimal places to avoid precision issues
  • πŸ’‘ Examples

    python3 scripts/calc.py "2 + 3 * 4"        # 14
    python3 scripts/calc.py "(2 + 3) * 4"       # 20
    python3 scripts/calc.py "sqrt(144)"         # 12
    python3 scripts/calc.py "2^8"               # 256
    python3 scripts/calc.py "1000 * 5%"         # 50
    python3 scripts/calc.py "sin(0)"            # 0
    python3 scripts/calc.py "log(1000)"         # 3
    

    πŸ“‹ Tips & Best Practices

  • Implicit multiplication supported: 2(3) = 2*3
  • Use parentheses for grouping
  • Float results are rounded to 10 decimal places to avoid precision issues