Average Error: 12.6 → 0.5
Time: 13.4s
Precision: 64
\[\frac{x \cdot \left(y + z\right)}{z}\]
\[\begin{array}{l} \mathbf{if}\;\frac{x \cdot \left(y + z\right)}{z} = -\infty:\\ \;\;\;\;x \cdot \frac{y + z}{z}\\ \mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \le -1.2760705430715326 \cdot 10^{130} \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \le 1.80046735081645386 \cdot 10^{-10}\right) \land \frac{x \cdot \left(y + z\right)}{z} \le 7.1424308487341901 \cdot 10^{294}:\\ \;\;\;\;\frac{x \cdot \left(y + z\right)}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{z}{y + 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:\\
\;\;\;\;x \cdot \frac{y + z}{z}\\

\mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \le -1.2760705430715326 \cdot 10^{130} \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \le 1.80046735081645386 \cdot 10^{-10}\right) \land \frac{x \cdot \left(y + z\right)}{z} \le 7.1424308487341901 \cdot 10^{294}:\\
\;\;\;\;\frac{x \cdot \left(y + z\right)}{z}\\

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

\end{array}
double f(double x, double y, double z) {
        double r326511 = x;
        double r326512 = y;
        double r326513 = z;
        double r326514 = r326512 + r326513;
        double r326515 = r326511 * r326514;
        double r326516 = r326515 / r326513;
        return r326516;
}

double f(double x, double y, double z) {
        double r326517 = x;
        double r326518 = y;
        double r326519 = z;
        double r326520 = r326518 + r326519;
        double r326521 = r326517 * r326520;
        double r326522 = r326521 / r326519;
        double r326523 = -inf.0;
        bool r326524 = r326522 <= r326523;
        double r326525 = r326520 / r326519;
        double r326526 = r326517 * r326525;
        double r326527 = -1.2760705430715326e+130;
        bool r326528 = r326522 <= r326527;
        double r326529 = 1.8004673508164539e-10;
        bool r326530 = r326522 <= r326529;
        double r326531 = !r326530;
        double r326532 = 7.14243084873419e+294;
        bool r326533 = r326522 <= r326532;
        bool r326534 = r326531 && r326533;
        bool r326535 = r326528 || r326534;
        double r326536 = r326519 / r326520;
        double r326537 = r326517 / r326536;
        double r326538 = r326535 ? r326522 : r326537;
        double r326539 = r326524 ? r326526 : r326538;
        return r326539;
}

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.6
Target3.1
Herbie0.5
\[\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.1

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

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

    if -inf.0 < (/ (* x (+ y z)) z) < -1.2760705430715326e+130 or 1.8004673508164539e-10 < (/ (* x (+ y z)) z) < 7.14243084873419e+294

    1. Initial program 0.2

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

    if -1.2760705430715326e+130 < (/ (* x (+ y z)) z) < 1.8004673508164539e-10 or 7.14243084873419e+294 < (/ (* x (+ y z)) z)

    1. Initial program 12.9

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x \cdot \left(y + z\right)}{z} = -\infty:\\ \;\;\;\;x \cdot \frac{y + z}{z}\\ \mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \le -1.2760705430715326 \cdot 10^{130} \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \le 1.80046735081645386 \cdot 10^{-10}\right) \land \frac{x \cdot \left(y + z\right)}{z} \le 7.1424308487341901 \cdot 10^{294}:\\ \;\;\;\;\frac{x \cdot \left(y + z\right)}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{z}{y + z}}\\ \end{array}\]

Reproduce

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