\tan^{-1} \left(N + 1\right) - \tan^{-1} N\mathsf{expm1}\left(\mathsf{log1p}\left(\tan^{-1}_* \frac{1}{\mathsf{fma}\left(N, N + 1, 1\right)}\right)\right)double f(double N) {
double r4666194 = N;
double r4666195 = 1.0;
double r4666196 = r4666194 + r4666195;
double r4666197 = atan(r4666196);
double r4666198 = atan(r4666194);
double r4666199 = r4666197 - r4666198;
return r4666199;
}
double f(double N) {
double r4666200 = 1.0;
double r4666201 = N;
double r4666202 = r4666201 + r4666200;
double r4666203 = fma(r4666201, r4666202, r4666200);
double r4666204 = atan2(r4666200, r4666203);
double r4666205 = log1p(r4666204);
double r4666206 = expm1(r4666205);
return r4666206;
}




Bits error versus N
| Original | 15.2 |
|---|---|
| Target | 0.4 |
| Herbie | 0.9 |
Initial program 15.2
rmApplied diff-atan14.1
Simplified0.4
Simplified0.4
rmApplied expm1-log1p-u0.9
Final simplification0.9
herbie shell --seed 2019168 +o rules:numerics
(FPCore (N)
:name "2atan (example 3.5)"
:herbie-target
(atan (/ 1 (+ 1 (* N (+ N 1)))))
(- (atan (+ N 1)) (atan N)))