| Alternative 1 | |
|---|---|
| Error | 24.2 |
| Cost | 33616 |
(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 (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))
(t_1 (* (/ 1.0 B) (- (- C A) t_0))))
(if (<= t_1 -1.0)
(/ (* 180.0 (atan (+ -1.0 (/ (- C A) B)))) PI)
(if (<= t_1 4e-24)
(* 180.0 (/ (atan (+ (* -0.5 (/ B C)) 0.0)) PI))
(if (<= t_1 5e+280)
(* 180.0 (/ (atan (/ (+ A (- t_0 C)) (- B))) PI))
(* 180.0 (/ (atan 1.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));
}
double code(double A, double B, double C) {
double t_0 = sqrt((pow((A - C), 2.0) + pow(B, 2.0)));
double t_1 = (1.0 / B) * ((C - A) - t_0);
double tmp;
if (t_1 <= -1.0) {
tmp = (180.0 * atan((-1.0 + ((C - A) / B)))) / ((double) M_PI);
} else if (t_1 <= 4e-24) {
tmp = 180.0 * (atan(((-0.5 * (B / C)) + 0.0)) / ((double) M_PI));
} else if (t_1 <= 5e+280) {
tmp = 180.0 * (atan(((A + (t_0 - C)) / -B)) / ((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) {
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.sqrt((Math.pow((A - C), 2.0) + Math.pow(B, 2.0)));
double t_1 = (1.0 / B) * ((C - A) - t_0);
double tmp;
if (t_1 <= -1.0) {
tmp = (180.0 * Math.atan((-1.0 + ((C - A) / B)))) / Math.PI;
} else if (t_1 <= 4e-24) {
tmp = 180.0 * (Math.atan(((-0.5 * (B / C)) + 0.0)) / Math.PI);
} else if (t_1 <= 5e+280) {
tmp = 180.0 * (Math.atan(((A + (t_0 - C)) / -B)) / Math.PI);
} else {
tmp = 180.0 * (Math.atan(1.0) / 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 = math.sqrt((math.pow((A - C), 2.0) + math.pow(B, 2.0))) t_1 = (1.0 / B) * ((C - A) - t_0) tmp = 0 if t_1 <= -1.0: tmp = (180.0 * math.atan((-1.0 + ((C - A) / B)))) / math.pi elif t_1 <= 4e-24: tmp = 180.0 * (math.atan(((-0.5 * (B / C)) + 0.0)) / math.pi) elif t_1 <= 5e+280: tmp = 180.0 * (math.atan(((A + (t_0 - C)) / -B)) / math.pi) else: tmp = 180.0 * (math.atan(1.0) / 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 = sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0))) t_1 = Float64(Float64(1.0 / B) * Float64(Float64(C - A) - t_0)) tmp = 0.0 if (t_1 <= -1.0) tmp = Float64(Float64(180.0 * atan(Float64(-1.0 + Float64(Float64(C - A) / B)))) / pi); elseif (t_1 <= 4e-24) tmp = Float64(180.0 * Float64(atan(Float64(Float64(-0.5 * Float64(B / C)) + 0.0)) / pi)); elseif (t_1 <= 5e+280) tmp = Float64(180.0 * Float64(atan(Float64(Float64(A + Float64(t_0 - C)) / Float64(-B))) / pi)); else tmp = Float64(180.0 * Float64(atan(1.0) / 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 = sqrt((((A - C) ^ 2.0) + (B ^ 2.0))); t_1 = (1.0 / B) * ((C - A) - t_0); tmp = 0.0; if (t_1 <= -1.0) tmp = (180.0 * atan((-1.0 + ((C - A) / B)))) / pi; elseif (t_1 <= 4e-24) tmp = 180.0 * (atan(((-0.5 * (B / C)) + 0.0)) / pi); elseif (t_1 <= 5e+280) tmp = 180.0 * (atan(((A + (t_0 - C)) / -B)) / pi); else tmp = 180.0 * (atan(1.0) / 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[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(1.0 / B), $MachinePrecision] * N[(N[(C - A), $MachinePrecision] - t$95$0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1.0], N[(N[(180.0 * N[ArcTan[N[(-1.0 + N[(N[(C - A), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / Pi), $MachinePrecision], If[LessEqual[t$95$1, 4e-24], N[(180.0 * N[(N[ArcTan[N[(N[(-0.5 * N[(B / C), $MachinePrecision]), $MachinePrecision] + 0.0), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+280], N[(180.0 * N[(N[ArcTan[N[(N[(A + N[(t$95$0 - C), $MachinePrecision]), $MachinePrecision] / (-B)), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], N[(180.0 * N[(N[ArcTan[1.0], $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 := \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\\
t_1 := \frac{1}{B} \cdot \left(\left(C - A\right) - t_0\right)\\
\mathbf{if}\;t_1 \leq -1:\\
\;\;\;\;\frac{180 \cdot \tan^{-1} \left(-1 + \frac{C - A}{B}\right)}{\pi}\\
\mathbf{elif}\;t_1 \leq 4 \cdot 10^{-24}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(-0.5 \cdot \frac{B}{C} + 0\right)}{\pi}\\
\mathbf{elif}\;t_1 \leq 5 \cdot 10^{+280}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{A + \left(t_0 - C\right)}{-B}\right)}{\pi}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} 1}{\pi}\\
\end{array}
Results
if (*.f64 (/.f64 1 B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))) < -1Initial program 26.8
Taylor expanded in B around inf 16.2
Simplified15.5
[Start]16.2 | \[ 180 \cdot \frac{\tan^{-1} \left(\frac{C}{B} - \left(1 + \frac{A}{B}\right)\right)}{\pi}
\] |
|---|---|
rational_best-simplify-17 [=>]16.2 | \[ 180 \cdot \frac{\tan^{-1} \left(\frac{C}{B} - \color{blue}{\left(\frac{A}{B} - -1\right)}\right)}{\pi}
\] |
rational_best-simplify-49 [=>]16.2 | \[ 180 \cdot \frac{\tan^{-1} \color{blue}{\left(-1 + \left(\frac{C}{B} - \frac{A}{B}\right)\right)}}{\pi}
\] |
rational_best-simplify-53 [<=]15.5 | \[ 180 \cdot \frac{\tan^{-1} \left(-1 + \color{blue}{\frac{C - A}{B}}\right)}{\pi}
\] |
Applied egg-rr15.5
if -1 < (*.f64 (/.f64 1 B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))) < 3.99999999999999969e-24Initial program 46.2
Taylor expanded in C around inf 45.0
Simplified45.0
[Start]45.0 | \[ 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-2 [=>]45.0 | \[ 180 \cdot \frac{\tan^{-1} \left(-0.5 \cdot \frac{\left({B}^{2} + {A}^{2}\right) - {\color{blue}{\left(A \cdot -1\right)}}^{2}}{C \cdot B} + -1 \cdot \frac{A + -1 \cdot A}{B}\right)}{\pi}
\] |
rational_best-simplify-13 [<=]45.0 | \[ 180 \cdot \frac{\tan^{-1} \left(-0.5 \cdot \frac{\left({B}^{2} + {A}^{2}\right) - {\color{blue}{\left(-A\right)}}^{2}}{C \cdot B} + -1 \cdot \frac{A + -1 \cdot A}{B}\right)}{\pi}
\] |
rational_best-simplify-2 [=>]45.0 | \[ 180 \cdot \frac{\tan^{-1} \left(-0.5 \cdot \frac{\left({B}^{2} + {A}^{2}\right) - {\left(-A\right)}^{2}}{\color{blue}{B \cdot C}} + -1 \cdot \frac{A + -1 \cdot A}{B}\right)}{\pi}
\] |
rational_best-simplify-2 [=>]45.0 | \[ 180 \cdot \frac{\tan^{-1} \left(-0.5 \cdot \frac{\left({B}^{2} + {A}^{2}\right) - {\left(-A\right)}^{2}}{B \cdot C} + \color{blue}{\frac{A + -1 \cdot A}{B} \cdot -1}\right)}{\pi}
\] |
rational_best-simplify-12 [=>]45.0 | \[ 180 \cdot \frac{\tan^{-1} \left(-0.5 \cdot \frac{\left({B}^{2} + {A}^{2}\right) - {\left(-A\right)}^{2}}{B \cdot C} + \color{blue}{\left(-\frac{A + -1 \cdot A}{B}\right)}\right)}{\pi}
\] |
rational_best-simplify-9 [=>]45.0 | \[ 180 \cdot \frac{\tan^{-1} \left(-0.5 \cdot \frac{\left({B}^{2} + {A}^{2}\right) - {\left(-A\right)}^{2}}{B \cdot C} + \color{blue}{\frac{\frac{A + -1 \cdot A}{B}}{-1}}\right)}{\pi}
\] |
rational_best-simplify-48 [=>]45.0 | \[ 180 \cdot \frac{\tan^{-1} \left(-0.5 \cdot \frac{\left({B}^{2} + {A}^{2}\right) - {\left(-A\right)}^{2}}{B \cdot C} + \color{blue}{\frac{A + -1 \cdot A}{-1 \cdot B}}\right)}{\pi}
\] |
rational_best-simplify-6 [<=]45.0 | \[ 180 \cdot \frac{\tan^{-1} \left(-0.5 \cdot \frac{\left({B}^{2} + {A}^{2}\right) - {\left(-A\right)}^{2}}{B \cdot C} + \frac{\color{blue}{\frac{A}{1}} + -1 \cdot A}{-1 \cdot B}\right)}{\pi}
\] |
rational_best-simplify-2 [=>]45.0 | \[ 180 \cdot \frac{\tan^{-1} \left(-0.5 \cdot \frac{\left({B}^{2} + {A}^{2}\right) - {\left(-A\right)}^{2}}{B \cdot C} + \frac{\frac{A}{1} + \color{blue}{A \cdot -1}}{-1 \cdot B}\right)}{\pi}
\] |
rational_best-simplify-13 [<=]45.0 | \[ 180 \cdot \frac{\tan^{-1} \left(-0.5 \cdot \frac{\left({B}^{2} + {A}^{2}\right) - {\left(-A\right)}^{2}}{B \cdot C} + \frac{\frac{A}{1} + \color{blue}{\left(-A\right)}}{-1 \cdot B}\right)}{\pi}
\] |
rational_best-simplify-26 [=>]45.0 | \[ 180 \cdot \frac{\tan^{-1} \left(-0.5 \cdot \frac{\left({B}^{2} + {A}^{2}\right) - {\left(-A\right)}^{2}}{B \cdot C} + \frac{\color{blue}{\frac{A}{1} \cdot \left(1 - 1\right)}}{-1 \cdot B}\right)}{\pi}
\] |
rational_best-simplify-28 [<=]45.0 | \[ 180 \cdot \frac{\tan^{-1} \left(-0.5 \cdot \frac{\left({B}^{2} + {A}^{2}\right) - {\left(-A\right)}^{2}}{B \cdot C} + \frac{\color{blue}{\frac{A}{1} - A}}{-1 \cdot B}\right)}{\pi}
\] |
rational_best-simplify-6 [=>]45.0 | \[ 180 \cdot \frac{\tan^{-1} \left(-0.5 \cdot \frac{\left({B}^{2} + {A}^{2}\right) - {\left(-A\right)}^{2}}{B \cdot C} + \frac{\color{blue}{A} - A}{-1 \cdot B}\right)}{\pi}
\] |
rational_best-simplify-7 [=>]45.0 | \[ 180 \cdot \frac{\tan^{-1} \left(-0.5 \cdot \frac{\left({B}^{2} + {A}^{2}\right) - {\left(-A\right)}^{2}}{B \cdot C} + \frac{\color{blue}{0}}{-1 \cdot B}\right)}{\pi}
\] |
rational_best-simplify-48 [<=]45.0 | \[ 180 \cdot \frac{\tan^{-1} \left(-0.5 \cdot \frac{\left({B}^{2} + {A}^{2}\right) - {\left(-A\right)}^{2}}{B \cdot C} + \color{blue}{\frac{\frac{0}{B}}{-1}}\right)}{\pi}
\] |
metadata-eval [<=]45.0 | \[ 180 \cdot \frac{\tan^{-1} \left(-0.5 \cdot \frac{\left({B}^{2} + {A}^{2}\right) - {\left(-A\right)}^{2}}{B \cdot C} + \frac{\frac{\color{blue}{0 - 0}}{B}}{-1}\right)}{\pi}
\] |
rational_best-simplify-52 [<=]45.0 | \[ 180 \cdot \frac{\tan^{-1} \left(-0.5 \cdot \frac{\left({B}^{2} + {A}^{2}\right) - {\left(-A\right)}^{2}}{B \cdot C} + \frac{\color{blue}{\frac{0}{B} - \frac{0}{B}}}{-1}\right)}{\pi}
\] |
rational_best-simplify-7 [=>]45.0 | \[ 180 \cdot \frac{\tan^{-1} \left(-0.5 \cdot \frac{\left({B}^{2} + {A}^{2}\right) - {\left(-A\right)}^{2}}{B \cdot C} + \frac{\color{blue}{0}}{-1}\right)}{\pi}
\] |
metadata-eval [=>]45.0 | \[ 180 \cdot \frac{\tan^{-1} \left(-0.5 \cdot \frac{\left({B}^{2} + {A}^{2}\right) - {\left(-A\right)}^{2}}{B \cdot C} + \color{blue}{0}\right)}{\pi}
\] |
Taylor expanded in B around 0 34.3
if 3.99999999999999969e-24 < (*.f64 (/.f64 1 B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))) < 5.0000000000000002e280Initial program 1.8
Applied egg-rr1.8
if 5.0000000000000002e280 < (*.f64 (/.f64 1 B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))) Initial program 36.1
Taylor expanded in B around -inf 38.6
Final simplification23.3
| Alternative 1 | |
|---|---|
| Error | 24.2 |
| Cost | 33616 |
| Alternative 2 | |
|---|---|
| Error | 24.6 |
| Cost | 33096 |
| Alternative 3 | |
|---|---|
| Error | 25.8 |
| Cost | 20556 |
| Alternative 4 | |
|---|---|
| Error | 33.8 |
| Cost | 14040 |
| Alternative 5 | |
|---|---|
| Error | 33.7 |
| Cost | 14040 |
| Alternative 6 | |
|---|---|
| Error | 33.7 |
| Cost | 14040 |
| Alternative 7 | |
|---|---|
| Error | 31.1 |
| Cost | 13972 |
| Alternative 8 | |
|---|---|
| Error | 25.7 |
| Cost | 13836 |
| Alternative 9 | |
|---|---|
| Error | 25.7 |
| Cost | 13836 |
| Alternative 10 | |
|---|---|
| Error | 33.5 |
| Cost | 13712 |
| Alternative 11 | |
|---|---|
| Error | 33.7 |
| Cost | 13448 |
| Alternative 12 | |
|---|---|
| Error | 38.2 |
| Cost | 13188 |
| Alternative 13 | |
|---|---|
| Error | 50.4 |
| Cost | 13056 |
herbie shell --seed 2023096
(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)))