← Constructive Calculator

No Rounding

Constructive Calculator is an iPhone calculator that doesn’t round at all. It computes with constructive real numbers: every result is exact, and you can scroll any answer for as many correct digits as you want. What that gives you:

It’s made possible by constructive (or computable) real arithmetic: instead of storing a number as a fixed-width approximation, store a function that produces an approximation to any requested precision, and evaluate each subexpression to whatever precision the final answer needs. Hans Boehm built a Java library for this in the 1980s and 90s, and it has been the engine behind Android’s built-in Calculator, a fact that periodically delights Hacker News.

But there was no equivalent on iPhone that I could find, so I built one, by porting Boehm’s engine.

It’s 2026, so I didn’t hand-write the port. I directed Opus 4.8 to translate the source line by line into Swift, and steered the process (architecture, UI, on-device testing, the App Store machinery) over a long back-and-forth.

What got ported:

The interesting work was what didn’t translate directly. Java’s synchronized, checked exceptions, and AsyncTask have no Swift equivalents, so the port re-expressed them: exceptions became Swift throws, precision-overflow and divergence became typed errors, and Java’s interrupt-based cancellation became Swift Concurrency’s Task.checkCancellation(). The 2013 Mac I develop on can’t run a current Xcode, so signing and TestFlight uploads run on GitHub Actions; the local machine never touches the submission.

Then I had a different model, Fable 5, do a clean-room review: fresh context, no memory of how the code was built, just the repository. It earned its keep:

As a data point on AI-assisted development, I found this quite useful: the port itself was faithful (Fable 5 checked the algorithms against Boehm’s Java and found no transcription errors), but the adaptation to a different concurrency model is where the bugs lived, and a second model with no stake in the first one’s choices caught them. None would have shown up in the unit tests.

Known Limitations

Exact real arithmetic has a hard wall: equality is undecidable. You cannot, in general, prove two constructive reals are equal by any finite computation. So exp(100)+42−exp(100) is correctly 42, but the app can’t prove it terminates; it prints 42.000… with a “more digits” arrow and will emit zeros forever. It always gives you the right number to as many digits as you want; it only labels a result “exact” when the value stays inside the structured rational-times-known-constant form. cos(π/3)=½ does; exp(100)+42 doesn’t. Android’s calculator has the same property, for the same reason.

Try it

Early TestFlight beta, iPhone, iOS 16+: join here. Caveat: iPhone-only for now. Feedback very welcome, especially edge cases: support@dimview.org.