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

Re: small correction to the Vienna Proposal



Le lundi 23 février 2009 à 11:14 -0700, Nelson H. F. Beebe a écrit :
> Chenyi Hu writes today:
> 
> >> I'd prefer m = 0.5 * (l + u) rather than m = l + 0.5*(u - l) because of
> >> 
> >> 1. Avoiding the loss of significance in performing u-l for narrow intervals
> >> 2. One less arithmetic operation.
> 
> Chenyi's alternative suffers from premature overflow when l and u are
> greater than half the maximum representable number.  The proposed form
> l + 0.5*(u - l) is safe.

It depends what you mean by "safe". Getting a midpoint that is not a
finite number (l big negative, u big positive) could break a lot of
things. So it would be better to ensure that the midpoint is always
finite:

set round down
m = l + 0.5 * (u - l)
r = -(m - u)

(Disclaimer, I have no idea if the formula above is always correct.)

Best regards,

Guillaume