Average Error: 29.8 → 13.0
Time: 8.1s
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} t_0 := \tan^{-1} \left(\frac{\left(C - A\right) - \mathsf{hypot}\left(B, C - A\right)}{B}\right)\\ \mathbf{if}\;C \leq -7.961133987601505 \cdot 10^{-17}:\\ \;\;\;\;180 \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{t_0}{\pi}\right)\right)\\ \mathbf{elif}\;C \leq -1.2315399059169273 \cdot 10^{-79}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(0.5 \cdot \left(\frac{C}{\frac{A \cdot A}{B}} + \frac{B}{A}\right)\right)}{\pi}\\ \mathbf{elif}\;C \leq 4.9369960185973415 \cdot 10^{+146}:\\ \;\;\;\;\frac{180 \cdot t_0}{\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}
t_0 := \tan^{-1} \left(\frac{\left(C - A\right) - \mathsf{hypot}\left(B, C - A\right)}{B}\right)\\
\mathbf{if}\;C \leq -7.961133987601505 \cdot 10^{-17}:\\
\;\;\;\;180 \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{t_0}{\pi}\right)\right)\\

\mathbf{elif}\;C \leq -1.2315399059169273 \cdot 10^{-79}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(0.5 \cdot \left(\frac{C}{\frac{A \cdot A}{B}} + \frac{B}{A}\right)\right)}{\pi}\\

\mathbf{elif}\;C \leq 4.9369960185973415 \cdot 10^{+146}:\\
\;\;\;\;\frac{180 \cdot t_0}{\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
 (let* ((t_0 (atan (/ (- (- C A) (hypot B (- C A))) B))))
   (if (<= C -7.961133987601505e-17)
     (* 180.0 (log1p (expm1 (/ t_0 PI))))
     (if (<= C -1.2315399059169273e-79)
       (* 180.0 (/ (atan (* 0.5 (+ (/ C (/ (* A A) B)) (/ B A)))) PI))
       (if (<= C 4.9369960185973415e+146)
         (/ (* 180.0 t_0) 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 t_0 = atan(((C - A) - hypot(B, (C - A))) / B);
	double tmp;
	if (C <= -7.961133987601505e-17) {
		tmp = 180.0 * log1p(expm1(t_0 / ((double) M_PI)));
	} else if (C <= -1.2315399059169273e-79) {
		tmp = 180.0 * (atan(0.5 * ((C / ((A * A) / B)) + (B / A))) / ((double) M_PI));
	} else if (C <= 4.9369960185973415e+146) {
		tmp = (180.0 * t_0) / ((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

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 4 regimes
  2. if C < -7.96113398760150458e-17

    1. Initial program 14.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. Simplified3.6

      \[\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 log1p-expm1-u_binary643.6

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

    if -7.96113398760150458e-17 < C < -1.23153990591692733e-79

    1. Initial program 25.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. Simplified10.1

      \[\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. Taylor expanded in A around -inf 39.3

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

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

    if -1.23153990591692733e-79 < C < 4.93699601859734147e146

    1. Initial program 31.2

      \[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. Simplified15.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/_binary6415.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}} \]

    if 4.93699601859734147e146 < C

    1. Initial program 56.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. Simplified30.1

      \[\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/_binary6430.1

      \[\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 11.6

      \[\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.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;C \leq -7.961133987601505 \cdot 10^{-17}:\\ \;\;\;\;180 \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{\tan^{-1} \left(\frac{\left(C - A\right) - \mathsf{hypot}\left(B, C - A\right)}{B}\right)}{\pi}\right)\right)\\ \mathbf{elif}\;C \leq -1.2315399059169273 \cdot 10^{-79}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(0.5 \cdot \left(\frac{C}{\frac{A \cdot A}{B}} + \frac{B}{A}\right)\right)}{\pi}\\ \mathbf{elif}\;C \leq 4.9369960185973415 \cdot 10^{+146}:\\ \;\;\;\;\frac{180 \cdot \tan^{-1} \left(\frac{\left(C - A\right) - \mathsf{hypot}\left(B, C - A\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 2021313 
(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)))