Twos complement assumption, other issues Laura Dickey 15 Jan 2005 17:44 UTC Re: Twos complement assumption, other issues Aubrey Jaffer 27 Jan 2005 19:00 UTC Re: Twos complement assumption, other issues Bradd W. Szonye 27 Jan 2005 19:04 UTC Re: Twos complement assumption, other issues Aubrey Jaffer 29 Jan 2005 00:53 UTC

Re: Twos complement assumption, other issues Aubrey Jaffer 29 Jan 2005 00:53 UTC

``` | Date: Thu, 27 Jan 2005 11:04:24 -0800
| From: "Bradd W. Szonye" <xxxxxx@szonye.com>
|
| Aubrey Jaffer wrote:
| >  Since we treat integers as having two's-complement negations,
| >  the two's-complement of an integer is its negation.  The
| >  one's-complement of an integer is computed by lognot:
| >
| >  (define (lognot n) (- -1 n))
|
| Isn't that backwards? Complement and negation are equivalent in
| ones- complement arithmetic; in twos-complement, the complement is
| equal to negation minus one.  Perhaps I'm not understanding your
| explanation clearly.

Taking the one's-complement of a number is the process of exchanging
'1' for '0' and '0' for '1'.  That is LOGNOT.

When we talk of *'s-complement representation, it is about which
process is used to negate a number.

SRFI-60 treats its integers as two's-complement.  Therefore the
process of taking the one's-complement is different from the native
negation.

It is difficult to keep straight.  In the specification section, the
description of LOGNOT incorrectly says two's-complement.

```