Average Error: 12.3 → 2.2
Time: 1.7s
Precision: 64
\[\frac{x \cdot \left(y + z\right)}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \le 2.0734916858130907 \cdot 10^{-270} \lor \neg \left(x \le 4.09342771190518611 \cdot 10^{-16}\right):\\ \;\;\;\;\frac{x}{\frac{z}{y + z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{z} + x\\ \end{array}\]
\frac{x \cdot \left(y + z\right)}{z}
\begin{array}{l}
\mathbf{if}\;x \le 2.0734916858130907 \cdot 10^{-270} \lor \neg \left(x \le 4.09342771190518611 \cdot 10^{-16}\right):\\
\;\;\;\;\frac{x}{\frac{z}{y + z}}\\

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

\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 (((x <= 2.0734916858130907e-270) || !(x <= 4.093427711905186e-16))) {
		VAR = (x / (z / (y + z)));
	} else {
		VAR = (((x * y) / z) + 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.3
Target2.9
Herbie2.2
\[\frac{x}{\frac{z}{y + z}}\]

Derivation

  1. Split input into 2 regimes
  2. if x < 2.0734916858130907e-270 or 4.093427711905186e-16 < x

    1. Initial program 14.8

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

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

    if 2.0734916858130907e-270 < x < 4.093427711905186e-16

    1. Initial program 4.1

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le 2.0734916858130907 \cdot 10^{-270} \lor \neg \left(x \le 4.09342771190518611 \cdot 10^{-16}\right):\\ \;\;\;\;\frac{x}{\frac{z}{y + z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{z} + x\\ \end{array}\]

Reproduce

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