Re: Integers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10-06-30 10:02 PM, David McGlone wrote:
Hi again

I'm trying to learn about octal numbers and I don't understand this:

Binary: 001000101111
breakdown: (001)= 1 (000)= 0 (101)=5 (111)=7

I know it's similar to unix permissions, but I'm not understanding where for
example: 111 = 7
In base 10, which you use every day, we go
0
1
2
3
4
5
6
7
8
9
10

The number 10 is the number of distinct digits we use.

In binary we only us two, 0 and 1, so 10 is 2 decimal

So we go

0 = 0 decimal
1 = 1 << important
10 = 2 << important
11 = 3
100 = 4 << important
101 = 5
110 = 6
111 = 7

So binary 111 is 4 + 2 + 1 = 7

Stephen

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux