| Alternative 1 | |
|---|---|
| Accuracy | 68.2% |
| Cost | 39360 |
\[\begin{array}{l}
t_0 := angle \cdot \frac{\pi}{180}\\
{\left(a \cdot \sin t_0\right)}^{2} + {\left(b \cdot \cos t_0\right)}^{2}
\end{array}
\]
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (* (/ angle 180.0) PI))) 2.0) (pow (* b (cos (* (/ angle 180.0) PI))) 2.0)))
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (/ angle (/ 180.0 PI)))) 2.0) (pow (* b (log1p (expm1 (cos (* angle (* PI 0.005555555555555556)))))) 2.0)))
double code(double a, double b, double angle) {
return pow((a * sin(((angle / 180.0) * ((double) M_PI)))), 2.0) + pow((b * cos(((angle / 180.0) * ((double) M_PI)))), 2.0);
}
double code(double a, double b, double angle) {
return pow((a * sin((angle / (180.0 / ((double) M_PI))))), 2.0) + pow((b * log1p(expm1(cos((angle * (((double) M_PI) * 0.005555555555555556)))))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.sin(((angle / 180.0) * Math.PI))), 2.0) + Math.pow((b * Math.cos(((angle / 180.0) * Math.PI))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.sin((angle / (180.0 / Math.PI)))), 2.0) + Math.pow((b * Math.log1p(Math.expm1(Math.cos((angle * (Math.PI * 0.005555555555555556)))))), 2.0);
}
def code(a, b, angle): return math.pow((a * math.sin(((angle / 180.0) * math.pi))), 2.0) + math.pow((b * math.cos(((angle / 180.0) * math.pi))), 2.0)
def code(a, b, angle): return math.pow((a * math.sin((angle / (180.0 / math.pi)))), 2.0) + math.pow((b * math.log1p(math.expm1(math.cos((angle * (math.pi * 0.005555555555555556)))))), 2.0)
function code(a, b, angle) return Float64((Float64(a * sin(Float64(Float64(angle / 180.0) * pi))) ^ 2.0) + (Float64(b * cos(Float64(Float64(angle / 180.0) * pi))) ^ 2.0)) end
function code(a, b, angle) return Float64((Float64(a * sin(Float64(angle / Float64(180.0 / pi)))) ^ 2.0) + (Float64(b * log1p(expm1(cos(Float64(angle * Float64(pi * 0.005555555555555556)))))) ^ 2.0)) end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Sin[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Sin[N[(angle / N[(180.0 / Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Log[1 + N[(Exp[N[Cos[N[(angle * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}
{\left(a \cdot \sin \left(\frac{angle}{\frac{180}{\pi}}\right)\right)}^{2} + {\left(b \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\cos \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)\right)\right)}^{2}
Results
Initial program 68.1%
Simplified68.1%
[Start]68.1 | \[ {\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}
\] |
|---|---|
associate-/r/ [<=]68.1 | \[ {\left(a \cdot \sin \color{blue}{\left(\frac{angle}{\frac{180}{\pi}}\right)}\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}
\] |
associate-/r/ [<=]68.1 | \[ {\left(a \cdot \sin \left(\frac{angle}{\frac{180}{\pi}}\right)\right)}^{2} + {\left(b \cdot \cos \color{blue}{\left(\frac{angle}{\frac{180}{\pi}}\right)}\right)}^{2}
\] |
Applied egg-rr68.1%
Final simplification68.1%
| Alternative 1 | |
|---|---|
| Accuracy | 68.2% |
| Cost | 39360 |
| Alternative 2 | |
|---|---|
| Accuracy | 68.1% |
| Cost | 26240 |
| Alternative 3 | |
|---|---|
| Accuracy | 68.0% |
| Cost | 26240 |
| Alternative 4 | |
|---|---|
| Accuracy | 67.5% |
| Cost | 20680 |
| Alternative 5 | |
|---|---|
| Accuracy | 67.7% |
| Cost | 20425 |
| Alternative 6 | |
|---|---|
| Accuracy | 59.2% |
| Cost | 19840 |
| Alternative 7 | |
|---|---|
| Accuracy | 59.3% |
| Cost | 19840 |
| Alternative 8 | |
|---|---|
| Accuracy | 59.3% |
| Cost | 19840 |
| Alternative 9 | |
|---|---|
| Accuracy | 59.4% |
| Cost | 19840 |
herbie shell --seed 2023129
(FPCore (a b angle)
:name "ab-angle->ABCF A"
:precision binary64
(+ (pow (* a (sin (* (/ angle 180.0) PI))) 2.0) (pow (* b (cos (* (/ angle 180.0) PI))) 2.0)))