Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!nx02.iad01.newshosting.com!newshosting.com!news-out.readnews.com!transit3.readnews.com!postnews.google.com!o4g2000vbv.googlegroups.com!not-for-mail From: tm Newsgroups: comp.lang.java.programmer,comp.lang.c Subject: Re: Arithmetic overflow checking Followup-To: comp.lang.java.programmer, comp.lang.c Date: Tue, 12 Jul 2011 23:54:47 -0700 (PDT) Organization: http://groups.google.com Lines: 37 Message-ID: <990875cf-1497-49e6-a07d-1fd31c974e2d@o4g2000vbv.googlegroups.com> References: <015aeb15-57db-48ab-9cd4-77f8448b632f@w24g2000yqw.googlegroups.com> <9LWdnZH2hdfmyYvTnZ2dnUVZ_vidnZ2d@posted.palinacquisition> <3797038f-22d1-40b2-8c12-60db5a0976b8@t5g2000yqj.googlegroups.com> <289ad570-65fc-49d8-9cc8-1f15d13ff3e3@gv8g2000vbb.googlegroups.com> <1ca84a18-e879-4249-a9e2-cea8c1ad7b92@ct4g2000vbb.googlegroups.com> <20110712223904.5b2fa970@arcadia> <2f3ad5b5-4db9-4e26-9f5a-b449a8afbc3b@g12g2000yqd.googlegroups.com> NNTP-Posting-Host: 84.112.82.23 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1310540087 14073 127.0.0.1 (13 Jul 2011 06:54:47 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 13 Jul 2011 06:54:47 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: o4g2000vbv.googlegroups.com; posting-host=84.112.82.23; posting-account=269_QwoAAADSifhJt6OVa6bEjZR2ZMUB User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-Header-Order: HUALESNKRC X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; de; rv:1.9.2.18) Gecko/20110615 Ubuntu/10.10 (maverick) Firefox/3.6.18,gzip(gfe) Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:6152 comp.lang.c:8226 On 12 Jul., 23:18, Keith Thompson wrote: > tm writes: > > On 12 Jul., 22:39, Thomas Boell wrote: > >> On Tue, 12 Jul 2011 10:21:44 -0700 (PDT) > > >> tm wrote: > >> > Using 64 bit ints only shifts the problem, but does NOT > >> > solve it. Only overflow detection and unlimited precision > >> > integers > > >> =A0and unlimited amounts of RAM > > > Libraries supporting unlimited precision integers usually > > raise a MEMORY_EXCEPTION when there is not enough memory > > to represent an integer. At least my bigInteger library > > (see:http://seed7.sourceforge.net/libraries/bigint.htm) > > works this way. :-) > > Or, if they're in C rather than C++, they either return a result > or set errno to some value that indicates they've run out of memory. My librariy is written in C, but it raises a Seed7 exception in out of memory situations. :-) Does GMP set errno when it runs out of memory? I am not sure that Java can handle out of memory situations with an exception. Greetings Thomas Mertes -- Seed7 Homepage: http://seed7.sourceforge.net Seed7 - The extensible programming language: User defined statements and operators, abstract data types, templates without special syntax, OO with interfaces and multiple dispatch, statically typed, interpreted or compiled, portable, runs under linux/unix/windows.