[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Twos complement assumption, other issues

This page is part of the web mail archives of SRFI 60 from before July 7th, 2015. The new archives for SRFI 60 contain all messages, not just those from before July 7th, 2015.



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.
-- 
Bradd W. Szonye
http://www.szonye.com/bradd