Average Error: 12.7 → 1.8
Time: 35.7s
Precision: 64
\[\frac{x \cdot \left(y + z\right)}{z}\]
\[\begin{array}{l} \mathbf{if}\;\frac{\left(y + z\right) \cdot x}{z} \le 6.664392603785444 \cdot 10^{+27}:\\ \;\;\;\;\frac{x}{\frac{z}{y + z}}\\ \mathbf{elif}\;\frac{\left(y + z\right) \cdot x}{z} \le 1.603991626425806 \cdot 10^{+271}:\\ \;\;\;\;\frac{x \cdot y}{z} + x\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{z}{y + 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 6.664392603785444 \cdot 10^{+27}:\\
\;\;\;\;\frac{x}{\frac{z}{y + z}}\\

\mathbf{elif}\;\frac{\left(y + z\right) \cdot x}{z} \le 1.603991626425806 \cdot 10^{+271}:\\
\;\;\;\;\frac{x \cdot y}{z} + x\\

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

\end{array}
double f(double x, double y, double z) {
        double r21737514 = x;
        double r21737515 = y;
        double r21737516 = z;
        double r21737517 = r21737515 + r21737516;
        double r21737518 = r21737514 * r21737517;
        double r21737519 = r21737518 / r21737516;
        return r21737519;
}

double f(double x, double y, double z) {
        double r21737520 = y;
        double r21737521 = z;
        double r21737522 = r21737520 + r21737521;
        double r21737523 = x;
        double r21737524 = r21737522 * r21737523;
        double r21737525 = r21737524 / r21737521;
        double r21737526 = 6.664392603785444e+27;
        bool r21737527 = r21737525 <= r21737526;
        double r21737528 = r21737521 / r21737522;
        double r21737529 = r21737523 / r21737528;
        double r21737530 = 1.603991626425806e+271;
        bool r21737531 = r21737525 <= r21737530;
        double r21737532 = r21737523 * r21737520;
        double r21737533 = r21737532 / r21737521;
        double r21737534 = r21737533 + r21737523;
        double r21737535 = r21737531 ? r21737534 : r21737529;
        double r21737536 = r21737527 ? r21737529 : r21737535;
        return r21737536;
}

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

Derivation

  1. Split input into 2 regimes
  2. if (/ (* x (+ y z)) z) < 6.664392603785444e+27 or 1.603991626425806e+271 < (/ (* x (+ y z)) z)

    1. Initial program 15.3

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

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

    if 6.664392603785444e+27 < (/ (* x (+ y z)) z) < 1.603991626425806e+271

    1. Initial program 0.2

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

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

      \[\leadsto \color{blue}{\frac{1}{\frac{\frac{z}{y + z}}{x}}}\]
    6. Taylor expanded around 0 0.2

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\left(y + z\right) \cdot x}{z} \le 6.664392603785444 \cdot 10^{+27}:\\ \;\;\;\;\frac{x}{\frac{z}{y + z}}\\ \mathbf{elif}\;\frac{\left(y + z\right) \cdot x}{z} \le 1.603991626425806 \cdot 10^{+271}:\\ \;\;\;\;\frac{x \cdot y}{z} + x\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{z}{y + z}}\\ \end{array}\]

Reproduce

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