Average Error: 6.7 → 0.9
Time: 3.7s
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 ((((double) (((double) (y * z)) - ((double) (z * t)))) <= -1.4081857819970173e+280)) {
		VAR = ((double) (((double) (x * ((double) (2.0 / z)))) / ((double) (y - t))));
	} else {
		double VAR_1;
		if (((((double) (((double) (y * z)) - ((double) (z * t)))) <= -3.639291069457733e-133) || (!(((double) (((double) (y * z)) - ((double) (z * t)))) <= 2.679802493275991e-121) && (((double) (((double) (y * z)) - ((double) (z * t)))) <= 6.238085171129462e+151)))) {
			VAR_1 = ((double) (((double) (x * 2.0)) / ((double) (((double) (y * z)) - ((double) (z * t))))));
		} else {
			VAR_1 = ((double) (((double) (x * ((double) (2.0 / ((double) (y - t)))))) / z));
		}
		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.7
Target2.0
Herbie0.9
\[\]

Derivation

  1. Split input into 3 regimes
  2. if (- (* y z) (* t z)) < -1.40818578199701733e280

    1. Initial program 16.9

      \[\]
    2. Simplified16.9

      \[\leadsto \]
    3. Using strategy rm
    4. Applied add-sqr-sqrt17.0

      \[\leadsto \]
    5. Applied times-frac15.8

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

      \[\leadsto \]
    7. Using strategy rm
    8. Applied associate-*r/0.3

      \[\leadsto \]
    9. Simplified0.1

      \[\leadsto \]

    if -1.40818578199701733e280 < (- (* y z) (* t z)) < -3.63929106945773292e-133 or 2.6798024932759908e-121 < (- (* y z) (* t z)) < 6.23808517112946158e151

    1. Initial program 0.3

      \[\]

    if -3.63929106945773292e-133 < (- (* y z) (* t z)) < 2.6798024932759908e-121 or 6.23808517112946158e151 < (- (* y z) (* t z))

    1. Initial program 12.6

      \[\]
    2. Simplified10.2

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

      \[\leadsto \]
    5. Applied times-frac9.8

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

      \[\leadsto \]
    7. Simplified2.2

      \[\leadsto \]
    8. Using strategy rm
    9. Applied associate-*l/2.0

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

    \[\leadsto \]

Reproduce

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