Average Error: 12.4 → 3.2
Time: 2.3s
Precision: binary64
\[\frac{x \cdot \left(y + z\right)}{z}\]
\[\begin{array}{l} \mathbf{if}\;z \le -7.2427517272985975 \cdot 10^{-264} \lor \neg \left(z \le 2.1672265956236841 \cdot 10^{-88}\right):\\ \;\;\;\;\frac{x}{\frac{z}{y + z}}\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot \left(y + z\right)\right) \cdot \frac{1}{z}\\ \end{array}\]
\frac{x \cdot \left(y + z\right)}{z}
\begin{array}{l}
\mathbf{if}\;z \le -7.2427517272985975 \cdot 10^{-264} \lor \neg \left(z \le 2.1672265956236841 \cdot 10^{-88}\right):\\
\;\;\;\;\frac{x}{\frac{z}{y + z}}\\

\mathbf{else}:\\
\;\;\;\;\left(x \cdot \left(y + z\right)\right) \cdot \frac{1}{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 (((z <= -7.2427517272985975e-264) || !(z <= 2.167226595623684e-88))) {
		VAR = ((double) (x / ((double) (z / ((double) (y + z))))));
	} else {
		VAR = ((double) (((double) (x * ((double) (y + z)))) * ((double) (1.0 / 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.4
Target3.3
Herbie3.2
\[\frac{x}{\frac{z}{y + z}}\]

Derivation

  1. Split input into 2 regimes
  2. if z < -7.2427517272985975e-264 or 2.1672265956236841e-88 < z

    1. Initial program 12.9

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

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

    if -7.2427517272985975e-264 < z < 2.1672265956236841e-88

    1. Initial program 10.3

      \[\frac{x \cdot \left(y + z\right)}{z}\]
    2. Using strategy rm
    3. Applied div-inv10.4

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -7.2427517272985975 \cdot 10^{-264} \lor \neg \left(z \le 2.1672265956236841 \cdot 10^{-88}\right):\\ \;\;\;\;\frac{x}{\frac{z}{y + z}}\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot \left(y + z\right)\right) \cdot \frac{1}{z}\\ \end{array}\]

Reproduce

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