Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #7720

Re: Arithmetic overflow checking

From Wolfgang Draxinger <wdraxinger@darkstargames.de>
Newsgroups comp.lang.java.programmer, comp.lang.c
Subject Re: Arithmetic overflow checking
Date 2011-09-08 22:24 +0200
Organization (posted via) M-net Telekommunikations GmbH
Message-ID <20110908222442.3eda3e88@loki.yggdrasil.draxit.de> (permalink)
References (5 earlier) <pPqdnbD2qr5G7ovTnZ2dnUVZ_qednZ2d@earthlink.com> <3797038f-22d1-40b2-8c12-60db5a0976b8@t5g2000yqj.googlegroups.com> <20110908210243.710b9d01@loki.yggdrasil.draxit.de> <20110908211243.7932aa0c@loki.yggdrasil.draxit.de> <slrnj6i521.1t7i.willem@toad.stack.nl>

Cross-posted to 2 groups.

Show all headers | View raw


Am Thu, 8 Sep 2011 19:15:13 +0000 (UTC)
schrieb Willem <willem@toad.stack.nl>:

> So if an overflow condition typically occurs less than 1 in 10000
> times, the interrupt solution is better.

Theoretically yes, practically no!

It depends on the architecture. On ARM it doesn't matter at all, since
ALL instructions are conditional.

On x86 architecture due to pipelining and OOE the differences are not
measureable as well (the overflow case code executes in parallel and
may have been finished, before the code, creating the overflow executed
at all). Also the overflow condition will probably not do any
arithmetic, in contrast to the arithmetic that does overflow. So these
are separate functional units at work, so pipelining will execute them
in parallel.

Really, there no cost to speak of in doing overflow checks.


Wolfgang

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Find similar


Thread

Re: Arithmetic overflow checking Wolfgang Draxinger <wdraxinger@darkstargames.de> - 2011-09-08 21:02 +0200
  Re: Arithmetic overflow checking Wolfgang Draxinger <wdraxinger@darkstargames.de> - 2011-09-08 21:12 +0200
    Re: Arithmetic overflow checking Willem <willem@toad.stack.nl> - 2011-09-08 19:15 +0000
      Re: Arithmetic overflow checking Wolfgang Draxinger <wdraxinger@darkstargames.de> - 2011-09-08 22:24 +0200

csiph-web