Average Error: 12.1 → 0.5
Time: 2.0s
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 \left(\frac{y}{z} + 1\right)\\ \mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \le -3.58734073562936087 \cdot 10^{-50}:\\ \;\;\;\;\frac{1}{z} \cdot \left(x \cdot \left(y + z\right)\right)\\ \mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \le 1.2688434278768279 \cdot 10^{79}:\\ \;\;\;\;x \cdot \left(\frac{y}{z} + 1\right)\\ \mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \le 1.26550784375647793 \cdot 10^{293}:\\ \;\;\;\;\frac{1}{z} \cdot \left(x \cdot \left(y + z\right)\right)\\ \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} = -\infty:\\
\;\;\;\;x \cdot \left(\frac{y}{z} + 1\right)\\

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

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

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

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

\end{array}
double f(double x, double y, double z) {
        double r442296 = x;
        double r442297 = y;
        double r442298 = z;
        double r442299 = r442297 + r442298;
        double r442300 = r442296 * r442299;
        double r442301 = r442300 / r442298;
        return r442301;
}

double f(double x, double y, double z) {
        double r442302 = x;
        double r442303 = y;
        double r442304 = z;
        double r442305 = r442303 + r442304;
        double r442306 = r442302 * r442305;
        double r442307 = r442306 / r442304;
        double r442308 = -inf.0;
        bool r442309 = r442307 <= r442308;
        double r442310 = r442303 / r442304;
        double r442311 = 1.0;
        double r442312 = r442310 + r442311;
        double r442313 = r442302 * r442312;
        double r442314 = -3.587340735629361e-50;
        bool r442315 = r442307 <= r442314;
        double r442316 = r442311 / r442304;
        double r442317 = r442316 * r442306;
        double r442318 = 1.2688434278768279e+79;
        bool r442319 = r442307 <= r442318;
        double r442320 = 1.265507843756478e+293;
        bool r442321 = r442307 <= r442320;
        double r442322 = r442304 / r442305;
        double r442323 = r442302 / r442322;
        double r442324 = r442321 ? r442317 : r442323;
        double r442325 = r442319 ? r442313 : r442324;
        double r442326 = r442315 ? r442317 : r442325;
        double r442327 = r442309 ? r442313 : r442326;
        return r442327;
}

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

Derivation

  1. Split input into 3 regimes
  2. if (/ (* x (+ y z)) z) < -inf.0 or -3.587340735629361e-50 < (/ (* x (+ y z)) z) < 1.2688434278768279e+79

    1. Initial program 14.1

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

      \[\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}\]
    6. Taylor expanded around 0 0.4

      \[\leadsto x \cdot \color{blue}{\left(\frac{y}{z} + 1\right)}\]

    if -inf.0 < (/ (* x (+ y z)) z) < -3.587340735629361e-50 or 1.2688434278768279e+79 < (/ (* x (+ y z)) z) < 1.265507843756478e+293

    1. Initial program 0.3

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

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{y + z}}}\]
    4. Using strategy rm
    5. Applied div-inv6.8

      \[\leadsto \frac{x}{\color{blue}{z \cdot \frac{1}{y + z}}}\]
    6. Applied *-un-lft-identity6.8

      \[\leadsto \frac{\color{blue}{1 \cdot x}}{z \cdot \frac{1}{y + z}}\]
    7. Applied times-frac0.3

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

      \[\leadsto \frac{1}{z} \cdot \color{blue}{\left(x \cdot \left(y + z\right)\right)}\]

    if 1.265507843756478e+293 < (/ (* x (+ y z)) z)

    1. Initial program 57.5

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x \cdot \left(y + z\right)}{z} = -\infty:\\ \;\;\;\;x \cdot \left(\frac{y}{z} + 1\right)\\ \mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \le -3.58734073562936087 \cdot 10^{-50}:\\ \;\;\;\;\frac{1}{z} \cdot \left(x \cdot \left(y + z\right)\right)\\ \mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \le 1.2688434278768279 \cdot 10^{79}:\\ \;\;\;\;x \cdot \left(\frac{y}{z} + 1\right)\\ \mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \le 1.26550784375647793 \cdot 10^{293}:\\ \;\;\;\;\frac{1}{z} \cdot \left(x \cdot \left(y + z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{z}{y + z}}\\ \end{array}\]

Reproduce

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