Average Error: 12.4 → 3.0
Time: 2.4s
Precision: 64
\[\frac{x \cdot \left(y + z\right)}{z}\]
\[\begin{array}{l} \mathbf{if}\;y \le -4.63176067989680751 \cdot 10^{138}:\\ \;\;\;\;\frac{x}{z} \cdot \left(y + z\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{z}{y + z}}\\ \end{array}\]
\frac{x \cdot \left(y + z\right)}{z}
\begin{array}{l}
\mathbf{if}\;y \le -4.63176067989680751 \cdot 10^{138}:\\
\;\;\;\;\frac{x}{z} \cdot \left(y + z\right)\\

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

\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 ((y <= -4.6317606798968075e+138)) {
		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.4
Target3.0
Herbie3.0
\[\frac{x}{\frac{z}{y + z}}\]

Derivation

  1. Split input into 2 regimes
  2. if y < -4.6317606798968075e+138

    1. Initial program 12.0

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

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

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

    if -4.6317606798968075e+138 < y

    1. Initial program 12.5

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -4.63176067989680751 \cdot 10^{138}:\\ \;\;\;\;\frac{x}{z} \cdot \left(y + z\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{z}{y + z}}\\ \end{array}\]

Reproduce

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