Similar to LabTalk limit -r command, to round a set of min, max and increment values
int RoundLimits( double * pmin, double * pmax, double * pinc, int nSteps = 8, int nType = LINEAR_SPACE )
If this function success, the return value is the number of steps determined after the rounding, otherwise a negative value will be returned.
EX1
void RoundLimits_ex1() { double x1 = -23.4; double x2 = 235.89; double xinc; int nSteps = RoundLimits(&x1, &x2, &xinc); printf("After rounding, the result is %d divisions, from %f to %f with an increment of %f\n", nSteps, x1, x2, xinc); // we next force increment to a particular value to redo rounding xinc = 50; nSteps =RoundLimits(&x1, &x2, &xinc, 0); printf("Forcing increment to be 50, the result is %d divisions, from %f to %f with an increment of %f\n", nSteps, x1, x2, xinc); }
origin.h