ABCF->ab-angle angle

Percentage Accurate: 53.6% → 88.6%
Time: 5.6s
Alternatives: 13
Speedup: 2.5×

Specification

?
\[\begin{array}{l} \\ 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} \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)))
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));
}
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);
}
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)
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 tmp = code(A, B, C)
	tmp = 180.0 * (atan(((1.0 / B) * ((C - A) - sqrt((((A - C) ^ 2.0) + (B ^ 2.0)))))) / pi);
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]
\begin{array}{l}

\\
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}
\end{array}

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 13 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 53.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ 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} \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)))
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));
}
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);
}
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)
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 tmp = code(A, B, C)
	tmp = 180.0 * (atan(((1.0 / B) * ((C - A) - sqrt((((A - C) ^ 2.0) + (B ^ 2.0)))))) / pi);
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]
\begin{array}{l}

\\
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}
\end{array}

Alternative 1: 88.6% accurate, 0.6× speedup?

\[\begin{array}{l} B\_m = \left|B\right| \\ B\_s = \mathsf{copysign}\left(1, B\right) \\ B\_s \cdot \begin{array}{l} \mathbf{if}\;180 \cdot \frac{\tan^{-1} \left(\frac{1}{B\_m} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B\_m}^{2}}\right)\right)}{\pi} \leq -5 \cdot 10^{-12}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{1}{B\_m} \cdot \left(\left(C - A\right) - \mathsf{hypot}\left(C - A, B\_m\right)\right)\right)}{\pi}\\ \mathbf{else}:\\ \;\;\;\;\left(180 \cdot \tan^{-1} \left(\frac{B\_m}{C - A} \cdot -0.5\right)\right) \cdot \frac{1}{\pi}\\ \end{array} \end{array} \]
B\_m = (fabs.f64 B)
B\_s = (copysign.f64 #s(literal 1 binary64) B)
(FPCore (B_s A B_m C)
 :precision binary64
 (*
  B_s
  (if (<=
       (*
        180.0
        (/
         (atan
          (*
           (/ 1.0 B_m)
           (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B_m 2.0))))))
         PI))
       -5e-12)
    (* 180.0 (/ (atan (* (/ 1.0 B_m) (- (- C A) (hypot (- C A) B_m)))) PI))
    (* (* 180.0 (atan (* (/ B_m (- C A)) -0.5))) (/ 1.0 PI)))))
B\_m = fabs(B);
B\_s = copysign(1.0, B);
double code(double B_s, double A, double B_m, double C) {
	double tmp;
	if ((180.0 * (atan(((1.0 / B_m) * ((C - A) - sqrt((pow((A - C), 2.0) + pow(B_m, 2.0)))))) / ((double) M_PI))) <= -5e-12) {
		tmp = 180.0 * (atan(((1.0 / B_m) * ((C - A) - hypot((C - A), B_m)))) / ((double) M_PI));
	} else {
		tmp = (180.0 * atan(((B_m / (C - A)) * -0.5))) * (1.0 / ((double) M_PI));
	}
	return B_s * tmp;
}
B\_m = Math.abs(B);
B\_s = Math.copySign(1.0, B);
public static double code(double B_s, double A, double B_m, double C) {
	double tmp;
	if ((180.0 * (Math.atan(((1.0 / B_m) * ((C - A) - Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B_m, 2.0)))))) / Math.PI)) <= -5e-12) {
		tmp = 180.0 * (Math.atan(((1.0 / B_m) * ((C - A) - Math.hypot((C - A), B_m)))) / Math.PI);
	} else {
		tmp = (180.0 * Math.atan(((B_m / (C - A)) * -0.5))) * (1.0 / Math.PI);
	}
	return B_s * tmp;
}
B\_m = math.fabs(B)
B\_s = math.copysign(1.0, B)
def code(B_s, A, B_m, C):
	tmp = 0
	if (180.0 * (math.atan(((1.0 / B_m) * ((C - A) - math.sqrt((math.pow((A - C), 2.0) + math.pow(B_m, 2.0)))))) / math.pi)) <= -5e-12:
		tmp = 180.0 * (math.atan(((1.0 / B_m) * ((C - A) - math.hypot((C - A), B_m)))) / math.pi)
	else:
		tmp = (180.0 * math.atan(((B_m / (C - A)) * -0.5))) * (1.0 / math.pi)
	return B_s * tmp
B\_m = abs(B)
B\_s = copysign(1.0, B)
function code(B_s, A, B_m, C)
	tmp = 0.0
	if (Float64(180.0 * Float64(atan(Float64(Float64(1.0 / B_m) * Float64(Float64(C - A) - sqrt(Float64((Float64(A - C) ^ 2.0) + (B_m ^ 2.0)))))) / pi)) <= -5e-12)
		tmp = Float64(180.0 * Float64(atan(Float64(Float64(1.0 / B_m) * Float64(Float64(C - A) - hypot(Float64(C - A), B_m)))) / pi));
	else
		tmp = Float64(Float64(180.0 * atan(Float64(Float64(B_m / Float64(C - A)) * -0.5))) * Float64(1.0 / pi));
	end
	return Float64(B_s * tmp)
end
B\_m = abs(B);
B\_s = sign(B) * abs(1.0);
function tmp_2 = code(B_s, A, B_m, C)
	tmp = 0.0;
	if ((180.0 * (atan(((1.0 / B_m) * ((C - A) - sqrt((((A - C) ^ 2.0) + (B_m ^ 2.0)))))) / pi)) <= -5e-12)
		tmp = 180.0 * (atan(((1.0 / B_m) * ((C - A) - hypot((C - A), B_m)))) / pi);
	else
		tmp = (180.0 * atan(((B_m / (C - A)) * -0.5))) * (1.0 / pi);
	end
	tmp_2 = B_s * tmp;
end
B\_m = N[Abs[B], $MachinePrecision]
B\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[B]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[B$95$s_, A_, B$95$m_, C_] := N[(B$95$s * If[LessEqual[N[(180.0 * N[(N[ArcTan[N[(N[(1.0 / B$95$m), $MachinePrecision] * N[(N[(C - A), $MachinePrecision] - N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], -5e-12], N[(180.0 * N[(N[ArcTan[N[(N[(1.0 / B$95$m), $MachinePrecision] * N[(N[(C - A), $MachinePrecision] - N[Sqrt[N[(C - A), $MachinePrecision] ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], N[(N[(180.0 * N[ArcTan[N[(N[(B$95$m / N[(C - A), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 / Pi), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
B\_m = \left|B\right|
\\
B\_s = \mathsf{copysign}\left(1, B\right)

\\
B\_s \cdot \begin{array}{l}
\mathbf{if}\;180 \cdot \frac{\tan^{-1} \left(\frac{1}{B\_m} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B\_m}^{2}}\right)\right)}{\pi} \leq -5 \cdot 10^{-12}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{1}{B\_m} \cdot \left(\left(C - A\right) - \mathsf{hypot}\left(C - A, B\_m\right)\right)\right)}{\pi}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 #s(literal 180 binary64) (/.f64 (atan.f64 (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64))))))) (PI.f64))) < -4.9999999999999997e-12

    1. Initial program 53.6%

      \[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. Step-by-step derivation
      1. lift-sqrt.f64N/A

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

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{\color{blue}{{\left(A - C\right)}^{2} + {B}^{2}}}\right)\right)}{\pi} \]
      3. lift--.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\color{blue}{\left(A - C\right)}}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      4. lift-pow.f64N/A

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

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\color{blue}{\left(A + \left(\mathsf{neg}\left(C\right)\right)\right)}}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      6. mul-1-negN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A + \color{blue}{-1 \cdot C}\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      7. lift-pow.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A + -1 \cdot C\right)}^{2} + \color{blue}{{B}^{2}}}\right)\right)}{\pi} \]
      8. mul-1-negN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A + \color{blue}{\left(\mathsf{neg}\left(C\right)\right)}\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      9. sub-flipN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\color{blue}{\left(A - C\right)}}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      10. sub-negate-revN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\color{blue}{\left(\mathsf{neg}\left(\left(C - A\right)\right)\right)}}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      11. sub-flipN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(\mathsf{neg}\left(\color{blue}{\left(C + \left(\mathsf{neg}\left(A\right)\right)\right)}\right)\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      12. mul-1-negN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(\mathsf{neg}\left(\left(C + \color{blue}{-1 \cdot A}\right)\right)\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      13. unpow-neg-2N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{\color{blue}{{\left(C + -1 \cdot A\right)}^{2}} + {B}^{2}}\right)\right)}{\pi} \]
      14. mul-1-negN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(C + \color{blue}{\left(\mathsf{neg}\left(A\right)\right)}\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      15. sub-flipN/A

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

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

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{\left(C - A\right) \cdot \left(C - A\right) + \color{blue}{B \cdot B}}\right)\right)}{\pi} \]
      18. lower-hypot.f64N/A

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

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

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

    if -4.9999999999999997e-12 < (*.f64 #s(literal 180 binary64) (/.f64 (atan.f64 (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64))))))) (PI.f64)))

    1. Initial program 53.6%

      \[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. Step-by-step derivation
      1. lift-sqrt.f64N/A

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

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{\color{blue}{{\left(A - C\right)}^{2} + {B}^{2}}}\right)\right)}{\pi} \]
      3. lift--.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\color{blue}{\left(A - C\right)}}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      4. lift-pow.f64N/A

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

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\color{blue}{\left(A + \left(\mathsf{neg}\left(C\right)\right)\right)}}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      6. mul-1-negN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A + \color{blue}{-1 \cdot C}\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      7. lift-pow.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A + -1 \cdot C\right)}^{2} + \color{blue}{{B}^{2}}}\right)\right)}{\pi} \]
      8. mul-1-negN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A + \color{blue}{\left(\mathsf{neg}\left(C\right)\right)}\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      9. sub-flipN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\color{blue}{\left(A - C\right)}}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      10. sub-negate-revN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\color{blue}{\left(\mathsf{neg}\left(\left(C - A\right)\right)\right)}}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      11. sub-flipN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(\mathsf{neg}\left(\color{blue}{\left(C + \left(\mathsf{neg}\left(A\right)\right)\right)}\right)\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      12. mul-1-negN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(\mathsf{neg}\left(\left(C + \color{blue}{-1 \cdot A}\right)\right)\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      13. unpow-neg-2N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{\color{blue}{{\left(C + -1 \cdot A\right)}^{2}} + {B}^{2}}\right)\right)}{\pi} \]
      14. mul-1-negN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(C + \color{blue}{\left(\mathsf{neg}\left(A\right)\right)}\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      15. sub-flipN/A

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

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

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{\left(C - A\right) \cdot \left(C - A\right) + \color{blue}{B \cdot B}}\right)\right)}{\pi} \]
      18. lower-hypot.f64N/A

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

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

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

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{-1}{2} \cdot \frac{B}{C - A}\right)}}{\pi} \]
    5. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-1}{2} \cdot \color{blue}{\frac{B}{C - A}}\right)}{\pi} \]
      2. lower-/.f64N/A

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

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

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(-0.5 \cdot \frac{B}{C - A}\right)}}{\pi} \]
    7. Step-by-step derivation
      1. lift-PI.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-1}{2} \cdot \frac{B}{C - A}\right)}{\color{blue}{\mathsf{PI}\left(\right)}} \]
      2. lift-/.f64N/A

        \[\leadsto 180 \cdot \color{blue}{\frac{\tan^{-1} \left(\frac{-1}{2} \cdot \frac{B}{C - A}\right)}{\mathsf{PI}\left(\right)}} \]
      3. mult-flipN/A

        \[\leadsto 180 \cdot \color{blue}{\left(\tan^{-1} \left(\frac{-1}{2} \cdot \frac{B}{C - A}\right) \cdot \frac{1}{\mathsf{PI}\left(\right)}\right)} \]
      4. lift-/.f64N/A

        \[\leadsto 180 \cdot \left(\tan^{-1} \left(\frac{-1}{2} \cdot \frac{B}{C - A}\right) \cdot \color{blue}{\frac{1}{\mathsf{PI}\left(\right)}}\right) \]
      5. lift-PI.f64N/A

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

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

      \[\leadsto 180 \cdot \color{blue}{\left(\tan^{-1} \left(\frac{B}{C - A} \cdot -0.5\right) \cdot \frac{1}{\pi}\right)} \]
    9. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \color{blue}{180 \cdot \left(\tan^{-1} \left(\frac{B}{C - A} \cdot \frac{-1}{2}\right) \cdot \frac{1}{\pi}\right)} \]
      2. lift-*.f64N/A

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

        \[\leadsto \color{blue}{\left(180 \cdot \tan^{-1} \left(\frac{B}{C - A} \cdot \frac{-1}{2}\right)\right) \cdot \frac{1}{\pi}} \]
      4. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(180 \cdot \tan^{-1} \left(\frac{B}{C - A} \cdot \frac{-1}{2}\right)\right) \cdot \frac{1}{\pi}} \]
      5. lower-*.f6437.3

        \[\leadsto \color{blue}{\left(180 \cdot \tan^{-1} \left(\frac{B}{C - A} \cdot -0.5\right)\right)} \cdot \frac{1}{\pi} \]
    10. Applied rewrites37.3%

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

Alternative 2: 77.8% accurate, 0.7× speedup?

\[\begin{array}{l} B\_m = \left|B\right| \\ B\_s = \mathsf{copysign}\left(1, B\right) \\ B\_s \cdot \begin{array}{l} \mathbf{if}\;180 \cdot \frac{\tan^{-1} \left(\frac{1}{B\_m} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B\_m}^{2}}\right)\right)}{\pi} \leq -5 \cdot 10^{-12}:\\ \;\;\;\;\left(180 \cdot \tan^{-1} \left(\left(\frac{C}{B\_m} - 1\right) - \frac{A}{B\_m}\right)\right) \cdot \frac{1}{\pi}\\ \mathbf{else}:\\ \;\;\;\;\left(180 \cdot \tan^{-1} \left(\frac{B\_m}{C - A} \cdot -0.5\right)\right) \cdot \frac{1}{\pi}\\ \end{array} \end{array} \]
B\_m = (fabs.f64 B)
B\_s = (copysign.f64 #s(literal 1 binary64) B)
(FPCore (B_s A B_m C)
 :precision binary64
 (*
  B_s
  (if (<=
       (*
        180.0
        (/
         (atan
          (*
           (/ 1.0 B_m)
           (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B_m 2.0))))))
         PI))
       -5e-12)
    (* (* 180.0 (atan (- (- (/ C B_m) 1.0) (/ A B_m)))) (/ 1.0 PI))
    (* (* 180.0 (atan (* (/ B_m (- C A)) -0.5))) (/ 1.0 PI)))))
B\_m = fabs(B);
B\_s = copysign(1.0, B);
double code(double B_s, double A, double B_m, double C) {
	double tmp;
	if ((180.0 * (atan(((1.0 / B_m) * ((C - A) - sqrt((pow((A - C), 2.0) + pow(B_m, 2.0)))))) / ((double) M_PI))) <= -5e-12) {
		tmp = (180.0 * atan((((C / B_m) - 1.0) - (A / B_m)))) * (1.0 / ((double) M_PI));
	} else {
		tmp = (180.0 * atan(((B_m / (C - A)) * -0.5))) * (1.0 / ((double) M_PI));
	}
	return B_s * tmp;
}
B\_m = Math.abs(B);
B\_s = Math.copySign(1.0, B);
public static double code(double B_s, double A, double B_m, double C) {
	double tmp;
	if ((180.0 * (Math.atan(((1.0 / B_m) * ((C - A) - Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B_m, 2.0)))))) / Math.PI)) <= -5e-12) {
		tmp = (180.0 * Math.atan((((C / B_m) - 1.0) - (A / B_m)))) * (1.0 / Math.PI);
	} else {
		tmp = (180.0 * Math.atan(((B_m / (C - A)) * -0.5))) * (1.0 / Math.PI);
	}
	return B_s * tmp;
}
B\_m = math.fabs(B)
B\_s = math.copysign(1.0, B)
def code(B_s, A, B_m, C):
	tmp = 0
	if (180.0 * (math.atan(((1.0 / B_m) * ((C - A) - math.sqrt((math.pow((A - C), 2.0) + math.pow(B_m, 2.0)))))) / math.pi)) <= -5e-12:
		tmp = (180.0 * math.atan((((C / B_m) - 1.0) - (A / B_m)))) * (1.0 / math.pi)
	else:
		tmp = (180.0 * math.atan(((B_m / (C - A)) * -0.5))) * (1.0 / math.pi)
	return B_s * tmp
B\_m = abs(B)
B\_s = copysign(1.0, B)
function code(B_s, A, B_m, C)
	tmp = 0.0
	if (Float64(180.0 * Float64(atan(Float64(Float64(1.0 / B_m) * Float64(Float64(C - A) - sqrt(Float64((Float64(A - C) ^ 2.0) + (B_m ^ 2.0)))))) / pi)) <= -5e-12)
		tmp = Float64(Float64(180.0 * atan(Float64(Float64(Float64(C / B_m) - 1.0) - Float64(A / B_m)))) * Float64(1.0 / pi));
	else
		tmp = Float64(Float64(180.0 * atan(Float64(Float64(B_m / Float64(C - A)) * -0.5))) * Float64(1.0 / pi));
	end
	return Float64(B_s * tmp)
end
B\_m = abs(B);
B\_s = sign(B) * abs(1.0);
function tmp_2 = code(B_s, A, B_m, C)
	tmp = 0.0;
	if ((180.0 * (atan(((1.0 / B_m) * ((C - A) - sqrt((((A - C) ^ 2.0) + (B_m ^ 2.0)))))) / pi)) <= -5e-12)
		tmp = (180.0 * atan((((C / B_m) - 1.0) - (A / B_m)))) * (1.0 / pi);
	else
		tmp = (180.0 * atan(((B_m / (C - A)) * -0.5))) * (1.0 / pi);
	end
	tmp_2 = B_s * tmp;
end
B\_m = N[Abs[B], $MachinePrecision]
B\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[B]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[B$95$s_, A_, B$95$m_, C_] := N[(B$95$s * If[LessEqual[N[(180.0 * N[(N[ArcTan[N[(N[(1.0 / B$95$m), $MachinePrecision] * N[(N[(C - A), $MachinePrecision] - N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], -5e-12], N[(N[(180.0 * N[ArcTan[N[(N[(N[(C / B$95$m), $MachinePrecision] - 1.0), $MachinePrecision] - N[(A / B$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 / Pi), $MachinePrecision]), $MachinePrecision], N[(N[(180.0 * N[ArcTan[N[(N[(B$95$m / N[(C - A), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 / Pi), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
B\_m = \left|B\right|
\\
B\_s = \mathsf{copysign}\left(1, B\right)

\\
B\_s \cdot \begin{array}{l}
\mathbf{if}\;180 \cdot \frac{\tan^{-1} \left(\frac{1}{B\_m} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B\_m}^{2}}\right)\right)}{\pi} \leq -5 \cdot 10^{-12}:\\
\;\;\;\;\left(180 \cdot \tan^{-1} \left(\left(\frac{C}{B\_m} - 1\right) - \frac{A}{B\_m}\right)\right) \cdot \frac{1}{\pi}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 #s(literal 180 binary64) (/.f64 (atan.f64 (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64))))))) (PI.f64))) < -4.9999999999999997e-12

    1. Initial program 53.6%

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

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{C}{B} - \left(1 + \frac{A}{B}\right)\right)}}{\pi} \]
    3. Step-by-step derivation
      1. associate--r+N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \color{blue}{\frac{A}{B}}\right)}{\pi} \]
      2. lower--.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \color{blue}{\frac{A}{B}}\right)}{\pi} \]
      3. lower--.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{\color{blue}{A}}{B}\right)}{\pi} \]
      4. lower-/.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right)}{\pi} \]
      5. lower-/.f6465.1

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{\color{blue}{B}}\right)}{\pi} \]
    4. Applied rewrites65.1%

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right)}}{\pi} \]
    5. Step-by-step derivation
      1. lift-PI.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right)}{\color{blue}{\mathsf{PI}\left(\right)}} \]
      2. lift-/.f64N/A

        \[\leadsto 180 \cdot \color{blue}{\frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right)}{\mathsf{PI}\left(\right)}} \]
      3. mult-flipN/A

        \[\leadsto 180 \cdot \color{blue}{\left(\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right) \cdot \frac{1}{\mathsf{PI}\left(\right)}\right)} \]
      4. lower-*.f64N/A

        \[\leadsto 180 \cdot \color{blue}{\left(\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right) \cdot \frac{1}{\mathsf{PI}\left(\right)}\right)} \]
    6. Applied rewrites65.1%

      \[\leadsto 180 \cdot \color{blue}{\left(\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right) \cdot \frac{1}{\pi}\right)} \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \color{blue}{180 \cdot \left(\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right) \cdot \frac{1}{\pi}\right)} \]
      2. lift-*.f64N/A

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

        \[\leadsto \color{blue}{\left(180 \cdot \tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right)\right) \cdot \frac{1}{\pi}} \]
      4. lower-*.f64N/A

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

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

    if -4.9999999999999997e-12 < (*.f64 #s(literal 180 binary64) (/.f64 (atan.f64 (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64))))))) (PI.f64)))

    1. Initial program 53.6%

      \[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. Step-by-step derivation
      1. lift-sqrt.f64N/A

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

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{\color{blue}{{\left(A - C\right)}^{2} + {B}^{2}}}\right)\right)}{\pi} \]
      3. lift--.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\color{blue}{\left(A - C\right)}}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      4. lift-pow.f64N/A

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

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\color{blue}{\left(A + \left(\mathsf{neg}\left(C\right)\right)\right)}}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      6. mul-1-negN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A + \color{blue}{-1 \cdot C}\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      7. lift-pow.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A + -1 \cdot C\right)}^{2} + \color{blue}{{B}^{2}}}\right)\right)}{\pi} \]
      8. mul-1-negN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A + \color{blue}{\left(\mathsf{neg}\left(C\right)\right)}\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      9. sub-flipN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\color{blue}{\left(A - C\right)}}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      10. sub-negate-revN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\color{blue}{\left(\mathsf{neg}\left(\left(C - A\right)\right)\right)}}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      11. sub-flipN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(\mathsf{neg}\left(\color{blue}{\left(C + \left(\mathsf{neg}\left(A\right)\right)\right)}\right)\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      12. mul-1-negN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(\mathsf{neg}\left(\left(C + \color{blue}{-1 \cdot A}\right)\right)\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      13. unpow-neg-2N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{\color{blue}{{\left(C + -1 \cdot A\right)}^{2}} + {B}^{2}}\right)\right)}{\pi} \]
      14. mul-1-negN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(C + \color{blue}{\left(\mathsf{neg}\left(A\right)\right)}\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      15. sub-flipN/A

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

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

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{\left(C - A\right) \cdot \left(C - A\right) + \color{blue}{B \cdot B}}\right)\right)}{\pi} \]
      18. lower-hypot.f64N/A

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

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

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

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{-1}{2} \cdot \frac{B}{C - A}\right)}}{\pi} \]
    5. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-1}{2} \cdot \color{blue}{\frac{B}{C - A}}\right)}{\pi} \]
      2. lower-/.f64N/A

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

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

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(-0.5 \cdot \frac{B}{C - A}\right)}}{\pi} \]
    7. Step-by-step derivation
      1. lift-PI.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-1}{2} \cdot \frac{B}{C - A}\right)}{\color{blue}{\mathsf{PI}\left(\right)}} \]
      2. lift-/.f64N/A

        \[\leadsto 180 \cdot \color{blue}{\frac{\tan^{-1} \left(\frac{-1}{2} \cdot \frac{B}{C - A}\right)}{\mathsf{PI}\left(\right)}} \]
      3. mult-flipN/A

        \[\leadsto 180 \cdot \color{blue}{\left(\tan^{-1} \left(\frac{-1}{2} \cdot \frac{B}{C - A}\right) \cdot \frac{1}{\mathsf{PI}\left(\right)}\right)} \]
      4. lift-/.f64N/A

        \[\leadsto 180 \cdot \left(\tan^{-1} \left(\frac{-1}{2} \cdot \frac{B}{C - A}\right) \cdot \color{blue}{\frac{1}{\mathsf{PI}\left(\right)}}\right) \]
      5. lift-PI.f64N/A

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

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

      \[\leadsto 180 \cdot \color{blue}{\left(\tan^{-1} \left(\frac{B}{C - A} \cdot -0.5\right) \cdot \frac{1}{\pi}\right)} \]
    9. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \color{blue}{180 \cdot \left(\tan^{-1} \left(\frac{B}{C - A} \cdot \frac{-1}{2}\right) \cdot \frac{1}{\pi}\right)} \]
      2. lift-*.f64N/A

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

        \[\leadsto \color{blue}{\left(180 \cdot \tan^{-1} \left(\frac{B}{C - A} \cdot \frac{-1}{2}\right)\right) \cdot \frac{1}{\pi}} \]
      4. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(180 \cdot \tan^{-1} \left(\frac{B}{C - A} \cdot \frac{-1}{2}\right)\right) \cdot \frac{1}{\pi}} \]
      5. lower-*.f6437.3

        \[\leadsto \color{blue}{\left(180 \cdot \tan^{-1} \left(\frac{B}{C - A} \cdot -0.5\right)\right)} \cdot \frac{1}{\pi} \]
    10. Applied rewrites37.3%

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

Alternative 3: 77.8% accurate, 0.7× speedup?

\[\begin{array}{l} B\_m = \left|B\right| \\ B\_s = \mathsf{copysign}\left(1, B\right) \\ B\_s \cdot \begin{array}{l} \mathbf{if}\;180 \cdot \frac{\tan^{-1} \left(\frac{1}{B\_m} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B\_m}^{2}}\right)\right)}{\pi} \leq -5 \cdot 10^{-12}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B\_m} - 1\right) - \frac{A}{B\_m}\right)}{\pi}\\ \mathbf{else}:\\ \;\;\;\;\left(180 \cdot \tan^{-1} \left(\frac{B\_m}{C - A} \cdot -0.5\right)\right) \cdot \frac{1}{\pi}\\ \end{array} \end{array} \]
B\_m = (fabs.f64 B)
B\_s = (copysign.f64 #s(literal 1 binary64) B)
(FPCore (B_s A B_m C)
 :precision binary64
 (*
  B_s
  (if (<=
       (*
        180.0
        (/
         (atan
          (*
           (/ 1.0 B_m)
           (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B_m 2.0))))))
         PI))
       -5e-12)
    (* 180.0 (/ (atan (- (- (/ C B_m) 1.0) (/ A B_m))) PI))
    (* (* 180.0 (atan (* (/ B_m (- C A)) -0.5))) (/ 1.0 PI)))))
B\_m = fabs(B);
B\_s = copysign(1.0, B);
double code(double B_s, double A, double B_m, double C) {
	double tmp;
	if ((180.0 * (atan(((1.0 / B_m) * ((C - A) - sqrt((pow((A - C), 2.0) + pow(B_m, 2.0)))))) / ((double) M_PI))) <= -5e-12) {
		tmp = 180.0 * (atan((((C / B_m) - 1.0) - (A / B_m))) / ((double) M_PI));
	} else {
		tmp = (180.0 * atan(((B_m / (C - A)) * -0.5))) * (1.0 / ((double) M_PI));
	}
	return B_s * tmp;
}
B\_m = Math.abs(B);
B\_s = Math.copySign(1.0, B);
public static double code(double B_s, double A, double B_m, double C) {
	double tmp;
	if ((180.0 * (Math.atan(((1.0 / B_m) * ((C - A) - Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B_m, 2.0)))))) / Math.PI)) <= -5e-12) {
		tmp = 180.0 * (Math.atan((((C / B_m) - 1.0) - (A / B_m))) / Math.PI);
	} else {
		tmp = (180.0 * Math.atan(((B_m / (C - A)) * -0.5))) * (1.0 / Math.PI);
	}
	return B_s * tmp;
}
B\_m = math.fabs(B)
B\_s = math.copysign(1.0, B)
def code(B_s, A, B_m, C):
	tmp = 0
	if (180.0 * (math.atan(((1.0 / B_m) * ((C - A) - math.sqrt((math.pow((A - C), 2.0) + math.pow(B_m, 2.0)))))) / math.pi)) <= -5e-12:
		tmp = 180.0 * (math.atan((((C / B_m) - 1.0) - (A / B_m))) / math.pi)
	else:
		tmp = (180.0 * math.atan(((B_m / (C - A)) * -0.5))) * (1.0 / math.pi)
	return B_s * tmp
B\_m = abs(B)
B\_s = copysign(1.0, B)
function code(B_s, A, B_m, C)
	tmp = 0.0
	if (Float64(180.0 * Float64(atan(Float64(Float64(1.0 / B_m) * Float64(Float64(C - A) - sqrt(Float64((Float64(A - C) ^ 2.0) + (B_m ^ 2.0)))))) / pi)) <= -5e-12)
		tmp = Float64(180.0 * Float64(atan(Float64(Float64(Float64(C / B_m) - 1.0) - Float64(A / B_m))) / pi));
	else
		tmp = Float64(Float64(180.0 * atan(Float64(Float64(B_m / Float64(C - A)) * -0.5))) * Float64(1.0 / pi));
	end
	return Float64(B_s * tmp)
end
B\_m = abs(B);
B\_s = sign(B) * abs(1.0);
function tmp_2 = code(B_s, A, B_m, C)
	tmp = 0.0;
	if ((180.0 * (atan(((1.0 / B_m) * ((C - A) - sqrt((((A - C) ^ 2.0) + (B_m ^ 2.0)))))) / pi)) <= -5e-12)
		tmp = 180.0 * (atan((((C / B_m) - 1.0) - (A / B_m))) / pi);
	else
		tmp = (180.0 * atan(((B_m / (C - A)) * -0.5))) * (1.0 / pi);
	end
	tmp_2 = B_s * tmp;
end
B\_m = N[Abs[B], $MachinePrecision]
B\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[B]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[B$95$s_, A_, B$95$m_, C_] := N[(B$95$s * If[LessEqual[N[(180.0 * N[(N[ArcTan[N[(N[(1.0 / B$95$m), $MachinePrecision] * N[(N[(C - A), $MachinePrecision] - N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], -5e-12], N[(180.0 * N[(N[ArcTan[N[(N[(N[(C / B$95$m), $MachinePrecision] - 1.0), $MachinePrecision] - N[(A / B$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], N[(N[(180.0 * N[ArcTan[N[(N[(B$95$m / N[(C - A), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 / Pi), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
B\_m = \left|B\right|
\\
B\_s = \mathsf{copysign}\left(1, B\right)

\\
B\_s \cdot \begin{array}{l}
\mathbf{if}\;180 \cdot \frac{\tan^{-1} \left(\frac{1}{B\_m} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B\_m}^{2}}\right)\right)}{\pi} \leq -5 \cdot 10^{-12}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B\_m} - 1\right) - \frac{A}{B\_m}\right)}{\pi}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 #s(literal 180 binary64) (/.f64 (atan.f64 (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64))))))) (PI.f64))) < -4.9999999999999997e-12

    1. Initial program 53.6%

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

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{C}{B} - \left(1 + \frac{A}{B}\right)\right)}}{\pi} \]
    3. Step-by-step derivation
      1. associate--r+N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \color{blue}{\frac{A}{B}}\right)}{\pi} \]
      2. lower--.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \color{blue}{\frac{A}{B}}\right)}{\pi} \]
      3. lower--.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{\color{blue}{A}}{B}\right)}{\pi} \]
      4. lower-/.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right)}{\pi} \]
      5. lower-/.f6465.1

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{\color{blue}{B}}\right)}{\pi} \]
    4. Applied rewrites65.1%

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

    if -4.9999999999999997e-12 < (*.f64 #s(literal 180 binary64) (/.f64 (atan.f64 (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64))))))) (PI.f64)))

    1. Initial program 53.6%

      \[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. Step-by-step derivation
      1. lift-sqrt.f64N/A

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

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{\color{blue}{{\left(A - C\right)}^{2} + {B}^{2}}}\right)\right)}{\pi} \]
      3. lift--.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\color{blue}{\left(A - C\right)}}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      4. lift-pow.f64N/A

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

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\color{blue}{\left(A + \left(\mathsf{neg}\left(C\right)\right)\right)}}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      6. mul-1-negN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A + \color{blue}{-1 \cdot C}\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      7. lift-pow.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A + -1 \cdot C\right)}^{2} + \color{blue}{{B}^{2}}}\right)\right)}{\pi} \]
      8. mul-1-negN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A + \color{blue}{\left(\mathsf{neg}\left(C\right)\right)}\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      9. sub-flipN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\color{blue}{\left(A - C\right)}}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      10. sub-negate-revN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\color{blue}{\left(\mathsf{neg}\left(\left(C - A\right)\right)\right)}}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      11. sub-flipN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(\mathsf{neg}\left(\color{blue}{\left(C + \left(\mathsf{neg}\left(A\right)\right)\right)}\right)\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      12. mul-1-negN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(\mathsf{neg}\left(\left(C + \color{blue}{-1 \cdot A}\right)\right)\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      13. unpow-neg-2N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{\color{blue}{{\left(C + -1 \cdot A\right)}^{2}} + {B}^{2}}\right)\right)}{\pi} \]
      14. mul-1-negN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(C + \color{blue}{\left(\mathsf{neg}\left(A\right)\right)}\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      15. sub-flipN/A

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

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

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{\left(C - A\right) \cdot \left(C - A\right) + \color{blue}{B \cdot B}}\right)\right)}{\pi} \]
      18. lower-hypot.f64N/A

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

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

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

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{-1}{2} \cdot \frac{B}{C - A}\right)}}{\pi} \]
    5. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-1}{2} \cdot \color{blue}{\frac{B}{C - A}}\right)}{\pi} \]
      2. lower-/.f64N/A

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

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

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(-0.5 \cdot \frac{B}{C - A}\right)}}{\pi} \]
    7. Step-by-step derivation
      1. lift-PI.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-1}{2} \cdot \frac{B}{C - A}\right)}{\color{blue}{\mathsf{PI}\left(\right)}} \]
      2. lift-/.f64N/A

        \[\leadsto 180 \cdot \color{blue}{\frac{\tan^{-1} \left(\frac{-1}{2} \cdot \frac{B}{C - A}\right)}{\mathsf{PI}\left(\right)}} \]
      3. mult-flipN/A

        \[\leadsto 180 \cdot \color{blue}{\left(\tan^{-1} \left(\frac{-1}{2} \cdot \frac{B}{C - A}\right) \cdot \frac{1}{\mathsf{PI}\left(\right)}\right)} \]
      4. lift-/.f64N/A

        \[\leadsto 180 \cdot \left(\tan^{-1} \left(\frac{-1}{2} \cdot \frac{B}{C - A}\right) \cdot \color{blue}{\frac{1}{\mathsf{PI}\left(\right)}}\right) \]
      5. lift-PI.f64N/A

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

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

      \[\leadsto 180 \cdot \color{blue}{\left(\tan^{-1} \left(\frac{B}{C - A} \cdot -0.5\right) \cdot \frac{1}{\pi}\right)} \]
    9. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \color{blue}{180 \cdot \left(\tan^{-1} \left(\frac{B}{C - A} \cdot \frac{-1}{2}\right) \cdot \frac{1}{\pi}\right)} \]
      2. lift-*.f64N/A

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

        \[\leadsto \color{blue}{\left(180 \cdot \tan^{-1} \left(\frac{B}{C - A} \cdot \frac{-1}{2}\right)\right) \cdot \frac{1}{\pi}} \]
      4. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(180 \cdot \tan^{-1} \left(\frac{B}{C - A} \cdot \frac{-1}{2}\right)\right) \cdot \frac{1}{\pi}} \]
      5. lower-*.f6437.3

        \[\leadsto \color{blue}{\left(180 \cdot \tan^{-1} \left(\frac{B}{C - A} \cdot -0.5\right)\right)} \cdot \frac{1}{\pi} \]
    10. Applied rewrites37.3%

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

Alternative 4: 72.1% accurate, 0.4× speedup?

\[\begin{array}{l} B\_m = \left|B\right| \\ B\_s = \mathsf{copysign}\left(1, B\right) \\ \begin{array}{l} t_0 := \frac{1}{B\_m} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B\_m}^{2}}\right)\\ t_1 := \frac{-A}{B\_m}\\ B\_s \cdot \begin{array}{l} \mathbf{if}\;t\_0 \leq -\infty:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(t\_1 - 1\right)}{\pi}\\ \mathbf{elif}\;t\_0 \leq -1 \cdot 10^{+21}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C - A}{B\_m}\right)}{\pi}\\ \mathbf{elif}\;t\_0 \leq -1 \cdot 10^{-13}:\\ \;\;\;\;\left(180 \cdot \tan^{-1} \left(-1 + t\_1\right)\right) \cdot \frac{1}{\pi}\\ \mathbf{else}:\\ \;\;\;\;\left(180 \cdot \tan^{-1} \left(\frac{B\_m}{C - A} \cdot -0.5\right)\right) \cdot \frac{1}{\pi}\\ \end{array} \end{array} \end{array} \]
B\_m = (fabs.f64 B)
B\_s = (copysign.f64 #s(literal 1 binary64) B)
(FPCore (B_s A B_m C)
 :precision binary64
 (let* ((t_0
         (*
          (/ 1.0 B_m)
          (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B_m 2.0))))))
        (t_1 (/ (- A) B_m)))
   (*
    B_s
    (if (<= t_0 (- INFINITY))
      (* 180.0 (/ (atan (- t_1 1.0)) PI))
      (if (<= t_0 -1e+21)
        (* 180.0 (/ (atan (/ (- C A) B_m)) PI))
        (if (<= t_0 -1e-13)
          (* (* 180.0 (atan (+ -1.0 t_1))) (/ 1.0 PI))
          (* (* 180.0 (atan (* (/ B_m (- C A)) -0.5))) (/ 1.0 PI))))))))
B\_m = fabs(B);
B\_s = copysign(1.0, B);
double code(double B_s, double A, double B_m, double C) {
	double t_0 = (1.0 / B_m) * ((C - A) - sqrt((pow((A - C), 2.0) + pow(B_m, 2.0))));
	double t_1 = -A / B_m;
	double tmp;
	if (t_0 <= -((double) INFINITY)) {
		tmp = 180.0 * (atan((t_1 - 1.0)) / ((double) M_PI));
	} else if (t_0 <= -1e+21) {
		tmp = 180.0 * (atan(((C - A) / B_m)) / ((double) M_PI));
	} else if (t_0 <= -1e-13) {
		tmp = (180.0 * atan((-1.0 + t_1))) * (1.0 / ((double) M_PI));
	} else {
		tmp = (180.0 * atan(((B_m / (C - A)) * -0.5))) * (1.0 / ((double) M_PI));
	}
	return B_s * tmp;
}
B\_m = Math.abs(B);
B\_s = Math.copySign(1.0, B);
public static double code(double B_s, double A, double B_m, double C) {
	double t_0 = (1.0 / B_m) * ((C - A) - Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B_m, 2.0))));
	double t_1 = -A / B_m;
	double tmp;
	if (t_0 <= -Double.POSITIVE_INFINITY) {
		tmp = 180.0 * (Math.atan((t_1 - 1.0)) / Math.PI);
	} else if (t_0 <= -1e+21) {
		tmp = 180.0 * (Math.atan(((C - A) / B_m)) / Math.PI);
	} else if (t_0 <= -1e-13) {
		tmp = (180.0 * Math.atan((-1.0 + t_1))) * (1.0 / Math.PI);
	} else {
		tmp = (180.0 * Math.atan(((B_m / (C - A)) * -0.5))) * (1.0 / Math.PI);
	}
	return B_s * tmp;
}
B\_m = math.fabs(B)
B\_s = math.copysign(1.0, B)
def code(B_s, A, B_m, C):
	t_0 = (1.0 / B_m) * ((C - A) - math.sqrt((math.pow((A - C), 2.0) + math.pow(B_m, 2.0))))
	t_1 = -A / B_m
	tmp = 0
	if t_0 <= -math.inf:
		tmp = 180.0 * (math.atan((t_1 - 1.0)) / math.pi)
	elif t_0 <= -1e+21:
		tmp = 180.0 * (math.atan(((C - A) / B_m)) / math.pi)
	elif t_0 <= -1e-13:
		tmp = (180.0 * math.atan((-1.0 + t_1))) * (1.0 / math.pi)
	else:
		tmp = (180.0 * math.atan(((B_m / (C - A)) * -0.5))) * (1.0 / math.pi)
	return B_s * tmp
B\_m = abs(B)
B\_s = copysign(1.0, B)
function code(B_s, A, B_m, C)
	t_0 = Float64(Float64(1.0 / B_m) * Float64(Float64(C - A) - sqrt(Float64((Float64(A - C) ^ 2.0) + (B_m ^ 2.0)))))
	t_1 = Float64(Float64(-A) / B_m)
	tmp = 0.0
	if (t_0 <= Float64(-Inf))
		tmp = Float64(180.0 * Float64(atan(Float64(t_1 - 1.0)) / pi));
	elseif (t_0 <= -1e+21)
		tmp = Float64(180.0 * Float64(atan(Float64(Float64(C - A) / B_m)) / pi));
	elseif (t_0 <= -1e-13)
		tmp = Float64(Float64(180.0 * atan(Float64(-1.0 + t_1))) * Float64(1.0 / pi));
	else
		tmp = Float64(Float64(180.0 * atan(Float64(Float64(B_m / Float64(C - A)) * -0.5))) * Float64(1.0 / pi));
	end
	return Float64(B_s * tmp)
end
B\_m = abs(B);
B\_s = sign(B) * abs(1.0);
function tmp_2 = code(B_s, A, B_m, C)
	t_0 = (1.0 / B_m) * ((C - A) - sqrt((((A - C) ^ 2.0) + (B_m ^ 2.0))));
	t_1 = -A / B_m;
	tmp = 0.0;
	if (t_0 <= -Inf)
		tmp = 180.0 * (atan((t_1 - 1.0)) / pi);
	elseif (t_0 <= -1e+21)
		tmp = 180.0 * (atan(((C - A) / B_m)) / pi);
	elseif (t_0 <= -1e-13)
		tmp = (180.0 * atan((-1.0 + t_1))) * (1.0 / pi);
	else
		tmp = (180.0 * atan(((B_m / (C - A)) * -0.5))) * (1.0 / pi);
	end
	tmp_2 = B_s * tmp;
end
B\_m = N[Abs[B], $MachinePrecision]
B\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[B]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[B$95$s_, A_, B$95$m_, C_] := Block[{t$95$0 = N[(N[(1.0 / B$95$m), $MachinePrecision] * N[(N[(C - A), $MachinePrecision] - N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[((-A) / B$95$m), $MachinePrecision]}, N[(B$95$s * If[LessEqual[t$95$0, (-Infinity)], N[(180.0 * N[(N[ArcTan[N[(t$95$1 - 1.0), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, -1e+21], N[(180.0 * N[(N[ArcTan[N[(N[(C - A), $MachinePrecision] / B$95$m), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, -1e-13], N[(N[(180.0 * N[ArcTan[N[(-1.0 + t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 / Pi), $MachinePrecision]), $MachinePrecision], N[(N[(180.0 * N[ArcTan[N[(N[(B$95$m / N[(C - A), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 / Pi), $MachinePrecision]), $MachinePrecision]]]]), $MachinePrecision]]]
\begin{array}{l}
B\_m = \left|B\right|
\\
B\_s = \mathsf{copysign}\left(1, B\right)

\\
\begin{array}{l}
t_0 := \frac{1}{B\_m} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B\_m}^{2}}\right)\\
t_1 := \frac{-A}{B\_m}\\
B\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(t\_1 - 1\right)}{\pi}\\

\mathbf{elif}\;t\_0 \leq -1 \cdot 10^{+21}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C - A}{B\_m}\right)}{\pi}\\

\mathbf{elif}\;t\_0 \leq -1 \cdot 10^{-13}:\\
\;\;\;\;\left(180 \cdot \tan^{-1} \left(-1 + t\_1\right)\right) \cdot \frac{1}{\pi}\\

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


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))) < -inf.0

    1. Initial program 53.6%

      \[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. Taylor expanded in C around 0

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(-1 \cdot \frac{A + \sqrt{{A}^{2} + {B}^{2}}}{B}\right)}}{\pi} \]
    3. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-1 \cdot \left(A + \sqrt{{A}^{2} + {B}^{2}}\right)}{\color{blue}{B}}\right)}{\pi} \]
      2. mul-1-negN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{neg}\left(\left(A + \sqrt{{A}^{2} + {B}^{2}}\right)\right)}{B}\right)}{\pi} \]
      3. lower-/.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{neg}\left(\left(A + \sqrt{{A}^{2} + {B}^{2}}\right)\right)}{\color{blue}{B}}\right)}{\pi} \]
      4. lower-neg.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-\left(A + \sqrt{{A}^{2} + {B}^{2}}\right)}{B}\right)}{\pi} \]
      5. +-commutativeN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-\left(\sqrt{{A}^{2} + {B}^{2}} + A\right)}{B}\right)}{\pi} \]
      6. lower-+.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-\left(\sqrt{{A}^{2} + {B}^{2}} + A\right)}{B}\right)}{\pi} \]
      7. lower-sqrt.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-\left(\sqrt{{A}^{2} + {B}^{2}} + A\right)}{B}\right)}{\pi} \]
      8. unpow2N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-\left(\sqrt{A \cdot A + {B}^{2}} + A\right)}{B}\right)}{\pi} \]
      9. lower-fma.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-\left(\sqrt{\mathsf{fma}\left(A, A, {B}^{2}\right)} + A\right)}{B}\right)}{\pi} \]
      10. unpow2N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-\left(\sqrt{\mathsf{fma}\left(A, A, B \cdot B\right)} + A\right)}{B}\right)}{\pi} \]
      11. lower-*.f6444.4

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-\left(\sqrt{\mathsf{fma}\left(A, A, B \cdot B\right)} + A\right)}{B}\right)}{\pi} \]
    4. Applied rewrites44.4%

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{-\left(\sqrt{\mathsf{fma}\left(A, A, B \cdot B\right)} + A\right)}{B}\right)}}{\pi} \]
    5. Taylor expanded in A around 0

      \[\leadsto 180 \cdot \frac{\tan^{-1} \left(-1 \cdot \frac{A}{B} - \color{blue}{1}\right)}{\pi} \]
    6. Step-by-step derivation
      1. lower--.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(-1 \cdot \frac{A}{B} - 1\right)}{\pi} \]
      2. associate-*r/N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-1 \cdot A}{B} - 1\right)}{\pi} \]
      3. mul-1-negN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{neg}\left(A\right)}{B} - 1\right)}{\pi} \]
      4. lower-/.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{neg}\left(A\right)}{B} - 1\right)}{\pi} \]
      5. lower-neg.f6455.9

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-A}{B} - 1\right)}{\pi} \]
    7. Applied rewrites55.9%

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

    if -inf.0 < (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))) < -1e21

    1. Initial program 53.6%

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

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{C}{B} - \left(1 + \frac{A}{B}\right)\right)}}{\pi} \]
    3. Step-by-step derivation
      1. associate--r+N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \color{blue}{\frac{A}{B}}\right)}{\pi} \]
      2. lower--.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \color{blue}{\frac{A}{B}}\right)}{\pi} \]
      3. lower--.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{\color{blue}{A}}{B}\right)}{\pi} \]
      4. lower-/.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right)}{\pi} \]
      5. lower-/.f6465.1

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{\color{blue}{B}}\right)}{\pi} \]
    4. Applied rewrites65.1%

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

      \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{C - A}{\color{blue}{B}}\right)}{\pi} \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{C - A}{B}\right)}{\pi} \]
      2. lift--.f6434.6

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{C - A}{B}\right)}{\pi} \]
    7. Applied rewrites34.6%

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

    if -1e21 < (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))) < -1e-13

    1. Initial program 53.6%

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

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{C}{B} - \left(1 + \frac{A}{B}\right)\right)}}{\pi} \]
    3. Step-by-step derivation
      1. associate--r+N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \color{blue}{\frac{A}{B}}\right)}{\pi} \]
      2. lower--.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \color{blue}{\frac{A}{B}}\right)}{\pi} \]
      3. lower--.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{\color{blue}{A}}{B}\right)}{\pi} \]
      4. lower-/.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right)}{\pi} \]
      5. lower-/.f6465.1

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{\color{blue}{B}}\right)}{\pi} \]
    4. Applied rewrites65.1%

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right)}}{\pi} \]
    5. Step-by-step derivation
      1. lift-PI.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right)}{\color{blue}{\mathsf{PI}\left(\right)}} \]
      2. lift-/.f64N/A

        \[\leadsto 180 \cdot \color{blue}{\frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right)}{\mathsf{PI}\left(\right)}} \]
      3. mult-flipN/A

        \[\leadsto 180 \cdot \color{blue}{\left(\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right) \cdot \frac{1}{\mathsf{PI}\left(\right)}\right)} \]
      4. lower-*.f64N/A

        \[\leadsto 180 \cdot \color{blue}{\left(\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right) \cdot \frac{1}{\mathsf{PI}\left(\right)}\right)} \]
    6. Applied rewrites65.1%

      \[\leadsto 180 \cdot \color{blue}{\left(\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right) \cdot \frac{1}{\pi}\right)} \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \color{blue}{180 \cdot \left(\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right) \cdot \frac{1}{\pi}\right)} \]
      2. lift-*.f64N/A

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

        \[\leadsto \color{blue}{\left(180 \cdot \tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right)\right) \cdot \frac{1}{\pi}} \]
      4. lower-*.f64N/A

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

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

      \[\leadsto \left(180 \cdot \tan^{-1} \left(-1 \cdot \color{blue}{\left(1 + \frac{A}{B}\right)}\right)\right) \cdot \frac{1}{\pi} \]
    10. Step-by-step derivation
      1. distribute-lft-inN/A

        \[\leadsto \left(180 \cdot \tan^{-1} \left(-1 \cdot 1 + -1 \cdot \color{blue}{\frac{A}{B}}\right)\right) \cdot \frac{1}{\pi} \]
      2. metadata-evalN/A

        \[\leadsto \left(180 \cdot \tan^{-1} \left(-1 + -1 \cdot \frac{\color{blue}{A}}{B}\right)\right) \cdot \frac{1}{\pi} \]
      3. lower-+.f64N/A

        \[\leadsto \left(180 \cdot \tan^{-1} \left(-1 + -1 \cdot \color{blue}{\frac{A}{B}}\right)\right) \cdot \frac{1}{\pi} \]
      4. mul-1-negN/A

        \[\leadsto \left(180 \cdot \tan^{-1} \left(-1 + \left(\mathsf{neg}\left(\frac{A}{B}\right)\right)\right)\right) \cdot \frac{1}{\pi} \]
      5. distribute-frac-negN/A

        \[\leadsto \left(180 \cdot \tan^{-1} \left(-1 + \frac{\mathsf{neg}\left(A\right)}{B}\right)\right) \cdot \frac{1}{\pi} \]
      6. lift-neg.f64N/A

        \[\leadsto \left(180 \cdot \tan^{-1} \left(-1 + \frac{-A}{B}\right)\right) \cdot \frac{1}{\pi} \]
      7. lift-/.f6455.9

        \[\leadsto \left(180 \cdot \tan^{-1} \left(-1 + \frac{-A}{B}\right)\right) \cdot \frac{1}{\pi} \]
    11. Applied rewrites55.9%

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

    if -1e-13 < (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64))))))

    1. Initial program 53.6%

      \[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. Step-by-step derivation
      1. lift-sqrt.f64N/A

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

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{\color{blue}{{\left(A - C\right)}^{2} + {B}^{2}}}\right)\right)}{\pi} \]
      3. lift--.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\color{blue}{\left(A - C\right)}}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      4. lift-pow.f64N/A

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

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\color{blue}{\left(A + \left(\mathsf{neg}\left(C\right)\right)\right)}}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      6. mul-1-negN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A + \color{blue}{-1 \cdot C}\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      7. lift-pow.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A + -1 \cdot C\right)}^{2} + \color{blue}{{B}^{2}}}\right)\right)}{\pi} \]
      8. mul-1-negN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A + \color{blue}{\left(\mathsf{neg}\left(C\right)\right)}\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      9. sub-flipN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\color{blue}{\left(A - C\right)}}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      10. sub-negate-revN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\color{blue}{\left(\mathsf{neg}\left(\left(C - A\right)\right)\right)}}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      11. sub-flipN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(\mathsf{neg}\left(\color{blue}{\left(C + \left(\mathsf{neg}\left(A\right)\right)\right)}\right)\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      12. mul-1-negN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(\mathsf{neg}\left(\left(C + \color{blue}{-1 \cdot A}\right)\right)\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      13. unpow-neg-2N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{\color{blue}{{\left(C + -1 \cdot A\right)}^{2}} + {B}^{2}}\right)\right)}{\pi} \]
      14. mul-1-negN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(C + \color{blue}{\left(\mathsf{neg}\left(A\right)\right)}\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      15. sub-flipN/A

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

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

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{\left(C - A\right) \cdot \left(C - A\right) + \color{blue}{B \cdot B}}\right)\right)}{\pi} \]
      18. lower-hypot.f64N/A

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

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

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

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{-1}{2} \cdot \frac{B}{C - A}\right)}}{\pi} \]
    5. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-1}{2} \cdot \color{blue}{\frac{B}{C - A}}\right)}{\pi} \]
      2. lower-/.f64N/A

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

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

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(-0.5 \cdot \frac{B}{C - A}\right)}}{\pi} \]
    7. Step-by-step derivation
      1. lift-PI.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-1}{2} \cdot \frac{B}{C - A}\right)}{\color{blue}{\mathsf{PI}\left(\right)}} \]
      2. lift-/.f64N/A

        \[\leadsto 180 \cdot \color{blue}{\frac{\tan^{-1} \left(\frac{-1}{2} \cdot \frac{B}{C - A}\right)}{\mathsf{PI}\left(\right)}} \]
      3. mult-flipN/A

        \[\leadsto 180 \cdot \color{blue}{\left(\tan^{-1} \left(\frac{-1}{2} \cdot \frac{B}{C - A}\right) \cdot \frac{1}{\mathsf{PI}\left(\right)}\right)} \]
      4. lift-/.f64N/A

        \[\leadsto 180 \cdot \left(\tan^{-1} \left(\frac{-1}{2} \cdot \frac{B}{C - A}\right) \cdot \color{blue}{\frac{1}{\mathsf{PI}\left(\right)}}\right) \]
      5. lift-PI.f64N/A

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

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

      \[\leadsto 180 \cdot \color{blue}{\left(\tan^{-1} \left(\frac{B}{C - A} \cdot -0.5\right) \cdot \frac{1}{\pi}\right)} \]
    9. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \color{blue}{180 \cdot \left(\tan^{-1} \left(\frac{B}{C - A} \cdot \frac{-1}{2}\right) \cdot \frac{1}{\pi}\right)} \]
      2. lift-*.f64N/A

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

        \[\leadsto \color{blue}{\left(180 \cdot \tan^{-1} \left(\frac{B}{C - A} \cdot \frac{-1}{2}\right)\right) \cdot \frac{1}{\pi}} \]
      4. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(180 \cdot \tan^{-1} \left(\frac{B}{C - A} \cdot \frac{-1}{2}\right)\right) \cdot \frac{1}{\pi}} \]
      5. lower-*.f6437.3

        \[\leadsto \color{blue}{\left(180 \cdot \tan^{-1} \left(\frac{B}{C - A} \cdot -0.5\right)\right)} \cdot \frac{1}{\pi} \]
    10. Applied rewrites37.3%

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

Alternative 5: 72.1% accurate, 0.4× speedup?

\[\begin{array}{l} B\_m = \left|B\right| \\ B\_s = \mathsf{copysign}\left(1, B\right) \\ \begin{array}{l} t_0 := \frac{1}{B\_m} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B\_m}^{2}}\right)\\ t_1 := \frac{-A}{B\_m}\\ B\_s \cdot \begin{array}{l} \mathbf{if}\;t\_0 \leq -\infty:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(t\_1 - 1\right)}{\pi}\\ \mathbf{elif}\;t\_0 \leq -1 \cdot 10^{+21}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C - A}{B\_m}\right)}{\pi}\\ \mathbf{elif}\;t\_0 \leq -1 \cdot 10^{-13}:\\ \;\;\;\;\left(180 \cdot \tan^{-1} \left(-1 + t\_1\right)\right) \cdot \frac{1}{\pi}\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(-0.5 \cdot \frac{B\_m}{C - A}\right)}{\pi}\\ \end{array} \end{array} \end{array} \]
B\_m = (fabs.f64 B)
B\_s = (copysign.f64 #s(literal 1 binary64) B)
(FPCore (B_s A B_m C)
 :precision binary64
 (let* ((t_0
         (*
          (/ 1.0 B_m)
          (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B_m 2.0))))))
        (t_1 (/ (- A) B_m)))
   (*
    B_s
    (if (<= t_0 (- INFINITY))
      (* 180.0 (/ (atan (- t_1 1.0)) PI))
      (if (<= t_0 -1e+21)
        (* 180.0 (/ (atan (/ (- C A) B_m)) PI))
        (if (<= t_0 -1e-13)
          (* (* 180.0 (atan (+ -1.0 t_1))) (/ 1.0 PI))
          (* 180.0 (/ (atan (* -0.5 (/ B_m (- C A)))) PI))))))))
B\_m = fabs(B);
B\_s = copysign(1.0, B);
double code(double B_s, double A, double B_m, double C) {
	double t_0 = (1.0 / B_m) * ((C - A) - sqrt((pow((A - C), 2.0) + pow(B_m, 2.0))));
	double t_1 = -A / B_m;
	double tmp;
	if (t_0 <= -((double) INFINITY)) {
		tmp = 180.0 * (atan((t_1 - 1.0)) / ((double) M_PI));
	} else if (t_0 <= -1e+21) {
		tmp = 180.0 * (atan(((C - A) / B_m)) / ((double) M_PI));
	} else if (t_0 <= -1e-13) {
		tmp = (180.0 * atan((-1.0 + t_1))) * (1.0 / ((double) M_PI));
	} else {
		tmp = 180.0 * (atan((-0.5 * (B_m / (C - A)))) / ((double) M_PI));
	}
	return B_s * tmp;
}
B\_m = Math.abs(B);
B\_s = Math.copySign(1.0, B);
public static double code(double B_s, double A, double B_m, double C) {
	double t_0 = (1.0 / B_m) * ((C - A) - Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B_m, 2.0))));
	double t_1 = -A / B_m;
	double tmp;
	if (t_0 <= -Double.POSITIVE_INFINITY) {
		tmp = 180.0 * (Math.atan((t_1 - 1.0)) / Math.PI);
	} else if (t_0 <= -1e+21) {
		tmp = 180.0 * (Math.atan(((C - A) / B_m)) / Math.PI);
	} else if (t_0 <= -1e-13) {
		tmp = (180.0 * Math.atan((-1.0 + t_1))) * (1.0 / Math.PI);
	} else {
		tmp = 180.0 * (Math.atan((-0.5 * (B_m / (C - A)))) / Math.PI);
	}
	return B_s * tmp;
}
B\_m = math.fabs(B)
B\_s = math.copysign(1.0, B)
def code(B_s, A, B_m, C):
	t_0 = (1.0 / B_m) * ((C - A) - math.sqrt((math.pow((A - C), 2.0) + math.pow(B_m, 2.0))))
	t_1 = -A / B_m
	tmp = 0
	if t_0 <= -math.inf:
		tmp = 180.0 * (math.atan((t_1 - 1.0)) / math.pi)
	elif t_0 <= -1e+21:
		tmp = 180.0 * (math.atan(((C - A) / B_m)) / math.pi)
	elif t_0 <= -1e-13:
		tmp = (180.0 * math.atan((-1.0 + t_1))) * (1.0 / math.pi)
	else:
		tmp = 180.0 * (math.atan((-0.5 * (B_m / (C - A)))) / math.pi)
	return B_s * tmp
B\_m = abs(B)
B\_s = copysign(1.0, B)
function code(B_s, A, B_m, C)
	t_0 = Float64(Float64(1.0 / B_m) * Float64(Float64(C - A) - sqrt(Float64((Float64(A - C) ^ 2.0) + (B_m ^ 2.0)))))
	t_1 = Float64(Float64(-A) / B_m)
	tmp = 0.0
	if (t_0 <= Float64(-Inf))
		tmp = Float64(180.0 * Float64(atan(Float64(t_1 - 1.0)) / pi));
	elseif (t_0 <= -1e+21)
		tmp = Float64(180.0 * Float64(atan(Float64(Float64(C - A) / B_m)) / pi));
	elseif (t_0 <= -1e-13)
		tmp = Float64(Float64(180.0 * atan(Float64(-1.0 + t_1))) * Float64(1.0 / pi));
	else
		tmp = Float64(180.0 * Float64(atan(Float64(-0.5 * Float64(B_m / Float64(C - A)))) / pi));
	end
	return Float64(B_s * tmp)
end
B\_m = abs(B);
B\_s = sign(B) * abs(1.0);
function tmp_2 = code(B_s, A, B_m, C)
	t_0 = (1.0 / B_m) * ((C - A) - sqrt((((A - C) ^ 2.0) + (B_m ^ 2.0))));
	t_1 = -A / B_m;
	tmp = 0.0;
	if (t_0 <= -Inf)
		tmp = 180.0 * (atan((t_1 - 1.0)) / pi);
	elseif (t_0 <= -1e+21)
		tmp = 180.0 * (atan(((C - A) / B_m)) / pi);
	elseif (t_0 <= -1e-13)
		tmp = (180.0 * atan((-1.0 + t_1))) * (1.0 / pi);
	else
		tmp = 180.0 * (atan((-0.5 * (B_m / (C - A)))) / pi);
	end
	tmp_2 = B_s * tmp;
end
B\_m = N[Abs[B], $MachinePrecision]
B\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[B]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[B$95$s_, A_, B$95$m_, C_] := Block[{t$95$0 = N[(N[(1.0 / B$95$m), $MachinePrecision] * N[(N[(C - A), $MachinePrecision] - N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[((-A) / B$95$m), $MachinePrecision]}, N[(B$95$s * If[LessEqual[t$95$0, (-Infinity)], N[(180.0 * N[(N[ArcTan[N[(t$95$1 - 1.0), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, -1e+21], N[(180.0 * N[(N[ArcTan[N[(N[(C - A), $MachinePrecision] / B$95$m), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, -1e-13], N[(N[(180.0 * N[ArcTan[N[(-1.0 + t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 / Pi), $MachinePrecision]), $MachinePrecision], N[(180.0 * N[(N[ArcTan[N[(-0.5 * N[(B$95$m / N[(C - A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]]]]), $MachinePrecision]]]
\begin{array}{l}
B\_m = \left|B\right|
\\
B\_s = \mathsf{copysign}\left(1, B\right)

\\
\begin{array}{l}
t_0 := \frac{1}{B\_m} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B\_m}^{2}}\right)\\
t_1 := \frac{-A}{B\_m}\\
B\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(t\_1 - 1\right)}{\pi}\\

\mathbf{elif}\;t\_0 \leq -1 \cdot 10^{+21}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C - A}{B\_m}\right)}{\pi}\\

\mathbf{elif}\;t\_0 \leq -1 \cdot 10^{-13}:\\
\;\;\;\;\left(180 \cdot \tan^{-1} \left(-1 + t\_1\right)\right) \cdot \frac{1}{\pi}\\

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


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))) < -inf.0

    1. Initial program 53.6%

      \[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. Taylor expanded in C around 0

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(-1 \cdot \frac{A + \sqrt{{A}^{2} + {B}^{2}}}{B}\right)}}{\pi} \]
    3. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-1 \cdot \left(A + \sqrt{{A}^{2} + {B}^{2}}\right)}{\color{blue}{B}}\right)}{\pi} \]
      2. mul-1-negN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{neg}\left(\left(A + \sqrt{{A}^{2} + {B}^{2}}\right)\right)}{B}\right)}{\pi} \]
      3. lower-/.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{neg}\left(\left(A + \sqrt{{A}^{2} + {B}^{2}}\right)\right)}{\color{blue}{B}}\right)}{\pi} \]
      4. lower-neg.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-\left(A + \sqrt{{A}^{2} + {B}^{2}}\right)}{B}\right)}{\pi} \]
      5. +-commutativeN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-\left(\sqrt{{A}^{2} + {B}^{2}} + A\right)}{B}\right)}{\pi} \]
      6. lower-+.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-\left(\sqrt{{A}^{2} + {B}^{2}} + A\right)}{B}\right)}{\pi} \]
      7. lower-sqrt.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-\left(\sqrt{{A}^{2} + {B}^{2}} + A\right)}{B}\right)}{\pi} \]
      8. unpow2N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-\left(\sqrt{A \cdot A + {B}^{2}} + A\right)}{B}\right)}{\pi} \]
      9. lower-fma.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-\left(\sqrt{\mathsf{fma}\left(A, A, {B}^{2}\right)} + A\right)}{B}\right)}{\pi} \]
      10. unpow2N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-\left(\sqrt{\mathsf{fma}\left(A, A, B \cdot B\right)} + A\right)}{B}\right)}{\pi} \]
      11. lower-*.f6444.4

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-\left(\sqrt{\mathsf{fma}\left(A, A, B \cdot B\right)} + A\right)}{B}\right)}{\pi} \]
    4. Applied rewrites44.4%

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{-\left(\sqrt{\mathsf{fma}\left(A, A, B \cdot B\right)} + A\right)}{B}\right)}}{\pi} \]
    5. Taylor expanded in A around 0

      \[\leadsto 180 \cdot \frac{\tan^{-1} \left(-1 \cdot \frac{A}{B} - \color{blue}{1}\right)}{\pi} \]
    6. Step-by-step derivation
      1. lower--.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(-1 \cdot \frac{A}{B} - 1\right)}{\pi} \]
      2. associate-*r/N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-1 \cdot A}{B} - 1\right)}{\pi} \]
      3. mul-1-negN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{neg}\left(A\right)}{B} - 1\right)}{\pi} \]
      4. lower-/.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{neg}\left(A\right)}{B} - 1\right)}{\pi} \]
      5. lower-neg.f6455.9

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-A}{B} - 1\right)}{\pi} \]
    7. Applied rewrites55.9%

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

    if -inf.0 < (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))) < -1e21

    1. Initial program 53.6%

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

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{C}{B} - \left(1 + \frac{A}{B}\right)\right)}}{\pi} \]
    3. Step-by-step derivation
      1. associate--r+N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \color{blue}{\frac{A}{B}}\right)}{\pi} \]
      2. lower--.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \color{blue}{\frac{A}{B}}\right)}{\pi} \]
      3. lower--.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{\color{blue}{A}}{B}\right)}{\pi} \]
      4. lower-/.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right)}{\pi} \]
      5. lower-/.f6465.1

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{\color{blue}{B}}\right)}{\pi} \]
    4. Applied rewrites65.1%

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

      \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{C - A}{\color{blue}{B}}\right)}{\pi} \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{C - A}{B}\right)}{\pi} \]
      2. lift--.f6434.6

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{C - A}{B}\right)}{\pi} \]
    7. Applied rewrites34.6%

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

    if -1e21 < (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))) < -1e-13

    1. Initial program 53.6%

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

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{C}{B} - \left(1 + \frac{A}{B}\right)\right)}}{\pi} \]
    3. Step-by-step derivation
      1. associate--r+N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \color{blue}{\frac{A}{B}}\right)}{\pi} \]
      2. lower--.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \color{blue}{\frac{A}{B}}\right)}{\pi} \]
      3. lower--.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{\color{blue}{A}}{B}\right)}{\pi} \]
      4. lower-/.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right)}{\pi} \]
      5. lower-/.f6465.1

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{\color{blue}{B}}\right)}{\pi} \]
    4. Applied rewrites65.1%

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right)}}{\pi} \]
    5. Step-by-step derivation
      1. lift-PI.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right)}{\color{blue}{\mathsf{PI}\left(\right)}} \]
      2. lift-/.f64N/A

        \[\leadsto 180 \cdot \color{blue}{\frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right)}{\mathsf{PI}\left(\right)}} \]
      3. mult-flipN/A

        \[\leadsto 180 \cdot \color{blue}{\left(\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right) \cdot \frac{1}{\mathsf{PI}\left(\right)}\right)} \]
      4. lower-*.f64N/A

        \[\leadsto 180 \cdot \color{blue}{\left(\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right) \cdot \frac{1}{\mathsf{PI}\left(\right)}\right)} \]
    6. Applied rewrites65.1%

      \[\leadsto 180 \cdot \color{blue}{\left(\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right) \cdot \frac{1}{\pi}\right)} \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \color{blue}{180 \cdot \left(\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right) \cdot \frac{1}{\pi}\right)} \]
      2. lift-*.f64N/A

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

        \[\leadsto \color{blue}{\left(180 \cdot \tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right)\right) \cdot \frac{1}{\pi}} \]
      4. lower-*.f64N/A

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

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

      \[\leadsto \left(180 \cdot \tan^{-1} \left(-1 \cdot \color{blue}{\left(1 + \frac{A}{B}\right)}\right)\right) \cdot \frac{1}{\pi} \]
    10. Step-by-step derivation
      1. distribute-lft-inN/A

        \[\leadsto \left(180 \cdot \tan^{-1} \left(-1 \cdot 1 + -1 \cdot \color{blue}{\frac{A}{B}}\right)\right) \cdot \frac{1}{\pi} \]
      2. metadata-evalN/A

        \[\leadsto \left(180 \cdot \tan^{-1} \left(-1 + -1 \cdot \frac{\color{blue}{A}}{B}\right)\right) \cdot \frac{1}{\pi} \]
      3. lower-+.f64N/A

        \[\leadsto \left(180 \cdot \tan^{-1} \left(-1 + -1 \cdot \color{blue}{\frac{A}{B}}\right)\right) \cdot \frac{1}{\pi} \]
      4. mul-1-negN/A

        \[\leadsto \left(180 \cdot \tan^{-1} \left(-1 + \left(\mathsf{neg}\left(\frac{A}{B}\right)\right)\right)\right) \cdot \frac{1}{\pi} \]
      5. distribute-frac-negN/A

        \[\leadsto \left(180 \cdot \tan^{-1} \left(-1 + \frac{\mathsf{neg}\left(A\right)}{B}\right)\right) \cdot \frac{1}{\pi} \]
      6. lift-neg.f64N/A

        \[\leadsto \left(180 \cdot \tan^{-1} \left(-1 + \frac{-A}{B}\right)\right) \cdot \frac{1}{\pi} \]
      7. lift-/.f6455.9

        \[\leadsto \left(180 \cdot \tan^{-1} \left(-1 + \frac{-A}{B}\right)\right) \cdot \frac{1}{\pi} \]
    11. Applied rewrites55.9%

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

    if -1e-13 < (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64))))))

    1. Initial program 53.6%

      \[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. Step-by-step derivation
      1. lift-sqrt.f64N/A

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

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{\color{blue}{{\left(A - C\right)}^{2} + {B}^{2}}}\right)\right)}{\pi} \]
      3. lift--.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\color{blue}{\left(A - C\right)}}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      4. lift-pow.f64N/A

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

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\color{blue}{\left(A + \left(\mathsf{neg}\left(C\right)\right)\right)}}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      6. mul-1-negN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A + \color{blue}{-1 \cdot C}\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      7. lift-pow.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A + -1 \cdot C\right)}^{2} + \color{blue}{{B}^{2}}}\right)\right)}{\pi} \]
      8. mul-1-negN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A + \color{blue}{\left(\mathsf{neg}\left(C\right)\right)}\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      9. sub-flipN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\color{blue}{\left(A - C\right)}}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      10. sub-negate-revN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\color{blue}{\left(\mathsf{neg}\left(\left(C - A\right)\right)\right)}}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      11. sub-flipN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(\mathsf{neg}\left(\color{blue}{\left(C + \left(\mathsf{neg}\left(A\right)\right)\right)}\right)\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      12. mul-1-negN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(\mathsf{neg}\left(\left(C + \color{blue}{-1 \cdot A}\right)\right)\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      13. unpow-neg-2N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{\color{blue}{{\left(C + -1 \cdot A\right)}^{2}} + {B}^{2}}\right)\right)}{\pi} \]
      14. mul-1-negN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(C + \color{blue}{\left(\mathsf{neg}\left(A\right)\right)}\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      15. sub-flipN/A

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

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

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{\left(C - A\right) \cdot \left(C - A\right) + \color{blue}{B \cdot B}}\right)\right)}{\pi} \]
      18. lower-hypot.f64N/A

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

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

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

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{-1}{2} \cdot \frac{B}{C - A}\right)}}{\pi} \]
    5. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-1}{2} \cdot \color{blue}{\frac{B}{C - A}}\right)}{\pi} \]
      2. lower-/.f64N/A

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

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

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

Alternative 6: 72.1% accurate, 0.4× speedup?

\[\begin{array}{l} B\_m = \left|B\right| \\ B\_s = \mathsf{copysign}\left(1, B\right) \\ \begin{array}{l} t_0 := \frac{1}{B\_m} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B\_m}^{2}}\right)\\ t_1 := 180 \cdot \frac{\tan^{-1} \left(\frac{-A}{B\_m} - 1\right)}{\pi}\\ B\_s \cdot \begin{array}{l} \mathbf{if}\;t\_0 \leq -\infty:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_0 \leq -1 \cdot 10^{+21}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C - A}{B\_m}\right)}{\pi}\\ \mathbf{elif}\;t\_0 \leq -1 \cdot 10^{-13}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(-0.5 \cdot \frac{B\_m}{C - A}\right)}{\pi}\\ \end{array} \end{array} \end{array} \]
B\_m = (fabs.f64 B)
B\_s = (copysign.f64 #s(literal 1 binary64) B)
(FPCore (B_s A B_m C)
 :precision binary64
 (let* ((t_0
         (*
          (/ 1.0 B_m)
          (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B_m 2.0))))))
        (t_1 (* 180.0 (/ (atan (- (/ (- A) B_m) 1.0)) PI))))
   (*
    B_s
    (if (<= t_0 (- INFINITY))
      t_1
      (if (<= t_0 -1e+21)
        (* 180.0 (/ (atan (/ (- C A) B_m)) PI))
        (if (<= t_0 -1e-13)
          t_1
          (* 180.0 (/ (atan (* -0.5 (/ B_m (- C A)))) PI))))))))
B\_m = fabs(B);
B\_s = copysign(1.0, B);
double code(double B_s, double A, double B_m, double C) {
	double t_0 = (1.0 / B_m) * ((C - A) - sqrt((pow((A - C), 2.0) + pow(B_m, 2.0))));
	double t_1 = 180.0 * (atan(((-A / B_m) - 1.0)) / ((double) M_PI));
	double tmp;
	if (t_0 <= -((double) INFINITY)) {
		tmp = t_1;
	} else if (t_0 <= -1e+21) {
		tmp = 180.0 * (atan(((C - A) / B_m)) / ((double) M_PI));
	} else if (t_0 <= -1e-13) {
		tmp = t_1;
	} else {
		tmp = 180.0 * (atan((-0.5 * (B_m / (C - A)))) / ((double) M_PI));
	}
	return B_s * tmp;
}
B\_m = Math.abs(B);
B\_s = Math.copySign(1.0, B);
public static double code(double B_s, double A, double B_m, double C) {
	double t_0 = (1.0 / B_m) * ((C - A) - Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B_m, 2.0))));
	double t_1 = 180.0 * (Math.atan(((-A / B_m) - 1.0)) / Math.PI);
	double tmp;
	if (t_0 <= -Double.POSITIVE_INFINITY) {
		tmp = t_1;
	} else if (t_0 <= -1e+21) {
		tmp = 180.0 * (Math.atan(((C - A) / B_m)) / Math.PI);
	} else if (t_0 <= -1e-13) {
		tmp = t_1;
	} else {
		tmp = 180.0 * (Math.atan((-0.5 * (B_m / (C - A)))) / Math.PI);
	}
	return B_s * tmp;
}
B\_m = math.fabs(B)
B\_s = math.copysign(1.0, B)
def code(B_s, A, B_m, C):
	t_0 = (1.0 / B_m) * ((C - A) - math.sqrt((math.pow((A - C), 2.0) + math.pow(B_m, 2.0))))
	t_1 = 180.0 * (math.atan(((-A / B_m) - 1.0)) / math.pi)
	tmp = 0
	if t_0 <= -math.inf:
		tmp = t_1
	elif t_0 <= -1e+21:
		tmp = 180.0 * (math.atan(((C - A) / B_m)) / math.pi)
	elif t_0 <= -1e-13:
		tmp = t_1
	else:
		tmp = 180.0 * (math.atan((-0.5 * (B_m / (C - A)))) / math.pi)
	return B_s * tmp
B\_m = abs(B)
B\_s = copysign(1.0, B)
function code(B_s, A, B_m, C)
	t_0 = Float64(Float64(1.0 / B_m) * Float64(Float64(C - A) - sqrt(Float64((Float64(A - C) ^ 2.0) + (B_m ^ 2.0)))))
	t_1 = Float64(180.0 * Float64(atan(Float64(Float64(Float64(-A) / B_m) - 1.0)) / pi))
	tmp = 0.0
	if (t_0 <= Float64(-Inf))
		tmp = t_1;
	elseif (t_0 <= -1e+21)
		tmp = Float64(180.0 * Float64(atan(Float64(Float64(C - A) / B_m)) / pi));
	elseif (t_0 <= -1e-13)
		tmp = t_1;
	else
		tmp = Float64(180.0 * Float64(atan(Float64(-0.5 * Float64(B_m / Float64(C - A)))) / pi));
	end
	return Float64(B_s * tmp)
end
B\_m = abs(B);
B\_s = sign(B) * abs(1.0);
function tmp_2 = code(B_s, A, B_m, C)
	t_0 = (1.0 / B_m) * ((C - A) - sqrt((((A - C) ^ 2.0) + (B_m ^ 2.0))));
	t_1 = 180.0 * (atan(((-A / B_m) - 1.0)) / pi);
	tmp = 0.0;
	if (t_0 <= -Inf)
		tmp = t_1;
	elseif (t_0 <= -1e+21)
		tmp = 180.0 * (atan(((C - A) / B_m)) / pi);
	elseif (t_0 <= -1e-13)
		tmp = t_1;
	else
		tmp = 180.0 * (atan((-0.5 * (B_m / (C - A)))) / pi);
	end
	tmp_2 = B_s * tmp;
end
B\_m = N[Abs[B], $MachinePrecision]
B\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[B]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[B$95$s_, A_, B$95$m_, C_] := Block[{t$95$0 = N[(N[(1.0 / B$95$m), $MachinePrecision] * N[(N[(C - A), $MachinePrecision] - N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(180.0 * N[(N[ArcTan[N[(N[((-A) / B$95$m), $MachinePrecision] - 1.0), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]}, N[(B$95$s * If[LessEqual[t$95$0, (-Infinity)], t$95$1, If[LessEqual[t$95$0, -1e+21], N[(180.0 * N[(N[ArcTan[N[(N[(C - A), $MachinePrecision] / B$95$m), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, -1e-13], t$95$1, N[(180.0 * N[(N[ArcTan[N[(-0.5 * N[(B$95$m / N[(C - A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]]]]), $MachinePrecision]]]
\begin{array}{l}
B\_m = \left|B\right|
\\
B\_s = \mathsf{copysign}\left(1, B\right)

\\
\begin{array}{l}
t_0 := \frac{1}{B\_m} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B\_m}^{2}}\right)\\
t_1 := 180 \cdot \frac{\tan^{-1} \left(\frac{-A}{B\_m} - 1\right)}{\pi}\\
B\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_0 \leq -1 \cdot 10^{+21}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C - A}{B\_m}\right)}{\pi}\\

\mathbf{elif}\;t\_0 \leq -1 \cdot 10^{-13}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))) < -inf.0 or -1e21 < (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))) < -1e-13

    1. Initial program 53.6%

      \[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. Taylor expanded in C around 0

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(-1 \cdot \frac{A + \sqrt{{A}^{2} + {B}^{2}}}{B}\right)}}{\pi} \]
    3. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-1 \cdot \left(A + \sqrt{{A}^{2} + {B}^{2}}\right)}{\color{blue}{B}}\right)}{\pi} \]
      2. mul-1-negN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{neg}\left(\left(A + \sqrt{{A}^{2} + {B}^{2}}\right)\right)}{B}\right)}{\pi} \]
      3. lower-/.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{neg}\left(\left(A + \sqrt{{A}^{2} + {B}^{2}}\right)\right)}{\color{blue}{B}}\right)}{\pi} \]
      4. lower-neg.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-\left(A + \sqrt{{A}^{2} + {B}^{2}}\right)}{B}\right)}{\pi} \]
      5. +-commutativeN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-\left(\sqrt{{A}^{2} + {B}^{2}} + A\right)}{B}\right)}{\pi} \]
      6. lower-+.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-\left(\sqrt{{A}^{2} + {B}^{2}} + A\right)}{B}\right)}{\pi} \]
      7. lower-sqrt.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-\left(\sqrt{{A}^{2} + {B}^{2}} + A\right)}{B}\right)}{\pi} \]
      8. unpow2N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-\left(\sqrt{A \cdot A + {B}^{2}} + A\right)}{B}\right)}{\pi} \]
      9. lower-fma.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-\left(\sqrt{\mathsf{fma}\left(A, A, {B}^{2}\right)} + A\right)}{B}\right)}{\pi} \]
      10. unpow2N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-\left(\sqrt{\mathsf{fma}\left(A, A, B \cdot B\right)} + A\right)}{B}\right)}{\pi} \]
      11. lower-*.f6444.4

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-\left(\sqrt{\mathsf{fma}\left(A, A, B \cdot B\right)} + A\right)}{B}\right)}{\pi} \]
    4. Applied rewrites44.4%

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{-\left(\sqrt{\mathsf{fma}\left(A, A, B \cdot B\right)} + A\right)}{B}\right)}}{\pi} \]
    5. Taylor expanded in A around 0

      \[\leadsto 180 \cdot \frac{\tan^{-1} \left(-1 \cdot \frac{A}{B} - \color{blue}{1}\right)}{\pi} \]
    6. Step-by-step derivation
      1. lower--.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(-1 \cdot \frac{A}{B} - 1\right)}{\pi} \]
      2. associate-*r/N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-1 \cdot A}{B} - 1\right)}{\pi} \]
      3. mul-1-negN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{neg}\left(A\right)}{B} - 1\right)}{\pi} \]
      4. lower-/.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{neg}\left(A\right)}{B} - 1\right)}{\pi} \]
      5. lower-neg.f6455.9

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-A}{B} - 1\right)}{\pi} \]
    7. Applied rewrites55.9%

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

    if -inf.0 < (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))) < -1e21

    1. Initial program 53.6%

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

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{C}{B} - \left(1 + \frac{A}{B}\right)\right)}}{\pi} \]
    3. Step-by-step derivation
      1. associate--r+N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \color{blue}{\frac{A}{B}}\right)}{\pi} \]
      2. lower--.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \color{blue}{\frac{A}{B}}\right)}{\pi} \]
      3. lower--.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{\color{blue}{A}}{B}\right)}{\pi} \]
      4. lower-/.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right)}{\pi} \]
      5. lower-/.f6465.1

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{\color{blue}{B}}\right)}{\pi} \]
    4. Applied rewrites65.1%

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

      \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{C - A}{\color{blue}{B}}\right)}{\pi} \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{C - A}{B}\right)}{\pi} \]
      2. lift--.f6434.6

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{C - A}{B}\right)}{\pi} \]
    7. Applied rewrites34.6%

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

    if -1e-13 < (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64))))))

    1. Initial program 53.6%

      \[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. Step-by-step derivation
      1. lift-sqrt.f64N/A

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

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{\color{blue}{{\left(A - C\right)}^{2} + {B}^{2}}}\right)\right)}{\pi} \]
      3. lift--.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\color{blue}{\left(A - C\right)}}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      4. lift-pow.f64N/A

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

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\color{blue}{\left(A + \left(\mathsf{neg}\left(C\right)\right)\right)}}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      6. mul-1-negN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A + \color{blue}{-1 \cdot C}\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      7. lift-pow.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A + -1 \cdot C\right)}^{2} + \color{blue}{{B}^{2}}}\right)\right)}{\pi} \]
      8. mul-1-negN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A + \color{blue}{\left(\mathsf{neg}\left(C\right)\right)}\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      9. sub-flipN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\color{blue}{\left(A - C\right)}}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      10. sub-negate-revN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\color{blue}{\left(\mathsf{neg}\left(\left(C - A\right)\right)\right)}}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      11. sub-flipN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(\mathsf{neg}\left(\color{blue}{\left(C + \left(\mathsf{neg}\left(A\right)\right)\right)}\right)\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      12. mul-1-negN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(\mathsf{neg}\left(\left(C + \color{blue}{-1 \cdot A}\right)\right)\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      13. unpow-neg-2N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{\color{blue}{{\left(C + -1 \cdot A\right)}^{2}} + {B}^{2}}\right)\right)}{\pi} \]
      14. mul-1-negN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(C + \color{blue}{\left(\mathsf{neg}\left(A\right)\right)}\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      15. sub-flipN/A

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

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

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{\left(C - A\right) \cdot \left(C - A\right) + \color{blue}{B \cdot B}}\right)\right)}{\pi} \]
      18. lower-hypot.f64N/A

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

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

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

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{-1}{2} \cdot \frac{B}{C - A}\right)}}{\pi} \]
    5. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-1}{2} \cdot \color{blue}{\frac{B}{C - A}}\right)}{\pi} \]
      2. lower-/.f64N/A

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

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

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

Alternative 7: 72.1% accurate, 0.4× speedup?

\[\begin{array}{l} B\_m = \left|B\right| \\ B\_s = \mathsf{copysign}\left(1, B\right) \\ \begin{array}{l} t_0 := \frac{1}{B\_m} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B\_m}^{2}}\right)\\ t_1 := 180 \cdot \frac{\tan^{-1} \left(\frac{-A}{B\_m} - 1\right)}{\pi}\\ B\_s \cdot \begin{array}{l} \mathbf{if}\;t\_0 \leq -\infty:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_0 \leq -1 \cdot 10^{+21}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C - A}{B\_m}\right)}{\pi}\\ \mathbf{elif}\;t\_0 \leq -1 \cdot 10^{-13}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;\frac{180 \cdot \tan^{-1} \left(\frac{B\_m}{C - A} \cdot -0.5\right)}{\pi}\\ \end{array} \end{array} \end{array} \]
B\_m = (fabs.f64 B)
B\_s = (copysign.f64 #s(literal 1 binary64) B)
(FPCore (B_s A B_m C)
 :precision binary64
 (let* ((t_0
         (*
          (/ 1.0 B_m)
          (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B_m 2.0))))))
        (t_1 (* 180.0 (/ (atan (- (/ (- A) B_m) 1.0)) PI))))
   (*
    B_s
    (if (<= t_0 (- INFINITY))
      t_1
      (if (<= t_0 -1e+21)
        (* 180.0 (/ (atan (/ (- C A) B_m)) PI))
        (if (<= t_0 -1e-13)
          t_1
          (/ (* 180.0 (atan (* (/ B_m (- C A)) -0.5))) PI)))))))
B\_m = fabs(B);
B\_s = copysign(1.0, B);
double code(double B_s, double A, double B_m, double C) {
	double t_0 = (1.0 / B_m) * ((C - A) - sqrt((pow((A - C), 2.0) + pow(B_m, 2.0))));
	double t_1 = 180.0 * (atan(((-A / B_m) - 1.0)) / ((double) M_PI));
	double tmp;
	if (t_0 <= -((double) INFINITY)) {
		tmp = t_1;
	} else if (t_0 <= -1e+21) {
		tmp = 180.0 * (atan(((C - A) / B_m)) / ((double) M_PI));
	} else if (t_0 <= -1e-13) {
		tmp = t_1;
	} else {
		tmp = (180.0 * atan(((B_m / (C - A)) * -0.5))) / ((double) M_PI);
	}
	return B_s * tmp;
}
B\_m = Math.abs(B);
B\_s = Math.copySign(1.0, B);
public static double code(double B_s, double A, double B_m, double C) {
	double t_0 = (1.0 / B_m) * ((C - A) - Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B_m, 2.0))));
	double t_1 = 180.0 * (Math.atan(((-A / B_m) - 1.0)) / Math.PI);
	double tmp;
	if (t_0 <= -Double.POSITIVE_INFINITY) {
		tmp = t_1;
	} else if (t_0 <= -1e+21) {
		tmp = 180.0 * (Math.atan(((C - A) / B_m)) / Math.PI);
	} else if (t_0 <= -1e-13) {
		tmp = t_1;
	} else {
		tmp = (180.0 * Math.atan(((B_m / (C - A)) * -0.5))) / Math.PI;
	}
	return B_s * tmp;
}
B\_m = math.fabs(B)
B\_s = math.copysign(1.0, B)
def code(B_s, A, B_m, C):
	t_0 = (1.0 / B_m) * ((C - A) - math.sqrt((math.pow((A - C), 2.0) + math.pow(B_m, 2.0))))
	t_1 = 180.0 * (math.atan(((-A / B_m) - 1.0)) / math.pi)
	tmp = 0
	if t_0 <= -math.inf:
		tmp = t_1
	elif t_0 <= -1e+21:
		tmp = 180.0 * (math.atan(((C - A) / B_m)) / math.pi)
	elif t_0 <= -1e-13:
		tmp = t_1
	else:
		tmp = (180.0 * math.atan(((B_m / (C - A)) * -0.5))) / math.pi
	return B_s * tmp
B\_m = abs(B)
B\_s = copysign(1.0, B)
function code(B_s, A, B_m, C)
	t_0 = Float64(Float64(1.0 / B_m) * Float64(Float64(C - A) - sqrt(Float64((Float64(A - C) ^ 2.0) + (B_m ^ 2.0)))))
	t_1 = Float64(180.0 * Float64(atan(Float64(Float64(Float64(-A) / B_m) - 1.0)) / pi))
	tmp = 0.0
	if (t_0 <= Float64(-Inf))
		tmp = t_1;
	elseif (t_0 <= -1e+21)
		tmp = Float64(180.0 * Float64(atan(Float64(Float64(C - A) / B_m)) / pi));
	elseif (t_0 <= -1e-13)
		tmp = t_1;
	else
		tmp = Float64(Float64(180.0 * atan(Float64(Float64(B_m / Float64(C - A)) * -0.5))) / pi);
	end
	return Float64(B_s * tmp)
end
B\_m = abs(B);
B\_s = sign(B) * abs(1.0);
function tmp_2 = code(B_s, A, B_m, C)
	t_0 = (1.0 / B_m) * ((C - A) - sqrt((((A - C) ^ 2.0) + (B_m ^ 2.0))));
	t_1 = 180.0 * (atan(((-A / B_m) - 1.0)) / pi);
	tmp = 0.0;
	if (t_0 <= -Inf)
		tmp = t_1;
	elseif (t_0 <= -1e+21)
		tmp = 180.0 * (atan(((C - A) / B_m)) / pi);
	elseif (t_0 <= -1e-13)
		tmp = t_1;
	else
		tmp = (180.0 * atan(((B_m / (C - A)) * -0.5))) / pi;
	end
	tmp_2 = B_s * tmp;
end
B\_m = N[Abs[B], $MachinePrecision]
B\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[B]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[B$95$s_, A_, B$95$m_, C_] := Block[{t$95$0 = N[(N[(1.0 / B$95$m), $MachinePrecision] * N[(N[(C - A), $MachinePrecision] - N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(180.0 * N[(N[ArcTan[N[(N[((-A) / B$95$m), $MachinePrecision] - 1.0), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]}, N[(B$95$s * If[LessEqual[t$95$0, (-Infinity)], t$95$1, If[LessEqual[t$95$0, -1e+21], N[(180.0 * N[(N[ArcTan[N[(N[(C - A), $MachinePrecision] / B$95$m), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, -1e-13], t$95$1, N[(N[(180.0 * N[ArcTan[N[(N[(B$95$m / N[(C - A), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / Pi), $MachinePrecision]]]]), $MachinePrecision]]]
\begin{array}{l}
B\_m = \left|B\right|
\\
B\_s = \mathsf{copysign}\left(1, B\right)

\\
\begin{array}{l}
t_0 := \frac{1}{B\_m} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B\_m}^{2}}\right)\\
t_1 := 180 \cdot \frac{\tan^{-1} \left(\frac{-A}{B\_m} - 1\right)}{\pi}\\
B\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_0 \leq -1 \cdot 10^{+21}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C - A}{B\_m}\right)}{\pi}\\

\mathbf{elif}\;t\_0 \leq -1 \cdot 10^{-13}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))) < -inf.0 or -1e21 < (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))) < -1e-13

    1. Initial program 53.6%

      \[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. Taylor expanded in C around 0

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(-1 \cdot \frac{A + \sqrt{{A}^{2} + {B}^{2}}}{B}\right)}}{\pi} \]
    3. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-1 \cdot \left(A + \sqrt{{A}^{2} + {B}^{2}}\right)}{\color{blue}{B}}\right)}{\pi} \]
      2. mul-1-negN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{neg}\left(\left(A + \sqrt{{A}^{2} + {B}^{2}}\right)\right)}{B}\right)}{\pi} \]
      3. lower-/.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{neg}\left(\left(A + \sqrt{{A}^{2} + {B}^{2}}\right)\right)}{\color{blue}{B}}\right)}{\pi} \]
      4. lower-neg.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-\left(A + \sqrt{{A}^{2} + {B}^{2}}\right)}{B}\right)}{\pi} \]
      5. +-commutativeN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-\left(\sqrt{{A}^{2} + {B}^{2}} + A\right)}{B}\right)}{\pi} \]
      6. lower-+.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-\left(\sqrt{{A}^{2} + {B}^{2}} + A\right)}{B}\right)}{\pi} \]
      7. lower-sqrt.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-\left(\sqrt{{A}^{2} + {B}^{2}} + A\right)}{B}\right)}{\pi} \]
      8. unpow2N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-\left(\sqrt{A \cdot A + {B}^{2}} + A\right)}{B}\right)}{\pi} \]
      9. lower-fma.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-\left(\sqrt{\mathsf{fma}\left(A, A, {B}^{2}\right)} + A\right)}{B}\right)}{\pi} \]
      10. unpow2N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-\left(\sqrt{\mathsf{fma}\left(A, A, B \cdot B\right)} + A\right)}{B}\right)}{\pi} \]
      11. lower-*.f6444.4

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-\left(\sqrt{\mathsf{fma}\left(A, A, B \cdot B\right)} + A\right)}{B}\right)}{\pi} \]
    4. Applied rewrites44.4%

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{-\left(\sqrt{\mathsf{fma}\left(A, A, B \cdot B\right)} + A\right)}{B}\right)}}{\pi} \]
    5. Taylor expanded in A around 0

      \[\leadsto 180 \cdot \frac{\tan^{-1} \left(-1 \cdot \frac{A}{B} - \color{blue}{1}\right)}{\pi} \]
    6. Step-by-step derivation
      1. lower--.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(-1 \cdot \frac{A}{B} - 1\right)}{\pi} \]
      2. associate-*r/N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-1 \cdot A}{B} - 1\right)}{\pi} \]
      3. mul-1-negN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{neg}\left(A\right)}{B} - 1\right)}{\pi} \]
      4. lower-/.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{neg}\left(A\right)}{B} - 1\right)}{\pi} \]
      5. lower-neg.f6455.9

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-A}{B} - 1\right)}{\pi} \]
    7. Applied rewrites55.9%

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

    if -inf.0 < (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))) < -1e21

    1. Initial program 53.6%

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

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{C}{B} - \left(1 + \frac{A}{B}\right)\right)}}{\pi} \]
    3. Step-by-step derivation
      1. associate--r+N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \color{blue}{\frac{A}{B}}\right)}{\pi} \]
      2. lower--.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \color{blue}{\frac{A}{B}}\right)}{\pi} \]
      3. lower--.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{\color{blue}{A}}{B}\right)}{\pi} \]
      4. lower-/.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right)}{\pi} \]
      5. lower-/.f6465.1

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{\color{blue}{B}}\right)}{\pi} \]
    4. Applied rewrites65.1%

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

      \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{C - A}{\color{blue}{B}}\right)}{\pi} \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{C - A}{B}\right)}{\pi} \]
      2. lift--.f6434.6

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{C - A}{B}\right)}{\pi} \]
    7. Applied rewrites34.6%

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

    if -1e-13 < (*.f64 (/.f64 #s(literal 1 binary64) B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64))))))

    1. Initial program 53.6%

      \[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. Step-by-step derivation
      1. lift-sqrt.f64N/A

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

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{\color{blue}{{\left(A - C\right)}^{2} + {B}^{2}}}\right)\right)}{\pi} \]
      3. lift--.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\color{blue}{\left(A - C\right)}}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      4. lift-pow.f64N/A

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

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\color{blue}{\left(A + \left(\mathsf{neg}\left(C\right)\right)\right)}}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      6. mul-1-negN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A + \color{blue}{-1 \cdot C}\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      7. lift-pow.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A + -1 \cdot C\right)}^{2} + \color{blue}{{B}^{2}}}\right)\right)}{\pi} \]
      8. mul-1-negN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A + \color{blue}{\left(\mathsf{neg}\left(C\right)\right)}\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      9. sub-flipN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\color{blue}{\left(A - C\right)}}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      10. sub-negate-revN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\color{blue}{\left(\mathsf{neg}\left(\left(C - A\right)\right)\right)}}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      11. sub-flipN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(\mathsf{neg}\left(\color{blue}{\left(C + \left(\mathsf{neg}\left(A\right)\right)\right)}\right)\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      12. mul-1-negN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(\mathsf{neg}\left(\left(C + \color{blue}{-1 \cdot A}\right)\right)\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      13. unpow-neg-2N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{\color{blue}{{\left(C + -1 \cdot A\right)}^{2}} + {B}^{2}}\right)\right)}{\pi} \]
      14. mul-1-negN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(C + \color{blue}{\left(\mathsf{neg}\left(A\right)\right)}\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      15. sub-flipN/A

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

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

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{\left(C - A\right) \cdot \left(C - A\right) + \color{blue}{B \cdot B}}\right)\right)}{\pi} \]
      18. lower-hypot.f64N/A

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

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

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

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{-1}{2} \cdot \frac{B}{C - A}\right)}}{\pi} \]
    5. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-1}{2} \cdot \color{blue}{\frac{B}{C - A}}\right)}{\pi} \]
      2. lower-/.f64N/A

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

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

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(-0.5 \cdot \frac{B}{C - A}\right)}}{\pi} \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \color{blue}{180 \cdot \frac{\tan^{-1} \left(\frac{-1}{2} \cdot \frac{B}{C - A}\right)}{\pi}} \]
      2. lift-PI.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-1}{2} \cdot \frac{B}{C - A}\right)}{\color{blue}{\mathsf{PI}\left(\right)}} \]
      3. lift-/.f64N/A

        \[\leadsto 180 \cdot \color{blue}{\frac{\tan^{-1} \left(\frac{-1}{2} \cdot \frac{B}{C - A}\right)}{\mathsf{PI}\left(\right)}} \]
      4. associate-*r/N/A

        \[\leadsto \color{blue}{\frac{180 \cdot \tan^{-1} \left(\frac{-1}{2} \cdot \frac{B}{C - A}\right)}{\mathsf{PI}\left(\right)}} \]
      5. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{180 \cdot \tan^{-1} \left(\frac{-1}{2} \cdot \frac{B}{C - A}\right)}{\mathsf{PI}\left(\right)}} \]
    8. Applied rewrites37.3%

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

Alternative 8: 67.9% accurate, 2.2× speedup?

\[\begin{array}{l} B\_m = \left|B\right| \\ B\_s = \mathsf{copysign}\left(1, B\right) \\ B\_s \cdot \begin{array}{l} \mathbf{if}\;C \leq -1.4 \cdot 10^{-58}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C - A}{B\_m}\right)}{\pi}\\ \mathbf{elif}\;C \leq 5 \cdot 10^{+79}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{-A}{B\_m} - 1\right)}{\pi}\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(-0.5 \cdot \frac{B\_m}{C}\right)}{\pi}\\ \end{array} \end{array} \]
B\_m = (fabs.f64 B)
B\_s = (copysign.f64 #s(literal 1 binary64) B)
(FPCore (B_s A B_m C)
 :precision binary64
 (*
  B_s
  (if (<= C -1.4e-58)
    (* 180.0 (/ (atan (/ (- C A) B_m)) PI))
    (if (<= C 5e+79)
      (* 180.0 (/ (atan (- (/ (- A) B_m) 1.0)) PI))
      (* 180.0 (/ (atan (* -0.5 (/ B_m C))) PI))))))
B\_m = fabs(B);
B\_s = copysign(1.0, B);
double code(double B_s, double A, double B_m, double C) {
	double tmp;
	if (C <= -1.4e-58) {
		tmp = 180.0 * (atan(((C - A) / B_m)) / ((double) M_PI));
	} else if (C <= 5e+79) {
		tmp = 180.0 * (atan(((-A / B_m) - 1.0)) / ((double) M_PI));
	} else {
		tmp = 180.0 * (atan((-0.5 * (B_m / C))) / ((double) M_PI));
	}
	return B_s * tmp;
}
B\_m = Math.abs(B);
B\_s = Math.copySign(1.0, B);
public static double code(double B_s, double A, double B_m, double C) {
	double tmp;
	if (C <= -1.4e-58) {
		tmp = 180.0 * (Math.atan(((C - A) / B_m)) / Math.PI);
	} else if (C <= 5e+79) {
		tmp = 180.0 * (Math.atan(((-A / B_m) - 1.0)) / Math.PI);
	} else {
		tmp = 180.0 * (Math.atan((-0.5 * (B_m / C))) / Math.PI);
	}
	return B_s * tmp;
}
B\_m = math.fabs(B)
B\_s = math.copysign(1.0, B)
def code(B_s, A, B_m, C):
	tmp = 0
	if C <= -1.4e-58:
		tmp = 180.0 * (math.atan(((C - A) / B_m)) / math.pi)
	elif C <= 5e+79:
		tmp = 180.0 * (math.atan(((-A / B_m) - 1.0)) / math.pi)
	else:
		tmp = 180.0 * (math.atan((-0.5 * (B_m / C))) / math.pi)
	return B_s * tmp
B\_m = abs(B)
B\_s = copysign(1.0, B)
function code(B_s, A, B_m, C)
	tmp = 0.0
	if (C <= -1.4e-58)
		tmp = Float64(180.0 * Float64(atan(Float64(Float64(C - A) / B_m)) / pi));
	elseif (C <= 5e+79)
		tmp = Float64(180.0 * Float64(atan(Float64(Float64(Float64(-A) / B_m) - 1.0)) / pi));
	else
		tmp = Float64(180.0 * Float64(atan(Float64(-0.5 * Float64(B_m / C))) / pi));
	end
	return Float64(B_s * tmp)
end
B\_m = abs(B);
B\_s = sign(B) * abs(1.0);
function tmp_2 = code(B_s, A, B_m, C)
	tmp = 0.0;
	if (C <= -1.4e-58)
		tmp = 180.0 * (atan(((C - A) / B_m)) / pi);
	elseif (C <= 5e+79)
		tmp = 180.0 * (atan(((-A / B_m) - 1.0)) / pi);
	else
		tmp = 180.0 * (atan((-0.5 * (B_m / C))) / pi);
	end
	tmp_2 = B_s * tmp;
end
B\_m = N[Abs[B], $MachinePrecision]
B\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[B]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[B$95$s_, A_, B$95$m_, C_] := N[(B$95$s * If[LessEqual[C, -1.4e-58], N[(180.0 * N[(N[ArcTan[N[(N[(C - A), $MachinePrecision] / B$95$m), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], If[LessEqual[C, 5e+79], N[(180.0 * N[(N[ArcTan[N[(N[((-A) / B$95$m), $MachinePrecision] - 1.0), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], N[(180.0 * N[(N[ArcTan[N[(-0.5 * N[(B$95$m / C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
B\_m = \left|B\right|
\\
B\_s = \mathsf{copysign}\left(1, B\right)

\\
B\_s \cdot \begin{array}{l}
\mathbf{if}\;C \leq -1.4 \cdot 10^{-58}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C - A}{B\_m}\right)}{\pi}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if C < -1.4e-58

    1. Initial program 53.6%

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

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{C}{B} - \left(1 + \frac{A}{B}\right)\right)}}{\pi} \]
    3. Step-by-step derivation
      1. associate--r+N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \color{blue}{\frac{A}{B}}\right)}{\pi} \]
      2. lower--.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \color{blue}{\frac{A}{B}}\right)}{\pi} \]
      3. lower--.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{\color{blue}{A}}{B}\right)}{\pi} \]
      4. lower-/.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right)}{\pi} \]
      5. lower-/.f6465.1

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{\color{blue}{B}}\right)}{\pi} \]
    4. Applied rewrites65.1%

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

      \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{C - A}{\color{blue}{B}}\right)}{\pi} \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{C - A}{B}\right)}{\pi} \]
      2. lift--.f6434.6

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{C - A}{B}\right)}{\pi} \]
    7. Applied rewrites34.6%

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

    if -1.4e-58 < C < 5e79

    1. Initial program 53.6%

      \[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. Taylor expanded in C around 0

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(-1 \cdot \frac{A + \sqrt{{A}^{2} + {B}^{2}}}{B}\right)}}{\pi} \]
    3. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-1 \cdot \left(A + \sqrt{{A}^{2} + {B}^{2}}\right)}{\color{blue}{B}}\right)}{\pi} \]
      2. mul-1-negN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{neg}\left(\left(A + \sqrt{{A}^{2} + {B}^{2}}\right)\right)}{B}\right)}{\pi} \]
      3. lower-/.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{neg}\left(\left(A + \sqrt{{A}^{2} + {B}^{2}}\right)\right)}{\color{blue}{B}}\right)}{\pi} \]
      4. lower-neg.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-\left(A + \sqrt{{A}^{2} + {B}^{2}}\right)}{B}\right)}{\pi} \]
      5. +-commutativeN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-\left(\sqrt{{A}^{2} + {B}^{2}} + A\right)}{B}\right)}{\pi} \]
      6. lower-+.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-\left(\sqrt{{A}^{2} + {B}^{2}} + A\right)}{B}\right)}{\pi} \]
      7. lower-sqrt.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-\left(\sqrt{{A}^{2} + {B}^{2}} + A\right)}{B}\right)}{\pi} \]
      8. unpow2N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-\left(\sqrt{A \cdot A + {B}^{2}} + A\right)}{B}\right)}{\pi} \]
      9. lower-fma.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-\left(\sqrt{\mathsf{fma}\left(A, A, {B}^{2}\right)} + A\right)}{B}\right)}{\pi} \]
      10. unpow2N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-\left(\sqrt{\mathsf{fma}\left(A, A, B \cdot B\right)} + A\right)}{B}\right)}{\pi} \]
      11. lower-*.f6444.4

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-\left(\sqrt{\mathsf{fma}\left(A, A, B \cdot B\right)} + A\right)}{B}\right)}{\pi} \]
    4. Applied rewrites44.4%

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{-\left(\sqrt{\mathsf{fma}\left(A, A, B \cdot B\right)} + A\right)}{B}\right)}}{\pi} \]
    5. Taylor expanded in A around 0

      \[\leadsto 180 \cdot \frac{\tan^{-1} \left(-1 \cdot \frac{A}{B} - \color{blue}{1}\right)}{\pi} \]
    6. Step-by-step derivation
      1. lower--.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(-1 \cdot \frac{A}{B} - 1\right)}{\pi} \]
      2. associate-*r/N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-1 \cdot A}{B} - 1\right)}{\pi} \]
      3. mul-1-negN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{neg}\left(A\right)}{B} - 1\right)}{\pi} \]
      4. lower-/.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{neg}\left(A\right)}{B} - 1\right)}{\pi} \]
      5. lower-neg.f6455.9

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-A}{B} - 1\right)}{\pi} \]
    7. Applied rewrites55.9%

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

    if 5e79 < C

    1. Initial program 53.6%

      \[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. Step-by-step derivation
      1. lift-sqrt.f64N/A

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

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{\color{blue}{{\left(A - C\right)}^{2} + {B}^{2}}}\right)\right)}{\pi} \]
      3. lift--.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\color{blue}{\left(A - C\right)}}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      4. lift-pow.f64N/A

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

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\color{blue}{\left(A + \left(\mathsf{neg}\left(C\right)\right)\right)}}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      6. mul-1-negN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A + \color{blue}{-1 \cdot C}\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      7. lift-pow.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A + -1 \cdot C\right)}^{2} + \color{blue}{{B}^{2}}}\right)\right)}{\pi} \]
      8. mul-1-negN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A + \color{blue}{\left(\mathsf{neg}\left(C\right)\right)}\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      9. sub-flipN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\color{blue}{\left(A - C\right)}}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      10. sub-negate-revN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\color{blue}{\left(\mathsf{neg}\left(\left(C - A\right)\right)\right)}}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      11. sub-flipN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(\mathsf{neg}\left(\color{blue}{\left(C + \left(\mathsf{neg}\left(A\right)\right)\right)}\right)\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      12. mul-1-negN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(\mathsf{neg}\left(\left(C + \color{blue}{-1 \cdot A}\right)\right)\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      13. unpow-neg-2N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{\color{blue}{{\left(C + -1 \cdot A\right)}^{2}} + {B}^{2}}\right)\right)}{\pi} \]
      14. mul-1-negN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(C + \color{blue}{\left(\mathsf{neg}\left(A\right)\right)}\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      15. sub-flipN/A

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

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

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{\left(C - A\right) \cdot \left(C - A\right) + \color{blue}{B \cdot B}}\right)\right)}{\pi} \]
      18. lower-hypot.f64N/A

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

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

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

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{-1}{2} \cdot \frac{B}{C - A}\right)}}{\pi} \]
    5. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-1}{2} \cdot \color{blue}{\frac{B}{C - A}}\right)}{\pi} \]
      2. lower-/.f64N/A

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

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

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

      \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-1}{2} \cdot \frac{B}{C}\right)}{\pi} \]
    8. Step-by-step derivation
      1. Applied rewrites26.4%

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(-0.5 \cdot \frac{B}{C}\right)}{\pi} \]
    9. Recombined 3 regimes into one program.
    10. Add Preprocessing

    Alternative 9: 58.6% accurate, 2.2× speedup?

    \[\begin{array}{l} B\_m = \left|B\right| \\ B\_s = \mathsf{copysign}\left(1, B\right) \\ B\_s \cdot \begin{array}{l} \mathbf{if}\;C \leq -2.5 \cdot 10^{-59}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C - A}{B\_m}\right)}{\pi}\\ \mathbf{elif}\;C \leq 1.06 \cdot 10^{+79}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\pi}\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(-0.5 \cdot \frac{B\_m}{C}\right)}{\pi}\\ \end{array} \end{array} \]
    B\_m = (fabs.f64 B)
    B\_s = (copysign.f64 #s(literal 1 binary64) B)
    (FPCore (B_s A B_m C)
     :precision binary64
     (*
      B_s
      (if (<= C -2.5e-59)
        (* 180.0 (/ (atan (/ (- C A) B_m)) PI))
        (if (<= C 1.06e+79)
          (* 180.0 (/ (atan -1.0) PI))
          (* 180.0 (/ (atan (* -0.5 (/ B_m C))) PI))))))
    B\_m = fabs(B);
    B\_s = copysign(1.0, B);
    double code(double B_s, double A, double B_m, double C) {
    	double tmp;
    	if (C <= -2.5e-59) {
    		tmp = 180.0 * (atan(((C - A) / B_m)) / ((double) M_PI));
    	} else if (C <= 1.06e+79) {
    		tmp = 180.0 * (atan(-1.0) / ((double) M_PI));
    	} else {
    		tmp = 180.0 * (atan((-0.5 * (B_m / C))) / ((double) M_PI));
    	}
    	return B_s * tmp;
    }
    
    B\_m = Math.abs(B);
    B\_s = Math.copySign(1.0, B);
    public static double code(double B_s, double A, double B_m, double C) {
    	double tmp;
    	if (C <= -2.5e-59) {
    		tmp = 180.0 * (Math.atan(((C - A) / B_m)) / Math.PI);
    	} else if (C <= 1.06e+79) {
    		tmp = 180.0 * (Math.atan(-1.0) / Math.PI);
    	} else {
    		tmp = 180.0 * (Math.atan((-0.5 * (B_m / C))) / Math.PI);
    	}
    	return B_s * tmp;
    }
    
    B\_m = math.fabs(B)
    B\_s = math.copysign(1.0, B)
    def code(B_s, A, B_m, C):
    	tmp = 0
    	if C <= -2.5e-59:
    		tmp = 180.0 * (math.atan(((C - A) / B_m)) / math.pi)
    	elif C <= 1.06e+79:
    		tmp = 180.0 * (math.atan(-1.0) / math.pi)
    	else:
    		tmp = 180.0 * (math.atan((-0.5 * (B_m / C))) / math.pi)
    	return B_s * tmp
    
    B\_m = abs(B)
    B\_s = copysign(1.0, B)
    function code(B_s, A, B_m, C)
    	tmp = 0.0
    	if (C <= -2.5e-59)
    		tmp = Float64(180.0 * Float64(atan(Float64(Float64(C - A) / B_m)) / pi));
    	elseif (C <= 1.06e+79)
    		tmp = Float64(180.0 * Float64(atan(-1.0) / pi));
    	else
    		tmp = Float64(180.0 * Float64(atan(Float64(-0.5 * Float64(B_m / C))) / pi));
    	end
    	return Float64(B_s * tmp)
    end
    
    B\_m = abs(B);
    B\_s = sign(B) * abs(1.0);
    function tmp_2 = code(B_s, A, B_m, C)
    	tmp = 0.0;
    	if (C <= -2.5e-59)
    		tmp = 180.0 * (atan(((C - A) / B_m)) / pi);
    	elseif (C <= 1.06e+79)
    		tmp = 180.0 * (atan(-1.0) / pi);
    	else
    		tmp = 180.0 * (atan((-0.5 * (B_m / C))) / pi);
    	end
    	tmp_2 = B_s * tmp;
    end
    
    B\_m = N[Abs[B], $MachinePrecision]
    B\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[B]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
    code[B$95$s_, A_, B$95$m_, C_] := N[(B$95$s * If[LessEqual[C, -2.5e-59], N[(180.0 * N[(N[ArcTan[N[(N[(C - A), $MachinePrecision] / B$95$m), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], If[LessEqual[C, 1.06e+79], N[(180.0 * N[(N[ArcTan[-1.0], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], N[(180.0 * N[(N[ArcTan[N[(-0.5 * N[(B$95$m / C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
    
    \begin{array}{l}
    B\_m = \left|B\right|
    \\
    B\_s = \mathsf{copysign}\left(1, B\right)
    
    \\
    B\_s \cdot \begin{array}{l}
    \mathbf{if}\;C \leq -2.5 \cdot 10^{-59}:\\
    \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C - A}{B\_m}\right)}{\pi}\\
    
    \mathbf{elif}\;C \leq 1.06 \cdot 10^{+79}:\\
    \;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\pi}\\
    
    \mathbf{else}:\\
    \;\;\;\;180 \cdot \frac{\tan^{-1} \left(-0.5 \cdot \frac{B\_m}{C}\right)}{\pi}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if C < -2.5000000000000001e-59

      1. Initial program 53.6%

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

        \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{C}{B} - \left(1 + \frac{A}{B}\right)\right)}}{\pi} \]
      3. Step-by-step derivation
        1. associate--r+N/A

          \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \color{blue}{\frac{A}{B}}\right)}{\pi} \]
        2. lower--.f64N/A

          \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \color{blue}{\frac{A}{B}}\right)}{\pi} \]
        3. lower--.f64N/A

          \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{\color{blue}{A}}{B}\right)}{\pi} \]
        4. lower-/.f64N/A

          \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right)}{\pi} \]
        5. lower-/.f6465.1

          \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{\color{blue}{B}}\right)}{\pi} \]
      4. Applied rewrites65.1%

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

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{C - A}{\color{blue}{B}}\right)}{\pi} \]
      6. Step-by-step derivation
        1. lower-/.f64N/A

          \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{C - A}{B}\right)}{\pi} \]
        2. lift--.f6434.6

          \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{C - A}{B}\right)}{\pi} \]
      7. Applied rewrites34.6%

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

      if -2.5000000000000001e-59 < C < 1.05999999999999992e79

      1. Initial program 53.6%

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

        \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{-1}}{\pi} \]
      3. Step-by-step derivation
        1. Applied rewrites40.2%

          \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{-1}}{\pi} \]

        if 1.05999999999999992e79 < C

        1. Initial program 53.6%

          \[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. Step-by-step derivation
          1. lift-sqrt.f64N/A

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

            \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{\color{blue}{{\left(A - C\right)}^{2} + {B}^{2}}}\right)\right)}{\pi} \]
          3. lift--.f64N/A

            \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\color{blue}{\left(A - C\right)}}^{2} + {B}^{2}}\right)\right)}{\pi} \]
          4. lift-pow.f64N/A

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

            \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\color{blue}{\left(A + \left(\mathsf{neg}\left(C\right)\right)\right)}}^{2} + {B}^{2}}\right)\right)}{\pi} \]
          6. mul-1-negN/A

            \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A + \color{blue}{-1 \cdot C}\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
          7. lift-pow.f64N/A

            \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A + -1 \cdot C\right)}^{2} + \color{blue}{{B}^{2}}}\right)\right)}{\pi} \]
          8. mul-1-negN/A

            \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A + \color{blue}{\left(\mathsf{neg}\left(C\right)\right)}\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
          9. sub-flipN/A

            \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\color{blue}{\left(A - C\right)}}^{2} + {B}^{2}}\right)\right)}{\pi} \]
          10. sub-negate-revN/A

            \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\color{blue}{\left(\mathsf{neg}\left(\left(C - A\right)\right)\right)}}^{2} + {B}^{2}}\right)\right)}{\pi} \]
          11. sub-flipN/A

            \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(\mathsf{neg}\left(\color{blue}{\left(C + \left(\mathsf{neg}\left(A\right)\right)\right)}\right)\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
          12. mul-1-negN/A

            \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(\mathsf{neg}\left(\left(C + \color{blue}{-1 \cdot A}\right)\right)\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
          13. unpow-neg-2N/A

            \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{\color{blue}{{\left(C + -1 \cdot A\right)}^{2}} + {B}^{2}}\right)\right)}{\pi} \]
          14. mul-1-negN/A

            \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(C + \color{blue}{\left(\mathsf{neg}\left(A\right)\right)}\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
          15. sub-flipN/A

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

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

            \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{\left(C - A\right) \cdot \left(C - A\right) + \color{blue}{B \cdot B}}\right)\right)}{\pi} \]
          18. lower-hypot.f64N/A

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

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

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

          \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{-1}{2} \cdot \frac{B}{C - A}\right)}}{\pi} \]
        5. Step-by-step derivation
          1. lower-*.f64N/A

            \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-1}{2} \cdot \color{blue}{\frac{B}{C - A}}\right)}{\pi} \]
          2. lower-/.f64N/A

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

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

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

          \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-1}{2} \cdot \frac{B}{C}\right)}{\pi} \]
        8. Step-by-step derivation
          1. Applied rewrites26.4%

            \[\leadsto 180 \cdot \frac{\tan^{-1} \left(-0.5 \cdot \frac{B}{C}\right)}{\pi} \]
        9. Recombined 3 regimes into one program.
        10. Add Preprocessing

        Alternative 10: 54.6% accurate, 2.5× speedup?

        \[\begin{array}{l} B\_m = \left|B\right| \\ B\_s = \mathsf{copysign}\left(1, B\right) \\ B\_s \cdot \begin{array}{l} \mathbf{if}\;B\_m \leq 3.6 \cdot 10^{+59}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C - A}{B\_m}\right)}{\pi}\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\pi}\\ \end{array} \end{array} \]
        B\_m = (fabs.f64 B)
        B\_s = (copysign.f64 #s(literal 1 binary64) B)
        (FPCore (B_s A B_m C)
         :precision binary64
         (*
          B_s
          (if (<= B_m 3.6e+59)
            (* 180.0 (/ (atan (/ (- C A) B_m)) PI))
            (* 180.0 (/ (atan -1.0) PI)))))
        B\_m = fabs(B);
        B\_s = copysign(1.0, B);
        double code(double B_s, double A, double B_m, double C) {
        	double tmp;
        	if (B_m <= 3.6e+59) {
        		tmp = 180.0 * (atan(((C - A) / B_m)) / ((double) M_PI));
        	} else {
        		tmp = 180.0 * (atan(-1.0) / ((double) M_PI));
        	}
        	return B_s * tmp;
        }
        
        B\_m = Math.abs(B);
        B\_s = Math.copySign(1.0, B);
        public static double code(double B_s, double A, double B_m, double C) {
        	double tmp;
        	if (B_m <= 3.6e+59) {
        		tmp = 180.0 * (Math.atan(((C - A) / B_m)) / Math.PI);
        	} else {
        		tmp = 180.0 * (Math.atan(-1.0) / Math.PI);
        	}
        	return B_s * tmp;
        }
        
        B\_m = math.fabs(B)
        B\_s = math.copysign(1.0, B)
        def code(B_s, A, B_m, C):
        	tmp = 0
        	if B_m <= 3.6e+59:
        		tmp = 180.0 * (math.atan(((C - A) / B_m)) / math.pi)
        	else:
        		tmp = 180.0 * (math.atan(-1.0) / math.pi)
        	return B_s * tmp
        
        B\_m = abs(B)
        B\_s = copysign(1.0, B)
        function code(B_s, A, B_m, C)
        	tmp = 0.0
        	if (B_m <= 3.6e+59)
        		tmp = Float64(180.0 * Float64(atan(Float64(Float64(C - A) / B_m)) / pi));
        	else
        		tmp = Float64(180.0 * Float64(atan(-1.0) / pi));
        	end
        	return Float64(B_s * tmp)
        end
        
        B\_m = abs(B);
        B\_s = sign(B) * abs(1.0);
        function tmp_2 = code(B_s, A, B_m, C)
        	tmp = 0.0;
        	if (B_m <= 3.6e+59)
        		tmp = 180.0 * (atan(((C - A) / B_m)) / pi);
        	else
        		tmp = 180.0 * (atan(-1.0) / pi);
        	end
        	tmp_2 = B_s * tmp;
        end
        
        B\_m = N[Abs[B], $MachinePrecision]
        B\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[B]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
        code[B$95$s_, A_, B$95$m_, C_] := N[(B$95$s * If[LessEqual[B$95$m, 3.6e+59], N[(180.0 * N[(N[ArcTan[N[(N[(C - A), $MachinePrecision] / B$95$m), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], N[(180.0 * N[(N[ArcTan[-1.0], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
        
        \begin{array}{l}
        B\_m = \left|B\right|
        \\
        B\_s = \mathsf{copysign}\left(1, B\right)
        
        \\
        B\_s \cdot \begin{array}{l}
        \mathbf{if}\;B\_m \leq 3.6 \cdot 10^{+59}:\\
        \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C - A}{B\_m}\right)}{\pi}\\
        
        \mathbf{else}:\\
        \;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\pi}\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if B < 3.5999999999999999e59

          1. Initial program 53.6%

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

            \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{C}{B} - \left(1 + \frac{A}{B}\right)\right)}}{\pi} \]
          3. Step-by-step derivation
            1. associate--r+N/A

              \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \color{blue}{\frac{A}{B}}\right)}{\pi} \]
            2. lower--.f64N/A

              \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \color{blue}{\frac{A}{B}}\right)}{\pi} \]
            3. lower--.f64N/A

              \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{\color{blue}{A}}{B}\right)}{\pi} \]
            4. lower-/.f64N/A

              \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right)}{\pi} \]
            5. lower-/.f6465.1

              \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{\color{blue}{B}}\right)}{\pi} \]
          4. Applied rewrites65.1%

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

            \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{C - A}{\color{blue}{B}}\right)}{\pi} \]
          6. Step-by-step derivation
            1. lower-/.f64N/A

              \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{C - A}{B}\right)}{\pi} \]
            2. lift--.f6434.6

              \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{C - A}{B}\right)}{\pi} \]
          7. Applied rewrites34.6%

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

          if 3.5999999999999999e59 < B

          1. Initial program 53.6%

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

            \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{-1}}{\pi} \]
          3. Step-by-step derivation
            1. Applied rewrites40.2%

              \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{-1}}{\pi} \]
          4. Recombined 2 regimes into one program.
          5. Add Preprocessing

          Alternative 11: 47.3% accurate, 2.7× speedup?

          \[\begin{array}{l} B\_m = \left|B\right| \\ B\_s = \mathsf{copysign}\left(1, B\right) \\ B\_s \cdot \begin{array}{l} \mathbf{if}\;B\_m \leq 8.2 \cdot 10^{-54}:\\ \;\;\;\;\frac{180 \cdot \tan^{-1} \left(\frac{-A}{B\_m}\right)}{\pi}\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\pi}\\ \end{array} \end{array} \]
          B\_m = (fabs.f64 B)
          B\_s = (copysign.f64 #s(literal 1 binary64) B)
          (FPCore (B_s A B_m C)
           :precision binary64
           (*
            B_s
            (if (<= B_m 8.2e-54)
              (/ (* 180.0 (atan (/ (- A) B_m))) PI)
              (* 180.0 (/ (atan -1.0) PI)))))
          B\_m = fabs(B);
          B\_s = copysign(1.0, B);
          double code(double B_s, double A, double B_m, double C) {
          	double tmp;
          	if (B_m <= 8.2e-54) {
          		tmp = (180.0 * atan((-A / B_m))) / ((double) M_PI);
          	} else {
          		tmp = 180.0 * (atan(-1.0) / ((double) M_PI));
          	}
          	return B_s * tmp;
          }
          
          B\_m = Math.abs(B);
          B\_s = Math.copySign(1.0, B);
          public static double code(double B_s, double A, double B_m, double C) {
          	double tmp;
          	if (B_m <= 8.2e-54) {
          		tmp = (180.0 * Math.atan((-A / B_m))) / Math.PI;
          	} else {
          		tmp = 180.0 * (Math.atan(-1.0) / Math.PI);
          	}
          	return B_s * tmp;
          }
          
          B\_m = math.fabs(B)
          B\_s = math.copysign(1.0, B)
          def code(B_s, A, B_m, C):
          	tmp = 0
          	if B_m <= 8.2e-54:
          		tmp = (180.0 * math.atan((-A / B_m))) / math.pi
          	else:
          		tmp = 180.0 * (math.atan(-1.0) / math.pi)
          	return B_s * tmp
          
          B\_m = abs(B)
          B\_s = copysign(1.0, B)
          function code(B_s, A, B_m, C)
          	tmp = 0.0
          	if (B_m <= 8.2e-54)
          		tmp = Float64(Float64(180.0 * atan(Float64(Float64(-A) / B_m))) / pi);
          	else
          		tmp = Float64(180.0 * Float64(atan(-1.0) / pi));
          	end
          	return Float64(B_s * tmp)
          end
          
          B\_m = abs(B);
          B\_s = sign(B) * abs(1.0);
          function tmp_2 = code(B_s, A, B_m, C)
          	tmp = 0.0;
          	if (B_m <= 8.2e-54)
          		tmp = (180.0 * atan((-A / B_m))) / pi;
          	else
          		tmp = 180.0 * (atan(-1.0) / pi);
          	end
          	tmp_2 = B_s * tmp;
          end
          
          B\_m = N[Abs[B], $MachinePrecision]
          B\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[B]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
          code[B$95$s_, A_, B$95$m_, C_] := N[(B$95$s * If[LessEqual[B$95$m, 8.2e-54], N[(N[(180.0 * N[ArcTan[N[((-A) / B$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / Pi), $MachinePrecision], N[(180.0 * N[(N[ArcTan[-1.0], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
          
          \begin{array}{l}
          B\_m = \left|B\right|
          \\
          B\_s = \mathsf{copysign}\left(1, B\right)
          
          \\
          B\_s \cdot \begin{array}{l}
          \mathbf{if}\;B\_m \leq 8.2 \cdot 10^{-54}:\\
          \;\;\;\;\frac{180 \cdot \tan^{-1} \left(\frac{-A}{B\_m}\right)}{\pi}\\
          
          \mathbf{else}:\\
          \;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\pi}\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if B < 8.2000000000000001e-54

            1. Initial program 53.6%

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

              \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{C}{B} - \left(1 + \frac{A}{B}\right)\right)}}{\pi} \]
            3. Step-by-step derivation
              1. associate--r+N/A

                \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \color{blue}{\frac{A}{B}}\right)}{\pi} \]
              2. lower--.f64N/A

                \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \color{blue}{\frac{A}{B}}\right)}{\pi} \]
              3. lower--.f64N/A

                \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{\color{blue}{A}}{B}\right)}{\pi} \]
              4. lower-/.f64N/A

                \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right)}{\pi} \]
              5. lower-/.f6465.1

                \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{\color{blue}{B}}\right)}{\pi} \]
            4. Applied rewrites65.1%

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

              \[\leadsto 180 \cdot \frac{\tan^{-1} \left(-1 \cdot \color{blue}{\frac{A}{B}}\right)}{\pi} \]
            6. Step-by-step derivation
              1. associate-*r/N/A

                \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-1 \cdot A}{B}\right)}{\pi} \]
              2. mul-1-negN/A

                \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{neg}\left(A\right)}{B}\right)}{\pi} \]
              3. lower-/.f64N/A

                \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{neg}\left(A\right)}{B}\right)}{\pi} \]
              4. lower-neg.f6423.0

                \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-A}{B}\right)}{\pi} \]
            7. Applied rewrites23.0%

              \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-A}{\color{blue}{B}}\right)}{\pi} \]
            8. Step-by-step derivation
              1. lift-*.f64N/A

                \[\leadsto \color{blue}{180 \cdot \frac{\tan^{-1} \left(\frac{-A}{B}\right)}{\pi}} \]
              2. lift-PI.f64N/A

                \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-A}{B}\right)}{\color{blue}{\mathsf{PI}\left(\right)}} \]
              3. lift-/.f64N/A

                \[\leadsto 180 \cdot \color{blue}{\frac{\tan^{-1} \left(\frac{-A}{B}\right)}{\mathsf{PI}\left(\right)}} \]
              4. associate-*r/N/A

                \[\leadsto \color{blue}{\frac{180 \cdot \tan^{-1} \left(\frac{-A}{B}\right)}{\mathsf{PI}\left(\right)}} \]
              5. lower-/.f64N/A

                \[\leadsto \color{blue}{\frac{180 \cdot \tan^{-1} \left(\frac{-A}{B}\right)}{\mathsf{PI}\left(\right)}} \]
            9. Applied rewrites23.0%

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

            if 8.2000000000000001e-54 < B

            1. Initial program 53.6%

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

              \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{-1}}{\pi} \]
            3. Step-by-step derivation
              1. Applied rewrites40.2%

                \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{-1}}{\pi} \]
            4. Recombined 2 regimes into one program.
            5. Add Preprocessing

            Alternative 12: 47.3% accurate, 2.7× speedup?

            \[\begin{array}{l} B\_m = \left|B\right| \\ B\_s = \mathsf{copysign}\left(1, B\right) \\ B\_s \cdot \begin{array}{l} \mathbf{if}\;B\_m \leq 8.2 \cdot 10^{-54}:\\ \;\;\;\;\frac{\tan^{-1} \left(\frac{-A}{B\_m}\right)}{\pi} \cdot 180\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\pi}\\ \end{array} \end{array} \]
            B\_m = (fabs.f64 B)
            B\_s = (copysign.f64 #s(literal 1 binary64) B)
            (FPCore (B_s A B_m C)
             :precision binary64
             (*
              B_s
              (if (<= B_m 8.2e-54)
                (* (/ (atan (/ (- A) B_m)) PI) 180.0)
                (* 180.0 (/ (atan -1.0) PI)))))
            B\_m = fabs(B);
            B\_s = copysign(1.0, B);
            double code(double B_s, double A, double B_m, double C) {
            	double tmp;
            	if (B_m <= 8.2e-54) {
            		tmp = (atan((-A / B_m)) / ((double) M_PI)) * 180.0;
            	} else {
            		tmp = 180.0 * (atan(-1.0) / ((double) M_PI));
            	}
            	return B_s * tmp;
            }
            
            B\_m = Math.abs(B);
            B\_s = Math.copySign(1.0, B);
            public static double code(double B_s, double A, double B_m, double C) {
            	double tmp;
            	if (B_m <= 8.2e-54) {
            		tmp = (Math.atan((-A / B_m)) / Math.PI) * 180.0;
            	} else {
            		tmp = 180.0 * (Math.atan(-1.0) / Math.PI);
            	}
            	return B_s * tmp;
            }
            
            B\_m = math.fabs(B)
            B\_s = math.copysign(1.0, B)
            def code(B_s, A, B_m, C):
            	tmp = 0
            	if B_m <= 8.2e-54:
            		tmp = (math.atan((-A / B_m)) / math.pi) * 180.0
            	else:
            		tmp = 180.0 * (math.atan(-1.0) / math.pi)
            	return B_s * tmp
            
            B\_m = abs(B)
            B\_s = copysign(1.0, B)
            function code(B_s, A, B_m, C)
            	tmp = 0.0
            	if (B_m <= 8.2e-54)
            		tmp = Float64(Float64(atan(Float64(Float64(-A) / B_m)) / pi) * 180.0);
            	else
            		tmp = Float64(180.0 * Float64(atan(-1.0) / pi));
            	end
            	return Float64(B_s * tmp)
            end
            
            B\_m = abs(B);
            B\_s = sign(B) * abs(1.0);
            function tmp_2 = code(B_s, A, B_m, C)
            	tmp = 0.0;
            	if (B_m <= 8.2e-54)
            		tmp = (atan((-A / B_m)) / pi) * 180.0;
            	else
            		tmp = 180.0 * (atan(-1.0) / pi);
            	end
            	tmp_2 = B_s * tmp;
            end
            
            B\_m = N[Abs[B], $MachinePrecision]
            B\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[B]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
            code[B$95$s_, A_, B$95$m_, C_] := N[(B$95$s * If[LessEqual[B$95$m, 8.2e-54], N[(N[(N[ArcTan[N[((-A) / B$95$m), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision] * 180.0), $MachinePrecision], N[(180.0 * N[(N[ArcTan[-1.0], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
            
            \begin{array}{l}
            B\_m = \left|B\right|
            \\
            B\_s = \mathsf{copysign}\left(1, B\right)
            
            \\
            B\_s \cdot \begin{array}{l}
            \mathbf{if}\;B\_m \leq 8.2 \cdot 10^{-54}:\\
            \;\;\;\;\frac{\tan^{-1} \left(\frac{-A}{B\_m}\right)}{\pi} \cdot 180\\
            
            \mathbf{else}:\\
            \;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\pi}\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if B < 8.2000000000000001e-54

              1. Initial program 53.6%

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

                \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{C}{B} - \left(1 + \frac{A}{B}\right)\right)}}{\pi} \]
              3. Step-by-step derivation
                1. associate--r+N/A

                  \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \color{blue}{\frac{A}{B}}\right)}{\pi} \]
                2. lower--.f64N/A

                  \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \color{blue}{\frac{A}{B}}\right)}{\pi} \]
                3. lower--.f64N/A

                  \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{\color{blue}{A}}{B}\right)}{\pi} \]
                4. lower-/.f64N/A

                  \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{B}\right)}{\pi} \]
                5. lower-/.f6465.1

                  \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - 1\right) - \frac{A}{\color{blue}{B}}\right)}{\pi} \]
              4. Applied rewrites65.1%

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

                \[\leadsto 180 \cdot \frac{\tan^{-1} \left(-1 \cdot \color{blue}{\frac{A}{B}}\right)}{\pi} \]
              6. Step-by-step derivation
                1. associate-*r/N/A

                  \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-1 \cdot A}{B}\right)}{\pi} \]
                2. mul-1-negN/A

                  \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{neg}\left(A\right)}{B}\right)}{\pi} \]
                3. lower-/.f64N/A

                  \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{neg}\left(A\right)}{B}\right)}{\pi} \]
                4. lower-neg.f6423.0

                  \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-A}{B}\right)}{\pi} \]
              7. Applied rewrites23.0%

                \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-A}{\color{blue}{B}}\right)}{\pi} \]
              8. Step-by-step derivation
                1. lift-*.f64N/A

                  \[\leadsto \color{blue}{180 \cdot \frac{\tan^{-1} \left(\frac{-A}{B}\right)}{\pi}} \]
                2. *-commutativeN/A

                  \[\leadsto \color{blue}{\frac{\tan^{-1} \left(\frac{-A}{B}\right)}{\pi} \cdot 180} \]
                3. lower-*.f6423.0

                  \[\leadsto \color{blue}{\frac{\tan^{-1} \left(\frac{-A}{B}\right)}{\pi} \cdot 180} \]
              9. Applied rewrites23.0%

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

              if 8.2000000000000001e-54 < B

              1. Initial program 53.6%

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

                \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{-1}}{\pi} \]
              3. Step-by-step derivation
                1. Applied rewrites40.2%

                  \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{-1}}{\pi} \]
              4. Recombined 2 regimes into one program.
              5. Add Preprocessing

              Alternative 13: 40.2% accurate, 4.1× speedup?

              \[\begin{array}{l} B\_m = \left|B\right| \\ B\_s = \mathsf{copysign}\left(1, B\right) \\ B\_s \cdot \left(180 \cdot \frac{\tan^{-1} -1}{\pi}\right) \end{array} \]
              B\_m = (fabs.f64 B)
              B\_s = (copysign.f64 #s(literal 1 binary64) B)
              (FPCore (B_s A B_m C) :precision binary64 (* B_s (* 180.0 (/ (atan -1.0) PI))))
              B\_m = fabs(B);
              B\_s = copysign(1.0, B);
              double code(double B_s, double A, double B_m, double C) {
              	return B_s * (180.0 * (atan(-1.0) / ((double) M_PI)));
              }
              
              B\_m = Math.abs(B);
              B\_s = Math.copySign(1.0, B);
              public static double code(double B_s, double A, double B_m, double C) {
              	return B_s * (180.0 * (Math.atan(-1.0) / Math.PI));
              }
              
              B\_m = math.fabs(B)
              B\_s = math.copysign(1.0, B)
              def code(B_s, A, B_m, C):
              	return B_s * (180.0 * (math.atan(-1.0) / math.pi))
              
              B\_m = abs(B)
              B\_s = copysign(1.0, B)
              function code(B_s, A, B_m, C)
              	return Float64(B_s * Float64(180.0 * Float64(atan(-1.0) / pi)))
              end
              
              B\_m = abs(B);
              B\_s = sign(B) * abs(1.0);
              function tmp = code(B_s, A, B_m, C)
              	tmp = B_s * (180.0 * (atan(-1.0) / pi));
              end
              
              B\_m = N[Abs[B], $MachinePrecision]
              B\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[B]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
              code[B$95$s_, A_, B$95$m_, C_] := N[(B$95$s * N[(180.0 * N[(N[ArcTan[-1.0], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
              
              \begin{array}{l}
              B\_m = \left|B\right|
              \\
              B\_s = \mathsf{copysign}\left(1, B\right)
              
              \\
              B\_s \cdot \left(180 \cdot \frac{\tan^{-1} -1}{\pi}\right)
              \end{array}
              
              Derivation
              1. Initial program 53.6%

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

                \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{-1}}{\pi} \]
              3. Step-by-step derivation
                1. Applied rewrites40.2%

                  \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{-1}}{\pi} \]
                2. Add Preprocessing

                Reproduce

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