Average Error: 14.6 → 0.4
Time: 7.1s
Precision: 64
Internal Precision: 128
\[\tan^{-1} \left(N + 1\right) - \tan^{-1} N\]
\[\tan^{-1}_* \frac{1}{\left(N + 1\right) \cdot N + 1}\]

Error

Bits error versus N

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program 14.6

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

    \[\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. Final simplification0.4

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

Reproduce

herbie shell --seed 2019007 
(FPCore (N)
  :name "2atan (example 3.5)"

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

  (- (atan (+ N 1)) (atan N)))

Details

Time bar (total: 6.7s)Debug log

sample36.0ms

Algorithm
intervals

simplify4.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

4.0ms
(- (atan (+ N 1)) (atan N))

prune6.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 12.3b

localize11.0ms

Local error

Found 2 expressions with local error:

1.0b
(- (atan (+ N 1)) (atan N))
0.0b
(atan (+ N 1))

rewrite4.0ms

Algorithm
rewrite-expression-head
Counts
2 → 22
Calls

2 calls. Slowest were:

3.0ms
(- (atan (+ N 1)) (atan N))
0.0ms
(atan (+ N 1))

series9.0ms

Counts
2 → 6
Calls

2 calls. Slowest were:

7.0ms
(- (atan (+ N 1)) (atan N))
2.0ms
(atan (+ N 1))

simplify89.0ms

Counts
12 → 28
Calls

12 calls. Slowest were:

19.0ms
(- (+ N 1) N)
17.0ms
(+ 1 (* (+ N 1) N))
12.0ms
(/ (exp (atan (+ N 1))) (exp (atan N)))

prune281.0ms

Pruning

2 alts after pruning (1 fresh and 1 done)

Merged error: 0.2b

localize17.0ms

Local error

Found 2 expressions with local error:

0.2b
(atan2 1 (+ 1 (* (+ N 1) N)))
0.0b
(* (+ N 1) N)

rewrite6.0ms

Algorithm
rewrite-expression-head
Counts
2 → 20
Calls

2 calls. Slowest were:

5.0ms
(* (+ N 1) N)
0.0ms
(atan2 1 (+ 1 (* (+ N 1) N)))

series36.0ms

Counts
2 → 6
Calls

2 calls. Slowest were:

31.0ms
(* (+ N 1) N)
5.0ms
(atan2 1 (+ 1 (* (+ N 1) N)))

simplify172.0ms

Counts
10 → 26
Calls

10 calls. Slowest were:

74.0ms
(* (- (* N N) (* 1 1)) N)
29.0ms
(* (+ (pow N 3) (pow 1 3)) N)
25.0ms
(atan2 1 (+ N (+ (pow N 2) 1)))

prune175.0ms

Pruning

4 alts after pruning (2 fresh and 2 done)

Merged error: 0.2b

localize6.0ms

Local error

Found 4 expressions with local error:

17.1b
(sqrt (atan2 1 (+ 1 (* (+ N 1) N))))
17.1b
(sqrt (atan2 1 (+ 1 (* (+ N 1) N))))
0.6b
(* (sqrt (atan2 1 (+ 1 (* (+ N 1) N)))) (sqrt (atan2 1 (+ 1 (* (+ N 1) N)))))
0.2b
(atan2 1 (+ 1 (* (+ N 1) N)))

rewrite9.0ms

Algorithm
rewrite-expression-head
Counts
4 → 61
Calls

4 calls. Slowest were:

6.0ms
(* (sqrt (atan2 1 (+ 1 (* (+ N 1) N)))) (sqrt (atan2 1 (+ 1 (* (+ N 1) N)))))
1.0ms
(sqrt (atan2 1 (+ 1 (* (+ N 1) N))))
0.0ms
(sqrt (atan2 1 (+ 1 (* (+ N 1) N))))

series33.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

16.0ms
(sqrt (atan2 1 (+ 1 (* (+ N 1) N))))
12.0ms
(sqrt (atan2 1 (+ 1 (* (+ N 1) N))))
3.0ms
(* (sqrt (atan2 1 (+ 1 (* (+ N 1) N)))) (sqrt (atan2 1 (+ 1 (* (+ N 1) N)))))
2.0ms
(atan2 1 (+ 1 (* (+ N 1) N)))

simplify1.1s

Counts
42 → 73
Calls

42 calls. Slowest were:

60.0ms
(* (* (* (sqrt (atan2 1 (+ 1 (* (+ N 1) N)))) (sqrt (atan2 1 (+ 1 (* (+ N 1) N))))) (sqrt (atan2 1 (+ 1 (* (+ N 1) N))))) (* (* (sqrt (atan2 1 (+ 1 (* (+ N 1) N)))) (sqrt (atan2 1 (+ 1 (* (+ N 1) N))))) (sqrt (atan2 1 (+ 1 (* (+ N 1) N))))))
54.0ms
(sqrt (* (cbrt (atan2 1 (+ 1 (* (+ N 1) N)))) (cbrt (atan2 1 (+ 1 (* (+ N 1) N))))))
43.0ms
(* (cbrt (sqrt (atan2 1 (+ 1 (* (+ N 1) N))))) (cbrt (sqrt (atan2 1 (+ 1 (* (+ N 1) N))))))

prune758.0ms

Pruning

6 alts after pruning (3 fresh and 3 done)

Merged error: 0.2b

localize23.0ms

Local error

Found 4 expressions with local error:

17.1b
(sqrt (atan2 1 (+ 1 (* (+ N 1) N))))
17.1b
(sqrt (atan2 1 (+ 1 (* (+ N 1) N))))
17.1b
(sqrt (atan2 1 (+ 1 (* (+ N 1) N))))
0.6b
(* (sqrt (atan2 1 (+ 1 (* (+ N 1) N)))) (* (sqrt (sqrt (atan2 1 (+ 1 (* (+ N 1) N))))) (sqrt (sqrt (atan2 1 (+ 1 (* (+ N 1) N)))))))

rewrite30.0ms

Algorithm
rewrite-expression-head
Counts
4 → 60
Calls

4 calls. Slowest were:

27.0ms
(* (sqrt (atan2 1 (+ 1 (* (+ N 1) N)))) (* (sqrt (sqrt (atan2 1 (+ 1 (* (+ N 1) N))))) (sqrt (sqrt (atan2 1 (+ 1 (* (+ N 1) N)))))))
1.0ms
(sqrt (atan2 1 (+ 1 (* (+ N 1) N))))
1.0ms
(sqrt (atan2 1 (+ 1 (* (+ N 1) N))))

series45.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

16.0ms
(sqrt (atan2 1 (+ 1 (* (+ N 1) N))))
12.0ms
(sqrt (atan2 1 (+ 1 (* (+ N 1) N))))
12.0ms
(sqrt (atan2 1 (+ 1 (* (+ N 1) N))))
6.0ms
(* (sqrt (atan2 1 (+ 1 (* (+ N 1) N)))) (* (sqrt (sqrt (atan2 1 (+ 1 (* (+ N 1) N))))) (sqrt (sqrt (atan2 1 (+ 1 (* (+ N 1) N)))))))

simplify1.1s

Counts
40 → 72
Calls

40 calls. Slowest were:

122.0ms
(* (* (* (sqrt (atan2 1 (+ 1 (* (+ N 1) N)))) (sqrt (atan2 1 (+ 1 (* (+ N 1) N))))) (sqrt (atan2 1 (+ 1 (* (+ N 1) N))))) (* (* (* (sqrt (sqrt (atan2 1 (+ 1 (* (+ N 1) N))))) (sqrt (sqrt (atan2 1 (+ 1 (* (+ N 1) N)))))) (sqrt (sqrt (atan2 1 (+ 1 (* (+ N 1) N)))))) (* (* (sqrt (sqrt (atan2 1 (+ 1 (* (+ N 1) N))))) (sqrt (sqrt (atan2 1 (+ 1 (* (+ N 1) N)))))) (sqrt (sqrt (atan2 1 (+ 1 (* (+ N 1) N))))))))
106.0ms
(* (* (* (sqrt (atan2 1 (+ 1 (* (+ N 1) N)))) (sqrt (atan2 1 (+ 1 (* (+ N 1) N))))) (sqrt (atan2 1 (+ 1 (* (+ N 1) N))))) (* (* (* (sqrt (sqrt (atan2 1 (+ 1 (* (+ N 1) N))))) (sqrt (sqrt (atan2 1 (+ 1 (* (+ N 1) N)))))) (* (sqrt (sqrt (atan2 1 (+ 1 (* (+ N 1) N))))) (sqrt (sqrt (atan2 1 (+ 1 (* (+ N 1) N))))))) (* (sqrt (sqrt (atan2 1 (+ 1 (* (+ N 1) N))))) (sqrt (sqrt (atan2 1 (+ 1 (* (+ N 1) N))))))))
46.0ms
(sqrt (* (cbrt (atan2 1 (+ 1 (* (+ N 1) N)))) (cbrt (atan2 1 (+ 1 (* (+ N 1) N))))))

prune712.0ms

Pruning

5 alts after pruning (2 fresh and 3 done)

Merged error: 0.2b

regimes117.0ms

Accuracy

0% (0.0b remaining)

Error of 0.4b against oracle of 0.4b and baseline of 0.4b

bsearch2.0ms

end0.0ms

sample1.8s

Algorithm
intervals