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

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

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


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

    1. Initial program 25.9

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

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

    if -9.787363799292195e-26 < (*.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 52.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. Simplified51.9

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

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

      \[\leadsto \color{blue}{\frac{1}{\frac{\pi}{\tan^{-1} \left(\frac{-0.5}{\frac{C}{B}}\right) \cdot 180}}} \]
    5. Applied egg-rr32.8

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

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

    \[\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 -9.787363799292195 \cdot 10^{-26}:\\ \;\;\;\;\tan^{-1} \left(\frac{\left(C - A\right) - \mathsf{hypot}\left(B, A - C\right)}{B}\right) \cdot \frac{180}{\pi}\\ \mathbf{elif}\;\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right) \leq 0:\\ \;\;\;\;\frac{1}{\frac{-\pi}{\tan^{-1} \left(\frac{B \cdot -0.5}{C}\right) \cdot -180}}\\ \mathbf{else}:\\ \;\;\;\;\tan^{-1} \left(\frac{\left(C - A\right) - \mathsf{hypot}\left(B, A - C\right)}{B}\right) \cdot \frac{180}{\pi}\\ \end{array} \]

Reproduce

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