Reason for divideEps in qwt
Hi,
I was wondering about QwtScaleArithmetic::divideEps method (and all other *-Eps-methods), like in the code below:
Code:
static const double _eps = 1.0e-6;
{
if ( numSteps == 0.0 || intervalSize == 0.0 )
return 0.0;
return ( intervalSize - ( _eps * intervalSize ) ) / numSteps;
}
What is the reason for subtracting a scaled epsilon before dividing? I assume it has something to do with rounding, rounding errors, or the imprecision of floating point math. Maybe someone can give an example were this actually matters?
Or is this code used for a totally different reason?
Best regards.
Re: Reason for divideEps in qwt
Quote:
What is the reason for subtracting a scaled epsilon before dividing? I assume it has something to do with rounding, rounding errors, or the imprecision of floating point math.
Yes exactly this.
Uwe