Average Error: 24.2 → 9.5
Time: 9.0s
Precision: binary64
\[\]
\[\]
double code(double x, double y, double z, double t, double a) {
	return ((double) (x + ((double) (((double) (((double) (y - x)) * ((double) (z - t)))) / ((double) (a - t))))));
}
double code(double x, double y, double z, double t, double a) {
	double VAR;
	if (((a <= -5.1545916501600656e-51) || !(a <= 3.17042561904086e-84))) {
		VAR = ((double) (x + ((double) (((double) (y - x)) / ((double) (((double) (a - t)) / ((double) (z - t))))))));
	} else {
		VAR = ((double) (y + ((double) (((double) (z / t)) * ((double) (x - y))))));
	}
	return VAR;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original24.2
Target9.1
Herbie9.5
\[\]

Derivation

  1. Split input into 2 regimes
  2. if a < -5.15459165016006555e-51 or 3.1704256190408599e-84 < a

    1. Initial program 22.2

      \[\]
    2. Simplified7.4

      \[\leadsto \]
    3. Using strategy rm
    4. Applied clear-num7.5

      \[\leadsto \]
    5. Using strategy rm
    6. Applied un-div-inv7.4

      \[\leadsto \]

    if -5.15459165016006555e-51 < a < 3.1704256190408599e-84

    1. Initial program 27.8

      \[\]
    2. Simplified18.9

      \[\leadsto \]
    3. Taylor expanded around inf 18.3

      \[\leadsto \]
    4. Simplified13.1

      \[\leadsto \]
  3. Recombined 2 regimes into one program.
  4. Final simplification9.5

    \[\leadsto \]

Reproduce

herbie shell --seed 2020180 
(FPCore (x y z t a)
  :name "Graphics.Rendering.Chart.Axis.Types:linMap from Chart-1.5.3"
  :precision binary64

  :herbie-target
  (if (< a -1.6153062845442575e-142) (+ x (* (/ (- y x) 1.0) (/ (- z t) (- a t)))) (if (< a 3.774403170083174e-182) (- y (* (/ z t) (- y x))) (+ x (* (/ (- y x) 1.0) (/ (- z t) (- a t))))))

  (+ x (/ (* (- y x) (- z t)) (- a t))))