
(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:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(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}
(FPCore (A B C) :precision binary64 (if (<= C 9.5e+40) (* 180.0 (/ (atan (/ (- (- C A) (hypot B (- A C))) B)) PI)) (* (atan (* B (/ -0.5 C))) (/ 180.0 PI))))
double code(double A, double B, double C) {
double tmp;
if (C <= 9.5e+40) {
tmp = 180.0 * (atan((((C - A) - hypot(B, (A - C))) / B)) / ((double) M_PI));
} else {
tmp = atan((B * (-0.5 / C))) * (180.0 / ((double) M_PI));
}
return tmp;
}
public static double code(double A, double B, double C) {
double tmp;
if (C <= 9.5e+40) {
tmp = 180.0 * (Math.atan((((C - A) - Math.hypot(B, (A - C))) / B)) / Math.PI);
} else {
tmp = Math.atan((B * (-0.5 / C))) * (180.0 / Math.PI);
}
return tmp;
}
def code(A, B, C): tmp = 0 if C <= 9.5e+40: tmp = 180.0 * (math.atan((((C - A) - math.hypot(B, (A - C))) / B)) / math.pi) else: tmp = math.atan((B * (-0.5 / C))) * (180.0 / math.pi) return tmp
function code(A, B, C) tmp = 0.0 if (C <= 9.5e+40) tmp = Float64(180.0 * Float64(atan(Float64(Float64(Float64(C - A) - hypot(B, Float64(A - C))) / B)) / pi)); else tmp = Float64(atan(Float64(B * Float64(-0.5 / C))) * Float64(180.0 / pi)); end return tmp end
function tmp_2 = code(A, B, C) tmp = 0.0; if (C <= 9.5e+40) tmp = 180.0 * (atan((((C - A) - hypot(B, (A - C))) / B)) / pi); else tmp = atan((B * (-0.5 / C))) * (180.0 / pi); end tmp_2 = tmp; end
code[A_, B_, C_] := If[LessEqual[C, 9.5e+40], N[(180.0 * N[(N[ArcTan[N[(N[(N[(C - A), $MachinePrecision] - N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], N[(N[ArcTan[N[(B * N[(-0.5 / C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(180.0 / Pi), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;C \leq 9.5 \cdot 10^{+40}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{\left(C - A\right) - \mathsf{hypot}\left(B, A - C\right)}{B}\right)}{\pi}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(B \cdot \frac{-0.5}{C}\right) \cdot \frac{180}{\pi}\\
\end{array}
\end{array}
if C < 9.5000000000000003e40Initial program 62.3%
associate-*l/62.3%
*-lft-identity62.3%
+-commutative62.3%
unpow262.3%
unpow262.3%
hypot-define86.7%
Simplified86.7%
if 9.5000000000000003e40 < C Initial program 18.0%
Taylor expanded in C around inf 74.8%
Taylor expanded in A around inf 74.8%
Simplified75.0%
(FPCore (A B C)
:precision binary64
(if (<= C -2.1e-14)
(* 180.0 (/ (atan (/ (- C (+ A (hypot B (- A C)))) B)) PI))
(if (<= C 4.3e+42)
(* 180.0 (/ (atan (/ (+ A (hypot A B)) (- B))) PI))
(* (atan (* B (/ -0.5 C))) (/ 180.0 PI)))))
double code(double A, double B, double C) {
double tmp;
if (C <= -2.1e-14) {
tmp = 180.0 * (atan(((C - (A + hypot(B, (A - C)))) / B)) / ((double) M_PI));
} else if (C <= 4.3e+42) {
tmp = 180.0 * (atan(((A + hypot(A, B)) / -B)) / ((double) M_PI));
} else {
tmp = atan((B * (-0.5 / C))) * (180.0 / ((double) M_PI));
}
return tmp;
}
public static double code(double A, double B, double C) {
double tmp;
if (C <= -2.1e-14) {
tmp = 180.0 * (Math.atan(((C - (A + Math.hypot(B, (A - C)))) / B)) / Math.PI);
} else if (C <= 4.3e+42) {
tmp = 180.0 * (Math.atan(((A + Math.hypot(A, B)) / -B)) / Math.PI);
} else {
tmp = Math.atan((B * (-0.5 / C))) * (180.0 / Math.PI);
}
return tmp;
}
def code(A, B, C): tmp = 0 if C <= -2.1e-14: tmp = 180.0 * (math.atan(((C - (A + math.hypot(B, (A - C)))) / B)) / math.pi) elif C <= 4.3e+42: tmp = 180.0 * (math.atan(((A + math.hypot(A, B)) / -B)) / math.pi) else: tmp = math.atan((B * (-0.5 / C))) * (180.0 / math.pi) return tmp
function code(A, B, C) tmp = 0.0 if (C <= -2.1e-14) tmp = Float64(180.0 * Float64(atan(Float64(Float64(C - Float64(A + hypot(B, Float64(A - C)))) / B)) / pi)); elseif (C <= 4.3e+42) tmp = Float64(180.0 * Float64(atan(Float64(Float64(A + hypot(A, B)) / Float64(-B))) / pi)); else tmp = Float64(atan(Float64(B * Float64(-0.5 / C))) * Float64(180.0 / pi)); end return tmp end
function tmp_2 = code(A, B, C) tmp = 0.0; if (C <= -2.1e-14) tmp = 180.0 * (atan(((C - (A + hypot(B, (A - C)))) / B)) / pi); elseif (C <= 4.3e+42) tmp = 180.0 * (atan(((A + hypot(A, B)) / -B)) / pi); else tmp = atan((B * (-0.5 / C))) * (180.0 / pi); end tmp_2 = tmp; end
code[A_, B_, C_] := If[LessEqual[C, -2.1e-14], N[(180.0 * N[(N[ArcTan[N[(N[(C - N[(A + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], If[LessEqual[C, 4.3e+42], N[(180.0 * N[(N[ArcTan[N[(N[(A + N[Sqrt[A ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision] / (-B)), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], N[(N[ArcTan[N[(B * N[(-0.5 / C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(180.0 / Pi), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;C \leq -2.1 \cdot 10^{-14}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C - \left(A + \mathsf{hypot}\left(B, A - C\right)\right)}{B}\right)}{\pi}\\
\mathbf{elif}\;C \leq 4.3 \cdot 10^{+42}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{A + \mathsf{hypot}\left(A, B\right)}{-B}\right)}{\pi}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(B \cdot \frac{-0.5}{C}\right) \cdot \frac{180}{\pi}\\
\end{array}
\end{array}
if C < -2.0999999999999999e-14Initial program 83.6%
Simplified94.7%
if -2.0999999999999999e-14 < C < 4.2999999999999998e42Initial program 49.4%
Taylor expanded in C around 0 49.5%
associate-*r/49.5%
mul-1-neg49.5%
unpow249.5%
unpow249.5%
hypot-define81.0%
Simplified81.0%
if 4.2999999999999998e42 < C Initial program 18.0%
Taylor expanded in C around inf 74.8%
Taylor expanded in A around inf 74.8%
Simplified75.0%
Final simplification83.5%
(FPCore (A B C)
:precision binary64
(if (<= C -250000.0)
(* 180.0 (/ (atan (/ (- C (hypot C B)) B)) PI))
(if (<= C 1.65e+43)
(* 180.0 (/ (atan (/ (+ A (hypot A B)) (- B))) PI))
(* (atan (* B (/ -0.5 C))) (/ 180.0 PI)))))
double code(double A, double B, double C) {
double tmp;
if (C <= -250000.0) {
tmp = 180.0 * (atan(((C - hypot(C, B)) / B)) / ((double) M_PI));
} else if (C <= 1.65e+43) {
tmp = 180.0 * (atan(((A + hypot(A, B)) / -B)) / ((double) M_PI));
} else {
tmp = atan((B * (-0.5 / C))) * (180.0 / ((double) M_PI));
}
return tmp;
}
public static double code(double A, double B, double C) {
double tmp;
if (C <= -250000.0) {
tmp = 180.0 * (Math.atan(((C - Math.hypot(C, B)) / B)) / Math.PI);
} else if (C <= 1.65e+43) {
tmp = 180.0 * (Math.atan(((A + Math.hypot(A, B)) / -B)) / Math.PI);
} else {
tmp = Math.atan((B * (-0.5 / C))) * (180.0 / Math.PI);
}
return tmp;
}
def code(A, B, C): tmp = 0 if C <= -250000.0: tmp = 180.0 * (math.atan(((C - math.hypot(C, B)) / B)) / math.pi) elif C <= 1.65e+43: tmp = 180.0 * (math.atan(((A + math.hypot(A, B)) / -B)) / math.pi) else: tmp = math.atan((B * (-0.5 / C))) * (180.0 / math.pi) return tmp
function code(A, B, C) tmp = 0.0 if (C <= -250000.0) tmp = Float64(180.0 * Float64(atan(Float64(Float64(C - hypot(C, B)) / B)) / pi)); elseif (C <= 1.65e+43) tmp = Float64(180.0 * Float64(atan(Float64(Float64(A + hypot(A, B)) / Float64(-B))) / pi)); else tmp = Float64(atan(Float64(B * Float64(-0.5 / C))) * Float64(180.0 / pi)); end return tmp end
function tmp_2 = code(A, B, C) tmp = 0.0; if (C <= -250000.0) tmp = 180.0 * (atan(((C - hypot(C, B)) / B)) / pi); elseif (C <= 1.65e+43) tmp = 180.0 * (atan(((A + hypot(A, B)) / -B)) / pi); else tmp = atan((B * (-0.5 / C))) * (180.0 / pi); end tmp_2 = tmp; end
code[A_, B_, C_] := If[LessEqual[C, -250000.0], N[(180.0 * N[(N[ArcTan[N[(N[(C - N[Sqrt[C ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], If[LessEqual[C, 1.65e+43], N[(180.0 * N[(N[ArcTan[N[(N[(A + N[Sqrt[A ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision] / (-B)), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], N[(N[ArcTan[N[(B * N[(-0.5 / C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(180.0 / Pi), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;C \leq -250000:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C - \mathsf{hypot}\left(C, B\right)}{B}\right)}{\pi}\\
\mathbf{elif}\;C \leq 1.65 \cdot 10^{+43}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{A + \mathsf{hypot}\left(A, B\right)}{-B}\right)}{\pi}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(B \cdot \frac{-0.5}{C}\right) \cdot \frac{180}{\pi}\\
\end{array}
\end{array}
if C < -2.5e5Initial program 84.5%
Taylor expanded in A around 0 84.5%
+-commutative84.5%
unpow284.5%
unpow284.5%
hypot-define94.8%
Simplified94.8%
if -2.5e5 < C < 1.6500000000000001e43Initial program 49.4%
Taylor expanded in C around 0 49.5%
associate-*r/49.5%
mul-1-neg49.5%
unpow249.5%
unpow249.5%
hypot-define80.5%
Simplified80.5%
if 1.6500000000000001e43 < C Initial program 18.0%
Taylor expanded in C around inf 74.8%
Taylor expanded in A around inf 74.8%
Simplified75.0%
Final simplification83.1%
(FPCore (A B C)
:precision binary64
(if (<= A -1.6e+140)
(* 180.0 (/ (atan (/ (* B 0.5) A)) PI))
(if (<= A 1.2e+40)
(* 180.0 (/ (atan (/ (- C (hypot C B)) B)) PI))
(/ 180.0 (/ PI (atan (+ 1.0 (/ (- C A) B))))))))
double code(double A, double B, double C) {
double tmp;
if (A <= -1.6e+140) {
tmp = 180.0 * (atan(((B * 0.5) / A)) / ((double) M_PI));
} else if (A <= 1.2e+40) {
tmp = 180.0 * (atan(((C - hypot(C, B)) / B)) / ((double) M_PI));
} else {
tmp = 180.0 / (((double) M_PI) / atan((1.0 + ((C - A) / B))));
}
return tmp;
}
public static double code(double A, double B, double C) {
double tmp;
if (A <= -1.6e+140) {
tmp = 180.0 * (Math.atan(((B * 0.5) / A)) / Math.PI);
} else if (A <= 1.2e+40) {
tmp = 180.0 * (Math.atan(((C - Math.hypot(C, B)) / B)) / Math.PI);
} else {
tmp = 180.0 / (Math.PI / Math.atan((1.0 + ((C - A) / B))));
}
return tmp;
}
def code(A, B, C): tmp = 0 if A <= -1.6e+140: tmp = 180.0 * (math.atan(((B * 0.5) / A)) / math.pi) elif A <= 1.2e+40: tmp = 180.0 * (math.atan(((C - math.hypot(C, B)) / B)) / math.pi) else: tmp = 180.0 / (math.pi / math.atan((1.0 + ((C - A) / B)))) return tmp
function code(A, B, C) tmp = 0.0 if (A <= -1.6e+140) tmp = Float64(180.0 * Float64(atan(Float64(Float64(B * 0.5) / A)) / pi)); elseif (A <= 1.2e+40) tmp = Float64(180.0 * Float64(atan(Float64(Float64(C - hypot(C, B)) / B)) / pi)); else tmp = Float64(180.0 / Float64(pi / atan(Float64(1.0 + Float64(Float64(C - A) / B))))); end return tmp end
function tmp_2 = code(A, B, C) tmp = 0.0; if (A <= -1.6e+140) tmp = 180.0 * (atan(((B * 0.5) / A)) / pi); elseif (A <= 1.2e+40) tmp = 180.0 * (atan(((C - hypot(C, B)) / B)) / pi); else tmp = 180.0 / (pi / atan((1.0 + ((C - A) / B)))); end tmp_2 = tmp; end
code[A_, B_, C_] := If[LessEqual[A, -1.6e+140], N[(180.0 * N[(N[ArcTan[N[(N[(B * 0.5), $MachinePrecision] / A), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], If[LessEqual[A, 1.2e+40], N[(180.0 * N[(N[ArcTan[N[(N[(C - N[Sqrt[C ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], N[(180.0 / N[(Pi / N[ArcTan[N[(1.0 + N[(N[(C - A), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;A \leq -1.6 \cdot 10^{+140}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{B \cdot 0.5}{A}\right)}{\pi}\\
\mathbf{elif}\;A \leq 1.2 \cdot 10^{+40}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C - \mathsf{hypot}\left(C, B\right)}{B}\right)}{\pi}\\
\mathbf{else}:\\
\;\;\;\;\frac{180}{\frac{\pi}{\tan^{-1} \left(1 + \frac{C - A}{B}\right)}}\\
\end{array}
\end{array}
if A < -1.60000000000000005e140Initial program 18.9%
Taylor expanded in A around -inf 77.8%
associate-*r/77.8%
Simplified77.8%
if -1.60000000000000005e140 < A < 1.2e40Initial program 51.0%
Taylor expanded in A around 0 48.5%
+-commutative48.5%
unpow248.5%
unpow248.5%
hypot-define76.0%
Simplified76.0%
if 1.2e40 < A Initial program 81.6%
*-commutative81.6%
associate--l-81.6%
+-commutative81.6%
unpow281.6%
unpow281.6%
hypot-undefine94.4%
div-inv94.4%
clear-num94.4%
un-div-inv94.4%
Applied egg-rr94.4%
Taylor expanded in B around -inf 84.7%
associate--l+84.7%
div-sub84.7%
Simplified84.7%
Final simplification78.0%
(FPCore (A B C)
:precision binary64
(let* ((t_0 (/ (- C A) B)))
(if (<= B -7e-256)
(/ 180.0 (/ PI (atan (+ 1.0 t_0))))
(if (<= B 8e-291)
(* 180.0 (/ (atan 0.0) PI))
(/ 180.0 (/ PI (atan (+ t_0 -1.0))))))))
double code(double A, double B, double C) {
double t_0 = (C - A) / B;
double tmp;
if (B <= -7e-256) {
tmp = 180.0 / (((double) M_PI) / atan((1.0 + t_0)));
} else if (B <= 8e-291) {
tmp = 180.0 * (atan(0.0) / ((double) M_PI));
} else {
tmp = 180.0 / (((double) M_PI) / atan((t_0 + -1.0)));
}
return tmp;
}
public static double code(double A, double B, double C) {
double t_0 = (C - A) / B;
double tmp;
if (B <= -7e-256) {
tmp = 180.0 / (Math.PI / Math.atan((1.0 + t_0)));
} else if (B <= 8e-291) {
tmp = 180.0 * (Math.atan(0.0) / Math.PI);
} else {
tmp = 180.0 / (Math.PI / Math.atan((t_0 + -1.0)));
}
return tmp;
}
def code(A, B, C): t_0 = (C - A) / B tmp = 0 if B <= -7e-256: tmp = 180.0 / (math.pi / math.atan((1.0 + t_0))) elif B <= 8e-291: tmp = 180.0 * (math.atan(0.0) / math.pi) else: tmp = 180.0 / (math.pi / math.atan((t_0 + -1.0))) return tmp
function code(A, B, C) t_0 = Float64(Float64(C - A) / B) tmp = 0.0 if (B <= -7e-256) tmp = Float64(180.0 / Float64(pi / atan(Float64(1.0 + t_0)))); elseif (B <= 8e-291) tmp = Float64(180.0 * Float64(atan(0.0) / pi)); else tmp = Float64(180.0 / Float64(pi / atan(Float64(t_0 + -1.0)))); end return tmp end
function tmp_2 = code(A, B, C) t_0 = (C - A) / B; tmp = 0.0; if (B <= -7e-256) tmp = 180.0 / (pi / atan((1.0 + t_0))); elseif (B <= 8e-291) tmp = 180.0 * (atan(0.0) / pi); else tmp = 180.0 / (pi / atan((t_0 + -1.0))); end tmp_2 = tmp; end
code[A_, B_, C_] := Block[{t$95$0 = N[(N[(C - A), $MachinePrecision] / B), $MachinePrecision]}, If[LessEqual[B, -7e-256], N[(180.0 / N[(Pi / N[ArcTan[N[(1.0 + t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 8e-291], N[(180.0 * N[(N[ArcTan[0.0], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], N[(180.0 / N[(Pi / N[ArcTan[N[(t$95$0 + -1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{C - A}{B}\\
\mathbf{if}\;B \leq -7 \cdot 10^{-256}:\\
\;\;\;\;\frac{180}{\frac{\pi}{\tan^{-1} \left(1 + t\_0\right)}}\\
\mathbf{elif}\;B \leq 8 \cdot 10^{-291}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} 0}{\pi}\\
\mathbf{else}:\\
\;\;\;\;\frac{180}{\frac{\pi}{\tan^{-1} \left(t\_0 + -1\right)}}\\
\end{array}
\end{array}
if B < -7.00000000000000028e-256Initial program 56.9%
*-commutative56.9%
associate--l-56.0%
+-commutative56.0%
unpow256.0%
unpow256.0%
hypot-undefine75.1%
div-inv75.1%
clear-num75.1%
un-div-inv75.1%
Applied egg-rr80.3%
Taylor expanded in B around -inf 68.9%
associate--l+68.9%
div-sub68.9%
Simplified68.9%
if -7.00000000000000028e-256 < B < 7.9999999999999997e-291Initial program 42.2%
Taylor expanded in C around inf 56.0%
Taylor expanded in B around 0 74.6%
distribute-rgt1-in74.6%
metadata-eval74.6%
mul0-lft74.6%
div074.6%
metadata-eval74.6%
Simplified74.6%
if 7.9999999999999997e-291 < B Initial program 47.2%
*-commutative47.2%
associate--l-47.1%
+-commutative47.1%
unpow247.1%
unpow247.1%
hypot-undefine71.5%
div-inv71.5%
clear-num71.5%
un-div-inv71.5%
Applied egg-rr76.0%
Taylor expanded in B around inf 65.7%
+-commutative65.7%
associate--r+65.7%
div-sub66.6%
Simplified66.6%
Final simplification68.2%
(FPCore (A B C)
:precision binary64
(if (<= C 4.9e-147)
(* 180.0 (/ (atan (+ 1.0 (/ C B))) PI))
(if (<= C 3.25e-85)
(* 180.0 (/ (atan -1.0) PI))
(* (atan (* B (/ -0.5 C))) (/ 180.0 PI)))))
double code(double A, double B, double C) {
double tmp;
if (C <= 4.9e-147) {
tmp = 180.0 * (atan((1.0 + (C / B))) / ((double) M_PI));
} else if (C <= 3.25e-85) {
tmp = 180.0 * (atan(-1.0) / ((double) M_PI));
} else {
tmp = atan((B * (-0.5 / C))) * (180.0 / ((double) M_PI));
}
return tmp;
}
public static double code(double A, double B, double C) {
double tmp;
if (C <= 4.9e-147) {
tmp = 180.0 * (Math.atan((1.0 + (C / B))) / Math.PI);
} else if (C <= 3.25e-85) {
tmp = 180.0 * (Math.atan(-1.0) / Math.PI);
} else {
tmp = Math.atan((B * (-0.5 / C))) * (180.0 / Math.PI);
}
return tmp;
}
def code(A, B, C): tmp = 0 if C <= 4.9e-147: tmp = 180.0 * (math.atan((1.0 + (C / B))) / math.pi) elif C <= 3.25e-85: tmp = 180.0 * (math.atan(-1.0) / math.pi) else: tmp = math.atan((B * (-0.5 / C))) * (180.0 / math.pi) return tmp
function code(A, B, C) tmp = 0.0 if (C <= 4.9e-147) tmp = Float64(180.0 * Float64(atan(Float64(1.0 + Float64(C / B))) / pi)); elseif (C <= 3.25e-85) tmp = Float64(180.0 * Float64(atan(-1.0) / pi)); else tmp = Float64(atan(Float64(B * Float64(-0.5 / C))) * Float64(180.0 / pi)); end return tmp end
function tmp_2 = code(A, B, C) tmp = 0.0; if (C <= 4.9e-147) tmp = 180.0 * (atan((1.0 + (C / B))) / pi); elseif (C <= 3.25e-85) tmp = 180.0 * (atan(-1.0) / pi); else tmp = atan((B * (-0.5 / C))) * (180.0 / pi); end tmp_2 = tmp; end
code[A_, B_, C_] := If[LessEqual[C, 4.9e-147], N[(180.0 * N[(N[ArcTan[N[(1.0 + N[(C / B), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], If[LessEqual[C, 3.25e-85], N[(180.0 * N[(N[ArcTan[-1.0], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], N[(N[ArcTan[N[(B * N[(-0.5 / C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(180.0 / Pi), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;C \leq 4.9 \cdot 10^{-147}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(1 + \frac{C}{B}\right)}{\pi}\\
\mathbf{elif}\;C \leq 3.25 \cdot 10^{-85}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\pi}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(B \cdot \frac{-0.5}{C}\right) \cdot \frac{180}{\pi}\\
\end{array}
\end{array}
if C < 4.90000000000000005e-147Initial program 67.0%
Taylor expanded in A around 0 60.0%
+-commutative60.0%
unpow260.0%
unpow260.0%
hypot-define75.9%
Simplified75.9%
Taylor expanded in B around -inf 59.8%
+-commutative59.8%
Simplified59.8%
if 4.90000000000000005e-147 < C < 3.25e-85Initial program 51.8%
Taylor expanded in B around inf 42.7%
if 3.25e-85 < C Initial program 24.5%
Taylor expanded in C around inf 61.7%
Taylor expanded in A around inf 61.7%
Simplified61.9%
Final simplification59.4%
(FPCore (A B C)
:precision binary64
(if (<= C 2.12e-147)
(* 180.0 (/ (atan (+ 1.0 (/ C B))) PI))
(if (<= C 3.05e-83)
(* 180.0 (/ (atan -1.0) PI))
(* 180.0 (/ (atan (* -0.5 (/ B C))) PI)))))
double code(double A, double B, double C) {
double tmp;
if (C <= 2.12e-147) {
tmp = 180.0 * (atan((1.0 + (C / B))) / ((double) M_PI));
} else if (C <= 3.05e-83) {
tmp = 180.0 * (atan(-1.0) / ((double) M_PI));
} else {
tmp = 180.0 * (atan((-0.5 * (B / C))) / ((double) M_PI));
}
return tmp;
}
public static double code(double A, double B, double C) {
double tmp;
if (C <= 2.12e-147) {
tmp = 180.0 * (Math.atan((1.0 + (C / B))) / Math.PI);
} else if (C <= 3.05e-83) {
tmp = 180.0 * (Math.atan(-1.0) / Math.PI);
} else {
tmp = 180.0 * (Math.atan((-0.5 * (B / C))) / Math.PI);
}
return tmp;
}
def code(A, B, C): tmp = 0 if C <= 2.12e-147: tmp = 180.0 * (math.atan((1.0 + (C / B))) / math.pi) elif C <= 3.05e-83: tmp = 180.0 * (math.atan(-1.0) / math.pi) else: tmp = 180.0 * (math.atan((-0.5 * (B / C))) / math.pi) return tmp
function code(A, B, C) tmp = 0.0 if (C <= 2.12e-147) tmp = Float64(180.0 * Float64(atan(Float64(1.0 + Float64(C / B))) / pi)); elseif (C <= 3.05e-83) tmp = Float64(180.0 * Float64(atan(-1.0) / pi)); else tmp = Float64(180.0 * Float64(atan(Float64(-0.5 * Float64(B / C))) / pi)); end return tmp end
function tmp_2 = code(A, B, C) tmp = 0.0; if (C <= 2.12e-147) tmp = 180.0 * (atan((1.0 + (C / B))) / pi); elseif (C <= 3.05e-83) tmp = 180.0 * (atan(-1.0) / pi); else tmp = 180.0 * (atan((-0.5 * (B / C))) / pi); end tmp_2 = tmp; end
code[A_, B_, C_] := If[LessEqual[C, 2.12e-147], N[(180.0 * N[(N[ArcTan[N[(1.0 + N[(C / B), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], If[LessEqual[C, 3.05e-83], N[(180.0 * N[(N[ArcTan[-1.0], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], N[(180.0 * N[(N[ArcTan[N[(-0.5 * N[(B / C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;C \leq 2.12 \cdot 10^{-147}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(1 + \frac{C}{B}\right)}{\pi}\\
\mathbf{elif}\;C \leq 3.05 \cdot 10^{-83}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\pi}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(-0.5 \cdot \frac{B}{C}\right)}{\pi}\\
\end{array}
\end{array}
if C < 2.11999999999999998e-147Initial program 67.0%
Taylor expanded in A around 0 60.0%
+-commutative60.0%
unpow260.0%
unpow260.0%
hypot-define75.9%
Simplified75.9%
Taylor expanded in B around -inf 59.8%
+-commutative59.8%
Simplified59.8%
if 2.11999999999999998e-147 < C < 3.05000000000000001e-83Initial program 51.8%
Taylor expanded in B around inf 42.7%
if 3.05000000000000001e-83 < C Initial program 24.5%
Taylor expanded in C around inf 61.7%
Taylor expanded in A around inf 61.7%
Final simplification59.3%
(FPCore (A B C) :precision binary64 (if (<= C 7.2e+28) (/ 180.0 (/ PI (atan (+ 1.0 (/ (- C A) B))))) (* (atan (* B (/ -0.5 C))) (/ 180.0 PI))))
double code(double A, double B, double C) {
double tmp;
if (C <= 7.2e+28) {
tmp = 180.0 / (((double) M_PI) / atan((1.0 + ((C - A) / B))));
} else {
tmp = atan((B * (-0.5 / C))) * (180.0 / ((double) M_PI));
}
return tmp;
}
public static double code(double A, double B, double C) {
double tmp;
if (C <= 7.2e+28) {
tmp = 180.0 / (Math.PI / Math.atan((1.0 + ((C - A) / B))));
} else {
tmp = Math.atan((B * (-0.5 / C))) * (180.0 / Math.PI);
}
return tmp;
}
def code(A, B, C): tmp = 0 if C <= 7.2e+28: tmp = 180.0 / (math.pi / math.atan((1.0 + ((C - A) / B)))) else: tmp = math.atan((B * (-0.5 / C))) * (180.0 / math.pi) return tmp
function code(A, B, C) tmp = 0.0 if (C <= 7.2e+28) tmp = Float64(180.0 / Float64(pi / atan(Float64(1.0 + Float64(Float64(C - A) / B))))); else tmp = Float64(atan(Float64(B * Float64(-0.5 / C))) * Float64(180.0 / pi)); end return tmp end
function tmp_2 = code(A, B, C) tmp = 0.0; if (C <= 7.2e+28) tmp = 180.0 / (pi / atan((1.0 + ((C - A) / B)))); else tmp = atan((B * (-0.5 / C))) * (180.0 / pi); end tmp_2 = tmp; end
code[A_, B_, C_] := If[LessEqual[C, 7.2e+28], N[(180.0 / N[(Pi / N[ArcTan[N[(1.0 + N[(N[(C - A), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[ArcTan[N[(B * N[(-0.5 / C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(180.0 / Pi), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;C \leq 7.2 \cdot 10^{+28}:\\
\;\;\;\;\frac{180}{\frac{\pi}{\tan^{-1} \left(1 + \frac{C - A}{B}\right)}}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(B \cdot \frac{-0.5}{C}\right) \cdot \frac{180}{\pi}\\
\end{array}
\end{array}
if C < 7.1999999999999999e28Initial program 63.2%
*-commutative63.2%
associate--l-62.5%
+-commutative62.5%
unpow262.5%
unpow262.5%
hypot-undefine80.7%
div-inv80.7%
clear-num80.7%
un-div-inv80.7%
Applied egg-rr87.7%
Taylor expanded in B around -inf 62.6%
associate--l+62.6%
div-sub63.1%
Simplified63.1%
if 7.1999999999999999e28 < C Initial program 18.7%
Taylor expanded in C around inf 69.9%
Taylor expanded in A around inf 69.9%
Simplified70.0%
(FPCore (A B C) :precision binary64 (if (<= C 4.4e+28) (* 180.0 (/ (atan (+ 1.0 (/ (- C A) B))) PI)) (* (atan (* B (/ -0.5 C))) (/ 180.0 PI))))
double code(double A, double B, double C) {
double tmp;
if (C <= 4.4e+28) {
tmp = 180.0 * (atan((1.0 + ((C - A) / B))) / ((double) M_PI));
} else {
tmp = atan((B * (-0.5 / C))) * (180.0 / ((double) M_PI));
}
return tmp;
}
public static double code(double A, double B, double C) {
double tmp;
if (C <= 4.4e+28) {
tmp = 180.0 * (Math.atan((1.0 + ((C - A) / B))) / Math.PI);
} else {
tmp = Math.atan((B * (-0.5 / C))) * (180.0 / Math.PI);
}
return tmp;
}
def code(A, B, C): tmp = 0 if C <= 4.4e+28: tmp = 180.0 * (math.atan((1.0 + ((C - A) / B))) / math.pi) else: tmp = math.atan((B * (-0.5 / C))) * (180.0 / math.pi) return tmp
function code(A, B, C) tmp = 0.0 if (C <= 4.4e+28) tmp = Float64(180.0 * Float64(atan(Float64(1.0 + Float64(Float64(C - A) / B))) / pi)); else tmp = Float64(atan(Float64(B * Float64(-0.5 / C))) * Float64(180.0 / pi)); end return tmp end
function tmp_2 = code(A, B, C) tmp = 0.0; if (C <= 4.4e+28) tmp = 180.0 * (atan((1.0 + ((C - A) / B))) / pi); else tmp = atan((B * (-0.5 / C))) * (180.0 / pi); end tmp_2 = tmp; end
code[A_, B_, C_] := If[LessEqual[C, 4.4e+28], N[(180.0 * N[(N[ArcTan[N[(1.0 + N[(N[(C - A), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], N[(N[ArcTan[N[(B * N[(-0.5 / C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(180.0 / Pi), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;C \leq 4.4 \cdot 10^{+28}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(1 + \frac{C - A}{B}\right)}{\pi}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(B \cdot \frac{-0.5}{C}\right) \cdot \frac{180}{\pi}\\
\end{array}
\end{array}
if C < 4.39999999999999973e28Initial program 63.2%
Taylor expanded in B around -inf 62.6%
associate--l+62.6%
div-sub63.1%
Simplified63.1%
if 4.39999999999999973e28 < C Initial program 18.7%
Taylor expanded in C around inf 69.9%
Taylor expanded in A around inf 69.9%
Simplified70.0%
(FPCore (A B C)
:precision binary64
(if (<= B -1.15e-102)
(* 180.0 (/ (atan 1.0) PI))
(if (<= B 5e-134)
(* 180.0 (/ (atan 0.0) PI))
(* 180.0 (/ (atan -1.0) PI)))))
double code(double A, double B, double C) {
double tmp;
if (B <= -1.15e-102) {
tmp = 180.0 * (atan(1.0) / ((double) M_PI));
} else if (B <= 5e-134) {
tmp = 180.0 * (atan(0.0) / ((double) M_PI));
} else {
tmp = 180.0 * (atan(-1.0) / ((double) M_PI));
}
return tmp;
}
public static double code(double A, double B, double C) {
double tmp;
if (B <= -1.15e-102) {
tmp = 180.0 * (Math.atan(1.0) / Math.PI);
} else if (B <= 5e-134) {
tmp = 180.0 * (Math.atan(0.0) / Math.PI);
} else {
tmp = 180.0 * (Math.atan(-1.0) / Math.PI);
}
return tmp;
}
def code(A, B, C): tmp = 0 if B <= -1.15e-102: tmp = 180.0 * (math.atan(1.0) / math.pi) elif B <= 5e-134: tmp = 180.0 * (math.atan(0.0) / math.pi) else: tmp = 180.0 * (math.atan(-1.0) / math.pi) return tmp
function code(A, B, C) tmp = 0.0 if (B <= -1.15e-102) tmp = Float64(180.0 * Float64(atan(1.0) / pi)); elseif (B <= 5e-134) tmp = Float64(180.0 * Float64(atan(0.0) / pi)); else tmp = Float64(180.0 * Float64(atan(-1.0) / pi)); end return tmp end
function tmp_2 = code(A, B, C) tmp = 0.0; if (B <= -1.15e-102) tmp = 180.0 * (atan(1.0) / pi); elseif (B <= 5e-134) tmp = 180.0 * (atan(0.0) / pi); else tmp = 180.0 * (atan(-1.0) / pi); end tmp_2 = tmp; end
code[A_, B_, C_] := If[LessEqual[B, -1.15e-102], N[(180.0 * N[(N[ArcTan[1.0], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 5e-134], N[(180.0 * N[(N[ArcTan[0.0], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], N[(180.0 * N[(N[ArcTan[-1.0], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq -1.15 \cdot 10^{-102}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\pi}\\
\mathbf{elif}\;B \leq 5 \cdot 10^{-134}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} 0}{\pi}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\pi}\\
\end{array}
\end{array}
if B < -1.14999999999999993e-102Initial program 58.8%
Taylor expanded in B around -inf 51.4%
if -1.14999999999999993e-102 < B < 5.0000000000000003e-134Initial program 53.6%
Taylor expanded in C around inf 33.6%
Taylor expanded in B around 0 37.4%
distribute-rgt1-in37.4%
metadata-eval37.4%
mul0-lft37.4%
div037.4%
metadata-eval37.4%
Simplified37.4%
if 5.0000000000000003e-134 < B Initial program 42.7%
Taylor expanded in B around inf 51.2%
(FPCore (A B C) :precision binary64 (if (<= B 1.02e-130) (* 180.0 (/ (atan 0.0) PI)) (* 180.0 (/ (atan -1.0) PI))))
double code(double A, double B, double C) {
double tmp;
if (B <= 1.02e-130) {
tmp = 180.0 * (atan(0.0) / ((double) M_PI));
} else {
tmp = 180.0 * (atan(-1.0) / ((double) M_PI));
}
return tmp;
}
public static double code(double A, double B, double C) {
double tmp;
if (B <= 1.02e-130) {
tmp = 180.0 * (Math.atan(0.0) / Math.PI);
} else {
tmp = 180.0 * (Math.atan(-1.0) / Math.PI);
}
return tmp;
}
def code(A, B, C): tmp = 0 if B <= 1.02e-130: tmp = 180.0 * (math.atan(0.0) / math.pi) else: tmp = 180.0 * (math.atan(-1.0) / math.pi) return tmp
function code(A, B, C) tmp = 0.0 if (B <= 1.02e-130) tmp = Float64(180.0 * Float64(atan(0.0) / pi)); else tmp = Float64(180.0 * Float64(atan(-1.0) / pi)); end return tmp end
function tmp_2 = code(A, B, C) tmp = 0.0; if (B <= 1.02e-130) tmp = 180.0 * (atan(0.0) / pi); else tmp = 180.0 * (atan(-1.0) / pi); end tmp_2 = tmp; end
code[A_, B_, C_] := If[LessEqual[B, 1.02e-130], N[(180.0 * N[(N[ArcTan[0.0], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], N[(180.0 * N[(N[ArcTan[-1.0], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 1.02 \cdot 10^{-130}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} 0}{\pi}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} -1}{\pi}\\
\end{array}
\end{array}
if B < 1.01999999999999994e-130Initial program 56.1%
Taylor expanded in C around inf 27.1%
Taylor expanded in B around 0 20.9%
distribute-rgt1-in20.9%
metadata-eval20.9%
mul0-lft20.9%
div020.9%
metadata-eval20.9%
Simplified20.9%
if 1.01999999999999994e-130 < B Initial program 42.7%
Taylor expanded in B around inf 51.2%
(FPCore (A B C) :precision binary64 (* 180.0 (/ (atan -1.0) PI)))
double code(double A, double B, double C) {
return 180.0 * (atan(-1.0) / ((double) M_PI));
}
public static double code(double A, double B, double C) {
return 180.0 * (Math.atan(-1.0) / Math.PI);
}
def code(A, B, C): return 180.0 * (math.atan(-1.0) / math.pi)
function code(A, B, C) return Float64(180.0 * Float64(atan(-1.0) / pi)) end
function tmp = code(A, B, C) tmp = 180.0 * (atan(-1.0) / pi); end
code[A_, B_, C_] := N[(180.0 * N[(N[ArcTan[-1.0], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
180 \cdot \frac{\tan^{-1} -1}{\pi}
\end{array}
Initial program 51.5%
Taylor expanded in B around inf 20.0%
herbie shell --seed 2024191
(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)))