1.0 - \log \left(1.0 - \frac{x - y}{1.0 - y}\right)\begin{array}{l}
\mathbf{if}\;\frac{x - y}{1.0 - y} \le 0.9998974867815034:\\
\;\;\;\;1.0 - \log \left(1.0 - \frac{\frac{x - y}{\sqrt[3]{1.0 - y} \cdot \sqrt[3]{1.0 - y}}}{\sqrt[3]{1.0 - y}}\right)\\
\mathbf{else}:\\
\;\;\;\;1.0 - \log \left(\mathsf{fma}\left(\frac{x}{y}, \frac{1.0}{y}, \frac{x}{y} - \frac{1.0}{y}\right)\right)\\
\end{array}double f(double x, double y) {
double r22090803 = 1.0;
double r22090804 = x;
double r22090805 = y;
double r22090806 = r22090804 - r22090805;
double r22090807 = r22090803 - r22090805;
double r22090808 = r22090806 / r22090807;
double r22090809 = r22090803 - r22090808;
double r22090810 = log(r22090809);
double r22090811 = r22090803 - r22090810;
return r22090811;
}
double f(double x, double y) {
double r22090812 = x;
double r22090813 = y;
double r22090814 = r22090812 - r22090813;
double r22090815 = 1.0;
double r22090816 = r22090815 - r22090813;
double r22090817 = r22090814 / r22090816;
double r22090818 = 0.9998974867815034;
bool r22090819 = r22090817 <= r22090818;
double r22090820 = cbrt(r22090816);
double r22090821 = r22090820 * r22090820;
double r22090822 = r22090814 / r22090821;
double r22090823 = r22090822 / r22090820;
double r22090824 = r22090815 - r22090823;
double r22090825 = log(r22090824);
double r22090826 = r22090815 - r22090825;
double r22090827 = r22090812 / r22090813;
double r22090828 = r22090815 / r22090813;
double r22090829 = r22090827 - r22090828;
double r22090830 = fma(r22090827, r22090828, r22090829);
double r22090831 = log(r22090830);
double r22090832 = r22090815 - r22090831;
double r22090833 = r22090819 ? r22090826 : r22090832;
return r22090833;
}




Bits error versus x




Bits error versus y
| Original | 18.8 |
|---|---|
| Target | 0.1 |
| Herbie | 0.2 |
if (/ (- x y) (- 1.0 y)) < 0.9998974867815034Initial program 0.1
rmApplied add-cube-cbrt0.1
Applied associate-/r*0.1
if 0.9998974867815034 < (/ (- x y) (- 1.0 y)) Initial program 61.9
Taylor expanded around inf 0.4
Simplified0.4
Final simplification0.2
herbie shell --seed 2019165 +o rules:numerics
(FPCore (x y)
:name "Numeric.SpecFunctions:invIncompleteGamma from math-functions-0.1.5.2, B"
:herbie-target
(if (< y -81284752.61947241) (- 1.0 (log (- (/ x (* y y)) (- (/ 1.0 y) (/ x y))))) (if (< y 3.0094271212461764e+25) (log (/ (exp 1.0) (- 1.0 (/ (- x y) (- 1.0 y))))) (- 1.0 (log (- (/ x (* y y)) (- (/ 1.0 y) (/ x y)))))))
(- 1.0 (log (- 1.0 (/ (- x y) (- 1.0 y))))))