Re: Arithmetic overflow checking
On July 24, 2011 22:13, in comp.lang.c, dave.thompson2@verizon.net wrote:
On Mon, 11 Jul 2011 21:31:11 -0700, Gene Wirchenko <genew@ocis.net>
wrote:
On Mon, 11 Jul 2011 21:51:28 -0400, Eric Sosman
<esosman@ieee-dot-org.invalid> wrote:
On 7/11/2011 5:54 PM, tm wrote:
[...]
Correct results can be computed without any slowdown,
when the CPU is able to trigger an overflow interupt.
A slowdown would only happen when an overflow occurs.
Computations without overflow would run at full speed.
Well, no. At least, not in any trap-capable architecture I've
seen. Three points:
[snipped nice explanation]
How about an example of such an architecture? A URL would be
fine. I believe that /370 had something like that for floating point,
but not for integer.
S/360 and all successors have masked interrupts for overflows in
'fixed-point' (integer) and decimal (BCD), and unmasked for (original)
floating-point now retronymed 'hex' floating-point. Since IIRC S/390
there is also 'binary' (IEEE) floating-point with its own separate and
more complicated status flags, masks and interrupt causes.
I can't find a usable ref on the IBM site,
You probably want IBM's documentation site. Here's a link to
z/Architecture Principles of Operations
http://publibfp.dhe.ibm.com/cgi-bin/bookmgr/download/DZ9ZR006.pdf?DT 080213005418&XKS=dz9zbk08
You want page 6-14 and after for "Program Interruption"; the various Data
Exceptions are documented there, including fixed, floating point, and IEEE
floating point data exceptions.
HTH
--
Lew Pitcher
Master Codewright & JOAT-in-training | Registered Linux User #112576
Me: http://pitcher.digitalfreehold.ca/ | Just Linux: http://justlinux.ca/
---------- Slackware - Because I know what I'm doing. ------