Average Error: 29.2 → 7.6
Time: 10.3s
Precision: binary64
\[180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\pi} \]
\[\begin{array}{l} t_0 := \frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\\ t_1 := \frac{\left(C - A\right) - \mathsf{hypot}\left(B, C - A\right)}{B}\\ \mathbf{if}\;t_0 \leq -0.9999999999999999:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} t_1}{\pi}\\ \mathbf{elif}\;t_0 \leq 0:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(0.5 \cdot \frac{B}{A - C}\right)}{\pi}\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left({\left(\sqrt[3]{t_1}\right)}^{3}\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)))
(FPCore (A B C)
 :precision binary64
 (let* ((t_0
         (* (/ 1.0 B) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))
        (t_1 (/ (- (- C A) (hypot B (- C A))) B)))
   (if (<= t_0 -0.9999999999999999)
     (* 180.0 (/ (atan t_1) PI))
     (if (<= t_0 0.0)
       (* 180.0 (/ (atan (* 0.5 (/ B (- A C)))) PI))
       (* 180.0 (/ (atan (pow (cbrt t_1) 3.0)) PI))))))
double code(double A, double B, double C) {
	return 180.0 * (atan(((1.0 / B) * ((C - A) - sqrt((pow((A - C), 2.0) + pow(B, 2.0)))))) / ((double) M_PI));
}
double code(double A, double B, double C) {
	double t_0 = (1.0 / B) * ((C - A) - sqrt((pow((A - C), 2.0) + pow(B, 2.0))));
	double t_1 = ((C - A) - hypot(B, (C - A))) / B;
	double tmp;
	if (t_0 <= -0.9999999999999999) {
		tmp = 180.0 * (atan(t_1) / ((double) M_PI));
	} else if (t_0 <= 0.0) {
		tmp = 180.0 * (atan((0.5 * (B / (A - C)))) / ((double) M_PI));
	} else {
		tmp = 180.0 * (atan(pow(cbrt(t_1), 3.0)) / ((double) M_PI));
	}
	return tmp;
}
public static double code(double A, double B, double C) {
	return 180.0 * (Math.atan(((1.0 / B) * ((C - A) - Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B, 2.0)))))) / Math.PI);
}
public static double code(double A, double B, double C) {
	double t_0 = (1.0 / B) * ((C - A) - Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B, 2.0))));
	double t_1 = ((C - A) - Math.hypot(B, (C - A))) / B;
	double tmp;
	if (t_0 <= -0.9999999999999999) {
		tmp = 180.0 * (Math.atan(t_1) / Math.PI);
	} else if (t_0 <= 0.0) {
		tmp = 180.0 * (Math.atan((0.5 * (B / (A - C)))) / Math.PI);
	} else {
		tmp = 180.0 * (Math.atan(Math.pow(Math.cbrt(t_1), 3.0)) / Math.PI);
	}
	return tmp;
}
function code(A, B, C)
	return Float64(180.0 * Float64(atan(Float64(Float64(1.0 / B) * Float64(Float64(C - A) - sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0)))))) / pi))
end
function code(A, B, C)
	t_0 = Float64(Float64(1.0 / B) * Float64(Float64(C - A) - sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0)))))
	t_1 = Float64(Float64(Float64(C - A) - hypot(B, Float64(C - A))) / B)
	tmp = 0.0
	if (t_0 <= -0.9999999999999999)
		tmp = Float64(180.0 * Float64(atan(t_1) / pi));
	elseif (t_0 <= 0.0)
		tmp = Float64(180.0 * Float64(atan(Float64(0.5 * Float64(B / Float64(A - C)))) / pi));
	else
		tmp = Float64(180.0 * Float64(atan((cbrt(t_1) ^ 3.0)) / pi));
	end
	return tmp
end
code[A_, B_, C_] := N[(180.0 * N[(N[ArcTan[N[(N[(1.0 / B), $MachinePrecision] * N[(N[(C - A), $MachinePrecision] - N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]
code[A_, B_, C_] := Block[{t$95$0 = N[(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]}, Block[{t$95$1 = N[(N[(N[(C - A), $MachinePrecision] - N[Sqrt[B ^ 2 + N[(C - A), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision]}, If[LessEqual[t$95$0, -0.9999999999999999], N[(180.0 * N[(N[ArcTan[t$95$1], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(180.0 * N[(N[ArcTan[N[(0.5 * N[(B / N[(A - C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], N[(180.0 * N[(N[ArcTan[N[Power[N[Power[t$95$1, 1/3], $MachinePrecision], 3.0], $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]]]]]
180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\pi}
\begin{array}{l}
t_0 := \frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\\
t_1 := \frac{\left(C - A\right) - \mathsf{hypot}\left(B, C - A\right)}{B}\\
\mathbf{if}\;t_0 \leq -0.9999999999999999:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} t_1}{\pi}\\

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

\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left({\left(\sqrt[3]{t_1}\right)}^{3}\right)}{\pi}\\


\end{array}

Error

Bits error versus A

Bits error versus B

Bits error versus C

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 3 regimes
  2. if (*.f64 (/.f64 1 B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))) < -0.999999999999999889

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

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

      \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{\color{blue}{\mathsf{fma}\left({\left(\sqrt[3]{C - A}\right)}^{2}, \sqrt[3]{C - A}, -\mathsf{hypot}\left(B, C - A\right)\right)}}{B}\right)}{\pi} \]
    4. Applied egg-rr8.3

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

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

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

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

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

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

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

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

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

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

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

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

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

Reproduce

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