Average Error: 14.4 → 3.1
Time: 9.6s
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 r14889015 = 2.0;
        double r14889016 = x;
        double r14889017 = y;
        double r14889018 = r14889016 * r14889017;
        double r14889019 = r14889015 * r14889018;
        double r14889020 = r14889016 - r14889017;
        double r14889021 = r14889019 / r14889020;
        return r14889021;
}

double f(double x, double y) {
        double r14889022 = x;
        double r14889023 = -7.571272827848799e+93;
        bool r14889024 = r14889022 <= r14889023;
        double r14889025 = y;
        double r14889026 = r14889022 - r14889025;
        double r14889027 = cbrt(r14889026);
        double r14889028 = r14889025 / r14889027;
        double r14889029 = 2.0;
        double r14889030 = r14889029 * r14889022;
        double r14889031 = r14889027 * r14889027;
        double r14889032 = r14889030 / r14889031;
        double r14889033 = r14889028 * r14889032;
        double r14889034 = 1.5811562494559677e+83;
        bool r14889035 = r14889022 <= r14889034;
        double r14889036 = r14889026 / r14889025;
        double r14889037 = r14889030 / r14889036;
        double r14889038 = r14889035 ? r14889037 : r14889033;
        double r14889039 = r14889024 ? r14889033 : r14889038;
        return r14889039;
}

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)))