Boost logo

Boost :

From: Guillaume Melquiond (gmelquio_at_[hidden])
Date: 2003-07-05 12:29:38


On Sat, 5 Jul 2003, Beman Dawes wrote:

> fpt_abs may do a unary "-" operation. I'm assuming, perhaps incorrectly,
> that is essentially subtraction and subject to a possible rounding error.

I don't think there is a system where the opposite of a representable
number would not be a representable number. So there should be no rounding
error when changing signs. At least not with IEEE-754 floating point
numbers.

Moreover, 0-x may lead to results different from -x. So changing sign is
essantially "not" a subtraction :-).

Guillaume

PS: for those who wonder how 0-x can be different from -x, think about
exceptional cases like x=0 or x=NaN.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk