\tan^{-1} \left(N + 1\right) - \tan^{-1} N\tan^{-1}_* \frac{1}{\mathsf{fma}\left(N, N + 1, 1\right)}double f(double N) {
double r98937 = N;
double r98938 = 1.0;
double r98939 = r98937 + r98938;
double r98940 = atan(r98939);
double r98941 = atan(r98937);
double r98942 = r98940 - r98941;
return r98942;
}
double f(double N) {
double r98943 = 1.0;
double r98944 = N;
double r98945 = r98944 + r98943;
double r98946 = 1.0;
double r98947 = fma(r98944, r98945, r98946);
double r98948 = atan2(r98943, r98947);
return r98948;
}




Bits error versus N
| Original | 14.9 |
|---|---|
| Target | 0.4 |
| Herbie | 0.4 |
Initial program 14.9
rmApplied diff-atan13.7
Simplified0.4
Simplified0.4
Final simplification0.4
herbie shell --seed 2019326 +o rules:numerics
(FPCore (N)
:name "2atan (example 3.5)"
:precision binary64
:herbie-target
(atan (/ 1 (+ 1 (* N (+ N 1)))))
(- (atan (+ N 1)) (atan N)))