| Alternative 1 | |
|---|---|
| Error | 21.1 |
| Cost | 33680 |
(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 B) (pow A 2.0))) (* 0.5 (/ B A)))) PI)))
(t_1
(*
180.0
(/
(atan
(* (/ 1.0 B) (- C (+ A (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))))
PI))))
(if (<= B -1.35e+154)
(* 180.0 (/ (atan (- (+ 1.0 (/ C B)) (/ A B))) PI))
(if (<= B -2e-252)
t_1
(if (<= B 3.2e-264)
(* 180.0 (/ (atan (* (/ 1.0 B) 0.0)) PI))
(if (<= B 3.15e-208)
t_1
(if (<= B 6.4e-187)
t_0
(if (<= B 6.5e-95)
t_1
(if (<= B 740000000.0)
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 * B) / pow(A, 2.0))) + (0.5 * (B / A)))) / ((double) M_PI));
double t_1 = 180.0 * (atan(((1.0 / B) * (C - (A + sqrt((pow((A - C), 2.0) + pow(B, 2.0))))))) / ((double) M_PI));
double tmp;
if (B <= -1.35e+154) {
tmp = 180.0 * (atan(((1.0 + (C / B)) - (A / B))) / ((double) M_PI));
} else if (B <= -2e-252) {
tmp = t_1;
} else if (B <= 3.2e-264) {
tmp = 180.0 * (atan(((1.0 / B) * 0.0)) / ((double) M_PI));
} else if (B <= 3.15e-208) {
tmp = t_1;
} else if (B <= 6.4e-187) {
tmp = t_0;
} else if (B <= 6.5e-95) {
tmp = t_1;
} else if (B <= 740000000.0) {
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 * B) / Math.pow(A, 2.0))) + (0.5 * (B / A)))) / Math.PI);
double t_1 = 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 tmp;
if (B <= -1.35e+154) {
tmp = 180.0 * (Math.atan(((1.0 + (C / B)) - (A / B))) / Math.PI);
} else if (B <= -2e-252) {
tmp = t_1;
} else if (B <= 3.2e-264) {
tmp = 180.0 * (Math.atan(((1.0 / B) * 0.0)) / Math.PI);
} else if (B <= 3.15e-208) {
tmp = t_1;
} else if (B <= 6.4e-187) {
tmp = t_0;
} else if (B <= 6.5e-95) {
tmp = t_1;
} else if (B <= 740000000.0) {
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 * B) / math.pow(A, 2.0))) + (0.5 * (B / A)))) / math.pi) t_1 = 180.0 * (math.atan(((1.0 / B) * (C - (A + math.sqrt((math.pow((A - C), 2.0) + math.pow(B, 2.0))))))) / math.pi) tmp = 0 if B <= -1.35e+154: tmp = 180.0 * (math.atan(((1.0 + (C / B)) - (A / B))) / math.pi) elif B <= -2e-252: tmp = t_1 elif B <= 3.2e-264: tmp = 180.0 * (math.atan(((1.0 / B) * 0.0)) / math.pi) elif B <= 3.15e-208: tmp = t_1 elif B <= 6.4e-187: tmp = t_0 elif B <= 6.5e-95: tmp = t_1 elif B <= 740000000.0: 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(Float64(0.5 * Float64(Float64(C * B) / (A ^ 2.0))) + Float64(0.5 * Float64(B / A)))) / pi)) t_1 = Float64(180.0 * Float64(atan(Float64(Float64(1.0 / B) * Float64(C - Float64(A + sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0))))))) / pi)) tmp = 0.0 if (B <= -1.35e+154) tmp = Float64(180.0 * Float64(atan(Float64(Float64(1.0 + Float64(C / B)) - Float64(A / B))) / pi)); elseif (B <= -2e-252) tmp = t_1; elseif (B <= 3.2e-264) tmp = Float64(180.0 * Float64(atan(Float64(Float64(1.0 / B) * 0.0)) / pi)); elseif (B <= 3.15e-208) tmp = t_1; elseif (B <= 6.4e-187) tmp = t_0; elseif (B <= 6.5e-95) tmp = t_1; elseif (B <= 740000000.0) 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 * B) / (A ^ 2.0))) + (0.5 * (B / A)))) / pi); t_1 = 180.0 * (atan(((1.0 / B) * (C - (A + sqrt((((A - C) ^ 2.0) + (B ^ 2.0))))))) / pi); tmp = 0.0; if (B <= -1.35e+154) tmp = 180.0 * (atan(((1.0 + (C / B)) - (A / B))) / pi); elseif (B <= -2e-252) tmp = t_1; elseif (B <= 3.2e-264) tmp = 180.0 * (atan(((1.0 / B) * 0.0)) / pi); elseif (B <= 3.15e-208) tmp = t_1; elseif (B <= 6.4e-187) tmp = t_0; elseif (B <= 6.5e-95) tmp = t_1; elseif (B <= 740000000.0) 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[(N[(0.5 * N[(N[(C * B), $MachinePrecision] / N[Power[A, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(B / A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(180.0 * N[(N[ArcTan[N[(N[(1.0 / B), $MachinePrecision] * N[(C - N[(A + N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -1.35e+154], 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, -2e-252], t$95$1, If[LessEqual[B, 3.2e-264], N[(180.0 * N[(N[ArcTan[N[(N[(1.0 / B), $MachinePrecision] * 0.0), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 3.15e-208], t$95$1, If[LessEqual[B, 6.4e-187], t$95$0, If[LessEqual[B, 6.5e-95], t$95$1, If[LessEqual[B, 740000000.0], 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 \frac{C \cdot B}{{A}^{2}} + 0.5 \cdot \frac{B}{A}\right)}{\pi}\\
t_1 := 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(C - \left(A + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)\right)}{\pi}\\
\mathbf{if}\;B \leq -1.35 \cdot 10^{+154}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\left(1 + \frac{C}{B}\right) - \frac{A}{B}\right)}{\pi}\\
\mathbf{elif}\;B \leq -2 \cdot 10^{-252}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;B \leq 3.2 \cdot 10^{-264}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot 0\right)}{\pi}\\
\mathbf{elif}\;B \leq 3.15 \cdot 10^{-208}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;B \leq 6.4 \cdot 10^{-187}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;B \leq 6.5 \cdot 10^{-95}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;B \leq 740000000:\\
\;\;\;\;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 < -1.35000000000000003e154Initial program 46.9
Simplified46.9
[Start]46.9 | \[ 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}
\] |
|---|---|
rational.json-simplify-32 [=>]46.9 | \[ 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \color{blue}{\left(\left(C - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right) - A\right)}\right)}{\pi}
\] |
rational.json-simplify-39 [<=]46.9 | \[ 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \color{blue}{\left(C - \left(A + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}\right)}{\pi}
\] |
Taylor expanded in B around -inf 8.6
if -1.35000000000000003e154 < B < -1.99999999999999989e-252 or 3.19999999999999995e-264 < B < 3.14999999999999996e-208 or 6.3999999999999997e-187 < B < 6.49999999999999985e-95Initial program 24.9
Simplified25.6
[Start]24.9 | \[ 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}
\] |
|---|---|
rational.json-simplify-32 [=>]25.5 | \[ 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \color{blue}{\left(\left(C - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right) - A\right)}\right)}{\pi}
\] |
rational.json-simplify-39 [<=]25.6 | \[ 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \color{blue}{\left(C - \left(A + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}\right)}{\pi}
\] |
if -1.99999999999999989e-252 < B < 3.19999999999999995e-264Initial program 21.2
Simplified25.2
[Start]21.2 | \[ 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}
\] |
|---|---|
rational.json-simplify-32 [=>]25.5 | \[ 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \color{blue}{\left(\left(C - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right) - A\right)}\right)}{\pi}
\] |
rational.json-simplify-39 [<=]25.2 | \[ 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \color{blue}{\left(C - \left(A + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}\right)}{\pi}
\] |
Taylor expanded in C around inf 41.2
Simplified41.2
[Start]41.2 | \[ 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(-1 \cdot \left(A + -1 \cdot A\right)\right)\right)}{\pi}
\] |
|---|---|
rational.json-simplify-2 [=>]41.2 | \[ 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(-1 \cdot \left(A + \color{blue}{A \cdot -1}\right)\right)\right)}{\pi}
\] |
rational.json-simplify-19 [=>]41.2 | \[ 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(-1 \cdot \color{blue}{\left(A \cdot \left(1 + -1\right)\right)}\right)\right)}{\pi}
\] |
metadata-eval [=>]41.2 | \[ 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(-1 \cdot \left(A \cdot \color{blue}{0}\right)\right)\right)}{\pi}
\] |
rational.json-simplify-2 [=>]41.2 | \[ 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(-1 \cdot \color{blue}{\left(0 \cdot A\right)}\right)\right)}{\pi}
\] |
rational.json-simplify-11 [=>]41.2 | \[ 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \left(-1 \cdot \color{blue}{0}\right)\right)}{\pi}
\] |
metadata-eval [=>]41.2 | \[ 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \color{blue}{0}\right)}{\pi}
\] |
if 3.14999999999999996e-208 < B < 6.3999999999999997e-187 or 6.49999999999999985e-95 < B < 7.4e8Initial program 25.6
Simplified25.9
[Start]25.6 | \[ 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}
\] |
|---|---|
rational.json-simplify-32 [=>]25.9 | \[ 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \color{blue}{\left(\left(C - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right) - A\right)}\right)}{\pi}
\] |
rational.json-simplify-39 [<=]25.9 | \[ 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \color{blue}{\left(C - \left(A + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}\right)}{\pi}
\] |
Taylor expanded in A around -inf 38.5
if 7.4e8 < B Initial program 33.4
Simplified33.4
[Start]33.4 | \[ 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}
\] |
|---|---|
rational.json-simplify-32 [=>]33.4 | \[ 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \color{blue}{\left(\left(C - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right) - A\right)}\right)}{\pi}
\] |
rational.json-simplify-39 [<=]33.4 | \[ 180 \cdot \frac{\tan^{-1} \left(\frac{1}{B} \cdot \color{blue}{\left(C - \left(A + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right)}\right)}{\pi}
\] |
Taylor expanded in B around inf 13.2
Final simplification22.9
| Alternative 1 | |
|---|---|
| Error | 21.1 |
| Cost | 33680 |
| Alternative 2 | |
|---|---|
| Error | 24.5 |
| Cost | 33292 |
| Alternative 3 | |
|---|---|
| Error | 23.9 |
| Cost | 20816 |
| Alternative 4 | |
|---|---|
| Error | 24.3 |
| Cost | 20564 |
| Alternative 5 | |
|---|---|
| Error | 33.7 |
| Cost | 14500 |
| Alternative 6 | |
|---|---|
| Error | 33.7 |
| Cost | 14500 |
| Alternative 7 | |
|---|---|
| Error | 25.1 |
| Cost | 14360 |
| Alternative 8 | |
|---|---|
| Error | 25.7 |
| Cost | 14168 |
| Alternative 9 | |
|---|---|
| Error | 27.5 |
| Cost | 14104 |
| Alternative 10 | |
|---|---|
| Error | 25.8 |
| Cost | 14104 |
| Alternative 11 | |
|---|---|
| Error | 25.2 |
| Cost | 14096 |
| Alternative 12 | |
|---|---|
| Error | 28.5 |
| Cost | 13840 |
| Alternative 13 | |
|---|---|
| Error | 34.0 |
| Cost | 13448 |
| Alternative 14 | |
|---|---|
| Error | 38.1 |
| Cost | 13188 |
| Alternative 15 | |
|---|---|
| Error | 50.1 |
| Cost | 13056 |
herbie shell --seed 2023053
(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)))