home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.amiga.programmer
- Path: sparky!uunet!think.com!sdd.hp.com!col.hp.com!fc.hp.com!koren
- From: koren@fc.hp.com (Steve Koren)
- Subject: Re: SAS6.1 users: please read
- Sender: news@fc.hp.com (news daemon)
- Message-ID: <Bz81JE.Bp7@fc.hp.com>
- Date: Sun, 13 Dec 1992 23:35:38 GMT
- References: <Bz3zxI.2A8@unx.sas.com>
- Organization: Hewlett-Packard Fort Collins Site
- X-Newsreader: Tin 1.1.3 PL5
- Lines: 35
-
- Doug Walker (walker@twix.unx.sas.com) wrote:
-
- > be considering signed types wider than unsigned types, from looking at
- > your example with doubles and ints, but your term is "more general".
-
- No, I don't consider them wider, but I _do_ consider them more general.
- The maximum integer storable in a signed and unsigned int is, I think,
- an implementation accident on all accords. First, consider a CPU which
- used 64 bit ints but used only 63 bits for _both_ signed and unsigned
- ints, ignoring the sign bit in one case and using it in the other. In
- that case, there is no overflow problem because the maximum is the
- same for both signed and unsigned ints. Second, the likelihood of
- overflowing MAXINT is dependent on the size of the integer. Whether or
- not you overflow is just an accident of how the numbers happen to be
- stored.
-
- Contrast this to the sign loss problem. The sign is an integral property
- of the data type, and does not depend on the storage method or
- architecture of the CPU. By using ANSI's rules, you _always_ run into
- the sign loss problem, no matter how your CPU deals with signed vs.
- unsigned ints and no matter how big they are.
-
- Think of the problem outside of computer terms: integers have no maximum
- value, so you can't overflow them to loose information. But you can
- loose sign information using ANSI's promoting rules. Nothing says that
- a future generation of CPUs won't default to arbitrary precision math,
- thus making the overflow problem meaningless, but leaving the sign loss
- problem.
-
- My argument with ANSI is that I believe what they picked was both
- shortsighted and dependent on our current CPU's implementation of
- signed vs. unsigned ints.
-
- - steve
-
-