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

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

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

\end{array}
double f(double x, double y, double z) {
        double r27272081 = x;
        double r27272082 = y;
        double r27272083 = r27272081 + r27272082;
        double r27272084 = 1.0;
        double r27272085 = z;
        double r27272086 = r27272082 / r27272085;
        double r27272087 = r27272084 - r27272086;
        double r27272088 = r27272083 / r27272087;
        return r27272088;
}

double f(double x, double y, double z) {
        double r27272089 = y;
        double r27272090 = x;
        double r27272091 = r27272089 + r27272090;
        double r27272092 = 1.0;
        double r27272093 = z;
        double r27272094 = r27272089 / r27272093;
        double r27272095 = r27272092 - r27272094;
        double r27272096 = r27272091 / r27272095;
        double r27272097 = -4.612917550312024e-270;
        bool r27272098 = r27272096 <= r27272097;
        double r27272099 = 0.0;
        bool r27272100 = r27272096 <= r27272099;
        double r27272101 = 1.0;
        double r27272102 = sqrt(r27272092);
        double r27272103 = sqrt(r27272089);
        double r27272104 = sqrt(r27272093);
        double r27272105 = r27272103 / r27272104;
        double r27272106 = r27272102 + r27272105;
        double r27272107 = r27272101 / r27272106;
        double r27272108 = r27272102 - r27272105;
        double r27272109 = r27272101 / r27272108;
        double r27272110 = r27272091 * r27272109;
        double r27272111 = r27272107 * r27272110;
        double r27272112 = r27272100 ? r27272111 : r27272096;
        double r27272113 = r27272098 ? r27272096 : r27272112;
        return r27272113;
}

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.2
Herbie6.4
\[\begin{array}{l} \mathbf{if}\;y \lt -3.742931076268985646434612946949172132145 \cdot 10^{171}:\\ \;\;\;\;\frac{y + x}{-y} \cdot z\\ \mathbf{elif}\;y \lt 3.553466245608673435460441960303815115662 \cdot 10^{168}:\\ \;\;\;\;\frac{x + y}{1 - \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.612917550312024e-270 or 0.0 < (/ (+ x y) (- 1.0 (/ y z)))

    1. Initial program 0.1

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

    if -4.612917550312024e-270 < (/ (+ x y) (- 1.0 (/ y z))) < 0.0

    1. Initial program 57.1

      \[\frac{x + y}{1 - \frac{y}{z}}\]
    2. Using strategy rm
    3. Applied clear-num57.1

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

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

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

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

      \[\leadsto \frac{\frac{1}{1 - \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-frac57.1

      \[\leadsto \frac{\frac{1}{1 - \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-sqrt59.5

      \[\leadsto \frac{\frac{1}{1 - \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.9

      \[\leadsto \frac{\frac{1}{1 - \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.9

      \[\leadsto \frac{\frac{1}{1 - \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.9

      \[\leadsto \frac{\frac{1}{\color{blue}{\sqrt{1} \cdot \sqrt{1}} - \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.9

      \[\leadsto \frac{\frac{1}{\color{blue}{\left(\sqrt{1} + \frac{\sqrt{y}}{\sqrt{z}}\right) \cdot \left(\sqrt{1} - \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.9

      \[\leadsto \frac{\frac{\color{blue}{\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \sqrt[3]{1}}}{\left(\sqrt{1} + \frac{\sqrt{y}}{\sqrt{z}}\right) \cdot \left(\sqrt{1} - \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-frac61.2

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

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

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

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

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

Reproduce

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