
Gennaro Prota wrote:
Shouldn't the comment read 0/x or 0/anything?
Probably.
+ // the result really is zero here no matter what the denominator:
Unless the denominator is zero, in which case returning zero is a convention.
Not in this case: the code calculates relative error, if the numerator is zero then the relative error is zero whatever the denominator is (including zero).
Could you please clarify the context a bit? Would this, in general, be called also when numeric_limits is not specialized? When a specialization exists I would return (std::numeric_limits<>::max)(); when it doesn't, how can one be sure that an FPT can be constructed from the integer 1000000? Sorry if this is just noise; I just thought better *I* raise some noise now than some executable somewhere will do it later :-)
The patch is *only* called when numeric_limits is not specialised, there is already an "if" case to handle that, this just adds the "else" :-) John