Average Error: 12.3 → 0.4
Time: 7.6s
Precision: 64
\[\frac{x \cdot \left(y + z\right)}{z}\]
\[\begin{array}{l} \mathbf{if}\;\frac{x \cdot \left(y + z\right)}{z} \le -4.3181556215390205 \cdot 10^{296}:\\ \;\;\;\;x \cdot \frac{y + z}{z}\\ \mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \le -1.5566900973758558 \cdot 10^{66}:\\ \;\;\;\;\frac{x \cdot \left(y + z\right)}{z}\\ \mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \le 1.0308431393447935 \cdot 10^{-29}:\\ \;\;\;\;x \cdot \frac{y + z}{z}\\ \mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \le 1.83014942255142419 \cdot 10^{297}:\\ \;\;\;\;\frac{x \cdot \left(y + z\right)}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{z}{y + 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 -4.3181556215390205 \cdot 10^{296}:\\
\;\;\;\;x \cdot \frac{y + z}{z}\\

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

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

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

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

\end{array}
double f(double x, double y, double z) {
        double r329103 = x;
        double r329104 = y;
        double r329105 = z;
        double r329106 = r329104 + r329105;
        double r329107 = r329103 * r329106;
        double r329108 = r329107 / r329105;
        return r329108;
}

double f(double x, double y, double z) {
        double r329109 = x;
        double r329110 = y;
        double r329111 = z;
        double r329112 = r329110 + r329111;
        double r329113 = r329109 * r329112;
        double r329114 = r329113 / r329111;
        double r329115 = -4.3181556215390205e+296;
        bool r329116 = r329114 <= r329115;
        double r329117 = r329112 / r329111;
        double r329118 = r329109 * r329117;
        double r329119 = -1.5566900973758558e+66;
        bool r329120 = r329114 <= r329119;
        double r329121 = 1.0308431393447935e-29;
        bool r329122 = r329114 <= r329121;
        double r329123 = 1.8301494225514242e+297;
        bool r329124 = r329114 <= r329123;
        double r329125 = r329111 / r329112;
        double r329126 = r329109 / r329125;
        double r329127 = r329124 ? r329114 : r329126;
        double r329128 = r329122 ? r329118 : r329127;
        double r329129 = r329120 ? r329114 : r329128;
        double r329130 = r329116 ? r329118 : r329129;
        return r329130;
}

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.3
Target3.1
Herbie0.4
\[\frac{x}{\frac{z}{y + z}}\]

Derivation

  1. Split input into 3 regimes
  2. if (/ (* x (+ y z)) z) < -4.3181556215390205e+296 or -1.5566900973758558e+66 < (/ (* x (+ y z)) z) < 1.0308431393447935e-29

    1. Initial program 14.4

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

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

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

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

    if -4.3181556215390205e+296 < (/ (* x (+ y z)) z) < -1.5566900973758558e+66 or 1.0308431393447935e-29 < (/ (* x (+ y z)) z) < 1.8301494225514242e+297

    1. Initial program 0.2

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

    if 1.8301494225514242e+297 < (/ (* x (+ y z)) z)

    1. Initial program 59.5

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x \cdot \left(y + z\right)}{z} \le -4.3181556215390205 \cdot 10^{296}:\\ \;\;\;\;x \cdot \frac{y + z}{z}\\ \mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \le -1.5566900973758558 \cdot 10^{66}:\\ \;\;\;\;\frac{x \cdot \left(y + z\right)}{z}\\ \mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \le 1.0308431393447935 \cdot 10^{-29}:\\ \;\;\;\;x \cdot \frac{y + z}{z}\\ \mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \le 1.83014942255142419 \cdot 10^{297}:\\ \;\;\;\;\frac{x \cdot \left(y + z\right)}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{z}{y + z}}\\ \end{array}\]

Reproduce

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