# right and left shifts for -ve numbers

madhuri vl

Ranch Hand

Posts: 86

Mukti Bajaj

Ranch Hand

Posts: 59

posted 15 years ago

Hi,

Check out this link....

http://www.hal-pc.org/%7Eclyndes/computer-arithmetic.html#COMPUTER-TWOS

The explanation given is very easy and will help you to clear you doubts.

HTPs

Mukti

Check out this link....

http://www.hal-pc.org/%7Eclyndes/computer-arithmetic.html#COMPUTER-TWOS

The explanation given is very easy and will help you to clear you doubts.

HTPs

Mukti

madhuri vl

Ranch Hand

Posts: 86

madhuri vl

Ranch Hand

Posts: 86

posted 15 years ago

Hi,

I got the site and understood fairly how to represent a negative number in binary form and left and right shift of postive numbers.

For example -13 binary is 1111 0011 and -13 >> 3 = 1111 1110.

I don't know how to interprete this as decimal number. Can anybody explain please?

Thanks in advance,

Madhuri.

I got the site and understood fairly how to represent a negative number in binary form and left and right shift of postive numbers.

For example -13 binary is 1111 0011 and -13 >> 3 = 1111 1110.

I don't know how to interprete this as decimal number. Can anybody explain please?

Thanks in advance,

Madhuri.

madhuri.

Jane Griscti

Ranch Hand

Posts: 3141

posted 15 years ago

Hi Madhuri,

Here's a link to some notes I have posted on Binary/Octal/Decimal/Hex converstions.

Hope they help.

------------------

Jane Griscti

Sun Certified Java 2 Programmer

[This message has been edited by Jane Griscti (edited February 12, 2001).]

Here's a link to some notes I have posted on Binary/Octal/Decimal/Hex converstions.

Hope they help.

------------------

Jane Griscti

Sun Certified Java 2 Programmer

[This message has been edited by Jane Griscti (edited February 12, 2001).]

Jane Griscti

SCJP, Co-author Mike Meyers' Java 2 Certification Passport

madhuri vl

Ranch Hand

Posts: 86

posted 15 years ago

Hi Jane,

The site given by you is so good but I still have the doubt for -13>>3 1111 1110 which is equal to -2. Even in your sight there is anumber -16>>2 which is equal to -4. The only part I did not understood is the calc part to arrive at -2 from

1111 1110 or in the -16 example. Please try to explain.

Madhuri.

The site given by you is so good but I still have the doubt for -13>>3 1111 1110 which is equal to -2. Even in your sight there is anumber -16>>2 which is equal to -4. The only part I did not understood is the calc part to arrive at -2 from

1111 1110 or in the -16 example. Please try to explain.

Madhuri.

madhuri.

Maja Grabovac

Greenhorn

Posts: 16

madhuri vl

Ranch Hand

Posts: 86

posted 15 years ago

Hi,

I got solution for this from Marcusgreen tutorials where he has an applet giving the result. Anyway thankyou and can u please show one example for a -ve num with >>>. like -2 >>> 2.

Thankyou in advance.

I got solution for this from Marcusgreen tutorials where he has an applet giving the result. Anyway thankyou and can u please show one example for a -ve num with >>>. like -2 >>> 2.

Thankyou in advance.

madhuri.