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}\;\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right) \leq -0.999999968075197:\\
\;\;\;\;\left(180 \cdot \tan^{-1} \left(\frac{C - \left(B + A\right)}{B}\right)\right) \cdot \frac{1}{\pi}\\
\mathbf{elif}\;\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right) \leq 6.889790926715526 \cdot 10^{-76}:\\
\;\;\;\;\frac{1}{\pi} \cdot \left(180 \cdot \tan^{-1} \left(\frac{C - \left(A + \sqrt{\left(A \cdot A + C \cdot C\right) - 2 \cdot \left(C \cdot A\right)}\right)}{B} - 0.5 \cdot \left(B \cdot \sqrt{\frac{1}{\left(A \cdot A + C \cdot C\right) - 2 \cdot \left(C \cdot A\right)}}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(B + \left(C - A\right)\right)\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 (<=
(* (/ 1.0 B) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))
-0.999999968075197)
(* (* 180.0 (atan (/ (- C (+ B A)) B))) (/ 1.0 PI))
(if (<=
(* (/ 1.0 B) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))
6.889790926715526e-76)
(*
(/ 1.0 PI)
(*
180.0
(atan
(-
(/ (- C (+ A (sqrt (- (+ (* A A) (* C C)) (* 2.0 (* C A)))))) B)
(*
0.5
(* B (sqrt (/ 1.0 (- (+ (* A A) (* C C)) (* 2.0 (* C A)))))))))))
(* 180.0 (/ (atan (* (/ 1.0 B) (+ B (- C A)))) 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 (((1.0 / B) * ((C - A) - sqrt(pow((A - C), 2.0) + pow(B, 2.0)))) <= -0.999999968075197) {
tmp = (180.0 * atan((C - (B + A)) / B)) * (1.0 / ((double) M_PI));
} else if (((1.0 / B) * ((C - A) - sqrt(pow((A - C), 2.0) + pow(B, 2.0)))) <= 6.889790926715526e-76) {
tmp = (1.0 / ((double) M_PI)) * (180.0 * atan(((C - (A + sqrt(((A * A) + (C * C)) - (2.0 * (C * A))))) / B) - (0.5 * (B * sqrt(1.0 / (((A * A) + (C * C)) - (2.0 * (C * A))))))));
} else {
tmp = 180.0 * (atan((1.0 / B) * (B + (C - A))) / ((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))))) < -0.99999996807519698Initial program 26.0
rmApplied div-inv_binary6426.0
Applied associate-*r*_binary6426.0
Simplified26.0
Taylor expanded around inf 15.1
if -0.99999996807519698 < (*.f64 (/.f64 1 B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))) < 6.8897909267155259e-76Initial program 51.7
rmApplied div-inv_binary6451.7
Applied associate-*r*_binary6451.7
Simplified51.7
Taylor expanded around 0 61.1
Simplified26.2
if 6.8897909267155259e-76 < (*.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
Taylor expanded around -inf 14.1
Simplified14.1
Final simplification16.1
herbie shell --seed 2021118
(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)))