
(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 13 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
(+
(pow
(*
a
(cos
(pow (cbrt (* (pow (sqrt PI) 2.0) (* angle 0.005555555555555556))) 3.0)))
2.0)
(pow (* b (sin (* PI (* angle 0.005555555555555556)))) 2.0)))
double code(double a, double b, double angle) {
return pow((a * cos(pow(cbrt((pow(sqrt(((double) M_PI)), 2.0) * (angle * 0.005555555555555556))), 3.0))), 2.0) + pow((b * sin((((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.pow(Math.cbrt((Math.pow(Math.sqrt(Math.PI), 2.0) * (angle * 0.005555555555555556))), 3.0))), 2.0) + Math.pow((b * Math.sin((Math.PI * (angle * 0.005555555555555556)))), 2.0);
}
function code(a, b, angle) return Float64((Float64(a * cos((cbrt(Float64((sqrt(pi) ^ 2.0) * Float64(angle * 0.005555555555555556))) ^ 3.0))) ^ 2.0) + (Float64(b * sin(Float64(pi * Float64(angle * 0.005555555555555556)))) ^ 2.0)) end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Cos[N[Power[N[Power[N[(N[Power[N[Sqrt[Pi], $MachinePrecision], 2.0], $MachinePrecision] * N[(angle * 0.005555555555555556), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[N[(Pi * N[(angle * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \cos \left({\left(\sqrt[3]{{\left(\sqrt{\pi}\right)}^{2} \cdot \left(angle \cdot 0.005555555555555556\right)}\right)}^{3}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2}
\end{array}
Initial program 84.3%
associate-*r/84.2%
metadata-eval84.2%
metadata-eval84.2%
distribute-neg-frac284.2%
distribute-frac-neg84.2%
distribute-rgt-neg-out84.2%
associate-/l*84.3%
neg-mul-184.3%
*-commutative84.3%
associate-/l*84.3%
metadata-eval84.3%
metadata-eval84.3%
Simplified84.5%
metadata-eval84.5%
div-inv84.5%
add-cube-cbrt84.3%
pow384.6%
div-inv84.6%
metadata-eval84.6%
Applied egg-rr84.6%
add-sqr-sqrt84.6%
pow284.6%
Applied egg-rr84.6%
Final simplification84.6%
(FPCore (a b angle)
:precision binary64
(+
(pow (* b (sin (* PI (* angle 0.005555555555555556)))) 2.0)
(pow
(*
a
(cos
(pow (cbrt (* PI (expm1 (log1p (* angle 0.005555555555555556))))) 3.0)))
2.0)))
double code(double a, double b, double angle) {
return pow((b * sin((((double) M_PI) * (angle * 0.005555555555555556)))), 2.0) + pow((a * cos(pow(cbrt((((double) M_PI) * expm1(log1p((angle * 0.005555555555555556))))), 3.0))), 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 * Math.cos(Math.pow(Math.cbrt((Math.PI * Math.expm1(Math.log1p((angle * 0.005555555555555556))))), 3.0))), 2.0);
}
function code(a, b, angle) return Float64((Float64(b * sin(Float64(pi * Float64(angle * 0.005555555555555556)))) ^ 2.0) + (Float64(a * cos((cbrt(Float64(pi * expm1(log1p(Float64(angle * 0.005555555555555556))))) ^ 3.0))) ^ 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[N[(a * N[Cos[N[Power[N[Power[N[(Pi * N[(Exp[N[Log[1 + N[(angle * 0.005555555555555556), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} + {\left(a \cdot \cos \left({\left(\sqrt[3]{\pi \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(angle \cdot 0.005555555555555556\right)\right)}\right)}^{3}\right)\right)}^{2}
\end{array}
Initial program 84.3%
associate-*r/84.2%
metadata-eval84.2%
metadata-eval84.2%
distribute-neg-frac284.2%
distribute-frac-neg84.2%
distribute-rgt-neg-out84.2%
associate-/l*84.3%
neg-mul-184.3%
*-commutative84.3%
associate-/l*84.3%
metadata-eval84.3%
metadata-eval84.3%
Simplified84.5%
metadata-eval84.5%
div-inv84.5%
add-cube-cbrt84.3%
pow384.6%
div-inv84.6%
metadata-eval84.6%
Applied egg-rr84.6%
expm1-log1p-u66.9%
Applied egg-rr66.8%
Final simplification66.8%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (cos (* PI (expm1 (log1p (* angle 0.005555555555555556)))))) 2.0) (pow (* b (expm1 (log1p (sin (* PI (* angle 0.005555555555555556)))))) 2.0)))
double code(double a, double b, double angle) {
return pow((a * cos((((double) M_PI) * expm1(log1p((angle * 0.005555555555555556)))))), 2.0) + pow((b * expm1(log1p(sin((((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 * Math.expm1(Math.log1p((angle * 0.005555555555555556)))))), 2.0) + Math.pow((b * Math.expm1(Math.log1p(Math.sin((Math.PI * (angle * 0.005555555555555556)))))), 2.0);
}
def code(a, b, angle): return math.pow((a * math.cos((math.pi * math.expm1(math.log1p((angle * 0.005555555555555556)))))), 2.0) + math.pow((b * math.expm1(math.log1p(math.sin((math.pi * (angle * 0.005555555555555556)))))), 2.0)
function code(a, b, angle) return Float64((Float64(a * cos(Float64(pi * expm1(log1p(Float64(angle * 0.005555555555555556)))))) ^ 2.0) + (Float64(b * expm1(log1p(sin(Float64(pi * Float64(angle * 0.005555555555555556)))))) ^ 2.0)) end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Cos[N[(Pi * N[(Exp[N[Log[1 + N[(angle * 0.005555555555555556), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[(Exp[N[Log[1 + N[Sin[N[(Pi * N[(angle * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \cos \left(\pi \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(angle \cdot 0.005555555555555556\right)\right)\right)\right)}^{2} + {\left(b \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(\sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)\right)\right)}^{2}
\end{array}
Initial program 84.3%
associate-*r/84.2%
metadata-eval84.2%
metadata-eval84.2%
distribute-neg-frac284.2%
distribute-frac-neg84.2%
distribute-rgt-neg-out84.2%
associate-/l*84.3%
neg-mul-184.3%
*-commutative84.3%
associate-/l*84.3%
metadata-eval84.3%
metadata-eval84.3%
Simplified84.5%
expm1-log1p-u84.5%
Applied egg-rr84.5%
expm1-log1p-u66.9%
Applied egg-rr66.9%
Final simplification66.9%
(FPCore (a b angle) :precision binary64 (+ (pow (* b (sin (* PI (* angle 0.005555555555555556)))) 2.0) (pow (* a (cos (* (* angle 0.005555555555555556) (cbrt (pow PI 3.0))))) 2.0)))
double code(double a, double b, double angle) {
return pow((b * sin((((double) M_PI) * (angle * 0.005555555555555556)))), 2.0) + pow((a * cos(((angle * 0.005555555555555556) * cbrt(pow(((double) M_PI), 3.0))))), 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 * Math.cos(((angle * 0.005555555555555556) * Math.cbrt(Math.pow(Math.PI, 3.0))))), 2.0);
}
function code(a, b, angle) return Float64((Float64(b * sin(Float64(pi * Float64(angle * 0.005555555555555556)))) ^ 2.0) + (Float64(a * cos(Float64(Float64(angle * 0.005555555555555556) * cbrt((pi ^ 3.0))))) ^ 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[N[(a * N[Cos[N[(N[(angle * 0.005555555555555556), $MachinePrecision] * N[Power[N[Power[Pi, 3.0], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} + {\left(a \cdot \cos \left(\left(angle \cdot 0.005555555555555556\right) \cdot \sqrt[3]{{\pi}^{3}}\right)\right)}^{2}
\end{array}
Initial program 84.3%
associate-*r/84.2%
metadata-eval84.2%
metadata-eval84.2%
distribute-neg-frac284.2%
distribute-frac-neg84.2%
distribute-rgt-neg-out84.2%
associate-/l*84.3%
neg-mul-184.3%
*-commutative84.3%
associate-/l*84.3%
metadata-eval84.3%
metadata-eval84.3%
Simplified84.5%
add-cbrt-cube84.5%
pow384.5%
Applied egg-rr84.5%
Final simplification84.5%
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* PI (* angle 0.005555555555555556)))) (+ (pow (* b (sin t_0)) 2.0) (pow (* a (cos (pow (cbrt t_0) 3.0))) 2.0))))
double code(double a, double b, double angle) {
double t_0 = ((double) M_PI) * (angle * 0.005555555555555556);
return pow((b * sin(t_0)), 2.0) + pow((a * cos(pow(cbrt(t_0), 3.0))), 2.0);
}
public static double code(double a, double b, double angle) {
double t_0 = Math.PI * (angle * 0.005555555555555556);
return Math.pow((b * Math.sin(t_0)), 2.0) + Math.pow((a * Math.cos(Math.pow(Math.cbrt(t_0), 3.0))), 2.0);
}
function code(a, b, angle) t_0 = Float64(pi * Float64(angle * 0.005555555555555556)) return Float64((Float64(b * sin(t_0)) ^ 2.0) + (Float64(a * cos((cbrt(t_0) ^ 3.0))) ^ 2.0)) end
code[a_, b_, angle_] := Block[{t$95$0 = N[(Pi * N[(angle * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]}, N[(N[Power[N[(b * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(a * N[Cos[N[Power[N[Power[t$95$0, 1/3], $MachinePrecision], 3.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \pi \cdot \left(angle \cdot 0.005555555555555556\right)\\
{\left(b \cdot \sin t\_0\right)}^{2} + {\left(a \cdot \cos \left({\left(\sqrt[3]{t\_0}\right)}^{3}\right)\right)}^{2}
\end{array}
\end{array}
Initial program 84.3%
associate-*r/84.2%
metadata-eval84.2%
metadata-eval84.2%
distribute-neg-frac284.2%
distribute-frac-neg84.2%
distribute-rgt-neg-out84.2%
associate-/l*84.3%
neg-mul-184.3%
*-commutative84.3%
associate-/l*84.3%
metadata-eval84.3%
metadata-eval84.3%
Simplified84.5%
metadata-eval84.5%
div-inv84.5%
add-cube-cbrt84.3%
pow384.6%
div-inv84.6%
metadata-eval84.6%
Applied egg-rr84.6%
Final simplification84.6%
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* PI (* angle 0.005555555555555556)))) (+ (pow (* b (sin t_0)) 2.0) (pow (* a (cos (expm1 (log1p t_0)))) 2.0))))
double code(double a, double b, double angle) {
double t_0 = ((double) M_PI) * (angle * 0.005555555555555556);
return pow((b * sin(t_0)), 2.0) + pow((a * cos(expm1(log1p(t_0)))), 2.0);
}
public static double code(double a, double b, double angle) {
double t_0 = Math.PI * (angle * 0.005555555555555556);
return Math.pow((b * Math.sin(t_0)), 2.0) + Math.pow((a * Math.cos(Math.expm1(Math.log1p(t_0)))), 2.0);
}
def code(a, b, angle): t_0 = math.pi * (angle * 0.005555555555555556) return math.pow((b * math.sin(t_0)), 2.0) + math.pow((a * math.cos(math.expm1(math.log1p(t_0)))), 2.0)
function code(a, b, angle) t_0 = Float64(pi * Float64(angle * 0.005555555555555556)) return Float64((Float64(b * sin(t_0)) ^ 2.0) + (Float64(a * cos(expm1(log1p(t_0)))) ^ 2.0)) end
code[a_, b_, angle_] := Block[{t$95$0 = N[(Pi * N[(angle * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]}, N[(N[Power[N[(b * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(a * N[Cos[N[(Exp[N[Log[1 + t$95$0], $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \pi \cdot \left(angle \cdot 0.005555555555555556\right)\\
{\left(b \cdot \sin t\_0\right)}^{2} + {\left(a \cdot \cos \left(\mathsf{expm1}\left(\mathsf{log1p}\left(t\_0\right)\right)\right)\right)}^{2}
\end{array}
\end{array}
Initial program 84.3%
associate-*r/84.2%
metadata-eval84.2%
metadata-eval84.2%
distribute-neg-frac284.2%
distribute-frac-neg84.2%
distribute-rgt-neg-out84.2%
associate-/l*84.3%
neg-mul-184.3%
*-commutative84.3%
associate-/l*84.3%
metadata-eval84.3%
metadata-eval84.3%
Simplified84.5%
expm1-log1p-u66.8%
Applied egg-rr66.8%
Final simplification66.8%
(FPCore (a b angle) :precision binary64 (+ (pow (* b (sin (* PI (* angle 0.005555555555555556)))) 2.0) (pow (* a (cos (* 0.005555555555555556 (* PI angle)))) 2.0)))
double code(double a, double b, double angle) {
return pow((b * sin((((double) M_PI) * (angle * 0.005555555555555556)))), 2.0) + pow((a * cos((0.005555555555555556 * (((double) M_PI) * angle)))), 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 * Math.cos((0.005555555555555556 * (Math.PI * angle)))), 2.0);
}
def code(a, b, angle): return math.pow((b * math.sin((math.pi * (angle * 0.005555555555555556)))), 2.0) + math.pow((a * math.cos((0.005555555555555556 * (math.pi * angle)))), 2.0)
function code(a, b, angle) return Float64((Float64(b * sin(Float64(pi * Float64(angle * 0.005555555555555556)))) ^ 2.0) + (Float64(a * cos(Float64(0.005555555555555556 * Float64(pi * angle)))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((b * sin((pi * (angle * 0.005555555555555556)))) ^ 2.0) + ((a * cos((0.005555555555555556 * (pi * angle)))) ^ 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[N[(a * N[Cos[N[(0.005555555555555556 * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} + {\left(a \cdot \cos \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)\right)}^{2}
\end{array}
Initial program 84.3%
associate-*r/84.2%
metadata-eval84.2%
metadata-eval84.2%
distribute-neg-frac284.2%
distribute-frac-neg84.2%
distribute-rgt-neg-out84.2%
associate-/l*84.3%
neg-mul-184.3%
*-commutative84.3%
associate-/l*84.3%
metadata-eval84.3%
metadata-eval84.3%
Simplified84.5%
Taylor expanded in angle around inf 84.4%
Final simplification84.4%
(FPCore (a b angle) :precision binary64 (+ (pow (* b (sin (* PI (* angle 0.005555555555555556)))) 2.0) (pow (* a (cos (* angle (* PI 0.005555555555555556)))) 2.0)))
double code(double a, double b, double angle) {
return pow((b * sin((((double) M_PI) * (angle * 0.005555555555555556)))), 2.0) + pow((a * cos((angle * (((double) M_PI) * 0.005555555555555556)))), 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 * Math.cos((angle * (Math.PI * 0.005555555555555556)))), 2.0);
}
def code(a, b, angle): return math.pow((b * math.sin((math.pi * (angle * 0.005555555555555556)))), 2.0) + math.pow((a * math.cos((angle * (math.pi * 0.005555555555555556)))), 2.0)
function code(a, b, angle) return Float64((Float64(b * sin(Float64(pi * Float64(angle * 0.005555555555555556)))) ^ 2.0) + (Float64(a * cos(Float64(angle * Float64(pi * 0.005555555555555556)))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((b * sin((pi * (angle * 0.005555555555555556)))) ^ 2.0) + ((a * cos((angle * (pi * 0.005555555555555556)))) ^ 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[N[(a * N[Cos[N[(angle * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} + {\left(a \cdot \cos \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)}^{2}
\end{array}
Initial program 84.3%
associate-*r/84.2%
metadata-eval84.2%
metadata-eval84.2%
distribute-neg-frac284.2%
distribute-frac-neg84.2%
distribute-rgt-neg-out84.2%
associate-/l*84.3%
neg-mul-184.3%
*-commutative84.3%
associate-/l*84.3%
metadata-eval84.3%
metadata-eval84.3%
Simplified84.5%
Taylor expanded in angle around inf 84.4%
*-commutative84.4%
associate-*r*84.5%
Simplified84.5%
Final simplification84.5%
(FPCore (a b angle) :precision binary64 (+ (pow a 2.0) (pow (* b (sin (* angle (* PI 0.005555555555555556)))) 2.0)))
double code(double a, double b, double angle) {
return pow(a, 2.0) + pow((b * sin((angle * (((double) M_PI) * 0.005555555555555556)))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow(a, 2.0) + Math.pow((b * Math.sin((angle * (Math.PI * 0.005555555555555556)))), 2.0);
}
def code(a, b, angle): return math.pow(a, 2.0) + math.pow((b * math.sin((angle * (math.pi * 0.005555555555555556)))), 2.0)
function code(a, b, angle) return Float64((a ^ 2.0) + (Float64(b * sin(Float64(angle * Float64(pi * 0.005555555555555556)))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = (a ^ 2.0) + ((b * sin((angle * (pi * 0.005555555555555556)))) ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[a, 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[N[(angle * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{a}^{2} + {\left(b \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)}^{2}
\end{array}
Initial program 84.3%
associate-*r/84.2%
metadata-eval84.2%
metadata-eval84.2%
distribute-neg-frac284.2%
distribute-frac-neg84.2%
distribute-rgt-neg-out84.2%
associate-/l*84.3%
neg-mul-184.3%
*-commutative84.3%
associate-/l*84.3%
metadata-eval84.3%
metadata-eval84.3%
Simplified84.5%
Taylor expanded in angle around 0 83.9%
Taylor expanded in angle around inf 83.7%
*-commutative83.7%
associate-*r*83.8%
Simplified83.8%
Final simplification83.8%
(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 84.3%
associate-*r/84.2%
metadata-eval84.2%
metadata-eval84.2%
distribute-neg-frac284.2%
distribute-frac-neg84.2%
distribute-rgt-neg-out84.2%
associate-/l*84.3%
neg-mul-184.3%
*-commutative84.3%
associate-/l*84.3%
metadata-eval84.3%
metadata-eval84.3%
Simplified84.5%
Taylor expanded in angle around 0 83.9%
Final simplification83.9%
(FPCore (a b angle) :precision binary64 (+ (pow a 2.0) (* (* 0.005555555555555556 b) (* (* PI angle) (* angle (* 0.005555555555555556 (* PI b)))))))
double code(double a, double b, double angle) {
return pow(a, 2.0) + ((0.005555555555555556 * b) * ((((double) M_PI) * angle) * (angle * (0.005555555555555556 * (((double) M_PI) * b)))));
}
public static double code(double a, double b, double angle) {
return Math.pow(a, 2.0) + ((0.005555555555555556 * b) * ((Math.PI * angle) * (angle * (0.005555555555555556 * (Math.PI * b)))));
}
def code(a, b, angle): return math.pow(a, 2.0) + ((0.005555555555555556 * b) * ((math.pi * angle) * (angle * (0.005555555555555556 * (math.pi * b)))))
function code(a, b, angle) return Float64((a ^ 2.0) + Float64(Float64(0.005555555555555556 * b) * Float64(Float64(pi * angle) * Float64(angle * Float64(0.005555555555555556 * Float64(pi * b)))))) end
function tmp = code(a, b, angle) tmp = (a ^ 2.0) + ((0.005555555555555556 * b) * ((pi * angle) * (angle * (0.005555555555555556 * (pi * b))))); end
code[a_, b_, angle_] := N[(N[Power[a, 2.0], $MachinePrecision] + N[(N[(0.005555555555555556 * b), $MachinePrecision] * N[(N[(Pi * angle), $MachinePrecision] * N[(angle * N[(0.005555555555555556 * N[(Pi * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{a}^{2} + \left(0.005555555555555556 \cdot b\right) \cdot \left(\left(\pi \cdot angle\right) \cdot \left(angle \cdot \left(0.005555555555555556 \cdot \left(\pi \cdot b\right)\right)\right)\right)
\end{array}
Initial program 84.3%
associate-*r/84.2%
metadata-eval84.2%
metadata-eval84.2%
distribute-neg-frac284.2%
distribute-frac-neg84.2%
distribute-rgt-neg-out84.2%
associate-/l*84.3%
neg-mul-184.3%
*-commutative84.3%
associate-/l*84.3%
metadata-eval84.3%
metadata-eval84.3%
Simplified84.5%
Taylor expanded in angle around 0 83.9%
Taylor expanded in angle around 0 79.4%
unpow279.4%
associate-*r*79.5%
associate-*l*78.4%
*-commutative78.4%
*-commutative78.4%
*-commutative78.4%
associate-*r*78.4%
*-commutative78.4%
*-commutative78.4%
associate-*l*78.4%
Applied egg-rr78.4%
Taylor expanded in angle around 0 78.4%
associate-*r*78.4%
*-commutative78.4%
associate-*l*78.4%
Simplified78.4%
Final simplification78.4%
(FPCore (a b angle) :precision binary64 (+ (pow a 2.0) (* (* 0.005555555555555556 b) (* (* PI (* (* angle 0.005555555555555556) b)) (* PI angle)))))
double code(double a, double b, double angle) {
return pow(a, 2.0) + ((0.005555555555555556 * b) * ((((double) M_PI) * ((angle * 0.005555555555555556) * b)) * (((double) M_PI) * angle)));
}
public static double code(double a, double b, double angle) {
return Math.pow(a, 2.0) + ((0.005555555555555556 * b) * ((Math.PI * ((angle * 0.005555555555555556) * b)) * (Math.PI * angle)));
}
def code(a, b, angle): return math.pow(a, 2.0) + ((0.005555555555555556 * b) * ((math.pi * ((angle * 0.005555555555555556) * b)) * (math.pi * angle)))
function code(a, b, angle) return Float64((a ^ 2.0) + Float64(Float64(0.005555555555555556 * b) * Float64(Float64(pi * Float64(Float64(angle * 0.005555555555555556) * b)) * Float64(pi * angle)))) end
function tmp = code(a, b, angle) tmp = (a ^ 2.0) + ((0.005555555555555556 * b) * ((pi * ((angle * 0.005555555555555556) * b)) * (pi * angle))); end
code[a_, b_, angle_] := N[(N[Power[a, 2.0], $MachinePrecision] + N[(N[(0.005555555555555556 * b), $MachinePrecision] * N[(N[(Pi * N[(N[(angle * 0.005555555555555556), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision] * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{a}^{2} + \left(0.005555555555555556 \cdot b\right) \cdot \left(\left(\pi \cdot \left(\left(angle \cdot 0.005555555555555556\right) \cdot b\right)\right) \cdot \left(\pi \cdot angle\right)\right)
\end{array}
Initial program 84.3%
associate-*r/84.2%
metadata-eval84.2%
metadata-eval84.2%
distribute-neg-frac284.2%
distribute-frac-neg84.2%
distribute-rgt-neg-out84.2%
associate-/l*84.3%
neg-mul-184.3%
*-commutative84.3%
associate-/l*84.3%
metadata-eval84.3%
metadata-eval84.3%
Simplified84.5%
Taylor expanded in angle around 0 83.9%
Taylor expanded in angle around 0 79.4%
unpow279.4%
associate-*r*79.5%
associate-*l*78.4%
*-commutative78.4%
*-commutative78.4%
*-commutative78.4%
associate-*r*78.4%
*-commutative78.4%
*-commutative78.4%
associate-*l*78.4%
Applied egg-rr78.4%
Final simplification78.4%
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* PI (* (* angle 0.005555555555555556) b)))) (+ (pow a 2.0) (* t_0 t_0))))
double code(double a, double b, double angle) {
double t_0 = ((double) M_PI) * ((angle * 0.005555555555555556) * b);
return pow(a, 2.0) + (t_0 * t_0);
}
public static double code(double a, double b, double angle) {
double t_0 = Math.PI * ((angle * 0.005555555555555556) * b);
return Math.pow(a, 2.0) + (t_0 * t_0);
}
def code(a, b, angle): t_0 = math.pi * ((angle * 0.005555555555555556) * b) return math.pow(a, 2.0) + (t_0 * t_0)
function code(a, b, angle) t_0 = Float64(pi * Float64(Float64(angle * 0.005555555555555556) * b)) return Float64((a ^ 2.0) + Float64(t_0 * t_0)) end
function tmp = code(a, b, angle) t_0 = pi * ((angle * 0.005555555555555556) * b); tmp = (a ^ 2.0) + (t_0 * t_0); end
code[a_, b_, angle_] := Block[{t$95$0 = N[(Pi * N[(N[(angle * 0.005555555555555556), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]}, N[(N[Power[a, 2.0], $MachinePrecision] + N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \pi \cdot \left(\left(angle \cdot 0.005555555555555556\right) \cdot b\right)\\
{a}^{2} + t\_0 \cdot t\_0
\end{array}
\end{array}
Initial program 84.3%
associate-*r/84.2%
metadata-eval84.2%
metadata-eval84.2%
distribute-neg-frac284.2%
distribute-frac-neg84.2%
distribute-rgt-neg-out84.2%
associate-/l*84.3%
neg-mul-184.3%
*-commutative84.3%
associate-/l*84.3%
metadata-eval84.3%
metadata-eval84.3%
Simplified84.5%
Taylor expanded in angle around 0 83.9%
Taylor expanded in angle around 0 79.4%
unpow279.4%
*-commutative79.4%
*-commutative79.4%
associate-*r*79.4%
*-commutative79.4%
*-commutative79.4%
associate-*l*79.5%
associate-*r*79.5%
*-commutative79.5%
*-commutative79.5%
associate-*l*79.5%
Applied egg-rr79.5%
Final simplification79.5%
herbie shell --seed 2024100
(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)))