In the early 1990s, game developer John Carmack made a small mistake while programming the computer game Doom. He set the value of pi (π) to 3.141592657 instead of the correct 3.141592654. While this error had little impact on the game itself, it sparked an interesting discovery by U.S. engineer Luke Gotszling.
Gotszling decided to investigate the consequences of incorrectly programming pi on a larger scale within the game. As Doom is an open-source game, he was able to download the code and modify it to test different values of pi. The results were surprising. When pi was set to 3, the game became distorted with walls and pillars moving unexpectedly. Setting pi to Euler’s number (2.718…) intensified the strangeness, with objects moving in unpredictable ways.
Things took a turn for the worse when Gotszling set pi to π/2. Walls would flash and disappear, invisible obstacles blocked the player’s movement, making the game unplayable in this state.
The power of pi lies in its fundamental role in geometry and trigonometry. Pi is defined as the ratio of a circle’s circumference to its diameter. However, in non-Euclidean geometries, such as those on curved surfaces like spheres, the value of pi can vary depending on the radius of the circle. This variability in pi’s value can lead to distorted geometries and unexpected results in calculations.
Gotszling’s experiment with Doom’s source code highlighted the importance of accurate mathematical constants in computer programming. By using an incorrect value of pi, he disrupted the trigonometric functions used to describe object movements in the game, resulting in bizarre and trippy visual effects.
Ultimately, this small mistake by Carmack led to a deeper exploration of the significance of pi in mathematics and computer science. Gotszling’s experiment served as a reminder of the critical role that precise mathematical constants play in ensuring the accuracy and functionality of computer programs.
This article, originally published in Spektrum der Wissenschaft, sheds light on the unexpected consequences of a simple programming error and the complex nature of mathematical constants like pi. It serves as a fascinating example of how a minor mistake can lead to significant discoveries in the world of technology and gaming.

