Average Error: 14.4 → 3.1
Time: 9.7s
Precision: 64
\[\frac{2 \cdot \left(x \cdot y\right)}{x - y}\]
\[\begin{array}{l} \mathbf{if}\;x \le -7.571272827848799 \cdot 10^{+93}:\\ \;\;\;\;\frac{y}{\sqrt[3]{x - y}} \cdot \frac{2 \cdot x}{\sqrt[3]{x - y} \cdot \sqrt[3]{x - y}}\\ \mathbf{elif}\;x \le 1.5811562494559677 \cdot 10^{+83}:\\ \;\;\;\;\frac{2 \cdot x}{\frac{x - y}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{\sqrt[3]{x - y}} \cdot \frac{2 \cdot x}{\sqrt[3]{x - y} \cdot \sqrt[3]{x - y}}\\ \end{array}\]
\frac{2 \cdot \left(x \cdot y\right)}{x - y}
\begin{array}{l}
\mathbf{if}\;x \le -7.571272827848799 \cdot 10^{+93}:\\
\;\;\;\;\frac{y}{\sqrt[3]{x - y}} \cdot \frac{2 \cdot x}{\sqrt[3]{x - y} \cdot \sqrt[3]{x - y}}\\

\mathbf{elif}\;x \le 1.5811562494559677 \cdot 10^{+83}:\\
\;\;\;\;\frac{2 \cdot x}{\frac{x - y}{y}}\\

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

\end{array}
double f(double x, double y) {
        double r10876395 = 2.0;
        double r10876396 = x;
        double r10876397 = y;
        double r10876398 = r10876396 * r10876397;
        double r10876399 = r10876395 * r10876398;
        double r10876400 = r10876396 - r10876397;
        double r10876401 = r10876399 / r10876400;
        return r10876401;
}

double f(double x, double y) {
        double r10876402 = x;
        double r10876403 = -7.571272827848799e+93;
        bool r10876404 = r10876402 <= r10876403;
        double r10876405 = y;
        double r10876406 = r10876402 - r10876405;
        double r10876407 = cbrt(r10876406);
        double r10876408 = r10876405 / r10876407;
        double r10876409 = 2.0;
        double r10876410 = r10876409 * r10876402;
        double r10876411 = r10876407 * r10876407;
        double r10876412 = r10876410 / r10876411;
        double r10876413 = r10876408 * r10876412;
        double r10876414 = 1.5811562494559677e+83;
        bool r10876415 = r10876402 <= r10876414;
        double r10876416 = r10876406 / r10876405;
        double r10876417 = r10876410 / r10876416;
        double r10876418 = r10876415 ? r10876417 : r10876413;
        double r10876419 = r10876404 ? r10876413 : r10876418;
        return r10876419;
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if x < -7.571272827848799e+93 or 1.5811562494559677e+83 < x

    1. Initial program 19.4

      \[\frac{2 \cdot \left(x \cdot y\right)}{x - y}\]
    2. Using strategy rm
    3. Applied associate-*r*19.5

      \[\leadsto \frac{\color{blue}{\left(2 \cdot x\right) \cdot y}}{x - y}\]
    4. Using strategy rm
    5. Applied add-cube-cbrt20.3

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

      \[\leadsto \color{blue}{\frac{2 \cdot x}{\sqrt[3]{x - y} \cdot \sqrt[3]{x - y}} \cdot \frac{y}{\sqrt[3]{x - y}}}\]

    if -7.571272827848799e+93 < x < 1.5811562494559677e+83

    1. Initial program 11.6

      \[\frac{2 \cdot \left(x \cdot y\right)}{x - y}\]
    2. Using strategy rm
    3. Applied associate-*r*11.6

      \[\leadsto \frac{\color{blue}{\left(2 \cdot x\right) \cdot y}}{x - y}\]
    4. Using strategy rm
    5. Applied associate-/l*1.0

      \[\leadsto \color{blue}{\frac{2 \cdot x}{\frac{x - y}{y}}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification3.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -7.571272827848799 \cdot 10^{+93}:\\ \;\;\;\;\frac{y}{\sqrt[3]{x - y}} \cdot \frac{2 \cdot x}{\sqrt[3]{x - y} \cdot \sqrt[3]{x - y}}\\ \mathbf{elif}\;x \le 1.5811562494559677 \cdot 10^{+83}:\\ \;\;\;\;\frac{2 \cdot x}{\frac{x - y}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{\sqrt[3]{x - y}} \cdot \frac{2 \cdot x}{\sqrt[3]{x - y} \cdot \sqrt[3]{x - y}}\\ \end{array}\]

Reproduce

herbie shell --seed 1 
(FPCore (x y)
  :name "2*(x*y)/(x-y)"
  (/ (* 2 (* x y)) (- x y)))