Average Error: 24.6 → 9.1
Time: 8.6s
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 (((((double) (x + ((double) (((double) (((double) (y - x)) * ((double) (z - t)))) / ((double) (a - t)))))) <= -1.8720817586345306e-286) || !(((double) (x + ((double) (((double) (((double) (y - x)) * ((double) (z - t)))) / ((double) (a - t)))))) <= 0.0))) {
		VAR = ((double) (x + ((double) (((double) (y - x)) * ((double) (((double) (z - t)) * ((double) (1.0 / ((double) (a - t))))))))));
	} else {
		VAR = ((double) (y + ((double) (((double) (z * ((double) (x / t)))) - ((double) (y * ((double) (z / t))))))));
	}
	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.6
Target9.6
Herbie9.1
\[\]

Derivation

  1. Split input into 2 regimes
  2. if (+ x (/ (* (- y x) (- z t)) (- a t))) < -1.87208175863453059e-286 or 0.0 < (+ x (/ (* (- y x) (- z t)) (- a t)))

    1. Initial program 21.5

      \[\]
    2. Simplified7.8

      \[\leadsto \]
    3. Using strategy rm
    4. Applied div-inv7.9

      \[\leadsto \]

    if -1.87208175863453059e-286 < (+ x (/ (* (- y x) (- z t)) (- a t))) < 0.0

    1. Initial program 59.0

      \[\]
    2. Simplified59.1

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

      \[\leadsto \]
    4. Simplified22.3

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

    \[\leadsto \]

Reproduce

herbie shell --seed 2020191 
(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))))