Average Error: 11.5 → 0.3
Time: 11.4s
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}:\\ \;\;\;\;x \cdot \frac{y + z}{z}\\ \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}:\\ \;\;\;\;x \cdot \frac{y + z}{z}\\ \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}:\\
\;\;\;\;x \cdot \frac{y + z}{z}\\

\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}:\\
\;\;\;\;x \cdot \frac{y + z}{z}\\

\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 r31512088 = x;
        double r31512089 = y;
        double r31512090 = z;
        double r31512091 = r31512089 + r31512090;
        double r31512092 = r31512088 * r31512091;
        double r31512093 = r31512092 / r31512090;
        return r31512093;
}

double f(double x, double y, double z) {
        double r31512094 = y;
        double r31512095 = z;
        double r31512096 = r31512094 + r31512095;
        double r31512097 = x;
        double r31512098 = r31512096 * r31512097;
        double r31512099 = r31512098 / r31512095;
        double r31512100 = -2.2389291331518298e+293;
        bool r31512101 = r31512099 <= r31512100;
        double r31512102 = r31512096 / r31512095;
        double r31512103 = r31512097 * r31512102;
        double r31512104 = -9.34948411246003e-93;
        bool r31512105 = r31512099 <= r31512104;
        double r31512106 = 5.384956960514642e-98;
        bool r31512107 = r31512099 <= r31512106;
        double r31512108 = 1.1230700433709488e+308;
        bool r31512109 = r31512099 <= r31512108;
        double r31512110 = r31512097 / r31512095;
        double r31512111 = r31512096 * r31512110;
        double r31512112 = r31512109 ? r31512099 : r31512111;
        double r31512113 = r31512107 ? r31512103 : r31512112;
        double r31512114 = r31512105 ? r31512099 : r31512113;
        double r31512115 = r31512101 ? r31512103 : r31512114;
        return r31512115;
}

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 *-un-lft-identity19.3

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

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

      \[\leadsto \color{blue}{x} \cdot \frac{y + z}{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 *-un-lft-identity59.9

      \[\leadsto \frac{x \cdot \left(y + z\right)}{\color{blue}{1 \cdot z}}\]
    4. Applied *-commutative59.9

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

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

      \[\leadsto \color{blue}{\left(y + z\right)} \cdot \frac{x}{z}\]
  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}:\\ \;\;\;\;x \cdot \frac{y + z}{z}\\ \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}:\\ \;\;\;\;x \cdot \frac{y + z}{z}\\ \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))