Dblock iconDblockSep 24, 2026 ~5 min source read

Porting a 1996 Pascal/Delphi Calculator to Rust: CLI and MCP server in under 24 hours

A developer rewrites a feature-rich 1996 Expression Calculator in Rust, producing a CLI and an MCP server. The port reproduces decades-old math capabilities, ships to crates.io, Homebrew, and Windows MSI, and documents the effort and measure of effort.

Porting My 1996 Pascal/Delphi Calculator to Rust (CLI + MCP)

Share this story

Send the public story page.

Useful takeaways from this story.

The Rust port (excalc-rs) reproduces the original calculator’s extensive math capabilities and exposes them as a CLI and an MCP server.

The port was produced quickly: one Copilot CLI session over 24 hours, 59 commits, 5,060 lines of Rust, 217 tests, and a v0.2.0 release.

Approximate token usage and cost for the AI-assisted port are reported: 732 API calls, ~83 million input tokens (mostly cache reads), ~262,000 output tokens, estimated near $50.

# 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.

More context around this story.

Rust: Макетирование форм для Iced 14
Habr iconHabrSep 4, 2026

Rust: Макетирование форм для Iced 14

Привет, Хабр! Некоторое время назад у меня образовалось немного (вернее много) свободного времени, и я между моментами серфинга на известном сайте HH решил посмотреть в сторону освоения Rust. Кроме всего прочего мне очень интересует тема библиотек графических интерфейсов. В Rust есть несколько подобных библиотек, я реш

Avdi iconAvdiSep 8, 2026

Untitled story

Originally appeared on avdi.codes . Making a Claude plugin named Bill Gates that makes Claude put a dollar in the swear jar every time it says “gate”.

Loading more related stories...

Keep reading in the app

Open the app view to save this story, compare related coverage, and continue from the same source.

Open in app