Average Error: 14.8 → 0.3
Time: 9.7s
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.8
Target0.3
Herbie0.3
\[\tan^{-1} \left(\frac{1}{1 + N \cdot \left(N + 1\right)}\right)\]

Derivation

  1. Initial program 14.8

    \[\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.3

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

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

Reproduce

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

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

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

Details

Time bar (total: 9.0s)Debug log

sample35.0ms

Algorithm
intervals
Results
256×(pre true 80)
129×(body real 80)
93×(body real 1280)
16×(body real 640)
10×(body real 320)
(body real 160)

simplify4.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
4.0ms
(- (atan (+ N 1)) (atan N))

prune6.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 15.3b

localize22.0ms

Local error

Found 1 expressions with local error:

1.8b
(- (atan (+ N 1)) (atan N))

rewrite7.0ms

Algorithm
rewrite-expression-head
Rules
add-log-exp
*-un-lft-identity
add-sqr-sqrt
difference-of-squares
distribute-lft-out--
flip--
add-cube-cbrt
add-exp-log
diff-atan
diff-log
add-cbrt-cube
flip3--
sub-neg
pow1
Counts
1 → 15
Calls
1 calls:
Slowest
7.0ms
(- (atan (+ N 1)) (atan N))

series11.0ms

Counts
1 → 3
Calls
1 calls:
Slowest
11.0ms
(- (atan (+ N 1)) (atan N))

simplify109.0ms

Counts
9 → 18
Calls
9 calls:
Slowest
50.0ms
(+ 1 (* (+ N 1) N))
15.0ms
(- (+ N 1) N)
12.0ms
(/ (exp (atan (+ N 1))) (exp (atan N)))
8.0ms
(- (atan (+ N 1)) (atan N))
8.0ms
(- (atan (+ N 1)) (atan N))

prune134.0ms

Pruning

2 alts after pruning (1 fresh and 1 done)

Merged error: 0.1b

localize8.0ms

Local error

Found 2 expressions with local error:

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

rewrite5.0ms

Algorithm
rewrite-expression-head
Rules
add-cube-cbrt
associate-*l*
*-un-lft-identity
add-sqr-sqrt
add-log-exp
add-exp-log
associate-*l/
add-cbrt-cube
pow1
flip-+
*-commutative
flip3-+
Counts
2 → 20
Calls
2 calls:
Slowest
4.0ms
(* (+ N 1) N)
0.0ms
(atan2 1 (+ 1 (* (+ N 1) N)))

series36.0ms

Counts
2 → 6
Calls
2 calls:
Slowest
31.0ms
(* (+ N 1) N)
5.0ms
(atan2 1 (+ 1 (* (+ N 1) N)))

simplify190.0ms

Counts
10 → 26
Calls
10 calls:
Slowest
77.0ms
(* (- (* N N) (* 1 1)) N)
26.0ms
(atan2 1 (+ N (+ (pow N 2) 1)))
24.0ms
(atan2 1 (+ N (+ (pow N 2) 1)))
21.0ms
(* (+ (pow N 3) (pow 1 3)) N)
14.0ms
(atan2 1 (+ N (+ (pow N 2) 1)))

prune241.0ms

Pruning

6 alts after pruning (4 fresh and 2 done)

Merged error: 0.0b

localize28.0ms

Local error

Found 4 expressions with local error:

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

rewrite27.0ms

Algorithm
rewrite-expression-head
Rules
20×associate-*l/
18×cbrt-div
flip-+
flip3-+
pow1
pow1/3
add-cube-cbrt
add-exp-log
*-un-lft-identity
add-sqr-sqrt
cbrt-prod
add-log-exp
associate-*l*
associate-*r*
add-cbrt-cube
frac-times
pow-prod-up
associate-*r/
pow-prod-down
cbrt-unprod
*-commutative
prod-exp
pow-plus
pow2
Counts
4 → 65
Calls
4 calls:
Slowest
17.0ms
(* (cbrt (* (+ N 1) N)) (cbrt (* (+ N 1) N)))
3.0ms
(cbrt (* (+ N 1) N))
3.0ms
(cbrt (* (+ N 1) N))
3.0ms
(cbrt (* (+ N 1) N))

series212.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
68.0ms
(* (cbrt (* (+ N 1) N)) (cbrt (* (+ N 1) N)))
55.0ms
(cbrt (* (+ N 1) N))
46.0ms
(cbrt (* (+ N 1) N))
43.0ms
(cbrt (* (+ N 1) N))

simplify3.0s

Counts
49 → 77
Calls
49 calls:
Slowest
365.0ms
(* (* (+ N 1) N) (* (+ N 1) N))
315.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))))
287.0ms
(* (* (+ N 1) N) (* (+ N 1) N))
196.0ms
(* (cbrt (* (- (* N N) (* 1 1)) N)) (cbrt (* (+ N 1) N)))
191.0ms
(- (+ (* (cbrt -1) (exp (* 1/3 (- (log -1) (* 2 (log (/ -1 N))))))) (* 1/3 (/ (* (cbrt -1) (exp (* 1/3 (- (log -1) (* 2 (log (/ -1 N))))))) N))) (* 1/9 (/ (* (cbrt -1) (exp (* 1/3 (- (log -1) (* 2 (log (/ -1 N))))))) (pow N 2))))

prune740.0ms

Pruning

6 alts after pruning (3 fresh and 3 done)

Merged error: 0.0b

localize12.0ms

Local error

Found 4 expressions with local error:

14.9b
(sqrt (atan2 1 (+ 1 (* (+ N 1) N))))
14.9b
(sqrt (atan2 1 (+ 1 (* (+ N 1) N))))
0.6b
(* (sqrt (atan2 1 (+ 1 (* (+ N 1) N)))) (sqrt (atan2 1 (+ 1 (* (+ N 1) N)))))
0.1b
(atan2 1 (+ 1 (* (+ N 1) N)))

rewrite13.0ms

Algorithm
rewrite-expression-head
Rules
12×sqrt-prod
12×add-sqr-sqrt
10×add-cube-cbrt
10×*-un-lft-identity
pow1
add-exp-log
associate-*l*
associate-*r*
pow1/2
add-cbrt-cube
add-log-exp
pow-prod-up
pow-prod-down
rem-sqrt-square
cbrt-unprod
*-commutative
prod-exp
sqrt-unprod
pow-plus
rem-square-sqrt
pow2
Counts
4 → 61
Calls
4 calls:
Slowest
9.0ms
(* (sqrt (atan2 1 (+ 1 (* (+ N 1) N)))) (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))))
0.0ms
(atan2 1 (+ 1 (* (+ N 1) N)))

series51.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
21.0ms
(sqrt (atan2 1 (+ 1 (* (+ N 1) N))))
20.0ms
(sqrt (atan2 1 (+ 1 (* (+ N 1) N))))
5.0ms
(* (sqrt (atan2 1 (+ 1 (* (+ N 1) N)))) (sqrt (atan2 1 (+ 1 (* (+ N 1) N)))))
4.0ms
(atan2 1 (+ 1 (* (+ N 1) N)))

simplify1.1s

Counts
42 → 73
Calls
42 calls:
Slowest
67.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))))))
47.0ms
(+ (log (sqrt (atan2 1 (+ 1 (* (+ N 1) N))))) (log (sqrt (atan2 1 (+ 1 (* (+ N 1) N))))))
45.0ms
(sqrt (* (cbrt (atan2 1 (+ 1 (* (+ N 1) N)))) (cbrt (atan2 1 (+ 1 (* (+ N 1) N))))))
43.0ms
(sqrt (sqrt (atan2 1 (+ 1 (* (+ N 1) N)))))
43.0ms
(sqrt (* (cbrt (atan2 1 (+ 1 (* (+ N 1) N)))) (cbrt (atan2 1 (+ 1 (* (+ N 1) N))))))

prune597.0ms

Pruning

8 alts after pruning (4 fresh and 4 done)

Merged error: 0.0b

regimes100.0ms

Accuracy

0% (0.0b remaining)

Error of 0.3b against oracle of 0.3b and baseline of 0.3b

bsearch1.0ms

end0.0ms

sample2.3s

Algorithm
intervals
Results
8000×(pre true 80)
4032×(body real 80)
2874×(body real 1280)
631×(body real 640)
297×(body real 320)
166×(body real 160)