Average Error: 12.7 → 0.3
Time: 3.6s
Precision: binary64
\[\frac{x \cdot \left(y + z\right)}{z}\]
\[\begin{array}{l} \mathbf{if}\;\frac{x \cdot \left(y + z\right)}{z} = -inf.0 \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \le -3.42029972732376873 \cdot 10^{53} \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \le 1.04003448335013346 \cdot 10^{43} \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \le 2.34776453281329523 \cdot 10^{294}\right)\right)\right):\\ \;\;\;\;x \cdot \frac{y + z}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \left(y + z\right)}{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 \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \le -3.42029972732376873 \cdot 10^{53} \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \le 1.04003448335013346 \cdot 10^{43} \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \le 2.34776453281329523 \cdot 10^{294}\right)\right)\right):\\
\;\;\;\;x \cdot \frac{y + z}{z}\\

\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(y + z\right)}{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) || !((((double) (((double) (x * ((double) (y + z)))) / z)) <= -3.4202997273237687e+53) || !((((double) (((double) (x * ((double) (y + z)))) / z)) <= 1.0400344833501335e+43) || !(((double) (((double) (x * ((double) (y + z)))) / z)) <= 2.3477645328132952e+294))))) {
		VAR = ((double) (x * ((double) (((double) (y + z)) / z))));
	} else {
		VAR = ((double) (((double) (x * ((double) (y + z)))) / z));
	}
	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.3
\[\frac{x}{\frac{z}{y + z}}\]

Derivation

  1. Split input into 2 regimes
  2. if (/ (* x (+ y z)) z) < -inf.0 or -3.42029972732376873e53 < (/ (* x (+ y z)) z) < 1.04003448335013346e43 or 2.34776453281329523e294 < (/ (* x (+ y z)) z)

    1. Initial program 19.1

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

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

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

      \[\leadsto \color{blue}{x} \cdot \frac{y + z}{z}\]

    if -inf.0 < (/ (* x (+ y z)) z) < -3.42029972732376873e53 or 1.04003448335013346e43 < (/ (* x (+ y z)) z) < 2.34776453281329523e294

    1. Initial program 0.2

      \[\frac{x \cdot \left(y + z\right)}{z}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x \cdot \left(y + z\right)}{z} = -inf.0 \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \le -3.42029972732376873 \cdot 10^{53} \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \le 1.04003448335013346 \cdot 10^{43} \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \le 2.34776453281329523 \cdot 10^{294}\right)\right)\right):\\ \;\;\;\;x \cdot \frac{y + z}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \left(y + z\right)}{z}\\ \end{array}\]

Reproduce

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