\tan^{-1} \left(N + 1\right) - \tan^{-1} N\tan^{-1}_* \frac{1}{1 + \mathsf{fma}\left(N, N, N\right)}double f(double N) {
double r3885691 = N;
double r3885692 = 1.0;
double r3885693 = r3885691 + r3885692;
double r3885694 = atan(r3885693);
double r3885695 = atan(r3885691);
double r3885696 = r3885694 - r3885695;
return r3885696;
}
double f(double N) {
double r3885697 = 1.0;
double r3885698 = N;
double r3885699 = fma(r3885698, r3885698, r3885698);
double r3885700 = r3885697 + r3885699;
double r3885701 = atan2(r3885697, r3885700);
return r3885701;
}




Bits error versus N
| Original | 14.8 |
|---|---|
| Target | 0.4 |
| Herbie | 0.4 |
Initial program 14.8
rmApplied diff-atan13.8
Simplified0.4
Simplified0.4
rmApplied add-sqr-sqrt1.0
Taylor expanded around 0 0.4
Final simplification0.4
herbie shell --seed 2019130 +o rules:numerics
(FPCore (N)
:name "2atan (example 3.5)"
:herbie-target
(atan (/ 1 (+ 1 (* N (+ N 1)))))
(- (atan (+ N 1)) (atan N)))