Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Joshua Cranmer Newsgroups: comp.lang.java.programmer Subject: Re: Arithmetic overflow checking Date: Mon, 25 Jul 2011 10:20:48 -0700 Organization: A noiseless patient Spider Lines: 29 Message-ID: References: <015aeb15-57db-48ab-9cd4-77f8448b632f@w24g2000yqw.googlegroups.com> <2rydnez7l-H5BYnTnZ2dnUVZ_vGdnZ2d@earthlink.com> <4e278a67$0$309$14726298@news.sunsite.dk> <1SSVp.69032$_I7.18660@newsfe08.iad> <4b8422e6-9ad6-493e-b5a5-3c8a772851de@u6g2000prc.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Mon, 25 Jul 2011 17:20:49 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="Q8HyEFb0j2lB0WC1MU3ArQ"; logging-data="1845"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/dCcvvqz8FMpjaBRmgT5EIE3dsJ/Z9+Vw=" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.18) Gecko/20110616 Lightning/1.0b2 Thunderbird/3.1.11 In-Reply-To: Cancel-Lock: sha1:QnY1g8Cg9POa1nx+qBxAjDf3DW8= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:6539 On 7/23/2011 7:39 PM, supercalifragilisticexpialadiamaticonormalizeringelimatisticantations wrote: > On 23/07/2011 2:51 PM, lewbloch wrote: >> David Lamb wrote: >>> supercalifragilisticexpialadiamaticonormalizeringelimatisticantations >>> wrote: >>>> Eww. Mutable number classes. >>> >>> It's what happens to ordinary ints in most machine languages. Feel free >>> to define the less-efficient functional versions that always generate >>> new objects. The main point was that the method calls aren't necessarily >>> all that hard to read. >> >> The "Eww" poster seems fond of making tabloid statements devoid of >> engineering reasoning. > > Wrong. > > Ordinary ints aren't (in Java, at least, with no "int *" type) subject > to aliasing and other problems that a mutable Integer-analogue would be. Then I suppose you'd have no objection to making the Matrix class immutable and implicitly copying itself every time you do an operation. I really appreciate that when using Householders to find eigenvalues in my small 10Kx10K matrix. -- Beware of bugs in the above code; I have only proved it correct, not tried it. -- Donald E. Knuth