# What happened In a single development effort, the author ported a 1996 Pascal/Delphi expression evaluator (Expression Calculator) to Rust as excalc-rs. The resulting project is both a CLI and an MCP server so other tools—such as coding agents—can call into it for reliable arithmetic instead of guessing or hallucinating results.
# Why this matters
# What the port reproduces
- 12 comparison and logical/bitwise operators plus 12 arithmetic operators with correct precedence.
- 8 general/rounding functions and 7 statistics functions (mean, variance, standard deviation, etc.).
- 36 standard math functions (trig, inverse trig, hyperbolic, radians and degrees variants).
- 17 number-theory utilities: GCD/LCM, Fibonacci, primality, Mersenne and perfect numbers, Euler's totient.
- 18 financial functions: NPV, IRR, loan payments, present/future value, depreciation schedules.
- 7 quadrature methods for numeric integration (trapezoid, Simpson, Gaussian, and more).
- 21 advanced/special functions: Gamma, Beta, elliptic integrals, Fresnel, erf, dilogarithm, Dawson's integral, sine/cosine integrals.
The post shows a numeric check: gamma(10) computed by numeric integration equals 9! to about seven decimal places (result: 0.000000054249539971351624 difference).
# How the port was done The author used Copilot CLI interactively across one session. Key milestones and CI/packaging work included:
- Initial scaffold and core arithmetic engine, then rapid addition of CI, tests, and releases.
- Implementations for general functions, operators, advanced/special functions, financial functions, numeric integration, variable assignment, degree-native trig, and more.
- Packaging and distribution: published to crates.io, Homebrew formula added and validated in CI, and a Windows MSI built with cargo-wix.
Timeline highlights show the first v0.1.0 shipped seven minutes after the initial scaffold. By the morning the project reached v0.2.0 with extensive features and packaging.
# Project metrics
- 59 commits, 5,060 lines of Rust, 217 tests.
- v0.2.0 published to crates.io, Homebrew formula, Windows MSI installer.
# The original and provenance
# Practical takeaway If you need a tested, standalone evaluator for complex math, statistics, number theory, financial calculations, or numeric integration, excalc-rs is a modern Rust implementation of a long-lived codebase. It is available as a crate, a CLI, and an MCP server suitable for programmatic use.