\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}\begin{array}{l}
\mathbf{if}\;x \le -5.524707695762122406128297926502901213277 \cdot 10^{-17}:\\
\;\;\;\;\frac{\log \left({1}^{3} - {x}^{3}\right) - \sqrt[3]{{\left(\sqrt[3]{\log \left(1 \cdot 1 + \left(x \cdot x + 1 \cdot x\right)\right) \cdot \log \left(1 \cdot 1 + \left(x \cdot x + 1 \cdot x\right)\right)} \cdot \sqrt[3]{\log \left(1 \cdot 1 + \left(x \cdot x + 1 \cdot x\right)\right)}\right)}^{3}}}{\log \left(1 + x\right)}\\
\mathbf{elif}\;x \le 1.134036592157405800381078481820496753738 \cdot 10^{-16}:\\
\;\;\;\;\frac{\log \left({1}^{3} - {x}^{3}\right) - \sqrt[3]{{\left(\sqrt[3]{\log \left(1 \cdot 1 + \left(x \cdot x + 1 \cdot x\right)\right) \cdot \log \left(1 \cdot 1 + \left(x \cdot x + 1 \cdot x\right)\right)} \cdot \sqrt[3]{\log \left(1 \cdot 1 + \left(x \cdot x + 1 \cdot x\right)\right)}\right)}^{3}}}{\mathsf{fma}\left(x, 1, \log 1 - \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\log \left({1}^{3} - {x}^{3}\right) - \sqrt[3]{{\left(\sqrt[3]{\log \left(1 \cdot 1 + \left(x \cdot x + 1 \cdot x\right)\right) \cdot \log \left(1 \cdot 1 + \left(x \cdot x + 1 \cdot x\right)\right)} \cdot \sqrt[3]{\log \left(1 \cdot 1 + \left(x \cdot x + 1 \cdot x\right)\right)}\right)}^{3}}}{e^{\log \left(\log \left(1 + x\right)\right)}}\\
\end{array}double f(double x) {
double r92182 = 1.0;
double r92183 = x;
double r92184 = r92182 - r92183;
double r92185 = log(r92184);
double r92186 = r92182 + r92183;
double r92187 = log(r92186);
double r92188 = r92185 / r92187;
return r92188;
}
double f(double x) {
double r92189 = x;
double r92190 = -5.5247076957621224e-17;
bool r92191 = r92189 <= r92190;
double r92192 = 1.0;
double r92193 = 3.0;
double r92194 = pow(r92192, r92193);
double r92195 = pow(r92189, r92193);
double r92196 = r92194 - r92195;
double r92197 = log(r92196);
double r92198 = r92192 * r92192;
double r92199 = r92189 * r92189;
double r92200 = r92192 * r92189;
double r92201 = r92199 + r92200;
double r92202 = r92198 + r92201;
double r92203 = log(r92202);
double r92204 = r92203 * r92203;
double r92205 = cbrt(r92204);
double r92206 = cbrt(r92203);
double r92207 = r92205 * r92206;
double r92208 = pow(r92207, r92193);
double r92209 = cbrt(r92208);
double r92210 = r92197 - r92209;
double r92211 = r92192 + r92189;
double r92212 = log(r92211);
double r92213 = r92210 / r92212;
double r92214 = 1.1340365921574058e-16;
bool r92215 = r92189 <= r92214;
double r92216 = log(r92192);
double r92217 = 0.5;
double r92218 = 2.0;
double r92219 = pow(r92189, r92218);
double r92220 = pow(r92192, r92218);
double r92221 = r92219 / r92220;
double r92222 = r92217 * r92221;
double r92223 = r92216 - r92222;
double r92224 = fma(r92189, r92192, r92223);
double r92225 = r92210 / r92224;
double r92226 = log(r92212);
double r92227 = exp(r92226);
double r92228 = r92210 / r92227;
double r92229 = r92215 ? r92225 : r92228;
double r92230 = r92191 ? r92213 : r92229;
return r92230;
}




Bits error versus x
| Original | 61.2 |
|---|---|
| Target | 0.2 |
| Herbie | 59.3 |
if x < -5.5247076957621224e-17Initial program 14.7
rmApplied flip3--14.8
Applied log-div12.9
rmApplied add-cbrt-cube12.9
Simplified12.9
rmApplied add-cube-cbrt12.8
Simplified12.8
if -5.5247076957621224e-17 < x < 1.1340365921574058e-16Initial program 64.0
rmApplied flip3--64.0
Applied log-div64.0
rmApplied add-cbrt-cube64.0
Simplified64.0
rmApplied add-cube-cbrt64.0
Simplified64.0
Taylor expanded around 0 62.0
Simplified62.0
if 1.1340365921574058e-16 < x Initial program 14.1
rmApplied flip3--3.8
Applied log-div13.2
rmApplied add-cbrt-cube13.1
Simplified13.1
rmApplied add-cube-cbrt13.2
Simplified13.2
rmApplied add-exp-log13.3
Final simplification59.3
herbie shell --seed 2019346 +o rules:numerics
(FPCore (x)
:name "qlog (example 3.10)"
:precision binary64
:pre (and (< -1 x) (< x 1))
:herbie-target
(- (+ (+ (+ 1 x) (/ (* x x) 2)) (* 0.4166666666666667 (pow x 3))))
(/ (log (- 1 x)) (log (+ 1 x))))