Average Error: 17.9 → 0.1
Time: 14.1s
Precision: 64
\[1 - \log \left(1 - \frac{x - y}{1 - y}\right)\]
\[\begin{array}{l} \mathbf{if}\;y \le -68337904.125021249 \lor \neg \left(y \le 27970212.3287003301\right):\\ \;\;\;\;1 - \log \left(\left(\left(1 \cdot \frac{x}{{y}^{2}} + \frac{x}{y}\right) - 1 \cdot \frac{1}{y}\right) + \frac{x - y}{1 \cdot 1 - y \cdot y} \cdot \left(\left(-\left(1 + y\right)\right) + \left(1 + y\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;1 - \log \left(\left(\mathsf{fma}\left(\sqrt[3]{1} \cdot \sqrt[3]{1}, \sqrt[3]{1}, -\frac{x - y}{\sqrt[3]{1 \cdot 1 - y \cdot y}} \cdot \left(\left(1 + y\right) \cdot \frac{1}{\sqrt[3]{1 \cdot 1 - y \cdot y} \cdot \sqrt[3]{1 \cdot 1 - y \cdot y}}\right)\right) + \mathsf{fma}\left(-\frac{x - y}{\sqrt[3]{1 \cdot 1 - y \cdot y}}, \left(1 + y\right) \cdot \frac{1}{\sqrt[3]{1 \cdot 1 - y \cdot y} \cdot \sqrt[3]{1 \cdot 1 - y \cdot y}}, \frac{x - y}{\sqrt[3]{1 \cdot 1 - y \cdot y}} \cdot \left(\left(1 + y\right) \cdot \frac{1}{\sqrt[3]{1 \cdot 1 - y \cdot y} \cdot \sqrt[3]{1 \cdot 1 - y \cdot y}}\right)\right)\right) + \frac{x - y}{1 \cdot 1 - y \cdot y} \cdot \left(\left(-\left(1 + y\right)\right) + \left(1 + y\right)\right)\right)\\ \end{array}\]
1 - \log \left(1 - \frac{x - y}{1 - y}\right)
\begin{array}{l}
\mathbf{if}\;y \le -68337904.125021249 \lor \neg \left(y \le 27970212.3287003301\right):\\
\;\;\;\;1 - \log \left(\left(\left(1 \cdot \frac{x}{{y}^{2}} + \frac{x}{y}\right) - 1 \cdot \frac{1}{y}\right) + \frac{x - y}{1 \cdot 1 - y \cdot y} \cdot \left(\left(-\left(1 + y\right)\right) + \left(1 + y\right)\right)\right)\\

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

\end{array}
double code(double x, double y) {
	return ((double) (1.0 - ((double) log(((double) (1.0 - ((double) (((double) (x - y)) / ((double) (1.0 - y))))))))));
}
double code(double x, double y) {
	double VAR;
	if (((y <= -68337904.12502125) || !(y <= 27970212.32870033))) {
		VAR = ((double) (1.0 - ((double) log(((double) (((double) (((double) (((double) (1.0 * ((double) (x / ((double) pow(y, 2.0)))))) + ((double) (x / y)))) - ((double) (1.0 * ((double) (1.0 / y)))))) + ((double) (((double) (((double) (x - y)) / ((double) (((double) (1.0 * 1.0)) - ((double) (y * y)))))) * ((double) (((double) -(((double) (1.0 + y)))) + ((double) (1.0 + y))))))))))));
	} else {
		VAR = ((double) (1.0 - ((double) log(((double) (((double) (((double) fma(((double) (((double) cbrt(1.0)) * ((double) cbrt(1.0)))), ((double) cbrt(1.0)), ((double) -(((double) (((double) (((double) (x - y)) / ((double) cbrt(((double) (((double) (1.0 * 1.0)) - ((double) (y * y)))))))) * ((double) (((double) (1.0 + y)) * ((double) (1.0 / ((double) (((double) cbrt(((double) (((double) (1.0 * 1.0)) - ((double) (y * y)))))) * ((double) cbrt(((double) (((double) (1.0 * 1.0)) - ((double) (y * y)))))))))))))))))) + ((double) fma(((double) -(((double) (((double) (x - y)) / ((double) cbrt(((double) (((double) (1.0 * 1.0)) - ((double) (y * y)))))))))), ((double) (((double) (1.0 + y)) * ((double) (1.0 / ((double) (((double) cbrt(((double) (((double) (1.0 * 1.0)) - ((double) (y * y)))))) * ((double) cbrt(((double) (((double) (1.0 * 1.0)) - ((double) (y * y)))))))))))), ((double) (((double) (((double) (x - y)) / ((double) cbrt(((double) (((double) (1.0 * 1.0)) - ((double) (y * y)))))))) * ((double) (((double) (1.0 + y)) * ((double) (1.0 / ((double) (((double) cbrt(((double) (((double) (1.0 * 1.0)) - ((double) (y * y)))))) * ((double) cbrt(((double) (((double) (1.0 * 1.0)) - ((double) (y * y)))))))))))))))))) + ((double) (((double) (((double) (x - y)) / ((double) (((double) (1.0 * 1.0)) - ((double) (y * y)))))) * ((double) (((double) -(((double) (1.0 + y)))) + ((double) (1.0 + y))))))))))));
	}
	return VAR;
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original17.9
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 < -68337904.12502125 or 27970212.32870033 < y

    1. Initial program 46.3

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

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

      \[\leadsto 1 - \log \left(1 - \color{blue}{\frac{x - y}{1 \cdot 1 - y \cdot y} \cdot \left(1 + y\right)}\right)\]
    5. Applied add-sqr-sqrt46.3

      \[\leadsto 1 - \log \left(\color{blue}{\sqrt{1} \cdot \sqrt{1}} - \frac{x - y}{1 \cdot 1 - y \cdot y} \cdot \left(1 + y\right)\right)\]
    6. Applied prod-diff45.5

      \[\leadsto 1 - \log \color{blue}{\left(\mathsf{fma}\left(\sqrt{1}, \sqrt{1}, -\left(1 + y\right) \cdot \frac{x - y}{1 \cdot 1 - y \cdot y}\right) + \mathsf{fma}\left(-\left(1 + y\right), \frac{x - y}{1 \cdot 1 - y \cdot y}, \left(1 + y\right) \cdot \frac{x - y}{1 \cdot 1 - y \cdot y}\right)\right)}\]
    7. Simplified45.5

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

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

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

    if -68337904.12502125 < y < 27970212.32870033

    1. Initial program 0.1

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

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

      \[\leadsto 1 - \log \left(1 - \color{blue}{\frac{x - y}{1 \cdot 1 - y \cdot y} \cdot \left(1 + y\right)}\right)\]
    5. Applied add-sqr-sqrt0.1

      \[\leadsto 1 - \log \left(\color{blue}{\sqrt{1} \cdot \sqrt{1}} - \frac{x - y}{1 \cdot 1 - y \cdot y} \cdot \left(1 + y\right)\right)\]
    6. Applied prod-diff0.1

      \[\leadsto 1 - \log \color{blue}{\left(\mathsf{fma}\left(\sqrt{1}, \sqrt{1}, -\left(1 + y\right) \cdot \frac{x - y}{1 \cdot 1 - y \cdot y}\right) + \mathsf{fma}\left(-\left(1 + y\right), \frac{x - y}{1 \cdot 1 - y \cdot y}, \left(1 + y\right) \cdot \frac{x - y}{1 \cdot 1 - y \cdot y}\right)\right)}\]
    7. Simplified0.1

      \[\leadsto 1 - \log \left(\color{blue}{\left(1 - \left(1 + y\right) \cdot \frac{x - y}{1 \cdot 1 - y \cdot y}\right)} + \mathsf{fma}\left(-\left(1 + y\right), \frac{x - y}{1 \cdot 1 - y \cdot y}, \left(1 + y\right) \cdot \frac{x - y}{1 \cdot 1 - y \cdot y}\right)\right)\]
    8. Simplified0.1

      \[\leadsto 1 - \log \left(\left(1 - \left(1 + y\right) \cdot \frac{x - y}{1 \cdot 1 - y \cdot y}\right) + \color{blue}{\frac{x - y}{1 \cdot 1 - y \cdot y} \cdot \left(\left(-\left(1 + y\right)\right) + \left(1 + y\right)\right)}\right)\]
    9. Using strategy rm
    10. Applied add-cube-cbrt0.1

      \[\leadsto 1 - \log \left(\left(1 - \left(1 + y\right) \cdot \frac{x - y}{\color{blue}{\left(\sqrt[3]{1 \cdot 1 - y \cdot y} \cdot \sqrt[3]{1 \cdot 1 - y \cdot y}\right) \cdot \sqrt[3]{1 \cdot 1 - y \cdot y}}}\right) + \frac{x - y}{1 \cdot 1 - y \cdot y} \cdot \left(\left(-\left(1 + y\right)\right) + \left(1 + y\right)\right)\right)\]
    11. Applied *-un-lft-identity0.1

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

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

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

      \[\leadsto 1 - \log \left(\left(\color{blue}{\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \sqrt[3]{1}} - \left(\left(1 + y\right) \cdot \frac{1}{\sqrt[3]{1 \cdot 1 - y \cdot y} \cdot \sqrt[3]{1 \cdot 1 - y \cdot y}}\right) \cdot \frac{x - y}{\sqrt[3]{1 \cdot 1 - y \cdot y}}\right) + \frac{x - y}{1 \cdot 1 - y \cdot y} \cdot \left(\left(-\left(1 + y\right)\right) + \left(1 + y\right)\right)\right)\]
    15. Applied prod-diff0.1

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

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

Reproduce

herbie shell --seed 2020113 +o rules:numerics
(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))))))