| Alternative 1 | |
|---|---|
| Error | 27.8 |
| Cost | 33756 |
(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))) PI))))
(if (<= B -3e-32)
(* 180.0 (/ (atan (+ -1.0 (+ (+ 1.0 (- 1.0 (/ A B))) (/ C B)))) PI))
(if (<= B -9e-63)
t_1
(if (<= B -2.05e-135)
t_0
(if (<= B -1.25e-198)
t_1
(if (<= B -3.6e-283)
t_0
(if (<= B 6e-270)
t_1
(if (<= B 6.5e-192)
t_0
(if (<= B 7.2e-58)
t_1
(if (<= B 3.3e+60)
(* 180.0 (/ (atan (* 0.5 (/ B A))) PI))
(*
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(((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))) / ((double) M_PI));
double tmp;
if (B <= -3e-32) {
tmp = 180.0 * (atan((-1.0 + ((1.0 + (1.0 - (A / B))) + (C / B)))) / ((double) M_PI));
} else if (B <= -9e-63) {
tmp = t_1;
} else if (B <= -2.05e-135) {
tmp = t_0;
} else if (B <= -1.25e-198) {
tmp = t_1;
} else if (B <= -3.6e-283) {
tmp = t_0;
} else if (B <= 6e-270) {
tmp = t_1;
} else if (B <= 6.5e-192) {
tmp = t_0;
} else if (B <= 7.2e-58) {
tmp = t_1;
} else if (B <= 3.3e+60) {
tmp = 180.0 * (atan((0.5 * (B / A))) / ((double) M_PI));
} 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(((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.PI);
double tmp;
if (B <= -3e-32) {
tmp = 180.0 * (Math.atan((-1.0 + ((1.0 + (1.0 - (A / B))) + (C / B)))) / Math.PI);
} else if (B <= -9e-63) {
tmp = t_1;
} else if (B <= -2.05e-135) {
tmp = t_0;
} else if (B <= -1.25e-198) {
tmp = t_1;
} else if (B <= -3.6e-283) {
tmp = t_0;
} else if (B <= 6e-270) {
tmp = t_1;
} else if (B <= 6.5e-192) {
tmp = t_0;
} else if (B <= 7.2e-58) {
tmp = t_1;
} else if (B <= 3.3e+60) {
tmp = 180.0 * (Math.atan((0.5 * (B / A))) / Math.PI);
} 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(((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.pi) tmp = 0 if B <= -3e-32: tmp = 180.0 * (math.atan((-1.0 + ((1.0 + (1.0 - (A / B))) + (C / B)))) / math.pi) elif B <= -9e-63: tmp = t_1 elif B <= -2.05e-135: tmp = t_0 elif B <= -1.25e-198: tmp = t_1 elif B <= -3.6e-283: tmp = t_0 elif B <= 6e-270: tmp = t_1 elif B <= 6.5e-192: tmp = t_0 elif B <= 7.2e-58: tmp = t_1 elif B <= 3.3e+60: tmp = 180.0 * (math.atan((0.5 * (B / A))) / math.pi) 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(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(B / C))) / pi)) tmp = 0.0 if (B <= -3e-32) tmp = Float64(180.0 * Float64(atan(Float64(-1.0 + Float64(Float64(1.0 + Float64(1.0 - Float64(A / B))) + Float64(C / B)))) / pi)); elseif (B <= -9e-63) tmp = t_1; elseif (B <= -2.05e-135) tmp = t_0; elseif (B <= -1.25e-198) tmp = t_1; elseif (B <= -3.6e-283) tmp = t_0; elseif (B <= 6e-270) tmp = t_1; elseif (B <= 6.5e-192) tmp = t_0; elseif (B <= 7.2e-58) tmp = t_1; elseif (B <= 3.3e+60) tmp = Float64(180.0 * Float64(atan(Float64(0.5 * Float64(B / A))) / pi)); 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(((1.0 / B) * ((C - A) - sqrt((((A - C) ^ 2.0) + (B ^ 2.0)))))) / pi); t_1 = 180.0 * (atan((-0.5 * (B / C))) / pi); tmp = 0.0; if (B <= -3e-32) tmp = 180.0 * (atan((-1.0 + ((1.0 + (1.0 - (A / B))) + (C / B)))) / pi); elseif (B <= -9e-63) tmp = t_1; elseif (B <= -2.05e-135) tmp = t_0; elseif (B <= -1.25e-198) tmp = t_1; elseif (B <= -3.6e-283) tmp = t_0; elseif (B <= 6e-270) tmp = t_1; elseif (B <= 6.5e-192) tmp = t_0; elseif (B <= 7.2e-58) tmp = t_1; elseif (B <= 3.3e+60) tmp = 180.0 * (atan((0.5 * (B / A))) / pi); 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[(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[(B / C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -3e-32], N[(180.0 * N[(N[ArcTan[N[(-1.0 + N[(N[(1.0 + N[(1.0 - N[(A / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(C / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -9e-63], t$95$1, If[LessEqual[B, -2.05e-135], t$95$0, If[LessEqual[B, -1.25e-198], t$95$1, If[LessEqual[B, -3.6e-283], t$95$0, If[LessEqual[B, 6e-270], t$95$1, If[LessEqual[B, 6.5e-192], t$95$0, If[LessEqual[B, 7.2e-58], t$95$1, If[LessEqual[B, 3.3e+60], N[(180.0 * N[(N[ArcTan[N[(0.5 * N[(B / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], 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(\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 \frac{B}{C}\right)}{\pi}\\
\mathbf{if}\;B \leq -3 \cdot 10^{-32}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(-1 + \left(\left(1 + \left(1 - \frac{A}{B}\right)\right) + \frac{C}{B}\right)\right)}{\pi}\\
\mathbf{elif}\;B \leq -9 \cdot 10^{-63}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;B \leq -2.05 \cdot 10^{-135}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;B \leq -1.25 \cdot 10^{-198}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;B \leq -3.6 \cdot 10^{-283}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;B \leq 6 \cdot 10^{-270}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;B \leq 6.5 \cdot 10^{-192}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;B \leq 7.2 \cdot 10^{-58}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;B \leq 3.3 \cdot 10^{+60}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(0.5 \cdot \frac{B}{A}\right)}{\pi}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{C}{B} - \left(1 + \frac{A}{B}\right)\right)}{\pi}\\
\end{array}
Results
if B < -3e-32Initial program 31.5
Taylor expanded in B around -inf 15.2
Applied egg-rr15.2
if -3e-32 < B < -8.9999999999999999e-63 or -2.05000000000000005e-135 < B < -1.25e-198 or -3.6e-283 < B < 6.00000000000000025e-270 or 6.49999999999999966e-192 < B < 7.20000000000000019e-58Initial program 27.0
Taylor expanded in C around inf 53.2
Simplified45.1
[Start]53.2 | \[ 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(-0.5 \cdot \frac{\left({B}^{2} + {A}^{2}\right) - {\left(-1 \cdot A\right)}^{2}}{C} + -1 \cdot \left(A + -1 \cdot A\right)\right)\right)}{\pi}
\] |
|---|---|
exponential.json-simplify-26 [=>]53.2 | \[ 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(-0.5 \cdot \frac{\left({B}^{2} + {A}^{2}\right) - \color{blue}{{-1}^{2} \cdot {A}^{2}}}{C} + -1 \cdot \left(A + -1 \cdot A\right)\right)\right)}{\pi}
\] |
metadata-eval [=>]53.2 | \[ 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(-0.5 \cdot \frac{\left({B}^{2} + {A}^{2}\right) - \color{blue}{1} \cdot {A}^{2}}{C} + -1 \cdot \left(A + -1 \cdot A\right)\right)\right)}{\pi}
\] |
rational.json-simplify-6 [=>]53.2 | \[ 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(-0.5 \cdot \frac{\left({B}^{2} + {A}^{2}\right) - \color{blue}{{A}^{2}}}{C} + -1 \cdot \left(A + -1 \cdot A\right)\right)\right)}{\pi}
\] |
rational.json-simplify-1 [=>]53.2 | \[ 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(-0.5 \cdot \frac{\color{blue}{\left({A}^{2} + {B}^{2}\right)} - {A}^{2}}{C} + -1 \cdot \left(A + -1 \cdot A\right)\right)\right)}{\pi}
\] |
rational.json-simplify-48 [=>]51.3 | \[ 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(-0.5 \cdot \frac{\color{blue}{{B}^{2} + \left({A}^{2} - {A}^{2}\right)}}{C} + -1 \cdot \left(A + -1 \cdot A\right)\right)\right)}{\pi}
\] |
rational.json-simplify-3 [=>]45.1 | \[ 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(-0.5 \cdot \frac{{B}^{2} + \color{blue}{0}}{C} + -1 \cdot \left(A + -1 \cdot A\right)\right)\right)}{\pi}
\] |
rational.json-simplify-4 [=>]45.1 | \[ 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(-0.5 \cdot \frac{\color{blue}{{B}^{2}}}{C} + -1 \cdot \left(A + -1 \cdot A\right)\right)\right)}{\pi}
\] |
rational.json-simplify-2 [=>]45.1 | \[ 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(-0.5 \cdot \frac{{B}^{2}}{C} + \color{blue}{\left(A + -1 \cdot A\right) \cdot -1}\right)\right)}{\pi}
\] |
rational.json-simplify-9 [=>]45.1 | \[ 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(-0.5 \cdot \frac{{B}^{2}}{C} + \color{blue}{\left(-\left(A + -1 \cdot A\right)\right)}\right)\right)}{\pi}
\] |
rational.json-simplify-2 [=>]45.1 | \[ 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(-0.5 \cdot \frac{{B}^{2}}{C} + \left(-\left(A + \color{blue}{A \cdot -1}\right)\right)\right)\right)}{\pi}
\] |
rational.json-simplify-8 [<=]45.1 | \[ 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(-0.5 \cdot \frac{{B}^{2}}{C} + \left(-\left(A + \color{blue}{\left(-A\right)}\right)\right)\right)\right)}{\pi}
\] |
rational.json-simplify-10 [=>]45.1 | \[ 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(-0.5 \cdot \frac{{B}^{2}}{C} + \left(-\left(A + \color{blue}{\frac{A}{-1}}\right)\right)\right)\right)}{\pi}
\] |
rational.json-simplify-31 [=>]45.1 | \[ 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(-0.5 \cdot \frac{{B}^{2}}{C} + \left(-\color{blue}{\left(-1 + 1\right) \cdot \frac{A}{-1}}\right)\right)\right)}{\pi}
\] |
metadata-eval [=>]45.1 | \[ 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(-0.5 \cdot \frac{{B}^{2}}{C} + \left(-\color{blue}{0} \cdot \frac{A}{-1}\right)\right)\right)}{\pi}
\] |
rational.json-simplify-10 [<=]45.1 | \[ 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(-0.5 \cdot \frac{{B}^{2}}{C} + \left(-0 \cdot \color{blue}{\left(-A\right)}\right)\right)\right)}{\pi}
\] |
rational.json-simplify-8 [=>]45.1 | \[ 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(-0.5 \cdot \frac{{B}^{2}}{C} + \left(-0 \cdot \color{blue}{\left(A \cdot -1\right)}\right)\right)\right)}{\pi}
\] |
rational.json-simplify-2 [<=]45.1 | \[ 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(-0.5 \cdot \frac{{B}^{2}}{C} + \left(-0 \cdot \color{blue}{\left(-1 \cdot A\right)}\right)\right)\right)}{\pi}
\] |
rational.json-simplify-2 [=>]45.1 | \[ 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(-0.5 \cdot \frac{{B}^{2}}{C} + \left(-\color{blue}{\left(-1 \cdot A\right) \cdot 0}\right)\right)\right)}{\pi}
\] |
rational.json-simplify-14 [=>]45.1 | \[ 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(-0.5 \cdot \frac{{B}^{2}}{C} + \left(-\color{blue}{0}\right)\right)\right)}{\pi}
\] |
metadata-eval [=>]45.1 | \[ 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(-0.5 \cdot \frac{{B}^{2}}{C} + \color{blue}{0}\right)\right)}{\pi}
\] |
Taylor expanded in B around 0 44.6
if -8.9999999999999999e-63 < B < -2.05000000000000005e-135 or -1.25e-198 < B < -3.6e-283 or 6.00000000000000025e-270 < B < 6.49999999999999966e-192Initial program 25.5
if 7.20000000000000019e-58 < B < 3.2999999999999998e60Initial program 22.0
Taylor expanded in A around -inf 46.2
if 3.2999999999999998e60 < B Initial program 36.4
Taylor expanded in B around inf 12.1
Final simplification26.4
| Alternative 1 | |
|---|---|
| Error | 27.8 |
| Cost | 33756 |
| Alternative 2 | |
|---|---|
| Error | 27.6 |
| Cost | 14756 |
| Alternative 3 | |
|---|---|
| Error | 27.8 |
| Cost | 14756 |
| Alternative 4 | |
|---|---|
| Error | 30.6 |
| Cost | 14500 |
| Alternative 5 | |
|---|---|
| Error | 27.7 |
| Cost | 14500 |
| Alternative 6 | |
|---|---|
| Error | 34.9 |
| Cost | 14236 |
| Alternative 7 | |
|---|---|
| Error | 32.9 |
| Cost | 14236 |
| Alternative 8 | |
|---|---|
| Error | 34.5 |
| Cost | 13972 |
| Alternative 9 | |
|---|---|
| Error | 34.5 |
| Cost | 13908 |
| Alternative 10 | |
|---|---|
| Error | 35.0 |
| Cost | 13840 |
| Alternative 11 | |
|---|---|
| Error | 34.8 |
| Cost | 13712 |
| Alternative 12 | |
|---|---|
| Error | 34.7 |
| Cost | 13448 |
| Alternative 13 | |
|---|---|
| Error | 38.1 |
| Cost | 13188 |
| Alternative 14 | |
|---|---|
| Error | 50.9 |
| Cost | 13056 |
herbie shell --seed 2023073
(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)))