Thread Links Date Links
Thread Prev Thread Next Thread Index Date Prev Date Next Date Index

Rounding rule for P1788/M0037.01



Vincent Lefèvre wrote:
>   "if there are two closest numbers, we use rounding to even,
>   i.e., select the one whose binary expansion ends in 0"
>
> This only makes sense for some number formats, even not all
> floating-point formats (as phrased above, for floating-point
> formats, the radix needs to be even and the precision >= 2).

Perhaps we should offer a friendly amendment to replace that
paragraph:

    "if there are two closest numbers, we use the default
    rounding mode defined for the format."

This would also allow COBOL to use ties-away-from-zero, which
is permitted by IEEE 754-2008 for decimal formats.

The problem with odd radices (or single-bit binary) is that
there is no deterministic unbiased rounding method.  So if we
wanted a generally-acceptable method applicable to all formats,
about the only ones that make sense are ties-away-from zero (a
method sanctioned by IEEE 754-2008) or ties-towards-zero (which
might have slightly less cumulative roundoff effects for formats
where ties-to-even does not work).

Michel.
---Sent: 2012-10-29 16:41:36 UTC