From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10a146,a03ae7f4e53958e1 X-Google-Attributes: gid10a146,public X-Google-Thread: fac41,a03ae7f4e53958e1 X-Google-Attributes: gidfac41,public X-Google-Thread: 109fba,a03ae7f4e53958e1 X-Google-Attributes: gid109fba,public X-Google-Thread: 1014db,a03ae7f4e53958e1 X-Google-Attributes: gid1014db,public X-Google-Thread: 103376,8775b19e3c68a5dc X-Google-Attributes: gid103376,public X-Google-Thread: fa0ae,a03ae7f4e53958e1 X-Google-Attributes: gidfa0ae,public X-Google-Thread: 1094ba,a03ae7f4e53958e1 X-Google-Attributes: gid1094ba,public X-Google-Thread: 114809,a03ae7f4e53958e1 X-Google-Attributes: gid114809,public From: thornley@visi.com (David Thornley) Subject: Re: Which language pays most? Smalltalk, not C++ nor Java. Date: 1997/12/31 Message-ID: <68dvjv$m70$1@darla.visi.com>#1/1 X-Deja-AN: 311681754 References: <199712121931.LAA25389@sirius.infonex.com> <68bu22$geg$1@brie.direct.ca> <68c66j$ei3$1@client3.news.psi.net> NNTP-Posting-Date: 31 Dec 1997 11:32:47 CST Organization: Vector Internet Services, Inc. Newsgroups: comp.lang.fortran,comp.lang.c,comp.lang.c++,comp.lang.eiffel,comp.lang.java.programmer,comp.lang.smalltalk,comp.lang.perl.misc,comp.lang.ada,comp.edu Date: 1997-12-31T11:32:47-06:00 List-Id: In article <68c66j$ei3$1@client3.news.psi.net>, Dann Corbit wrote: >Robert Dewar wrote in message ... >>Kaz says >> >><>for sign reversal, you would have to depend on a particular platform's >>handling of overflow. On two's complement systems, overflow on addition or >>subtraction can be detected by examining the most significant bit of the >>result and those of the operands. This isn't true in general, however. >> >>It's possible to determine whether a given operation will occur by >>writing a test expression (or assertion) which itself does not invoke >>overflow. >>>> >> >> >>Yes, it is possible, but gruesome, especially for multiplication. And rather >>silly, since at the hardware level it is typically easy to detect overflow. > My preferred solution is the Common Lisp one. It will handle integers of any size, subject of course to machine limitation. I can write a program that will handle integers accurately, without overflow. The downside is the performance hit, but there are ways around that. First, I can introduce spot checks to see if my integers are staying in the "fixnum" range rather than the "bignum" range; second, I can use declarations to tell the compiler to optimize performance at the expense of safety. It fits in well with my attitude of getting it working without worrying about low-level optimization. -- David H. Thornley | These opinions are mine. I david@thornley.net | do give them freely to those http://www.thornley.net/~thornley/david/ | who run too slowly. O-