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: "BartC" Newsgroups: comp.lang.java.programmer,comp.lang.c Subject: Re: Arithmetic overflow checking Date: Tue, 12 Jul 2011 19:14:09 +0100 Organization: A noiseless patient Spider Lines: 1 Message-ID: References: <015aeb15-57db-48ab-9cd4-77f8448b632f@w24g2000yqw.googlegroups.com> <2rydnez7l-H5BYnTnZ2dnUVZ_vGdnZ2d@earthlink.com> <9LWdnZH2hdfmyYvTnZ2dnUVZ_vidnZ2d@posted.palinacquisition> <3797038f-22d1-40b2-8c12-60db5a0976b8@t5g2000yqj.googlegroups.com> <289ad570-65fc-49d8-9cc8-1f15d13ff3e3@gv8g2000vbb.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit Injection-Date: Tue, 12 Jul 2011 18:14:48 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="ySFDo36AujN+NJ7nQGUG6Q"; logging-data="16699"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18QRiiwCYnZiqghbXfUtJZG" X-MimeOLE: Produced By Microsoft MimeOLE V14.0.8089.726 In-Reply-To: X-Antivirus-Status: Clean X-Newsreader: Microsoft Windows Live Mail 14.0.8089.726 Importance: Normal X-Antivirus: avast! (VPS 110712-1, 12/07/2011), Outbound message Cancel-Lock: sha1:Cg9h8ZzpaU4inIGWaBjt9SNzVAI= X-Priority: 3 X-MSMail-Priority: Normal Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:6127 comp.lang.c:8182 "Malcolm McLean" wrote in message news:d16ec56b-6e94-473d-80b4-b2ddfcf58850@r18g2000vbs.googlegroups.com... > The problem is that 32 bit ints are large enough to count most things, > but not all. > > You can't give a different 32-bit integer to everyone in the world, Just give two each... > for example, nor to all the bytes of RAM you might reasonably have in > your desktop computer. No, you need up to 40-bits, if there is really a need to address every byte in each object, and in every task, uniquely. > 64 bit ints solve most of these problems, they can count the vast > majority of things we need to count. When you start doing arithmetic requiring bigger numbers, then 64-bits won't be enough either. If you're calculating factorials, it means you can go up to 20! instead of 12! Big deal... And if you're advocating always using 64-bits, whether it's needed or not, then you could be doubling or quadrupling memory needs, and bandwidth, unnecessarily. Especially on a machine with a natural word size of 32-bits. -- Bartc