Definition
A hard-coded numeric value embedded in code without explanation, leaving future developers to wonder if it's a critical constant or the programmer's birth year. Best practice: replace with named constants. Reality: it's easier to just ship it.
Example Usage
Why are we dividing by 86400 here? Oh right, that's the magic number for seconds in a day—should probably document that.
Origin
Programming term dating to at least the 1960s, considered poor practice since the dawn of structured programming
Fun Fact
The most famous magic number is probably 0x5f3759df from Quake III's fast inverse square root algorithm, which seemed like black magic until mathematicians explained it decades later.
Source: Software engineering code quality standards
Related Terms
Translate This Term
See “magic number” in Corporate Speak, Gen-Z Slang, Pirate Speak, and more.
Try the Translator