Average Error: 12.4 → 0.8
Time: 14.2s
Precision: 64
\[\frac{x \cdot \left(y + z\right)}{z}\]
\[\begin{array}{l} \mathbf{if}\;\frac{x \cdot \left(y + z\right)}{z} = -\infty \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \le -4.045134593776475081238842750214028354482 \cdot 10^{44} \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \le 2.695397302024607118954686919516299646759 \cdot 10^{-102}\right) \land \frac{x \cdot \left(y + z\right)}{z} \le 1.963982869283896660652236439582473717883 \cdot 10^{219}\right):\\ \;\;\;\;\frac{y + z}{z} \cdot x\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \left(y + z\right)}{z}\\ \end{array}\]
\frac{x \cdot \left(y + z\right)}{z}
\begin{array}{l}
\mathbf{if}\;\frac{x \cdot \left(y + z\right)}{z} = -\infty \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \le -4.045134593776475081238842750214028354482 \cdot 10^{44} \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \le 2.695397302024607118954686919516299646759 \cdot 10^{-102}\right) \land \frac{x \cdot \left(y + z\right)}{z} \le 1.963982869283896660652236439582473717883 \cdot 10^{219}\right):\\
\;\;\;\;\frac{y + z}{z} \cdot x\\

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

\end{array}
double f(double x, double y, double z) {
        double r322177 = x;
        double r322178 = y;
        double r322179 = z;
        double r322180 = r322178 + r322179;
        double r322181 = r322177 * r322180;
        double r322182 = r322181 / r322179;
        return r322182;
}

double f(double x, double y, double z) {
        double r322183 = x;
        double r322184 = y;
        double r322185 = z;
        double r322186 = r322184 + r322185;
        double r322187 = r322183 * r322186;
        double r322188 = r322187 / r322185;
        double r322189 = -inf.0;
        bool r322190 = r322188 <= r322189;
        double r322191 = -4.045134593776475e+44;
        bool r322192 = r322188 <= r322191;
        double r322193 = 2.695397302024607e-102;
        bool r322194 = r322188 <= r322193;
        double r322195 = !r322194;
        double r322196 = 1.9639828692838967e+219;
        bool r322197 = r322188 <= r322196;
        bool r322198 = r322195 && r322197;
        bool r322199 = r322192 || r322198;
        double r322200 = !r322199;
        bool r322201 = r322190 || r322200;
        double r322202 = r322186 / r322185;
        double r322203 = r322202 * r322183;
        double r322204 = r322201 ? r322203 : r322188;
        return r322204;
}

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

Derivation

  1. Split input into 2 regimes
  2. if (/ (* x (+ y z)) z) < -inf.0 or -4.045134593776475e+44 < (/ (* x (+ y z)) z) < 2.695397302024607e-102 or 1.9639828692838967e+219 < (/ (* x (+ y z)) z)

    1. Initial program 21.1

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

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

      \[\leadsto \color{blue}{\frac{1}{\frac{\frac{z}{y + z}}{x}}}\]
    6. Using strategy rm
    7. Applied div-inv1.3

      \[\leadsto \frac{1}{\color{blue}{\frac{z}{y + z} \cdot \frac{1}{x}}}\]
    8. Applied add-cube-cbrt1.3

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

      \[\leadsto \color{blue}{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\frac{z}{y + z}} \cdot \frac{\sqrt[3]{1}}{\frac{1}{x}}}\]
    10. Simplified1.4

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

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

    if -inf.0 < (/ (* x (+ y z)) z) < -4.045134593776475e+44 or 2.695397302024607e-102 < (/ (* x (+ y z)) z) < 1.9639828692838967e+219

    1. Initial program 0.3

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x \cdot \left(y + z\right)}{z} = -\infty \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \le -4.045134593776475081238842750214028354482 \cdot 10^{44} \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \le 2.695397302024607118954686919516299646759 \cdot 10^{-102}\right) \land \frac{x \cdot \left(y + z\right)}{z} \le 1.963982869283896660652236439582473717883 \cdot 10^{219}\right):\\ \;\;\;\;\frac{y + z}{z} \cdot x\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \left(y + z\right)}{z}\\ \end{array}\]

Reproduce

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