Average Error: 22.5 → 0.2
Time: 19.8s
Precision: 64
\[1 - \frac{\left(1 - x\right) \cdot y}{y + 1}\]
\[\begin{array}{l} \mathbf{if}\;y \le -100475634.736784503 \lor \neg \left(y \le 892748271927.31689\right):\\ \;\;\;\;x + \left(\frac{1}{y} - 1 \cdot \frac{x}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(1 - \frac{\left(1 - x\right) \cdot y}{{y}^{3} + {1}^{3}} \cdot \left(y \cdot y\right)\right) - \left(1 \cdot 1 - y \cdot 1\right) \cdot \frac{\left(1 - x\right) \cdot y}{{y}^{3} + {1}^{3}}\\ \end{array}\]
1 - \frac{\left(1 - x\right) \cdot y}{y + 1}
\begin{array}{l}
\mathbf{if}\;y \le -100475634.736784503 \lor \neg \left(y \le 892748271927.31689\right):\\
\;\;\;\;x + \left(\frac{1}{y} - 1 \cdot \frac{x}{y}\right)\\

\mathbf{else}:\\
\;\;\;\;\left(1 - \frac{\left(1 - x\right) \cdot y}{{y}^{3} + {1}^{3}} \cdot \left(y \cdot y\right)\right) - \left(1 \cdot 1 - y \cdot 1\right) \cdot \frac{\left(1 - x\right) \cdot y}{{y}^{3} + {1}^{3}}\\

\end{array}
double f(double x, double y) {
        double r567734 = 1.0;
        double r567735 = x;
        double r567736 = r567734 - r567735;
        double r567737 = y;
        double r567738 = r567736 * r567737;
        double r567739 = r567737 + r567734;
        double r567740 = r567738 / r567739;
        double r567741 = r567734 - r567740;
        return r567741;
}

double f(double x, double y) {
        double r567742 = y;
        double r567743 = -100475634.7367845;
        bool r567744 = r567742 <= r567743;
        double r567745 = 892748271927.3169;
        bool r567746 = r567742 <= r567745;
        double r567747 = !r567746;
        bool r567748 = r567744 || r567747;
        double r567749 = x;
        double r567750 = 1.0;
        double r567751 = r567750 / r567742;
        double r567752 = r567749 / r567742;
        double r567753 = r567750 * r567752;
        double r567754 = r567751 - r567753;
        double r567755 = r567749 + r567754;
        double r567756 = r567750 - r567749;
        double r567757 = r567756 * r567742;
        double r567758 = 3.0;
        double r567759 = pow(r567742, r567758);
        double r567760 = pow(r567750, r567758);
        double r567761 = r567759 + r567760;
        double r567762 = r567757 / r567761;
        double r567763 = r567742 * r567742;
        double r567764 = r567762 * r567763;
        double r567765 = r567750 - r567764;
        double r567766 = r567750 * r567750;
        double r567767 = r567742 * r567750;
        double r567768 = r567766 - r567767;
        double r567769 = r567768 * r567762;
        double r567770 = r567765 - r567769;
        double r567771 = r567748 ? r567755 : r567770;
        return r567771;
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original22.5
Target0.3
Herbie0.2
\[\begin{array}{l} \mathbf{if}\;y \lt -3693.84827882972468:\\ \;\;\;\;\frac{1}{y} - \left(\frac{x}{y} - x\right)\\ \mathbf{elif}\;y \lt 6799310503.41891003:\\ \;\;\;\;1 - \frac{\left(1 - x\right) \cdot y}{y + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{y} - \left(\frac{x}{y} - x\right)\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if y < -100475634.7367845 or 892748271927.3169 < y

    1. Initial program 46.0

      \[1 - \frac{\left(1 - x\right) \cdot y}{y + 1}\]
    2. Using strategy rm
    3. Applied flip3-+54.7

      \[\leadsto 1 - \frac{\left(1 - x\right) \cdot y}{\color{blue}{\frac{{y}^{3} + {1}^{3}}{y \cdot y + \left(1 \cdot 1 - y \cdot 1\right)}}}\]
    4. Applied associate-/r/54.7

      \[\leadsto 1 - \color{blue}{\frac{\left(1 - x\right) \cdot y}{{y}^{3} + {1}^{3}} \cdot \left(y \cdot y + \left(1 \cdot 1 - y \cdot 1\right)\right)}\]
    5. Using strategy rm
    6. Applied sum-cubes54.7

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

      \[\leadsto 1 - \color{blue}{\frac{\frac{\left(1 - x\right) \cdot y}{y \cdot y + \left(1 \cdot 1 - y \cdot 1\right)}}{y + 1}} \cdot \left(y \cdot y + \left(1 \cdot 1 - y \cdot 1\right)\right)\]
    8. Simplified46.8

      \[\leadsto 1 - \frac{\color{blue}{\frac{1 - x}{\frac{y \cdot y + 1 \cdot \left(1 - y\right)}{y}}}}{y + 1} \cdot \left(y \cdot y + \left(1 \cdot 1 - y \cdot 1\right)\right)\]
    9. Taylor expanded around inf 0.2

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

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

    if -100475634.7367845 < y < 892748271927.3169

    1. Initial program 0.3

      \[1 - \frac{\left(1 - x\right) \cdot y}{y + 1}\]
    2. Using strategy rm
    3. Applied flip3-+0.3

      \[\leadsto 1 - \frac{\left(1 - x\right) \cdot y}{\color{blue}{\frac{{y}^{3} + {1}^{3}}{y \cdot y + \left(1 \cdot 1 - y \cdot 1\right)}}}\]
    4. Applied associate-/r/0.3

      \[\leadsto 1 - \color{blue}{\frac{\left(1 - x\right) \cdot y}{{y}^{3} + {1}^{3}} \cdot \left(y \cdot y + \left(1 \cdot 1 - y \cdot 1\right)\right)}\]
    5. Using strategy rm
    6. Applied distribute-rgt-in0.3

      \[\leadsto 1 - \color{blue}{\left(\left(y \cdot y\right) \cdot \frac{\left(1 - x\right) \cdot y}{{y}^{3} + {1}^{3}} + \left(1 \cdot 1 - y \cdot 1\right) \cdot \frac{\left(1 - x\right) \cdot y}{{y}^{3} + {1}^{3}}\right)}\]
    7. Applied associate--r+0.2

      \[\leadsto \color{blue}{\left(1 - \left(y \cdot y\right) \cdot \frac{\left(1 - x\right) \cdot y}{{y}^{3} + {1}^{3}}\right) - \left(1 \cdot 1 - y \cdot 1\right) \cdot \frac{\left(1 - x\right) \cdot y}{{y}^{3} + {1}^{3}}}\]
    8. Simplified0.2

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -100475634.736784503 \lor \neg \left(y \le 892748271927.31689\right):\\ \;\;\;\;x + \left(\frac{1}{y} - 1 \cdot \frac{x}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(1 - \frac{\left(1 - x\right) \cdot y}{{y}^{3} + {1}^{3}} \cdot \left(y \cdot y\right)\right) - \left(1 \cdot 1 - y \cdot 1\right) \cdot \frac{\left(1 - x\right) \cdot y}{{y}^{3} + {1}^{3}}\\ \end{array}\]

Reproduce

herbie shell --seed 2019198 
(FPCore (x y)
  :name "Diagrams.Trail:splitAtParam  from diagrams-lib-1.3.0.3, D"

  :herbie-target
  (if (< y -3693.8482788297247) (- (/ 1.0 y) (- (/ x y) x)) (if (< y 6799310503.41891) (- 1.0 (/ (* (- 1.0 x) y) (+ y 1.0))) (- (/ 1.0 y) (- (/ x y) x))))

  (- 1.0 (/ (* (- 1.0 x) y) (+ y 1.0))))