Average Error: 6.8 → 2.5
Time: 5.3s
Precision: binary64
\[\]
\[\]
double code(double x, double y, double z, double t) {
	return ((double) (((double) (x * 2.0)) / ((double) (((double) (y * z)) - ((double) (t * z))))));
}
double code(double x, double y, double z, double t) {
	double VAR;
	if ((z <= -1.9170945823704876e+37)) {
		VAR = ((double) (1.0 / ((double) (((double) (y - t)) * ((double) (z / ((double) (x * 2.0))))))));
	} else {
		double VAR_1;
		if ((z <= 6.676781766092113e-43)) {
			VAR_1 = ((double) (((double) (x * 2.0)) / ((double) (z * ((double) (y - t))))));
		} else {
			VAR_1 = ((double) (((double) (x * ((double) (2.0 / z)))) / ((double) (y - t))));
		}
		VAR = VAR_1;
	}
	return VAR;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original6.8
Target2.2
Herbie2.5
\[\]

Derivation

  1. Split input into 3 regimes
  2. if z < -1.91709458237048765e37

    1. Initial program 11.8

      \[\]
    2. Simplified9.2

      \[\leadsto \]
    3. Using strategy rm
    4. Applied associate-*r/9.2

      \[\leadsto \]
    5. Using strategy rm
    6. Applied clear-num9.5

      \[\leadsto \]
    7. Simplified2.8

      \[\leadsto \]

    if -1.91709458237048765e37 < z < 6.676781766092113e-43

    1. Initial program 2.7

      \[\]
    2. Simplified3.0

      \[\leadsto \]
    3. Using strategy rm
    4. Applied associate-*r/2.7

      \[\leadsto \]

    if 6.676781766092113e-43 < z

    1. Initial program 8.9

      \[\]
    2. Simplified7.3

      \[\leadsto \]
    3. Using strategy rm
    4. Applied associate-*r/7.3

      \[\leadsto \]
    5. Using strategy rm
    6. Applied associate-/r*2.1

      \[\leadsto \]
    7. Simplified2.1

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

    \[\leadsto \]

Reproduce

herbie shell --seed 2020180 
(FPCore (x y z t)
  :name "Linear.Projection:infinitePerspective from linear-1.19.1.3, A"
  :precision binary64

  :herbie-target
  (if (< (/ (* x 2.0) (- (* y z) (* t z))) -2.559141628295061e-13) (* (/ x (* (- y t) z)) 2.0) (if (< (/ (* x 2.0) (- (* y z) (* t z))) 1.0450278273301259e-269) (/ (* (/ x z) 2.0) (- y t)) (* (/ x (* (- y t) z)) 2.0)))

  (/ (* x 2.0) (- (* y z) (* t z))))