William Lupton wrote:
> Overflows, underflows and divide by zeroes are all errors and it is
> reasonable that they should cause exceptions. Would there be any
> support, though, for providing an architecture-independent method for
> controlling them (e.g. a hook routine that would be called whenever
> EPICS created a task)?
On my mv167 the following test
int exctest()
{
float x,y,z;
int i,j,k;
x = 1e35;
y = 0.0;
z = x/y;
printf("x %e y %e z %e\n",x,y,z);
x = 1e35;
y = 1e35;
z = x*y;
printf("x %e y %e z %e\n",x,y,z);
i = 100000;
j = 100000;
k = i*j;
printf("i %d j %d k %d\n",i,j,k);
i=1;
j=0;
k = i/j;
printf("i %d j %d k %d\n",i,j,k);
return(0);
}
produces
exctest
x 1.000000e+35 y 0.000000e+00 z Inf
x 1.000000e+35 y 1.000000e+35 z Inf
i 100000 j 100000 k 1410065408
Zero Divide
Program Counter: 0x007fdc40
Status Register: 0x3000
Access Address : 0x007fdc3c
Thus only divide by zero is being trapped.
I also have three comments about:
> Overflows, underflows and divide by zeroes are all errors and it is
> reasonable that they should cause exceptions.
1) It is not clear that under flows should be errors. For many
algorithms they can be expected. Back in my IBM scientific programming
days I wrote an assembly routine, callable by fortran, that turned off
underflow exceptions. It was widely used and not just by myself.
2) In c it has been common for implementations to ignore integer
overflow. It will be interesting to see what fails if these are now
trapped.
3) If we start trapping 1) or 2) what should we do? one possibility is:
a) provide a handler that issues an error and continues.
b) provide the ability for user code to temporily disable trap or
provide alternate handler.
Marty Kraimer
- References:
- Power PC floating point underflow William Lupton
- Navigate by Date:
- Prev:
Power PC floating point underflow William Lupton
- Next:
Re: Power PC floating point underflow William Lupton
- Index:
1994
1995
1996
1997
<1998>
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
Power PC floating point underflow William Lupton
- Next:
Re: Power PC floating point underflow William Lupton
- Index:
1994
1995
1996
1997
<1998>
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|