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



Bits error versus A



Bits error versus B



Bits error versus C
Results
if A < -6.9558447322655957e-7 or -6.3822375496822152e-43 < A < -3.4226817542894903e-77Initial program 46.0
Simplified25.2
Applied clear-num_binary6425.2
Taylor expanded in A around -inf 24.4
Simplified24.4
Taylor expanded in B around 0 20.2
Simplified20.2
if -6.9558447322655957e-7 < A < -6.3822375496822152e-43Initial program 32.3
Simplified21.2
Applied clear-num_binary6421.2
Taylor expanded in A around 0 32.7
Simplified21.7
if -3.4226817542894903e-77 < A Initial program 22.0
Simplified8.4
Applied clear-num_binary648.4
Final simplification12.0
herbie shell --seed 2022132
(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)))