Binary Angle Measurement

17 05 2010

As a programmer, I have to keep things easy to compute and calculate. However, if you’ve taken trigonometry, you’ll find out how extremely difficult it can be to accurately calculate angles on older systems. Many programmers have taken and exploited shortcuts in order to allow for fast calculations at the expense of accuracy. One of those shortcuts is binary angle measurement.

For those who don’t know, trigonometry requires floating point values (numbers with decimal values, as opposed to integers, whole numbers), which were unavailable back then, and if they were, they were often too hard to implement with the resulting code being too slow. The answer to this was binary angle measurement, or BAM.

Binary Angle Measurement

To summarize, the most significant bit is 180 degrees, the next bit is half of that, the next bit is half of the last bit, etc. This is a more visual example:

Bit 7: 180

Bit 6: 90

Bit 5: 45

Bit 4: 22.5


This allowed for storage of angles in convenient little bytes or words, instead of large floating point numbers. This method was used for computing angles in popular games such as Doom and Duke Nukem 3D, so it was pretty useful.




Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: