Welcome to DU! The truly grassroots left-of-center political community where regular people, not algorithms, drive the discussions and set the standards. Join the community: Create a free account Support DU (and get rid of ads!): Become a Star Member Latest Breaking News Editorials & Other Articles General Discussion The DU Lounge All Forums Issue Forums Culture Forums Alliance Forums Region Forums Support Forums Help & Search

magicarpet

(18,455 posts)
7. It is simple,.. do you live in a vacuum ? (smirk)
Wed Oct 31, 2018, 12:51 PM
Oct 2018

Why do programmers always mix up Halloween and Christmas? Because Oct 31 = Dec 25.
The joke here is that Octal 31 (which abbreviated looks like October 31st, Halloween) is equal to Decimal 25 (which abbreviated looks like December 25th, Christmas).

Decimal and octal are two number systems with different bases.

Decimal is the base-10 number system that everyone is familiar with. A number system has as many digits as its base number. That means a base-10 number system 10 digits (0, 1, 2, 3, 4, 5, 6, 7, 8, and 9) and is where it gets its name from (decimal, from Latin decimus, means tenth).

When you get to a number that is higher than the highest digit, you add another column to the left, so you count like 8, 9, 10, 11, 12, and so on.

Octal (from the Latin root oct- meaning eight) is a base-8 number system commonly used in programming. A base-8 system means it has 8 digits (0, 1, 2, 3, 4, 5, 6, and 7). When you get to a number higher than 7, you also add another column, so you count like 6, 7, 10, 11, 12, and so on.

If we convert the octal 31 to decimal, we end up with 25. Watch: if we break octal 31 out to a math equation, it ends up being 3 x 81 + 1 x 80 = 3 x 8 + 1 x 1 = 24 + 1 = decimal 25.

To convert the other way, you start with the biggest power of the base (8, in this case) you can divide by and get a whole number, then take that and divide the remainder by the next smaller power until you get to the 0-th power. Then you just combine the digits together. In the case of 25, we need to start at 81: 25 / 81 = 3, remainder of 1 / 80 = 1, so 31.

Recommendations

0 members have recommended this reply (displayed in chronological order):

Latest Discussions»Help & Search»Computer Help and Support»Happy Halloween! Or, if y...»Reply #7