\mathsf{max}\left(\ell + 1, \mathsf{min}\left(h - 1, \left\lfloor\ell + \left(h - \ell\right) \cdot \frac{td - vld}{vhd - vld}\right\rfloor\right)\right)\mathsf{max}\left(\ell + 1, \mathsf{min}\left(h - 1, \left\lfloor\ell + \left(h - \ell\right) \cdot \frac{td - vld}{vhd - vld}\right\rfloor\right)\right)double code(double l, double h, double td, double vld, double vhd) {
return ((double) fmax(((double) (l + 1.0)), ((double) fmin(((double) (h - 1.0)), ((double) floor(((double) (l + ((double) (((double) (h - l)) * ((double) (((double) (td - vld)) / ((double) (vhd - vld))))))))))))));
}
double code(double l, double h, double td, double vld, double vhd) {
return ((double) fmax(((double) (l + 1.0)), ((double) fmin(((double) (h - 1.0)), ((double) floor(((double) (l + ((double) (((double) (h - l)) * ((double) (((double) (td - vld)) / ((double) (vhd - vld))))))))))))));
}



Bits error versus l



Bits error versus h



Bits error versus td



Bits error versus vld



Bits error versus vhd
Results
Initial program 1.3
Final simplification1.3
herbie shell --seed 2020153
(FPCore (l h td vld vhd)
:name "(fmax (+ l 1) (fmin (- h 1) (floor (+ l (* (- h l) (/ (- td vld) (- vhd vld)))))))"
:precision binary64
(fmax (+ l 1.0) (fmin (- h 1.0) (floor (+ l (* (- h l) (/ (- td vld) (- vhd vld))))))))