Average Error: 14.7 → 1.5
Time: 35.3s
Precision: 64
\[\frac{\left(x \cdot 2\right) \cdot y}{x - y}\]
\[\begin{array}{l} \mathbf{if}\;\frac{\left(x \cdot 2\right) \cdot y}{x - y} = -\infty:\\ \;\;\;\;\left(x \cdot 2\right) \cdot \frac{y}{x - y}\\ \mathbf{elif}\;\frac{\left(x \cdot 2\right) \cdot y}{x - y} \le -6.745122070843779617146525347103711815123 \cdot 10^{-307}:\\ \;\;\;\;\frac{\left(x \cdot 2\right) \cdot y}{x - y}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{\sqrt[3]{x - y} \cdot \sqrt[3]{x - y}} \cdot \left(x \cdot 2\right)\right) \cdot \frac{\sqrt[3]{y}}{\sqrt[3]{x - y}}\\ \end{array}\]
\frac{\left(x \cdot 2\right) \cdot y}{x - y}
\begin{array}{l}
\mathbf{if}\;\frac{\left(x \cdot 2\right) \cdot y}{x - y} = -\infty:\\
\;\;\;\;\left(x \cdot 2\right) \cdot \frac{y}{x - y}\\

\mathbf{elif}\;\frac{\left(x \cdot 2\right) \cdot y}{x - y} \le -6.745122070843779617146525347103711815123 \cdot 10^{-307}:\\
\;\;\;\;\frac{\left(x \cdot 2\right) \cdot y}{x - y}\\

\mathbf{else}:\\
\;\;\;\;\left(\frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{\sqrt[3]{x - y} \cdot \sqrt[3]{x - y}} \cdot \left(x \cdot 2\right)\right) \cdot \frac{\sqrt[3]{y}}{\sqrt[3]{x - y}}\\

\end{array}
double f(double x, double y) {
        double r387594 = x;
        double r387595 = 2.0;
        double r387596 = r387594 * r387595;
        double r387597 = y;
        double r387598 = r387596 * r387597;
        double r387599 = r387594 - r387597;
        double r387600 = r387598 / r387599;
        return r387600;
}

double f(double x, double y) {
        double r387601 = x;
        double r387602 = 2.0;
        double r387603 = r387601 * r387602;
        double r387604 = y;
        double r387605 = r387603 * r387604;
        double r387606 = r387601 - r387604;
        double r387607 = r387605 / r387606;
        double r387608 = -inf.0;
        bool r387609 = r387607 <= r387608;
        double r387610 = r387604 / r387606;
        double r387611 = r387603 * r387610;
        double r387612 = -6.74512207084378e-307;
        bool r387613 = r387607 <= r387612;
        double r387614 = cbrt(r387604);
        double r387615 = r387614 * r387614;
        double r387616 = cbrt(r387606);
        double r387617 = r387616 * r387616;
        double r387618 = r387615 / r387617;
        double r387619 = r387618 * r387603;
        double r387620 = r387614 / r387616;
        double r387621 = r387619 * r387620;
        double r387622 = r387613 ? r387607 : r387621;
        double r387623 = r387609 ? r387611 : r387622;
        return r387623;
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original14.7
Target0.3
Herbie1.5
\[\begin{array}{l} \mathbf{if}\;x \lt -1.721044263414944729490876394165887012892 \cdot 10^{81}:\\ \;\;\;\;\frac{2 \cdot x}{x - y} \cdot y\\ \mathbf{elif}\;x \lt 83645045635564432:\\ \;\;\;\;\frac{x \cdot 2}{\frac{x - y}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot x}{x - y} \cdot y\\ \end{array}\]

Derivation

  1. Split input into 3 regimes
  2. if (/ (* (* x 2.0) y) (- x y)) < -inf.0

    1. Initial program 64.0

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

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

      \[\leadsto \color{blue}{\frac{x \cdot 2}{1} \cdot \frac{y}{x - y}}\]
    5. Simplified0.2

      \[\leadsto \color{blue}{\left(x \cdot 2\right)} \cdot \frac{y}{x - y}\]

    if -inf.0 < (/ (* (* x 2.0) y) (- x y)) < -6.74512207084378e-307

    1. Initial program 0.4

      \[\frac{\left(x \cdot 2\right) \cdot y}{x - y}\]

    if -6.74512207084378e-307 < (/ (* (* x 2.0) y) (- x y))

    1. Initial program 18.8

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

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

      \[\leadsto \color{blue}{\frac{x \cdot 2}{1} \cdot \frac{y}{x - y}}\]
    5. Simplified6.4

      \[\leadsto \color{blue}{\left(x \cdot 2\right)} \cdot \frac{y}{x - y}\]
    6. Using strategy rm
    7. Applied add-cube-cbrt7.6

      \[\leadsto \left(x \cdot 2\right) \cdot \frac{y}{\color{blue}{\left(\sqrt[3]{x - y} \cdot \sqrt[3]{x - y}\right) \cdot \sqrt[3]{x - y}}}\]
    8. Applied add-cube-cbrt7.1

      \[\leadsto \left(x \cdot 2\right) \cdot \frac{\color{blue}{\left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot \sqrt[3]{y}}}{\left(\sqrt[3]{x - y} \cdot \sqrt[3]{x - y}\right) \cdot \sqrt[3]{x - y}}\]
    9. Applied times-frac7.1

      \[\leadsto \left(x \cdot 2\right) \cdot \color{blue}{\left(\frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{\sqrt[3]{x - y} \cdot \sqrt[3]{x - y}} \cdot \frac{\sqrt[3]{y}}{\sqrt[3]{x - y}}\right)}\]
    10. Applied associate-*r*2.3

      \[\leadsto \color{blue}{\left(\left(x \cdot 2\right) \cdot \frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{\sqrt[3]{x - y} \cdot \sqrt[3]{x - y}}\right) \cdot \frac{\sqrt[3]{y}}{\sqrt[3]{x - y}}}\]
    11. Simplified2.3

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\left(x \cdot 2\right) \cdot y}{x - y} = -\infty:\\ \;\;\;\;\left(x \cdot 2\right) \cdot \frac{y}{x - y}\\ \mathbf{elif}\;\frac{\left(x \cdot 2\right) \cdot y}{x - y} \le -6.745122070843779617146525347103711815123 \cdot 10^{-307}:\\ \;\;\;\;\frac{\left(x \cdot 2\right) \cdot y}{x - y}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{\sqrt[3]{x - y} \cdot \sqrt[3]{x - y}} \cdot \left(x \cdot 2\right)\right) \cdot \frac{\sqrt[3]{y}}{\sqrt[3]{x - y}}\\ \end{array}\]

Reproduce

herbie shell --seed 2019208 
(FPCore (x y)
  :name "Linear.Projection:perspective from linear-1.19.1.3, B"
  :precision binary64

  :herbie-target
  (if (< x -1.7210442634149447e81) (* (/ (* 2 x) (- x y)) y) (if (< x 83645045635564432) (/ (* x 2) (/ (- x y) y)) (* (/ (* 2 x) (- x y)) y)))

  (/ (* (* x 2) y) (- x y)))