Average Error: 1.3 → 1.3
Time: 1.4s
Precision: binary64
\[\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)\]
\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))))))))))))));
}

Error

Bits error versus l

Bits error versus h

Bits error versus td

Bits error versus vld

Bits error versus vhd

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 1.3

    \[\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)\]
  2. Final simplification1.3

    \[\leadsto \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)\]

Reproduce

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))))))))