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

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 div-sub0.0

    \[\leadsto 2 \cdot \tan^{-1} \left(\sqrt{\color{blue}{\frac{1}{1 + x} - \frac{x}{1 + x}}}\right)\]
  4. Using strategy rm
  5. Applied add-sqr-sqrt0.0

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

    \[\leadsto 2 \cdot \tan^{-1} \left(\sqrt{\sqrt{\frac{1}{1 + x}} \cdot \sqrt{\frac{1}{1 + x}} - \frac{x}{1 + x}}\right)\]

Reproduce

herbie shell --seed 2019016 
(FPCore (x)
  :name "arccos"
  (* 2 (atan (sqrt (/ (- 1 x) (+ 1 x))))))

Details

Time bar (total: 13.6s)Debug log

sample198.0ms

Algorithm
intervals
Results
524×(pre true 80)
268×(body nan 80)
256×(body real 80)

simplify30.0ms

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

prune12.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 0.0b

localize62.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))))

rewrite16.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*
associate-/r*
pow1
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 → 65
Calls
3 calls:
Slowest
9.0ms
(/ (- 1 x) (+ 1 x))
3.0ms
(sqrt (/ (- 1 x) (+ 1 x)))
1.0ms
(atan (sqrt (/ (- 1 x) (+ 1 x))))

series56.0ms

Counts
3 → 9
Calls
3 calls:
Slowest
29.0ms
(sqrt (/ (- 1 x) (+ 1 x)))
20.0ms
(/ (- 1 x) (+ 1 x))
7.0ms
(atan (sqrt (/ (- 1 x) (+ 1 x))))

simplify1.6s

Counts
57 → 74
Calls
57 calls:
Slowest
354.0ms
(/ (* (* (- 1 x) (- 1 x)) (- 1 x)) (* (* (+ 1 x) (+ 1 x)) (+ 1 x)))
250.0ms
(- (+ (sqrt -1) (/ 1 (* x (sqrt -1)))) (+ (/ 1 (* (pow x 2) (sqrt -1))) (* 1/2 (/ 1 (* (pow x 2) (pow (sqrt -1) 3))))))
234.0ms
(- (+ (sqrt -1) (/ 1 (* x (sqrt -1)))) (+ (/ 1 (* (pow x 2) (sqrt -1))) (* 1/2 (/ 1 (* (pow x 2) (pow (sqrt -1) 3))))))
104.0ms
(- (* 2 (/ 1 x)) (+ (* 2 (/ 1 (pow x 2))) 1))
90.0ms
(- (* 2 (/ 1 x)) (+ (* 2 (/ 1 (pow x 2))) 1))

prune796.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 0b

localize23.0ms

Local error

Found 4 expressions with local error:

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

rewrite14.0ms

Algorithm
rewrite-expression-head
Rules
15×*-un-lft-identity
12×associate-/r/
12×add-sqr-sqrt
10×div-inv
10×sqrt-prod
distribute-rgt-out--
add-cube-cbrt
add-log-exp
flip-+
flip3-+
associate-/r*
add-exp-log
pow1
distribute-lft-out--
sqrt-div
add-cbrt-cube
difference-of-squares
sub-div
flip--
frac-sub
flip3--
frac-2neg
clear-num
inv-pow
pow-flip
diff-log
pow1/2
sub-neg
rec-exp
rem-sqrt-square
Counts
4 → 77
Calls
4 calls:
Slowest
6.0ms
(sqrt (- (/ 1 (+ 1 x)) (/ x (+ 1 x))))
6.0ms
(- (/ 1 (+ 1 x)) (/ x (+ 1 x)))
1.0ms
(/ 1 (+ 1 x))
0.0ms
(/ x (+ 1 x))

series78.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
41.0ms
(sqrt (- (/ 1 (+ 1 x)) (/ x (+ 1 x))))
17.0ms
(- (/ 1 (+ 1 x)) (/ x (+ 1 x)))
10.0ms
(/ x (+ 1 x))
9.0ms
(/ 1 (+ 1 x))

simplify3.0s

Counts
55 → 89
Calls
55 calls:
Slowest
631.0ms
(sqrt (- (* 1 (+ 1 x)) (* (+ 1 x) x)))
322.0ms
(sqrt (- (pow (/ 1 (+ 1 x)) 3) (pow (/ x (+ 1 x)) 3)))
318.0ms
(sqrt (- (* (/ 1 (+ 1 x)) (/ 1 (+ 1 x))) (* (/ x (+ 1 x)) (/ x (+ 1 x)))))
281.0ms
(- (+ (sqrt -1) (/ 1 (* x (sqrt -1)))) (+ (/ 1 (* (pow x 2) (sqrt -1))) (* 1/2 (/ 1 (* (pow x 2) (pow (sqrt -1) 3))))))
269.0ms
(- (+ (sqrt -1) (/ 1 (* x (sqrt -1)))) (+ (/ 1 (* (pow x 2) (sqrt -1))) (* 1/2 (/ 1 (* (pow x 2) (pow (sqrt -1) 3))))))

prune778.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 0b

localize16.0ms

Local error

Found 4 expressions with local error:

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

rewrite46.0ms

Algorithm
rewrite-expression-head
Rules
17×sqrt-div
16×sqrt-prod
13×add-sqr-sqrt
10×add-cube-cbrt
10×*-un-lft-identity
10×pow1
associate-*l*
associate-*r*
add-exp-log
add-log-exp
frac-sub
associate-/r/
add-cbrt-cube
pow1/2
div-inv
flip-+
associate-*r/
associate-*l/
flip3-+
associate-/r*
frac-times
difference-of-squares
flip--
pow-prod-up
pow-prod-down
flip3--
inv-pow
pow-flip
cbrt-unprod
*-commutative
prod-exp
diff-log
sqrt-unprod
pow-plus
frac-2neg
rem-square-sqrt
sub-neg
clear-num
rec-exp
rem-sqrt-square
pow2
Counts
4 → 91
Calls
4 calls:
Slowest
17.0ms
(sqrt (- (* (sqrt (/ 1 (+ 1 x))) (sqrt (/ 1 (+ 1 x)))) (/ x (+ 1 x))))
14.0ms
(- (* (sqrt (/ 1 (+ 1 x))) (sqrt (/ 1 (+ 1 x)))) (/ x (+ 1 x)))
10.0ms
(* (sqrt (/ 1 (+ 1 x))) (sqrt (/ 1 (+ 1 x))))
2.0ms
(/ 1 (+ 1 x))

series80.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
39.0ms
(sqrt (- (* (sqrt (/ 1 (+ 1 x))) (sqrt (/ 1 (+ 1 x)))) (/ x (+ 1 x))))
25.0ms
(- (* (sqrt (/ 1 (+ 1 x))) (sqrt (/ 1 (+ 1 x)))) (/ x (+ 1 x)))
10.0ms
(/ 1 (+ 1 x))
6.0ms
(* (sqrt (/ 1 (+ 1 x))) (sqrt (/ 1 (+ 1 x))))

simplify3.0s

Counts
69 → 103
Calls
69 calls:
Slowest
387.0ms
(sqrt (- (* (* (sqrt (/ 1 (+ 1 x))) (sqrt (/ 1 (+ 1 x)))) (* (sqrt (/ 1 (+ 1 x))) (sqrt (/ 1 (+ 1 x))))) (* (/ x (+ 1 x)) (/ x (+ 1 x)))))
333.0ms
(sqrt (- (pow (* (sqrt (/ 1 (+ 1 x))) (sqrt (/ 1 (+ 1 x)))) 3) (pow (/ x (+ 1 x)) 3)))
276.0ms
(- (+ (sqrt -1) (/ 1 (* x (sqrt -1)))) (+ (/ 1 (* (pow x 2) (sqrt -1))) (* 1/2 (/ 1 (* (pow x 2) (pow (sqrt -1) 3))))))
242.0ms
(- (+ (sqrt -1) (/ 1 (* x (sqrt -1)))) (+ (/ 1 (* (pow x 2) (sqrt -1))) (* 1/2 (/ 1 (* (pow x 2) (pow (sqrt -1) 3))))))
202.0ms
(sqrt (- (* (* (sqrt 1) (sqrt 1)) (+ 1 x)) (* (* (sqrt (+ 1 x)) (sqrt (+ 1 x))) x)))

prune1.1s

Pruning

1 alts after pruning (0 fresh and 1 done)

Merged error: 0b

end0.0ms

sample2.7s

Algorithm
intervals
Results
15997×(pre true 80)
8001×(body real 80)
7996×(body nan 80)