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

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. Initial simplification14.6

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

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

    \[\leadsto \tan^{-1}_* \frac{\color{blue}{1}}{1 + \left(1 + N\right) \cdot N}\]
  6. Taylor expanded around inf 0.4

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

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

Reproduce

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

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

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

Details

Time bar (total: 5.1s)Debug log

start84.0ms

Algorithm
intervals

setup24.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 10.9b

localize22.0ms

Local error

Found 2 expressions with local error:

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

rewrite8.0ms

Algorithm
rewrite-expression-head
Counts
2 → 22
Calls

2 calls. Slowest were:

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

series16.0ms

Counts
2 → 6
Calls

2 calls. Slowest were:

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

simplify74.0ms

Counts
12 → 28
Calls

12 calls. Slowest were:

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

prune270.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 0.1b

localize10.0ms

Local error

Found 2 expressions with local error:

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

rewrite3.0ms

Algorithm
rewrite-expression-head
Counts
2 → 20
Calls

2 calls. Slowest were:

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

series21.0ms

Counts
2 → 6
Calls

2 calls. Slowest were:

18.0ms
(* (+ 1 N) N)
3.0ms
(atan2 1 (+ 1 (* (+ 1 N) N)))

simplify82.0ms

Counts
10 → 26
Calls

10 calls. Slowest were:

18.0ms
(* (+ (pow 1 3) (pow N 3)) N)
14.0ms
(* (- (* 1 1) (* N N)) N)
13.0ms
(atan2 1 (+ N (+ (pow N 2) 1)))

prune294.0ms

Pruning

7 alts after pruning (7 fresh and 0 done)

Merged error: 0.1b

localize26.0ms

Local error

Found 2 expressions with local error:

0.1b
(atan2 1 (+ N (+ (pow N 2) 1)))
0.0b
(+ N (+ (pow N 2) 1))

rewrite5.0ms

Algorithm
rewrite-expression-head
Counts
2 → 18
Calls

2 calls. Slowest were:

5.0ms
(+ N (+ (pow N 2) 1))
0.0ms
(atan2 1 (+ N (+ (pow N 2) 1)))

series11.0ms

Counts
2 → 6
Calls

2 calls. Slowest were:

8.0ms
(+ N (+ (pow N 2) 1))
3.0ms
(atan2 1 (+ N (+ (pow N 2) 1)))

simplify124.0ms

Counts
6 → 24
Calls

6 calls. Slowest were:

26.0ms
(atan2 1 (+ N (+ (pow N 2) 1)))
25.0ms
(+ N (+ (pow N 2) 1))
24.0ms
(+ N (+ (pow N 2) 1))

prune257.0ms

Pruning

7 alts after pruning (6 fresh and 1 done)

Merged error: 0.1b

localize14.0ms

Local error

Found 4 expressions with local error:

13.8b
(cbrt (* (+ 1 N) N))
13.8b
(cbrt (* (+ 1 N) N))
13.8b
(cbrt (* (+ 1 N) N))
0.5b
(* (cbrt (* (+ 1 N) N)) (cbrt (* (+ 1 N) N)))

rewrite19.0ms

Algorithm
rewrite-expression-head
Counts
4 → 65
Calls

4 calls. Slowest were:

13.0ms
(* (cbrt (* (+ 1 N) N)) (cbrt (* (+ 1 N) N)))
2.0ms
(cbrt (* (+ 1 N) N))
1.0ms
(cbrt (* (+ 1 N) N))

series286.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

77.0ms
(* (cbrt (* (+ 1 N) N)) (cbrt (* (+ 1 N) N)))
73.0ms
(cbrt (* (+ 1 N) N))
69.0ms
(cbrt (* (+ 1 N) N))
66.0ms
(cbrt (* (+ 1 N) N))

simplify2.6s

Counts
49 → 77
Calls

49 calls. Slowest were:

387.0ms
(* (* (+ 1 N) N) (* (+ 1 N) N))
371.0ms
(* (* (+ 1 N) N) (* (+ 1 N) N))
291.0ms
(- (+ (* (pow (pow N 4) 1/3) (pow (cbrt -1) 2)) (* 2/3 (* (pow N 1/3) (pow (cbrt -1) 2)))) (* 1/9 (* (pow (/ 1 (pow N 2)) 1/3) (pow (cbrt -1) 2))))

prune802.0ms

Pruning

7 alts after pruning (5 fresh and 2 done)

Merged error: 0.1b

regimes41.0ms

Accuracy

0% (0.0b remaining)

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

bsearch1.0ms