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}
t_0 := \tan^{-1} \left(\frac{\left(C - A\right) - \mathsf{hypot}\left(B, C - A\right)}{B}\right)\\
\mathbf{if}\;C \leq -7.961133987601505 \cdot 10^{-17}:\\
\;\;\;\;180 \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{t_0}{\pi}\right)\right)\\
\mathbf{elif}\;C \leq -1.2315399059169273 \cdot 10^{-79}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(0.5 \cdot \left(\frac{C}{\frac{A \cdot A}{B}} + \frac{B}{A}\right)\right)}{\pi}\\
\mathbf{elif}\;C \leq 4.9369960185973415 \cdot 10^{+146}:\\
\;\;\;\;\frac{180 \cdot t_0}{\pi}\\
\mathbf{else}:\\
\;\;\;\;\frac{180 \cdot \tan^{-1} \left(-0.5 \cdot \frac{B}{C}\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
(let* ((t_0 (atan (/ (- (- C A) (hypot B (- C A))) B))))
(if (<= C -7.961133987601505e-17)
(* 180.0 (log1p (expm1 (/ t_0 PI))))
(if (<= C -1.2315399059169273e-79)
(* 180.0 (/ (atan (* 0.5 (+ (/ C (/ (* A A) B)) (/ B A)))) PI))
(if (<= C 4.9369960185973415e+146)
(/ (* 180.0 t_0) PI)
(/ (* 180.0 (atan (* -0.5 (/ B C)))) 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 t_0 = atan(((C - A) - hypot(B, (C - A))) / B);
double tmp;
if (C <= -7.961133987601505e-17) {
tmp = 180.0 * log1p(expm1(t_0 / ((double) M_PI)));
} else if (C <= -1.2315399059169273e-79) {
tmp = 180.0 * (atan(0.5 * ((C / ((A * A) / B)) + (B / A))) / ((double) M_PI));
} else if (C <= 4.9369960185973415e+146) {
tmp = (180.0 * t_0) / ((double) M_PI);
} else {
tmp = (180.0 * atan(-0.5 * (B / C))) / ((double) M_PI);
}
return tmp;
}



Bits error versus A



Bits error versus B



Bits error versus C
Results
if C < -7.96113398760150458e-17Initial program 14.9
Simplified3.6
Applied log1p-expm1-u_binary643.6
if -7.96113398760150458e-17 < C < -1.23153990591692733e-79Initial program 25.3
Simplified10.1
Taylor expanded in A around -inf 39.3
Simplified38.5
if -1.23153990591692733e-79 < C < 4.93699601859734147e146Initial program 31.2
Simplified15.5
Applied associate-*r/_binary6415.5
if 4.93699601859734147e146 < C Initial program 56.3
Simplified30.1
Applied associate-*r/_binary6430.1
Taylor expanded in C around inf 11.6
Final simplification13.0
herbie shell --seed 2021313
(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)))