180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\pi}
\begin{array}{l}
\mathbf{if}\;A \leq -0.1297148223603918:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(0.5 \cdot \frac{B}{A}\right)}{\pi}\\
\mathbf{else}:\\
\;\;\;\;\frac{180}{\frac{\pi}{\tan^{-1} \left(\frac{\left(C - A\right) - \mathsf{hypot}\left(B, C - A\right)}{B}\right)}}\\
\end{array}
(FPCore (A B C) :precision binary64 (* 180.0 (/ (atan (* (/ 1.0 B) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))) PI)))
(FPCore (A B C) :precision binary64 (if (<= A -0.1297148223603918) (* 180.0 (/ (atan (* 0.5 (/ B A))) PI)) (/ 180.0 (/ PI (atan (/ (- (- C A) (hypot B (- C A))) B))))))
double code(double A, double B, double C) {
return 180.0 * (atan((1.0 / B) * ((C - A) - sqrt(pow((A - C), 2.0) + pow(B, 2.0)))) / ((double) M_PI));
}
double code(double A, double B, double C) {
double tmp;
if (A <= -0.1297148223603918) {
tmp = 180.0 * (atan(0.5 * (B / A)) / ((double) M_PI));
} else {
tmp = 180.0 / (((double) M_PI) / atan(((C - A) - hypot(B, (C - A))) / B));
}
return tmp;
}



Bits error versus A



Bits error versus B



Bits error versus C
Results
if A < -0.129714822360391807Initial program 47.8
Simplified26.9
Taylor expanded in A around -inf 21.3
if -0.129714822360391807 < A Initial program 23.7
Simplified9.5
Applied associate-*r/_binary649.6
Applied associate-/l*_binary649.6
Final simplification12.5
herbie shell --seed 2021275
(FPCore (A B C)
:name "ABCF->ab-angle angle"
:precision binary64
(* 180.0 (/ (atan (* (/ 1.0 B) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))) PI)))