
Dave Steffen wrote:
Well, IIRC BOOST_CHECK_CLOSE does a check for _relative error_. And you can't do relative error if one of the numbers is zero. From a conceptual point of view, relative error says that two values differ by an amount that is small relative to their magnitude. Zero has no magnitude, e.g. no information about what's small relative to it, so the question is meaningless.
Apologies: I saw the "small" but not the "or zero". Yes, that's something I've had to work around as well. Trouble is I suspect everyone has their own ideas about what represents failure in this case. I currently use: "Any zero or denormalised number is treated as if it were a zero", and that works for what I need. I suspect some folks will want either more or less strict conditions depending on what they're doing. John.