Average Error: 24.4 → 10.1
Time: 5.8s
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 <= -8.279965384186068e-139)) {
		VAR = ((double) (x + ((double) (((double) (y - x)) * ((double) (1.0 / ((double) (((double) (a - t)) / ((double) (z - t))))))))));
	} else {
		double VAR_1;
		if ((a <= 1.3780460953492288e-82)) {
			VAR_1 = ((double) (y + ((double) (((double) (z * ((double) (x / t)))) - ((double) (y * ((double) (z / t))))))));
		} else {
			VAR_1 = ((double) (x + ((double) (((double) (y - x)) * ((double) (((double) (z - t)) * ((double) (1.0 / ((double) (a - t))))))))));
		}
		VAR = VAR_1;
	}
	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.4
Target9.5
Herbie10.1
\[\]

Derivation

  1. Split input into 3 regimes
  2. if a < -8.279965384186068e-139

    1. Initial program 22.9

      \[\]
    2. Simplified9.1

      \[\leadsto \]
    3. Using strategy rm
    4. Applied clear-num9.1

      \[\leadsto \]

    if -8.279965384186068e-139 < a < 1.37804609534922883e-82

    1. Initial program 28.2

      \[\]
    2. Simplified19.3

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

      \[\leadsto \]
    4. Simplified13.3

      \[\leadsto \]

    if 1.37804609534922883e-82 < a

    1. Initial program 22.6

      \[\]
    2. Simplified8.2

      \[\leadsto \]
    3. Using strategy rm
    4. Applied div-inv8.2

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

    \[\leadsto \]

Reproduce

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