| Alternative 1 | |
|---|---|
| Error | 23.6 |
| Cost | 33284 |
(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 (* 0.5 (* (+ (/ C (pow A 2.0)) (/ 1.0 A)) B))) PI))))
(if (<= B -4.2e+160)
(* 180.0 (/ (atan (- (+ 1.0 (/ C B)) (/ A B))) PI))
(if (<= B -7.8e-252)
(*
180.0
(/
(atan
(* (/ 1.0 B) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))
PI))
(if (<= B 4e-260)
(* 180.0 (/ (atan (/ (- C C) B)) PI))
(if (<= B 6.2e-173)
t_0
(if (<= B 7.2e-141)
(*
180.0
(/
(atan
(+
(- (/ (+ A (- A)) B))
(*
-0.5
(/
(- (+ (pow B 2.0) (pow A 2.0)) (pow (- A) 2.0))
(* B C)))))
PI))
(if (<= B 4.2e-62)
t_0
(* 180.0 (/ (atan (- (/ C B) (+ 1.0 (/ A B)))) 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((0.5 * (((C / pow(A, 2.0)) + (1.0 / A)) * B))) / ((double) M_PI));
double tmp;
if (B <= -4.2e+160) {
tmp = 180.0 * (atan(((1.0 + (C / B)) - (A / B))) / ((double) M_PI));
} else if (B <= -7.8e-252) {
tmp = 180.0 * (atan(((1.0 / B) * ((C - A) - sqrt((pow((A - C), 2.0) + pow(B, 2.0)))))) / ((double) M_PI));
} else if (B <= 4e-260) {
tmp = 180.0 * (atan(((C - C) / B)) / ((double) M_PI));
} else if (B <= 6.2e-173) {
tmp = t_0;
} else if (B <= 7.2e-141) {
tmp = 180.0 * (atan((-((A + -A) / B) + (-0.5 * (((pow(B, 2.0) + pow(A, 2.0)) - pow(-A, 2.0)) / (B * C))))) / ((double) M_PI));
} else if (B <= 4.2e-62) {
tmp = t_0;
} else {
tmp = 180.0 * (atan(((C / B) - (1.0 + (A / B)))) / ((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((0.5 * (((C / Math.pow(A, 2.0)) + (1.0 / A)) * B))) / Math.PI);
double tmp;
if (B <= -4.2e+160) {
tmp = 180.0 * (Math.atan(((1.0 + (C / B)) - (A / B))) / Math.PI);
} else if (B <= -7.8e-252) {
tmp = 180.0 * (Math.atan(((1.0 / B) * ((C - A) - Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B, 2.0)))))) / Math.PI);
} else if (B <= 4e-260) {
tmp = 180.0 * (Math.atan(((C - C) / B)) / Math.PI);
} else if (B <= 6.2e-173) {
tmp = t_0;
} else if (B <= 7.2e-141) {
tmp = 180.0 * (Math.atan((-((A + -A) / B) + (-0.5 * (((Math.pow(B, 2.0) + Math.pow(A, 2.0)) - Math.pow(-A, 2.0)) / (B * C))))) / Math.PI);
} else if (B <= 4.2e-62) {
tmp = t_0;
} else {
tmp = 180.0 * (Math.atan(((C / B) - (1.0 + (A / B)))) / 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((0.5 * (((C / math.pow(A, 2.0)) + (1.0 / A)) * B))) / math.pi) tmp = 0 if B <= -4.2e+160: tmp = 180.0 * (math.atan(((1.0 + (C / B)) - (A / B))) / math.pi) elif B <= -7.8e-252: tmp = 180.0 * (math.atan(((1.0 / B) * ((C - A) - math.sqrt((math.pow((A - C), 2.0) + math.pow(B, 2.0)))))) / math.pi) elif B <= 4e-260: tmp = 180.0 * (math.atan(((C - C) / B)) / math.pi) elif B <= 6.2e-173: tmp = t_0 elif B <= 7.2e-141: tmp = 180.0 * (math.atan((-((A + -A) / B) + (-0.5 * (((math.pow(B, 2.0) + math.pow(A, 2.0)) - math.pow(-A, 2.0)) / (B * C))))) / math.pi) elif B <= 4.2e-62: tmp = t_0 else: tmp = 180.0 * (math.atan(((C / B) - (1.0 + (A / B)))) / 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(0.5 * Float64(Float64(Float64(C / (A ^ 2.0)) + Float64(1.0 / A)) * B))) / pi)) tmp = 0.0 if (B <= -4.2e+160) tmp = Float64(180.0 * Float64(atan(Float64(Float64(1.0 + Float64(C / B)) - Float64(A / B))) / pi)); elseif (B <= -7.8e-252) tmp = 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)); elseif (B <= 4e-260) tmp = Float64(180.0 * Float64(atan(Float64(Float64(C - C) / B)) / pi)); elseif (B <= 6.2e-173) tmp = t_0; elseif (B <= 7.2e-141) tmp = Float64(180.0 * Float64(atan(Float64(Float64(-Float64(Float64(A + Float64(-A)) / B)) + Float64(-0.5 * Float64(Float64(Float64((B ^ 2.0) + (A ^ 2.0)) - (Float64(-A) ^ 2.0)) / Float64(B * C))))) / pi)); elseif (B <= 4.2e-62) tmp = t_0; else tmp = Float64(180.0 * Float64(atan(Float64(Float64(C / B) - Float64(1.0 + Float64(A / B)))) / 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((0.5 * (((C / (A ^ 2.0)) + (1.0 / A)) * B))) / pi); tmp = 0.0; if (B <= -4.2e+160) tmp = 180.0 * (atan(((1.0 + (C / B)) - (A / B))) / pi); elseif (B <= -7.8e-252) tmp = 180.0 * (atan(((1.0 / B) * ((C - A) - sqrt((((A - C) ^ 2.0) + (B ^ 2.0)))))) / pi); elseif (B <= 4e-260) tmp = 180.0 * (atan(((C - C) / B)) / pi); elseif (B <= 6.2e-173) tmp = t_0; elseif (B <= 7.2e-141) tmp = 180.0 * (atan((-((A + -A) / B) + (-0.5 * ((((B ^ 2.0) + (A ^ 2.0)) - (-A ^ 2.0)) / (B * C))))) / pi); elseif (B <= 4.2e-62) tmp = t_0; else tmp = 180.0 * (atan(((C / B) - (1.0 + (A / B)))) / 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[(0.5 * N[(N[(N[(C / N[Power[A, 2.0], $MachinePrecision]), $MachinePrecision] + N[(1.0 / A), $MachinePrecision]), $MachinePrecision] * B), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -4.2e+160], N[(180.0 * N[(N[ArcTan[N[(N[(1.0 + N[(C / B), $MachinePrecision]), $MachinePrecision] - N[(A / B), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -7.8e-252], 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], If[LessEqual[B, 4e-260], N[(180.0 * N[(N[ArcTan[N[(N[(C - C), $MachinePrecision] / B), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 6.2e-173], t$95$0, If[LessEqual[B, 7.2e-141], N[(180.0 * N[(N[ArcTan[N[((-N[(N[(A + (-A)), $MachinePrecision] / B), $MachinePrecision]) + N[(-0.5 * N[(N[(N[(N[Power[B, 2.0], $MachinePrecision] + N[Power[A, 2.0], $MachinePrecision]), $MachinePrecision] - N[Power[(-A), 2.0], $MachinePrecision]), $MachinePrecision] / N[(B * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 4.2e-62], t$95$0, N[(180.0 * N[(N[ArcTan[N[(N[(C / B), $MachinePrecision] - N[(1.0 + N[(A / B), $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(0.5 \cdot \left(\left(\frac{C}{{A}^{2}} + \frac{1}{A}\right) \cdot B\right)\right)}{\pi}\\
\mathbf{if}\;B \leq -4.2 \cdot 10^{+160}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\left(1 + \frac{C}{B}\right) - \frac{A}{B}\right)}{\pi}\\
\mathbf{elif}\;B \leq -7.8 \cdot 10^{-252}:\\
\;\;\;\;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}\\
\mathbf{elif}\;B \leq 4 \cdot 10^{-260}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C - C}{B}\right)}{\pi}\\
\mathbf{elif}\;B \leq 6.2 \cdot 10^{-173}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;B \leq 7.2 \cdot 10^{-141}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\left(-\frac{A + \left(-A\right)}{B}\right) + -0.5 \cdot \frac{\left({B}^{2} + {A}^{2}\right) - {\left(-A\right)}^{2}}{B \cdot C}\right)}{\pi}\\
\mathbf{elif}\;B \leq 4.2 \cdot 10^{-62}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C}{B} - \left(1 + \frac{A}{B}\right)\right)}{\pi}\\
\end{array}
Results
if B < -4.19999999999999993e160Initial program 47.5
Taylor expanded in B around -inf 7.7
if -4.19999999999999993e160 < B < -7.7999999999999998e-252Initial program 24.5
if -7.7999999999999998e-252 < B < 3.99999999999999985e-260Initial program 24.1
Taylor expanded in A around 0 31.8
Taylor expanded in B around 0 39.6
if 3.99999999999999985e-260 < B < 6.20000000000000011e-173 or 7.2000000000000003e-141 < B < 4.1999999999999998e-62Initial program 27.5
Taylor expanded in A around -inf 39.5
Simplified39.5
[Start]39.5 | \[ 180 \cdot \frac{\tan^{-1} \left(0.5 \cdot \frac{C \cdot B}{{A}^{2}} + 0.5 \cdot \frac{B}{A}\right)}{\pi}
\] |
|---|---|
rational_best-simplify-47 [=>]39.5 | \[ 180 \cdot \frac{\tan^{-1} \color{blue}{\left(0.5 \cdot \left(\frac{B}{A} + \frac{C \cdot B}{{A}^{2}}\right)\right)}}{\pi}
\] |
rational_best-simplify-2 [=>]39.5 | \[ 180 \cdot \frac{\tan^{-1} \left(0.5 \cdot \left(\frac{B}{A} + \frac{\color{blue}{B \cdot C}}{{A}^{2}}\right)\right)}{\pi}
\] |
Taylor expanded in B around 0 38.4
if 6.20000000000000011e-173 < B < 7.2000000000000003e-141Initial program 32.2
Taylor expanded in C around inf 55.5
Simplified55.5
[Start]55.5 | \[ 180 \cdot \frac{\tan^{-1} \left(-0.5 \cdot \frac{\left({B}^{2} + {A}^{2}\right) - {\left(-1 \cdot A\right)}^{2}}{C \cdot B} + -1 \cdot \frac{A + -1 \cdot A}{B}\right)}{\pi}
\] |
|---|---|
rational_best-simplify-1 [=>]55.5 | \[ 180 \cdot \frac{\tan^{-1} \color{blue}{\left(-1 \cdot \frac{A + -1 \cdot A}{B} + -0.5 \cdot \frac{\left({B}^{2} + {A}^{2}\right) - {\left(-1 \cdot A\right)}^{2}}{C \cdot B}\right)}}{\pi}
\] |
rational_best-simplify-2 [=>]55.5 | \[ 180 \cdot \frac{\tan^{-1} \left(\color{blue}{\frac{A + -1 \cdot A}{B} \cdot -1} + -0.5 \cdot \frac{\left({B}^{2} + {A}^{2}\right) - {\left(-1 \cdot A\right)}^{2}}{C \cdot B}\right)}{\pi}
\] |
rational_best-simplify-12 [=>]55.5 | \[ 180 \cdot \frac{\tan^{-1} \left(\color{blue}{\left(-\frac{A + -1 \cdot A}{B}\right)} + -0.5 \cdot \frac{\left({B}^{2} + {A}^{2}\right) - {\left(-1 \cdot A\right)}^{2}}{C \cdot B}\right)}{\pi}
\] |
rational_best-simplify-2 [=>]55.5 | \[ 180 \cdot \frac{\tan^{-1} \left(\left(-\frac{A + \color{blue}{A \cdot -1}}{B}\right) + -0.5 \cdot \frac{\left({B}^{2} + {A}^{2}\right) - {\left(-1 \cdot A\right)}^{2}}{C \cdot B}\right)}{\pi}
\] |
rational_best-simplify-13 [<=]55.5 | \[ 180 \cdot \frac{\tan^{-1} \left(\left(-\frac{A + \color{blue}{\left(-A\right)}}{B}\right) + -0.5 \cdot \frac{\left({B}^{2} + {A}^{2}\right) - {\left(-1 \cdot A\right)}^{2}}{C \cdot B}\right)}{\pi}
\] |
rational_best-simplify-2 [=>]55.5 | \[ 180 \cdot \frac{\tan^{-1} \left(\left(-\frac{A + \left(-A\right)}{B}\right) + -0.5 \cdot \frac{\left({B}^{2} + {A}^{2}\right) - {\color{blue}{\left(A \cdot -1\right)}}^{2}}{C \cdot B}\right)}{\pi}
\] |
rational_best-simplify-13 [<=]55.5 | \[ 180 \cdot \frac{\tan^{-1} \left(\left(-\frac{A + \left(-A\right)}{B}\right) + -0.5 \cdot \frac{\left({B}^{2} + {A}^{2}\right) - {\color{blue}{\left(-A\right)}}^{2}}{C \cdot B}\right)}{\pi}
\] |
rational_best-simplify-2 [=>]55.5 | \[ 180 \cdot \frac{\tan^{-1} \left(\left(-\frac{A + \left(-A\right)}{B}\right) + -0.5 \cdot \frac{\left({B}^{2} + {A}^{2}\right) - {\left(-A\right)}^{2}}{\color{blue}{B \cdot C}}\right)}{\pi}
\] |
if 4.1999999999999998e-62 < B Initial program 31.5
Taylor expanded in B around inf 16.4
Final simplification23.9
| Alternative 1 | |
|---|---|
| Error | 23.6 |
| Cost | 33284 |
| Alternative 2 | |
|---|---|
| Error | 24.1 |
| Cost | 33032 |
| Alternative 3 | |
|---|---|
| Error | 24.7 |
| Cost | 20688 |
| Alternative 4 | |
|---|---|
| Error | 24.7 |
| Cost | 20232 |
| Alternative 5 | |
|---|---|
| Error | 24.4 |
| Cost | 20168 |
| Alternative 6 | |
|---|---|
| Error | 26.1 |
| Cost | 13964 |
| Alternative 7 | |
|---|---|
| Error | 33.8 |
| Cost | 13840 |
| Alternative 8 | |
|---|---|
| Error | 33.7 |
| Cost | 13840 |
| Alternative 9 | |
|---|---|
| Error | 24.9 |
| Cost | 13832 |
| Alternative 10 | |
|---|---|
| Error | 29.7 |
| Cost | 13708 |
| Alternative 11 | |
|---|---|
| Error | 26.6 |
| Cost | 13576 |
| Alternative 12 | |
|---|---|
| Error | 26.2 |
| Cost | 13576 |
| Alternative 13 | |
|---|---|
| Error | 34.6 |
| Cost | 13448 |
| Alternative 14 | |
|---|---|
| Error | 38.5 |
| Cost | 13188 |
| Alternative 15 | |
|---|---|
| Error | 50.5 |
| Cost | 13056 |
herbie shell --seed 2023092
(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)))