No subject

Fred Tydeman validgh!uunet!ibmsupt!ibmpa!tydemanaSun.COM
Wed Jan 23 08:46:49 PST 1991


Subject: Exceptions: ANSI C vs IEEE-754
 
In an earlier posting, dated around Tue, 11 Sep 90 15:22:27, I made the
statements:
 
   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, without  generating any externally visible
   exceptions.
 
   IEEE-754 says  that sqrt(-1.0) shall  signal the  invalid operation
   exception.
 
   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?
 
Dave Prosser, of AT&T, and the ANSI C Draft Redactor, has provided the
answer.   There is no  conflict.  ANSI C  does not provide  a trapping
environment.   If one has called  a function to enable  trapping, then
one has called a function that is not part of ANSI C. Since a function
that is not part  of ANSI C has been called, the  program is no longer
strictly conforming to ANSI C. So either there is no trapping enabled,
in which case the program follows the ANSI C requirements, or there is
trapping  to  follow the  IEEE-754  requirements,  in which  case  the
program is no longer strictly ANSI C.
 
Fred Tydeman, IBM, Palo Alto, Calif., (415) 855-4430
Internet: tydemanaibmpa.awdpa.ibm.com   UUCP: uunet!ibmsupt!tydeman



More information about the Numeric-interest mailing list