Average Error: 12.6 → 1.6
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} \le 117551755719498.03125 \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \le 1.49129745858446283124535579131507121905 \cdot 10^{305}\right):\\ \;\;\;\;x \cdot \frac{y + z}{z}\\ \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} \le 117551755719498.03125 \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \le 1.49129745858446283124535579131507121905 \cdot 10^{305}\right):\\
\;\;\;\;x \cdot \frac{y + z}{z}\\

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

\end{array}
double f(double x, double y, double z) {
        double r307461 = x;
        double r307462 = y;
        double r307463 = z;
        double r307464 = r307462 + r307463;
        double r307465 = r307461 * r307464;
        double r307466 = r307465 / r307463;
        return r307466;
}

double f(double x, double y, double z) {
        double r307467 = x;
        double r307468 = y;
        double r307469 = z;
        double r307470 = r307468 + r307469;
        double r307471 = r307467 * r307470;
        double r307472 = r307471 / r307469;
        double r307473 = 117551755719498.03;
        bool r307474 = r307472 <= r307473;
        double r307475 = 1.4912974585844628e+305;
        bool r307476 = r307472 <= r307475;
        double r307477 = !r307476;
        bool r307478 = r307474 || r307477;
        double r307479 = r307470 / r307469;
        double r307480 = r307467 * r307479;
        double r307481 = r307478 ? r307480 : r307472;
        return r307481;
}

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

Derivation

  1. Split input into 2 regimes
  2. if (/ (* x (+ y z)) z) < 117551755719498.03 or 1.4912974585844628e+305 < (/ (* x (+ y z)) z)

    1. Initial program 15.7

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

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

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

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

    if 117551755719498.03 < (/ (* x (+ y z)) z) < 1.4912974585844628e+305

    1. Initial program 0.2

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x \cdot \left(y + z\right)}{z} \le 117551755719498.03125 \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \le 1.49129745858446283124535579131507121905 \cdot 10^{305}\right):\\ \;\;\;\;x \cdot \frac{y + z}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \left(y + z\right)}{z}\\ \end{array}\]

Reproduce

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