Average Error: 24.2 → 8.8
Time: 5.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)))))) <= -4.639554587483571e-281) || !(((double) (x + ((double) (((double) (((double) (y - x)) * ((double) (z - t)))) / ((double) (a - t)))))) <= 1.2826677504057426e-290))) {
		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.2
Target9.4
Herbie8.8
\[\]

Derivation

  1. Split input into 2 regimes
  2. if (+ x (/ (* (- y x) (- z t)) (- a t))) < -4.63955458748357079e-281 or 1.28267e-290 < (+ x (/ (* (- y x) (- z t)) (- a t)))

    1. Initial program 21.0

      \[\]
    2. Simplified7.2

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

      \[\leadsto \]

    if -4.63955458748357079e-281 < (+ x (/ (* (- y x) (- z t)) (- a t))) < 1.28267e-290

    1. Initial program 57.2

      \[\]
    2. Simplified56.7

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

      \[\leadsto \]
    4. Simplified24.0

      \[\leadsto \]
  3. Recombined 2 regimes into one program.
  4. Final simplification8.8

    \[\leadsto \]

Reproduce

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