Average Error: 7.0 → 6.1
Time: 18.4s
Precision: 64
$\sin^{-1} \left(\sqrt{\left(x \cdot x + y \cdot y\right) + z \cdot z}\right)$
$\begin{array}{l} \mathbf{if}\;\left(x \cdot x + y \cdot y\right) + z \cdot z \le 0.0:\\ \;\;\;\;\sin^{-1} z\\ \mathbf{else}:\\ \;\;\;\;\sin^{-1} \left(\sqrt{\left(x \cdot x + y \cdot y\right) + z \cdot z}\right)\\ \end{array}$
\sin^{-1} \left(\sqrt{\left(x \cdot x + y \cdot y\right) + z \cdot z}\right)
\begin{array}{l}
\mathbf{if}\;\left(x \cdot x + y \cdot y\right) + z \cdot z \le 0.0:\\
\;\;\;\;\sin^{-1} z\\

\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{\left(x \cdot x + y \cdot y\right) + z \cdot z}\right)\\

\end{array}
double f(double x, double y, double z) {
double r293835 = x;
double r293836 = r293835 * r293835;
double r293837 = y;
double r293838 = r293837 * r293837;
double r293839 = r293836 + r293838;
double r293840 = z;
double r293841 = r293840 * r293840;
double r293842 = r293839 + r293841;
double r293843 = sqrt(r293842);
double r293844 = asin(r293843);
return r293844;
}

double f(double x, double y, double z) {
double r293845 = x;
double r293846 = r293845 * r293845;
double r293847 = y;
double r293848 = r293847 * r293847;
double r293849 = r293846 + r293848;
double r293850 = z;
double r293851 = r293850 * r293850;
double r293852 = r293849 + r293851;
double r293853 = 0.0;
bool r293854 = r293852 <= r293853;
double r293855 = asin(r293850);
double r293856 = sqrt(r293852);
double r293857 = asin(r293856);
double r293858 = r293854 ? r293855 : r293857;
return r293858;
}

# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Split input into 2 regimes
2. ## if (+ (+ (* x x) (* y y)) (* z z)) < 0.0

1. Initial program 60.5

$\sin^{-1} \left(\sqrt{\left(x \cdot x + y \cdot y\right) + z \cdot z}\right)$
2. Taylor expanded around 0 52.3

$\leadsto \sin^{-1} \color{blue}{z}$

## if 0.0 < (+ (+ (* x x) (* y y)) (* z z))

1. Initial program 0.5

$\sin^{-1} \left(\sqrt{\left(x \cdot x + y \cdot y\right) + z \cdot z}\right)$
3. Recombined 2 regimes into one program.
4. Final simplification6.1

$\leadsto \begin{array}{l} \mathbf{if}\;\left(x \cdot x + y \cdot y\right) + z \cdot z \le 0.0:\\ \;\;\;\;\sin^{-1} z\\ \mathbf{else}:\\ \;\;\;\;\sin^{-1} \left(\sqrt{\left(x \cdot x + y \cdot y\right) + z \cdot z}\right)\\ \end{array}$

# Reproduce

herbie shell --seed 1
(FPCore (x y z)
:name "asin(sqrt(x * x + y * y + z * z))"
:precision binary64
(asin (sqrt (+ (+ (* x x) (* y y)) (* z z)))))