Average Error: 12.4 → 0.8
Time: 10.2s
Precision: 64
\[\frac{x \cdot \left(y + z\right)}{z}\]
\[\begin{array}{l} \mathbf{if}\;\frac{\left(y + z\right) \cdot x}{z} = -\infty:\\ \;\;\;\;x + \frac{x}{z} \cdot y\\ \mathbf{elif}\;\frac{\left(y + z\right) \cdot x}{z} \le -3.29607326624137812320100595795931176341 \cdot 10^{166} \lor \neg \left(\frac{\left(y + z\right) \cdot x}{z} \le 5.202634720474758820046443901709134862331 \cdot 10^{-23}\right) \land \frac{\left(y + z\right) \cdot x}{z} \le 6.000688925971464265220404848603213842526 \cdot 10^{299}:\\ \;\;\;\;\frac{\left(y + z\right) \cdot x}{z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y + z}{z}\\ \end{array}\]
\frac{x \cdot \left(y + z\right)}{z}
\begin{array}{l}
\mathbf{if}\;\frac{\left(y + z\right) \cdot x}{z} = -\infty:\\
\;\;\;\;x + \frac{x}{z} \cdot y\\

\mathbf{elif}\;\frac{\left(y + z\right) \cdot x}{z} \le -3.29607326624137812320100595795931176341 \cdot 10^{166} \lor \neg \left(\frac{\left(y + z\right) \cdot x}{z} \le 5.202634720474758820046443901709134862331 \cdot 10^{-23}\right) \land \frac{\left(y + z\right) \cdot x}{z} \le 6.000688925971464265220404848603213842526 \cdot 10^{299}:\\
\;\;\;\;\frac{\left(y + z\right) \cdot x}{z}\\

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

\end{array}
double f(double x, double y, double z) {
        double r338055 = x;
        double r338056 = y;
        double r338057 = z;
        double r338058 = r338056 + r338057;
        double r338059 = r338055 * r338058;
        double r338060 = r338059 / r338057;
        return r338060;
}

double f(double x, double y, double z) {
        double r338061 = y;
        double r338062 = z;
        double r338063 = r338061 + r338062;
        double r338064 = x;
        double r338065 = r338063 * r338064;
        double r338066 = r338065 / r338062;
        double r338067 = -inf.0;
        bool r338068 = r338066 <= r338067;
        double r338069 = r338064 / r338062;
        double r338070 = r338069 * r338061;
        double r338071 = r338064 + r338070;
        double r338072 = -3.296073266241378e+166;
        bool r338073 = r338066 <= r338072;
        double r338074 = 5.202634720474759e-23;
        bool r338075 = r338066 <= r338074;
        double r338076 = !r338075;
        double r338077 = 6.000688925971464e+299;
        bool r338078 = r338066 <= r338077;
        bool r338079 = r338076 && r338078;
        bool r338080 = r338073 || r338079;
        double r338081 = r338063 / r338062;
        double r338082 = r338064 * r338081;
        double r338083 = r338080 ? r338066 : r338082;
        double r338084 = r338068 ? r338071 : r338083;
        return r338084;
}

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.4
Target2.9
Herbie0.8
\[\frac{x}{\frac{z}{y + z}}\]

Derivation

  1. Split input into 3 regimes
  2. if (/ (* x (+ y z)) z) < -inf.0

    1. Initial program 64.0

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

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

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

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

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

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

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

    if -inf.0 < (/ (* x (+ y z)) z) < -3.296073266241378e+166 or 5.202634720474759e-23 < (/ (* x (+ y z)) z) < 6.000688925971464e+299

    1. Initial program 0.2

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

    if -3.296073266241378e+166 < (/ (* x (+ y z)) z) < 5.202634720474759e-23 or 6.000688925971464e+299 < (/ (* x (+ y z)) z)

    1. Initial program 12.3

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\left(y + z\right) \cdot x}{z} = -\infty:\\ \;\;\;\;x + \frac{x}{z} \cdot y\\ \mathbf{elif}\;\frac{\left(y + z\right) \cdot x}{z} \le -3.29607326624137812320100595795931176341 \cdot 10^{166} \lor \neg \left(\frac{\left(y + z\right) \cdot x}{z} \le 5.202634720474758820046443901709134862331 \cdot 10^{-23}\right) \land \frac{\left(y + z\right) \cdot x}{z} \le 6.000688925971464265220404848603213842526 \cdot 10^{299}:\\ \;\;\;\;\frac{\left(y + z\right) \cdot x}{z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y + z}{z}\\ \end{array}\]

Reproduce

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