(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 (* (* (/ B C) (+ 1.0 (/ A C))) -0.5))
(* PI 0.005555555555555556)))
(t_1 (atan (/ (- (- C A) (hypot B (- A C))) B))))
(if (<= C 8.995628272771583e-100)
(* t_1 (/ 180.0 PI))
(if (<= C 0.23170752377600393)
t_0
(if (<= C 1.7991825338144448e+115) (/ (* t_1 180.0) PI) 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((((B / C) * (1.0 + (A / C))) * -0.5)) / (((double) M_PI) * 0.005555555555555556);
double t_1 = atan((((C - A) - hypot(B, (A - C))) / B));
double tmp;
if (C <= 8.995628272771583e-100) {
tmp = t_1 * (180.0 / ((double) M_PI));
} else if (C <= 0.23170752377600393) {
tmp = t_0;
} else if (C <= 1.7991825338144448e+115) {
tmp = (t_1 * 180.0) / ((double) M_PI);
} 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((((B / C) * (1.0 + (A / C))) * -0.5)) / (Math.PI * 0.005555555555555556);
double t_1 = Math.atan((((C - A) - Math.hypot(B, (A - C))) / B));
double tmp;
if (C <= 8.995628272771583e-100) {
tmp = t_1 * (180.0 / Math.PI);
} else if (C <= 0.23170752377600393) {
tmp = t_0;
} else if (C <= 1.7991825338144448e+115) {
tmp = (t_1 * 180.0) / Math.PI;
} 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((((B / C) * (1.0 + (A / C))) * -0.5)) / (math.pi * 0.005555555555555556) t_1 = math.atan((((C - A) - math.hypot(B, (A - C))) / B)) tmp = 0 if C <= 8.995628272771583e-100: tmp = t_1 * (180.0 / math.pi) elif C <= 0.23170752377600393: tmp = t_0 elif C <= 1.7991825338144448e+115: tmp = (t_1 * 180.0) / math.pi 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(B / C) * Float64(1.0 + Float64(A / C))) * -0.5)) / Float64(pi * 0.005555555555555556)) t_1 = atan(Float64(Float64(Float64(C - A) - hypot(B, Float64(A - C))) / B)) tmp = 0.0 if (C <= 8.995628272771583e-100) tmp = Float64(t_1 * Float64(180.0 / pi)); elseif (C <= 0.23170752377600393) tmp = t_0; elseif (C <= 1.7991825338144448e+115) tmp = Float64(Float64(t_1 * 180.0) / pi); 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((((B / C) * (1.0 + (A / C))) * -0.5)) / (pi * 0.005555555555555556); t_1 = atan((((C - A) - hypot(B, (A - C))) / B)); tmp = 0.0; if (C <= 8.995628272771583e-100) tmp = t_1 * (180.0 / pi); elseif (C <= 0.23170752377600393) tmp = t_0; elseif (C <= 1.7991825338144448e+115) tmp = (t_1 * 180.0) / pi; 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[(B / C), $MachinePrecision] * N[(1.0 + N[(A / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision]], $MachinePrecision] / N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[ArcTan[N[(N[(N[(C - A), $MachinePrecision] - N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[C, 8.995628272771583e-100], N[(t$95$1 * N[(180.0 / Pi), $MachinePrecision]), $MachinePrecision], If[LessEqual[C, 0.23170752377600393], t$95$0, If[LessEqual[C, 1.7991825338144448e+115], N[(N[(t$95$1 * 180.0), $MachinePrecision] / Pi), $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 := \frac{\tan^{-1} \left(\left(\frac{B}{C} \cdot \left(1 + \frac{A}{C}\right)\right) \cdot -0.5\right)}{\pi \cdot 0.005555555555555556}\\
t_1 := \tan^{-1} \left(\frac{\left(C - A\right) - \mathsf{hypot}\left(B, A - C\right)}{B}\right)\\
\mathbf{if}\;C \leq 8.995628272771583 \cdot 10^{-100}:\\
\;\;\;\;t_1 \cdot \frac{180}{\pi}\\
\mathbf{elif}\;C \leq 0.23170752377600393:\\
\;\;\;\;t_0\\
\mathbf{elif}\;C \leq 1.7991825338144448 \cdot 10^{+115}:\\
\;\;\;\;\frac{t_1 \cdot 180}{\pi}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}



Bits error versus A



Bits error versus B



Bits error versus C
Results
if C < 8.995628272771583e-100Initial program 22.3
Simplified8.3
if 8.995628272771583e-100 < C < 0.231707523776003926 or 1.79918253381444479e115 < C Initial program 46.0
Simplified25.1
Taylor expanded in C around inf 24.7
Simplified22.4
Applied egg-rr22.3
if 0.231707523776003926 < C < 1.79918253381444479e115Initial program 38.5
Simplified23.4
Taylor expanded in C around 0 27.0
Simplified23.4
Final simplification13.0
herbie shell --seed 2022148
(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)))