| Alternative 1 | |
|---|---|
| Error | 31.6 |
| Cost | 14896 |
(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
(* (/ 1.0 B) (- (- C A) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))))
(if (<= t_0 -0.5)
(* (atan (/ (- (- C B) A) B)) (/ 180.0 PI))
(if (<= t_0 1e-6)
(* (atan (* 0.5 (/ B A))) (/ 180.0 PI))
(* 180.0 (/ (atan (/ (- (+ C B) 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 = (1.0 / B) * ((C - A) - sqrt((pow((A - C), 2.0) + pow(B, 2.0))));
double tmp;
if (t_0 <= -0.5) {
tmp = atan((((C - B) - A) / B)) * (180.0 / ((double) M_PI));
} else if (t_0 <= 1e-6) {
tmp = atan((0.5 * (B / A))) * (180.0 / ((double) M_PI));
} else {
tmp = 180.0 * (atan((((C + B) - 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 = (1.0 / B) * ((C - A) - Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B, 2.0))));
double tmp;
if (t_0 <= -0.5) {
tmp = Math.atan((((C - B) - A) / B)) * (180.0 / Math.PI);
} else if (t_0 <= 1e-6) {
tmp = Math.atan((0.5 * (B / A))) * (180.0 / Math.PI);
} else {
tmp = 180.0 * (Math.atan((((C + B) - 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 = (1.0 / B) * ((C - A) - math.sqrt((math.pow((A - C), 2.0) + math.pow(B, 2.0)))) tmp = 0 if t_0 <= -0.5: tmp = math.atan((((C - B) - A) / B)) * (180.0 / math.pi) elif t_0 <= 1e-6: tmp = math.atan((0.5 * (B / A))) * (180.0 / math.pi) else: tmp = 180.0 * (math.atan((((C + B) - 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(Float64(1.0 / B) * Float64(Float64(C - A) - sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0))))) tmp = 0.0 if (t_0 <= -0.5) tmp = Float64(atan(Float64(Float64(Float64(C - B) - A) / B)) * Float64(180.0 / pi)); elseif (t_0 <= 1e-6) tmp = Float64(atan(Float64(0.5 * Float64(B / A))) * Float64(180.0 / pi)); else tmp = Float64(180.0 * Float64(atan(Float64(Float64(Float64(C + B) - 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 = (1.0 / B) * ((C - A) - sqrt((((A - C) ^ 2.0) + (B ^ 2.0)))); tmp = 0.0; if (t_0 <= -0.5) tmp = atan((((C - B) - A) / B)) * (180.0 / pi); elseif (t_0 <= 1e-6) tmp = atan((0.5 * (B / A))) * (180.0 / pi); else tmp = 180.0 * (atan((((C + B) - 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[(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]}, If[LessEqual[t$95$0, -0.5], N[(N[ArcTan[N[(N[(N[(C - B), $MachinePrecision] - A), $MachinePrecision] / B), $MachinePrecision]], $MachinePrecision] * N[(180.0 / Pi), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1e-6], N[(N[ArcTan[N[(0.5 * N[(B / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(180.0 / Pi), $MachinePrecision]), $MachinePrecision], N[(180.0 * N[(N[ArcTan[N[(N[(N[(C + B), $MachinePrecision] - A), $MachinePrecision] / B), $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 := \frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\\
\mathbf{if}\;t_0 \leq -0.5:\\
\;\;\;\;\tan^{-1} \left(\frac{\left(C - B\right) - A}{B}\right) \cdot \frac{180}{\pi}\\
\mathbf{elif}\;t_0 \leq 10^{-6}:\\
\;\;\;\;\tan^{-1} \left(0.5 \cdot \frac{B}{A}\right) \cdot \frac{180}{\pi}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{\left(C + B\right) - A}{B}\right)}{\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))))) < -0.5Initial program 26.6
Simplified26.6
[Start]26.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_best-simplify-55 [=>]26.6 | \[ \color{blue}{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right) \cdot \frac{180}{\pi}}
\] |
rational_best-simplify-1 [=>]26.6 | \[ \tan^{-1} \color{blue}{\left(\left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right) \cdot \frac{1}{B}\right)} \cdot \frac{180}{\pi}
\] |
rational_best-simplify-55 [=>]26.6 | \[ \tan^{-1} \color{blue}{\left(1 \cdot \frac{\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}{B}\right)} \cdot \frac{180}{\pi}
\] |
rational_best-simplify-1 [=>]26.6 | \[ \tan^{-1} \color{blue}{\left(\frac{\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}{B} \cdot 1\right)} \cdot \frac{180}{\pi}
\] |
rational_best-simplify-7 [=>]26.6 | \[ \tan^{-1} \color{blue}{\left(\frac{\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}{B}\right)} \cdot \frac{180}{\pi}
\] |
Taylor expanded in B around inf 16.1
Simplified16.1
[Start]16.1 | \[ \tan^{-1} \left(\frac{\left(C + -1 \cdot B\right) - A}{B}\right) \cdot \frac{180}{\pi}
\] |
|---|---|
rational_best-simplify-59 [=>]16.1 | \[ \tan^{-1} \left(\frac{\color{blue}{\left(-1 \cdot B - \left(-C\right)\right)} - A}{B}\right) \cdot \frac{180}{\pi}
\] |
rational_best-simplify-14 [=>]16.1 | \[ \tan^{-1} \left(\frac{\left(-1 \cdot B - \color{blue}{\left(0 - C\right)}\right) - A}{B}\right) \cdot \frac{180}{\pi}
\] |
rational_best-simplify-51 [=>]16.1 | \[ \tan^{-1} \left(\frac{\color{blue}{\left(C - \left(0 - -1 \cdot B\right)\right)} - A}{B}\right) \cdot \frac{180}{\pi}
\] |
metadata-eval [<=]16.1 | \[ \tan^{-1} \left(\frac{\left(C - \left(\color{blue}{\frac{0}{-1}} - -1 \cdot B\right)\right) - A}{B}\right) \cdot \frac{180}{\pi}
\] |
rational_best-simplify-37 [=>]16.1 | \[ \tan^{-1} \left(\frac{\left(C - \color{blue}{\frac{B}{\frac{-1}{-1}}}\right) - A}{B}\right) \cdot \frac{180}{\pi}
\] |
metadata-eval [=>]16.1 | \[ \tan^{-1} \left(\frac{\left(C - \frac{B}{\color{blue}{1}}\right) - A}{B}\right) \cdot \frac{180}{\pi}
\] |
rational_best-simplify-8 [=>]16.1 | \[ \tan^{-1} \left(\frac{\left(C - \color{blue}{B}\right) - A}{B}\right) \cdot \frac{180}{\pi}
\] |
if -0.5 < (*.f64 (/.f64 1 B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))) < 9.99999999999999955e-7Initial program 51.4
Simplified51.4
[Start]51.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_best-simplify-55 [=>]51.4 | \[ \color{blue}{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right) \cdot \frac{180}{\pi}}
\] |
rational_best-simplify-1 [=>]51.4 | \[ \tan^{-1} \color{blue}{\left(\left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right) \cdot \frac{1}{B}\right)} \cdot \frac{180}{\pi}
\] |
rational_best-simplify-55 [=>]51.4 | \[ \tan^{-1} \color{blue}{\left(1 \cdot \frac{\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}{B}\right)} \cdot \frac{180}{\pi}
\] |
rational_best-simplify-1 [=>]51.4 | \[ \tan^{-1} \color{blue}{\left(\frac{\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}{B} \cdot 1\right)} \cdot \frac{180}{\pi}
\] |
rational_best-simplify-7 [=>]51.4 | \[ \tan^{-1} \color{blue}{\left(\frac{\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}{B}\right)} \cdot \frac{180}{\pi}
\] |
Taylor expanded in A around -inf 31.1
if 9.99999999999999955e-7 < (*.f64 (/.f64 1 B) (-.f64 (-.f64 C A) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))) Initial program 25.6
Simplified25.6
[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_best-simplify-55 [=>]25.6 | \[ \color{blue}{\tan^{-1} \left(\frac{1}{B} \cdot \left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)\right) \cdot \frac{180}{\pi}}
\] |
rational_best-simplify-1 [=>]25.6 | \[ \tan^{-1} \color{blue}{\left(\left(\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right) \cdot \frac{1}{B}\right)} \cdot \frac{180}{\pi}
\] |
rational_best-simplify-55 [=>]25.6 | \[ \tan^{-1} \color{blue}{\left(1 \cdot \frac{\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}{B}\right)} \cdot \frac{180}{\pi}
\] |
rational_best-simplify-1 [=>]25.6 | \[ \tan^{-1} \color{blue}{\left(\frac{\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}{B} \cdot 1\right)} \cdot \frac{180}{\pi}
\] |
rational_best-simplify-7 [=>]25.6 | \[ \tan^{-1} \color{blue}{\left(\frac{\left(C - A\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}{B}\right)} \cdot \frac{180}{\pi}
\] |
rational_best-simplify-52 [=>]25.6 | \[ \tan^{-1} \left(\frac{\color{blue}{C - \left(\sqrt{{\left(A - C\right)}^{2} + {B}^{2}} + A\right)}}{B}\right) \cdot \frac{180}{\pi}
\] |
rational_best-simplify-3 [=>]25.6 | \[ \tan^{-1} \left(\frac{C - \color{blue}{\left(A + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{B}\right) \cdot \frac{180}{\pi}
\] |
Taylor expanded in B around -inf 14.7
Taylor expanded in C around 0 14.7
Final simplification17.5
| Alternative 1 | |
|---|---|
| Error | 31.6 |
| Cost | 14896 |
| Alternative 2 | |
|---|---|
| Error | 31.5 |
| Cost | 14896 |
| Alternative 3 | |
|---|---|
| Error | 33.9 |
| Cost | 14764 |
| Alternative 4 | |
|---|---|
| Error | 27.8 |
| Cost | 14236 |
| Alternative 5 | |
|---|---|
| Error | 27.9 |
| Cost | 14236 |
| Alternative 6 | |
|---|---|
| Error | 26.0 |
| Cost | 14232 |
| Alternative 7 | |
|---|---|
| Error | 26.0 |
| Cost | 14232 |
| Alternative 8 | |
|---|---|
| Error | 34.8 |
| Cost | 14040 |
| Alternative 9 | |
|---|---|
| Error | 34.1 |
| Cost | 14040 |
| Alternative 10 | |
|---|---|
| Error | 34.9 |
| Cost | 13844 |
| Alternative 11 | |
|---|---|
| Error | 25.8 |
| Cost | 13708 |
| Alternative 12 | |
|---|---|
| Error | 35.5 |
| Cost | 13448 |
| Alternative 13 | |
|---|---|
| Error | 38.4 |
| Cost | 13188 |
| Alternative 14 | |
|---|---|
| Error | 50.8 |
| Cost | 13056 |
herbie shell --seed 2023100
(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)))