Average Error: 29.4 → 7.8
Time: 20.9s
Precision: binary64
Cost: 60488
\[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 := 180 \cdot \frac{\tan^{-1} \left(\frac{\left(C - A\right) - \mathsf{hypot}\left(B, C - A\right)}{B}\right)}{\pi}\\ t_1 := \frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\\ \mathbf{if}\;t_1 \leq -0.5:\\ \;\;\;\;t_0\\ \mathbf{elif}\;t_1 \leq 0:\\ \;\;\;\;\tan^{-1} \left(-0.5 \cdot \frac{B}{C - A}\right) \cdot \frac{180}{\pi}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \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 (* 180.0 (/ (atan (/ (- (- C A) (hypot B (- C A))) B)) PI)))
        (t_1
         (* (/ 1.0 B) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))))
   (if (<= t_1 -0.5)
     t_0
     (if (<= t_1 0.0) (* (atan (* -0.5 (/ B (- C A)))) (/ 180.0 PI)) t_0))))
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 = 180.0 * (atan((((C - A) - hypot(B, (C - A))) / B)) / ((double) M_PI));
	double t_1 = (1.0 / B) * ((C - A) - sqrt((pow((A - C), 2.0) + pow(B, 2.0))));
	double tmp;
	if (t_1 <= -0.5) {
		tmp = t_0;
	} else if (t_1 <= 0.0) {
		tmp = atan((-0.5 * (B / (C - A)))) * (180.0 / ((double) M_PI));
	} else {
		tmp = t_0;
	}
	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 t_0 = 180.0 * (Math.atan((((C - A) - Math.hypot(B, (C - A))) / B)) / Math.PI);
	double t_1 = (1.0 / B) * ((C - A) - Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B, 2.0))));
	double tmp;
	if (t_1 <= -0.5) {
		tmp = t_0;
	} else if (t_1 <= 0.0) {
		tmp = Math.atan((-0.5 * (B / (C - A)))) * (180.0 / Math.PI);
	} else {
		tmp = t_0;
	}
	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):
	t_0 = 180.0 * (math.atan((((C - A) - math.hypot(B, (C - A))) / B)) / math.pi)
	t_1 = (1.0 / B) * ((C - A) - math.sqrt((math.pow((A - C), 2.0) + math.pow(B, 2.0))))
	tmp = 0
	if t_1 <= -0.5:
		tmp = t_0
	elif t_1 <= 0.0:
		tmp = math.atan((-0.5 * (B / (C - A)))) * (180.0 / math.pi)
	else:
		tmp = t_0
	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)
	t_0 = Float64(180.0 * Float64(atan(Float64(Float64(Float64(C - A) - hypot(B, Float64(C - A))) / B)) / pi))
	t_1 = Float64(Float64(1.0 / B) * Float64(Float64(C - A) - sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0)))))
	tmp = 0.0
	if (t_1 <= -0.5)
		tmp = t_0;
	elseif (t_1 <= 0.0)
		tmp = Float64(atan(Float64(-0.5 * Float64(B / Float64(C - A)))) * Float64(180.0 / pi));
	else
		tmp = t_0;
	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)
	t_0 = 180.0 * (atan((((C - A) - hypot(B, (C - A))) / B)) / pi);
	t_1 = (1.0 / B) * ((C - A) - sqrt((((A - C) ^ 2.0) + (B ^ 2.0))));
	tmp = 0.0;
	if (t_1 <= -0.5)
		tmp = t_0;
	elseif (t_1 <= 0.0)
		tmp = atan((-0.5 * (B / (C - A)))) * (180.0 / pi);
	else
		tmp = t_0;
	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_] := Block[{t$95$0 = N[(180.0 * N[(N[ArcTan[N[(N[(N[(C - A), $MachinePrecision] - N[Sqrt[B ^ 2 + N[(C - A), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = 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]}, If[LessEqual[t$95$1, -0.5], t$95$0, If[LessEqual[t$95$1, 0.0], N[(N[ArcTan[N[(-0.5 * N[(B / N[(C - A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(180.0 / Pi), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
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 := 180 \cdot \frac{\tan^{-1} \left(\frac{\left(C - A\right) - \mathsf{hypot}\left(B, C - A\right)}{B}\right)}{\pi}\\
t_1 := \frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\\
\mathbf{if}\;t_1 \leq -0.5:\\
\;\;\;\;t_0\\

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

\mathbf{else}:\\
\;\;\;\;t_0\\


\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 (*.f64 (/.f64 1 B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))) < -0.5 or -0.0 < (*.f64 (/.f64 1 B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2)))))

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

      \[\leadsto \color{blue}{180 \cdot \frac{\tan^{-1} \left(\frac{\left(C - A\right) - \mathsf{hypot}\left(B, C - A\right)}{B}\right)}{\pi}} \]
      Proof
      (*.f64 180 (/.f64 (atan.f64 (/.f64 (-.f64 (-.f64 C A) (hypot.f64 B (-.f64 C A))) B)) (PI.f64))): 0 points increase in error, 0 points decrease in error
      (*.f64 180 (/.f64 (atan.f64 (/.f64 (-.f64 (-.f64 C A) (Rewrite<= hypot-def_binary64 (sqrt.f64 (+.f64 (*.f64 B B) (*.f64 (-.f64 C A) (-.f64 C A)))))) B)) (PI.f64))): 76 points increase in error, 17 points decrease in error
      (*.f64 180 (/.f64 (atan.f64 (/.f64 (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (Rewrite<= unpow2_binary64 (pow.f64 B 2)) (*.f64 (-.f64 C A) (-.f64 C A))))) B)) (PI.f64))): 0 points increase in error, 0 points decrease in error
      (*.f64 180 (/.f64 (atan.f64 (/.f64 (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 B 2) (Rewrite<= sqr-neg_binary64 (*.f64 (neg.f64 (-.f64 C A)) (neg.f64 (-.f64 C A))))))) B)) (PI.f64))): 0 points increase in error, 0 points decrease in error
      (*.f64 180 (/.f64 (atan.f64 (/.f64 (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 B 2) (*.f64 (Rewrite<= sub0-neg_binary64 (-.f64 0 (-.f64 C A))) (neg.f64 (-.f64 C A)))))) B)) (PI.f64))): 0 points increase in error, 0 points decrease in error
      (*.f64 180 (/.f64 (atan.f64 (/.f64 (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 B 2) (*.f64 (Rewrite<= associate-+l-_binary64 (+.f64 (-.f64 0 C) A)) (neg.f64 (-.f64 C A)))))) B)) (PI.f64))): 0 points increase in error, 0 points decrease in error
      (*.f64 180 (/.f64 (atan.f64 (/.f64 (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 B 2) (*.f64 (+.f64 (Rewrite<= neg-sub0_binary64 (neg.f64 C)) A) (neg.f64 (-.f64 C A)))))) B)) (PI.f64))): 0 points increase in error, 0 points decrease in error
      (*.f64 180 (/.f64 (atan.f64 (/.f64 (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 B 2) (*.f64 (Rewrite<= +-commutative_binary64 (+.f64 A (neg.f64 C))) (neg.f64 (-.f64 C A)))))) B)) (PI.f64))): 0 points increase in error, 0 points decrease in error
      (*.f64 180 (/.f64 (atan.f64 (/.f64 (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 B 2) (*.f64 (Rewrite<= sub-neg_binary64 (-.f64 A C)) (neg.f64 (-.f64 C A)))))) B)) (PI.f64))): 0 points increase in error, 0 points decrease in error
      (*.f64 180 (/.f64 (atan.f64 (/.f64 (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 B 2) (*.f64 (-.f64 A C) (Rewrite<= sub0-neg_binary64 (-.f64 0 (-.f64 C A))))))) B)) (PI.f64))): 0 points increase in error, 0 points decrease in error
      (*.f64 180 (/.f64 (atan.f64 (/.f64 (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 B 2) (*.f64 (-.f64 A C) (Rewrite<= associate-+l-_binary64 (+.f64 (-.f64 0 C) A)))))) B)) (PI.f64))): 0 points increase in error, 0 points decrease in error
      (*.f64 180 (/.f64 (atan.f64 (/.f64 (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 B 2) (*.f64 (-.f64 A C) (+.f64 (Rewrite<= neg-sub0_binary64 (neg.f64 C)) A))))) B)) (PI.f64))): 0 points increase in error, 0 points decrease in error
      (*.f64 180 (/.f64 (atan.f64 (/.f64 (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 B 2) (*.f64 (-.f64 A C) (Rewrite<= +-commutative_binary64 (+.f64 A (neg.f64 C))))))) B)) (PI.f64))): 0 points increase in error, 0 points decrease in error
      (*.f64 180 (/.f64 (atan.f64 (/.f64 (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 B 2) (*.f64 (-.f64 A C) (Rewrite<= sub-neg_binary64 (-.f64 A C)))))) B)) (PI.f64))): 0 points increase in error, 0 points decrease in error
      (*.f64 180 (/.f64 (atan.f64 (/.f64 (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 B 2) (Rewrite<= unpow2_binary64 (pow.f64 (-.f64 A C) 2))))) B)) (PI.f64))): 0 points increase in error, 0 points decrease in error
      (*.f64 180 (/.f64 (atan.f64 (/.f64 (-.f64 (-.f64 C A) (sqrt.f64 (Rewrite<= +-commutative_binary64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))) B)) (PI.f64))): 0 points increase in error, 0 points decrease in error
      (*.f64 180 (/.f64 (atan.f64 (/.f64 (Rewrite<= *-lft-identity_binary64 (*.f64 1 (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2)))))) B)) (PI.f64))): 0 points increase in error, 0 points decrease in error
      (*.f64 180 (/.f64 (atan.f64 (Rewrite<= associate-*l/_binary64 (*.f64 (/.f64 1 B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (PI.f64))): 0 points increase in error, 0 points decrease in error

    if -0.5 < (*.f64 (/.f64 1 B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))) < -0.0

    1. Initial program 51.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. Simplified50.8

      \[\leadsto \color{blue}{180 \cdot \frac{\tan^{-1} \left(\frac{\left(C - A\right) - \mathsf{hypot}\left(B, C - A\right)}{B}\right)}{\pi}} \]
      Proof
      (*.f64 180 (/.f64 (atan.f64 (/.f64 (-.f64 (-.f64 C A) (hypot.f64 B (-.f64 C A))) B)) (PI.f64))): 0 points increase in error, 0 points decrease in error
      (*.f64 180 (/.f64 (atan.f64 (/.f64 (-.f64 (-.f64 C A) (Rewrite<= hypot-def_binary64 (sqrt.f64 (+.f64 (*.f64 B B) (*.f64 (-.f64 C A) (-.f64 C A)))))) B)) (PI.f64))): 76 points increase in error, 17 points decrease in error
      (*.f64 180 (/.f64 (atan.f64 (/.f64 (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (Rewrite<= unpow2_binary64 (pow.f64 B 2)) (*.f64 (-.f64 C A) (-.f64 C A))))) B)) (PI.f64))): 0 points increase in error, 0 points decrease in error
      (*.f64 180 (/.f64 (atan.f64 (/.f64 (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 B 2) (Rewrite<= sqr-neg_binary64 (*.f64 (neg.f64 (-.f64 C A)) (neg.f64 (-.f64 C A))))))) B)) (PI.f64))): 0 points increase in error, 0 points decrease in error
      (*.f64 180 (/.f64 (atan.f64 (/.f64 (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 B 2) (*.f64 (Rewrite<= sub0-neg_binary64 (-.f64 0 (-.f64 C A))) (neg.f64 (-.f64 C A)))))) B)) (PI.f64))): 0 points increase in error, 0 points decrease in error
      (*.f64 180 (/.f64 (atan.f64 (/.f64 (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 B 2) (*.f64 (Rewrite<= associate-+l-_binary64 (+.f64 (-.f64 0 C) A)) (neg.f64 (-.f64 C A)))))) B)) (PI.f64))): 0 points increase in error, 0 points decrease in error
      (*.f64 180 (/.f64 (atan.f64 (/.f64 (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 B 2) (*.f64 (+.f64 (Rewrite<= neg-sub0_binary64 (neg.f64 C)) A) (neg.f64 (-.f64 C A)))))) B)) (PI.f64))): 0 points increase in error, 0 points decrease in error
      (*.f64 180 (/.f64 (atan.f64 (/.f64 (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 B 2) (*.f64 (Rewrite<= +-commutative_binary64 (+.f64 A (neg.f64 C))) (neg.f64 (-.f64 C A)))))) B)) (PI.f64))): 0 points increase in error, 0 points decrease in error
      (*.f64 180 (/.f64 (atan.f64 (/.f64 (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 B 2) (*.f64 (Rewrite<= sub-neg_binary64 (-.f64 A C)) (neg.f64 (-.f64 C A)))))) B)) (PI.f64))): 0 points increase in error, 0 points decrease in error
      (*.f64 180 (/.f64 (atan.f64 (/.f64 (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 B 2) (*.f64 (-.f64 A C) (Rewrite<= sub0-neg_binary64 (-.f64 0 (-.f64 C A))))))) B)) (PI.f64))): 0 points increase in error, 0 points decrease in error
      (*.f64 180 (/.f64 (atan.f64 (/.f64 (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 B 2) (*.f64 (-.f64 A C) (Rewrite<= associate-+l-_binary64 (+.f64 (-.f64 0 C) A)))))) B)) (PI.f64))): 0 points increase in error, 0 points decrease in error
      (*.f64 180 (/.f64 (atan.f64 (/.f64 (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 B 2) (*.f64 (-.f64 A C) (+.f64 (Rewrite<= neg-sub0_binary64 (neg.f64 C)) A))))) B)) (PI.f64))): 0 points increase in error, 0 points decrease in error
      (*.f64 180 (/.f64 (atan.f64 (/.f64 (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 B 2) (*.f64 (-.f64 A C) (Rewrite<= +-commutative_binary64 (+.f64 A (neg.f64 C))))))) B)) (PI.f64))): 0 points increase in error, 0 points decrease in error
      (*.f64 180 (/.f64 (atan.f64 (/.f64 (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 B 2) (*.f64 (-.f64 A C) (Rewrite<= sub-neg_binary64 (-.f64 A C)))))) B)) (PI.f64))): 0 points increase in error, 0 points decrease in error
      (*.f64 180 (/.f64 (atan.f64 (/.f64 (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 B 2) (Rewrite<= unpow2_binary64 (pow.f64 (-.f64 A C) 2))))) B)) (PI.f64))): 0 points increase in error, 0 points decrease in error
      (*.f64 180 (/.f64 (atan.f64 (/.f64 (-.f64 (-.f64 C A) (sqrt.f64 (Rewrite<= +-commutative_binary64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))) B)) (PI.f64))): 0 points increase in error, 0 points decrease in error
      (*.f64 180 (/.f64 (atan.f64 (/.f64 (Rewrite<= *-lft-identity_binary64 (*.f64 1 (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2)))))) B)) (PI.f64))): 0 points increase in error, 0 points decrease in error
      (*.f64 180 (/.f64 (atan.f64 (Rewrite<= associate-*l/_binary64 (*.f64 (/.f64 1 B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (PI.f64))): 0 points increase in error, 0 points decrease in error
    3. Applied egg-rr55.3

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

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

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

      \[\leadsto \color{blue}{\tan^{-1} \left(-0.5 \cdot \frac{B}{C - A}\right) \cdot \frac{180}{\pi}} \]
      Proof
      (*.f64 (atan.f64 (*.f64 -1/2 (/.f64 B (-.f64 C A)))) (/.f64 180 (PI.f64))): 0 points increase in error, 0 points decrease in error
      (*.f64 (atan.f64 (Rewrite=> associate-*r/_binary64 (/.f64 (*.f64 -1/2 B) (-.f64 C A)))) (/.f64 180 (PI.f64))): 0 points increase in error, 1 points decrease in error
      (*.f64 (atan.f64 (Rewrite=> associate-/l*_binary64 (/.f64 -1/2 (/.f64 (-.f64 C A) B)))) (/.f64 180 (PI.f64))): 15 points increase in error, 11 points decrease in error
      (Rewrite=> associate-*r/_binary64 (/.f64 (*.f64 (atan.f64 (/.f64 -1/2 (/.f64 (-.f64 C A) B))) 180) (PI.f64))): 18 points increase in error, 11 points decrease in error
      (Rewrite<= associate-*l/_binary64 (*.f64 (/.f64 (atan.f64 (/.f64 -1/2 (/.f64 (-.f64 C A) B))) (PI.f64)) 180)): 24 points increase in error, 18 points decrease in error
      (Rewrite<= *-commutative_binary64 (*.f64 180 (/.f64 (atan.f64 (/.f64 -1/2 (/.f64 (-.f64 C A) B))) (PI.f64)))): 0 points increase in error, 0 points decrease in error
      (*.f64 180 (/.f64 (atan.f64 (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 -1/2 B) (-.f64 C A)))) (PI.f64))): 12 points increase in error, 15 points decrease in error
      (*.f64 180 (/.f64 (atan.f64 (Rewrite<= associate-*r/_binary64 (*.f64 -1/2 (/.f64 B (-.f64 C A))))) (PI.f64))): 0 points increase in error, 0 points decrease in error
  3. Recombined 2 regimes into one program.
  4. Final simplification7.8

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

Alternatives

Alternative 1
Error15.9
Cost20304
\[\begin{array}{l} t_0 := 180 \cdot \frac{\tan^{-1} \left(\frac{C - \mathsf{hypot}\left(B, C\right)}{B}\right)}{\pi}\\ \mathbf{if}\;A \leq -1.3 \cdot 10^{+133}:\\ \;\;\;\;\tan^{-1} \left(-0.5 \cdot \frac{B}{C - A}\right) \cdot \frac{180}{\pi}\\ \mathbf{elif}\;A \leq 8.5 \cdot 10^{-73}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;A \leq 1.36 \cdot 10^{+75}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{\left(B + C\right) - A}{B}\right)}{\pi}\\ \mathbf{elif}\;A \leq 9.2 \cdot 10^{+106}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{\left(C - B\right) - A}{B}\right)}{\pi}\\ \end{array} \]
Alternative 2
Error29.7
Cost14500
\[\begin{array}{l} t_0 := 180 \cdot \frac{\tan^{-1} \left(\frac{C - B}{B}\right)}{\pi}\\ t_1 := 180 \cdot \frac{\tan^{-1} 1}{\pi}\\ \mathbf{if}\;A \leq -3 \cdot 10^{+83}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(0.5 \cdot \frac{B}{A}\right)}{\pi}\\ \mathbf{elif}\;A \leq -5.5 \cdot 10^{-209}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;A \leq -9.8 \cdot 10^{-301}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;A \leq 2.55 \cdot 10^{-235}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;A \leq 2.2 \cdot 10^{-180}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;A \leq 6.4 \cdot 10^{-87}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;A \leq 1.24 \cdot 10^{-51}:\\ \;\;\;\;\frac{180}{\frac{\pi}{\tan^{-1} \left(-0.5 \cdot \frac{B}{C}\right)}}\\ \mathbf{elif}\;A \leq 6.6 \cdot 10^{+18}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;A \leq 3.8 \cdot 10^{+22}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{0}{B}\right)}{\pi}\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(-1 - \frac{A}{B}\right)}{\pi}\\ \end{array} \]
Alternative 3
Error24.5
Cost14496
\[\begin{array}{l} t_0 := 180 \cdot \frac{\tan^{-1} \left(-0.5 \cdot \frac{B}{C - A}\right)}{\pi}\\ t_1 := 180 \cdot \frac{\tan^{-1} \left(\frac{\left(B + C\right) - A}{B}\right)}{\pi}\\ \mathbf{if}\;B \leq -1.95 \cdot 10^{-22}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;B \leq -3.7 \cdot 10^{-96}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;B \leq -2.5 \cdot 10^{-248}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;B \leq 1.72 \cdot 10^{-267}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;B \leq 7.4 \cdot 10^{-219}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;B \leq 2.05 \cdot 10^{-161}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;B \leq 6.5 \cdot 10^{-102}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;B \leq 8 \cdot 10^{-42}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C - B}{B}\right)}{\pi}\\ \end{array} \]
Alternative 4
Error22.8
Cost14496
\[\begin{array}{l} t_0 := 180 \cdot \frac{\tan^{-1} \left(-0.5 \cdot \frac{B}{C - A}\right)}{\pi}\\ t_1 := 180 \cdot \frac{\tan^{-1} \left(\frac{\left(B + C\right) - A}{B}\right)}{\pi}\\ \mathbf{if}\;B \leq -8.4 \cdot 10^{-28}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;B \leq -6.6 \cdot 10^{-101}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;B \leq -3.5 \cdot 10^{-250}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;B \leq 2.5 \cdot 10^{-270}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;B \leq 6.5 \cdot 10^{-214}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;B \leq 3 \cdot 10^{-161}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;B \leq 7.5 \cdot 10^{-101}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;B \leq 5.5 \cdot 10^{-49}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{\left(C - B\right) - A}{B}\right)}{\pi}\\ \end{array} \]
Alternative 5
Error22.8
Cost14496
\[\begin{array}{l} t_0 := \tan^{-1} \left(-0.5 \cdot \frac{B}{C - A}\right)\\ t_1 := t_0 \cdot \frac{180}{\pi}\\ t_2 := 180 \cdot \frac{t_0}{\pi}\\ t_3 := 180 \cdot \frac{\tan^{-1} \left(\frac{\left(B + C\right) - A}{B}\right)}{\pi}\\ \mathbf{if}\;B \leq -3.4 \cdot 10^{-26}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;B \leq -1.8 \cdot 10^{-97}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;B \leq -6 \cdot 10^{-249}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;B \leq 5.2 \cdot 10^{-274}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;B \leq 1.6 \cdot 10^{-213}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;B \leq 5 \cdot 10^{-160}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;B \leq 5.6 \cdot 10^{-102}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;B \leq 2.1 \cdot 10^{-44}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{\left(C - B\right) - A}{B}\right)}{\pi}\\ \end{array} \]
Alternative 6
Error22.9
Cost14496
\[\begin{array}{l} t_0 := \tan^{-1} \left(-0.5 \cdot \frac{B}{C - A}\right)\\ t_1 := t_0 \cdot \frac{180}{\pi}\\ t_2 := 180 \cdot \frac{t_0}{\pi}\\ t_3 := 180 \cdot \frac{\tan^{-1} \left(\frac{\left(B + C\right) - A}{B}\right)}{\pi}\\ \mathbf{if}\;B \leq -2.2 \cdot 10^{-22}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;B \leq -1.4 \cdot 10^{-96}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;B \leq -3.5 \cdot 10^{-250}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;B \leq 8.8 \cdot 10^{-281}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;B \leq 1.3 \cdot 10^{-213}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C + \left(-0.5 \cdot \frac{C}{\frac{B}{C}} - B\right)}{B}\right)}{\pi}\\ \mathbf{elif}\;B \leq 6.8 \cdot 10^{-161}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;B \leq 1.5 \cdot 10^{-97}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;B \leq 1.9 \cdot 10^{-44}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{\left(C - B\right) - A}{B}\right)}{\pi}\\ \end{array} \]
Alternative 7
Error29.2
Cost14236
\[\begin{array}{l} t_0 := 180 \cdot \frac{\tan^{-1} \left(\frac{C - B}{B}\right)}{\pi}\\ t_1 := 180 \cdot \frac{\tan^{-1} 1}{\pi}\\ \mathbf{if}\;A \leq -2.9 \cdot 10^{+83}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(0.5 \cdot \frac{B}{A}\right)}{\pi}\\ \mathbf{elif}\;A \leq -2.4 \cdot 10^{-210}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;A \leq -1.5 \cdot 10^{-300}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;A \leq 7.5 \cdot 10^{-235}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;A \leq 1.5 \cdot 10^{-180}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;A \leq 4 \cdot 10^{-51}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;A \leq 3.8 \cdot 10^{+22}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(-1 - \frac{A}{B}\right)}{\pi}\\ \end{array} \]
Alternative 8
Error30.6
Cost14236
\[\begin{array}{l} t_0 := \frac{180}{\frac{\pi}{\tan^{-1} \left(-0.5 \cdot \frac{B}{C}\right)}}\\ t_1 := \frac{180}{\frac{\pi}{\tan^{-1} \left(\frac{B + C}{B}\right)}}\\ t_2 := 180 \cdot \frac{\tan^{-1} \left(\frac{C - B}{B}\right)}{\pi}\\ \mathbf{if}\;B \leq -1.2 \cdot 10^{-12}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;B \leq -3.6 \cdot 10^{-96}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;B \leq -4.9 \cdot 10^{-225}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;B \leq 3.1 \cdot 10^{-224}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(-1 - \frac{A}{B}\right)}{\pi}\\ \mathbf{elif}\;B \leq 1.9 \cdot 10^{-158}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;B \leq 4.4 \cdot 10^{-94}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;B \leq 2.4 \cdot 10^{-45}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 9
Error26.6
Cost14236
\[\begin{array}{l} t_0 := \frac{180}{\frac{\pi}{\tan^{-1} \left(\frac{B + C}{B}\right)}}\\ t_1 := 180 \cdot \frac{\tan^{-1} \left(-0.5 \cdot \frac{B}{C - A}\right)}{\pi}\\ \mathbf{if}\;A \leq -1.15 \cdot 10^{+43}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;A \leq -1.06 \cdot 10^{-32}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;A \leq -2.3 \cdot 10^{-71}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;A \leq -3.85 \cdot 10^{-156}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C - B}{B}\right)}{\pi}\\ \mathbf{elif}\;A \leq 3.8 \cdot 10^{-170}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;A \leq 1.25 \cdot 10^{-57}:\\ \;\;\;\;\frac{180}{\frac{\pi}{\tan^{-1} \left(-0.5 \cdot \frac{B}{C}\right)}}\\ \mathbf{elif}\;A \leq 3.8 \cdot 10^{+22}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(-1 - \frac{A}{B}\right)}{\pi}\\ \end{array} \]
Alternative 10
Error31.6
Cost14104
\[\begin{array}{l} t_0 := 180 \cdot \frac{\tan^{-1} 1}{\pi}\\ t_1 := 180 \cdot \frac{\tan^{-1} \left(-1 - \frac{A}{B}\right)}{\pi}\\ \mathbf{if}\;A \leq -6.7 \cdot 10^{-50}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(0.5 \cdot \frac{B}{A}\right)}{\pi}\\ \mathbf{elif}\;A \leq -1.35 \cdot 10^{-304}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;A \leq 1.7 \cdot 10^{-209}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C}{B}\right)}{\pi}\\ \mathbf{elif}\;A \leq 1.45 \cdot 10^{-140}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;A \leq 4 \cdot 10^{-51}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;A \leq 6.2 \cdot 10^{+22}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 11
Error31.6
Cost14104
\[\begin{array}{l} t_0 := 180 \cdot \frac{\tan^{-1} 1}{\pi}\\ t_1 := 180 \cdot \frac{\tan^{-1} \left(-1 - \frac{A}{B}\right)}{\pi}\\ \mathbf{if}\;A \leq -5.9 \cdot 10^{-53}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(0.5 \cdot \frac{B}{A}\right)}{\pi}\\ \mathbf{elif}\;A \leq -1.05 \cdot 10^{-303}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;A \leq 2.4 \cdot 10^{-218}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C \cdot 2}{B}\right)}{\pi}\\ \mathbf{elif}\;A \leq 9 \cdot 10^{-136}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;A \leq 4 \cdot 10^{-51}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;A \leq 3.8 \cdot 10^{+22}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 12
Error33.7
Cost13776
\[\begin{array}{l} t_0 := 180 \cdot \frac{\tan^{-1} 1}{\pi}\\ \mathbf{if}\;A \leq -1.85 \cdot 10^{-55}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(0.5 \cdot \frac{B}{A}\right)}{\pi}\\ \mathbf{elif}\;A \leq -1.15 \cdot 10^{-305}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;A \leq 1.45 \cdot 10^{-213}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C}{B}\right)}{\pi}\\ \mathbf{elif}\;A \leq 4 \cdot 10^{+22}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{-A}{B}\right)}{\pi}\\ \end{array} \]
Alternative 13
Error34.8
Cost13712
\[\begin{array}{l} t_0 := 180 \cdot \frac{\tan^{-1} \left(\frac{C}{B}\right)}{\pi}\\ \mathbf{if}\;B \leq -1.04 \cdot 10^{-132}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\pi}\\ \mathbf{elif}\;B \leq -8.5 \cdot 10^{-249}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;B \leq 9.8 \cdot 10^{-246}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{0}{B}\right)}{\pi}\\ \mathbf{elif}\;B \leq 7 \cdot 10^{+46}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\pi}\\ \end{array} \]
Alternative 14
Error35.3
Cost13712
\[\begin{array}{l} t_0 := 180 \cdot \frac{\tan^{-1} \left(\frac{C}{B}\right)}{\pi}\\ \mathbf{if}\;B \leq -8.8 \cdot 10^{-133}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\pi}\\ \mathbf{elif}\;B \leq -2.5 \cdot 10^{-184}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;B \leq 2.8 \cdot 10^{-157}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{-A}{B}\right)}{\pi}\\ \mathbf{elif}\;B \leq 1.22 \cdot 10^{+51}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\pi}\\ \end{array} \]
Alternative 15
Error35.5
Cost13448
\[\begin{array}{l} \mathbf{if}\;B \leq -9 \cdot 10^{-159}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\pi}\\ \mathbf{elif}\;B \leq 4.1 \cdot 10^{-160}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{0}{B}\right)}{\pi}\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\pi}\\ \end{array} \]
Alternative 16
Error38.6
Cost13188
\[\begin{array}{l} \mathbf{if}\;B \leq -5 \cdot 10^{-310}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\pi}\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\pi}\\ \end{array} \]
Alternative 17
Error51.0
Cost13056
\[180 \cdot \frac{\tan^{-1} -1}{\pi} \]

Error

Reproduce

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