CasNum is a Python library that implements arbitrary precision arithmetic using compass and straightedge geometric constructions. Numbers are represented as points on a plane, and all arithmetic and logical operations (add, multiply, divide, AND, OR, XOR) are performed through classical Euclidean constructions. As a proof of concept, the library is integrated into a modified PyBoy Game Boy emulator, replacing Python's native int so every ALU opcode runs entirely through geometric constructions. The result is a functional (if extremely slow) emulator capable of running Pokémon Red, with a ~15-minute boot time and ~0.5–1 FPS after caching. Performance is managed via Python's lru_cache. The project is openly described as a novelty built for the experience rather than practical use.

6m read timeFrom github.com
Post cover image
Table of contents
Introduction To Compass And Straightedge ConstructionsPossible UsesExamples and how to runPhilosophyPerformanceDependenciesF.A.QLicense and Third-Party Credits

Sort: