Average Error: 7.8 → 0.4
Time: 10.7s
Precision: 64
\[\frac{2 \cdot x}{\frac{x - y}{y}}\]
\[\begin{array}{l} \mathbf{if}\;x \le -5.091827858905314 \cdot 10^{+93}:\\ \;\;\;\;\frac{2 \cdot x}{x - y} \cdot y\\ \mathbf{elif}\;x \le 1.71649334501874 \cdot 10^{-21}:\\ \;\;\;\;\left(2 \cdot x\right) \cdot \frac{y}{x - y}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot x}{x - y} \cdot y\\ \end{array}\]
\frac{2 \cdot x}{\frac{x - y}{y}}
\begin{array}{l}
\mathbf{if}\;x \le -5.091827858905314 \cdot 10^{+93}:\\
\;\;\;\;\frac{2 \cdot x}{x - y} \cdot y\\

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

\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot x}{x - y} \cdot y\\

\end{array}
double f(double x, double y) {
        double r9054540 = 2.0;
        double r9054541 = x;
        double r9054542 = r9054540 * r9054541;
        double r9054543 = y;
        double r9054544 = r9054541 - r9054543;
        double r9054545 = r9054544 / r9054543;
        double r9054546 = r9054542 / r9054545;
        return r9054546;
}

double f(double x, double y) {
        double r9054547 = x;
        double r9054548 = -5.091827858905314e+93;
        bool r9054549 = r9054547 <= r9054548;
        double r9054550 = 2.0;
        double r9054551 = r9054550 * r9054547;
        double r9054552 = y;
        double r9054553 = r9054547 - r9054552;
        double r9054554 = r9054551 / r9054553;
        double r9054555 = r9054554 * r9054552;
        double r9054556 = 1.71649334501874e-21;
        bool r9054557 = r9054547 <= r9054556;
        double r9054558 = r9054552 / r9054553;
        double r9054559 = r9054551 * r9054558;
        double r9054560 = r9054557 ? r9054559 : r9054555;
        double r9054561 = r9054549 ? r9054555 : r9054560;
        return r9054561;
}

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 < -5.091827858905314e+93 or 1.71649334501874e-21 < x

    1. Initial program 16.6

      \[\frac{2 \cdot x}{\frac{x - y}{y}}\]
    2. Using strategy rm
    3. Applied associate-/r/0.1

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

    if -5.091827858905314e+93 < x < 1.71649334501874e-21

    1. Initial program 0.6

      \[\frac{2 \cdot x}{\frac{x - y}{y}}\]
    2. Using strategy rm
    3. Applied div-inv0.7

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -5.091827858905314 \cdot 10^{+93}:\\ \;\;\;\;\frac{2 \cdot x}{x - y} \cdot y\\ \mathbf{elif}\;x \le 1.71649334501874 \cdot 10^{-21}:\\ \;\;\;\;\left(2 \cdot x\right) \cdot \frac{y}{x - y}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot x}{x - y} \cdot y\\ \end{array}\]

Reproduce

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