logoalt Hacker News

aldoniustoday at 4:47 AM1 replyview on HN

Binary fractions of a turn are also a nice intuition pump for two's complement in general.

Let's keep it simple and use just 8 bits. 0° is 0x00, 180° is 0x80, and 255/256ths of 360° is 0xFF. And if we wanted to use signed integers, then 0x80 through 0xFF - the high-bit half of the range - now represent the negative quadrants just as they represent negative integers.


Replies

djmipstoday at 6:27 AM

and that's exactly what we did in the old days of 8 bit games. We called them BRADs but others had their own names.