Average Error: 0.0 → 0.0
Time: 2.2s
Precision: 64
\[2 \cdot \tan^{-1} \left(\sqrt{\frac{1 - x}{1 + x}}\right)\]
\[2 \cdot \tan^{-1} \left(\left|\frac{\sqrt{1 - x}}{\sqrt{1 + x}}\right|\right)\]
2 \cdot \tan^{-1} \left(\sqrt{\frac{1 - x}{1 + x}}\right)
2 \cdot \tan^{-1} \left(\left|\frac{\sqrt{1 - x}}{\sqrt{1 + x}}\right|\right)
double f(double x) {
        double r5400 = 2.0;
        double r5401 = 1.0;
        double r5402 = x;
        double r5403 = r5401 - r5402;
        double r5404 = r5401 + r5402;
        double r5405 = r5403 / r5404;
        double r5406 = sqrt(r5405);
        double r5407 = atan(r5406);
        double r5408 = r5400 * r5407;
        return r5408;
}

double f(double x) {
        double r5409 = 2.0;
        double r5410 = 1.0;
        double r5411 = x;
        double r5412 = r5410 - r5411;
        double r5413 = sqrt(r5412);
        double r5414 = r5410 + r5411;
        double r5415 = sqrt(r5414);
        double r5416 = r5413 / r5415;
        double r5417 = fabs(r5416);
        double r5418 = atan(r5417);
        double r5419 = r5409 * r5418;
        return r5419;
}

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

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

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

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

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

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

Reproduce

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