Average Error: 12.6 → 0.2
Time: 2.3s
Precision: 64
\[\frac{x \cdot \left(y + z\right)}{z}\]
\[\begin{array}{l} \mathbf{if}\;\frac{x \cdot \left(y + z\right)}{z} = -\infty:\\ \;\;\;\;\frac{x}{\frac{z}{y + z}}\\ \mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \le -2.01894392068078278 \cdot 10^{-69}:\\ \;\;\;\;\frac{x \cdot \left(y + z\right)}{z}\\ \mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \le 5.60008248528112405 \cdot 10^{-63}:\\ \;\;\;\;x \cdot \frac{y + z}{z}\\ \mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \le 2.5209699895476903 \cdot 10^{300}:\\ \;\;\;\;\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} = -\infty:\\
\;\;\;\;\frac{x}{\frac{z}{y + z}}\\

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

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

\mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \le 2.5209699895476903 \cdot 10^{300}:\\
\;\;\;\;\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 r372929 = x;
        double r372930 = y;
        double r372931 = z;
        double r372932 = r372930 + r372931;
        double r372933 = r372929 * r372932;
        double r372934 = r372933 / r372931;
        return r372934;
}

double f(double x, double y, double z) {
        double r372935 = x;
        double r372936 = y;
        double r372937 = z;
        double r372938 = r372936 + r372937;
        double r372939 = r372935 * r372938;
        double r372940 = r372939 / r372937;
        double r372941 = -inf.0;
        bool r372942 = r372940 <= r372941;
        double r372943 = r372937 / r372938;
        double r372944 = r372935 / r372943;
        double r372945 = -2.0189439206807828e-69;
        bool r372946 = r372940 <= r372945;
        double r372947 = 5.600082485281124e-63;
        bool r372948 = r372940 <= r372947;
        double r372949 = r372938 / r372937;
        double r372950 = r372935 * r372949;
        double r372951 = 2.5209699895476903e+300;
        bool r372952 = r372940 <= r372951;
        double r372953 = r372952 ? r372940 : r372950;
        double r372954 = r372948 ? r372950 : r372953;
        double r372955 = r372946 ? r372940 : r372954;
        double r372956 = r372942 ? r372944 : r372955;
        return r372956;
}

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

Derivation

  1. Split input into 3 regimes
  2. if (/ (* x (+ y z)) z) < -inf.0

    1. Initial program 64.0

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

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

    if -inf.0 < (/ (* x (+ y z)) z) < -2.0189439206807828e-69 or 5.600082485281124e-63 < (/ (* x (+ y z)) z) < 2.5209699895476903e+300

    1. Initial program 0.2

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

    if -2.0189439206807828e-69 < (/ (* x (+ y z)) z) < 5.600082485281124e-63 or 2.5209699895476903e+300 < (/ (* x (+ y z)) z)

    1. Initial program 19.2

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x \cdot \left(y + z\right)}{z} = -\infty:\\ \;\;\;\;\frac{x}{\frac{z}{y + z}}\\ \mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \le -2.01894392068078278 \cdot 10^{-69}:\\ \;\;\;\;\frac{x \cdot \left(y + z\right)}{z}\\ \mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \le 5.60008248528112405 \cdot 10^{-63}:\\ \;\;\;\;x \cdot \frac{y + z}{z}\\ \mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \le 2.5209699895476903 \cdot 10^{300}:\\ \;\;\;\;\frac{x \cdot \left(y + z\right)}{z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y + z}{z}\\ \end{array}\]

Reproduce

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