ABCF->ab-angle angle

Percentage Accurate: 54.0% → 71.1%
Time: 11.4s
Alternatives: 12
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}

Sampling outcomes in binary64 precision:

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 12 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: 54.0% 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: 71.1% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(\left(C - A\right) - \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right) \cdot \frac{1}{B}\\ \mathbf{if}\;t\_0 \leq -0.1:\\ \;\;\;\;\frac{\tan^{-1} t\_0}{\pi} \cdot 180\\ \mathbf{elif}\;t\_0 \leq 0:\\ \;\;\;\;\tan^{-1} \left(-0.5 \cdot \frac{B}{C - A}\right) \cdot \frac{180}{\pi}\\ \mathbf{else}:\\ \;\;\;\;\frac{\tan^{-1} \left(\frac{C - A}{B} + 1\right)}{\pi} \cdot 180\\ \end{array} \end{array} \]
(FPCore (A B C)
 :precision binary64
 (let* ((t_0
         (* (- (- C A) (sqrt (+ (pow B 2.0) (pow (- A C) 2.0)))) (/ 1.0 B))))
   (if (<= t_0 -0.1)
     (* (/ (atan t_0) PI) 180.0)
     (if (<= t_0 0.0)
       (* (atan (* -0.5 (/ B (- C A)))) (/ 180.0 PI))
       (* (/ (atan (+ (/ (- C A) B) 1.0)) PI) 180.0)))))
double code(double A, double B, double C) {
	double t_0 = ((C - A) - sqrt((pow(B, 2.0) + pow((A - C), 2.0)))) * (1.0 / B);
	double tmp;
	if (t_0 <= -0.1) {
		tmp = (atan(t_0) / ((double) M_PI)) * 180.0;
	} else if (t_0 <= 0.0) {
		tmp = atan((-0.5 * (B / (C - A)))) * (180.0 / ((double) M_PI));
	} else {
		tmp = (atan((((C - A) / B) + 1.0)) / ((double) M_PI)) * 180.0;
	}
	return tmp;
}
public static double code(double A, double B, double C) {
	double t_0 = ((C - A) - Math.sqrt((Math.pow(B, 2.0) + Math.pow((A - C), 2.0)))) * (1.0 / B);
	double tmp;
	if (t_0 <= -0.1) {
		tmp = (Math.atan(t_0) / Math.PI) * 180.0;
	} else if (t_0 <= 0.0) {
		tmp = Math.atan((-0.5 * (B / (C - A)))) * (180.0 / Math.PI);
	} else {
		tmp = (Math.atan((((C - A) / B) + 1.0)) / Math.PI) * 180.0;
	}
	return tmp;
}
def code(A, B, C):
	t_0 = ((C - A) - math.sqrt((math.pow(B, 2.0) + math.pow((A - C), 2.0)))) * (1.0 / B)
	tmp = 0
	if t_0 <= -0.1:
		tmp = (math.atan(t_0) / math.pi) * 180.0
	elif t_0 <= 0.0:
		tmp = math.atan((-0.5 * (B / (C - A)))) * (180.0 / math.pi)
	else:
		tmp = (math.atan((((C - A) / B) + 1.0)) / math.pi) * 180.0
	return tmp
function code(A, B, C)
	t_0 = Float64(Float64(Float64(C - A) - sqrt(Float64((B ^ 2.0) + (Float64(A - C) ^ 2.0)))) * Float64(1.0 / B))
	tmp = 0.0
	if (t_0 <= -0.1)
		tmp = Float64(Float64(atan(t_0) / pi) * 180.0);
	elseif (t_0 <= 0.0)
		tmp = Float64(atan(Float64(-0.5 * Float64(B / Float64(C - A)))) * Float64(180.0 / pi));
	else
		tmp = Float64(Float64(atan(Float64(Float64(Float64(C - A) / B) + 1.0)) / pi) * 180.0);
	end
	return tmp
end
function tmp_2 = code(A, B, C)
	t_0 = ((C - A) - sqrt(((B ^ 2.0) + ((A - C) ^ 2.0)))) * (1.0 / B);
	tmp = 0.0;
	if (t_0 <= -0.1)
		tmp = (atan(t_0) / pi) * 180.0;
	elseif (t_0 <= 0.0)
		tmp = atan((-0.5 * (B / (C - A)))) * (180.0 / pi);
	else
		tmp = (atan((((C - A) / B) + 1.0)) / pi) * 180.0;
	end
	tmp_2 = tmp;
end
code[A_, B_, C_] := Block[{t$95$0 = N[(N[(N[(C - A), $MachinePrecision] - N[Sqrt[N[(N[Power[B, 2.0], $MachinePrecision] + N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -0.1], N[(N[(N[ArcTan[t$95$0], $MachinePrecision] / Pi), $MachinePrecision] * 180.0), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(N[ArcTan[N[(-0.5 * N[(B / N[(C - A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(180.0 / Pi), $MachinePrecision]), $MachinePrecision], N[(N[(N[ArcTan[N[(N[(N[(C - A), $MachinePrecision] / B), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision] * 180.0), $MachinePrecision]]]]
\begin{array}{l}

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

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

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


\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)))))) < -0.10000000000000001

    1. Initial program 63.2%

      \[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
    2. Add Preprocessing

    if -0.10000000000000001 < (*.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)))))) < 0.0

    1. Initial program 14.4%

      \[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/A

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

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

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

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

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

        \[\leadsto 180 \cdot \left(\frac{1}{\mathsf{PI}\left(\right)} \cdot \tan^{-1} \color{blue}{\left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}\right) \]
      7. *-commutativeN/A

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

        \[\leadsto 180 \cdot \left(\frac{1}{\mathsf{PI}\left(\right)} \cdot \tan^{-1} \left(\left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right) \cdot \color{blue}{\frac{1}{B}}\right)\right) \]
      9. un-div-invN/A

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

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

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

      \[\leadsto 180 \cdot \left(\frac{1}{\mathsf{PI}\left(\right)} \cdot \tan^{-1} \color{blue}{\left(\frac{1}{2} \cdot \frac{B}{A}\right)}\right) \]
    6. Step-by-step derivation
      1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{180}{\mathsf{PI}\left(\right)}} \cdot \tan^{-1} \left(\frac{B}{A} \cdot \frac{1}{2}\right) \]
      7. lower-*.f6456.9

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

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

      \[\leadsto \frac{180}{\mathsf{PI}\left(\right)} \cdot \tan^{-1} \color{blue}{\left(\frac{-1}{2} \cdot \frac{B}{C - A}\right)} \]
    11. Step-by-step derivation
      1. *-commutativeN/A

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

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

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

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

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

    if 0.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))))))

    1. Initial program 60.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. Add Preprocessing
    3. Taylor expanded in B around -inf

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

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

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

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

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

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\color{blue}{\frac{C - A}{B}} + 1\right)}{\mathsf{PI}\left(\right)} \]
      6. lower--.f6480.3

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

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

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

Alternative 2: 68.7% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\tan^{-1} \left(\frac{C - A}{B} + 1\right)}{\pi} \cdot 180\\ t_1 := \left(\left(C - A\right) - \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right) \cdot \frac{1}{B}\\ \mathbf{if}\;t\_1 \leq -40000000000000:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;t\_1 \leq -0.5:\\ \;\;\;\;\frac{\tan^{-1} -1}{\pi} \cdot 180\\ \mathbf{elif}\;t\_1 \leq 0:\\ \;\;\;\;\tan^{-1} \left(-0.5 \cdot \frac{B}{C - A}\right) \cdot \frac{180}{\pi}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (A B C)
 :precision binary64
 (let* ((t_0 (* (/ (atan (+ (/ (- C A) B) 1.0)) PI) 180.0))
        (t_1
         (* (- (- C A) (sqrt (+ (pow B 2.0) (pow (- A C) 2.0)))) (/ 1.0 B))))
   (if (<= t_1 -40000000000000.0)
     t_0
     (if (<= t_1 -0.5)
       (* (/ (atan -1.0) PI) 180.0)
       (if (<= t_1 0.0) (* (atan (* -0.5 (/ B (- C A)))) (/ 180.0 PI)) t_0)))))
double code(double A, double B, double C) {
	double t_0 = (atan((((C - A) / B) + 1.0)) / ((double) M_PI)) * 180.0;
	double t_1 = ((C - A) - sqrt((pow(B, 2.0) + pow((A - C), 2.0)))) * (1.0 / B);
	double tmp;
	if (t_1 <= -40000000000000.0) {
		tmp = t_0;
	} else if (t_1 <= -0.5) {
		tmp = (atan(-1.0) / ((double) M_PI)) * 180.0;
	} else if (t_1 <= 0.0) {
		tmp = atan((-0.5 * (B / (C - A)))) * (180.0 / ((double) M_PI));
	} else {
		tmp = t_0;
	}
	return tmp;
}
public static double code(double A, double B, double C) {
	double t_0 = (Math.atan((((C - A) / B) + 1.0)) / Math.PI) * 180.0;
	double t_1 = ((C - A) - Math.sqrt((Math.pow(B, 2.0) + Math.pow((A - C), 2.0)))) * (1.0 / B);
	double tmp;
	if (t_1 <= -40000000000000.0) {
		tmp = t_0;
	} else if (t_1 <= -0.5) {
		tmp = (Math.atan(-1.0) / Math.PI) * 180.0;
	} else if (t_1 <= 0.0) {
		tmp = Math.atan((-0.5 * (B / (C - A)))) * (180.0 / Math.PI);
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(A, B, C):
	t_0 = (math.atan((((C - A) / B) + 1.0)) / math.pi) * 180.0
	t_1 = ((C - A) - math.sqrt((math.pow(B, 2.0) + math.pow((A - C), 2.0)))) * (1.0 / B)
	tmp = 0
	if t_1 <= -40000000000000.0:
		tmp = t_0
	elif t_1 <= -0.5:
		tmp = (math.atan(-1.0) / math.pi) * 180.0
	elif t_1 <= 0.0:
		tmp = math.atan((-0.5 * (B / (C - A)))) * (180.0 / math.pi)
	else:
		tmp = t_0
	return tmp
function code(A, B, C)
	t_0 = Float64(Float64(atan(Float64(Float64(Float64(C - A) / B) + 1.0)) / pi) * 180.0)
	t_1 = Float64(Float64(Float64(C - A) - sqrt(Float64((B ^ 2.0) + (Float64(A - C) ^ 2.0)))) * Float64(1.0 / B))
	tmp = 0.0
	if (t_1 <= -40000000000000.0)
		tmp = t_0;
	elseif (t_1 <= -0.5)
		tmp = Float64(Float64(atan(-1.0) / pi) * 180.0);
	elseif (t_1 <= 0.0)
		tmp = Float64(atan(Float64(-0.5 * Float64(B / Float64(C - A)))) * Float64(180.0 / pi));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(A, B, C)
	t_0 = (atan((((C - A) / B) + 1.0)) / pi) * 180.0;
	t_1 = ((C - A) - sqrt(((B ^ 2.0) + ((A - C) ^ 2.0)))) * (1.0 / B);
	tmp = 0.0;
	if (t_1 <= -40000000000000.0)
		tmp = t_0;
	elseif (t_1 <= -0.5)
		tmp = (atan(-1.0) / pi) * 180.0;
	elseif (t_1 <= 0.0)
		tmp = atan((-0.5 * (B / (C - A)))) * (180.0 / pi);
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[A_, B_, C_] := Block[{t$95$0 = N[(N[(N[ArcTan[N[(N[(N[(C - A), $MachinePrecision] / B), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision] * 180.0), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(C - A), $MachinePrecision] - N[Sqrt[N[(N[Power[B, 2.0], $MachinePrecision] + N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -40000000000000.0], t$95$0, If[LessEqual[t$95$1, -0.5], N[(N[(N[ArcTan[-1.0], $MachinePrecision] / Pi), $MachinePrecision] * 180.0), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(N[ArcTan[N[(-0.5 * N[(B / N[(C - A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(180.0 / Pi), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}

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

\mathbf{elif}\;t\_1 \leq -0.5:\\
\;\;\;\;\frac{\tan^{-1} -1}{\pi} \cdot 180\\

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

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\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)))))) < -4e13 or 0.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))))))

    1. Initial program 59.1%

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

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

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

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

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

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

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

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

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

    if -4e13 < (*.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)))))) < -0.5

    1. Initial program 100.0%

      \[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
    2. Add Preprocessing
    3. Taylor expanded in B around inf

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{-1}}{\mathsf{PI}\left(\right)} \]
    4. Step-by-step derivation
      1. Applied rewrites100.0%

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

      if -0.5 < (*.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)))))) < 0.0

      1. Initial program 17.1%

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

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

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

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

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

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

          \[\leadsto 180 \cdot \left(\frac{1}{\mathsf{PI}\left(\right)} \cdot \tan^{-1} \color{blue}{\left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}\right) \]
        7. *-commutativeN/A

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

          \[\leadsto 180 \cdot \left(\frac{1}{\mathsf{PI}\left(\right)} \cdot \tan^{-1} \left(\left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right) \cdot \color{blue}{\frac{1}{B}}\right)\right) \]
        9. un-div-invN/A

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

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

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

        \[\leadsto 180 \cdot \left(\frac{1}{\mathsf{PI}\left(\right)} \cdot \tan^{-1} \color{blue}{\left(\frac{1}{2} \cdot \frac{B}{A}\right)}\right) \]
      6. Step-by-step derivation
        1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

          \[\leadsto \color{blue}{\frac{180}{\mathsf{PI}\left(\right)}} \cdot \tan^{-1} \left(\frac{B}{A} \cdot \frac{1}{2}\right) \]
        7. lower-*.f6455.0

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

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

        \[\leadsto \frac{180}{\mathsf{PI}\left(\right)} \cdot \tan^{-1} \color{blue}{\left(\frac{-1}{2} \cdot \frac{B}{C - A}\right)} \]
      11. Step-by-step derivation
        1. *-commutativeN/A

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

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

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

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

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

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

    Alternative 3: 71.1% accurate, 0.6× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(\left(C - A\right) - \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right) \cdot \frac{1}{B}\\ \mathbf{if}\;t\_0 \leq -0.1:\\ \;\;\;\;\left(\tan^{-1} \left(\frac{\left(C - A\right) - \sqrt{\mathsf{fma}\left(C - A, C - A, B \cdot B\right)}}{B}\right) \cdot \frac{1}{\pi}\right) \cdot 180\\ \mathbf{elif}\;t\_0 \leq 0:\\ \;\;\;\;\tan^{-1} \left(-0.5 \cdot \frac{B}{C - A}\right) \cdot \frac{180}{\pi}\\ \mathbf{else}:\\ \;\;\;\;\frac{\tan^{-1} \left(\frac{C - A}{B} + 1\right)}{\pi} \cdot 180\\ \end{array} \end{array} \]
    (FPCore (A B C)
     :precision binary64
     (let* ((t_0
             (* (- (- C A) (sqrt (+ (pow B 2.0) (pow (- A C) 2.0)))) (/ 1.0 B))))
       (if (<= t_0 -0.1)
         (*
          (*
           (atan (/ (- (- C A) (sqrt (fma (- C A) (- C A) (* B B)))) B))
           (/ 1.0 PI))
          180.0)
         (if (<= t_0 0.0)
           (* (atan (* -0.5 (/ B (- C A)))) (/ 180.0 PI))
           (* (/ (atan (+ (/ (- C A) B) 1.0)) PI) 180.0)))))
    double code(double A, double B, double C) {
    	double t_0 = ((C - A) - sqrt((pow(B, 2.0) + pow((A - C), 2.0)))) * (1.0 / B);
    	double tmp;
    	if (t_0 <= -0.1) {
    		tmp = (atan((((C - A) - sqrt(fma((C - A), (C - A), (B * B)))) / B)) * (1.0 / ((double) M_PI))) * 180.0;
    	} else if (t_0 <= 0.0) {
    		tmp = atan((-0.5 * (B / (C - A)))) * (180.0 / ((double) M_PI));
    	} else {
    		tmp = (atan((((C - A) / B) + 1.0)) / ((double) M_PI)) * 180.0;
    	}
    	return tmp;
    }
    
    function code(A, B, C)
    	t_0 = Float64(Float64(Float64(C - A) - sqrt(Float64((B ^ 2.0) + (Float64(A - C) ^ 2.0)))) * Float64(1.0 / B))
    	tmp = 0.0
    	if (t_0 <= -0.1)
    		tmp = Float64(Float64(atan(Float64(Float64(Float64(C - A) - sqrt(fma(Float64(C - A), Float64(C - A), Float64(B * B)))) / B)) * Float64(1.0 / pi)) * 180.0);
    	elseif (t_0 <= 0.0)
    		tmp = Float64(atan(Float64(-0.5 * Float64(B / Float64(C - A)))) * Float64(180.0 / pi));
    	else
    		tmp = Float64(Float64(atan(Float64(Float64(Float64(C - A) / B) + 1.0)) / pi) * 180.0);
    	end
    	return tmp
    end
    
    code[A_, B_, C_] := Block[{t$95$0 = N[(N[(N[(C - A), $MachinePrecision] - N[Sqrt[N[(N[Power[B, 2.0], $MachinePrecision] + N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -0.1], N[(N[(N[ArcTan[N[(N[(N[(C - A), $MachinePrecision] - N[Sqrt[N[(N[(C - A), $MachinePrecision] * N[(C - A), $MachinePrecision] + N[(B * B), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision]], $MachinePrecision] * N[(1.0 / Pi), $MachinePrecision]), $MachinePrecision] * 180.0), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(N[ArcTan[N[(-0.5 * N[(B / N[(C - A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(180.0 / Pi), $MachinePrecision]), $MachinePrecision], N[(N[(N[ArcTan[N[(N[(N[(C - A), $MachinePrecision] / B), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision] * 180.0), $MachinePrecision]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \left(\left(C - A\right) - \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right) \cdot \frac{1}{B}\\
    \mathbf{if}\;t\_0 \leq -0.1:\\
    \;\;\;\;\left(\tan^{-1} \left(\frac{\left(C - A\right) - \sqrt{\mathsf{fma}\left(C - A, C - A, B \cdot B\right)}}{B}\right) \cdot \frac{1}{\pi}\right) \cdot 180\\
    
    \mathbf{elif}\;t\_0 \leq 0:\\
    \;\;\;\;\tan^{-1} \left(-0.5 \cdot \frac{B}{C - A}\right) \cdot \frac{180}{\pi}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{\tan^{-1} \left(\frac{C - A}{B} + 1\right)}{\pi} \cdot 180\\
    
    
    \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)))))) < -0.10000000000000001

      1. Initial program 63.2%

        \[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. lift-/.f64N/A

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

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

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

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

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

          \[\leadsto 180 \cdot \left(\frac{1}{\mathsf{PI}\left(\right)} \cdot \tan^{-1} \color{blue}{\left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}\right) \]
        7. *-commutativeN/A

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

          \[\leadsto 180 \cdot \left(\frac{1}{\mathsf{PI}\left(\right)} \cdot \tan^{-1} \left(\left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right) \cdot \color{blue}{\frac{1}{B}}\right)\right) \]
        9. un-div-invN/A

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

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

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

      if -0.10000000000000001 < (*.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)))))) < 0.0

      1. Initial program 14.4%

        \[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. lift-/.f64N/A

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

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

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

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

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

          \[\leadsto 180 \cdot \left(\frac{1}{\mathsf{PI}\left(\right)} \cdot \tan^{-1} \color{blue}{\left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}\right) \]
        7. *-commutativeN/A

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

          \[\leadsto 180 \cdot \left(\frac{1}{\mathsf{PI}\left(\right)} \cdot \tan^{-1} \left(\left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right) \cdot \color{blue}{\frac{1}{B}}\right)\right) \]
        9. un-div-invN/A

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

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

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

        \[\leadsto 180 \cdot \left(\frac{1}{\mathsf{PI}\left(\right)} \cdot \tan^{-1} \color{blue}{\left(\frac{1}{2} \cdot \frac{B}{A}\right)}\right) \]
      6. Step-by-step derivation
        1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

          \[\leadsto \color{blue}{\frac{180}{\mathsf{PI}\left(\right)}} \cdot \tan^{-1} \left(\frac{B}{A} \cdot \frac{1}{2}\right) \]
        7. lower-*.f6456.9

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

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

        \[\leadsto \frac{180}{\mathsf{PI}\left(\right)} \cdot \tan^{-1} \color{blue}{\left(\frac{-1}{2} \cdot \frac{B}{C - A}\right)} \]
      11. Step-by-step derivation
        1. *-commutativeN/A

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

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

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

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

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

      if 0.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))))))

      1. Initial program 60.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. Add Preprocessing
      3. Taylor expanded in B around -inf

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

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

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

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

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

          \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\color{blue}{\frac{C - A}{B}} + 1\right)}{\mathsf{PI}\left(\right)} \]
        6. lower--.f6480.3

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

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

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

    Alternative 4: 64.7% accurate, 2.2× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;A \leq -1.85 \cdot 10^{-7}:\\ \;\;\;\;\tan^{-1} \left(-0.5 \cdot \frac{B}{C - A}\right) \cdot \frac{180}{\pi}\\ \mathbf{elif}\;A \leq 9.6 \cdot 10^{-150}:\\ \;\;\;\;\tan^{-1} \left(\frac{C - \sqrt{\mathsf{fma}\left(B, B, C \cdot C\right)}}{B}\right) \cdot \frac{180}{\pi}\\ \mathbf{else}:\\ \;\;\;\;\frac{\tan^{-1} \left(\frac{C - A}{B} + 1\right)}{\pi} \cdot 180\\ \end{array} \end{array} \]
    (FPCore (A B C)
     :precision binary64
     (if (<= A -1.85e-7)
       (* (atan (* -0.5 (/ B (- C A)))) (/ 180.0 PI))
       (if (<= A 9.6e-150)
         (* (atan (/ (- C (sqrt (fma B B (* C C)))) B)) (/ 180.0 PI))
         (* (/ (atan (+ (/ (- C A) B) 1.0)) PI) 180.0))))
    double code(double A, double B, double C) {
    	double tmp;
    	if (A <= -1.85e-7) {
    		tmp = atan((-0.5 * (B / (C - A)))) * (180.0 / ((double) M_PI));
    	} else if (A <= 9.6e-150) {
    		tmp = atan(((C - sqrt(fma(B, B, (C * C)))) / B)) * (180.0 / ((double) M_PI));
    	} else {
    		tmp = (atan((((C - A) / B) + 1.0)) / ((double) M_PI)) * 180.0;
    	}
    	return tmp;
    }
    
    function code(A, B, C)
    	tmp = 0.0
    	if (A <= -1.85e-7)
    		tmp = Float64(atan(Float64(-0.5 * Float64(B / Float64(C - A)))) * Float64(180.0 / pi));
    	elseif (A <= 9.6e-150)
    		tmp = Float64(atan(Float64(Float64(C - sqrt(fma(B, B, Float64(C * C)))) / B)) * Float64(180.0 / pi));
    	else
    		tmp = Float64(Float64(atan(Float64(Float64(Float64(C - A) / B) + 1.0)) / pi) * 180.0);
    	end
    	return tmp
    end
    
    code[A_, B_, C_] := If[LessEqual[A, -1.85e-7], N[(N[ArcTan[N[(-0.5 * N[(B / N[(C - A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(180.0 / Pi), $MachinePrecision]), $MachinePrecision], If[LessEqual[A, 9.6e-150], N[(N[ArcTan[N[(N[(C - N[Sqrt[N[(B * B + N[(C * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision]], $MachinePrecision] * N[(180.0 / Pi), $MachinePrecision]), $MachinePrecision], N[(N[(N[ArcTan[N[(N[(N[(C - A), $MachinePrecision] / B), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision] * 180.0), $MachinePrecision]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;A \leq -1.85 \cdot 10^{-7}:\\
    \;\;\;\;\tan^{-1} \left(-0.5 \cdot \frac{B}{C - A}\right) \cdot \frac{180}{\pi}\\
    
    \mathbf{elif}\;A \leq 9.6 \cdot 10^{-150}:\\
    \;\;\;\;\tan^{-1} \left(\frac{C - \sqrt{\mathsf{fma}\left(B, B, C \cdot C\right)}}{B}\right) \cdot \frac{180}{\pi}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{\tan^{-1} \left(\frac{C - A}{B} + 1\right)}{\pi} \cdot 180\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if A < -1.85000000000000002e-7

      1. Initial program 22.8%

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

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

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

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

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

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

          \[\leadsto 180 \cdot \left(\frac{1}{\mathsf{PI}\left(\right)} \cdot \tan^{-1} \color{blue}{\left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}\right) \]
        7. *-commutativeN/A

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

          \[\leadsto 180 \cdot \left(\frac{1}{\mathsf{PI}\left(\right)} \cdot \tan^{-1} \left(\left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right) \cdot \color{blue}{\frac{1}{B}}\right)\right) \]
        9. un-div-invN/A

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

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

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

        \[\leadsto 180 \cdot \left(\frac{1}{\mathsf{PI}\left(\right)} \cdot \tan^{-1} \color{blue}{\left(\frac{1}{2} \cdot \frac{B}{A}\right)}\right) \]
      6. Step-by-step derivation
        1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{180}{\mathsf{PI}\left(\right)} \cdot \tan^{-1} \color{blue}{\left(\frac{-1}{2} \cdot \frac{B}{C - A}\right)} \]
      11. Step-by-step derivation
        1. *-commutativeN/A

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

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

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

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

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

      if -1.85000000000000002e-7 < A < 9.6e-150

      1. Initial program 63.0%

        \[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      2. Add Preprocessing
      3. Taylor expanded in A around 0

        \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{C - \sqrt{{B}^{2} + {C}^{2}}}{B}\right)}}{\mathsf{PI}\left(\right)} \]
      4. Step-by-step derivation
        1. lower-/.f64N/A

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

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

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

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

          \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{C - \sqrt{\color{blue}{\mathsf{fma}\left(B, B, {C}^{2}\right)}}}{B}\right)}{\mathsf{PI}\left(\right)} \]
        6. unpow2N/A

          \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{C - \sqrt{\mathsf{fma}\left(B, B, \color{blue}{C \cdot C}\right)}}{B}\right)}{\mathsf{PI}\left(\right)} \]
        7. lower-*.f6461.9

          \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{C - \sqrt{\mathsf{fma}\left(B, B, \color{blue}{C \cdot C}\right)}}{B}\right)}{\pi} \]
      5. Applied rewrites61.9%

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

          \[\leadsto \color{blue}{180 \cdot \frac{\tan^{-1} \left(\frac{C - \sqrt{\mathsf{fma}\left(B, B, C \cdot C\right)}}{B}\right)}{\mathsf{PI}\left(\right)}} \]
        2. *-commutativeN/A

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

          \[\leadsto \color{blue}{\frac{\tan^{-1} \left(\frac{C - \sqrt{\mathsf{fma}\left(B, B, C \cdot C\right)}}{B}\right)}{\mathsf{PI}\left(\right)}} \cdot 180 \]
        4. div-invN/A

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

          \[\leadsto \left(\tan^{-1} \left(\frac{C - \sqrt{\mathsf{fma}\left(B, B, C \cdot C\right)}}{B}\right) \cdot \color{blue}{\frac{1}{\mathsf{PI}\left(\right)}}\right) \cdot 180 \]
        6. associate-*l*N/A

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

          \[\leadsto \color{blue}{\tan^{-1} \left(\frac{C - \sqrt{\mathsf{fma}\left(B, B, C \cdot C\right)}}{B}\right) \cdot \left(\frac{1}{\mathsf{PI}\left(\right)} \cdot 180\right)} \]
      7. Applied rewrites61.9%

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

      if 9.6e-150 < A

      1. Initial program 70.2%

        \[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      2. Add Preprocessing
      3. Taylor expanded in B around -inf

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

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

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

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

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

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

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;A \leq -1.85 \cdot 10^{-7}:\\ \;\;\;\;\tan^{-1} \left(-0.5 \cdot \frac{B}{C - A}\right) \cdot \frac{180}{\pi}\\ \mathbf{elif}\;A \leq 9.6 \cdot 10^{-150}:\\ \;\;\;\;\tan^{-1} \left(\frac{C - \sqrt{\mathsf{fma}\left(B, B, C \cdot C\right)}}{B}\right) \cdot \frac{180}{\pi}\\ \mathbf{else}:\\ \;\;\;\;\frac{\tan^{-1} \left(\frac{C - A}{B} + 1\right)}{\pi} \cdot 180\\ \end{array} \]
    5. Add Preprocessing

    Alternative 5: 64.7% accurate, 2.2× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;A \leq -1.85 \cdot 10^{-7}:\\ \;\;\;\;\tan^{-1} \left(-0.5 \cdot \frac{B}{C - A}\right) \cdot \frac{180}{\pi}\\ \mathbf{elif}\;A \leq 9.6 \cdot 10^{-150}:\\ \;\;\;\;\frac{\tan^{-1} \left(\frac{C - \sqrt{\mathsf{fma}\left(B, B, C \cdot C\right)}}{B}\right)}{\pi} \cdot 180\\ \mathbf{else}:\\ \;\;\;\;\frac{\tan^{-1} \left(\frac{C - A}{B} + 1\right)}{\pi} \cdot 180\\ \end{array} \end{array} \]
    (FPCore (A B C)
     :precision binary64
     (if (<= A -1.85e-7)
       (* (atan (* -0.5 (/ B (- C A)))) (/ 180.0 PI))
       (if (<= A 9.6e-150)
         (* (/ (atan (/ (- C (sqrt (fma B B (* C C)))) B)) PI) 180.0)
         (* (/ (atan (+ (/ (- C A) B) 1.0)) PI) 180.0))))
    double code(double A, double B, double C) {
    	double tmp;
    	if (A <= -1.85e-7) {
    		tmp = atan((-0.5 * (B / (C - A)))) * (180.0 / ((double) M_PI));
    	} else if (A <= 9.6e-150) {
    		tmp = (atan(((C - sqrt(fma(B, B, (C * C)))) / B)) / ((double) M_PI)) * 180.0;
    	} else {
    		tmp = (atan((((C - A) / B) + 1.0)) / ((double) M_PI)) * 180.0;
    	}
    	return tmp;
    }
    
    function code(A, B, C)
    	tmp = 0.0
    	if (A <= -1.85e-7)
    		tmp = Float64(atan(Float64(-0.5 * Float64(B / Float64(C - A)))) * Float64(180.0 / pi));
    	elseif (A <= 9.6e-150)
    		tmp = Float64(Float64(atan(Float64(Float64(C - sqrt(fma(B, B, Float64(C * C)))) / B)) / pi) * 180.0);
    	else
    		tmp = Float64(Float64(atan(Float64(Float64(Float64(C - A) / B) + 1.0)) / pi) * 180.0);
    	end
    	return tmp
    end
    
    code[A_, B_, C_] := If[LessEqual[A, -1.85e-7], N[(N[ArcTan[N[(-0.5 * N[(B / N[(C - A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(180.0 / Pi), $MachinePrecision]), $MachinePrecision], If[LessEqual[A, 9.6e-150], N[(N[(N[ArcTan[N[(N[(C - N[Sqrt[N[(B * B + N[(C * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision] * 180.0), $MachinePrecision], N[(N[(N[ArcTan[N[(N[(N[(C - A), $MachinePrecision] / B), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision] * 180.0), $MachinePrecision]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;A \leq -1.85 \cdot 10^{-7}:\\
    \;\;\;\;\tan^{-1} \left(-0.5 \cdot \frac{B}{C - A}\right) \cdot \frac{180}{\pi}\\
    
    \mathbf{elif}\;A \leq 9.6 \cdot 10^{-150}:\\
    \;\;\;\;\frac{\tan^{-1} \left(\frac{C - \sqrt{\mathsf{fma}\left(B, B, C \cdot C\right)}}{B}\right)}{\pi} \cdot 180\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{\tan^{-1} \left(\frac{C - A}{B} + 1\right)}{\pi} \cdot 180\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if A < -1.85000000000000002e-7

      1. Initial program 22.8%

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

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

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

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

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

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

          \[\leadsto 180 \cdot \left(\frac{1}{\mathsf{PI}\left(\right)} \cdot \tan^{-1} \color{blue}{\left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}\right) \]
        7. *-commutativeN/A

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

          \[\leadsto 180 \cdot \left(\frac{1}{\mathsf{PI}\left(\right)} \cdot \tan^{-1} \left(\left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right) \cdot \color{blue}{\frac{1}{B}}\right)\right) \]
        9. un-div-invN/A

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

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

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

        \[\leadsto 180 \cdot \left(\frac{1}{\mathsf{PI}\left(\right)} \cdot \tan^{-1} \color{blue}{\left(\frac{1}{2} \cdot \frac{B}{A}\right)}\right) \]
      6. Step-by-step derivation
        1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{180}{\mathsf{PI}\left(\right)} \cdot \tan^{-1} \color{blue}{\left(\frac{-1}{2} \cdot \frac{B}{C - A}\right)} \]
      11. Step-by-step derivation
        1. *-commutativeN/A

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

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

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

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

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

      if -1.85000000000000002e-7 < A < 9.6e-150

      1. Initial program 63.0%

        \[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      2. Add Preprocessing
      3. Taylor expanded in A around 0

        \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{C - \sqrt{{B}^{2} + {C}^{2}}}{B}\right)}}{\mathsf{PI}\left(\right)} \]
      4. Step-by-step derivation
        1. lower-/.f64N/A

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

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

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

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

          \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{C - \sqrt{\color{blue}{\mathsf{fma}\left(B, B, {C}^{2}\right)}}}{B}\right)}{\mathsf{PI}\left(\right)} \]
        6. unpow2N/A

          \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{C - \sqrt{\mathsf{fma}\left(B, B, \color{blue}{C \cdot C}\right)}}{B}\right)}{\mathsf{PI}\left(\right)} \]
        7. lower-*.f6461.9

          \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{C - \sqrt{\mathsf{fma}\left(B, B, \color{blue}{C \cdot C}\right)}}{B}\right)}{\pi} \]
      5. Applied rewrites61.9%

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

      if 9.6e-150 < A

      1. Initial program 70.2%

        \[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      2. Add Preprocessing
      3. Taylor expanded in B around -inf

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

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

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

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

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

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

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;A \leq -1.85 \cdot 10^{-7}:\\ \;\;\;\;\tan^{-1} \left(-0.5 \cdot \frac{B}{C - A}\right) \cdot \frac{180}{\pi}\\ \mathbf{elif}\;A \leq 9.6 \cdot 10^{-150}:\\ \;\;\;\;\frac{\tan^{-1} \left(\frac{C - \sqrt{\mathsf{fma}\left(B, B, C \cdot C\right)}}{B}\right)}{\pi} \cdot 180\\ \mathbf{else}:\\ \;\;\;\;\frac{\tan^{-1} \left(\frac{C - A}{B} + 1\right)}{\pi} \cdot 180\\ \end{array} \]
    5. Add Preprocessing

    Alternative 6: 55.9% accurate, 2.5× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;A \leq -8.5 \cdot 10^{-92}:\\ \;\;\;\;\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right) \cdot \frac{180}{\pi}\\ \mathbf{elif}\;A \leq 2.1 \cdot 10^{+69}:\\ \;\;\;\;\frac{\tan^{-1} \left(\frac{C}{B} + 1\right)}{\pi} \cdot 180\\ \mathbf{else}:\\ \;\;\;\;\frac{\tan^{-1} \left(-2 \cdot \frac{A}{B}\right)}{\pi} \cdot 180\\ \end{array} \end{array} \]
    (FPCore (A B C)
     :precision binary64
     (if (<= A -8.5e-92)
       (* (atan (* (/ B A) 0.5)) (/ 180.0 PI))
       (if (<= A 2.1e+69)
         (* (/ (atan (+ (/ C B) 1.0)) PI) 180.0)
         (* (/ (atan (* -2.0 (/ A B))) PI) 180.0))))
    double code(double A, double B, double C) {
    	double tmp;
    	if (A <= -8.5e-92) {
    		tmp = atan(((B / A) * 0.5)) * (180.0 / ((double) M_PI));
    	} else if (A <= 2.1e+69) {
    		tmp = (atan(((C / B) + 1.0)) / ((double) M_PI)) * 180.0;
    	} else {
    		tmp = (atan((-2.0 * (A / B))) / ((double) M_PI)) * 180.0;
    	}
    	return tmp;
    }
    
    public static double code(double A, double B, double C) {
    	double tmp;
    	if (A <= -8.5e-92) {
    		tmp = Math.atan(((B / A) * 0.5)) * (180.0 / Math.PI);
    	} else if (A <= 2.1e+69) {
    		tmp = (Math.atan(((C / B) + 1.0)) / Math.PI) * 180.0;
    	} else {
    		tmp = (Math.atan((-2.0 * (A / B))) / Math.PI) * 180.0;
    	}
    	return tmp;
    }
    
    def code(A, B, C):
    	tmp = 0
    	if A <= -8.5e-92:
    		tmp = math.atan(((B / A) * 0.5)) * (180.0 / math.pi)
    	elif A <= 2.1e+69:
    		tmp = (math.atan(((C / B) + 1.0)) / math.pi) * 180.0
    	else:
    		tmp = (math.atan((-2.0 * (A / B))) / math.pi) * 180.0
    	return tmp
    
    function code(A, B, C)
    	tmp = 0.0
    	if (A <= -8.5e-92)
    		tmp = Float64(atan(Float64(Float64(B / A) * 0.5)) * Float64(180.0 / pi));
    	elseif (A <= 2.1e+69)
    		tmp = Float64(Float64(atan(Float64(Float64(C / B) + 1.0)) / pi) * 180.0);
    	else
    		tmp = Float64(Float64(atan(Float64(-2.0 * Float64(A / B))) / pi) * 180.0);
    	end
    	return tmp
    end
    
    function tmp_2 = code(A, B, C)
    	tmp = 0.0;
    	if (A <= -8.5e-92)
    		tmp = atan(((B / A) * 0.5)) * (180.0 / pi);
    	elseif (A <= 2.1e+69)
    		tmp = (atan(((C / B) + 1.0)) / pi) * 180.0;
    	else
    		tmp = (atan((-2.0 * (A / B))) / pi) * 180.0;
    	end
    	tmp_2 = tmp;
    end
    
    code[A_, B_, C_] := If[LessEqual[A, -8.5e-92], N[(N[ArcTan[N[(N[(B / A), $MachinePrecision] * 0.5), $MachinePrecision]], $MachinePrecision] * N[(180.0 / Pi), $MachinePrecision]), $MachinePrecision], If[LessEqual[A, 2.1e+69], N[(N[(N[ArcTan[N[(N[(C / B), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision] * 180.0), $MachinePrecision], N[(N[(N[ArcTan[N[(-2.0 * N[(A / B), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision] * 180.0), $MachinePrecision]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;A \leq -8.5 \cdot 10^{-92}:\\
    \;\;\;\;\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right) \cdot \frac{180}{\pi}\\
    
    \mathbf{elif}\;A \leq 2.1 \cdot 10^{+69}:\\
    \;\;\;\;\frac{\tan^{-1} \left(\frac{C}{B} + 1\right)}{\pi} \cdot 180\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{\tan^{-1} \left(-2 \cdot \frac{A}{B}\right)}{\pi} \cdot 180\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if A < -8.50000000000000067e-92

      1. Initial program 27.5%

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

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

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

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

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

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

          \[\leadsto 180 \cdot \left(\frac{1}{\mathsf{PI}\left(\right)} \cdot \tan^{-1} \color{blue}{\left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}\right) \]
        7. *-commutativeN/A

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

          \[\leadsto 180 \cdot \left(\frac{1}{\mathsf{PI}\left(\right)} \cdot \tan^{-1} \left(\left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right) \cdot \color{blue}{\frac{1}{B}}\right)\right) \]
        9. un-div-invN/A

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

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

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

        \[\leadsto 180 \cdot \left(\frac{1}{\mathsf{PI}\left(\right)} \cdot \tan^{-1} \color{blue}{\left(\frac{1}{2} \cdot \frac{B}{A}\right)}\right) \]
      6. Step-by-step derivation
        1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

          \[\leadsto \color{blue}{\frac{180}{\mathsf{PI}\left(\right)}} \cdot \tan^{-1} \left(\frac{B}{A} \cdot \frac{1}{2}\right) \]
        7. lower-*.f6460.1

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

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

      if -8.50000000000000067e-92 < A < 2.10000000000000015e69

      1. Initial program 60.3%

        \[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
      2. Add Preprocessing
      3. Taylor expanded in B around -inf

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

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

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

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

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

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

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

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

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{C}{B} + 1\right)}{\mathsf{PI}\left(\right)} \]
      7. Step-by-step derivation
        1. Applied rewrites54.1%

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

        if 2.10000000000000015e69 < A

        1. Initial program 86.9%

          \[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
        2. Add Preprocessing
        3. Taylor expanded in A around inf

          \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(-2 \cdot \frac{A}{B}\right)}}{\mathsf{PI}\left(\right)} \]
        4. Step-by-step derivation
          1. *-commutativeN/A

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

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

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

          \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{A}{B} \cdot -2\right)}}{\pi} \]
      8. Recombined 3 regimes into one program.
      9. Final simplification62.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;A \leq -8.5 \cdot 10^{-92}:\\ \;\;\;\;\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right) \cdot \frac{180}{\pi}\\ \mathbf{elif}\;A \leq 2.1 \cdot 10^{+69}:\\ \;\;\;\;\frac{\tan^{-1} \left(\frac{C}{B} + 1\right)}{\pi} \cdot 180\\ \mathbf{else}:\\ \;\;\;\;\frac{\tan^{-1} \left(-2 \cdot \frac{A}{B}\right)}{\pi} \cdot 180\\ \end{array} \]
      10. Add Preprocessing

      Alternative 7: 55.8% accurate, 2.5× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;A \leq -8.5 \cdot 10^{-92}:\\ \;\;\;\;\frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\pi} \cdot 180\\ \mathbf{elif}\;A \leq 2.1 \cdot 10^{+69}:\\ \;\;\;\;\frac{\tan^{-1} \left(\frac{C}{B} + 1\right)}{\pi} \cdot 180\\ \mathbf{else}:\\ \;\;\;\;\frac{\tan^{-1} \left(-2 \cdot \frac{A}{B}\right)}{\pi} \cdot 180\\ \end{array} \end{array} \]
      (FPCore (A B C)
       :precision binary64
       (if (<= A -8.5e-92)
         (* (/ (atan (* (/ B A) 0.5)) PI) 180.0)
         (if (<= A 2.1e+69)
           (* (/ (atan (+ (/ C B) 1.0)) PI) 180.0)
           (* (/ (atan (* -2.0 (/ A B))) PI) 180.0))))
      double code(double A, double B, double C) {
      	double tmp;
      	if (A <= -8.5e-92) {
      		tmp = (atan(((B / A) * 0.5)) / ((double) M_PI)) * 180.0;
      	} else if (A <= 2.1e+69) {
      		tmp = (atan(((C / B) + 1.0)) / ((double) M_PI)) * 180.0;
      	} else {
      		tmp = (atan((-2.0 * (A / B))) / ((double) M_PI)) * 180.0;
      	}
      	return tmp;
      }
      
      public static double code(double A, double B, double C) {
      	double tmp;
      	if (A <= -8.5e-92) {
      		tmp = (Math.atan(((B / A) * 0.5)) / Math.PI) * 180.0;
      	} else if (A <= 2.1e+69) {
      		tmp = (Math.atan(((C / B) + 1.0)) / Math.PI) * 180.0;
      	} else {
      		tmp = (Math.atan((-2.0 * (A / B))) / Math.PI) * 180.0;
      	}
      	return tmp;
      }
      
      def code(A, B, C):
      	tmp = 0
      	if A <= -8.5e-92:
      		tmp = (math.atan(((B / A) * 0.5)) / math.pi) * 180.0
      	elif A <= 2.1e+69:
      		tmp = (math.atan(((C / B) + 1.0)) / math.pi) * 180.0
      	else:
      		tmp = (math.atan((-2.0 * (A / B))) / math.pi) * 180.0
      	return tmp
      
      function code(A, B, C)
      	tmp = 0.0
      	if (A <= -8.5e-92)
      		tmp = Float64(Float64(atan(Float64(Float64(B / A) * 0.5)) / pi) * 180.0);
      	elseif (A <= 2.1e+69)
      		tmp = Float64(Float64(atan(Float64(Float64(C / B) + 1.0)) / pi) * 180.0);
      	else
      		tmp = Float64(Float64(atan(Float64(-2.0 * Float64(A / B))) / pi) * 180.0);
      	end
      	return tmp
      end
      
      function tmp_2 = code(A, B, C)
      	tmp = 0.0;
      	if (A <= -8.5e-92)
      		tmp = (atan(((B / A) * 0.5)) / pi) * 180.0;
      	elseif (A <= 2.1e+69)
      		tmp = (atan(((C / B) + 1.0)) / pi) * 180.0;
      	else
      		tmp = (atan((-2.0 * (A / B))) / pi) * 180.0;
      	end
      	tmp_2 = tmp;
      end
      
      code[A_, B_, C_] := If[LessEqual[A, -8.5e-92], N[(N[(N[ArcTan[N[(N[(B / A), $MachinePrecision] * 0.5), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision] * 180.0), $MachinePrecision], If[LessEqual[A, 2.1e+69], N[(N[(N[ArcTan[N[(N[(C / B), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision] * 180.0), $MachinePrecision], N[(N[(N[ArcTan[N[(-2.0 * N[(A / B), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision] * 180.0), $MachinePrecision]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;A \leq -8.5 \cdot 10^{-92}:\\
      \;\;\;\;\frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\pi} \cdot 180\\
      
      \mathbf{elif}\;A \leq 2.1 \cdot 10^{+69}:\\
      \;\;\;\;\frac{\tan^{-1} \left(\frac{C}{B} + 1\right)}{\pi} \cdot 180\\
      
      \mathbf{else}:\\
      \;\;\;\;\frac{\tan^{-1} \left(-2 \cdot \frac{A}{B}\right)}{\pi} \cdot 180\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if A < -8.50000000000000067e-92

        1. Initial program 27.5%

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

          \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{1}{2} \cdot \frac{B}{A}\right)}}{\mathsf{PI}\left(\right)} \]
        4. Step-by-step derivation
          1. *-commutativeN/A

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

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

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

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

        if -8.50000000000000067e-92 < A < 2.10000000000000015e69

        1. Initial program 60.3%

          \[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
        2. Add Preprocessing
        3. Taylor expanded in B around -inf

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

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

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

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

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

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

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

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

          \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{C}{B} + 1\right)}{\mathsf{PI}\left(\right)} \]
        7. Step-by-step derivation
          1. Applied rewrites54.1%

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

          if 2.10000000000000015e69 < A

          1. Initial program 86.9%

            \[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
          2. Add Preprocessing
          3. Taylor expanded in A around inf

            \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(-2 \cdot \frac{A}{B}\right)}}{\mathsf{PI}\left(\right)} \]
          4. Step-by-step derivation
            1. *-commutativeN/A

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

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

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

            \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{A}{B} \cdot -2\right)}}{\pi} \]
        8. Recombined 3 regimes into one program.
        9. Final simplification62.7%

          \[\leadsto \begin{array}{l} \mathbf{if}\;A \leq -8.5 \cdot 10^{-92}:\\ \;\;\;\;\frac{\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right)}{\pi} \cdot 180\\ \mathbf{elif}\;A \leq 2.1 \cdot 10^{+69}:\\ \;\;\;\;\frac{\tan^{-1} \left(\frac{C}{B} + 1\right)}{\pi} \cdot 180\\ \mathbf{else}:\\ \;\;\;\;\frac{\tan^{-1} \left(-2 \cdot \frac{A}{B}\right)}{\pi} \cdot 180\\ \end{array} \]
        10. Add Preprocessing

        Alternative 8: 60.2% accurate, 2.5× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;A \leq -8.5 \cdot 10^{-92}:\\ \;\;\;\;\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right) \cdot \frac{180}{\pi}\\ \mathbf{else}:\\ \;\;\;\;\frac{\tan^{-1} \left(\frac{C - A}{B} + 1\right)}{\pi} \cdot 180\\ \end{array} \end{array} \]
        (FPCore (A B C)
         :precision binary64
         (if (<= A -8.5e-92)
           (* (atan (* (/ B A) 0.5)) (/ 180.0 PI))
           (* (/ (atan (+ (/ (- C A) B) 1.0)) PI) 180.0)))
        double code(double A, double B, double C) {
        	double tmp;
        	if (A <= -8.5e-92) {
        		tmp = atan(((B / A) * 0.5)) * (180.0 / ((double) M_PI));
        	} else {
        		tmp = (atan((((C - A) / B) + 1.0)) / ((double) M_PI)) * 180.0;
        	}
        	return tmp;
        }
        
        public static double code(double A, double B, double C) {
        	double tmp;
        	if (A <= -8.5e-92) {
        		tmp = Math.atan(((B / A) * 0.5)) * (180.0 / Math.PI);
        	} else {
        		tmp = (Math.atan((((C - A) / B) + 1.0)) / Math.PI) * 180.0;
        	}
        	return tmp;
        }
        
        def code(A, B, C):
        	tmp = 0
        	if A <= -8.5e-92:
        		tmp = math.atan(((B / A) * 0.5)) * (180.0 / math.pi)
        	else:
        		tmp = (math.atan((((C - A) / B) + 1.0)) / math.pi) * 180.0
        	return tmp
        
        function code(A, B, C)
        	tmp = 0.0
        	if (A <= -8.5e-92)
        		tmp = Float64(atan(Float64(Float64(B / A) * 0.5)) * Float64(180.0 / pi));
        	else
        		tmp = Float64(Float64(atan(Float64(Float64(Float64(C - A) / B) + 1.0)) / pi) * 180.0);
        	end
        	return tmp
        end
        
        function tmp_2 = code(A, B, C)
        	tmp = 0.0;
        	if (A <= -8.5e-92)
        		tmp = atan(((B / A) * 0.5)) * (180.0 / pi);
        	else
        		tmp = (atan((((C - A) / B) + 1.0)) / pi) * 180.0;
        	end
        	tmp_2 = tmp;
        end
        
        code[A_, B_, C_] := If[LessEqual[A, -8.5e-92], N[(N[ArcTan[N[(N[(B / A), $MachinePrecision] * 0.5), $MachinePrecision]], $MachinePrecision] * N[(180.0 / Pi), $MachinePrecision]), $MachinePrecision], N[(N[(N[ArcTan[N[(N[(N[(C - A), $MachinePrecision] / B), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision] * 180.0), $MachinePrecision]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;A \leq -8.5 \cdot 10^{-92}:\\
        \;\;\;\;\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right) \cdot \frac{180}{\pi}\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{\tan^{-1} \left(\frac{C - A}{B} + 1\right)}{\pi} \cdot 180\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if A < -8.50000000000000067e-92

          1. Initial program 27.5%

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

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

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

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

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

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

              \[\leadsto 180 \cdot \left(\frac{1}{\mathsf{PI}\left(\right)} \cdot \tan^{-1} \color{blue}{\left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}\right) \]
            7. *-commutativeN/A

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

              \[\leadsto 180 \cdot \left(\frac{1}{\mathsf{PI}\left(\right)} \cdot \tan^{-1} \left(\left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right) \cdot \color{blue}{\frac{1}{B}}\right)\right) \]
            9. un-div-invN/A

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

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

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

            \[\leadsto 180 \cdot \left(\frac{1}{\mathsf{PI}\left(\right)} \cdot \tan^{-1} \color{blue}{\left(\frac{1}{2} \cdot \frac{B}{A}\right)}\right) \]
          6. Step-by-step derivation
            1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

              \[\leadsto \color{blue}{\frac{180}{\mathsf{PI}\left(\right)}} \cdot \tan^{-1} \left(\frac{B}{A} \cdot \frac{1}{2}\right) \]
            7. lower-*.f6460.1

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

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

          if -8.50000000000000067e-92 < A

          1. Initial program 68.7%

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

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

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

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

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

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

              \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\color{blue}{\frac{C - A}{B}} + 1\right)}{\mathsf{PI}\left(\right)} \]
            6. lower--.f6468.9

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

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

          \[\leadsto \begin{array}{l} \mathbf{if}\;A \leq -8.5 \cdot 10^{-92}:\\ \;\;\;\;\tan^{-1} \left(\frac{B}{A} \cdot 0.5\right) \cdot \frac{180}{\pi}\\ \mathbf{else}:\\ \;\;\;\;\frac{\tan^{-1} \left(\frac{C - A}{B} + 1\right)}{\pi} \cdot 180\\ \end{array} \]
        5. Add Preprocessing

        Alternative 9: 50.4% accurate, 2.6× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;B \leq 7 \cdot 10^{-9}:\\ \;\;\;\;\frac{\tan^{-1} \left(\frac{C}{B} + 1\right)}{\pi} \cdot 180\\ \mathbf{else}:\\ \;\;\;\;\frac{\tan^{-1} -1}{\pi} \cdot 180\\ \end{array} \end{array} \]
        (FPCore (A B C)
         :precision binary64
         (if (<= B 7e-9)
           (* (/ (atan (+ (/ C B) 1.0)) PI) 180.0)
           (* (/ (atan -1.0) PI) 180.0)))
        double code(double A, double B, double C) {
        	double tmp;
        	if (B <= 7e-9) {
        		tmp = (atan(((C / B) + 1.0)) / ((double) M_PI)) * 180.0;
        	} else {
        		tmp = (atan(-1.0) / ((double) M_PI)) * 180.0;
        	}
        	return tmp;
        }
        
        public static double code(double A, double B, double C) {
        	double tmp;
        	if (B <= 7e-9) {
        		tmp = (Math.atan(((C / B) + 1.0)) / Math.PI) * 180.0;
        	} else {
        		tmp = (Math.atan(-1.0) / Math.PI) * 180.0;
        	}
        	return tmp;
        }
        
        def code(A, B, C):
        	tmp = 0
        	if B <= 7e-9:
        		tmp = (math.atan(((C / B) + 1.0)) / math.pi) * 180.0
        	else:
        		tmp = (math.atan(-1.0) / math.pi) * 180.0
        	return tmp
        
        function code(A, B, C)
        	tmp = 0.0
        	if (B <= 7e-9)
        		tmp = Float64(Float64(atan(Float64(Float64(C / B) + 1.0)) / pi) * 180.0);
        	else
        		tmp = Float64(Float64(atan(-1.0) / pi) * 180.0);
        	end
        	return tmp
        end
        
        function tmp_2 = code(A, B, C)
        	tmp = 0.0;
        	if (B <= 7e-9)
        		tmp = (atan(((C / B) + 1.0)) / pi) * 180.0;
        	else
        		tmp = (atan(-1.0) / pi) * 180.0;
        	end
        	tmp_2 = tmp;
        end
        
        code[A_, B_, C_] := If[LessEqual[B, 7e-9], N[(N[(N[ArcTan[N[(N[(C / B), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision] * 180.0), $MachinePrecision], N[(N[(N[ArcTan[-1.0], $MachinePrecision] / Pi), $MachinePrecision] * 180.0), $MachinePrecision]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;B \leq 7 \cdot 10^{-9}:\\
        \;\;\;\;\frac{\tan^{-1} \left(\frac{C}{B} + 1\right)}{\pi} \cdot 180\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{\tan^{-1} -1}{\pi} \cdot 180\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if B < 6.9999999999999998e-9

          1. Initial program 61.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. Add Preprocessing
          3. Taylor expanded in B around -inf

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

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

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

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

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

              \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\color{blue}{\frac{C - A}{B}} + 1\right)}{\mathsf{PI}\left(\right)} \]
            6. lower--.f6468.7

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

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

            \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{C}{B} + 1\right)}{\mathsf{PI}\left(\right)} \]
          7. Step-by-step derivation
            1. Applied rewrites51.9%

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

            if 6.9999999999999998e-9 < B

            1. Initial program 43.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. Add Preprocessing
            3. Taylor expanded in B around inf

              \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{-1}}{\mathsf{PI}\left(\right)} \]
            4. Step-by-step derivation
              1. Applied rewrites58.8%

                \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{-1}}{\pi} \]
            5. Recombined 2 regimes into one program.
            6. Final simplification53.8%

              \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq 7 \cdot 10^{-9}:\\ \;\;\;\;\frac{\tan^{-1} \left(\frac{C}{B} + 1\right)}{\pi} \cdot 180\\ \mathbf{else}:\\ \;\;\;\;\frac{\tan^{-1} -1}{\pi} \cdot 180\\ \end{array} \]
            7. Add Preprocessing

            Alternative 10: 44.4% accurate, 2.8× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;B \leq -2.8 \cdot 10^{-70}:\\ \;\;\;\;\frac{\tan^{-1} 1}{\pi} \cdot 180\\ \mathbf{elif}\;B \leq 1.28 \cdot 10^{-146}:\\ \;\;\;\;\frac{\tan^{-1} 0}{\pi} \cdot 180\\ \mathbf{else}:\\ \;\;\;\;\frac{\tan^{-1} -1}{\pi} \cdot 180\\ \end{array} \end{array} \]
            (FPCore (A B C)
             :precision binary64
             (if (<= B -2.8e-70)
               (* (/ (atan 1.0) PI) 180.0)
               (if (<= B 1.28e-146)
                 (* (/ (atan 0.0) PI) 180.0)
                 (* (/ (atan -1.0) PI) 180.0))))
            double code(double A, double B, double C) {
            	double tmp;
            	if (B <= -2.8e-70) {
            		tmp = (atan(1.0) / ((double) M_PI)) * 180.0;
            	} else if (B <= 1.28e-146) {
            		tmp = (atan(0.0) / ((double) M_PI)) * 180.0;
            	} else {
            		tmp = (atan(-1.0) / ((double) M_PI)) * 180.0;
            	}
            	return tmp;
            }
            
            public static double code(double A, double B, double C) {
            	double tmp;
            	if (B <= -2.8e-70) {
            		tmp = (Math.atan(1.0) / Math.PI) * 180.0;
            	} else if (B <= 1.28e-146) {
            		tmp = (Math.atan(0.0) / Math.PI) * 180.0;
            	} else {
            		tmp = (Math.atan(-1.0) / Math.PI) * 180.0;
            	}
            	return tmp;
            }
            
            def code(A, B, C):
            	tmp = 0
            	if B <= -2.8e-70:
            		tmp = (math.atan(1.0) / math.pi) * 180.0
            	elif B <= 1.28e-146:
            		tmp = (math.atan(0.0) / math.pi) * 180.0
            	else:
            		tmp = (math.atan(-1.0) / math.pi) * 180.0
            	return tmp
            
            function code(A, B, C)
            	tmp = 0.0
            	if (B <= -2.8e-70)
            		tmp = Float64(Float64(atan(1.0) / pi) * 180.0);
            	elseif (B <= 1.28e-146)
            		tmp = Float64(Float64(atan(0.0) / pi) * 180.0);
            	else
            		tmp = Float64(Float64(atan(-1.0) / pi) * 180.0);
            	end
            	return tmp
            end
            
            function tmp_2 = code(A, B, C)
            	tmp = 0.0;
            	if (B <= -2.8e-70)
            		tmp = (atan(1.0) / pi) * 180.0;
            	elseif (B <= 1.28e-146)
            		tmp = (atan(0.0) / pi) * 180.0;
            	else
            		tmp = (atan(-1.0) / pi) * 180.0;
            	end
            	tmp_2 = tmp;
            end
            
            code[A_, B_, C_] := If[LessEqual[B, -2.8e-70], N[(N[(N[ArcTan[1.0], $MachinePrecision] / Pi), $MachinePrecision] * 180.0), $MachinePrecision], If[LessEqual[B, 1.28e-146], N[(N[(N[ArcTan[0.0], $MachinePrecision] / Pi), $MachinePrecision] * 180.0), $MachinePrecision], N[(N[(N[ArcTan[-1.0], $MachinePrecision] / Pi), $MachinePrecision] * 180.0), $MachinePrecision]]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            \mathbf{if}\;B \leq -2.8 \cdot 10^{-70}:\\
            \;\;\;\;\frac{\tan^{-1} 1}{\pi} \cdot 180\\
            
            \mathbf{elif}\;B \leq 1.28 \cdot 10^{-146}:\\
            \;\;\;\;\frac{\tan^{-1} 0}{\pi} \cdot 180\\
            
            \mathbf{else}:\\
            \;\;\;\;\frac{\tan^{-1} -1}{\pi} \cdot 180\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 3 regimes
            2. if B < -2.7999999999999999e-70

              1. Initial program 50.7%

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

                \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{1}}{\mathsf{PI}\left(\right)} \]
              4. Step-by-step derivation
                1. Applied rewrites56.9%

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

                if -2.7999999999999999e-70 < B < 1.27999999999999992e-146

                1. Initial program 62.7%

                  \[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. Add Preprocessing
                3. Taylor expanded in C around inf

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

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

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

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

                    \[\leadsto 180 \cdot \frac{\tan^{-1} \left(-1 \cdot \color{blue}{0}\right)}{\mathsf{PI}\left(\right)} \]
                  5. metadata-eval28.6

                    \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{0}}{\pi} \]
                5. Applied rewrites28.6%

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

                if 1.27999999999999992e-146 < B

                1. Initial program 55.7%

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

                  \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{-1}}{\mathsf{PI}\left(\right)} \]
                4. Step-by-step derivation
                  1. Applied rewrites50.2%

                    \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{-1}}{\pi} \]
                5. Recombined 3 regimes into one program.
                6. Final simplification44.9%

                  \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq -2.8 \cdot 10^{-70}:\\ \;\;\;\;\frac{\tan^{-1} 1}{\pi} \cdot 180\\ \mathbf{elif}\;B \leq 1.28 \cdot 10^{-146}:\\ \;\;\;\;\frac{\tan^{-1} 0}{\pi} \cdot 180\\ \mathbf{else}:\\ \;\;\;\;\frac{\tan^{-1} -1}{\pi} \cdot 180\\ \end{array} \]
                7. Add Preprocessing

                Alternative 11: 29.3% accurate, 2.9× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;B \leq 1.28 \cdot 10^{-146}:\\ \;\;\;\;\frac{\tan^{-1} 0}{\pi} \cdot 180\\ \mathbf{else}:\\ \;\;\;\;\frac{\tan^{-1} -1}{\pi} \cdot 180\\ \end{array} \end{array} \]
                (FPCore (A B C)
                 :precision binary64
                 (if (<= B 1.28e-146)
                   (* (/ (atan 0.0) PI) 180.0)
                   (* (/ (atan -1.0) PI) 180.0)))
                double code(double A, double B, double C) {
                	double tmp;
                	if (B <= 1.28e-146) {
                		tmp = (atan(0.0) / ((double) M_PI)) * 180.0;
                	} else {
                		tmp = (atan(-1.0) / ((double) M_PI)) * 180.0;
                	}
                	return tmp;
                }
                
                public static double code(double A, double B, double C) {
                	double tmp;
                	if (B <= 1.28e-146) {
                		tmp = (Math.atan(0.0) / Math.PI) * 180.0;
                	} else {
                		tmp = (Math.atan(-1.0) / Math.PI) * 180.0;
                	}
                	return tmp;
                }
                
                def code(A, B, C):
                	tmp = 0
                	if B <= 1.28e-146:
                		tmp = (math.atan(0.0) / math.pi) * 180.0
                	else:
                		tmp = (math.atan(-1.0) / math.pi) * 180.0
                	return tmp
                
                function code(A, B, C)
                	tmp = 0.0
                	if (B <= 1.28e-146)
                		tmp = Float64(Float64(atan(0.0) / pi) * 180.0);
                	else
                		tmp = Float64(Float64(atan(-1.0) / pi) * 180.0);
                	end
                	return tmp
                end
                
                function tmp_2 = code(A, B, C)
                	tmp = 0.0;
                	if (B <= 1.28e-146)
                		tmp = (atan(0.0) / pi) * 180.0;
                	else
                		tmp = (atan(-1.0) / pi) * 180.0;
                	end
                	tmp_2 = tmp;
                end
                
                code[A_, B_, C_] := If[LessEqual[B, 1.28e-146], N[(N[(N[ArcTan[0.0], $MachinePrecision] / Pi), $MachinePrecision] * 180.0), $MachinePrecision], N[(N[(N[ArcTan[-1.0], $MachinePrecision] / Pi), $MachinePrecision] * 180.0), $MachinePrecision]]
                
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                \mathbf{if}\;B \leq 1.28 \cdot 10^{-146}:\\
                \;\;\;\;\frac{\tan^{-1} 0}{\pi} \cdot 180\\
                
                \mathbf{else}:\\
                \;\;\;\;\frac{\tan^{-1} -1}{\pi} \cdot 180\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if B < 1.27999999999999992e-146

                  1. Initial program 57.2%

                    \[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
                  2. Add Preprocessing
                  3. Taylor expanded in C around inf

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

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

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

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

                      \[\leadsto 180 \cdot \frac{\tan^{-1} \left(-1 \cdot \color{blue}{0}\right)}{\mathsf{PI}\left(\right)} \]
                    5. metadata-eval17.1

                      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{0}}{\pi} \]
                  5. Applied rewrites17.1%

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

                  if 1.27999999999999992e-146 < B

                  1. Initial program 55.7%

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

                    \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{-1}}{\mathsf{PI}\left(\right)} \]
                  4. Step-by-step derivation
                    1. Applied rewrites50.2%

                      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{-1}}{\pi} \]
                  5. Recombined 2 regimes into one program.
                  6. Final simplification29.9%

                    \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq 1.28 \cdot 10^{-146}:\\ \;\;\;\;\frac{\tan^{-1} 0}{\pi} \cdot 180\\ \mathbf{else}:\\ \;\;\;\;\frac{\tan^{-1} -1}{\pi} \cdot 180\\ \end{array} \]
                  7. Add Preprocessing

                  Alternative 12: 21.2% accurate, 3.1× speedup?

                  \[\begin{array}{l} \\ \frac{\tan^{-1} -1}{\pi} \cdot 180 \end{array} \]
                  (FPCore (A B C) :precision binary64 (* (/ (atan -1.0) PI) 180.0))
                  double code(double A, double B, double C) {
                  	return (atan(-1.0) / ((double) M_PI)) * 180.0;
                  }
                  
                  public static double code(double A, double B, double C) {
                  	return (Math.atan(-1.0) / Math.PI) * 180.0;
                  }
                  
                  def code(A, B, C):
                  	return (math.atan(-1.0) / math.pi) * 180.0
                  
                  function code(A, B, C)
                  	return Float64(Float64(atan(-1.0) / pi) * 180.0)
                  end
                  
                  function tmp = code(A, B, C)
                  	tmp = (atan(-1.0) / pi) * 180.0;
                  end
                  
                  code[A_, B_, C_] := N[(N[(N[ArcTan[-1.0], $MachinePrecision] / Pi), $MachinePrecision] * 180.0), $MachinePrecision]
                  
                  \begin{array}{l}
                  
                  \\
                  \frac{\tan^{-1} -1}{\pi} \cdot 180
                  \end{array}
                  
                  Derivation
                  1. Initial program 56.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. Add Preprocessing
                  3. Taylor expanded in B around inf

                    \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{-1}}{\mathsf{PI}\left(\right)} \]
                  4. Step-by-step derivation
                    1. Applied rewrites22.1%

                      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{-1}}{\pi} \]
                    2. Final simplification22.1%

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

                    Reproduce

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