Average Error: 29.8 → 11.6
Time: 9.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} \mathbf{if}\;C \leq 4.283004787062823 \cdot 10^{+31}:\\ \;\;\;\;\tan^{-1} \left(\frac{1}{\frac{B}{\left(C - A\right) - \mathsf{hypot}\left(B, A - C\right)}}\right) \cdot \frac{180}{\pi}\\ \mathbf{else}:\\ \;\;\;\;\frac{180}{\pi} \cdot \tan^{-1} \left(-0.5 \cdot \left(\frac{B}{C} + \frac{B}{C} \cdot \frac{A}{C}\right)\right)\\ \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 4.283004787062823e+31)
   (* (atan (/ 1.0 (/ B (- (- C A) (hypot B (- A C)))))) (/ 180.0 PI))
   (* (/ 180.0 PI) (atan (* -0.5 (+ (/ B C) (* (/ B C) (/ A C))))))))
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 <= 4.283004787062823e+31) {
		tmp = atan((1.0 / (B / ((C - A) - hypot(B, (A - C)))))) * (180.0 / ((double) M_PI));
	} else {
		tmp = (180.0 / ((double) M_PI)) * atan((-0.5 * ((B / C) + ((B / C) * (A / C)))));
	}
	return tmp;
}
public static double code(double A, double B, double C) {
	return 180.0 * (Math.atan(((1.0 / B) * ((C - A) - Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B, 2.0)))))) / Math.PI);
}
public static double code(double A, double B, double C) {
	double tmp;
	if (C <= 4.283004787062823e+31) {
		tmp = Math.atan((1.0 / (B / ((C - A) - Math.hypot(B, (A - C)))))) * (180.0 / Math.PI);
	} else {
		tmp = (180.0 / Math.PI) * Math.atan((-0.5 * ((B / C) + ((B / C) * (A / C)))));
	}
	return tmp;
}
def code(A, B, C):
	return 180.0 * (math.atan(((1.0 / B) * ((C - A) - math.sqrt((math.pow((A - C), 2.0) + math.pow(B, 2.0)))))) / math.pi)
def code(A, B, C):
	tmp = 0
	if C <= 4.283004787062823e+31:
		tmp = math.atan((1.0 / (B / ((C - A) - math.hypot(B, (A - C)))))) * (180.0 / math.pi)
	else:
		tmp = (180.0 / math.pi) * math.atan((-0.5 * ((B / C) + ((B / C) * (A / C)))))
	return tmp
function code(A, B, C)
	return Float64(180.0 * Float64(atan(Float64(Float64(1.0 / B) * Float64(Float64(C - A) - sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0)))))) / pi))
end
function code(A, B, C)
	tmp = 0.0
	if (C <= 4.283004787062823e+31)
		tmp = Float64(atan(Float64(1.0 / Float64(B / Float64(Float64(C - A) - hypot(B, Float64(A - C)))))) * Float64(180.0 / pi));
	else
		tmp = Float64(Float64(180.0 / pi) * atan(Float64(-0.5 * Float64(Float64(B / C) + Float64(Float64(B / C) * Float64(A / C))))));
	end
	return tmp
end
function tmp = code(A, B, C)
	tmp = 180.0 * (atan(((1.0 / B) * ((C - A) - sqrt((((A - C) ^ 2.0) + (B ^ 2.0)))))) / pi);
end
function tmp_2 = code(A, B, C)
	tmp = 0.0;
	if (C <= 4.283004787062823e+31)
		tmp = atan((1.0 / (B / ((C - A) - hypot(B, (A - C)))))) * (180.0 / pi);
	else
		tmp = (180.0 / pi) * atan((-0.5 * ((B / C) + ((B / C) * (A / C)))));
	end
	tmp_2 = tmp;
end
code[A_, B_, C_] := N[(180.0 * N[(N[ArcTan[N[(N[(1.0 / B), $MachinePrecision] * N[(N[(C - A), $MachinePrecision] - N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]
code[A_, B_, C_] := If[LessEqual[C, 4.283004787062823e+31], N[(N[ArcTan[N[(1.0 / N[(B / N[(N[(C - A), $MachinePrecision] - N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(180.0 / Pi), $MachinePrecision]), $MachinePrecision], N[(N[(180.0 / Pi), $MachinePrecision] * N[ArcTan[N[(-0.5 * N[(N[(B / C), $MachinePrecision] + N[(N[(B / C), $MachinePrecision] * N[(A / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
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 4.283004787062823 \cdot 10^{+31}:\\
\;\;\;\;\tan^{-1} \left(\frac{1}{\frac{B}{\left(C - A\right) - \mathsf{hypot}\left(B, A - C\right)}}\right) \cdot \frac{180}{\pi}\\

\mathbf{else}:\\
\;\;\;\;\frac{180}{\pi} \cdot \tan^{-1} \left(-0.5 \cdot \left(\frac{B}{C} + \frac{B}{C} \cdot \frac{A}{C}\right)\right)\\


\end{array}

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 2 regimes
  2. if C < 4.2830047870628231e31

    1. Initial program 23.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. Simplified9.7

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

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

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

    if 4.2830047870628231e31 < C

    1. Initial program 49.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. Simplified27.8

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;C \leq 4.283004787062823 \cdot 10^{+31}:\\ \;\;\;\;\tan^{-1} \left(\frac{1}{\frac{B}{\left(C - A\right) - \mathsf{hypot}\left(B, A - C\right)}}\right) \cdot \frac{180}{\pi}\\ \mathbf{else}:\\ \;\;\;\;\frac{180}{\pi} \cdot \tan^{-1} \left(-0.5 \cdot \left(\frac{B}{C} + \frac{B}{C} \cdot \frac{A}{C}\right)\right)\\ \end{array} \]

Reproduce

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