Average Error: 12.7 → 0.6
Time: 1.6s
Precision: 64
\[\frac{x \cdot \left(y + z\right)}{z}\]
\[\begin{array}{l} \mathbf{if}\;\frac{x \cdot \left(y + z\right)}{z} = -inf.0:\\ \;\;\;\;\frac{x}{z} \cdot \left(y + z\right)\\ \mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \le -7.49079041143360216 \cdot 10^{121}:\\ \;\;\;\;\frac{x \cdot \left(y + z\right)}{z}\\ \mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \le 3.7398528169995593 \cdot 10^{-25}:\\ \;\;\;\;x \cdot \frac{y + z}{z}\\ \mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \le 1.7843898618341535 \cdot 10^{296}:\\ \;\;\;\;\frac{x \cdot \left(y + z\right)}{z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y + z}{z}\\ \end{array}\]
\frac{x \cdot \left(y + z\right)}{z}
\begin{array}{l}
\mathbf{if}\;\frac{x \cdot \left(y + z\right)}{z} = -inf.0:\\
\;\;\;\;\frac{x}{z} \cdot \left(y + z\right)\\

\mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \le -7.49079041143360216 \cdot 10^{121}:\\
\;\;\;\;\frac{x \cdot \left(y + z\right)}{z}\\

\mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \le 3.7398528169995593 \cdot 10^{-25}:\\
\;\;\;\;x \cdot \frac{y + z}{z}\\

\mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \le 1.7843898618341535 \cdot 10^{296}:\\
\;\;\;\;\frac{x \cdot \left(y + z\right)}{z}\\

\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y + z}{z}\\

\end{array}
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)) <= -inf.0)) {
		VAR = ((double) (((double) (x / z)) * ((double) (y + z))));
	} else {
		double VAR_1;
		if ((((double) (((double) (x * ((double) (y + z)))) / z)) <= -7.490790411433602e+121)) {
			VAR_1 = ((double) (((double) (x * ((double) (y + z)))) / z));
		} else {
			double VAR_2;
			if ((((double) (((double) (x * ((double) (y + z)))) / z)) <= 3.7398528169995593e-25)) {
				VAR_2 = ((double) (x * ((double) (((double) (y + z)) / z))));
			} else {
				double VAR_3;
				if ((((double) (((double) (x * ((double) (y + z)))) / z)) <= 1.7843898618341535e+296)) {
					VAR_3 = ((double) (((double) (x * ((double) (y + z)))) / z));
				} else {
					VAR_3 = ((double) (x * ((double) (((double) (y + z)) / z))));
				}
				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.7
Target3.2
Herbie0.6
\[\frac{x}{\frac{z}{y + z}}\]

Derivation

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

    1. Initial program 64.0

      \[\frac{x \cdot \left(y + z\right)}{z}\]
    2. Using strategy rm
    3. Applied associate-/l*0.1

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{y + z}}}\]
    4. Using strategy rm
    5. Applied associate-/r/0.2

      \[\leadsto \color{blue}{\frac{x}{z} \cdot \left(y + z\right)}\]

    if -inf.0 < (/ (* x (+ y z)) z) < -7.490790411433602e+121 or 3.7398528169995593e-25 < (/ (* x (+ y z)) z) < 1.7843898618341535e+296

    1. Initial program 0.2

      \[\frac{x \cdot \left(y + z\right)}{z}\]

    if -7.490790411433602e+121 < (/ (* x (+ y z)) z) < 3.7398528169995593e-25 or 1.7843898618341535e+296 < (/ (* x (+ y z)) z)

    1. Initial program 13.3

      \[\frac{x \cdot \left(y + z\right)}{z}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity13.3

      \[\leadsto \frac{x \cdot \left(y + z\right)}{\color{blue}{1 \cdot z}}\]
    4. Applied times-frac0.9

      \[\leadsto \color{blue}{\frac{x}{1} \cdot \frac{y + z}{z}}\]
    5. Simplified0.9

      \[\leadsto \color{blue}{x} \cdot \frac{y + z}{z}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x \cdot \left(y + z\right)}{z} = -inf.0:\\ \;\;\;\;\frac{x}{z} \cdot \left(y + z\right)\\ \mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \le -7.49079041143360216 \cdot 10^{121}:\\ \;\;\;\;\frac{x \cdot \left(y + z\right)}{z}\\ \mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \le 3.7398528169995593 \cdot 10^{-25}:\\ \;\;\;\;x \cdot \frac{y + z}{z}\\ \mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \le 1.7843898618341535 \cdot 10^{296}:\\ \;\;\;\;\frac{x \cdot \left(y + z\right)}{z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y + z}{z}\\ \end{array}\]

Reproduce

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