[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
Re: [Stds-754] motion: update exception and flag operations for consistency
This is item 20 for August. - Dan
Date: Wed, 2 Aug 2006 23:11:14 -0700 (PDT)
From: David Hough 754R work <754r@xxxxxxxxxxx>
Subject: [Stds-754] motion: update exception and flag operations for
consistency
Motion: update exception and flag operations for consistency
Rationale: The style of the exceptions and flags operations interface
is not consistent with that of
the mode operations which the committee approved in the motion of Agenda
item #42 in June. This proposal addresses just this inconsistency.
Comment:
In June, motions #18 and #42 were both passed with similar majorities,
concerning the operations on flags and modes mentioned barely in 754,
and the operations for signaling exceptions which were more implied than
mentioned in 754.
Evidently both majorities of voters did not read the motions, did not notice
certain stylistic discrepancies, or didn't care. August motion #18 intends
to reconcile these operations consistent with one point of view,
and this motion #20 is based upon a different one.
This motion is based upon the point of view that the operations worth
standardizing are the ones that are important to application programmers
attempting to build portable applications upon the framework of this
standard. Application programs generally know which exceptions and flags
they want to deal with, and there's no value in forcing them to fit their
locutions into a more general framework that, if performance is to be obtained
in higher level languages, optimizing compilers will just have to undo.
So the standard should point language designers in that direction of
applicability rather than generality. But languages remain free to
implement things in a less convenient way if they prefer.
Text:
Nicely formatted:
<a
href="http://754r.ucbtest.org/motions/simplify-flags.pdf">http://754r.ucbtest.org/motions/simplify-flags.pdf</a>
Crudely formatted: [DEL] marks strikeout of existing text:
7.7.2 Exception signaling-computational operations
Implementations shall provide the following non-computational
operations to signal the exceptions specified by their names, invoking
either default or, if explicitly requested by the programmer, a
language-defined alternate handling:
- void signalInvalid(void):
- void signalDivideByZero(void):
- void signalOverflow(void):
- void signalUnderflow(void):
- void signalInexact(void):
[These are the operations most often used by application programmers,
who generally know which exceptions are at issue. The first, for
instance, is conceptually equivalent to
signalException(invalidException) - and could be defined that way in a
language - but not equivalent in performance unless optimizing
compilers recognize the programmer's original intent by undoing the
indirect locution. There is no need to signal multiple exceptions
simultaneously - no 754 operations do so, though they can appear to
raise two flags simultaneously - but only in default exception
handling.]
[DEL: This operation signals the exceptions specified by its operand,
invoking either default or, if explicitly requested by the programmer,
a language-defined alternate handling: :DEL]
[DEL: - void signalException(exceptionGroupType):
signals the exceptions specified in the exceptionGroupType operand,
which can represent any subset of the exceptions :DEL]
[DEL: Whether signalException additionally signals the inexact
exception whenever it signals overflow or underflow is language
defined. If signalException signals overflow and inexact or underflow
and inexact, then it signals overflow or underflow before inexact.
Otherwise, the order in which the exceptions are signaled is
unspecified. :DEL]
7.8.4 Operations on individual flags
Implementations shall provide the following non-computational
operations to raise, lower, and test individual status flags:
- void raiseInvalid(void):
- void raiseDivideByZero(void):
- void raiseOverflow(void):
- void raiseUnderflow(void):
- void raiseInexact(void):
- void lowerInvalid(void):
- void lowerDivideByZero(void):
- void lowerOverflow(void):
- void lowerUnderflow(void):
- void lowerInexact(void):
- boolean testInvalid(void):
- boolean testDivideByZero(void):
- boolean testOverflow(void):
- boolean testUnderflow(void):
- boolean testInexact(void):
[These are the operations most often used by application programmers,
who generally know which flags are at issue. The first, for instance,
is conceptually equivalent to raiseFlag(invalidFlag) - and could be
defined that way in a language - but not equivalent in performance
unless optimizing compilers recognize the programmer's original intent
by undoing the indirect locution. ]
[DEL: 7.8.4 Operations on subsets of flags :DEL]
[DEL: Implementations shall provide the following
non-computational operations that act upon multiple all status
flags collectively: :DEL]
[DEL: - void lowerFlag(exceptionGroupType): :DEL]
[DEL: lowers (clears) the flags corresponding to the exceptions
specified in the exceptionGroupType operand, which can represent any
subset of the exceptions :DEL]
[DEL: - boolean testFlag(exceptionGroupType): :DEL]
[DEL: queries whether any of the flags corresponding to the exceptions
specified in the exceptionGroupType operand, which can represent any
subset of the exceptions, are raised :DEL]
[DEL: - void restoreFlag(flagsType, exceptionGroupType): :DEL]
[DEL: restores the flags corresponding to the exceptions specified in
the exceptionGroupType operand, which can represent any subset of the
exceptions, to their state represented in the flagsType operand :DEL]
7.8.5 Operations on all flags
Implementations shall provide the following non-computational
operations that act upon all status flags collectively:
- flagsType saveFlags(void)
returns a representation of the state of all the flags. The return
values of the saveFlags operation are for use as the first operand
to the restoreFlag operation in the same program; this standard
does not require support for any other use.
- void restoreFlags(flagsType)
restores the state of all the flags. The return values of the
saveFlags operation are for use as the operand of the restoreFlags
operation in the same program; this standard does not require
support for any other use.
- void lowerFlags(void)
lowers all the status flags
[These are the operations most often used by system and library
programmers.]
[DEL: Implementations shall provide the following
non-computational operations that act upon all status flags
collectively: :DEL]
[DEL: - flagsType saveFlags(void) :DEL]
[DEL: returns a representation of the state of all the flags. The
return values of the saveFlags operation are for use as the first
operand to the restoreFlag operation in the same program; this
standard does not require support for any other use. :DEL]