Average Error: 25.1 → 25.2
Time: 27.3s
Precision: 64
Internal Precision: 2624
$\cos^{-1} \left(\frac{x1 \cdot y1 + x2 \cdot y2}{\sqrt{x1^2 + x2^2}^* \cdot \sqrt{y1^2 + y2^2}^*}\right)$
$\begin{array}{l} \mathbf{if}\;x1 \le -6.091437625220569 \cdot 10^{+22} \lor \neg \left(x1 \le 2.2486827300578035 \cdot 10^{+209}\right):\\ \;\;\;\;\cos^{-1} \left(\frac{\frac{0}{\sqrt{y1^2 + y2^2}^*}}{\sqrt{x1^2 + x2^2}^*}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{\left(\cos^{-1} \left(\frac{\frac{x1 \cdot y1 + y2 \cdot x2}{\sqrt{y1^2 + y2^2}^*}}{\sqrt{x1^2 + x2^2}^*}\right) \cdot \cos^{-1} \left(\frac{\frac{x1 \cdot y1 + y2 \cdot x2}{\sqrt{y1^2 + y2^2}^*}}{\sqrt{x1^2 + x2^2}^*}\right)\right) \cdot \cos^{-1} \left(\frac{\frac{x1 \cdot y1 + y2 \cdot x2}{\sqrt{y1^2 + y2^2}^*}}{\sqrt{x1^2 + x2^2}^*}\right)}\\ \end{array}$

# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Split input into 2 regimes
2. ## if x1 < -6.091437625220569e+22 or 2.2486827300578035e+209 < x1

1. Initial program 30.9

$\cos^{-1} \left(\frac{x1 \cdot y1 + x2 \cdot y2}{\sqrt{x1^2 + x2^2}^* \cdot \sqrt{y1^2 + y2^2}^*}\right)$
2. Initial simplification30.9

$\leadsto \cos^{-1} \left(\frac{x1 \cdot y1 + x2 \cdot y2}{\sqrt{y1^2 + y2^2}^* \cdot \sqrt{x1^2 + x2^2}^*}\right)$
3. Using strategy rm
4. Applied associate-/r*31.4

$\leadsto \cos^{-1} \color{blue}{\left(\frac{\frac{x1 \cdot y1 + x2 \cdot y2}{\sqrt{y1^2 + y2^2}^*}}{\sqrt{x1^2 + x2^2}^*}\right)}$
5. Taylor expanded around 0 28.8

$\leadsto \cos^{-1} \left(\frac{\frac{\color{blue}{0}}{\sqrt{y1^2 + y2^2}^*}}{\sqrt{x1^2 + x2^2}^*}\right)$

## if -6.091437625220569e+22 < x1 < 2.2486827300578035e+209

1. Initial program 22.3

$\cos^{-1} \left(\frac{x1 \cdot y1 + x2 \cdot y2}{\sqrt{x1^2 + x2^2}^* \cdot \sqrt{y1^2 + y2^2}^*}\right)$
2. Initial simplification22.3

$\leadsto \cos^{-1} \left(\frac{x1 \cdot y1 + x2 \cdot y2}{\sqrt{y1^2 + y2^2}^* \cdot \sqrt{x1^2 + x2^2}^*}\right)$
3. Using strategy rm
4. Applied associate-/r*22.8

$\leadsto \cos^{-1} \color{blue}{\left(\frac{\frac{x1 \cdot y1 + x2 \cdot y2}{\sqrt{y1^2 + y2^2}^*}}{\sqrt{x1^2 + x2^2}^*}\right)}$
5. Using strategy rm

$\leadsto \color{blue}{\sqrt[3]{\left(\cos^{-1} \left(\frac{\frac{x1 \cdot y1 + x2 \cdot y2}{\sqrt{y1^2 + y2^2}^*}}{\sqrt{x1^2 + x2^2}^*}\right) \cdot \cos^{-1} \left(\frac{\frac{x1 \cdot y1 + x2 \cdot y2}{\sqrt{y1^2 + y2^2}^*}}{\sqrt{x1^2 + x2^2}^*}\right)\right) \cdot \cos^{-1} \left(\frac{\frac{x1 \cdot y1 + x2 \cdot y2}{\sqrt{y1^2 + y2^2}^*}}{\sqrt{x1^2 + x2^2}^*}\right)}}$
3. Recombined 2 regimes into one program.
4. Final simplification25.2

$\leadsto \begin{array}{l} \mathbf{if}\;x1 \le -6.091437625220569 \cdot 10^{+22} \lor \neg \left(x1 \le 2.2486827300578035 \cdot 10^{+209}\right):\\ \;\;\;\;\cos^{-1} \left(\frac{\frac{0}{\sqrt{y1^2 + y2^2}^*}}{\sqrt{x1^2 + x2^2}^*}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{\left(\cos^{-1} \left(\frac{\frac{x1 \cdot y1 + y2 \cdot x2}{\sqrt{y1^2 + y2^2}^*}}{\sqrt{x1^2 + x2^2}^*}\right) \cdot \cos^{-1} \left(\frac{\frac{x1 \cdot y1 + y2 \cdot x2}{\sqrt{y1^2 + y2^2}^*}}{\sqrt{x1^2 + x2^2}^*}\right)\right) \cdot \cos^{-1} \left(\frac{\frac{x1 \cdot y1 + y2 \cdot x2}{\sqrt{y1^2 + y2^2}^*}}{\sqrt{x1^2 + x2^2}^*}\right)}\\ \end{array}$

# Runtime

Time bar (total: 27.3s)Debug log

herbie shell --seed '#(2775764126 3555076145 3898259844 1891440260 2599947619 1948460636)'
(FPCore (x1 y1 x2 y2)
:name "acos((x1 * y1 + x2 * y2) / (hypot(x1, x2) * hypot(y1, y2)))"
(acos (/ (+ (* x1 y1) (* x2 y2)) (* (hypot x1 x2) (hypot y1 y2)))))