Exceptions
Tom MacDonald
sun!juniper.cray.com!tam
Tue Sep 11 18:38:25 PDT 1990
Forwarded message:
> From validgh!sun!uunet.UU.NET!ibmsupt!ibmpa!tydemanauunet.UU.NET Tue Sep 11 20:07:16 1990
> Date: Tue, 11 Sep 90 15:22:27 -0700
> From: validgh!sun!uunet.UU.NET!ibmsupt!ibmpa!tydemanauunet.UU.NET (Fred Tydeman)
> Message-Id: <9009112222.AA22453aibmpa.awdpa.ibm.com>
> To: sun!dgh!numeric-interestauunet.uu.net
>
> Subject: Exceptions: ANSI C vs IEEE-754
>
> There appears to be a direct conflict between ANSI C and IEEE-754 for
> what should happen on exceptions. For example, y = sqrt(-1.0);
>
> ANSI C says the each function (in math.h) shall execute as if it were
> a single operation, with generating any externally visible exceptions
> (ANSI C, February 14, 1990, section 4.5.1 Treatment of Error
> Conditions).
>
> IEEE-754 says that sqrt(-1.0) shall signal the invalid operation
> exception (IEEE Std 754-1985, section 7.1 Invalid Operation).
>
> In a trapping environment, this appears to be a direct conflict, as
> IEEE says to take a trap to a user trap handler, whereas ANSI C says
> that the user cannot see this exception and that the user's trap
> handler cannot be called.
>
> How is NCEG going to resolve this conflict?
> a single operation, with generating any externally visible exceptions
^^^^
should be: "without"
I say we define a new math library that is an alternative to the math
library present in the ANSI C standard. We could just provide two
environments. One that allows you to get by the ANSI certification
suite and another that provides reasonable exception handling.
Thus, we are not violating the ANSI standard - just side-stepping it.
NCEG 90-026 makes no mention of errno what-so-ever in section 4.2,
and errno is the source of the problem. This is exactly what I want to see.
However, it does state that section 4.2.1 <math.h> appends to
rather than replaces the ANSI <math.h>. Perhaps we could move
it all to <numeric.h>?
Let's have a contest to find a numerical application that actually uses errno.
Along with this we need intrinsic functions like SIN, COS, SQRT, etc.
Just like Fortran. Dave Hough has been telling us this for a long
time and he's right. This is what the numeric programmer wants
and it isn't that hard to add.
I also want an exponentiation operator.
Tom MacDonald
More information about the Numeric-interest
mailing list