A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
The Java EE 7 Tutorial Volume 1 or Volume 2
this week in the
jQuery UI in Action
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
Reg. Bitwise NOT
Casting from long to byte
Right shift using array
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