\log \left(1 + x\right)
\begin{array}{l}
\mathbf{if}\;x + 1 \le 1.000000000007547740210611664224416017532:\\
\;\;\;\;1 \cdot x + \left(\log 1 - \frac{x}{1} \cdot \left(\frac{1}{2} \cdot \frac{x}{1}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\log \left(x + 1\right)\\
\end{array}double f(double x) {
double r3229038 = 1.0;
double r3229039 = x;
double r3229040 = r3229038 + r3229039;
double r3229041 = log(r3229040);
return r3229041;
}
double f(double x) {
double r3229042 = x;
double r3229043 = 1.0;
double r3229044 = r3229042 + r3229043;
double r3229045 = 1.0000000000075477;
bool r3229046 = r3229044 <= r3229045;
double r3229047 = r3229043 * r3229042;
double r3229048 = log(r3229043);
double r3229049 = r3229042 / r3229043;
double r3229050 = 0.5;
double r3229051 = r3229050 * r3229049;
double r3229052 = r3229049 * r3229051;
double r3229053 = r3229048 - r3229052;
double r3229054 = r3229047 + r3229053;
double r3229055 = log(r3229044);
double r3229056 = r3229046 ? r3229054 : r3229055;
return r3229056;
}




Bits error versus x
Results
| Original | 39.1 |
|---|---|
| Target | 0.3 |
| Herbie | 0.4 |
if (+ 1.0 x) < 1.0000000000075477Initial program 59.4
Taylor expanded around 0 0.3
Simplified0.3
if 1.0000000000075477 < (+ 1.0 x) Initial program 0.5
Final simplification0.4
herbie shell --seed 2019179
(FPCore (x)
:name "ln(1 + x)"
:herbie-target
(if (== (+ 1.0 x) 1.0) x (/ (* x (log (+ 1.0 x))) (- (+ 1.0 x) 1.0)))
(log (+ 1.0 x)))