Average Error: 0.0 → 0.0
Time: 37.8s
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 +o rules:numerics
(FPCore (x)
  :name "arccos"
  (* 2 (atan (sqrt (/ (- 1 x) (+ 1 x))))))

Details

Time bar (total: 37.4s)Debug log

sample154.0ms

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

simplify62.0ms

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

prune13.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 0.0b

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

rewrite17.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
9.0ms
(/ (- 1 x) (+ 1 x))
3.0ms
(sqrt (/ (- 1 x) (+ 1 x)))
1.0ms
(atan (sqrt (/ (- 1 x) (+ 1 x))))

series74.0ms

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

simplify4.8s

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.5s
(- (+ (sqrt -1) (/ 1 (* x (sqrt -1)))) (+ (/ 1 (* (pow x 2) (sqrt -1))) (* 1/2 (/ 1 (* (pow x 2) (pow (sqrt -1) 3))))))
784.0ms
(/ (* (* (- 1 x) (- 1 x)) (- 1 x)) (* (* (+ 1 x) (+ 1 x)) (+ 1 x)))
163.0ms
(- (* 2 (/ 1 x)) (+ (* 2 (/ 1 (pow x 2))) 1))
119.0ms
(- (* 2 (/ 1 x)) (+ (* 2 (/ 1 (pow x 2))) 1))

prune696.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 0b

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

rewrite40.0ms

Algorithm
rewrite-expression-head
Rules
38×associate-/r/
36×prod-diff
28×*-un-lft-identity
25×add-sqr-sqrt
23×div-inv
20×add-cube-cbrt
19×flip-+
19×flip3-+
10×sqrt-prod
distribute-rgt-out--
add-log-exp
fma-neg
associate-/r*
add-exp-log
pow1
distribute-lft-out--
log1p-expm1-u
sqrt-div
add-cbrt-cube
expm1-log1p-u
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 → 127
Calls
4 calls:
Slowest
21.0ms
(sqrt (- (/ 1 (+ 1 x)) (/ x (+ 1 x))))
12.0ms
(- (/ 1 (+ 1 x)) (/ x (+ 1 x)))
2.0ms
(/ 1 (+ 1 x))
1.0ms
(/ x (+ 1 x))

series84.0ms

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

simplify17.9s

Counts
131 → 139
Calls
131 calls:
Slowest
1.5s
(- (+ (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))))))
1.4s
(sqrt (- (* 1 (+ 1 x)) (* (+ 1 x) x)))
569.0ms
(fma 1 (/ 1 (+ 1 x)) (- (* (- 1 x) (/ x (- (* 1 1) (* x x))))))
541.0ms
(fma (sqrt (/ 1 (+ 1 x))) (sqrt (/ 1 (+ 1 x))) (- (* (- 1 x) (/ x (- (* 1 1) (* x x))))))

prune1.5s

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 0b

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

rewrite52.0ms

Algorithm
rewrite-expression-head
Rules
17×sqrt-div
16×sqrt-prod
14×add-sqr-sqrt
11×add-cube-cbrt
11×*-un-lft-identity
10×pow1
associate-*l*
associate-*r*
associate-/r/
add-exp-log
add-log-exp
frac-sub
prod-diff
add-cbrt-cube
pow1/2
div-inv
log1p-expm1-u
flip-+
flip3-+
expm1-log1p-u
associate-*r/
associate-*l/
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
fma-neg
pow-plus
frac-2neg
rem-square-sqrt
sub-neg
clear-num
rec-exp
rem-sqrt-square
pow2
Counts
4 → 106
Calls
4 calls:
Slowest
21.0ms
(sqrt (- (* (sqrt (/ 1 (+ 1 x))) (sqrt (/ 1 (+ 1 x)))) (/ x (+ 1 x))))
16.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))

series98.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
51.0ms
(sqrt (- (* (sqrt (/ 1 (+ 1 x))) (sqrt (/ 1 (+ 1 x)))) (/ x (+ 1 x))))
26.0ms
(- (* (sqrt (/ 1 (+ 1 x))) (sqrt (/ 1 (+ 1 x)))) (/ x (+ 1 x)))
11.0ms
(* (sqrt (/ 1 (+ 1 x))) (sqrt (/ 1 (+ 1 x))))
10.0ms
(/ 1 (+ 1 x))

simplify7.8s

Counts
82 → 118
Calls
82 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.6s
(- (+ (sqrt -1) (/ 1 (* x (sqrt -1)))) (+ (/ 1 (* (pow x 2) (sqrt -1))) (* 1/2 (/ 1 (* (pow x 2) (pow (sqrt -1) 3))))))
521.0ms
(fma (sqrt (/ 1 (+ 1 x))) (sqrt (/ 1 (+ 1 x))) (- (* (- 1 x) (/ x (- (* 1 1) (* x x))))))
430.0ms
(sqrt (- (pow (* (sqrt (/ 1 (+ 1 x))) (sqrt (/ 1 (+ 1 x)))) 3) (pow (/ x (+ 1 x)) 3)))
408.0ms
(fma (- (- 1 x)) (/ x (- (* 1 1) (* x x))) (* (- 1 x) (/ x (- (* 1 1) (* x x)))))

prune1.7s

Pruning

1 alts after pruning (0 fresh and 1 done)

Merged error: 0b

end0.0ms

sample2.4s

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