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 -4.693515796693692 \cdot 10^{+135}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(0.5 \cdot \frac{B}{A}\right)}{\pi}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C - \left(A + \mathsf{hypot}\left(B, C - A\right)\right)}{B}\right)}{\pi}\\
\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 -4.693515796693692e+135) (* 180.0 (/ (atan (* 0.5 (/ B A))) PI)) (* 180.0 (/ (atan (/ (- C (+ A (hypot B (- C A)))) B)) PI))))
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 <= -4.693515796693692e+135) {
tmp = 180.0 * (atan(0.5 * (B / A)) / ((double) M_PI));
} else {
tmp = 180.0 * (atan((C - (A + hypot(B, (C - A)))) / B) / ((double) M_PI));
}
return tmp;
}



Bits error versus A



Bits error versus B



Bits error versus C
Results
if A < -4.69351579669369179e135Initial program 54.1
Simplified28.1
Taylor expanded in A around -inf 13.9
if -4.69351579669369179e135 < A Initial program 26.0
Simplified11.6
Taylor expanded in C around 0 12.1
Final simplification12.3
herbie shell --seed 2022024
(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)))