Average Error: 12.6 → 1.8
Time: 2.9s
Precision: binary64
\[\]
\[\]
double code(double x, double y, double z) {
	return ((double) (((double) (x * ((double) (y + z)))) / z));
}
double code(double x, double y, double z) {
	double VAR;
	if ((((double) (((double) (x * ((double) (y + z)))) / z)) <= -9.806390852011462e+199)) {
		VAR = ((double) (x + ((double) (x * ((double) (y / z))))));
	} else {
		double VAR_1;
		if ((((double) (((double) (x * ((double) (y + z)))) / z)) <= -8.062485962730442e-22)) {
			VAR_1 = ((double) (x + ((double) (y * ((double) (x / z))))));
		} else {
			double VAR_2;
			if (((((double) (((double) (x * ((double) (y + z)))) / z)) <= 1.6972335314453705e+43) || !(((double) (((double) (x * ((double) (y + z)))) / z)) <= 1.2441665559299811e+243))) {
				VAR_2 = ((double) (x + ((double) (x * ((double) (y / z))))));
			} else {
				VAR_2 = ((double) (((double) (x * ((double) (y + z)))) / z));
			}
			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.6
Target3.1
Herbie1.8
\[\]

Derivation

  1. Split input into 3 regimes
  2. if (/ (* x (+ y z)) z) < -9.80639085201146162e199 or -8.0624859627304423e-22 < (/ (* x (+ y z)) z) < 1.6972335314453705e43 or 1.24416655592998115e243 < (/ (* x (+ y z)) z)

    1. Initial program 18.1

      \[\]
    2. Simplified1.9

      \[\leadsto \]

    if -9.80639085201146162e199 < (/ (* x (+ y z)) z) < -8.0624859627304423e-22

    1. Initial program 0.2

      \[\]
    2. Simplified4.6

      \[\leadsto \]
    3. Using strategy rm
    4. Applied add-cube-cbrt5.1

      \[\leadsto \]
    5. Applied *-un-lft-identity5.1

      \[\leadsto \]
    6. Applied times-frac5.2

      \[\leadsto \]
    7. Applied associate-*r*2.1

      \[\leadsto \]
    8. Simplified2.0

      \[\leadsto \]
    9. Taylor expanded around 0 0.2

      \[\leadsto \]
    10. Simplified2.5

      \[\leadsto \]

    if 1.6972335314453705e43 < (/ (* x (+ y z)) z) < 1.24416655592998115e243

    1. Initial program 0.2

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

    \[\leadsto \]

Reproduce

herbie shell --seed 2020190 
(FPCore (x y z)
  :name "Numeric.SpecFunctions:choose from math-functions-0.1.5.2"
  :precision binary64

  :herbie-target
  (/ x (/ z (+ y z)))

  (/ (* x (+ y z)) z))