Average Error: 12.0 → 1.0
Time: 10.2s
Precision: 64
\[\frac{x \cdot \left(y + z\right)}{z}\]
\[\begin{array}{l} \mathbf{if}\;\frac{x \cdot \left(y + z\right)}{z} \le -5.96598232373732859 \cdot 10^{285}:\\ \;\;\;\;\frac{x}{\frac{z}{y + z}}\\ \mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \le -2.61589186094131368 \cdot 10^{58} \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \le 2.6146663650125952 \cdot 10^{93}\right) \land \frac{x \cdot \left(y + z\right)}{z} \le 1.5414981946279022 \cdot 10^{266}:\\ \;\;\;\;\frac{x \cdot \left(y + z\right)}{z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y + z}{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 -5.96598232373732859 \cdot 10^{285}:\\
\;\;\;\;\frac{x}{\frac{z}{y + z}}\\

\mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \le -2.61589186094131368 \cdot 10^{58} \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \le 2.6146663650125952 \cdot 10^{93}\right) \land \frac{x \cdot \left(y + z\right)}{z} \le 1.5414981946279022 \cdot 10^{266}:\\
\;\;\;\;\frac{x \cdot \left(y + z\right)}{z}\\

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

\end{array}
double f(double x, double y, double z) {
        double r356462 = x;
        double r356463 = y;
        double r356464 = z;
        double r356465 = r356463 + r356464;
        double r356466 = r356462 * r356465;
        double r356467 = r356466 / r356464;
        return r356467;
}

double f(double x, double y, double z) {
        double r356468 = x;
        double r356469 = y;
        double r356470 = z;
        double r356471 = r356469 + r356470;
        double r356472 = r356468 * r356471;
        double r356473 = r356472 / r356470;
        double r356474 = -5.965982323737329e+285;
        bool r356475 = r356473 <= r356474;
        double r356476 = r356470 / r356471;
        double r356477 = r356468 / r356476;
        double r356478 = -2.6158918609413137e+58;
        bool r356479 = r356473 <= r356478;
        double r356480 = 2.614666365012595e+93;
        bool r356481 = r356473 <= r356480;
        double r356482 = !r356481;
        double r356483 = 1.5414981946279022e+266;
        bool r356484 = r356473 <= r356483;
        bool r356485 = r356482 && r356484;
        bool r356486 = r356479 || r356485;
        double r356487 = r356471 / r356470;
        double r356488 = r356468 * r356487;
        double r356489 = r356486 ? r356473 : r356488;
        double r356490 = r356475 ? r356477 : r356489;
        return r356490;
}

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

Derivation

  1. Split input into 3 regimes
  2. if (/ (* x (+ y z)) z) < -5.965982323737329e+285

    1. Initial program 54.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 -5.965982323737329e+285 < (/ (* x (+ y z)) z) < -2.6158918609413137e+58 or 2.614666365012595e+93 < (/ (* x (+ y z)) z) < 1.5414981946279022e+266

    1. Initial program 0.2

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

    if -2.6158918609413137e+58 < (/ (* x (+ y z)) z) < 2.614666365012595e+93 or 1.5414981946279022e+266 < (/ (* x (+ y z)) z)

    1. Initial program 11.3

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x \cdot \left(y + z\right)}{z} \le -5.96598232373732859 \cdot 10^{285}:\\ \;\;\;\;\frac{x}{\frac{z}{y + z}}\\ \mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \le -2.61589186094131368 \cdot 10^{58} \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \le 2.6146663650125952 \cdot 10^{93}\right) \land \frac{x \cdot \left(y + z\right)}{z} \le 1.5414981946279022 \cdot 10^{266}:\\ \;\;\;\;\frac{x \cdot \left(y + z\right)}{z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y + z}{z}\\ \end{array}\]

Reproduce

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