Average Error: 12.5 → 3.0
Time: 2.0s
Precision: 64
\[\frac{x \cdot \left(y + z\right)}{z}\]
\[\begin{array}{l} \mathbf{if}\;z \le -2.352586947984001 \cdot 10^{-127} \lor \neg \left(z \le -2.01859068287501424 \cdot 10^{-249}\right):\\ \;\;\;\;\frac{x}{\frac{z}{y + z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{z}}{\frac{1}{y + z}}\\ \end{array}\]
\frac{x \cdot \left(y + z\right)}{z}
\begin{array}{l}
\mathbf{if}\;z \le -2.352586947984001 \cdot 10^{-127} \lor \neg \left(z \le -2.01859068287501424 \cdot 10^{-249}\right):\\
\;\;\;\;\frac{x}{\frac{z}{y + z}}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{z}}{\frac{1}{y + 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 <= -2.352586947984001e-127) || !(z <= -2.0185906828750142e-249))) {
		VAR = ((double) (x / ((double) (z / ((double) (y + z))))));
	} else {
		VAR = ((double) (((double) (x / z)) / ((double) (1.0 / ((double) (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.0
Herbie3.0
\[\frac{x}{\frac{z}{y + z}}\]

Derivation

  1. Split input into 2 regimes
  2. if z < -2.352586947984001e-127 or -2.0185906828750142e-249 < z

    1. Initial program 12.8

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

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

    if -2.352586947984001e-127 < z < -2.0185906828750142e-249

    1. Initial program 9.1

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

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{y + z}}}\]
    4. Using strategy rm
    5. Applied div-inv9.3

      \[\leadsto \frac{x}{\color{blue}{z \cdot \frac{1}{y + z}}}\]
    6. Applied associate-/r*8.5

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

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

Reproduce

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