Average Error: 7.7 → 6.1
Time: 14.8s
Precision: 64
\[\frac{x + y}{1.0 - \frac{y}{z}}\]
\[\begin{array}{l} \mathbf{if}\;\frac{y + x}{1.0 - \frac{y}{z}} \le -4.7401362634525394 \cdot 10^{-285}:\\ \;\;\;\;\frac{y + x}{1.0 - \frac{y}{z}}\\ \mathbf{elif}\;\frac{y + x}{1.0 - \frac{y}{z}} \le -0.0:\\ \;\;\;\;\frac{1}{\sqrt{1.0} + \frac{\sqrt{y}}{\sqrt{z}}} \cdot \left(\left(y + x\right) \cdot \frac{1}{\sqrt{1.0} - \frac{\sqrt{y}}{\sqrt{z}}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{y + x}{1.0 - \frac{y}{z}}\\ \end{array}\]
\frac{x + y}{1.0 - \frac{y}{z}}
\begin{array}{l}
\mathbf{if}\;\frac{y + x}{1.0 - \frac{y}{z}} \le -4.7401362634525394 \cdot 10^{-285}:\\
\;\;\;\;\frac{y + x}{1.0 - \frac{y}{z}}\\

\mathbf{elif}\;\frac{y + x}{1.0 - \frac{y}{z}} \le -0.0:\\
\;\;\;\;\frac{1}{\sqrt{1.0} + \frac{\sqrt{y}}{\sqrt{z}}} \cdot \left(\left(y + x\right) \cdot \frac{1}{\sqrt{1.0} - \frac{\sqrt{y}}{\sqrt{z}}}\right)\\

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

\end{array}
double f(double x, double y, double z) {
        double r30608450 = x;
        double r30608451 = y;
        double r30608452 = r30608450 + r30608451;
        double r30608453 = 1.0;
        double r30608454 = z;
        double r30608455 = r30608451 / r30608454;
        double r30608456 = r30608453 - r30608455;
        double r30608457 = r30608452 / r30608456;
        return r30608457;
}

double f(double x, double y, double z) {
        double r30608458 = y;
        double r30608459 = x;
        double r30608460 = r30608458 + r30608459;
        double r30608461 = 1.0;
        double r30608462 = z;
        double r30608463 = r30608458 / r30608462;
        double r30608464 = r30608461 - r30608463;
        double r30608465 = r30608460 / r30608464;
        double r30608466 = -4.7401362634525394e-285;
        bool r30608467 = r30608465 <= r30608466;
        double r30608468 = -0.0;
        bool r30608469 = r30608465 <= r30608468;
        double r30608470 = 1.0;
        double r30608471 = sqrt(r30608461);
        double r30608472 = sqrt(r30608458);
        double r30608473 = sqrt(r30608462);
        double r30608474 = r30608472 / r30608473;
        double r30608475 = r30608471 + r30608474;
        double r30608476 = r30608470 / r30608475;
        double r30608477 = r30608471 - r30608474;
        double r30608478 = r30608470 / r30608477;
        double r30608479 = r30608460 * r30608478;
        double r30608480 = r30608476 * r30608479;
        double r30608481 = r30608469 ? r30608480 : r30608465;
        double r30608482 = r30608467 ? r30608465 : r30608481;
        return r30608482;
}

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

Original7.7
Target4.3
Herbie6.1
\[\begin{array}{l} \mathbf{if}\;y \lt -3.7429310762689856 \cdot 10^{+171}:\\ \;\;\;\;\frac{y + x}{-y} \cdot z\\ \mathbf{elif}\;y \lt 3.5534662456086734 \cdot 10^{+168}:\\ \;\;\;\;\frac{x + y}{1.0 - \frac{y}{z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{y + x}{-y} \cdot z\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if (/ (+ x y) (- 1.0 (/ y z))) < -4.7401362634525394e-285 or -0.0 < (/ (+ x y) (- 1.0 (/ y z)))

    1. Initial program 0.1

      \[\frac{x + y}{1.0 - \frac{y}{z}}\]

    if -4.7401362634525394e-285 < (/ (+ x y) (- 1.0 (/ y z))) < -0.0

    1. Initial program 58.7

      \[\frac{x + y}{1.0 - \frac{y}{z}}\]
    2. Using strategy rm
    3. Applied clear-num58.7

      \[\leadsto \color{blue}{\frac{1}{\frac{1.0 - \frac{y}{z}}{x + y}}}\]
    4. Using strategy rm
    5. Applied div-inv58.7

      \[\leadsto \frac{1}{\color{blue}{\left(1.0 - \frac{y}{z}\right) \cdot \frac{1}{x + y}}}\]
    6. Applied associate-/r*58.7

      \[\leadsto \color{blue}{\frac{\frac{1}{1.0 - \frac{y}{z}}}{\frac{1}{x + y}}}\]
    7. Using strategy rm
    8. Applied *-un-lft-identity58.7

      \[\leadsto \frac{\frac{1}{1.0 - \frac{y}{z}}}{\frac{1}{\color{blue}{1 \cdot \left(x + y\right)}}}\]
    9. Applied add-cube-cbrt58.7

      \[\leadsto \frac{\frac{1}{1.0 - \frac{y}{z}}}{\frac{\color{blue}{\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \sqrt[3]{1}}}{1 \cdot \left(x + y\right)}}\]
    10. Applied times-frac58.7

      \[\leadsto \frac{\frac{1}{1.0 - \frac{y}{z}}}{\color{blue}{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{1} \cdot \frac{\sqrt[3]{1}}{x + y}}}\]
    11. Applied add-sqr-sqrt60.3

      \[\leadsto \frac{\frac{1}{1.0 - \frac{y}{\color{blue}{\sqrt{z} \cdot \sqrt{z}}}}}{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{1} \cdot \frac{\sqrt[3]{1}}{x + y}}\]
    12. Applied add-sqr-sqrt61.8

      \[\leadsto \frac{\frac{1}{1.0 - \frac{\color{blue}{\sqrt{y} \cdot \sqrt{y}}}{\sqrt{z} \cdot \sqrt{z}}}}{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{1} \cdot \frac{\sqrt[3]{1}}{x + y}}\]
    13. Applied times-frac61.8

      \[\leadsto \frac{\frac{1}{1.0 - \color{blue}{\frac{\sqrt{y}}{\sqrt{z}} \cdot \frac{\sqrt{y}}{\sqrt{z}}}}}{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{1} \cdot \frac{\sqrt[3]{1}}{x + y}}\]
    14. Applied add-sqr-sqrt61.8

      \[\leadsto \frac{\frac{1}{\color{blue}{\sqrt{1.0} \cdot \sqrt{1.0}} - \frac{\sqrt{y}}{\sqrt{z}} \cdot \frac{\sqrt{y}}{\sqrt{z}}}}{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{1} \cdot \frac{\sqrt[3]{1}}{x + y}}\]
    15. Applied difference-of-squares61.8

      \[\leadsto \frac{\frac{1}{\color{blue}{\left(\sqrt{1.0} + \frac{\sqrt{y}}{\sqrt{z}}\right) \cdot \left(\sqrt{1.0} - \frac{\sqrt{y}}{\sqrt{z}}\right)}}}{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{1} \cdot \frac{\sqrt[3]{1}}{x + y}}\]
    16. Applied add-cube-cbrt61.8

      \[\leadsto \frac{\frac{\color{blue}{\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \sqrt[3]{1}}}{\left(\sqrt{1.0} + \frac{\sqrt{y}}{\sqrt{z}}\right) \cdot \left(\sqrt{1.0} - \frac{\sqrt{y}}{\sqrt{z}}\right)}}{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{1} \cdot \frac{\sqrt[3]{1}}{x + y}}\]
    17. Applied times-frac60.9

      \[\leadsto \frac{\color{blue}{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\sqrt{1.0} + \frac{\sqrt{y}}{\sqrt{z}}} \cdot \frac{\sqrt[3]{1}}{\sqrt{1.0} - \frac{\sqrt{y}}{\sqrt{z}}}}}{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{1} \cdot \frac{\sqrt[3]{1}}{x + y}}\]
    18. Applied times-frac46.5

      \[\leadsto \color{blue}{\frac{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\sqrt{1.0} + \frac{\sqrt{y}}{\sqrt{z}}}}{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{1}} \cdot \frac{\frac{\sqrt[3]{1}}{\sqrt{1.0} - \frac{\sqrt{y}}{\sqrt{z}}}}{\frac{\sqrt[3]{1}}{x + y}}}\]
    19. Simplified46.5

      \[\leadsto \color{blue}{\frac{1}{\sqrt{1.0} + \frac{\sqrt{y}}{\sqrt{z}}}} \cdot \frac{\frac{\sqrt[3]{1}}{\sqrt{1.0} - \frac{\sqrt{y}}{\sqrt{z}}}}{\frac{\sqrt[3]{1}}{x + y}}\]
    20. Simplified46.5

      \[\leadsto \frac{1}{\sqrt{1.0} + \frac{\sqrt{y}}{\sqrt{z}}} \cdot \color{blue}{\left(\frac{1}{\sqrt{1.0} - \frac{\sqrt{y}}{\sqrt{z}}} \cdot \left(x + y\right)\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification6.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y + x}{1.0 - \frac{y}{z}} \le -4.7401362634525394 \cdot 10^{-285}:\\ \;\;\;\;\frac{y + x}{1.0 - \frac{y}{z}}\\ \mathbf{elif}\;\frac{y + x}{1.0 - \frac{y}{z}} \le -0.0:\\ \;\;\;\;\frac{1}{\sqrt{1.0} + \frac{\sqrt{y}}{\sqrt{z}}} \cdot \left(\left(y + x\right) \cdot \frac{1}{\sqrt{1.0} - \frac{\sqrt{y}}{\sqrt{z}}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{y + x}{1.0 - \frac{y}{z}}\\ \end{array}\]

Reproduce

herbie shell --seed 2019165 
(FPCore (x y z)
  :name "Graphics.Rendering.Chart.Backend.Diagrams:calcFontMetrics from Chart-diagrams-1.5.1, A"

  :herbie-target
  (if (< y -3.7429310762689856e+171) (* (/ (+ y x) (- y)) z) (if (< y 3.5534662456086734e+168) (/ (+ x y) (- 1.0 (/ y z))) (* (/ (+ y x) (- y)) z)))

  (/ (+ x y) (- 1.0 (/ y z))))