Average Error: 11.5 → 0.3
Time: 10.8s
Precision: 64
\[\frac{x \cdot \left(y + z\right)}{z}\]
\[\begin{array}{l} \mathbf{if}\;\frac{\left(y + z\right) \cdot x}{z} \le -2.2389291331518298 \cdot 10^{+293}:\\ \;\;\;\;\frac{y + z}{z} \cdot x\\ \mathbf{elif}\;\frac{\left(y + z\right) \cdot x}{z} \le -9.34948411246003 \cdot 10^{-93}:\\ \;\;\;\;\frac{\left(y + z\right) \cdot x}{z}\\ \mathbf{elif}\;\frac{\left(y + z\right) \cdot x}{z} \le 5.384956960514642 \cdot 10^{-98}:\\ \;\;\;\;\frac{y + z}{z} \cdot x\\ \mathbf{elif}\;\frac{\left(y + z\right) \cdot x}{z} \le 1.1230700433709488 \cdot 10^{+308}:\\ \;\;\;\;\frac{\left(y + z\right) \cdot x}{z}\\ \mathbf{else}:\\ \;\;\;\;\left(y + z\right) \cdot \frac{x}{z}\\ \end{array}\]
\frac{x \cdot \left(y + z\right)}{z}
\begin{array}{l}
\mathbf{if}\;\frac{\left(y + z\right) \cdot x}{z} \le -2.2389291331518298 \cdot 10^{+293}:\\
\;\;\;\;\frac{y + z}{z} \cdot x\\

\mathbf{elif}\;\frac{\left(y + z\right) \cdot x}{z} \le -9.34948411246003 \cdot 10^{-93}:\\
\;\;\;\;\frac{\left(y + z\right) \cdot x}{z}\\

\mathbf{elif}\;\frac{\left(y + z\right) \cdot x}{z} \le 5.384956960514642 \cdot 10^{-98}:\\
\;\;\;\;\frac{y + z}{z} \cdot x\\

\mathbf{elif}\;\frac{\left(y + z\right) \cdot x}{z} \le 1.1230700433709488 \cdot 10^{+308}:\\
\;\;\;\;\frac{\left(y + z\right) \cdot x}{z}\\

\mathbf{else}:\\
\;\;\;\;\left(y + z\right) \cdot \frac{x}{z}\\

\end{array}
double f(double x, double y, double z) {
        double r23266930 = x;
        double r23266931 = y;
        double r23266932 = z;
        double r23266933 = r23266931 + r23266932;
        double r23266934 = r23266930 * r23266933;
        double r23266935 = r23266934 / r23266932;
        return r23266935;
}

double f(double x, double y, double z) {
        double r23266936 = y;
        double r23266937 = z;
        double r23266938 = r23266936 + r23266937;
        double r23266939 = x;
        double r23266940 = r23266938 * r23266939;
        double r23266941 = r23266940 / r23266937;
        double r23266942 = -2.2389291331518298e+293;
        bool r23266943 = r23266941 <= r23266942;
        double r23266944 = r23266938 / r23266937;
        double r23266945 = r23266944 * r23266939;
        double r23266946 = -9.34948411246003e-93;
        bool r23266947 = r23266941 <= r23266946;
        double r23266948 = 5.384956960514642e-98;
        bool r23266949 = r23266941 <= r23266948;
        double r23266950 = 1.1230700433709488e+308;
        bool r23266951 = r23266941 <= r23266950;
        double r23266952 = r23266939 / r23266937;
        double r23266953 = r23266938 * r23266952;
        double r23266954 = r23266951 ? r23266941 : r23266953;
        double r23266955 = r23266949 ? r23266945 : r23266954;
        double r23266956 = r23266947 ? r23266941 : r23266955;
        double r23266957 = r23266943 ? r23266945 : r23266956;
        return r23266957;
}

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

Original11.5
Target2.9
Herbie0.3
\[\frac{x}{\frac{z}{y + z}}\]

Derivation

  1. Split input into 3 regimes
  2. if (/ (* x (+ y z)) z) < -2.2389291331518298e+293 or -9.34948411246003e-93 < (/ (* x (+ y z)) z) < 5.384956960514642e-98

    1. Initial program 19.3

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

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

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

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

    if -2.2389291331518298e+293 < (/ (* x (+ y z)) z) < -9.34948411246003e-93 or 5.384956960514642e-98 < (/ (* x (+ y z)) z) < 1.1230700433709488e+308

    1. Initial program 0.3

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

    if 1.1230700433709488e+308 < (/ (* x (+ y z)) z)

    1. Initial program 59.9

      \[\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}}}\]
    4. Using strategy rm
    5. Applied associate-/r/0.1

      \[\leadsto \color{blue}{\frac{x}{z} \cdot \left(y + z\right)}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\left(y + z\right) \cdot x}{z} \le -2.2389291331518298 \cdot 10^{+293}:\\ \;\;\;\;\frac{y + z}{z} \cdot x\\ \mathbf{elif}\;\frac{\left(y + z\right) \cdot x}{z} \le -9.34948411246003 \cdot 10^{-93}:\\ \;\;\;\;\frac{\left(y + z\right) \cdot x}{z}\\ \mathbf{elif}\;\frac{\left(y + z\right) \cdot x}{z} \le 5.384956960514642 \cdot 10^{-98}:\\ \;\;\;\;\frac{y + z}{z} \cdot x\\ \mathbf{elif}\;\frac{\left(y + z\right) \cdot x}{z} \le 1.1230700433709488 \cdot 10^{+308}:\\ \;\;\;\;\frac{\left(y + z\right) \cdot x}{z}\\ \mathbf{else}:\\ \;\;\;\;\left(y + z\right) \cdot \frac{x}{z}\\ \end{array}\]

Reproduce

herbie shell --seed 2019158 
(FPCore (x y z)
  :name "Numeric.SpecFunctions:choose from math-functions-0.1.5.2"

  :herbie-target
  (/ x (/ z (+ y z)))

  (/ (* x (+ y z)) z))