Average Error: 12.9 → 1.7
Time: 14.1s
Precision: 64
\[\frac{x \cdot \left(y + z\right)}{z}\]
\[\begin{array}{l} \mathbf{if}\;\frac{x \cdot \left(y + z\right)}{z} = -\infty:\\ \;\;\;\;x \cdot \frac{y + z}{z}\\ \mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \le -9.980656591458488676125808816729354026739 \cdot 10^{-68}:\\ \;\;\;\;\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:\\
\;\;\;\;x \cdot \frac{y + z}{z}\\

\mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \le -9.980656591458488676125808816729354026739 \cdot 10^{-68}:\\
\;\;\;\;\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 r253736207 = x;
        double r253736208 = y;
        double r253736209 = z;
        double r253736210 = r253736208 + r253736209;
        double r253736211 = r253736207 * r253736210;
        double r253736212 = r253736211 / r253736209;
        return r253736212;
}

double f(double x, double y, double z) {
        double r253736213 = x;
        double r253736214 = y;
        double r253736215 = z;
        double r253736216 = r253736214 + r253736215;
        double r253736217 = r253736213 * r253736216;
        double r253736218 = r253736217 / r253736215;
        double r253736219 = -inf.0;
        bool r253736220 = r253736218 <= r253736219;
        double r253736221 = r253736216 / r253736215;
        double r253736222 = r253736213 * r253736221;
        double r253736223 = -9.980656591458489e-68;
        bool r253736224 = r253736218 <= r253736223;
        double r253736225 = r253736224 ? r253736218 : r253736222;
        double r253736226 = r253736220 ? r253736222 : r253736225;
        return r253736226;
}

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

Derivation

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

    1. Initial program 17.5

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

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

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

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

    if -inf.0 < (/ (* x (+ y z)) z) < -9.980656591458489e-68

    1. Initial program 0.2

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

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

Reproduce

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