1 - \log \left(1 - \frac{x - y}{1 - y}\right)\begin{array}{l}
\mathbf{if}\;\frac{x - y}{1 - y} \le 1.545842237750884217971380531209124598035 \cdot 10^{-7}:\\
\;\;\;\;1 - \log \left(1 - \left(x - y\right) \cdot \frac{1}{1 - y}\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \left(\log \left(\sqrt{\left(\frac{x}{y} + 1 \cdot \frac{x}{{y}^{2}}\right) - \frac{1}{y}}\right) + \log \left(\sqrt{\left(\frac{x}{y} + 1 \cdot \frac{x}{{y}^{2}}\right) - \frac{1}{y}}\right)\right)\\
\end{array}double f(double x, double y) {
double r233115 = 1.0;
double r233116 = x;
double r233117 = y;
double r233118 = r233116 - r233117;
double r233119 = r233115 - r233117;
double r233120 = r233118 / r233119;
double r233121 = r233115 - r233120;
double r233122 = log(r233121);
double r233123 = r233115 - r233122;
return r233123;
}
double f(double x, double y) {
double r233124 = x;
double r233125 = y;
double r233126 = r233124 - r233125;
double r233127 = 1.0;
double r233128 = r233127 - r233125;
double r233129 = r233126 / r233128;
double r233130 = 1.5458422377508842e-07;
bool r233131 = r233129 <= r233130;
double r233132 = 1.0;
double r233133 = r233132 / r233128;
double r233134 = r233126 * r233133;
double r233135 = r233127 - r233134;
double r233136 = log(r233135);
double r233137 = r233127 - r233136;
double r233138 = r233124 / r233125;
double r233139 = 2.0;
double r233140 = pow(r233125, r233139);
double r233141 = r233124 / r233140;
double r233142 = r233127 * r233141;
double r233143 = r233138 + r233142;
double r233144 = r233127 / r233125;
double r233145 = r233143 - r233144;
double r233146 = sqrt(r233145);
double r233147 = log(r233146);
double r233148 = r233147 + r233147;
double r233149 = r233127 - r233148;
double r233150 = r233131 ? r233137 : r233149;
return r233150;
}




Bits error versus x




Bits error versus y
Results
| Original | 18.2 |
|---|---|
| Target | 0.1 |
| Herbie | 0.8 |
if (/ (- x y) (- 1.0 y)) < 1.5458422377508842e-07Initial program 0.0
rmApplied div-inv0.0
if 1.5458422377508842e-07 < (/ (- x y) (- 1.0 y)) Initial program 59.8
Taylor expanded around inf 2.4
Simplified2.4
rmApplied add-sqr-sqrt2.4
Applied log-prod2.4
Final simplification0.8
herbie shell --seed 2019305
(FPCore (x y)
:name "Numeric.SpecFunctions:invIncompleteGamma from math-functions-0.1.5.2, B"
:precision binary64
:herbie-target
(if (< y -81284752.619472414) (- 1 (log (- (/ x (* y y)) (- (/ 1 y) (/ x y))))) (if (< y 3.0094271212461764e25) (log (/ (exp 1) (- 1 (/ (- x y) (- 1 y))))) (- 1 (log (- (/ x (* y y)) (- (/ 1 y) (/ x y)))))))
(- 1 (log (- 1 (/ (- x y) (- 1 y))))))