A calculator that doesn't round
3 days ago
- #Constructive Real Arithmetic
- #iOS Development
- #Exact Computation
- Constructive Calculator is an iPhone app that uses constructive real arithmetic, allowing exact results without rounding, and enabling scrolling for as many digits as needed.
- It can compute expressions like Ramanujan's constant (exp(π√163)), which appears as an integer but reveals differences upon scrolling, and exp(100) + 42 − exp(100) returns exactly 42 by evaluating to necessary precision.
- The app is built by porting Hans Boehm's Java library for constructive reals to Swift, with AI assistance from Opus 4.8 for translation, and includes layers for symbolic exactness and a SwiftUI front end.
- Porting challenges included adapting Java concurrency features to Swift, leading to bugs like incorrect actor isolation and cache races, which were caught by a separate AI model review.
- Limitations include undecidability of equality in constructive real arithmetic, so some results display as approximations even when exact, similar to Android's calculator.
- The app is available as an early TestFlight beta for iPhone, with recent additions like standard normal CDF and inverse functions implemented via new constructive series.