Average Error: 12.3 → 0.2
Time: 2.4s
Precision: binary64
\[\]
\[\]
double code(double x, double y, double z) {
	return ((double) (((double) (x * ((double) (y - z)))) / y));
}
double code(double x, double y, double z) {
	double VAR;
	if ((((double) (((double) (x * ((double) (y - z)))) / y)) <= -inf.0)) {
		VAR = ((double) (x / ((double) (y / ((double) (y - z))))));
	} else {
		double VAR_1;
		if ((((double) (((double) (x * ((double) (y - z)))) / y)) <= -9.27044634916613e+20)) {
			VAR_1 = ((double) (x + ((double) (((double) (x * z)) * ((double) (-1.0 / y))))));
		} else {
			double VAR_2;
			if ((((double) (((double) (x * ((double) (y - z)))) / y)) <= 92392680230831.23)) {
				VAR_2 = ((double) (x / ((double) (y / ((double) (y - z))))));
			} else {
				double VAR_3;
				if ((((double) (((double) (x * ((double) (y - z)))) / y)) <= 2.9608211504775197e+299)) {
					VAR_3 = ((double) (x + ((double) (((double) (x * z)) * ((double) (-1.0 / y))))));
				} else {
					VAR_3 = ((double) (x - ((double) (x * ((double) (z / y))))));
				}
				VAR_2 = VAR_3;
			}
			VAR_1 = VAR_2;
		}
		VAR = VAR_1;
	}
	return VAR;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original12.3
Target3.1
Herbie0.2
\[\]

Derivation

  1. Split input into 3 regimes
  2. if (/ (* x (- y z)) y) < -inf.0 or -9.27044634916613e20 < (/ (* x (- y z)) y) < 92392680230831.2344

    1. Initial program 14.1

      \[\]
    2. Using strategy rm
    3. Applied associate-/l*0.1

      \[\leadsto \]

    if -inf.0 < (/ (* x (- y z)) y) < -9.27044634916613e20 or 92392680230831.2344 < (/ (* x (- y z)) y) < 2.9608211504775197e299

    1. Initial program 0.2

      \[\]
    2. Simplified8.5

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

      \[\leadsto \]
    5. Applied associate-*r*0.2

      \[\leadsto \]

    if 2.9608211504775197e299 < (/ (* x (- y z)) y)

    1. Initial program 60.0

      \[\]
    2. Simplified1.1

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

    \[\leadsto \]

Reproduce

herbie shell --seed 2020190 
(FPCore (x y z)
  :name "Diagrams.Backend.Cairo.Internal:setTexture from diagrams-cairo-1.3.0.3"
  :precision binary64

  :herbie-target
  (if (< z -2.060202331921739e+104) (- x (/ (* z x) y)) (if (< z 1.6939766013828526e+213) (/ x (/ y (- y z))) (* (- y z) (/ x y))))

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