Average Error: 6.8 → 1.9
Time: 6.4s
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 <= -19228.415161329853)) {
		VAR = ((double) (((double) (x * ((double) (2.0 / z)))) / ((double) (y - t))));
	} else {
		double VAR_1;
		if ((z <= 1586623875675827.2)) {
			VAR_1 = ((double) (((double) (x * 2.0)) / ((double) (z * ((double) (y - t))))));
		} else {
			VAR_1 = ((double) (((double) (x / z)) * ((double) (2.0 / ((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
Target1.9
Herbie1.9
\[\]

Derivation

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

    1. Initial program 11.1

      \[\]
    2. Simplified9.1

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

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

      \[\leadsto \]

    if -19228.415161329853 < z < 1586623875675827.25

    1. Initial program 2.0

      \[\]
    2. Simplified2.3

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

      \[\leadsto \]

    if 1586623875675827.25 < z

    1. Initial program 11.3

      \[\]
    2. Simplified9.2

      \[\leadsto \]
    3. Using strategy rm
    4. Applied *-un-lft-identity9.2

      \[\leadsto \]
    5. Applied times-frac8.7

      \[\leadsto \]
    6. Applied associate-*r*2.0

      \[\leadsto \]
    7. Simplified1.9

      \[\leadsto \]
  3. Recombined 3 regimes into one program.
  4. Final simplification1.9

    \[\leadsto \]

Reproduce

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