Average Error: 18.2 → 0.1
Time: 6.7s
Precision: 64
\[1 - \log \left(1 - \frac{x - y}{1 - y}\right)\]
\[\begin{array}{l} \mathbf{if}\;y \le -51178879.934393361 \lor \neg \left(y \le 53143023.8704946265\right):\\ \;\;\;\;\log \left(\frac{e^{1}}{\left(\frac{x}{y} + 1 \cdot \frac{x}{{y}^{2}}\right) - \frac{1}{y}}\right)\\ \mathbf{else}:\\ \;\;\;\;1 - \log \left(1 - \left(\sqrt[3]{x - y} \cdot \sqrt[3]{x - y}\right) \cdot \frac{\sqrt[3]{x - y}}{1 - y}\right)\\ \end{array}\]
1 - \log \left(1 - \frac{x - y}{1 - y}\right)
\begin{array}{l}
\mathbf{if}\;y \le -51178879.934393361 \lor \neg \left(y \le 53143023.8704946265\right):\\
\;\;\;\;\log \left(\frac{e^{1}}{\left(\frac{x}{y} + 1 \cdot \frac{x}{{y}^{2}}\right) - \frac{1}{y}}\right)\\

\mathbf{else}:\\
\;\;\;\;1 - \log \left(1 - \left(\sqrt[3]{x - y} \cdot \sqrt[3]{x - y}\right) \cdot \frac{\sqrt[3]{x - y}}{1 - y}\right)\\

\end{array}
double f(double x, double y) {
        double r1113780 = 1.0;
        double r1113781 = x;
        double r1113782 = y;
        double r1113783 = r1113781 - r1113782;
        double r1113784 = r1113780 - r1113782;
        double r1113785 = r1113783 / r1113784;
        double r1113786 = r1113780 - r1113785;
        double r1113787 = log(r1113786);
        double r1113788 = r1113780 - r1113787;
        return r1113788;
}

double f(double x, double y) {
        double r1113789 = y;
        double r1113790 = -51178879.93439336;
        bool r1113791 = r1113789 <= r1113790;
        double r1113792 = 53143023.87049463;
        bool r1113793 = r1113789 <= r1113792;
        double r1113794 = !r1113793;
        bool r1113795 = r1113791 || r1113794;
        double r1113796 = 1.0;
        double r1113797 = exp(r1113796);
        double r1113798 = x;
        double r1113799 = r1113798 / r1113789;
        double r1113800 = 2.0;
        double r1113801 = pow(r1113789, r1113800);
        double r1113802 = r1113798 / r1113801;
        double r1113803 = r1113796 * r1113802;
        double r1113804 = r1113799 + r1113803;
        double r1113805 = r1113796 / r1113789;
        double r1113806 = r1113804 - r1113805;
        double r1113807 = r1113797 / r1113806;
        double r1113808 = log(r1113807);
        double r1113809 = r1113798 - r1113789;
        double r1113810 = cbrt(r1113809);
        double r1113811 = r1113810 * r1113810;
        double r1113812 = r1113796 - r1113789;
        double r1113813 = r1113810 / r1113812;
        double r1113814 = r1113811 * r1113813;
        double r1113815 = r1113796 - r1113814;
        double r1113816 = log(r1113815);
        double r1113817 = r1113796 - r1113816;
        double r1113818 = r1113795 ? r1113808 : r1113817;
        return r1113818;
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original18.2
Target0.1
Herbie0.1
\[\begin{array}{l} \mathbf{if}\;y \lt -81284752.619472414:\\ \;\;\;\;1 - \log \left(\frac{x}{y \cdot y} - \left(\frac{1}{y} - \frac{x}{y}\right)\right)\\ \mathbf{elif}\;y \lt 3.0094271212461764 \cdot 10^{25}:\\ \;\;\;\;\log \left(\frac{e^{1}}{1 - \frac{x - y}{1 - y}}\right)\\ \mathbf{else}:\\ \;\;\;\;1 - \log \left(\frac{x}{y \cdot y} - \left(\frac{1}{y} - \frac{x}{y}\right)\right)\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if y < -51178879.93439336 or 53143023.87049463 < y

    1. Initial program 47.0

      \[1 - \log \left(1 - \frac{x - y}{1 - y}\right)\]
    2. Using strategy rm
    3. Applied add-log-exp47.0

      \[\leadsto \color{blue}{\log \left(e^{1}\right)} - \log \left(1 - \frac{x - y}{1 - y}\right)\]
    4. Applied diff-log47.0

      \[\leadsto \color{blue}{\log \left(\frac{e^{1}}{1 - \frac{x - y}{1 - y}}\right)}\]
    5. Taylor expanded around inf 0.2

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

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

    if -51178879.93439336 < y < 53143023.87049463

    1. Initial program 0.1

      \[1 - \log \left(1 - \frac{x - y}{1 - y}\right)\]
    2. Using strategy rm
    3. Applied *-un-lft-identity0.1

      \[\leadsto 1 - \log \left(1 - \frac{x - y}{\color{blue}{1 \cdot \left(1 - y\right)}}\right)\]
    4. Applied add-cube-cbrt0.1

      \[\leadsto 1 - \log \left(1 - \frac{\color{blue}{\left(\sqrt[3]{x - y} \cdot \sqrt[3]{x - y}\right) \cdot \sqrt[3]{x - y}}}{1 \cdot \left(1 - y\right)}\right)\]
    5. Applied times-frac0.1

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -51178879.934393361 \lor \neg \left(y \le 53143023.8704946265\right):\\ \;\;\;\;\log \left(\frac{e^{1}}{\left(\frac{x}{y} + 1 \cdot \frac{x}{{y}^{2}}\right) - \frac{1}{y}}\right)\\ \mathbf{else}:\\ \;\;\;\;1 - \log \left(1 - \left(\sqrt[3]{x - y} \cdot \sqrt[3]{x - y}\right) \cdot \frac{\sqrt[3]{x - y}}{1 - y}\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2020047 
(FPCore (x y)
  :name "Numeric.SpecFunctions:invIncompleteGamma from math-functions-0.1.5.2, B"
  :precision binary64

  :herbie-target
  (if (< y -81284752.61947241) (- 1 (log (- (/ x (* y y)) (- (/ 1 y) (/ x y))))) (if (< y 3.0094271212461764e+25) (log (/ (exp 1) (- 1 (/ (- x y) (- 1 y))))) (- 1 (log (- (/ x (* y y)) (- (/ 1 y) (/ x y)))))))

  (- 1 (log (- 1 (/ (- x y) (- 1 y))))))