Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Octal numbers in Computer Programming [duplicate]

I'm a college programming student with two years of programming experience in Java and Python. We've talked about number systems in classes including Binary, Octal, and Hexidecimal. I understand why Binary and Hexidecimal are important in Computing but I don't see any benefits to using Octal numbers. What would be some examples of Octal number use in programming?

like image 606
Nick Gilbert Avatar asked Feb 15 '26 17:02

Nick Gilbert


2 Answers

Many early computers had 36 bit architectures (http://en.m.wikipedia.org/wiki/36-bit) and octal makes a lot more sense for them, as 3 divides into 36 very nicely (12 has a lot of factors). Four also divides but its an odd number.

like image 158
user949300 Avatar answered Feb 21 '26 15:02

user949300


The reason why we use octal is in many ways the same as hexadecimal: we need a human readable format to quickly Identify bit strings. Just like the bit pattern of large binary data can (relatively) easily be described/specified and understood using hexadecimal, where each digit represents the exact binary pattern of for bits, where ever you would want to easily understand the bit string in groups of 3 you would use octal

the best example will be the unix file permissions: the read write and execute permissions for the owner,group, and 'other' users fall logically into 3 groups of 3 bits (rwxrwxrwx) it is most convenient to describe these logical blocks using octal. eg: rw-r--r-- will be 110100100 or 644

like image 42
staticd Avatar answered Feb 21 '26 15:02

staticd



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!