Average Error: 12.7 → 3.6
Time: 1.5s
Precision: 64
\[\frac{x \cdot \left(y + z\right)}{z}\]
\[\begin{array}{l} \mathbf{if}\;z \le -2.7390615932918903 \cdot 10^{-281}:\\ \;\;\;\;x \cdot \left(\frac{y}{z} + 1\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{\frac{z}{x}} + x\\ \end{array}\]
\frac{x \cdot \left(y + z\right)}{z}
\begin{array}{l}
\mathbf{if}\;z \le -2.7390615932918903 \cdot 10^{-281}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} + 1\right)\\

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

\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.7390615932918903e-281)) {
		VAR = ((double) (x * ((double) (((double) (y / z)) + 1.0))));
	} else {
		VAR = ((double) (((double) (y / ((double) (z / x)))) + x));
	}
	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
Target2.8
Herbie3.6
\[\frac{x}{\frac{z}{y + z}}\]

Derivation

  1. Split input into 2 regimes
  2. if z < -2.7390615932918903e-281

    1. Initial program 12.5

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

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

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

      \[\leadsto \color{blue}{x} \cdot \frac{y + z}{z}\]
    6. Taylor expanded around 0 2.6

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

    if -2.7390615932918903e-281 < z

    1. Initial program 12.9

      \[\frac{x \cdot \left(y + z\right)}{z}\]
    2. Taylor expanded around 0 5.2

      \[\leadsto \color{blue}{\frac{x \cdot y}{z} + x}\]
    3. Using strategy rm
    4. Applied *-commutative5.2

      \[\leadsto \frac{\color{blue}{y \cdot x}}{z} + x\]
    5. Applied associate-/l*4.5

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

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

Reproduce

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