Average Error: 12.4 → 1.2
Time: 11.6s
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 -7825814767530457880915367903964954624 \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \le 1.838059779037275385286090314095155048363 \cdot 10^{53}\right) \land \frac{x \cdot \left(y + z\right)}{z} \le 3.758543573875074846263052226259935491495 \cdot 10^{171}\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} = -\infty \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \le -7825814767530457880915367903964954624 \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \le 1.838059779037275385286090314095155048363 \cdot 10^{53}\right) \land \frac{x \cdot \left(y + z\right)}{z} \le 3.758543573875074846263052226259935491495 \cdot 10^{171}\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 r329434 = x;
        double r329435 = y;
        double r329436 = z;
        double r329437 = r329435 + r329436;
        double r329438 = r329434 * r329437;
        double r329439 = r329438 / r329436;
        return r329439;
}

double f(double x, double y, double z) {
        double r329440 = x;
        double r329441 = y;
        double r329442 = z;
        double r329443 = r329441 + r329442;
        double r329444 = r329440 * r329443;
        double r329445 = r329444 / r329442;
        double r329446 = -inf.0;
        bool r329447 = r329445 <= r329446;
        double r329448 = -7.825814767530458e+36;
        bool r329449 = r329445 <= r329448;
        double r329450 = 1.8380597790372754e+53;
        bool r329451 = r329445 <= r329450;
        double r329452 = !r329451;
        double r329453 = 3.758543573875075e+171;
        bool r329454 = r329445 <= r329453;
        bool r329455 = r329452 && r329454;
        bool r329456 = r329449 || r329455;
        double r329457 = !r329456;
        bool r329458 = r329447 || r329457;
        double r329459 = r329443 / r329442;
        double r329460 = r329440 * r329459;
        double r329461 = r329458 ? r329460 : r329445;
        return r329461;
}

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

Derivation

  1. Split input into 2 regimes
  2. if (/ (* x (+ y z)) z) < -inf.0 or -7.825814767530458e+36 < (/ (* x (+ y z)) z) < 1.8380597790372754e+53 or 3.758543573875075e+171 < (/ (* x (+ y z)) z)

    1. Initial program 17.0

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

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

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

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

    if -inf.0 < (/ (* x (+ y z)) z) < -7.825814767530458e+36 or 1.8380597790372754e+53 < (/ (* x (+ y z)) z) < 3.758543573875075e+171

    1. Initial program 0.2

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

    \[\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 -7825814767530457880915367903964954624 \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \le 1.838059779037275385286090314095155048363 \cdot 10^{53}\right) \land \frac{x \cdot \left(y + z\right)}{z} \le 3.758543573875074846263052226259935491495 \cdot 10^{171}\right):\\ \;\;\;\;x \cdot \frac{y + z}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \left(y + z\right)}{z}\\ \end{array}\]

Reproduce

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