| Alternative 1 | |
|---|---|
| Error | 23.0 |
| Cost | 20940 |
(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
(* (/ 1.0 B) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))
PI)))
(t_1
(* 180.0 (/ (atan (* 0.5 (+ (* B (/ C (pow A 2.0))) (/ B A)))) PI)))
(t_2 (+ 1.0 (/ C B))))
(if (<= B -3e-208)
(* 180.0 (/ (atan (- t_2 (/ A B))) PI))
(if (<= B -8.2e-305)
t_1
(if (<= B 7e-276)
t_0
(if (<= B 8.5e-273)
(* 180.0 (/ (atan (- (/ (+ A (- A)) B))) PI))
(if (<= B 1.26e-179)
t_0
(if (<= B 6.2e-95)
t_1
(if (<= B 3.5e+134)
t_0
(* 180.0 (/ (atan (+ t_2 (- -2.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(((1.0 / B) * ((C - A) - sqrt((pow((A - C), 2.0) + pow(B, 2.0)))))) / ((double) M_PI));
double t_1 = 180.0 * (atan((0.5 * ((B * (C / pow(A, 2.0))) + (B / A)))) / ((double) M_PI));
double t_2 = 1.0 + (C / B);
double tmp;
if (B <= -3e-208) {
tmp = 180.0 * (atan((t_2 - (A / B))) / ((double) M_PI));
} else if (B <= -8.2e-305) {
tmp = t_1;
} else if (B <= 7e-276) {
tmp = t_0;
} else if (B <= 8.5e-273) {
tmp = 180.0 * (atan(-((A + -A) / B)) / ((double) M_PI));
} else if (B <= 1.26e-179) {
tmp = t_0;
} else if (B <= 6.2e-95) {
tmp = t_1;
} else if (B <= 3.5e+134) {
tmp = t_0;
} else {
tmp = 180.0 * (atan((t_2 + (-2.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(((1.0 / B) * ((C - A) - Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B, 2.0)))))) / Math.PI);
double t_1 = 180.0 * (Math.atan((0.5 * ((B * (C / Math.pow(A, 2.0))) + (B / A)))) / Math.PI);
double t_2 = 1.0 + (C / B);
double tmp;
if (B <= -3e-208) {
tmp = 180.0 * (Math.atan((t_2 - (A / B))) / Math.PI);
} else if (B <= -8.2e-305) {
tmp = t_1;
} else if (B <= 7e-276) {
tmp = t_0;
} else if (B <= 8.5e-273) {
tmp = 180.0 * (Math.atan(-((A + -A) / B)) / Math.PI);
} else if (B <= 1.26e-179) {
tmp = t_0;
} else if (B <= 6.2e-95) {
tmp = t_1;
} else if (B <= 3.5e+134) {
tmp = t_0;
} else {
tmp = 180.0 * (Math.atan((t_2 + (-2.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(((1.0 / B) * ((C - A) - math.sqrt((math.pow((A - C), 2.0) + math.pow(B, 2.0)))))) / math.pi) t_1 = 180.0 * (math.atan((0.5 * ((B * (C / math.pow(A, 2.0))) + (B / A)))) / math.pi) t_2 = 1.0 + (C / B) tmp = 0 if B <= -3e-208: tmp = 180.0 * (math.atan((t_2 - (A / B))) / math.pi) elif B <= -8.2e-305: tmp = t_1 elif B <= 7e-276: tmp = t_0 elif B <= 8.5e-273: tmp = 180.0 * (math.atan(-((A + -A) / B)) / math.pi) elif B <= 1.26e-179: tmp = t_0 elif B <= 6.2e-95: tmp = t_1 elif B <= 3.5e+134: tmp = t_0 else: tmp = 180.0 * (math.atan((t_2 + (-2.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(Float64(1.0 / B) * Float64(Float64(C - A) - sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0)))))) / pi)) t_1 = Float64(180.0 * Float64(atan(Float64(0.5 * Float64(Float64(B * Float64(C / (A ^ 2.0))) + Float64(B / A)))) / pi)) t_2 = Float64(1.0 + Float64(C / B)) tmp = 0.0 if (B <= -3e-208) tmp = Float64(180.0 * Float64(atan(Float64(t_2 - Float64(A / B))) / pi)); elseif (B <= -8.2e-305) tmp = t_1; elseif (B <= 7e-276) tmp = t_0; elseif (B <= 8.5e-273) tmp = Float64(180.0 * Float64(atan(Float64(-Float64(Float64(A + Float64(-A)) / B))) / pi)); elseif (B <= 1.26e-179) tmp = t_0; elseif (B <= 6.2e-95) tmp = t_1; elseif (B <= 3.5e+134) tmp = t_0; else tmp = Float64(180.0 * Float64(atan(Float64(t_2 + Float64(-2.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(((1.0 / B) * ((C - A) - sqrt((((A - C) ^ 2.0) + (B ^ 2.0)))))) / pi); t_1 = 180.0 * (atan((0.5 * ((B * (C / (A ^ 2.0))) + (B / A)))) / pi); t_2 = 1.0 + (C / B); tmp = 0.0; if (B <= -3e-208) tmp = 180.0 * (atan((t_2 - (A / B))) / pi); elseif (B <= -8.2e-305) tmp = t_1; elseif (B <= 7e-276) tmp = t_0; elseif (B <= 8.5e-273) tmp = 180.0 * (atan(-((A + -A) / B)) / pi); elseif (B <= 1.26e-179) tmp = t_0; elseif (B <= 6.2e-95) tmp = t_1; elseif (B <= 3.5e+134) tmp = t_0; else tmp = 180.0 * (atan((t_2 + (-2.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[(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]}, Block[{t$95$1 = N[(180.0 * N[(N[ArcTan[N[(0.5 * N[(N[(B * N[(C / N[Power[A, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(B / A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 + N[(C / B), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -3e-208], N[(180.0 * N[(N[ArcTan[N[(t$95$2 - N[(A / B), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -8.2e-305], t$95$1, If[LessEqual[B, 7e-276], t$95$0, If[LessEqual[B, 8.5e-273], N[(180.0 * N[(N[ArcTan[(-N[(N[(A + (-A)), $MachinePrecision] / B), $MachinePrecision])], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 1.26e-179], t$95$0, If[LessEqual[B, 6.2e-95], t$95$1, If[LessEqual[B, 3.5e+134], t$95$0, N[(180.0 * N[(N[ArcTan[N[(t$95$2 + N[(-2.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(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}{\pi}\\
t_1 := 180 \cdot \frac{\tan^{-1} \left(0.5 \cdot \left(B \cdot \frac{C}{{A}^{2}} + \frac{B}{A}\right)\right)}{\pi}\\
t_2 := 1 + \frac{C}{B}\\
\mathbf{if}\;B \leq -3 \cdot 10^{-208}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(t_2 - \frac{A}{B}\right)}{\pi}\\
\mathbf{elif}\;B \leq -8.2 \cdot 10^{-305}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;B \leq 7 \cdot 10^{-276}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;B \leq 8.5 \cdot 10^{-273}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(-\frac{A + \left(-A\right)}{B}\right)}{\pi}\\
\mathbf{elif}\;B \leq 1.26 \cdot 10^{-179}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;B \leq 6.2 \cdot 10^{-95}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;B \leq 3.5 \cdot 10^{+134}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(t_2 + \left(-2 - \frac{A}{B}\right)\right)}{\pi}\\
\end{array}
Results
if B < -2.99999999999999986e-208Initial program 30.1
Taylor expanded in B around -inf 20.1
if -2.99999999999999986e-208 < B < -8.2000000000000005e-305 or 1.2599999999999999e-179 < B < 6.19999999999999983e-95Initial program 27.9
Taylor expanded in A around -inf 38.8
Simplified37.8
[Start]38.8 | \[ 180 \cdot \frac{\tan^{-1} \left(0.5 \cdot \frac{C \cdot B}{{A}^{2}} + 0.5 \cdot \frac{B}{A}\right)}{\pi}
\] |
|---|---|
rational.json-simplify-1 [=>]38.8 | \[ 180 \cdot \frac{\tan^{-1} \color{blue}{\left(0.5 \cdot \frac{B}{A} + 0.5 \cdot \frac{C \cdot B}{{A}^{2}}\right)}}{\pi}
\] |
rational.json-simplify-2 [=>]38.8 | \[ 180 \cdot \frac{\tan^{-1} \left(0.5 \cdot \frac{B}{A} + \color{blue}{\frac{C \cdot B}{{A}^{2}} \cdot 0.5}\right)}{\pi}
\] |
rational.json-simplify-51 [=>]38.8 | \[ 180 \cdot \frac{\tan^{-1} \color{blue}{\left(0.5 \cdot \left(\frac{C \cdot B}{{A}^{2}} + \frac{B}{A}\right)\right)}}{\pi}
\] |
rational.json-simplify-49 [=>]37.8 | \[ 180 \cdot \frac{\tan^{-1} \left(0.5 \cdot \left(\color{blue}{B \cdot \frac{C}{{A}^{2}}} + \frac{B}{A}\right)\right)}{\pi}
\] |
if -8.2000000000000005e-305 < B < 6.99999999999999986e-276 or 8.5000000000000008e-273 < B < 1.2599999999999999e-179 or 6.19999999999999983e-95 < B < 3.50000000000000003e134Initial program 23.4
if 6.99999999999999986e-276 < B < 8.5000000000000008e-273Initial program 23.3
Taylor expanded in C around inf 43.9
Simplified43.9
[Start]43.9 | \[ 180 \cdot \frac{\tan^{-1} \left(-1 \cdot \frac{A + -1 \cdot A}{B}\right)}{\pi}
\] |
|---|---|
rational.json-simplify-2 [=>]43.9 | \[ 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{A + -1 \cdot A}{B} \cdot -1\right)}}{\pi}
\] |
rational.json-simplify-9 [=>]43.9 | \[ 180 \cdot \frac{\tan^{-1} \color{blue}{\left(-\frac{A + -1 \cdot A}{B}\right)}}{\pi}
\] |
rational.json-simplify-2 [=>]43.9 | \[ 180 \cdot \frac{\tan^{-1} \left(-\frac{A + \color{blue}{A \cdot -1}}{B}\right)}{\pi}
\] |
rational.json-simplify-8 [<=]43.9 | \[ 180 \cdot \frac{\tan^{-1} \left(-\frac{A + \color{blue}{\left(-A\right)}}{B}\right)}{\pi}
\] |
if 3.50000000000000003e134 < B Initial program 43.1
Taylor expanded in B around inf 9.1
Applied egg-rr9.1
Simplified9.1
[Start]9.1 | \[ 180 \cdot \frac{\tan^{-1} \left(\left(-1 - \left(1 + \frac{A}{B}\right)\right) + \left(1 - \frac{-C}{B}\right)\right)}{\pi}
\] |
|---|---|
rational.json-simplify-1 [=>]9.1 | \[ 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\left(1 - \frac{-C}{B}\right) + \left(-1 - \left(1 + \frac{A}{B}\right)\right)\right)}}{\pi}
\] |
rational.json-simplify-10 [=>]9.1 | \[ 180 \cdot \frac{\tan^{-1} \left(\left(1 - \frac{\color{blue}{\frac{C}{-1}}}{B}\right) + \left(-1 - \left(1 + \frac{A}{B}\right)\right)\right)}{\pi}
\] |
rational.json-simplify-44 [=>]9.1 | \[ 180 \cdot \frac{\tan^{-1} \left(\left(1 - \color{blue}{\frac{\frac{C}{B}}{-1}}\right) + \left(-1 - \left(1 + \frac{A}{B}\right)\right)\right)}{\pi}
\] |
rational.json-simplify-10 [<=]9.1 | \[ 180 \cdot \frac{\tan^{-1} \left(\left(1 - \color{blue}{\left(-\frac{C}{B}\right)}\right) + \left(-1 - \left(1 + \frac{A}{B}\right)\right)\right)}{\pi}
\] |
rational.json-simplify-12 [=>]9.1 | \[ 180 \cdot \frac{\tan^{-1} \left(\left(1 - \color{blue}{\left(0 - \frac{C}{B}\right)}\right) + \left(-1 - \left(1 + \frac{A}{B}\right)\right)\right)}{\pi}
\] |
rational.json-simplify-45 [=>]9.1 | \[ 180 \cdot \frac{\tan^{-1} \left(\color{blue}{\left(\frac{C}{B} - \left(0 - 1\right)\right)} + \left(-1 - \left(1 + \frac{A}{B}\right)\right)\right)}{\pi}
\] |
metadata-eval [=>]9.1 | \[ 180 \cdot \frac{\tan^{-1} \left(\left(\frac{C}{B} - \color{blue}{-1}\right) + \left(-1 - \left(1 + \frac{A}{B}\right)\right)\right)}{\pi}
\] |
rational.json-simplify-18 [=>]9.1 | \[ 180 \cdot \frac{\tan^{-1} \left(\color{blue}{\left(1 + \frac{C}{B}\right)} + \left(-1 - \left(1 + \frac{A}{B}\right)\right)\right)}{\pi}
\] |
metadata-eval [<=]9.1 | \[ 180 \cdot \frac{\tan^{-1} \left(\left(1 + \frac{C}{B}\right) + \left(\color{blue}{\left(0 - 1\right)} - \left(1 + \frac{A}{B}\right)\right)\right)}{\pi}
\] |
rational.json-simplify-42 [<=]9.1 | \[ 180 \cdot \frac{\tan^{-1} \left(\left(1 + \frac{C}{B}\right) + \color{blue}{\left(\left(0 - \left(1 + \frac{A}{B}\right)\right) - 1\right)}\right)}{\pi}
\] |
rational.json-simplify-17 [=>]9.1 | \[ 180 \cdot \frac{\tan^{-1} \left(\left(1 + \frac{C}{B}\right) + \left(\left(0 - \color{blue}{\left(\frac{A}{B} - -1\right)}\right) - 1\right)\right)}{\pi}
\] |
rational.json-simplify-45 [=>]9.1 | \[ 180 \cdot \frac{\tan^{-1} \left(\left(1 + \frac{C}{B}\right) + \left(\color{blue}{\left(-1 - \left(\frac{A}{B} - 0\right)\right)} - 1\right)\right)}{\pi}
\] |
rational.json-simplify-5 [=>]9.1 | \[ 180 \cdot \frac{\tan^{-1} \left(\left(1 + \frac{C}{B}\right) + \left(\left(-1 - \color{blue}{\frac{A}{B}}\right) - 1\right)\right)}{\pi}
\] |
rational.json-simplify-42 [=>]9.1 | \[ 180 \cdot \frac{\tan^{-1} \left(\left(1 + \frac{C}{B}\right) + \color{blue}{\left(\left(-1 - 1\right) - \frac{A}{B}\right)}\right)}{\pi}
\] |
metadata-eval [=>]9.1 | \[ 180 \cdot \frac{\tan^{-1} \left(\left(1 + \frac{C}{B}\right) + \left(\color{blue}{-2} - \frac{A}{B}\right)\right)}{\pi}
\] |
Final simplification22.2
| Alternative 1 | |
|---|---|
| Error | 23.0 |
| Cost | 20940 |
| Alternative 2 | |
|---|---|
| Error | 23.4 |
| Cost | 20688 |
| Alternative 3 | |
|---|---|
| Error | 27.0 |
| Cost | 14236 |
| Alternative 4 | |
|---|---|
| Error | 26.9 |
| Cost | 14236 |
| Alternative 5 | |
|---|---|
| Error | 25.7 |
| Cost | 14104 |
| Alternative 6 | |
|---|---|
| Error | 34.6 |
| Cost | 13972 |
| Alternative 7 | |
|---|---|
| Error | 34.6 |
| Cost | 13972 |
| Alternative 8 | |
|---|---|
| Error | 26.9 |
| Cost | 13972 |
| Alternative 9 | |
|---|---|
| Error | 30.6 |
| Cost | 13840 |
| Alternative 10 | |
|---|---|
| Error | 22.9 |
| Cost | 13832 |
| Alternative 11 | |
|---|---|
| Error | 22.8 |
| Cost | 13832 |
| Alternative 12 | |
|---|---|
| Error | 34.5 |
| Cost | 13576 |
| Alternative 13 | |
|---|---|
| Error | 34.5 |
| Cost | 13512 |
| Alternative 14 | |
|---|---|
| Error | 34.6 |
| Cost | 13448 |
| Alternative 15 | |
|---|---|
| Error | 38.9 |
| Cost | 13188 |
| Alternative 16 | |
|---|---|
| Error | 50.9 |
| Cost | 13056 |
herbie shell --seed 2023067
(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)))