Average Error: 13.1 → 1.9
Time: 5.4s
Precision: binary64
\[\frac{x \cdot \left(y + z\right)}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \le -3.55850091344555163 \cdot 10^{110} \lor \neg \left(x \le 25947.6304069558137\right):\\ \;\;\;\;\frac{x}{\frac{z}{y + z}}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{x \cdot y}{z}\\ \end{array}\]
\frac{x \cdot \left(y + z\right)}{z}
\begin{array}{l}
\mathbf{if}\;x \le -3.55850091344555163 \cdot 10^{110} \lor \neg \left(x \le 25947.6304069558137\right):\\
\;\;\;\;\frac{x}{\frac{z}{y + z}}\\

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

\end{array}
double code(double x, double y, double z) {
	return (((double) (x * ((double) (y + z)))) / z);
}
double code(double x, double y, double z) {
	double VAR;
	if (((x <= -3.5585009134455516e+110) || !(x <= 25947.630406955814))) {
		VAR = (x / (z / ((double) (y + z))));
	} else {
		VAR = ((double) (x + (((double) (x * 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

Original13.1
Target3.3
Herbie1.9
\[\frac{x}{\frac{z}{y + z}}\]

Derivation

  1. Split input into 2 regimes
  2. if x < -3.55850091344555163e110 or 25947.6304069558137 < x

    1. Initial program 27.5

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

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

    if -3.55850091344555163e110 < x < 25947.6304069558137

    1. Initial program 5.7

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

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

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

Reproduce

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