Average Error: 28.6 → 13.1
Time: 7.6s
Precision: binary64
\[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 1116359.8079724736:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\left(\left(C - A\right) - \mathsf{hypot}\left(B, C - A\right)\right) \cdot \frac{1}{B}\right)}{\pi}\\ \mathbf{elif}\;C \leq 1.3262682172405047 \cdot 10^{+154}:\\ \;\;\;\;\begin{array}{l} t_0 := \mathsf{fma}\left(A, A, C \cdot \left(C - A \cdot 2\right)\right)\\ 180 \cdot \frac{\tan^{-1} \left(\frac{C - \left(A + \sqrt{t_0}\right)}{B} - 0.5 \cdot \left(B \cdot \sqrt{\frac{1}{t_0}}\right)\right)}{\pi} \end{array}\\ \mathbf{elif}\;C \leq 1.2860608303654123 \cdot 10^{+219}:\\ \;\;\;\;\frac{180 \cdot \tan^{-1} \left(\frac{C - \mathsf{hypot}\left(B, C\right)}{B}\right)}{\pi}\\ \mathbf{else}:\\ \;\;\;\;\frac{180 \cdot \tan^{-1} \left(-0.5 \cdot \frac{B}{C}\right)}{\pi}\\ \end{array} \]
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 1116359.8079724736:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\left(\left(C - A\right) - \mathsf{hypot}\left(B, C - A\right)\right) \cdot \frac{1}{B}\right)}{\pi}\\

\mathbf{elif}\;C \leq 1.3262682172405047 \cdot 10^{+154}:\\
\;\;\;\;\begin{array}{l}
t_0 := \mathsf{fma}\left(A, A, C \cdot \left(C - A \cdot 2\right)\right)\\
180 \cdot \frac{\tan^{-1} \left(\frac{C - \left(A + \sqrt{t_0}\right)}{B} - 0.5 \cdot \left(B \cdot \sqrt{\frac{1}{t_0}}\right)\right)}{\pi}
\end{array}\\

\mathbf{elif}\;C \leq 1.2860608303654123 \cdot 10^{+219}:\\
\;\;\;\;\frac{180 \cdot \tan^{-1} \left(\frac{C - \mathsf{hypot}\left(B, C\right)}{B}\right)}{\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
 (if (<= C 1116359.8079724736)
   (* 180.0 (/ (atan (* (- (- C A) (hypot B (- C A))) (/ 1.0 B))) PI))
   (if (<= C 1.3262682172405047e+154)
     (let* ((t_0 (fma A A (* C (- C (* A 2.0))))))
       (*
        180.0
        (/
         (atan
          (- (/ (- C (+ A (sqrt t_0))) B) (* 0.5 (* B (sqrt (/ 1.0 t_0))))))
         PI)))
     (if (<= C 1.2860608303654123e+219)
       (/ (* 180.0 (atan (/ (- C (hypot B C)) B))) 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 tmp;
	if (C <= 1116359.8079724736) {
		tmp = 180.0 * (atan(((C - A) - hypot(B, (C - A))) * (1.0 / B)) / ((double) M_PI));
	} else if (C <= 1.3262682172405047e+154) {
		double t_0 = fma(A, A, (C * (C - (A * 2.0))));
		tmp = 180.0 * (atan(((C - (A + sqrt(t_0))) / B) - (0.5 * (B * sqrt(1.0 / t_0)))) / ((double) M_PI));
	} else if (C <= 1.2860608303654123e+219) {
		tmp = (180.0 * atan((C - hypot(B, C)) / B)) / ((double) M_PI);
	} else {
		tmp = (180.0 * atan(-0.5 * (B / C))) / ((double) M_PI);
	}
	return tmp;
}

Error

Bits error versus A

Bits error versus B

Bits error versus C

Derivation

  1. Split input into 4 regimes
  2. if C < 1116359.8079724736

    1. Initial program 22.5

      \[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} \]
    2. Simplified9.5

      \[\leadsto \color{blue}{180 \cdot \frac{\tan^{-1} \left(\frac{\left(C - A\right) - \mathsf{hypot}\left(B, C - A\right)}{B}\right)}{\pi}} \]
    3. Applied div-inv_binary649.5

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\left(\left(C - A\right) - \mathsf{hypot}\left(B, C - A\right)\right) \cdot \frac{1}{B}\right)}}{\pi} \]

    if 1116359.8079724736 < C < 1.3262682172405047e154

    1. Initial program 38.1

      \[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} \]
    2. Simplified23.0

      \[\leadsto \color{blue}{180 \cdot \frac{\tan^{-1} \left(\frac{\left(C - A\right) - \mathsf{hypot}\left(B, C - A\right)}{B}\right)}{\pi}} \]
    3. Applied div-inv_binary6423.0

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\left(\left(C - A\right) - \mathsf{hypot}\left(B, C - A\right)\right) \cdot \frac{1}{B}\right)}}{\pi} \]
    4. Taylor expanded in B around 0 52.5

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{C}{B} - \left(\frac{A}{B} + \left(0.5 \cdot \left(\sqrt{\frac{1}{\left({A}^{2} + {C}^{2}\right) - 2 \cdot \left(A \cdot C\right)}} \cdot B\right) + \sqrt{\left({A}^{2} + {C}^{2}\right) - 2 \cdot \left(A \cdot C\right)} \cdot \frac{1}{B}\right)\right)\right)}}{\pi} \]
    5. Simplified30.2

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{C - \left(A + \sqrt{\mathsf{fma}\left(A, A, C \cdot \left(C - A \cdot 2\right)\right)}\right)}{B} - 0.5 \cdot \left(B \cdot \sqrt{\frac{1}{\mathsf{fma}\left(A, A, C \cdot \left(C - A \cdot 2\right)\right)}}\right)\right)}}{\pi} \]

    if 1.3262682172405047e154 < C < 1.28606083036541231e219

    1. Initial program 54.9

      \[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} \]
    2. Simplified25.5

      \[\leadsto \color{blue}{180 \cdot \frac{\tan^{-1} \left(\frac{\left(C - A\right) - \mathsf{hypot}\left(B, C - A\right)}{B}\right)}{\pi}} \]
    3. Applied associate-*r/_binary6425.5

      \[\leadsto \color{blue}{\frac{180 \cdot \tan^{-1} \left(\frac{\left(C - A\right) - \mathsf{hypot}\left(B, C - A\right)}{B}\right)}{\pi}} \]
    4. Taylor expanded in A around 0 54.9

      \[\leadsto \frac{180 \cdot \tan^{-1} \left(\frac{\color{blue}{C - \sqrt{{B}^{2} + {C}^{2}}}}{B}\right)}{\pi} \]
    5. Simplified30.2

      \[\leadsto \frac{180 \cdot \tan^{-1} \left(\frac{\color{blue}{C - \mathsf{hypot}\left(B, C\right)}}{B}\right)}{\pi} \]

    if 1.28606083036541231e219 < C

    1. Initial program 58.3

      \[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} \]
    2. Simplified29.2

      \[\leadsto \color{blue}{180 \cdot \frac{\tan^{-1} \left(\frac{\left(C - A\right) - \mathsf{hypot}\left(B, C - A\right)}{B}\right)}{\pi}} \]
    3. Applied associate-*r/_binary6429.2

      \[\leadsto \color{blue}{\frac{180 \cdot \tan^{-1} \left(\frac{\left(C - A\right) - \mathsf{hypot}\left(B, C - A\right)}{B}\right)}{\pi}} \]
    4. Taylor expanded in C around inf 8.0

      \[\leadsto \frac{180 \cdot \tan^{-1} \color{blue}{\left(-0.5 \cdot \frac{B}{C}\right)}}{\pi} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification13.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;C \leq 1116359.8079724736:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\left(\left(C - A\right) - \mathsf{hypot}\left(B, C - A\right)\right) \cdot \frac{1}{B}\right)}{\pi}\\ \mathbf{elif}\;C \leq 1.3262682172405047 \cdot 10^{+154}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C - \left(A + \sqrt{\mathsf{fma}\left(A, A, C \cdot \left(C - A \cdot 2\right)\right)}\right)}{B} - 0.5 \cdot \left(B \cdot \sqrt{\frac{1}{\mathsf{fma}\left(A, A, C \cdot \left(C - A \cdot 2\right)\right)}}\right)\right)}{\pi}\\ \mathbf{elif}\;C \leq 1.2860608303654123 \cdot 10^{+219}:\\ \;\;\;\;\frac{180 \cdot \tan^{-1} \left(\frac{C - \mathsf{hypot}\left(B, C\right)}{B}\right)}{\pi}\\ \mathbf{else}:\\ \;\;\;\;\frac{180 \cdot \tan^{-1} \left(-0.5 \cdot \frac{B}{C}\right)}{\pi}\\ \end{array} \]

Reproduce

herbie shell --seed 2021280 
(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)))