Average Error: 12.5 → 3.0
Time: 2.9s
Precision: 64
\[\frac{x \cdot \left(y + z\right)}{z}\]
\[\begin{array}{l} \mathbf{if}\;z \le -2.15145309439867013 \cdot 10^{-167} \lor \neg \left(z \le 2.0059309513327617 \cdot 10^{-227}\right):\\ \;\;\;\;\frac{x}{\frac{z}{y + z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} \cdot \left(y + z\right)\\ \end{array}\]
\frac{x \cdot \left(y + z\right)}{z}
\begin{array}{l}
\mathbf{if}\;z \le -2.15145309439867013 \cdot 10^{-167} \lor \neg \left(z \le 2.0059309513327617 \cdot 10^{-227}\right):\\
\;\;\;\;\frac{x}{\frac{z}{y + z}}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{z} \cdot \left(y + z\right)\\

\end{array}
double code(double x, double y, double z) {
	return ((x * (y + z)) / z);
}
double code(double x, double y, double z) {
	double VAR;
	if (((z <= -2.15145309439867e-167) || !(z <= 2.0059309513327617e-227))) {
		VAR = (x / (z / (y + z)));
	} else {
		VAR = ((x / z) * (y + 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.5
Target3.2
Herbie3.0
\[\frac{x}{\frac{z}{y + z}}\]

Derivation

  1. Split input into 2 regimes
  2. if z < -2.15145309439867e-167 or 2.0059309513327617e-227 < z

    1. Initial program 12.6

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

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

    if -2.15145309439867e-167 < z < 2.0059309513327617e-227

    1. Initial program 11.6

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -2.15145309439867013 \cdot 10^{-167} \lor \neg \left(z \le 2.0059309513327617 \cdot 10^{-227}\right):\\ \;\;\;\;\frac{x}{\frac{z}{y + z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} \cdot \left(y + z\right)\\ \end{array}\]

Reproduce

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