Average Error: 12.7 → 2.0
Time: 11.8s
Precision: 64
\[\frac{x \cdot \left(y + z\right)}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \le -5902353266861854707684716951842930556928 \lor \neg \left(x \le 5.84007380562484519005819080598235169684 \cdot 10^{83}\right):\\ \;\;\;\;x \cdot \left(\frac{1}{z} \cdot \left(y + z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{y \cdot x}{z} + x\\ \end{array}\]
\frac{x \cdot \left(y + z\right)}{z}
\begin{array}{l}
\mathbf{if}\;x \le -5902353266861854707684716951842930556928 \lor \neg \left(x \le 5.84007380562484519005819080598235169684 \cdot 10^{83}\right):\\
\;\;\;\;x \cdot \left(\frac{1}{z} \cdot \left(y + z\right)\right)\\

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

\end{array}
double f(double x, double y, double z) {
        double r208391 = x;
        double r208392 = y;
        double r208393 = z;
        double r208394 = r208392 + r208393;
        double r208395 = r208391 * r208394;
        double r208396 = r208395 / r208393;
        return r208396;
}

double f(double x, double y, double z) {
        double r208397 = x;
        double r208398 = -5.902353266861855e+39;
        bool r208399 = r208397 <= r208398;
        double r208400 = 5.840073805624845e+83;
        bool r208401 = r208397 <= r208400;
        double r208402 = !r208401;
        bool r208403 = r208399 || r208402;
        double r208404 = 1.0;
        double r208405 = z;
        double r208406 = r208404 / r208405;
        double r208407 = y;
        double r208408 = r208407 + r208405;
        double r208409 = r208406 * r208408;
        double r208410 = r208397 * r208409;
        double r208411 = r208407 * r208397;
        double r208412 = r208411 / r208405;
        double r208413 = r208412 + r208397;
        double r208414 = r208403 ? r208410 : r208413;
        return r208414;
}

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

Derivation

  1. Split input into 2 regimes
  2. if x < -5.902353266861855e+39 or 5.840073805624845e+83 < x

    1. Initial program 28.2

      \[\frac{x \cdot \left(y + z\right)}{z}\]
    2. Simplified9.4

      \[\leadsto \color{blue}{\frac{y + z}{\frac{z}{x}}}\]
    3. Using strategy rm
    4. Applied associate-/r/0.1

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

      \[\leadsto \color{blue}{\left(\left(y + z\right) \cdot \frac{1}{z}\right)} \cdot x\]

    if -5.902353266861855e+39 < x < 5.840073805624845e+83

    1. Initial program 5.4

      \[\frac{x \cdot \left(y + z\right)}{z}\]
    2. Simplified13.8

      \[\leadsto \color{blue}{\frac{y + z}{\frac{z}{x}}}\]
    3. Taylor expanded around 0 2.9

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

      \[\leadsto \color{blue}{x + \frac{x}{z} \cdot y}\]
    5. Using strategy rm
    6. Applied associate-*l/2.9

      \[\leadsto x + \color{blue}{\frac{x \cdot y}{z}}\]
    7. Simplified2.9

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -5902353266861854707684716951842930556928 \lor \neg \left(x \le 5.84007380562484519005819080598235169684 \cdot 10^{83}\right):\\ \;\;\;\;x \cdot \left(\frac{1}{z} \cdot \left(y + z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{y \cdot x}{z} + x\\ \end{array}\]

Reproduce

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