
October 30, 2025
4 min learn
How an Error in Cult Basic Sport Doom Sparked New Appreciation for Pi
What would the world appear like if we modified the worth of pi? Whether or not in the true world or a recreation atmosphere, the reply is advanced
By Manon Bischoff edited by Daisy Yuhas
Nikolay Vinokurov/Alamy
Everybody makes errors—and generally these errors can result in stunning discoveries. Within the early Nineties, whereas programming the pc recreation Doom, recreation developer John Carmack set the worth of pi (π) by hand—and in true nerd trend, he wrote the quantity all the way down to the ninth decimal place from reminiscence: 3.141592657.
Do you discover something unusual about that determine? The final digit is mistaken. The quantity ought to as an alternative be 3.141592654. (Pi is commonly truncated with out rounding, by which case the ninth decimal place could be crammed by 3, nevertheless it rounds to 4 as a result of the next digit is 5.)
Happily, this error has little influence on the sport. In Doom, one of many earliest first-person shooters with three-dimensional graphics, you tackle the function of an area marine who, due to a failed teleportation experiment, finally ends up on a moon of Mars, the place he fights demons and zombies. The sport has an excellent story however horrible graphics. That’s not due to the wrong pi worth however quite a mirrored image of how little computing energy was accessible within the Nineties.
In case you're having fun with this text, take into account supporting our award-winning journalism by subscribing. By buying a subscription you might be serving to to make sure the way forward for impactful tales concerning the discoveries and concepts shaping our world at present.
Nonetheless, the error impressed U.S. engineer Luke Gotszling to analyze the attainable penalties of incorrectly programming pi at a bigger scale within the recreation—an thought he offered at a hackers conference in 2022.
As a result of Doom is an open-source laptop recreation, you may obtain the code—and modify it. Gotszling did simply that, testing what would occur if he modified the programmed values of pi.
The outcomes could make a viewer really feel a bit nauseous. When Gotszling set π = 3, for instance, the pixelated world of Doom grew to become distorted, with partitions and pillars transferring in surprising methods. Nonetheless, the sport was playable.
When pi was set to the worth of Euler’s quantity, 2.718…, the strangeness intensified. As a participant moved straight within the recreation world, surrounding objects would transfer to totally different sides. Enemies may seem out of nowhere and disappear once more. “With sufficient intoxication, you may re-create this,” Gotszling joked in his presentation.
Issues acquired actually unhealthy when he set a worth of π⁄2 for pi. Partitions would flash and disappear. Invisible obstacles block the participant’s motion. The sport wasn’t notably enjoyable on this state.
Why is pi so highly effective? To reply that, we’d like to consider the results of adjusting pi extra deeply.
Initially, pi was outlined because the ratio of a circle’s circumference to its diameter. In our on a regular basis world, we assume circles are spherical. However within the narrower mathematical sense, a circle is outlined by all factors which are equidistant from a standard heart. In a flat, two-dimensional world, the place distances are outlined because the shortest straight traces, a circle is spherical. Meaning pi’s worth can change.
For instance, think about you’re standing in downtown Manhattan. If you wish to discover out which locations are precisely one kilometer away from you, the form you may create will now not be spherical. That’s as a result of you may’t stroll by way of partitions. As a substitute it’s important to observe the checkerboard format of the streets. A circle has a sq. form within the “Manhattan metric,” because it’s known as in mathematical jargon. And should you outline pi on this context because the ratio of circumference to diameter, the quantity takes on fully totally different values: within the Manhattan metric, pi is strictly 4.
Amanda Montañez
In case you look carefully, the worth of pi in our world isn’t precisely 3.14159…. As a substitute, the ratio of circumference to diameter takes on a special worth—and, worse nonetheless, this worth varies!
If you’re standing on the North Pole and all of the locations precisely 1,000 kilometers away from you, as an illustration, these factors kind a circle on the floor of a sphere—however its circumference is smaller than that of a circle on a flat floor, due to the curvature of Earth. The nearer you get to the equator, the stronger this impact turns into, and the corresponding worth of pi deviates increasingly more from the same old 3.14159….
Amanda Montañez
The brand new worth of pi is due to this fact not fixed however as an alternative relies on the radius of the circle. And this isn’t simply the case when contemplating a spherical floor. Any sort of curved floor yields variable values for pi.
Mathematicians discuss with such curved worlds as “non-Euclidean” geometries. (Greater than 2,000 years in the past, the scholar Euclid laid out the principles of geometry most of us realized at school—concepts that solely apply on a flat world.)
The quirky panorama Gotszling created by tweaking Doom’s supply code is one thing else completely. To know it, we now have to return to the Nineties: a time when each arithmetic operation consumed an enormous quantity of sources. To handle that problem, programmers made efforts to find out attainable calculations upfront and retailer them in “lookup tables.”
When creating 3D graphics for a pc recreation, trigonometric features resembling sine, cosine and tangent play an essential function. They can be utilized to explain how objects transfer by way of house over time. To avoid wasting processing energy, Doom’s builders calculated essential values of the trigonometric features for numerous angles upfront and saved them within the lookup tables. And that is the place pi comes into play: it’s important to multiply an angle in levels by pi to get the corresponding worth in radians, which the pc makes use of.
So if Gotszling used a worth of pi that was too small, the angles could be transformed incorrectly. As a result of builders solely retailer a finite variety of angles, he created lookup tables with values that now not embody the complete rotations: As a substitute of describing an atmosphere by which an object solely reappears in the identical place after a 360-degree rotation, this happens after a considerably smaller angle. Consequently, in excessive conditions, objects all of a sudden disappear or reappear out of nowhere.
The Doom world Gotszling has created is extremely unusual. Nonetheless, it’s a pleasant technique to get folks fascinated about arithmetic and the worth—in each sense—of pi. One small mistake by a recreation developer has sparked a a lot bigger experiment into the unusual circle quantity.
This text initially appeared in Spektrum der Wissenschaft and was reproduced with permission.
Manon Bischoff is a theoretical physicist and an editor at Spektrum der Wissenschaft, the German-language sister publication of Scientific American.
In case you loved this text, I’d wish to ask in your help. Scientific American has served as an advocate for science and business for 180 years, and proper now could be the most crucial second in that two-century historical past.
I’ve been a Scientific American subscriber since I used to be 12 years outdated, and it helped form the way in which I take a look at the world. SciAm all the time educates and delights me, and evokes a way of awe for our huge, lovely universe. I hope it does that for you, too.
In case you subscribe to Scientific American, you assist be sure that our protection is centered on significant analysis and discovery; that we now have the sources to report on the choices that threaten labs throughout the U.S.; and that we help each budding and dealing scientists at a time when the worth of science itself too typically goes unrecognized.
In return, you get important information, captivating podcasts, good infographics, can't-miss newsletters, must-watch movies, challenging games, and the science world's greatest writing and reporting. You’ll be able to even gift someone a subscription.
There has by no means been a extra essential time for us to face up and present why science issues. I hope you’ll help us in that mission.
Thanks,
David M. Ewalt, Editor in Chief, Scientific American
Subscribe to Scientific American to study and share essentially the most thrilling discoveries, improvements and concepts shaping our world at present.
Scientific American is a part of Springer Nature, which owns or has business relations with hundreds of scientific publications (a lot of them might be discovered at www.springernature.com/us). Scientific American maintains a strict coverage of editorial independence in reporting developments in science to our readers.
© 2025 SCIENTIFIC AMERICAN, A DIVISION OF SPRINGER NATURE AMERICA, INC.
ALL RIGHTS RESERVED.