\mathsf{max}\left(\ell, \mathsf{min}\left(\ell + \left(h - \ell\right) \cdot x, h\right)\right)\mathsf{max}\left(\ell, \mathsf{min}\left(\ell + \left(h - \ell\right) \cdot x, h\right)\right)double code(double l, double h, double x) {
return ((double) fmax(l, ((double) fmin(((double) (l + ((double) (((double) (h - l)) * x)))), h))));
}
double code(double l, double h, double x) {
return ((double) fmax(l, ((double) fmin(((double) (l + ((double) (((double) (h - l)) * x)))), h))));
}



Bits error versus l



Bits error versus h



Bits error versus x
Results
Initial program 0.0
Final simplification0.0
herbie shell --seed 2020153
(FPCore (l h x)
:name "(fmax l (fmin (+ l (* (- h l) x)) h))"
:precision binary64
(fmax l (fmin (+ l (* (- h l) x)) h)))