Average Error: 29.5 → 12.1
Time: 33.2s
Precision: binary64
Cost: 20164
\[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}\;A \leq -1.3 \cdot 10^{+47}:\\ \;\;\;\;\tan^{-1} \left(0.5 \cdot \left(B \cdot \left(\frac{C}{A \cdot A} + \frac{1}{A}\right)\right)\right) \cdot \frac{180}{\pi}\\ \mathbf{else}:\\ \;\;\;\;\tan^{-1} \left(\frac{C - \left(A + \mathsf{hypot}\left(A - C, B\right)\right)}{B}\right) \cdot \frac{180}{\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 (<= A -1.3e+47)
   (* (atan (* 0.5 (* B (+ (/ C (* A A)) (/ 1.0 A))))) (/ 180.0 PI))
   (* (atan (/ (- C (+ A (hypot (- A C) B))) B)) (/ 180.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 tmp;
	if (A <= -1.3e+47) {
		tmp = atan((0.5 * (B * ((C / (A * A)) + (1.0 / A))))) * (180.0 / ((double) M_PI));
	} else {
		tmp = atan(((C - (A + hypot((A - C), B))) / B)) * (180.0 / ((double) M_PI));
	}
	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 (A <= -1.3e+47) {
		tmp = Math.atan((0.5 * (B * ((C / (A * A)) + (1.0 / A))))) * (180.0 / Math.PI);
	} else {
		tmp = Math.atan(((C - (A + Math.hypot((A - C), B))) / B)) * (180.0 / Math.PI);
	}
	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 A <= -1.3e+47:
		tmp = math.atan((0.5 * (B * ((C / (A * A)) + (1.0 / A))))) * (180.0 / math.pi)
	else:
		tmp = math.atan(((C - (A + math.hypot((A - C), B))) / B)) * (180.0 / math.pi)
	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 (A <= -1.3e+47)
		tmp = Float64(atan(Float64(0.5 * Float64(B * Float64(Float64(C / Float64(A * A)) + Float64(1.0 / A))))) * Float64(180.0 / pi));
	else
		tmp = Float64(atan(Float64(Float64(C - Float64(A + hypot(Float64(A - C), B))) / B)) * Float64(180.0 / pi));
	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 (A <= -1.3e+47)
		tmp = atan((0.5 * (B * ((C / (A * A)) + (1.0 / A))))) * (180.0 / pi);
	else
		tmp = atan(((C - (A + hypot((A - C), B))) / B)) * (180.0 / pi);
	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[A, -1.3e+47], N[(N[ArcTan[N[(0.5 * N[(B * N[(N[(C / N[(A * A), $MachinePrecision]), $MachinePrecision] + N[(1.0 / A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(180.0 / Pi), $MachinePrecision]), $MachinePrecision], N[(N[ArcTan[N[(N[(C - N[(A + N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision]], $MachinePrecision] * N[(180.0 / Pi), $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}\;A \leq -1.3 \cdot 10^{+47}:\\
\;\;\;\;\tan^{-1} \left(0.5 \cdot \left(B \cdot \left(\frac{C}{A \cdot A} + \frac{1}{A}\right)\right)\right) \cdot \frac{180}{\pi}\\

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


\end{array}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if A < -1.30000000000000002e47

    1. Initial program 50.4

      \[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. Simplified42.8

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

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

      \[\leadsto \tan^{-1} \left(\frac{\color{blue}{0.5 \cdot \left(\left(B \cdot B\right) \cdot \left(C \cdot {\left(\frac{-1}{A}\right)}^{2}\right) + \frac{B \cdot B}{A}\right)}}{B}\right) \cdot \frac{180}{\pi} \]
      Proof
    5. Taylor expanded in B around 0 18.3

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

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

    if -1.30000000000000002e47 < A

    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. Simplified10.4

      \[\leadsto \color{blue}{\tan^{-1} \left(\frac{C - \left(A + \mathsf{hypot}\left(A - C, B\right)\right)}{B}\right) \cdot \frac{180}{\pi}} \]
      Proof
  3. Recombined 2 regimes into one program.

Alternatives

Alternative 1
Error31.1
Cost14368
\[\begin{array}{l} t_0 := \tan^{-1} \left(1 + \frac{C}{B}\right) \cdot \frac{180}{\pi}\\ t_1 := \tan^{-1} \left(\frac{B \cdot 0.5}{A}\right) \cdot \frac{180}{\pi}\\ t_2 := \tan^{-1} \left(\frac{-0.5 \cdot B}{C}\right) \cdot \frac{180}{\pi}\\ \mathbf{if}\;A \leq -3.9 \cdot 10^{+44}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;A \leq -1.4 \cdot 10^{+16}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;A \leq -1.2 \cdot 10^{-75}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;A \leq -2.4 \cdot 10^{-206}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;A \leq 3.6 \cdot 10^{-303}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;A \leq 7.6 \cdot 10^{-126}:\\ \;\;\;\;\tan^{-1} -1 \cdot \frac{180}{\pi}\\ \mathbf{elif}\;A \leq 1.15 \cdot 10^{-53}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;A \leq 3 \cdot 10^{+27}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\tan^{-1} \left(\frac{-2 \cdot A}{B}\right) \cdot \frac{180}{\pi}\\ \end{array} \]
Alternative 2
Error29.9
Cost14368
\[\begin{array}{l} t_0 := \tan^{-1} \left(1 + \frac{C}{B}\right) \cdot \frac{180}{\pi}\\ t_1 := \tan^{-1} \left(\frac{B \cdot 0.5}{A}\right) \cdot \frac{180}{\pi}\\ t_2 := \tan^{-1} -1 \cdot \frac{180}{\pi}\\ t_3 := \tan^{-1} \left(\frac{-0.5 \cdot B}{C}\right) \cdot \frac{180}{\pi}\\ \mathbf{if}\;A \leq -1.02 \cdot 10^{+43}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;A \leq -5 \cdot 10^{+15}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;A \leq -3.5 \cdot 10^{-73}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;A \leq -1.25 \cdot 10^{-206}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;A \leq 5.2 \cdot 10^{-303}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;A \leq 9.5 \cdot 10^{-136}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;A \leq 1.3 \cdot 10^{-53}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;A \leq 9.8 \cdot 10^{-34}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;\tan^{-1} \left(\frac{B - A}{B}\right) \cdot \frac{180}{\pi}\\ \end{array} \]
Alternative 3
Error26.4
Cost14232
\[\begin{array}{l} t_0 := \tan^{-1} \left(\frac{C - B}{B}\right) \cdot \frac{180}{\pi}\\ t_1 := 180 \cdot \frac{\tan^{-1} \left(1 + \frac{C - A}{B}\right)}{\pi}\\ t_2 := \tan^{-1} \left(\frac{B \cdot 0.5}{A}\right) \cdot \frac{180}{\pi}\\ \mathbf{if}\;A \leq -3.15 \cdot 10^{+43}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;A \leq -1.2 \cdot 10^{+15}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;A \leq -2 \cdot 10^{-84}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;A \leq 1.9 \cdot 10^{-122}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;A \leq 1.15 \cdot 10^{-53}:\\ \;\;\;\;\tan^{-1} \left(\frac{-0.5 \cdot B}{C}\right) \cdot \frac{180}{\pi}\\ \mathbf{elif}\;A \leq 1.85 \cdot 10^{-32}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 4
Error26.4
Cost14232
\[\begin{array}{l} t_0 := \tan^{-1} \left(\frac{C - B}{B}\right) \cdot \frac{180}{\pi}\\ t_1 := \tan^{-1} \left(1 + \frac{C - A}{B}\right)\\ t_2 := \tan^{-1} \left(\frac{B \cdot 0.5}{A}\right) \cdot \frac{180}{\pi}\\ \mathbf{if}\;A \leq -5.4 \cdot 10^{+43}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;A \leq -4.35 \cdot 10^{+15}:\\ \;\;\;\;180 \cdot \frac{t_1}{\pi}\\ \mathbf{elif}\;A \leq -1.85 \cdot 10^{-84}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;A \leq 1.1 \cdot 10^{-122}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;A \leq 1.4 \cdot 10^{-53}:\\ \;\;\;\;\tan^{-1} \left(\frac{-0.5 \cdot B}{C}\right) \cdot \frac{180}{\pi}\\ \mathbf{elif}\;A \leq 1.38 \cdot 10^{-30}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1 \cdot \frac{180}{\pi}\\ \end{array} \]
Alternative 5
Error26.9
Cost14104
\[\begin{array}{l} t_0 := \tan^{-1} \left(\frac{B \cdot 0.5}{A}\right) \cdot \frac{180}{\pi}\\ t_1 := \tan^{-1} \left(\frac{C - B}{B}\right) \cdot \frac{180}{\pi}\\ \mathbf{if}\;A \leq -4.8 \cdot 10^{+43}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;A \leq -9 \cdot 10^{+15}:\\ \;\;\;\;\tan^{-1} \left(1 + \frac{C}{B}\right) \cdot \frac{180}{\pi}\\ \mathbf{elif}\;A \leq -8.2 \cdot 10^{-85}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;A \leq 1.5 \cdot 10^{-129}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;A \leq 1.25 \cdot 10^{-53}:\\ \;\;\;\;\tan^{-1} \left(\frac{-0.5 \cdot B}{C}\right) \cdot \frac{180}{\pi}\\ \mathbf{elif}\;A \leq 8.3 \cdot 10^{-22}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\tan^{-1} \left(\frac{B - A}{B}\right) \cdot \frac{180}{\pi}\\ \end{array} \]
Alternative 6
Error23.1
Cost14088
\[\begin{array}{l} \mathbf{if}\;B \leq -5 \cdot 10^{-30}:\\ \;\;\;\;\tan^{-1} \left(1 + \frac{C - A}{B}\right) \cdot \frac{180}{\pi}\\ \mathbf{elif}\;B \leq -9.5 \cdot 10^{-270}:\\ \;\;\;\;\tan^{-1} \left(0.5 \cdot \left(B \cdot \left(\frac{C}{A \cdot A} + \frac{1}{A}\right)\right)\right) \cdot \frac{180}{\pi}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\tan^{-1} \left(\frac{\left(C + \left(-B\right)\right) - A}{B}\right)}{\pi}}{0.005555555555555556}\\ \end{array} \]
Alternative 7
Error24.5
Cost13768
\[\begin{array}{l} \mathbf{if}\;B \leq -5.1 \cdot 10^{-30}:\\ \;\;\;\;\tan^{-1} \left(1 + \frac{C - A}{B}\right) \cdot \frac{180}{\pi}\\ \mathbf{elif}\;B \leq -9 \cdot 10^{-269}:\\ \;\;\;\;\tan^{-1} \left(\frac{B \cdot 0.5}{A}\right) \cdot \frac{180}{\pi}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\tan^{-1} \left(\frac{\left(C + \left(-B\right)\right) - A}{B}\right)}{\pi}}{0.005555555555555556}\\ \end{array} \]
Alternative 8
Error30.2
Cost13576
\[\begin{array}{l} \mathbf{if}\;C \leq -3.25 \cdot 10^{-248}:\\ \;\;\;\;\tan^{-1} \left(1 + \frac{C}{B}\right) \cdot \frac{180}{\pi}\\ \mathbf{elif}\;C \leq 8.5 \cdot 10^{-122}:\\ \;\;\;\;\tan^{-1} -1 \cdot \frac{180}{\pi}\\ \mathbf{else}:\\ \;\;\;\;\tan^{-1} \left(\frac{-0.5 \cdot B}{C}\right) \cdot \frac{180}{\pi}\\ \end{array} \]
Alternative 9
Error34.6
Cost13448
\[\begin{array}{l} \mathbf{if}\;B \leq -3.8 \cdot 10^{-89}:\\ \;\;\;\;\tan^{-1} 1 \cdot \frac{180}{\pi}\\ \mathbf{elif}\;B \leq 2.7 \cdot 10^{-156}:\\ \;\;\;\;\tan^{-1} \left(\frac{C}{B}\right) \cdot \frac{180}{\pi}\\ \mathbf{else}:\\ \;\;\;\;\tan^{-1} -1 \cdot \frac{180}{\pi}\\ \end{array} \]
Alternative 10
Error31.7
Cost13444
\[\begin{array}{l} \mathbf{if}\;B \leq 9.5 \cdot 10^{-158}:\\ \;\;\;\;\tan^{-1} \left(1 + \frac{C}{B}\right) \cdot \frac{180}{\pi}\\ \mathbf{else}:\\ \;\;\;\;\tan^{-1} -1 \cdot \frac{180}{\pi}\\ \end{array} \]
Alternative 11
Error38.5
Cost13188
\[\begin{array}{l} \mathbf{if}\;B \leq -1 \cdot 10^{-310}:\\ \;\;\;\;\tan^{-1} 1 \cdot \frac{180}{\pi}\\ \mathbf{else}:\\ \;\;\;\;\tan^{-1} -1 \cdot \frac{180}{\pi}\\ \end{array} \]
Alternative 12
Error51.0
Cost13056
\[\tan^{-1} -1 \cdot \frac{180}{\pi} \]

Error

Reproduce

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