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 := \frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\\
t_1 := \left(C - A\right) - \mathsf{hypot}\left(B, C - A\right)\\
\mathbf{if}\;t_0 \leq -1.030386440041263 \cdot 10^{-101}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot t_1\right)}{\pi}\\
\mathbf{elif}\;t_0 \leq 0:\\
\;\;\;\;\frac{180 \cdot \tan^{-1} \left(-0.5 \cdot \frac{B}{C}\right)}{\pi}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{t_1}{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
(let* ((t_0
(* (/ 1.0 B) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))
(t_1 (- (- C A) (hypot B (- C A)))))
(if (<= t_0 -1.030386440041263e-101)
(* 180.0 (/ (atan (* (/ 1.0 B) t_1)) PI))
(if (<= t_0 0.0)
(/ (* 180.0 (atan (* -0.5 (/ B C)))) PI)
(* 180.0 (/ (atan (/ t_1 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 t_0 = (1.0 / B) * ((C - A) - sqrt(pow((A - C), 2.0) + pow(B, 2.0)));
double t_1 = (C - A) - hypot(B, (C - A));
double tmp;
if (t_0 <= -1.030386440041263e-101) {
tmp = 180.0 * (atan((1.0 / B) * t_1) / ((double) M_PI));
} else if (t_0 <= 0.0) {
tmp = (180.0 * atan(-0.5 * (B / C))) / ((double) M_PI);
} else {
tmp = 180.0 * (atan(t_1 / B) / ((double) M_PI));
}
return tmp;
}



Bits error versus A



Bits error versus B



Bits error versus C
Results
if (*.f64 (/.f64 1 B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))) < -1.03038644004126301e-101Initial program 26.0
Simplified8.0
Applied div-inv_binary648.0
if -1.03038644004126301e-101 < (*.f64 (/.f64 1 B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))) < -0.0Initial program 52.4
Simplified52.4
Applied associate-*r/_binary6452.4
Taylor expanded in C around inf 31.4
if -0.0 < (*.f64 (/.f64 1 B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))) Initial program 25.0
Simplified7.6
Applied *-un-lft-identity_binary647.6
Final simplification10.9
herbie shell --seed 2022081
(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)))