# Octal

Gautam Sewani

Ranch Hand

Posts: 93

posted 14 years ago

I wanna know how to convert octal to decimal

and decimal to octal

and I also wanna know how to convert octal to binary and binary to octal

and how to convert hex to decimal and decimal to hex and hex to binary and binary to hex,

Where should I look for it?

and decimal to octal

and I also wanna know how to convert octal to binary and binary to octal

and how to convert hex to decimal and decimal to hex and hex to binary and binary to hex,

Where should I look for it?

La Vish

Ranch Hand

Posts: 161

Gautam Sewani

Ranch Hand

Posts: 93

posted 14 years ago

If we wanna do some bit shifting on an octal number manually,then we'll have to first convert it into a binary no. and then perform the shifting.

if a binary no. is like this:

00000011

then >>2 would mean:

11000000

coz 1 is shifted right,and other 1 is shifted right

IF i m wrong pls correct me

Thanks

if a binary no. is like this:

00000011

then >>2 would mean:

11000000

coz 1 is shifted right,and other 1 is shifted right

IF i m wrong pls correct me

Thanks

Mag Hoehme

Ranch Hand

Posts: 194

posted 14 years ago

Hi Gautam,

when you're doing bit shifting, the bits at the end (in the case of right shifting, >> ) are not rotated, as in your example, but simply fall off. Therefore:

0000 0011 >> 2 becomes 0000 0000 (which is zero).

Whether you have an octal, a decimal, a hexadecimal or even a binary number does not matter - internally they are all represented as binary numbers.

If in doubt, ask your compiler.

[ May 08, 2002: Message edited by: Mag Hoehme ]

when you're doing bit shifting, the bits at the end (in the case of right shifting, >> ) are not rotated, as in your example, but simply fall off. Therefore:

0000 0011 >> 2 becomes 0000 0000 (which is zero).

Whether you have an octal, a decimal, a hexadecimal or even a binary number does not matter - internally they are all represented as binary numbers.

If in doubt, ask your compiler.

[ May 08, 2002: Message edited by: Mag Hoehme ]

Mag