Average Error: 0.0 → 0.0
Time: 2.5min
Precision: binary64
Cost: 46016
\[2 \cdot \tan^{-1} \left(\sqrt{\frac{1 - x}{1 + x}}\right)\]
\[2 \cdot \tan^{-1} \left(\sqrt{\log \left(e^{\frac{\sqrt{1 - x}}{\sqrt{1 + x}}}\right) \cdot \frac{\sqrt{1 - x \cdot x}}{1 + x}}\right)\]
2 \cdot \tan^{-1} \left(\sqrt{\frac{1 - x}{1 + x}}\right)
2 \cdot \tan^{-1} \left(\sqrt{\log \left(e^{\frac{\sqrt{1 - x}}{\sqrt{1 + x}}}\right) \cdot \frac{\sqrt{1 - x \cdot x}}{1 + x}}\right)
(FPCore (x) :precision binary64 (* 2.0 (atan (sqrt (/ (- 1.0 x) (+ 1.0 x))))))
(FPCore (x)
 :precision binary64
 (*
  2.0
  (atan
   (sqrt
    (*
     (log (exp (/ (sqrt (- 1.0 x)) (sqrt (+ 1.0 x)))))
     (/ (sqrt (- 1.0 (* x x))) (+ 1.0 x)))))))
double code(double x) {
	return 2.0 * atan(sqrt((1.0 - x) / (1.0 + x)));
}
double code(double x) {
	return 2.0 * atan(sqrt(log(exp(sqrt(1.0 - x) / sqrt(1.0 + x))) * (sqrt(1.0 - (x * x)) / (1.0 + x))));
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Alternatives

Alternative 1
Error0.0
Cost19904
\[2 \cdot \tan^{-1} \left(\left|\frac{\sqrt{1 - x \cdot x}}{1 + x}\right|\right)\]
Alternative 2
Error0.0
Cost13376
\[2 \cdot \tan^{-1} \left(\sqrt{\frac{1 - x}{1 + x}}\right)\]
Alternative 3
Error0.3
Cost7360
\[2 \cdot \tan^{-1} \left(\left(1 - x\right) + \left(1 - x\right) \cdot \left(\left(x \cdot x\right) \cdot 0.5\right)\right)\]
Alternative 4
Error0.4
Cost7104
\[2 \cdot \tan^{-1} \left(\left(1 - x\right) + \left(x \cdot x\right) \cdot 0.5\right)\]
Alternative 5
Error0.6
Cost6720
\[2 \cdot \tan^{-1} \left(1 - x\right)\]
Alternative 6
Error1.3
Cost6592
\[2 \cdot \tan^{-1} 1\]
Alternative 7
Error51.2
Cost64
\[1\]

Error

Time

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-sqr-sqrt_binary640.0

    \[\leadsto 2 \cdot \tan^{-1} \left(\sqrt{\frac{\color{blue}{\sqrt{1 - x} \cdot \sqrt{1 - x}}}{1 + x}}\right)\]
  4. Applied associate-/l*_binary640.0

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

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

    \[\leadsto 2 \cdot \tan^{-1} \left(\sqrt{\frac{\sqrt{1 - x}}{\frac{1 + x}{\color{blue}{\frac{\sqrt{1 \cdot 1 - x \cdot x}}{\sqrt{1 + x}}}}}}\right)\]
  8. Applied associate-/r/_binary640.0

    \[\leadsto 2 \cdot \tan^{-1} \left(\sqrt{\frac{\sqrt{1 - x}}{\color{blue}{\frac{1 + x}{\sqrt{1 \cdot 1 - x \cdot x}} \cdot \sqrt{1 + x}}}}\right)\]
  9. Applied *-un-lft-identity_binary640.0

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

    \[\leadsto 2 \cdot \tan^{-1} \left(\sqrt{\frac{\color{blue}{\sqrt{1} \cdot \sqrt{1 - x}}}{\frac{1 + x}{\sqrt{1 \cdot 1 - x \cdot x}} \cdot \sqrt{1 + x}}}\right)\]
  11. Applied times-frac_binary640.0

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

    \[\leadsto 2 \cdot \tan^{-1} \left(\sqrt{\color{blue}{\frac{\sqrt{1 - x \cdot x}}{1 + x}} \cdot \frac{\sqrt{1 - x}}{\sqrt{1 + x}}}\right)\]
  13. Using strategy rm
  14. Applied add-log-exp_binary640.0

    \[\leadsto 2 \cdot \tan^{-1} \left(\sqrt{\frac{\sqrt{1 - x \cdot x}}{1 + x} \cdot \color{blue}{\log \left(e^{\frac{\sqrt{1 - x}}{\sqrt{1 + x}}}\right)}}\right)\]
  15. Using strategy rm
  16. Applied *-commutative_binary640.0

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

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

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

Reproduce

herbie shell --seed 2021045 
(FPCore (x)
  :name "arccos"
  :precision binary64
  (* 2.0 (atan (sqrt (/ (- 1.0 x) (+ 1.0 x))))))