[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
section 5.6.2 signalException
This section is broken worse than I'd realized.
What does it mean to signal an underflow, for instance?
The default handling for underflow is to compute a result depending
on the operation and operands, and if inexact,
raise the underflow flags and signal
the inexact exception. What does it mean to signal underflow, then, without
specifying at least a result?
How does the default or alternate underflow signal handler
know what to do to what?
If the program just wanted default handling it might have done that itself.
The explicit signalException is to elicit default or alternate handling.
I don't think we want to simulate a trap (by passing full details
of operation and operands).
It seems the least that is required for signaling the exceptions is to pass the
default result as operand and return the actual result as function value.
So the signalException operations at least need to be generic functions, e.g.:
sourceformat signalInexact ( sourceformat)
sourceformat signalUnderflow ( sourceformat)
sourceformat signalOverflow ( sourceformat)
sourceformat signalDivideByZero ( sourceformat)
sourceformat signalInvalid ( sourceformat)
which in C or Fortran might actually be implemented by passing the operand by
reference instead of value.
Even that doesn't address the case of an invalid exception for an operation
with no floating-point result. All the other exception envision an operation
producing a floating-point result.
The original motivation for 5.6.2 was to provide a way to signal exceptions,
eliciting whatever default or alternate exception handling might be enabled,
by means other than executing an appropriate arithmetic operation which might
get optimized away as dead code. I think we need to rethink
how to solve the larger problem.
One short term solution is to remove 5.6.2 entirely
pending further implementation experience.
Another is to put the generic operations
as above in section 9 as another optional section, reflecting the current
lack of implementation experience.