www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/03/05/21:42:46

From: Damian Yerrick <DONT DOT YOU DOT DAREd_yerrick AT hotmail DOT comSEND DOT SPAM>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: odd or even?
Organization: Pin Eight Software http://pineight.8m.com/
Message-ID: <fdv5csgus2u8g26uu8v7b370jt6jqcnovg@4ax.com>
References: <38BE28A9 DOT CD476C62 AT student DOT kuleuven DOT ac DOT be> <38BE4B85 DOT 1F5A0778 AT videotron DOT ca> <l5jsbs87qgu43hr16el30msklmmao5j2h1 AT 4ax DOT com> <38BE7E6D DOT 6FE78AC9 AT americasm01 DOT nt DOT com> <tsg0csclt7k7q6suq7vdcq2gua5aacq8kh AT 4ax DOT com> <89to3c$1th$1 AT antares DOT lu DOT erisoft DOT se>
X-Newsreader: Forte Agent 1.7/32.534
MIME-Version: 1.0
Lines: 53
X-Trace: +4EwKIhx5qMjK1XOQqxPODSN3AXpIJhCIbxe12PhQ51JaeYweQJkCRJ7YJT0WJKF/i1aVXf965HF!obpjEW9jTss1biHvgvk0Pr266PCodkX7n7NNYVqBRx2WjwBJZOepogD5QPfj8h4N8Otf/xeZ+BY8!/URHOaw=
X-Complaints-To: abuse AT gte DOT net
X-Abuse-Info: Please be sure to forward a copy of ALL headers
X-Abuse-Info: Otherwise we will be unable to process your complaint properly
NNTP-Posting-Date: Mon, 06 Mar 2000 00:43:04 GMT
Distribution: world
Date: Mon, 06 Mar 2000 00:43:04 GMT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

On 5 Mar 2000 13:39:56 GMT, eplmst AT lu DOT erisoft DOT se (Martin Stromberg)
wrote:

>Chris Mears (chris_mears AT softhome DOT net) wrote:
>: That "Campbell, Rolf [SKY:1U32:EXCH]" <moscoop AT americasm01 DOT nt DOT com>
>: really knows where his towel is.  On Thu, 02 Mar 2000 09:45:01 -0500,
>: he wrote:
>
>Ha-ha! Good reference!
>
>: >It should work fine with signed integers....
>: >-1 = 0xFFFFFFFF (lowest bit set)
>: >-2 = 0xFFFFFFFE (lowest bit not set)
>
>: Might not work on other machines, though.  (I honestly don't know,
>: I've never used a machine that wasn't 2's-complement)
>
>One's complement works as well:
>+0 = 0x00000000 (lowest bit not set)
>-0 = 0x80000000 (lowest bit not set)
>-1 = 0x80000001 (lowest bit set)
>-2 = 0x80000002 (lowest bit not set)

This isn't ones' complement.  This is called "sign bit" representation
and is one of the first things taught in Intro to Digital Logic
(EC130) here at Rose.

>What other interesting representations are there? 

There's ones' complement, where -foo = 0xffffffff xor foo

-2 0xfffffffd
-1 0xfffffffe
-0 0xffffffff
+0 0x00000000
+1 0x00000001
+2 0x00000002

When you add two ones' complement numbers, you also add the carry-out
to the final result.  This is slow; that's one reason why two's
complement was introduced.

And then there's floating point.  I'm not touching that
with a proverbial fifteen-millifurlong (3 m; 10 ft) pole.

-- 
Damian Yerrick  http://yerricde.tripod.com/
Comment on story ideas: http://home1.gte.net/frodo/quickjot.html
AOL is sucks! Find out why: http://anti-aol.org/faqs/aas/
View full sig: http://www.rose-hulman.edu/~yerricde/sig.html

This is McAfee VirusScan. Add these two lines to your .sig to
prevent the spread of .sig viruses.  http://www.mcafee.com/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019