[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
a question about formatOf operations
754R Draft 1.5.0 contains the language:
" 5.4.1 Arithmetic operations
Implementations shall provide the following formatOf general-computational
operations, for destinations of
all supported floating-point formats available for arithmetic, and,
for each destination format, for operands
of all supported floating-point formats available for arithmetic with the same
radix as the destination format.
formatOf-addition(source1, source2)
The operation addition(x, y) computes x + y. "
etc.
The intent is that for the listed operations, any combination of operand
formats of a particular radix can be combined and rounded only once to
any result format in that radix.
So in particular, if an implementation supports binary32, binary64,
and binary80 (or any other three binary formats), then it
"provides" a way to compute
binary64 = binary32 + binary80
with only one rounding error. The most likely implementation approach,
from a hardware point of view, is to have operations with homogeneous
operands and narrowing results, e.g.
binary32 = binary32 + binary32
binary32 = binary64 + binary64
binary32 = binary80 + binary80
binary64 = binary64 + binary64
binary64 = binary80 + binary80
binary80 = binary80 + binary80
all with only one rounding error,
and then all combinations can be fabricated from these operations
and exact widening conversions. That's expensive enough.
However my question is about programming language specification.
How exactly is one going to "provide" the most general forms of
these operations in C or Fortran and other languages likely to support
multiple floating-point types?
Because "provide" might mean defining and implementing a function which
might be passed by reference, it would seem that all of the odd
combinations like
binary64 = binary32 + binary80
might need to be given specific names and specific implementations
and this is getting to be pretty expensive in documentation and
implementation.
I'm wondering if this is an issue that anybody has thought about enough to
plan solutions, and if the benefit is proportionate to the cost.
[A similar issue arises with all the many kinds of conversions to all supported
integer types, required later in 5.4.1.]