Average Error: 22.6 → 0.2
Time: 45.8s
Precision: 64
\[1 - \frac{\left(1 - x\right) \cdot y}{y + 1}\]
\[\begin{array}{l} \mathbf{if}\;y \le -12832313739411.76171875:\\ \;\;\;\;x + \left(\frac{1}{y} - \frac{x}{y} \cdot 1\right)\\ \mathbf{elif}\;y \le 1637963662191947:\\ \;\;\;\;\left(1 - \left(y \cdot y\right) \cdot \frac{y \cdot \frac{1 - x}{\left(y \cdot y - 1 \cdot y\right) + 1 \cdot 1}}{y + 1}\right) - \left(y \cdot \frac{\frac{1 - x}{\left(y \cdot y - 1 \cdot y\right) + 1 \cdot 1}}{y + 1}\right) \cdot \left(1 \cdot 1 - 1 \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;x + \left(\frac{1}{y} - \frac{x}{y} \cdot 1\right)\\ \end{array}\]
1 - \frac{\left(1 - x\right) \cdot y}{y + 1}
\begin{array}{l}
\mathbf{if}\;y \le -12832313739411.76171875:\\
\;\;\;\;x + \left(\frac{1}{y} - \frac{x}{y} \cdot 1\right)\\

\mathbf{elif}\;y \le 1637963662191947:\\
\;\;\;\;\left(1 - \left(y \cdot y\right) \cdot \frac{y \cdot \frac{1 - x}{\left(y \cdot y - 1 \cdot y\right) + 1 \cdot 1}}{y + 1}\right) - \left(y \cdot \frac{\frac{1 - x}{\left(y \cdot y - 1 \cdot y\right) + 1 \cdot 1}}{y + 1}\right) \cdot \left(1 \cdot 1 - 1 \cdot y\right)\\

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

\end{array}
double f(double x, double y) {
        double r34082721 = 1.0;
        double r34082722 = x;
        double r34082723 = r34082721 - r34082722;
        double r34082724 = y;
        double r34082725 = r34082723 * r34082724;
        double r34082726 = r34082724 + r34082721;
        double r34082727 = r34082725 / r34082726;
        double r34082728 = r34082721 - r34082727;
        return r34082728;
}

double f(double x, double y) {
        double r34082729 = y;
        double r34082730 = -12832313739411.762;
        bool r34082731 = r34082729 <= r34082730;
        double r34082732 = x;
        double r34082733 = 1.0;
        double r34082734 = r34082733 / r34082729;
        double r34082735 = r34082732 / r34082729;
        double r34082736 = r34082735 * r34082733;
        double r34082737 = r34082734 - r34082736;
        double r34082738 = r34082732 + r34082737;
        double r34082739 = 1637963662191947.0;
        bool r34082740 = r34082729 <= r34082739;
        double r34082741 = r34082729 * r34082729;
        double r34082742 = r34082733 - r34082732;
        double r34082743 = r34082733 * r34082729;
        double r34082744 = r34082741 - r34082743;
        double r34082745 = r34082733 * r34082733;
        double r34082746 = r34082744 + r34082745;
        double r34082747 = r34082742 / r34082746;
        double r34082748 = r34082729 * r34082747;
        double r34082749 = r34082729 + r34082733;
        double r34082750 = r34082748 / r34082749;
        double r34082751 = r34082741 * r34082750;
        double r34082752 = r34082733 - r34082751;
        double r34082753 = r34082747 / r34082749;
        double r34082754 = r34082729 * r34082753;
        double r34082755 = r34082745 - r34082743;
        double r34082756 = r34082754 * r34082755;
        double r34082757 = r34082752 - r34082756;
        double r34082758 = r34082740 ? r34082757 : r34082738;
        double r34082759 = r34082731 ? r34082738 : r34082758;
        return r34082759;
}

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.6
Target0.2
Herbie0.2
\[\begin{array}{l} \mathbf{if}\;y \lt -3693.848278829724677052581682801246643066:\\ \;\;\;\;\frac{1}{y} - \left(\frac{x}{y} - x\right)\\ \mathbf{elif}\;y \lt 6799310503.41891002655029296875:\\ \;\;\;\;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 < -12832313739411.762 or 1637963662191947.0 < y

    1. Initial program 46.3

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

      \[\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/55.1

      \[\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. Simplified53.3

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

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

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

    if -12832313739411.762 < y < 1637963662191947.0

    1. Initial program 0.5

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

      \[\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.5

      \[\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. Simplified0.5

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

      \[\leadsto 1 - \left(\frac{1 - x}{1 \cdot \left(1 \cdot 1\right) + \color{blue}{{y}^{3}}} \cdot y\right) \cdot \left(y \cdot y + \left(1 \cdot 1 - y \cdot 1\right)\right)\]
    8. Applied cube-unmult0.5

      \[\leadsto 1 - \left(\frac{1 - x}{\color{blue}{{1}^{3}} + {y}^{3}} \cdot y\right) \cdot \left(y \cdot y + \left(1 \cdot 1 - y \cdot 1\right)\right)\]
    9. Applied sum-cubes0.5

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

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

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

      \[\leadsto \color{blue}{\left(1 - \left(y \cdot y\right) \cdot \left(\frac{\frac{1 - x}{1 \cdot 1 + \left(y \cdot y - 1 \cdot y\right)}}{1 + y} \cdot y\right)\right) - \left(1 \cdot 1 - y \cdot 1\right) \cdot \left(\frac{\frac{1 - x}{1 \cdot 1 + \left(y \cdot y - 1 \cdot y\right)}}{1 + y} \cdot y\right)}\]
    14. Using strategy rm
    15. Applied associate-*l/0.3

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -12832313739411.76171875:\\ \;\;\;\;x + \left(\frac{1}{y} - \frac{x}{y} \cdot 1\right)\\ \mathbf{elif}\;y \le 1637963662191947:\\ \;\;\;\;\left(1 - \left(y \cdot y\right) \cdot \frac{y \cdot \frac{1 - x}{\left(y \cdot y - 1 \cdot y\right) + 1 \cdot 1}}{y + 1}\right) - \left(y \cdot \frac{\frac{1 - x}{\left(y \cdot y - 1 \cdot y\right) + 1 \cdot 1}}{y + 1}\right) \cdot \left(1 \cdot 1 - 1 \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;x + \left(\frac{1}{y} - \frac{x}{y} \cdot 1\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2019168 
(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))))