Average Error: 7.2 → 5.9
Time: 14.2s
Precision: 64
\[\frac{x + y}{1.0 - \frac{y}{z}}\]
\[\begin{array}{l} \mathbf{if}\;\frac{y + x}{1.0 - \frac{y}{z}} \le -2.5200352144339976 \cdot 10^{-283}:\\ \;\;\;\;\frac{y + x}{1.0 - \frac{y}{z}}\\ \mathbf{elif}\;\frac{y + x}{1.0 - \frac{y}{z}} \le -0.0:\\ \;\;\;\;\frac{\frac{\sqrt{y + x}}{\sqrt{\sqrt{1.0} + \frac{\sqrt{y}}{\sqrt{z}}}} \cdot \frac{\sqrt{y + x}}{\sqrt{\sqrt{1.0} + \frac{\sqrt{y}}{\sqrt{z}}}}}{\sqrt{1.0} - \frac{\sqrt{y}}{\sqrt{z}}}\\ \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 -2.5200352144339976 \cdot 10^{-283}:\\
\;\;\;\;\frac{y + x}{1.0 - \frac{y}{z}}\\

\mathbf{elif}\;\frac{y + x}{1.0 - \frac{y}{z}} \le -0.0:\\
\;\;\;\;\frac{\frac{\sqrt{y + x}}{\sqrt{\sqrt{1.0} + \frac{\sqrt{y}}{\sqrt{z}}}} \cdot \frac{\sqrt{y + x}}{\sqrt{\sqrt{1.0} + \frac{\sqrt{y}}{\sqrt{z}}}}}{\sqrt{1.0} - \frac{\sqrt{y}}{\sqrt{z}}}\\

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

\end{array}
double f(double x, double y, double z) {
        double r29632418 = x;
        double r29632419 = y;
        double r29632420 = r29632418 + r29632419;
        double r29632421 = 1.0;
        double r29632422 = z;
        double r29632423 = r29632419 / r29632422;
        double r29632424 = r29632421 - r29632423;
        double r29632425 = r29632420 / r29632424;
        return r29632425;
}

double f(double x, double y, double z) {
        double r29632426 = y;
        double r29632427 = x;
        double r29632428 = r29632426 + r29632427;
        double r29632429 = 1.0;
        double r29632430 = z;
        double r29632431 = r29632426 / r29632430;
        double r29632432 = r29632429 - r29632431;
        double r29632433 = r29632428 / r29632432;
        double r29632434 = -2.5200352144339976e-283;
        bool r29632435 = r29632433 <= r29632434;
        double r29632436 = -0.0;
        bool r29632437 = r29632433 <= r29632436;
        double r29632438 = sqrt(r29632428);
        double r29632439 = sqrt(r29632429);
        double r29632440 = sqrt(r29632426);
        double r29632441 = sqrt(r29632430);
        double r29632442 = r29632440 / r29632441;
        double r29632443 = r29632439 + r29632442;
        double r29632444 = sqrt(r29632443);
        double r29632445 = r29632438 / r29632444;
        double r29632446 = r29632445 * r29632445;
        double r29632447 = r29632439 - r29632442;
        double r29632448 = r29632446 / r29632447;
        double r29632449 = r29632437 ? r29632448 : r29632433;
        double r29632450 = r29632435 ? r29632433 : r29632449;
        return r29632450;
}

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.2
Target4.0
Herbie5.9
\[\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))) < -2.5200352144339976e-283 or -0.0 < (/ (+ x y) (- 1.0 (/ y z)))

    1. Initial program 0.1

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

    if -2.5200352144339976e-283 < (/ (+ x y) (- 1.0 (/ y z))) < -0.0

    1. Initial program 58.9

      \[\frac{x + y}{1.0 - \frac{y}{z}}\]
    2. Using strategy rm
    3. Applied add-sqr-sqrt60.5

      \[\leadsto \frac{x + y}{1.0 - \frac{y}{\color{blue}{\sqrt{z} \cdot \sqrt{z}}}}\]
    4. Applied add-sqr-sqrt61.7

      \[\leadsto \frac{x + y}{1.0 - \frac{\color{blue}{\sqrt{y} \cdot \sqrt{y}}}{\sqrt{z} \cdot \sqrt{z}}}\]
    5. Applied times-frac61.7

      \[\leadsto \frac{x + y}{1.0 - \color{blue}{\frac{\sqrt{y}}{\sqrt{z}} \cdot \frac{\sqrt{y}}{\sqrt{z}}}}\]
    6. Applied add-sqr-sqrt61.7

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

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

      \[\leadsto \color{blue}{\frac{\frac{x + y}{\sqrt{1.0} + \frac{\sqrt{y}}{\sqrt{z}}}}{\sqrt{1.0} - \frac{\sqrt{y}}{\sqrt{z}}}}\]
    9. Using strategy rm
    10. Applied add-sqr-sqrt46.7

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

      \[\leadsto \frac{\frac{\color{blue}{\sqrt{x + y} \cdot \sqrt{x + y}}}{\sqrt{\sqrt{1.0} + \frac{\sqrt{y}}{\sqrt{z}}} \cdot \sqrt{\sqrt{1.0} + \frac{\sqrt{y}}{\sqrt{z}}}}}{\sqrt{1.0} - \frac{\sqrt{y}}{\sqrt{z}}}\]
    12. Applied times-frac47.8

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y + x}{1.0 - \frac{y}{z}} \le -2.5200352144339976 \cdot 10^{-283}:\\ \;\;\;\;\frac{y + x}{1.0 - \frac{y}{z}}\\ \mathbf{elif}\;\frac{y + x}{1.0 - \frac{y}{z}} \le -0.0:\\ \;\;\;\;\frac{\frac{\sqrt{y + x}}{\sqrt{\sqrt{1.0} + \frac{\sqrt{y}}{\sqrt{z}}}} \cdot \frac{\sqrt{y + x}}{\sqrt{\sqrt{1.0} + \frac{\sqrt{y}}{\sqrt{z}}}}}{\sqrt{1.0} - \frac{\sqrt{y}}{\sqrt{z}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{y + x}{1.0 - \frac{y}{z}}\\ \end{array}\]

Reproduce

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