Path: csiph.com!x330-a1.tempe.blueboxinc.net!aioe.org!news.glorb.com!postnews.google.com!news2.google.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail NNTP-Posting-Date: Sun, 15 May 2011 09:37:39 -0500 Date: Sun, 15 May 2011 07:37:37 -0700 From: Patricia Shanahan User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 MIME-Version: 1.0 Newsgroups: comp.lang.java.programmer Subject: Re: Java puzzler References: <4db69c13-878f-4806-adb2-a3c5adb1c48c@glegroupsg2000goo.googlegroups.com> <-8mdnSRPEIdA21HQnZ2dnUVZ_j2dnZ2d@earthlink.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Lines: 22 X-Usenet-Provider: http://www.giganews.com NNTP-Posting-Host: 75.8.126.96 X-Trace: sv3-bZhgtw2IlMh8pGmmwDhx4/KK7X9+gjwgumiX16pU8qdvjrmPGkpjCytpe2s2zPT+NA1e8YaSWW/rAyl!XRqWcW0gN0jtie/o/YIcvZsuqsFHZqaa5l9qSL3ICqVsWUb9i4Joy4C/Q7vzKtoPk4kTVcdbw53T!W9dCYbS8WCBa57zcePowRhs+HKi9lpbZxMY21Ntt7eI= X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 2819 Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:4118 On 5/15/2011 5:40 AM, markspace wrote: > On 5/15/2011 3:16 AM, Tom Anderson wrote: > >> Fair enough. I suppose my position is that this hardware ability has to >> be used in the service of some solidly well-defined software semantics. >> Throwing exceptions at random from arithmetic expressions is not what i >> think of as solidly well-defined. > > > I guess I'm not understanding what people think is wrong with the > semantics of "overflow." Overflow is very well defined. It's something > like 8 gates on the hardware level, and happens at the same speed as the > the add or subtract itself. I.e., about 1 CPU cycle in most cases nowadays. > > By contrast, the current semantics of integer math are that sometimes > you get the right answer and sometimes you don't. I consider that to be > non-deterministic. It is totally deterministic. It is just arithmetic modulo 2**32 for int, 2**64 for long etc. Patricia