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}\;C \leq 5.039411572303443 \cdot 10^{-27}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + B \cdot B}}{B}\right)}{\pi}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\left(\left(\frac{A}{C} + 1\right) \cdot \frac{B}{C}\right) \cdot -0.5\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 (<= C 5.039411572303443e-27)
(*
180.0
(/ (atan (/ (- (- C A) (sqrt (+ (pow (- A C) 2.0) (* B B)))) B)) PI))
(* 180.0 (/ (atan (* (* (+ (/ A C) 1.0) (/ B C)) -0.5)) 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 (C <= 5.039411572303443e-27) {
tmp = 180.0 * (atan(((C - A) - sqrt(pow((A - C), 2.0) + (B * B))) / B) / ((double) M_PI));
} else {
tmp = 180.0 * (atan((((A / C) + 1.0) * (B / C)) * -0.5) / ((double) M_PI));
}
return tmp;
}



Bits error versus A



Bits error versus B



Bits error versus C
Results
if C < 5.039411572303443e-27Initial program 22.9
Simplified22.9
if 5.039411572303443e-27 < C Initial program 46.5
Simplified46.5
Taylor expanded around inf 23.2
Simplified21.1
Final simplification22.4
herbie shell --seed 2020358
(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)))