A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Java in General
Two's complement significance
Joined: Jan 11, 2001
Jan 23, 2001 09:34:00
What is the significance of representing number in two's complement?
Joined: Sep 18, 2000
Jan 23, 2001 09:43:00
It allows for all bits to be represented while eliminating the embarrassing problem of having a positive and negative zero.
for example: an 8 bit number allows values of -128 to 127.
[This message has been edited by Steve Fahlbusch (edited January 23, 2001).]
Joined: Jun 03, 2000
Jan 23, 2001 10:19:00
Steve is correct.
For more discussion on this please refer to a
a discussion on Signed and Unsigned numbers
- which elaborates the discussion.
Take a Minute, Donate an Hour, Change a Life
I agree. Here's the link:
subject: Two's complement significance
Right shift using array
Reg. Bitwise NOT
Casting from long to byte
Using ~ (Unary bitwise complement) for Zero
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014