[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
Re: a question about formatOf operations
binary64 = binary32 + binary80
I don't see any language issue here, in a language that provides
type declarations. Basically, in the absence of widenTo (perhaps
better named minWidth) specifications, the statement above denotes
a single operation. A language that wants to avoid the difficulty
of supporting the single rounding should define a widenTo rule and
make it the default, so only those who do care about the single
rounding would use the appropriate declarations to turn off widenTo
There isn't a lot of "shall" in clause 10 expression evaluation.
The formatOf operations are required however in clause 5.
What exactly a language does with a statement of the form
binary64 = binary32 + binary80
might vary, but usually it involves widening operands to a common format
and then performing the operation, rounding the result to that common format -
and in this case rounding again to the binary64 format - double rounding,
with usually no way to prevent it.
widenTo is optional and doesn't help getting single rounding.
But the formatOf operations are not optional,
in order to provide a mechanism to avoid the double rounding - usually by
widening
operands to a common format and then performing the operation, rounding the
result to the narrow format.
No matter what the default is, single or double rounding, there will have
to be some explicit operation name to get the other. That's the rub - how
many
of these explicit operation names have to be defined and implemented.
Implementation-wise, it is sufficient to OR the Inexact flag of the
wide arithmetic with the low-order bit (in binary), or to use the
equivalent of IBM's round-to-prepare-for-shorter-precision method
(in decimal), before performing the narrowing assignment with the
intended rounding mode.
As with all of 754R,
one can devote as much or as little hardware as desired to these operations.
All it affects is performance.