Average Error: 0.0 → 0.0
Time: 39.0s
Precision: 64
Internal Precision: 128
\[2 \cdot \tan^{-1} \left(\sqrt{\frac{1 - x}{1 + x}}\right)\]
\[\tan^{-1} \left(\sqrt{e^{\log \left(1 - x\right) - \log_* (1 + x)}}\right) \cdot 2\]

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.0

    \[2 \cdot \tan^{-1} \left(\sqrt{\frac{1 - x}{1 + x}}\right)\]
  2. Using strategy rm
  3. Applied add-exp-log0.0

    \[\leadsto 2 \cdot \tan^{-1} \left(\sqrt{\frac{1 - x}{\color{blue}{e^{\log \left(1 + x\right)}}}}\right)\]
  4. Applied add-exp-log0.0

    \[\leadsto 2 \cdot \tan^{-1} \left(\sqrt{\frac{\color{blue}{e^{\log \left(1 - x\right)}}}{e^{\log \left(1 + x\right)}}}\right)\]
  5. Applied div-exp0.0

    \[\leadsto 2 \cdot \tan^{-1} \left(\sqrt{\color{blue}{e^{\log \left(1 - x\right) - \log \left(1 + x\right)}}}\right)\]
  6. Simplified0.0

    \[\leadsto 2 \cdot \tan^{-1} \left(\sqrt{e^{\color{blue}{\log \left(1 - x\right) - \log_* (1 + x)}}}\right)\]
  7. Final simplification0.0

    \[\leadsto \tan^{-1} \left(\sqrt{e^{\log \left(1 - x\right) - \log_* (1 + x)}}\right) \cdot 2\]

Reproduce

herbie shell --seed 2019010 +o rules:numerics
(FPCore (x)
  :name "arccos"
  (* 2 (atan (sqrt (/ (- 1 x) (+ 1 x))))))

Details

Time bar (total: 38.5s)Debug log

sample161.0ms

Algorithm
intervals

simplify16.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
15.0ms
(* 2 (atan (sqrt (/ (- 1 x) (+ 1 x)))))

prune7.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 0.0b

localize25.0ms

Local error

Found 3 expressions with local error:

0.0b
(/ (- 1 x) (+ 1 x))
0.0b
(sqrt (/ (- 1 x) (+ 1 x)))
0.0b
(atan (sqrt (/ (- 1 x) (+ 1 x))))

rewrite35.0ms

Algorithm
rewrite-expression-head
Rules
21×add-sqr-sqrt
19×times-frac
18×add-cube-cbrt
18×*-un-lft-identity
15×sqrt-prod
add-exp-log
add-cbrt-cube
associate-/r/
add-log-exp
associate-/l*
log1p-expm1-u
associate-/r*
pow1
expm1-log1p-u
associate-/l/
div-inv
flip-+
flip3-+
rem-sqrt-square
flip--
div-exp
div-sub
sqrt-div
pow1/2
flip3--
frac-2neg
clear-num
cbrt-undiv
Counts
3 → 71
Calls
3 calls:
Slowest
8.0ms
(/ (- 1 x) (+ 1 x))
3.0ms
(sqrt (/ (- 1 x) (+ 1 x)))
1.0ms
(atan (sqrt (/ (- 1 x) (+ 1 x))))

series59.0ms

Counts
3 → 9
Calls
3 calls:
Slowest
28.0ms
(/ (- 1 x) (+ 1 x))
26.0ms
(sqrt (/ (- 1 x) (+ 1 x)))
5.0ms
(atan (sqrt (/ (- 1 x) (+ 1 x))))

simplify4.2s

Counts
57 → 80
Calls
57 calls:
Slowest
1.6s
(- (+ (sqrt -1) (/ 1 (* x (sqrt -1)))) (+ (/ 1 (* (pow x 2) (sqrt -1))) (* 1/2 (/ 1 (* (pow x 2) (pow (sqrt -1) 3))))))
1.3s
(- (+ (sqrt -1) (/ 1 (* x (sqrt -1)))) (+ (/ 1 (* (pow x 2) (sqrt -1))) (* 1/2 (/ 1 (* (pow x 2) (pow (sqrt -1) 3))))))
328.0ms
(/ (* (* (- 1 x) (- 1 x)) (- 1 x)) (* (* (+ 1 x) (+ 1 x)) (+ 1 x)))
187.0ms
(- (* 2 (/ 1 x)) (+ (* 2 (/ 1 (pow x 2))) 1))
172.0ms
(- (* 2 (/ 1 x)) (+ (* 2 (/ 1 (pow x 2))) 1))

prune661.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 0b

localize17.0ms

Local error

Found 4 expressions with local error:

5.5b
(log (- 1 x))
0.0b
(sqrt (exp (- (log (- 1 x)) (log1p x))))
0.0b
(- (log (- 1 x)) (log1p x))
0.0b
(atan (sqrt (exp (- (log (- 1 x)) (log1p x)))))

rewrite16.0ms

Algorithm
rewrite-expression-head
Rules
26×*-un-lft-identity
26×add-sqr-sqrt
24×prod-diff
23×add-cube-cbrt
20×sqrt-prod
17×exp-sum
13×pow1
log-pow
log-prod
associate--l+
add-log-exp
add-exp-log
log1p-expm1-u
fma-neg
add-cbrt-cube
log-div
expm1-log1p-u
flip--
flip3--
sub-neg
distribute-lft-out--
diff-log
log1p-def
associate--l-
difference-of-squares
rem-log-exp
sqrt-div
exp-diff
pow1/2
log1p-udef
rem-sqrt-square
Counts
4 → 98
Calls
4 calls:
Slowest
7.0ms
(sqrt (exp (- (log (- 1 x)) (log1p x))))
6.0ms
(- (log (- 1 x)) (log1p x))
1.0ms
(log (- 1 x))
1.0ms
(atan (sqrt (exp (- (log (- 1 x)) (log1p x)))))

series242.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
120.0ms
(- (log (- 1 x)) (log1p x))
96.0ms
(sqrt (exp (- (log (- 1 x)) (log1p x))))
23.0ms
(log (- 1 x))
2.0ms
(atan (sqrt (exp (- (log (- 1 x)) (log1p x)))))

simplify5.2s

Counts
79 → 110
Calls
79 calls:
Slowest
1.4s
(- (+ (sqrt -1) (/ 1 (* x (sqrt -1)))) (+ (/ 1 (* (pow x 2) (sqrt -1))) (* 1/2 (/ 1 (* (pow x 2) (pow (sqrt -1) 3))))))
453.0ms
(- (+ (sqrt (exp (- (log -1)))) (* 1/2 (* (/ 1 (pow x 2)) (sqrt (exp (- (log -1))))))) (* (/ 1 x) (sqrt (exp (- (log -1))))))
306.0ms
(- (+ (* 2 x) (+ (* 2/3 (pow x 3)) (* 2/5 (pow x 5)))))
285.0ms
(- (log -1) (+ (log (/ 1 x)) (+ (* 1/2 (/ 1 (pow x 2))) (/ 1 x))))
284.0ms
(- (+ (* 2 (/ 1 x)) (+ (* 2/3 (/ 1 (pow x 3))) (log -1))))

prune1.4s

Pruning

2 alts after pruning (1 fresh and 1 done)

Merged error: 0b

localize15.0ms

Local error

Found 4 expressions with local error:

0.0b
(/ (/ (- 1 x) (sqrt (+ 1 x))) (sqrt (+ 1 x)))
0.0b
(/ (- 1 x) (sqrt (+ 1 x)))
0.0b
(sqrt (/ (/ (- 1 x) (sqrt (+ 1 x))) (sqrt (+ 1 x))))
0.0b
(sqrt (+ 1 x))

rewrite36.0ms

Algorithm
rewrite-expression-head
Rules
550×times-frac
434×sqrt-prod
306×add-sqr-sqrt
288×add-cube-cbrt
288×*-un-lft-identity
35×sqrt-div
32×associate-/r/
27×associate-/l*
17×flip-+
17×flip3-+
16×div-inv
12×associate-/r*
11×add-exp-log
11×add-cbrt-cube
rem-sqrt-square
add-log-exp
log1p-expm1-u
div-exp
cbrt-undiv
pow1
expm1-log1p-u
associate-/l/
div-sub
pow1/2
frac-2neg
clear-num
flip--
flip3--
Counts
4 → 424
Calls
4 calls:
Slowest
10.0ms
(/ (/ (- 1 x) (sqrt (+ 1 x))) (sqrt (+ 1 x)))
5.0ms
(sqrt (/ (/ (- 1 x) (sqrt (+ 1 x))) (sqrt (+ 1 x))))
3.0ms
(/ (- 1 x) (sqrt (+ 1 x)))
1.0ms
(sqrt (+ 1 x))

series121.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
37.0ms
(sqrt (/ (/ (- 1 x) (sqrt (+ 1 x))) (sqrt (+ 1 x))))
32.0ms
(/ (- 1 x) (sqrt (+ 1 x)))
26.0ms
(/ (/ (- 1 x) (sqrt (+ 1 x))) (sqrt (+ 1 x)))
25.0ms
(sqrt (+ 1 x))

simplify18.5s

Counts
552 → 436
Calls
552 calls:
Slowest
1.6s
(- (+ (sqrt -1) (/ 1 (* x (sqrt -1)))) (+ (/ 1 (* (pow x 2) (sqrt -1))) (* 1/2 (/ 1 (* (pow x 2) (pow (sqrt -1) 3))))))
1.4s
(- (+ (sqrt -1) (/ 1 (* x (sqrt -1)))) (+ (/ 1 (* (pow x 2) (sqrt -1))) (* 1/2 (/ 1 (* (pow x 2) (pow (sqrt -1) 3))))))
669.0ms
(/ (* (* (/ (- 1 x) (sqrt (+ 1 x))) (/ (- 1 x) (sqrt (+ 1 x)))) (/ (- 1 x) (sqrt (+ 1 x)))) (* (* (sqrt (+ 1 x)) (sqrt (+ 1 x))) (sqrt (+ 1 x))))
530.0ms
(/ (/ (* (* (- 1 x) (- 1 x)) (- 1 x)) (* (* (sqrt (+ 1 x)) (sqrt (+ 1 x))) (sqrt (+ 1 x)))) (* (* (sqrt (+ 1 x)) (sqrt (+ 1 x))) (sqrt (+ 1 x))))
279.0ms
(sqrt (/ (/ (* (cbrt (- 1 x)) (cbrt (- 1 x))) (sqrt 1)) (* (cbrt (sqrt (+ 1 x))) (cbrt (sqrt (+ 1 x))))))

prune5.7s

Pruning

2 alts after pruning (0 fresh and 2 done)

Merged error: 0b

regimes40.0ms

Accuracy

0% (0.0b remaining)

Error of 0.0b against oracle of 0.0b and baseline of 0.0b

bsearch3.0ms

end0.0ms

sample2.1s

Algorithm
intervals