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)\\
\mathbf{if}\;t_0 \leq -0.99999999853945:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C - \left(B + A\right)}{B}\right)}{\pi}\\
\mathbf{elif}\;t_0 \leq 3.567253752474156 \cdot 10^{-5}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{0.5 \cdot \frac{B \cdot B}{A}}{B}\right)}{\pi}\\
\mathbf{else}:\\
\;\;\;\;\left(180 \cdot \tan^{-1} \left(\frac{\left(B + C\right) - A}{B}\right)\right) \cdot \frac{1}{\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)))))))
(if (<= t_0 -0.99999999853945)
(* 180.0 (/ (atan (/ (- C (+ B A)) B)) PI))
(if (<= t_0 3.567253752474156e-5)
(* 180.0 (/ (atan (/ (* 0.5 (/ (* B B) A)) B)) PI))
(* (* 180.0 (atan (/ (- (+ B C) A) B))) (/ 1.0 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 tmp;
if (t_0 <= -0.99999999853945) {
tmp = 180.0 * (atan((C - (B + A)) / B) / ((double) M_PI));
} else if (t_0 <= 3.567253752474156e-5) {
tmp = 180.0 * (atan((0.5 * ((B * B) / A)) / B) / ((double) M_PI));
} else {
tmp = (180.0 * atan(((B + C) - A) / B)) * (1.0 / ((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.999999998539449986Initial program 26.2
Simplified26.2
rmApplied associate--l-_binary6426.2
Simplified26.2
rmApplied *-un-lft-identity_binary6426.2
Applied *-un-lft-identity_binary6426.2
Applied times-frac_binary6426.2
Simplified26.2
Taylor expanded around inf 14.9
if -0.999999998539449986 < (*.f64 (/.f64 1 B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))) < 3.567253752474156e-5Initial program 50.8
Simplified50.8
Taylor expanded around -inf 38.5
Simplified38.5
if 3.567253752474156e-5 < (*.f64 (/.f64 1 B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))) Initial program 25.9
Simplified25.9
Taylor expanded around -inf 14.6
Simplified14.6
rmApplied div-inv_binary6414.6
Applied associate-*r*_binary6414.6
Simplified14.6
Final simplification18.1
herbie shell --seed 2021205
(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)))