Average Error: 15.1 → 0.4
Time: 2.6s
Precision: binary64
Cost: 6912
\[\tan^{-1} \left(N + 1\right) - \tan^{-1} N\]
\[\tan^{-1}_* \frac{1}{1 + N \cdot \left(1 + N\right)}\]
\tan^{-1} \left(N + 1\right) - \tan^{-1} N
\tan^{-1}_* \frac{1}{1 + N \cdot \left(1 + N\right)}
(FPCore (N) :precision binary64 (- (atan (+ N 1.0)) (atan N)))
(FPCore (N) :precision binary64 (atan2 1.0 (+ 1.0 (* N (+ 1.0 N)))))
double code(double N) {
	return atan(N + 1.0) - atan(N);
}
double code(double N) {
	return atan2(1.0, (1.0 + (N * (1.0 + N))));
}

Error

Bits error versus N

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original15.1
Target0.5
Herbie0.4
\[\tan^{-1} \left(\frac{1}{1 + N \cdot \left(N + 1\right)}\right)\]

Alternatives

Alternative 1
Error40.7
Cost706
\[\begin{array}{l} \mathbf{if}\;N \leq -9.337312749146761 \cdot 10^{+76}:\\ \;\;\;\;0\\ \mathbf{elif}\;N \leq 9.549103444578948 \cdot 10^{+76}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array}\]
Alternative 2
Error56.0
Cost64
\[1\]

Error

Derivation

  1. Initial program 15.1

    \[\tan^{-1} \left(N + 1\right) - \tan^{-1} N\]
  2. Using strategy rm
  3. Applied diff-atan_binary64_262214.0

    \[\leadsto \color{blue}{\tan^{-1}_* \frac{\left(N + 1\right) - N}{1 + \left(N + 1\right) \cdot N}}\]
  4. Simplified0.4

    \[\leadsto \tan^{-1}_* \frac{\color{blue}{1}}{1 + \left(N + 1\right) \cdot N}\]
  5. Simplified0.4

    \[\leadsto \tan^{-1}_* \frac{1}{\color{blue}{1 + N \cdot \left(N + 1\right)}}\]
  6. Simplified0.4

    \[\leadsto \color{blue}{\tan^{-1}_* \frac{1}{1 + N \cdot \left(1 + N\right)}}\]
  7. Final simplification0.4

    \[\leadsto \tan^{-1}_* \frac{1}{1 + N \cdot \left(1 + N\right)}\]

Reproduce

herbie shell --seed 2021044 
(FPCore (N)
  :name "2atan (example 3.5)"
  :precision binary64

  :herbie-target
  (atan (/ 1.0 (+ 1.0 (* N (+ N 1.0)))))

  (- (atan (+ N 1.0)) (atan N)))