Average Error: 12.3 → 0.4
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 -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 r534807 = x;
        double r534808 = y;
        double r534809 = z;
        double r534810 = r534808 + r534809;
        double r534811 = r534807 * r534810;
        double r534812 = r534811 / r534809;
        return r534812;
}

double f(double x, double y, double z) {
        double r534813 = x;
        double r534814 = y;
        double r534815 = z;
        double r534816 = r534814 + r534815;
        double r534817 = r534813 * r534816;
        double r534818 = r534817 / r534815;
        double r534819 = -4.3181556215390205e+296;
        bool r534820 = r534818 <= r534819;
        double r534821 = r534816 / r534815;
        double r534822 = r534813 * r534821;
        double r534823 = -1.5566900973758558e+66;
        bool r534824 = r534818 <= r534823;
        double r534825 = 1.0308431393447935e-29;
        bool r534826 = r534818 <= r534825;
        double r534827 = 1.8301494225514242e+297;
        bool r534828 = r534818 <= r534827;
        double r534829 = r534815 / r534816;
        double r534830 = r534813 / r534829;
        double r534831 = r534828 ? r534818 : r534830;
        double r534832 = r534826 ? r534822 : r534831;
        double r534833 = r534824 ? r534818 : r534832;
        double r534834 = r534820 ? r534822 : r534833;
        return r534834;
}

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))