
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* PI (/ angle 180.0)))) (+ (pow (* a (cos t_0)) 2.0) (pow (* b (sin t_0)) 2.0))))
double code(double a, double b, double angle) {
double t_0 = ((double) M_PI) * (angle / 180.0);
return pow((a * cos(t_0)), 2.0) + pow((b * sin(t_0)), 2.0);
}
public static double code(double a, double b, double angle) {
double t_0 = Math.PI * (angle / 180.0);
return Math.pow((a * Math.cos(t_0)), 2.0) + Math.pow((b * Math.sin(t_0)), 2.0);
}
def code(a, b, angle): t_0 = math.pi * (angle / 180.0) return math.pow((a * math.cos(t_0)), 2.0) + math.pow((b * math.sin(t_0)), 2.0)
function code(a, b, angle) t_0 = Float64(pi * Float64(angle / 180.0)) return Float64((Float64(a * cos(t_0)) ^ 2.0) + (Float64(b * sin(t_0)) ^ 2.0)) end
function tmp = code(a, b, angle) t_0 = pi * (angle / 180.0); tmp = ((a * cos(t_0)) ^ 2.0) + ((b * sin(t_0)) ^ 2.0); end
code[a_, b_, angle_] := Block[{t$95$0 = N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]}, N[(N[Power[N[(a * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \pi \cdot \frac{angle}{180}\\
{\left(a \cdot \cos t\_0\right)}^{2} + {\left(b \cdot \sin t\_0\right)}^{2}
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* PI (/ angle 180.0)))) (+ (pow (* a (cos t_0)) 2.0) (pow (* b (sin t_0)) 2.0))))
double code(double a, double b, double angle) {
double t_0 = ((double) M_PI) * (angle / 180.0);
return pow((a * cos(t_0)), 2.0) + pow((b * sin(t_0)), 2.0);
}
public static double code(double a, double b, double angle) {
double t_0 = Math.PI * (angle / 180.0);
return Math.pow((a * Math.cos(t_0)), 2.0) + Math.pow((b * Math.sin(t_0)), 2.0);
}
def code(a, b, angle): t_0 = math.pi * (angle / 180.0) return math.pow((a * math.cos(t_0)), 2.0) + math.pow((b * math.sin(t_0)), 2.0)
function code(a, b, angle) t_0 = Float64(pi * Float64(angle / 180.0)) return Float64((Float64(a * cos(t_0)) ^ 2.0) + (Float64(b * sin(t_0)) ^ 2.0)) end
function tmp = code(a, b, angle) t_0 = pi * (angle / 180.0); tmp = ((a * cos(t_0)) ^ 2.0) + ((b * sin(t_0)) ^ 2.0); end
code[a_, b_, angle_] := Block[{t$95$0 = N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]}, N[(N[Power[N[(a * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \pi \cdot \frac{angle}{180}\\
{\left(a \cdot \cos t\_0\right)}^{2} + {\left(b \cdot \sin t\_0\right)}^{2}
\end{array}
\end{array}
(FPCore (a b angle) :precision binary64 (+ (* a (* a (+ 0.5 (* 0.5 (cos (* 2.0 (* angle (* PI 0.005555555555555556)))))))) (pow (* b (sin (* PI (* angle 0.005555555555555556)))) 2.0)))
double code(double a, double b, double angle) {
return (a * (a * (0.5 + (0.5 * cos((2.0 * (angle * (((double) M_PI) * 0.005555555555555556)))))))) + pow((b * sin((((double) M_PI) * (angle * 0.005555555555555556)))), 2.0);
}
public static double code(double a, double b, double angle) {
return (a * (a * (0.5 + (0.5 * Math.cos((2.0 * (angle * (Math.PI * 0.005555555555555556)))))))) + Math.pow((b * Math.sin((Math.PI * (angle * 0.005555555555555556)))), 2.0);
}
def code(a, b, angle): return (a * (a * (0.5 + (0.5 * math.cos((2.0 * (angle * (math.pi * 0.005555555555555556)))))))) + math.pow((b * math.sin((math.pi * (angle * 0.005555555555555556)))), 2.0)
function code(a, b, angle) return Float64(Float64(a * Float64(a * Float64(0.5 + Float64(0.5 * cos(Float64(2.0 * Float64(angle * Float64(pi * 0.005555555555555556)))))))) + (Float64(b * sin(Float64(pi * Float64(angle * 0.005555555555555556)))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = (a * (a * (0.5 + (0.5 * cos((2.0 * (angle * (pi * 0.005555555555555556)))))))) + ((b * sin((pi * (angle * 0.005555555555555556)))) ^ 2.0); end
code[a_, b_, angle_] := N[(N[(a * N[(a * N[(0.5 + N[(0.5 * N[Cos[N[(2.0 * N[(angle * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Power[N[(b * N[Sin[N[(Pi * N[(angle * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
a \cdot \left(a \cdot \left(0.5 + 0.5 \cdot \cos \left(2 \cdot \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)\right)\right) + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2}
\end{array}
Initial program 78.3%
Simplified78.3%
metadata-eval78.3%
div-inv78.3%
add-cube-cbrt77.7%
pow377.7%
*-commutative77.7%
*-commutative77.7%
div-inv77.7%
metadata-eval77.7%
associate-*l*77.7%
Applied egg-rr77.7%
unpow377.7%
add-cube-cbrt78.3%
*-commutative78.3%
unpow-prod-down78.3%
unpow278.3%
associate-*r*78.3%
*-commutative78.3%
associate-*l*78.3%
*-commutative78.3%
associate-*r*78.3%
Applied egg-rr78.3%
unpow278.3%
sqr-cos-a78.3%
associate-*r*78.3%
*-commutative78.3%
Applied egg-rr78.3%
*-commutative78.3%
associate-*l*78.3%
*-commutative78.3%
Simplified78.3%
(FPCore (a b angle) :precision binary64 (+ (pow (* b (sin (* PI (* angle 0.005555555555555556)))) 2.0) (* a (* a (/ (+ 1.0 (cos (* PI (* angle 0.011111111111111112)))) 2.0)))))
double code(double a, double b, double angle) {
return pow((b * sin((((double) M_PI) * (angle * 0.005555555555555556)))), 2.0) + (a * (a * ((1.0 + cos((((double) M_PI) * (angle * 0.011111111111111112)))) / 2.0)));
}
public static double code(double a, double b, double angle) {
return Math.pow((b * Math.sin((Math.PI * (angle * 0.005555555555555556)))), 2.0) + (a * (a * ((1.0 + Math.cos((Math.PI * (angle * 0.011111111111111112)))) / 2.0)));
}
def code(a, b, angle): return math.pow((b * math.sin((math.pi * (angle * 0.005555555555555556)))), 2.0) + (a * (a * ((1.0 + math.cos((math.pi * (angle * 0.011111111111111112)))) / 2.0)))
function code(a, b, angle) return Float64((Float64(b * sin(Float64(pi * Float64(angle * 0.005555555555555556)))) ^ 2.0) + Float64(a * Float64(a * Float64(Float64(1.0 + cos(Float64(pi * Float64(angle * 0.011111111111111112)))) / 2.0)))) end
function tmp = code(a, b, angle) tmp = ((b * sin((pi * (angle * 0.005555555555555556)))) ^ 2.0) + (a * (a * ((1.0 + cos((pi * (angle * 0.011111111111111112)))) / 2.0))); end
code[a_, b_, angle_] := N[(N[Power[N[(b * N[Sin[N[(Pi * N[(angle * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(a * N[(a * N[(N[(1.0 + N[Cos[N[(Pi * N[(angle * 0.011111111111111112), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} + a \cdot \left(a \cdot \frac{1 + \cos \left(\pi \cdot \left(angle \cdot 0.011111111111111112\right)\right)}{2}\right)
\end{array}
Initial program 78.3%
Simplified78.3%
metadata-eval78.3%
div-inv78.3%
add-cube-cbrt77.7%
pow377.7%
*-commutative77.7%
*-commutative77.7%
div-inv77.7%
metadata-eval77.7%
associate-*l*77.7%
Applied egg-rr77.7%
unpow377.7%
add-cube-cbrt78.3%
*-commutative78.3%
unpow-prod-down78.3%
unpow278.3%
associate-*r*78.3%
*-commutative78.3%
associate-*l*78.3%
*-commutative78.3%
associate-*r*78.3%
Applied egg-rr78.3%
unpow278.3%
cos-mult78.3%
associate-*r*78.3%
*-commutative78.3%
associate-*r*78.3%
*-commutative78.3%
associate-*r*77.1%
*-commutative77.1%
associate-*r*78.3%
*-commutative78.3%
Applied egg-rr78.3%
+-commutative78.3%
+-inverses78.3%
cos-078.3%
distribute-lft-out78.3%
distribute-lft-out78.3%
metadata-eval78.3%
Simplified78.3%
Final simplification78.3%
(FPCore (a b angle) :precision binary64 (+ (pow (* b (sin (* PI (* angle 0.005555555555555556)))) 2.0) (pow a 2.0)))
double code(double a, double b, double angle) {
return pow((b * sin((((double) M_PI) * (angle * 0.005555555555555556)))), 2.0) + pow(a, 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((b * Math.sin((Math.PI * (angle * 0.005555555555555556)))), 2.0) + Math.pow(a, 2.0);
}
def code(a, b, angle): return math.pow((b * math.sin((math.pi * (angle * 0.005555555555555556)))), 2.0) + math.pow(a, 2.0)
function code(a, b, angle) return Float64((Float64(b * sin(Float64(pi * Float64(angle * 0.005555555555555556)))) ^ 2.0) + (a ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((b * sin((pi * (angle * 0.005555555555555556)))) ^ 2.0) + (a ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(b * N[Sin[N[(Pi * N[(angle * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} + {a}^{2}
\end{array}
Initial program 78.3%
Simplified78.3%
Taylor expanded in angle around 0 78.0%
Final simplification78.0%
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* PI (* angle 0.005555555555555556)))) (if (<= a 5.9e-96) (pow (* b (sin t_0)) 2.0) (pow (* a (cos t_0)) 2.0))))
double code(double a, double b, double angle) {
double t_0 = ((double) M_PI) * (angle * 0.005555555555555556);
double tmp;
if (a <= 5.9e-96) {
tmp = pow((b * sin(t_0)), 2.0);
} else {
tmp = pow((a * cos(t_0)), 2.0);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double t_0 = Math.PI * (angle * 0.005555555555555556);
double tmp;
if (a <= 5.9e-96) {
tmp = Math.pow((b * Math.sin(t_0)), 2.0);
} else {
tmp = Math.pow((a * Math.cos(t_0)), 2.0);
}
return tmp;
}
def code(a, b, angle): t_0 = math.pi * (angle * 0.005555555555555556) tmp = 0 if a <= 5.9e-96: tmp = math.pow((b * math.sin(t_0)), 2.0) else: tmp = math.pow((a * math.cos(t_0)), 2.0) return tmp
function code(a, b, angle) t_0 = Float64(pi * Float64(angle * 0.005555555555555556)) tmp = 0.0 if (a <= 5.9e-96) tmp = Float64(b * sin(t_0)) ^ 2.0; else tmp = Float64(a * cos(t_0)) ^ 2.0; end return tmp end
function tmp_2 = code(a, b, angle) t_0 = pi * (angle * 0.005555555555555556); tmp = 0.0; if (a <= 5.9e-96) tmp = (b * sin(t_0)) ^ 2.0; else tmp = (a * cos(t_0)) ^ 2.0; end tmp_2 = tmp; end
code[a_, b_, angle_] := Block[{t$95$0 = N[(Pi * N[(angle * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, 5.9e-96], N[Power[N[(b * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[Power[N[(a * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \pi \cdot \left(angle \cdot 0.005555555555555556\right)\\
\mathbf{if}\;a \leq 5.9 \cdot 10^{-96}:\\
\;\;\;\;{\left(b \cdot \sin t\_0\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;{\left(a \cdot \cos t\_0\right)}^{2}\\
\end{array}
\end{array}
if a < 5.89999999999999966e-96Initial program 76.9%
Simplified76.9%
Taylor expanded in a around 0 42.5%
associate-*r*42.6%
*-commutative42.6%
associate-*r*42.6%
unpow242.6%
unpow242.6%
swap-sqr47.9%
unpow247.9%
associate-*r*47.9%
*-commutative47.9%
associate-*r*47.8%
associate-*r*47.9%
*-commutative47.9%
*-commutative47.9%
*-commutative47.9%
Simplified47.9%
if 5.89999999999999966e-96 < a Initial program 80.8%
Simplified80.8%
Taylor expanded in a around inf 72.8%
*-commutative72.8%
associate-*r*73.0%
*-commutative73.0%
associate-*r*73.0%
unpow273.0%
unpow273.0%
swap-sqr73.0%
unpow273.0%
*-commutative73.0%
associate-*r*73.0%
*-commutative73.0%
Simplified73.0%
Final simplification57.0%
(FPCore (a b angle) :precision binary64 (if (<= a 3.6e-96) (pow (* b (sin (* angle (* PI 0.005555555555555556)))) 2.0) (pow (* a (cos (* PI (* angle 0.005555555555555556)))) 2.0)))
double code(double a, double b, double angle) {
double tmp;
if (a <= 3.6e-96) {
tmp = pow((b * sin((angle * (((double) M_PI) * 0.005555555555555556)))), 2.0);
} else {
tmp = pow((a * cos((((double) M_PI) * (angle * 0.005555555555555556)))), 2.0);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (a <= 3.6e-96) {
tmp = Math.pow((b * Math.sin((angle * (Math.PI * 0.005555555555555556)))), 2.0);
} else {
tmp = Math.pow((a * Math.cos((Math.PI * (angle * 0.005555555555555556)))), 2.0);
}
return tmp;
}
def code(a, b, angle): tmp = 0 if a <= 3.6e-96: tmp = math.pow((b * math.sin((angle * (math.pi * 0.005555555555555556)))), 2.0) else: tmp = math.pow((a * math.cos((math.pi * (angle * 0.005555555555555556)))), 2.0) return tmp
function code(a, b, angle) tmp = 0.0 if (a <= 3.6e-96) tmp = Float64(b * sin(Float64(angle * Float64(pi * 0.005555555555555556)))) ^ 2.0; else tmp = Float64(a * cos(Float64(pi * Float64(angle * 0.005555555555555556)))) ^ 2.0; end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (a <= 3.6e-96) tmp = (b * sin((angle * (pi * 0.005555555555555556)))) ^ 2.0; else tmp = (a * cos((pi * (angle * 0.005555555555555556)))) ^ 2.0; end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[a, 3.6e-96], N[Power[N[(b * N[Sin[N[(angle * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[Power[N[(a * N[Cos[N[(Pi * N[(angle * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 3.6 \cdot 10^{-96}:\\
\;\;\;\;{\left(b \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;{\left(a \cdot \cos \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2}\\
\end{array}
\end{array}
if a < 3.60000000000000008e-96Initial program 76.9%
Simplified76.9%
metadata-eval76.9%
div-inv76.9%
unpow276.9%
associate-*r*76.9%
*-commutative76.9%
*-commutative76.9%
div-inv74.6%
metadata-eval74.6%
associate-*l*75.5%
*-commutative75.5%
div-inv75.9%
metadata-eval75.9%
associate-*l*76.8%
Applied egg-rr76.8%
Taylor expanded in a around 0 42.5%
unpow242.5%
*-commutative42.5%
associate-*l*42.6%
*-commutative42.6%
unpow242.6%
swap-sqr47.9%
unpow247.9%
*-commutative47.9%
Simplified47.9%
if 3.60000000000000008e-96 < a Initial program 80.8%
Simplified80.8%
Taylor expanded in a around inf 72.8%
*-commutative72.8%
associate-*r*73.0%
*-commutative73.0%
associate-*r*73.0%
unpow273.0%
unpow273.0%
swap-sqr73.0%
unpow273.0%
*-commutative73.0%
associate-*r*73.0%
*-commutative73.0%
Simplified73.0%
Final simplification57.0%
(FPCore (a b angle) :precision binary64 (if (<= a 8.2e-98) (pow (* b (sin (* 0.005555555555555556 (* angle PI)))) 2.0) (pow (* a (cos (* PI (* angle 0.005555555555555556)))) 2.0)))
double code(double a, double b, double angle) {
double tmp;
if (a <= 8.2e-98) {
tmp = pow((b * sin((0.005555555555555556 * (angle * ((double) M_PI))))), 2.0);
} else {
tmp = pow((a * cos((((double) M_PI) * (angle * 0.005555555555555556)))), 2.0);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (a <= 8.2e-98) {
tmp = Math.pow((b * Math.sin((0.005555555555555556 * (angle * Math.PI)))), 2.0);
} else {
tmp = Math.pow((a * Math.cos((Math.PI * (angle * 0.005555555555555556)))), 2.0);
}
return tmp;
}
def code(a, b, angle): tmp = 0 if a <= 8.2e-98: tmp = math.pow((b * math.sin((0.005555555555555556 * (angle * math.pi)))), 2.0) else: tmp = math.pow((a * math.cos((math.pi * (angle * 0.005555555555555556)))), 2.0) return tmp
function code(a, b, angle) tmp = 0.0 if (a <= 8.2e-98) tmp = Float64(b * sin(Float64(0.005555555555555556 * Float64(angle * pi)))) ^ 2.0; else tmp = Float64(a * cos(Float64(pi * Float64(angle * 0.005555555555555556)))) ^ 2.0; end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (a <= 8.2e-98) tmp = (b * sin((0.005555555555555556 * (angle * pi)))) ^ 2.0; else tmp = (a * cos((pi * (angle * 0.005555555555555556)))) ^ 2.0; end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[a, 8.2e-98], N[Power[N[(b * N[Sin[N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[Power[N[(a * N[Cos[N[(Pi * N[(angle * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 8.2 \cdot 10^{-98}:\\
\;\;\;\;{\left(b \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;{\left(a \cdot \cos \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2}\\
\end{array}
\end{array}
if a < 8.1999999999999996e-98Initial program 76.9%
Simplified76.9%
metadata-eval76.9%
div-inv76.9%
unpow276.9%
associate-*r*76.9%
*-commutative76.9%
*-commutative76.9%
div-inv74.6%
metadata-eval74.6%
associate-*l*75.5%
*-commutative75.5%
div-inv75.9%
metadata-eval75.9%
associate-*l*76.8%
Applied egg-rr76.8%
Applied egg-rr76.9%
Taylor expanded in a around 0 42.5%
*-commutative42.5%
associate-*r*42.6%
*-commutative42.6%
associate-*r*42.6%
unpow242.6%
unpow242.6%
swap-sqr47.9%
unpow247.9%
associate-*r*47.9%
*-commutative47.9%
associate-*r*47.8%
*-commutative47.8%
Simplified47.8%
if 8.1999999999999996e-98 < a Initial program 80.8%
Simplified80.8%
Taylor expanded in a around inf 72.8%
*-commutative72.8%
associate-*r*73.0%
*-commutative73.0%
associate-*r*73.0%
unpow273.0%
unpow273.0%
swap-sqr73.0%
unpow273.0%
*-commutative73.0%
associate-*r*73.0%
*-commutative73.0%
Simplified73.0%
Final simplification56.9%
(FPCore (a b angle) :precision binary64 (pow (* a (cos (* PI (* angle 0.005555555555555556)))) 2.0))
double code(double a, double b, double angle) {
return pow((a * cos((((double) M_PI) * (angle * 0.005555555555555556)))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.cos((Math.PI * (angle * 0.005555555555555556)))), 2.0);
}
def code(a, b, angle): return math.pow((a * math.cos((math.pi * (angle * 0.005555555555555556)))), 2.0)
function code(a, b, angle) return Float64(a * cos(Float64(pi * Float64(angle * 0.005555555555555556)))) ^ 2.0 end
function tmp = code(a, b, angle) tmp = (a * cos((pi * (angle * 0.005555555555555556)))) ^ 2.0; end
code[a_, b_, angle_] := N[Power[N[(a * N[Cos[N[(Pi * N[(angle * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \cos \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2}
\end{array}
Initial program 78.3%
Simplified78.3%
Taylor expanded in a around inf 57.6%
*-commutative57.6%
associate-*r*57.8%
*-commutative57.8%
associate-*r*57.8%
unpow257.8%
unpow257.8%
swap-sqr57.8%
unpow257.8%
*-commutative57.8%
associate-*r*57.8%
*-commutative57.8%
Simplified57.8%
Final simplification57.8%
(FPCore (a b angle) :precision binary64 (pow (* a (cos (* angle (* PI 0.005555555555555556)))) 2.0))
double code(double a, double b, double angle) {
return pow((a * cos((angle * (((double) M_PI) * 0.005555555555555556)))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.cos((angle * (Math.PI * 0.005555555555555556)))), 2.0);
}
def code(a, b, angle): return math.pow((a * math.cos((angle * (math.pi * 0.005555555555555556)))), 2.0)
function code(a, b, angle) return Float64(a * cos(Float64(angle * Float64(pi * 0.005555555555555556)))) ^ 2.0 end
function tmp = code(a, b, angle) tmp = (a * cos((angle * (pi * 0.005555555555555556)))) ^ 2.0; end
code[a_, b_, angle_] := N[Power[N[(a * N[Cos[N[(angle * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \cos \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)}^{2}
\end{array}
Initial program 78.3%
Simplified78.3%
metadata-eval78.3%
div-inv78.3%
unpow278.3%
associate-*r*78.3%
*-commutative78.3%
*-commutative78.3%
div-inv75.6%
metadata-eval75.6%
associate-*l*76.3%
*-commutative76.3%
div-inv77.6%
metadata-eval77.6%
associate-*l*78.3%
Applied egg-rr78.3%
Taylor expanded in a around inf 57.6%
*-commutative57.6%
*-commutative57.6%
associate-*l*57.8%
*-commutative57.8%
unpow257.8%
unpow257.8%
swap-sqr57.8%
unpow257.8%
*-commutative57.8%
associate-*l*57.6%
*-commutative57.6%
*-commutative57.6%
*-commutative57.6%
associate-*l*57.8%
Simplified57.8%
(FPCore (a b angle) :precision binary64 (pow (* a (cos (* 0.005555555555555556 (* angle PI)))) 2.0))
double code(double a, double b, double angle) {
return pow((a * cos((0.005555555555555556 * (angle * ((double) M_PI))))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.cos((0.005555555555555556 * (angle * Math.PI)))), 2.0);
}
def code(a, b, angle): return math.pow((a * math.cos((0.005555555555555556 * (angle * math.pi)))), 2.0)
function code(a, b, angle) return Float64(a * cos(Float64(0.005555555555555556 * Float64(angle * pi)))) ^ 2.0 end
function tmp = code(a, b, angle) tmp = (a * cos((0.005555555555555556 * (angle * pi)))) ^ 2.0; end
code[a_, b_, angle_] := N[Power[N[(a * N[Cos[N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2}
\end{array}
Initial program 78.3%
Simplified78.3%
metadata-eval78.3%
div-inv78.3%
unpow278.3%
associate-*r*78.3%
*-commutative78.3%
*-commutative78.3%
div-inv75.6%
metadata-eval75.6%
associate-*l*76.3%
*-commutative76.3%
div-inv77.6%
metadata-eval77.6%
associate-*l*78.3%
Applied egg-rr78.3%
Applied egg-rr78.3%
Taylor expanded in a around inf 57.6%
unpow257.6%
associate-*r*57.8%
*-commutative57.8%
associate-*r*57.8%
unpow257.8%
swap-sqr57.8%
unpow257.8%
associate-*r*57.8%
*-commutative57.8%
associate-*r*57.6%
Simplified57.6%
(FPCore (a b angle) :precision binary64 (* a a))
double code(double a, double b, double angle) {
return a * a;
}
real(8) function code(a, b, angle)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle
code = a * a
end function
public static double code(double a, double b, double angle) {
return a * a;
}
def code(a, b, angle): return a * a
function code(a, b, angle) return Float64(a * a) end
function tmp = code(a, b, angle) tmp = a * a; end
code[a_, b_, angle_] := N[(a * a), $MachinePrecision]
\begin{array}{l}
\\
a \cdot a
\end{array}
Initial program 78.3%
Simplified78.3%
Taylor expanded in angle around 0 57.5%
unpow257.5%
Applied egg-rr57.5%
herbie shell --seed 2024121
(FPCore (a b angle)
:name "ab-angle->ABCF C"
:precision binary64
(+ (pow (* a (cos (* PI (/ angle 180.0)))) 2.0) (pow (* b (sin (* PI (/ angle 180.0)))) 2.0)))