ABCF->ab-angle angle

Percentage Accurate: 54.2% → 82.8%
Time: 7.2s
Alternatives: 6
Speedup: N/A×

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 6 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.2% 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: 82.8% accurate, N/A× speedup?

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

\\
\begin{array}{l}
t_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}\\
t_1 := 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \mathsf{hypot}\left(A - C, B\right)\right)\right)}{\pi}\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-84}:\\
\;\;\;\;t\_1\\

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

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


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

    1. Initial program 57.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. Step-by-step derivation
      1. lift-sqrt.f64N/A

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 14.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 C around inf

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

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

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

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

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

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

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

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, \frac{-1}{2}, \frac{A + -1 \cdot A}{B} \cdot -1\right)\right)}{\pi} \]
      8. distribute-rgt1-inN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, \frac{-1}{2}, \frac{\left(-1 + 1\right) \cdot A}{B} \cdot -1\right)\right)}{\pi} \]
      9. metadata-evalN/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, \frac{-1}{2}, \frac{0 \cdot A}{B} \cdot -1\right)\right)}{\pi} \]
      10. lower-*.f6459.1

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\mathsf{fma}\left(\frac{B}{C}, -0.5, \frac{0 \cdot A}{B} \cdot -1\right)\right)}{\pi} \]
    5. Applied rewrites59.1%

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

Alternative 2: 63.8% accurate, N/A× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;A \leq -7.2 \cdot 10^{-79}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{fma}\left(B \cdot \frac{C}{A}, -0.5, -0.5 \cdot B\right)}{A} \cdot -1\right)}{\pi}\\

\mathbf{else}:\\
\;\;\;\;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}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if A < -7.2000000000000005e-79

    1. Initial program 21.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. Taylor expanded in A around -inf

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

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

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

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

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

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

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{fma}\left(\frac{B \cdot C}{A}, \frac{-1}{2}, \frac{-1}{2} \cdot B\right)}{A} \cdot -1\right)}{\pi} \]
      7. associate-/l*N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{fma}\left(B \cdot \frac{C}{A}, \frac{-1}{2}, \frac{-1}{2} \cdot B\right)}{A} \cdot -1\right)}{\pi} \]
      8. lower-*.f64N/A

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

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{fma}\left(B \cdot \frac{C}{A}, \frac{-1}{2}, \frac{-1}{2} \cdot B\right)}{A} \cdot -1\right)}{\pi} \]
      10. lower-*.f6461.9

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

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

    if -7.2000000000000005e-79 < A

    1. Initial program 66.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. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 3: 63.1% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;A \leq -7.2 \cdot 10^{-79}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{fma}\left(B \cdot \frac{C}{A}, -0.5, -0.5 \cdot B\right)}{A} \cdot -1\right)}{\pi}\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{fma}\left(-1, C, {\left(\mathsf{fma}\left(B, B, {\left(\mathsf{fma}\left(-1, C, A\right)\right)}^{2}\right)\right)}^{0.5}\right) + A}{B} \cdot -1\right)}{\pi}\\ \end{array} \end{array} \]
(FPCore (A B C)
 :precision binary64
 (if (<= A -7.2e-79)
   (* 180.0 (/ (atan (* (/ (fma (* B (/ C A)) -0.5 (* -0.5 B)) A) -1.0)) PI))
   (*
    180.0
    (/
     (atan
      (*
       (/ (+ (fma -1.0 C (pow (fma B B (pow (fma -1.0 C A) 2.0)) 0.5)) A) B)
       -1.0))
     PI))))
double code(double A, double B, double C) {
	double tmp;
	if (A <= -7.2e-79) {
		tmp = 180.0 * (atan(((fma((B * (C / A)), -0.5, (-0.5 * B)) / A) * -1.0)) / ((double) M_PI));
	} else {
		tmp = 180.0 * (atan((((fma(-1.0, C, pow(fma(B, B, pow(fma(-1.0, C, A), 2.0)), 0.5)) + A) / B) * -1.0)) / ((double) M_PI));
	}
	return tmp;
}
function code(A, B, C)
	tmp = 0.0
	if (A <= -7.2e-79)
		tmp = Float64(180.0 * Float64(atan(Float64(Float64(fma(Float64(B * Float64(C / A)), -0.5, Float64(-0.5 * B)) / A) * -1.0)) / pi));
	else
		tmp = Float64(180.0 * Float64(atan(Float64(Float64(Float64(fma(-1.0, C, (fma(B, B, (fma(-1.0, C, A) ^ 2.0)) ^ 0.5)) + A) / B) * -1.0)) / pi));
	end
	return tmp
end
code[A_, B_, C_] := If[LessEqual[A, -7.2e-79], N[(180.0 * N[(N[ArcTan[N[(N[(N[(N[(B * N[(C / A), $MachinePrecision]), $MachinePrecision] * -0.5 + N[(-0.5 * B), $MachinePrecision]), $MachinePrecision] / A), $MachinePrecision] * -1.0), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], N[(180.0 * N[(N[ArcTan[N[(N[(N[(N[(-1.0 * C + N[Power[N[(B * B + N[Power[N[(-1.0 * C + A), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] + A), $MachinePrecision] / B), $MachinePrecision] * -1.0), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;A \leq -7.2 \cdot 10^{-79}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{fma}\left(B \cdot \frac{C}{A}, -0.5, -0.5 \cdot B\right)}{A} \cdot -1\right)}{\pi}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if A < -7.2000000000000005e-79

    1. Initial program 21.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. Taylor expanded in A around -inf

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

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

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

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

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

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

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{fma}\left(\frac{B \cdot C}{A}, \frac{-1}{2}, \frac{-1}{2} \cdot B\right)}{A} \cdot -1\right)}{\pi} \]
      7. associate-/l*N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{fma}\left(B \cdot \frac{C}{A}, \frac{-1}{2}, \frac{-1}{2} \cdot B\right)}{A} \cdot -1\right)}{\pi} \]
      8. lower-*.f64N/A

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

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{fma}\left(B \cdot \frac{C}{A}, \frac{-1}{2}, \frac{-1}{2} \cdot B\right)}{A} \cdot -1\right)}{\pi} \]
      10. lower-*.f6461.9

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

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

    if -7.2000000000000005e-79 < A

    1. Initial program 66.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 C around -inf

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

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

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

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

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

Alternative 4: 61.7% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;A \leq -7.2 \cdot 10^{-79}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\left(C \cdot \frac{\mathsf{fma}\left(-0.5, \frac{B}{A}, -0.5 \cdot \frac{B}{C}\right)}{A}\right) \cdot -1\right)}{\pi}\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{fma}\left(-1, C, {\left(\mathsf{fma}\left(B, B, {\left(\mathsf{fma}\left(-1, C, A\right)\right)}^{2}\right)\right)}^{0.5}\right) + A}{B} \cdot -1\right)}{\pi}\\ \end{array} \end{array} \]
(FPCore (A B C)
 :precision binary64
 (if (<= A -7.2e-79)
   (*
    180.0
    (/ (atan (* (* C (/ (fma -0.5 (/ B A) (* -0.5 (/ B C))) A)) -1.0)) PI))
   (*
    180.0
    (/
     (atan
      (*
       (/ (+ (fma -1.0 C (pow (fma B B (pow (fma -1.0 C A) 2.0)) 0.5)) A) B)
       -1.0))
     PI))))
double code(double A, double B, double C) {
	double tmp;
	if (A <= -7.2e-79) {
		tmp = 180.0 * (atan(((C * (fma(-0.5, (B / A), (-0.5 * (B / C))) / A)) * -1.0)) / ((double) M_PI));
	} else {
		tmp = 180.0 * (atan((((fma(-1.0, C, pow(fma(B, B, pow(fma(-1.0, C, A), 2.0)), 0.5)) + A) / B) * -1.0)) / ((double) M_PI));
	}
	return tmp;
}
function code(A, B, C)
	tmp = 0.0
	if (A <= -7.2e-79)
		tmp = Float64(180.0 * Float64(atan(Float64(Float64(C * Float64(fma(-0.5, Float64(B / A), Float64(-0.5 * Float64(B / C))) / A)) * -1.0)) / pi));
	else
		tmp = Float64(180.0 * Float64(atan(Float64(Float64(Float64(fma(-1.0, C, (fma(B, B, (fma(-1.0, C, A) ^ 2.0)) ^ 0.5)) + A) / B) * -1.0)) / pi));
	end
	return tmp
end
code[A_, B_, C_] := If[LessEqual[A, -7.2e-79], N[(180.0 * N[(N[ArcTan[N[(N[(C * N[(N[(-0.5 * N[(B / A), $MachinePrecision] + N[(-0.5 * N[(B / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision] * -1.0), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], N[(180.0 * N[(N[ArcTan[N[(N[(N[(N[(-1.0 * C + N[Power[N[(B * B + N[Power[N[(-1.0 * C + A), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] + A), $MachinePrecision] / B), $MachinePrecision] * -1.0), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;A \leq -7.2 \cdot 10^{-79}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\left(C \cdot \frac{\mathsf{fma}\left(-0.5, \frac{B}{A}, -0.5 \cdot \frac{B}{C}\right)}{A}\right) \cdot -1\right)}{\pi}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if A < -7.2000000000000005e-79

    1. Initial program 21.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. Taylor expanded in A around -inf

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

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

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

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

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

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

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{fma}\left(\frac{B \cdot C}{A}, \frac{-1}{2}, \frac{-1}{2} \cdot B\right)}{A} \cdot -1\right)}{\pi} \]
      7. associate-/l*N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{fma}\left(B \cdot \frac{C}{A}, \frac{-1}{2}, \frac{-1}{2} \cdot B\right)}{A} \cdot -1\right)}{\pi} \]
      8. lower-*.f64N/A

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

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{fma}\left(B \cdot \frac{C}{A}, \frac{-1}{2}, \frac{-1}{2} \cdot B\right)}{A} \cdot -1\right)}{\pi} \]
      10. lower-*.f6461.9

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

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

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

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

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

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

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(C \cdot \mathsf{fma}\left(\frac{-1}{2}, \frac{B}{A \cdot C}, \frac{-1}{2} \cdot \frac{B}{{A}^{2}}\right)\right) \cdot -1\right)}{\pi} \]
      5. lower-*.f64N/A

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

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(C \cdot \mathsf{fma}\left(\frac{-1}{2}, \frac{B}{A \cdot C}, \frac{-1}{2} \cdot \frac{B}{{A}^{2}}\right)\right) \cdot -1\right)}{\pi} \]
      7. pow2N/A

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(C \cdot \mathsf{fma}\left(\frac{-1}{2}, \frac{B}{A \cdot C}, \frac{-1}{2} \cdot \frac{B}{A \cdot A}\right)\right) \cdot -1\right)}{\pi} \]
      8. lift-*.f6451.8

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(C \cdot \mathsf{fma}\left(-0.5, \frac{B}{A \cdot C}, -0.5 \cdot \frac{B}{A \cdot A}\right)\right) \cdot -1\right)}{\pi} \]
    8. Applied rewrites51.8%

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

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

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

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

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

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(C \cdot \frac{\mathsf{fma}\left(\frac{-1}{2}, \frac{B}{A}, \frac{-1}{2} \cdot \frac{B}{C}\right)}{A}\right) \cdot -1\right)}{\pi} \]
      5. lift-/.f6454.7

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(C \cdot \frac{\mathsf{fma}\left(-0.5, \frac{B}{A}, -0.5 \cdot \frac{B}{C}\right)}{A}\right) \cdot -1\right)}{\pi} \]
    11. Applied rewrites54.7%

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

    if -7.2000000000000005e-79 < A

    1. Initial program 66.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 C around -inf

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

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

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

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

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

Alternative 5: 58.1% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\left(B \cdot B\right)}^{2}\\ t_1 := \mathsf{fma}\left(-1, {\left(B \cdot C\right)}^{2}, 0.25 \cdot t\_0\right)\\ \mathbf{if}\;A \leq -7.2 \cdot 10^{-79}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-0.5, \frac{\mathsf{fma}\left(-1, C \cdot t\_1, -0.5 \cdot \left(t\_0 \cdot C\right)\right)}{A \cdot B}, 0.5 \cdot \frac{t\_1}{B}\right)}{A}, 0.5 \cdot \left(B \cdot C\right)\right)}{A}, -0.5 \cdot B\right)}{-1 \cdot A}\right)}{\pi}\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{fma}\left(-1, C, {\left(\mathsf{fma}\left(B, B, {\left(\mathsf{fma}\left(-1, C, A\right)\right)}^{2}\right)\right)}^{0.5}\right) + A}{B} \cdot -1\right)}{\pi}\\ \end{array} \end{array} \]
(FPCore (A B C)
 :precision binary64
 (let* ((t_0 (pow (* B B) 2.0))
        (t_1 (fma -1.0 (pow (* B C) 2.0) (* 0.25 t_0))))
   (if (<= A -7.2e-79)
     (*
      180.0
      (/
       (atan
        (/
         (fma
          -1.0
          (/
           (fma
            -1.0
            (/
             (fma
              -0.5
              (/ (fma -1.0 (* C t_1) (* -0.5 (* t_0 C))) (* A B))
              (* 0.5 (/ t_1 B)))
             A)
            (* 0.5 (* B C)))
           A)
          (* -0.5 B))
         (* -1.0 A)))
       PI))
     (*
      180.0
      (/
       (atan
        (*
         (/ (+ (fma -1.0 C (pow (fma B B (pow (fma -1.0 C A) 2.0)) 0.5)) A) B)
         -1.0))
       PI)))))
double code(double A, double B, double C) {
	double t_0 = pow((B * B), 2.0);
	double t_1 = fma(-1.0, pow((B * C), 2.0), (0.25 * t_0));
	double tmp;
	if (A <= -7.2e-79) {
		tmp = 180.0 * (atan((fma(-1.0, (fma(-1.0, (fma(-0.5, (fma(-1.0, (C * t_1), (-0.5 * (t_0 * C))) / (A * B)), (0.5 * (t_1 / B))) / A), (0.5 * (B * C))) / A), (-0.5 * B)) / (-1.0 * A))) / ((double) M_PI));
	} else {
		tmp = 180.0 * (atan((((fma(-1.0, C, pow(fma(B, B, pow(fma(-1.0, C, A), 2.0)), 0.5)) + A) / B) * -1.0)) / ((double) M_PI));
	}
	return tmp;
}
function code(A, B, C)
	t_0 = Float64(B * B) ^ 2.0
	t_1 = fma(-1.0, (Float64(B * C) ^ 2.0), Float64(0.25 * t_0))
	tmp = 0.0
	if (A <= -7.2e-79)
		tmp = Float64(180.0 * Float64(atan(Float64(fma(-1.0, Float64(fma(-1.0, Float64(fma(-0.5, Float64(fma(-1.0, Float64(C * t_1), Float64(-0.5 * Float64(t_0 * C))) / Float64(A * B)), Float64(0.5 * Float64(t_1 / B))) / A), Float64(0.5 * Float64(B * C))) / A), Float64(-0.5 * B)) / Float64(-1.0 * A))) / pi));
	else
		tmp = Float64(180.0 * Float64(atan(Float64(Float64(Float64(fma(-1.0, C, (fma(B, B, (fma(-1.0, C, A) ^ 2.0)) ^ 0.5)) + A) / B) * -1.0)) / pi));
	end
	return tmp
end
code[A_, B_, C_] := Block[{t$95$0 = N[Power[N[(B * B), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[(-1.0 * N[Power[N[(B * C), $MachinePrecision], 2.0], $MachinePrecision] + N[(0.25 * t$95$0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[A, -7.2e-79], N[(180.0 * N[(N[ArcTan[N[(N[(-1.0 * N[(N[(-1.0 * N[(N[(-0.5 * N[(N[(-1.0 * N[(C * t$95$1), $MachinePrecision] + N[(-0.5 * N[(t$95$0 * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(A * B), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(t$95$1 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / A), $MachinePrecision] + N[(0.5 * N[(B * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / A), $MachinePrecision] + N[(-0.5 * B), $MachinePrecision]), $MachinePrecision] / N[(-1.0 * A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], N[(180.0 * N[(N[ArcTan[N[(N[(N[(N[(-1.0 * C + N[Power[N[(B * B + N[Power[N[(-1.0 * C + A), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] + A), $MachinePrecision] / B), $MachinePrecision] * -1.0), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {\left(B \cdot B\right)}^{2}\\
t_1 := \mathsf{fma}\left(-1, {\left(B \cdot C\right)}^{2}, 0.25 \cdot t\_0\right)\\
\mathbf{if}\;A \leq -7.2 \cdot 10^{-79}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-0.5, \frac{\mathsf{fma}\left(-1, C \cdot t\_1, -0.5 \cdot \left(t\_0 \cdot C\right)\right)}{A \cdot B}, 0.5 \cdot \frac{t\_1}{B}\right)}{A}, 0.5 \cdot \left(B \cdot C\right)\right)}{A}, -0.5 \cdot B\right)}{-1 \cdot A}\right)}{\pi}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if A < -7.2000000000000005e-79

    1. Initial program 21.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-sqrt.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

    if -7.2000000000000005e-79 < A

    1. Initial program 66.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 C around -inf

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

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

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

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

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

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

Alternative 6: 53.3% accurate, N/A× speedup?

\[\begin{array}{l} \\ 180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{fma}\left(-1, C, {\left(\mathsf{fma}\left(B, B, {\left(\mathsf{fma}\left(-1, C, A\right)\right)}^{2}\right)\right)}^{0.5}\right) + A}{B} \cdot -1\right)}{\pi} \end{array} \]
(FPCore (A B C)
 :precision binary64
 (*
  180.0
  (/
   (atan
    (*
     (/ (+ (fma -1.0 C (pow (fma B B (pow (fma -1.0 C A) 2.0)) 0.5)) A) B)
     -1.0))
   PI)))
double code(double A, double B, double C) {
	return 180.0 * (atan((((fma(-1.0, C, pow(fma(B, B, pow(fma(-1.0, C, A), 2.0)), 0.5)) + A) / B) * -1.0)) / ((double) M_PI));
}
function code(A, B, C)
	return Float64(180.0 * Float64(atan(Float64(Float64(Float64(fma(-1.0, C, (fma(B, B, (fma(-1.0, C, A) ^ 2.0)) ^ 0.5)) + A) / B) * -1.0)) / pi))
end
code[A_, B_, C_] := N[(180.0 * N[(N[ArcTan[N[(N[(N[(N[(-1.0 * C + N[Power[N[(B * B + N[Power[N[(-1.0 * C + A), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] + A), $MachinePrecision] / B), $MachinePrecision] * -1.0), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{fma}\left(-1, C, {\left(\mathsf{fma}\left(B, B, {\left(\mathsf{fma}\left(-1, C, A\right)\right)}^{2}\right)\right)}^{0.5}\right) + A}{B} \cdot -1\right)}{\pi}
\end{array}
Derivation
  1. Initial program 51.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 C around -inf

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

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

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

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

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

Reproduce

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