An open-source macOS calculator, rebuilt clean-room from black-box observation.
Basic, Scientific and Programmer modes · Swift 6 + SwiftUI · zero dependencies
How it was made · Build · Stats · Code map · Spec
OpenCalc is an original calculator for macOS that behaves like the built-in one. Every rule it
follows (precedence, repeated =, percent, rounding to 8 places, Undefined / Indeterminate
/ Overflow, 64-bit programmer arithmetic) was recorded from the real app and is checked by
189 test vectors on every push.
- Basic: expression-style display, ⌫, AC, %, ±, repeated equals
- Scientific: parentheses, powers and roots, logs, factorial (gamma for decimals), trig in degrees or radians, hyperbolic functions, EE, π, e, memory
- Programmer: bases 8/10/16, 64-bit binary view, AND / OR / XOR / NOR / NOT / NEG, shifts, rotates, byte and word flips, mod
OpenCalc is a clean-room reimplementation. Nothing inside the original app (its code, files or artwork) was read, decompiled or copied.
- Study (black box). Claude Opus 5.5 operated the real calculator from outside through the macOS accessibility interface, pressing its buttons and reading its display, and recorded 189 results plus layout measurements.
- Spec. Those observations became
spec/SPEC.mdandspec/test-vectors.csv. Only written behaviour crossed over. - Build. Craft Anything ran Claude Code on Claude Haiku 5.5 in clean-room mode to write the app from the spec alone.
- Check. Every vector is replayed against the engine; the window was compared side by side with screenshots of the original for layout, sizes and colours.
The icon and all drawing are original. OpenCalc is not affiliated with or endorsed by Apple.
Needs macOS 14+ and Swift 6 (the Command Line Tools are enough; Xcode is not needed).
swift build # build everything
swift run OpenCalc # run the app
scripts/make-app.sh # package dist/OpenCalc.app
scripts/check-vectors.sh # replay the 189 recorded results
python3 -I scripts/stats.py # refresh the badges, stats and treemap below| Overall | |
|---|---|
| Behaviour match | 189/189 recorded results (100.0%) |
| Lines of code (excluding spec) | 2,758 across 12 Swift files |
| App bundle | 1.3 MB (original app: 3.4 MB, 0.4×) |
| Vector replay time | 0.7 s (including incremental build) |
| Commits | 2 |
| Mode | Recorded results | Passing | Progress |
|---|---|---|---|
| Basic | 89 | 89 | ████████████████████ 100% |
| Programmer | 46 | 46 | ████████████████████ 100% |
| Scientific | 54 | 54 | ████████████████████ 100% |
| Module | Non-blank lines |
|---|---|
| Engine | 1,434 |
| App (SwiftUI) | 905 |
| Scripts | 361 |
| Spec | 326 |
| Tests | 58 |
Generated by scripts/stats.py on 2026-11-10.
Each box is a file, sized by its non-blank lines and coloured by module.
| Path | What it is |
|---|---|
Sources/OpenCalcCore |
The calculator engine. No UI. |
Sources/OpenCalc |
The SwiftUI app. |
scripts/check-vectors |
Command-line replay of the vectors (swift run OpenCalcTests). |
Tests/OpenCalcCoreTests |
The same replay as Swift Testing tests. |
spec/ |
The behaviour spec and the recorded test vectors. |
Made by Claude (Opus 5.5 and Haiku 5.5) with Craft Anything.