Average Error: 3.2 → 0.0
Time: 1.1s
Precision: binary64
\[\ell + \left(vhd - vld\right) \cdot \frac{td - vld}{vhd - vld}\]
\[\left(\ell + td\right) - vld\]
\ell + \left(vhd - vld\right) \cdot \frac{td - vld}{vhd - vld}
\left(\ell + td\right) - vld
double code(double l, double vhd, double vld, double td) {
	return ((double) (l + ((double) (((double) (vhd - vld)) * ((double) (((double) (td - vld)) / ((double) (vhd - vld))))))));
}
double code(double l, double vhd, double vld, double td) {
	return ((double) (((double) (l + td)) - vld));
}

Error

Bits error versus l

Bits error versus vhd

Bits error versus vld

Bits error versus td

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 3.2

    \[\ell + \left(vhd - vld\right) \cdot \frac{td - vld}{vhd - vld}\]
  2. Simplified0.0

    \[\leadsto \color{blue}{\left(\ell + td\right) - vld}\]
  3. Final simplification0.0

    \[\leadsto \left(\ell + td\right) - vld\]

Reproduce

herbie shell --seed 2020152 
(FPCore (l vhd vld td)
  :name "(+ l (* (- vhd vld) (/ (- td vld) (- vhd vld))))"
  :precision binary64
  (+ l (* (- vhd vld) (/ (- td vld) (- vhd vld)))))