
(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 8 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}
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow (* a (cos (* PI (* angle_m 0.005555555555555556)))) 2.0) (pow (* b (sin (* PI (expm1 (log1p (* angle_m 0.005555555555555556)))))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow((a * cos((((double) M_PI) * (angle_m * 0.005555555555555556)))), 2.0) + pow((b * sin((((double) M_PI) * expm1(log1p((angle_m * 0.005555555555555556)))))), 2.0);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return Math.pow((a * Math.cos((Math.PI * (angle_m * 0.005555555555555556)))), 2.0) + Math.pow((b * Math.sin((Math.PI * Math.expm1(Math.log1p((angle_m * 0.005555555555555556)))))), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow((a * math.cos((math.pi * (angle_m * 0.005555555555555556)))), 2.0) + math.pow((b * math.sin((math.pi * math.expm1(math.log1p((angle_m * 0.005555555555555556)))))), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) return Float64((Float64(a * cos(Float64(pi * Float64(angle_m * 0.005555555555555556)))) ^ 2.0) + (Float64(b * sin(Float64(pi * expm1(log1p(Float64(angle_m * 0.005555555555555556)))))) ^ 2.0)) end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(N[Power[N[(a * N[Cos[N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[N[(Pi * N[(Exp[N[Log[1 + N[(angle$95$m * 0.005555555555555556), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{\left(a \cdot \cos \left(\pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(angle\_m \cdot 0.005555555555555556\right)\right)\right)\right)}^{2}
\end{array}
Initial program 79.8%
associate-*r/79.8%
metadata-eval79.8%
metadata-eval79.8%
distribute-neg-frac279.8%
distribute-frac-neg79.8%
distribute-rgt-neg-out79.8%
associate-/l*79.8%
neg-mul-179.8%
*-commutative79.8%
associate-/l*79.9%
metadata-eval79.9%
metadata-eval79.9%
Simplified80.0%
expm1-log1p-u65.6%
Applied egg-rr65.6%
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
:precision binary64
(let* ((t_0 (cos (* 0.005555555555555556 (* PI angle_m)))))
(+
(* t_0 (* a (* a t_0)))
(pow (* b (sin (* PI (* angle_m 0.005555555555555556)))) 2.0))))angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double t_0 = cos((0.005555555555555556 * (((double) M_PI) * angle_m)));
return (t_0 * (a * (a * t_0))) + pow((b * sin((((double) M_PI) * (angle_m * 0.005555555555555556)))), 2.0);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double t_0 = Math.cos((0.005555555555555556 * (Math.PI * angle_m)));
return (t_0 * (a * (a * t_0))) + Math.pow((b * Math.sin((Math.PI * (angle_m * 0.005555555555555556)))), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): t_0 = math.cos((0.005555555555555556 * (math.pi * angle_m))) return (t_0 * (a * (a * t_0))) + math.pow((b * math.sin((math.pi * (angle_m * 0.005555555555555556)))), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) t_0 = cos(Float64(0.005555555555555556 * Float64(pi * angle_m))) return Float64(Float64(t_0 * Float64(a * Float64(a * t_0))) + (Float64(b * sin(Float64(pi * Float64(angle_m * 0.005555555555555556)))) ^ 2.0)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) t_0 = cos((0.005555555555555556 * (pi * angle_m))); tmp = (t_0 * (a * (a * t_0))) + ((b * sin((pi * (angle_m * 0.005555555555555556)))) ^ 2.0); end
angle_m = N[Abs[angle], $MachinePrecision]
code[a_, b_, angle$95$m_] := Block[{t$95$0 = N[Cos[N[(0.005555555555555556 * N[(Pi * angle$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[(N[(t$95$0 * N[(a * N[(a * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Power[N[(b * N[Sin[N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
t_0 := \cos \left(0.005555555555555556 \cdot \left(\pi \cdot angle\_m\right)\right)\\
t\_0 \cdot \left(a \cdot \left(a \cdot t\_0\right)\right) + {\left(b \cdot \sin \left(\pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)\right)\right)}^{2}
\end{array}
\end{array}
Initial program 79.8%
associate-*r/79.8%
metadata-eval79.8%
metadata-eval79.8%
distribute-neg-frac279.8%
distribute-frac-neg79.8%
distribute-rgt-neg-out79.8%
associate-/l*79.8%
neg-mul-179.8%
*-commutative79.8%
associate-/l*79.9%
metadata-eval79.9%
metadata-eval79.9%
Simplified80.0%
metadata-eval80.0%
div-inv80.0%
unpow280.0%
associate-*r*80.0%
div-inv77.9%
metadata-eval77.9%
associate-*r*77.4%
*-commutative77.4%
div-inv78.6%
metadata-eval78.6%
associate-*r*80.0%
*-commutative80.0%
Applied egg-rr80.0%
Final simplification80.0%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (let* ((t_0 (* PI (* angle_m 0.005555555555555556)))) (pow (hypot (* b (sin t_0)) (* a (cos t_0))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double t_0 = ((double) M_PI) * (angle_m * 0.005555555555555556);
return pow(hypot((b * sin(t_0)), (a * cos(t_0))), 2.0);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double t_0 = Math.PI * (angle_m * 0.005555555555555556);
return Math.pow(Math.hypot((b * Math.sin(t_0)), (a * Math.cos(t_0))), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): t_0 = math.pi * (angle_m * 0.005555555555555556) return math.pow(math.hypot((b * math.sin(t_0)), (a * math.cos(t_0))), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) t_0 = Float64(pi * Float64(angle_m * 0.005555555555555556)) return hypot(Float64(b * sin(t_0)), Float64(a * cos(t_0))) ^ 2.0 end
angle_m = abs(angle); function tmp = code(a, b, angle_m) t_0 = pi * (angle_m * 0.005555555555555556); tmp = hypot((b * sin(t_0)), (a * cos(t_0))) ^ 2.0; end
angle_m = N[Abs[angle], $MachinePrecision]
code[a_, b_, angle$95$m_] := Block[{t$95$0 = N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]}, N[Power[N[Sqrt[N[(b * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision] ^ 2 + N[(a * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision], 2.0], $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
t_0 := \pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)\\
{\left(\mathsf{hypot}\left(b \cdot \sin t\_0, a \cdot \cos t\_0\right)\right)}^{2}
\end{array}
\end{array}
Initial program 79.8%
associate-*r/79.8%
metadata-eval79.8%
metadata-eval79.8%
distribute-neg-frac279.8%
distribute-frac-neg79.8%
distribute-rgt-neg-out79.8%
associate-/l*79.8%
neg-mul-179.8%
*-commutative79.8%
associate-/l*79.9%
metadata-eval79.9%
metadata-eval79.9%
Simplified80.0%
expm1-log1p-u65.6%
Applied egg-rr65.6%
*-commutative65.6%
associate-*r*65.6%
*-commutative65.6%
*-commutative65.6%
expm1-log1p-u45.4%
unpow245.4%
*-commutative45.4%
expm1-log1p-u56.2%
*-commutative56.2%
Applied egg-rr80.0%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow (* b (sin (* PI (* angle_m 0.005555555555555556)))) 2.0) (pow a 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow((b * sin((((double) M_PI) * (angle_m * 0.005555555555555556)))), 2.0) + pow(a, 2.0);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return Math.pow((b * Math.sin((Math.PI * (angle_m * 0.005555555555555556)))), 2.0) + Math.pow(a, 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow((b * math.sin((math.pi * (angle_m * 0.005555555555555556)))), 2.0) + math.pow(a, 2.0)
angle_m = abs(angle) function code(a, b, angle_m) return Float64((Float64(b * sin(Float64(pi * Float64(angle_m * 0.005555555555555556)))) ^ 2.0) + (a ^ 2.0)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = ((b * sin((pi * (angle_m * 0.005555555555555556)))) ^ 2.0) + (a ^ 2.0); end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(N[Power[N[(b * N[Sin[N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{\left(b \cdot \sin \left(\pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)\right)\right)}^{2} + {a}^{2}
\end{array}
Initial program 79.8%
associate-*r/79.8%
metadata-eval79.8%
metadata-eval79.8%
distribute-neg-frac279.8%
distribute-frac-neg79.8%
distribute-rgt-neg-out79.8%
associate-/l*79.8%
neg-mul-179.8%
*-commutative79.8%
associate-/l*79.9%
metadata-eval79.9%
metadata-eval79.9%
Simplified80.0%
Taylor expanded in angle around 0 79.8%
Final simplification79.8%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (if (<= b 1.3e+130) (pow (* a (cos (* 0.005555555555555556 (* PI angle_m)))) 2.0) (pow (* b (sin (* angle_m (* PI 0.005555555555555556)))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if (b <= 1.3e+130) {
tmp = pow((a * cos((0.005555555555555556 * (((double) M_PI) * angle_m)))), 2.0);
} else {
tmp = pow((b * sin((angle_m * (((double) M_PI) * 0.005555555555555556)))), 2.0);
}
return tmp;
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double tmp;
if (b <= 1.3e+130) {
tmp = Math.pow((a * Math.cos((0.005555555555555556 * (Math.PI * angle_m)))), 2.0);
} else {
tmp = Math.pow((b * Math.sin((angle_m * (Math.PI * 0.005555555555555556)))), 2.0);
}
return tmp;
}
angle_m = math.fabs(angle) def code(a, b, angle_m): tmp = 0 if b <= 1.3e+130: tmp = math.pow((a * math.cos((0.005555555555555556 * (math.pi * angle_m)))), 2.0) else: tmp = math.pow((b * math.sin((angle_m * (math.pi * 0.005555555555555556)))), 2.0) return tmp
angle_m = abs(angle) function code(a, b, angle_m) tmp = 0.0 if (b <= 1.3e+130) tmp = Float64(a * cos(Float64(0.005555555555555556 * Float64(pi * angle_m)))) ^ 2.0; else tmp = Float64(b * sin(Float64(angle_m * Float64(pi * 0.005555555555555556)))) ^ 2.0; end return tmp end
angle_m = abs(angle); function tmp_2 = code(a, b, angle_m) tmp = 0.0; if (b <= 1.3e+130) tmp = (a * cos((0.005555555555555556 * (pi * angle_m)))) ^ 2.0; else tmp = (b * sin((angle_m * (pi * 0.005555555555555556)))) ^ 2.0; end tmp_2 = tmp; end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := If[LessEqual[b, 1.3e+130], N[Power[N[(a * N[Cos[N[(0.005555555555555556 * N[(Pi * angle$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[Power[N[(b * N[Sin[N[(angle$95$m * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.3 \cdot 10^{+130}:\\
\;\;\;\;{\left(a \cdot \cos \left(0.005555555555555556 \cdot \left(\pi \cdot angle\_m\right)\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;{\left(b \cdot \sin \left(angle\_m \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)}^{2}\\
\end{array}
\end{array}
if b < 1.2999999999999999e130Initial program 77.2%
associate-*r/77.2%
metadata-eval77.2%
metadata-eval77.2%
distribute-neg-frac277.2%
distribute-frac-neg77.2%
distribute-rgt-neg-out77.2%
associate-/l*77.2%
neg-mul-177.2%
*-commutative77.2%
associate-/l*77.2%
metadata-eval77.2%
metadata-eval77.2%
Simplified77.4%
Taylor expanded in a around inf 63.5%
*-commutative63.5%
unpow263.5%
unpow263.5%
swap-sqr63.5%
unpow263.5%
*-commutative63.5%
Simplified63.5%
if 1.2999999999999999e130 < b Initial program 94.9%
associate-*r/94.9%
metadata-eval94.9%
metadata-eval94.9%
distribute-neg-frac294.9%
distribute-frac-neg94.9%
distribute-rgt-neg-out94.9%
associate-/l*94.9%
neg-mul-194.9%
*-commutative94.9%
associate-/l*94.9%
metadata-eval94.9%
metadata-eval94.9%
Simplified95.0%
expm1-log1p-u73.3%
Applied egg-rr73.3%
Taylor expanded in a around 0 77.2%
unpow277.2%
associate-*r*77.2%
*-commutative77.2%
*-commutative77.2%
unpow277.2%
swap-sqr82.4%
unpow282.4%
*-commutative82.4%
associate-*l*82.4%
Simplified82.4%
Final simplification66.3%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (let* ((t_0 (* 0.005555555555555556 (* PI angle_m)))) (if (<= b 3.4e+128) (pow (* a (cos t_0)) 2.0) (pow (* b (sin t_0)) 2.0))))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double t_0 = 0.005555555555555556 * (((double) M_PI) * angle_m);
double tmp;
if (b <= 3.4e+128) {
tmp = pow((a * cos(t_0)), 2.0);
} else {
tmp = pow((b * sin(t_0)), 2.0);
}
return tmp;
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double t_0 = 0.005555555555555556 * (Math.PI * angle_m);
double tmp;
if (b <= 3.4e+128) {
tmp = Math.pow((a * Math.cos(t_0)), 2.0);
} else {
tmp = Math.pow((b * Math.sin(t_0)), 2.0);
}
return tmp;
}
angle_m = math.fabs(angle) def code(a, b, angle_m): t_0 = 0.005555555555555556 * (math.pi * angle_m) tmp = 0 if b <= 3.4e+128: tmp = math.pow((a * math.cos(t_0)), 2.0) else: tmp = math.pow((b * math.sin(t_0)), 2.0) return tmp
angle_m = abs(angle) function code(a, b, angle_m) t_0 = Float64(0.005555555555555556 * Float64(pi * angle_m)) tmp = 0.0 if (b <= 3.4e+128) tmp = Float64(a * cos(t_0)) ^ 2.0; else tmp = Float64(b * sin(t_0)) ^ 2.0; end return tmp end
angle_m = abs(angle); function tmp_2 = code(a, b, angle_m) t_0 = 0.005555555555555556 * (pi * angle_m); tmp = 0.0; if (b <= 3.4e+128) tmp = (a * cos(t_0)) ^ 2.0; else tmp = (b * sin(t_0)) ^ 2.0; end tmp_2 = tmp; end
angle_m = N[Abs[angle], $MachinePrecision]
code[a_, b_, angle$95$m_] := Block[{t$95$0 = N[(0.005555555555555556 * N[(Pi * angle$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 3.4e+128], 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]]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
t_0 := 0.005555555555555556 \cdot \left(\pi \cdot angle\_m\right)\\
\mathbf{if}\;b \leq 3.4 \cdot 10^{+128}:\\
\;\;\;\;{\left(a \cdot \cos t\_0\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;{\left(b \cdot \sin t\_0\right)}^{2}\\
\end{array}
\end{array}
if b < 3.3999999999999999e128Initial program 77.2%
associate-*r/77.2%
metadata-eval77.2%
metadata-eval77.2%
distribute-neg-frac277.2%
distribute-frac-neg77.2%
distribute-rgt-neg-out77.2%
associate-/l*77.2%
neg-mul-177.2%
*-commutative77.2%
associate-/l*77.2%
metadata-eval77.2%
metadata-eval77.2%
Simplified77.4%
Taylor expanded in a around inf 63.5%
*-commutative63.5%
unpow263.5%
unpow263.5%
swap-sqr63.5%
unpow263.5%
*-commutative63.5%
Simplified63.5%
if 3.3999999999999999e128 < b Initial program 94.9%
associate-*r/94.9%
metadata-eval94.9%
metadata-eval94.9%
distribute-neg-frac294.9%
distribute-frac-neg94.9%
distribute-rgt-neg-out94.9%
associate-/l*94.9%
neg-mul-194.9%
*-commutative94.9%
associate-/l*94.9%
metadata-eval94.9%
metadata-eval94.9%
Simplified95.0%
Taylor expanded in a around 0 77.2%
unpow277.2%
*-commutative77.2%
unpow277.2%
swap-sqr82.4%
unpow282.4%
*-commutative82.4%
Simplified82.4%
Final simplification66.3%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (pow (* a (cos (* 0.005555555555555556 (* PI angle_m)))) 2.0))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow((a * cos((0.005555555555555556 * (((double) M_PI) * angle_m)))), 2.0);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return Math.pow((a * Math.cos((0.005555555555555556 * (Math.PI * angle_m)))), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow((a * math.cos((0.005555555555555556 * (math.pi * angle_m)))), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) return Float64(a * cos(Float64(0.005555555555555556 * Float64(pi * angle_m)))) ^ 2.0 end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = (a * cos((0.005555555555555556 * (pi * angle_m)))) ^ 2.0; end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[Power[N[(a * N[Cos[N[(0.005555555555555556 * N[(Pi * angle$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{\left(a \cdot \cos \left(0.005555555555555556 \cdot \left(\pi \cdot angle\_m\right)\right)\right)}^{2}
\end{array}
Initial program 79.8%
associate-*r/79.8%
metadata-eval79.8%
metadata-eval79.8%
distribute-neg-frac279.8%
distribute-frac-neg79.8%
distribute-rgt-neg-out79.8%
associate-/l*79.8%
neg-mul-179.8%
*-commutative79.8%
associate-/l*79.9%
metadata-eval79.9%
metadata-eval79.9%
Simplified80.0%
Taylor expanded in a around inf 59.4%
*-commutative59.4%
unpow259.4%
unpow259.4%
swap-sqr59.4%
unpow259.4%
*-commutative59.4%
Simplified59.4%
Final simplification59.4%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (* a a))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return a * a;
}
angle_m = abs(angle)
real(8) function code(a, b, angle_m)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle_m
code = a * a
end function
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return a * a;
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return a * a
angle_m = abs(angle) function code(a, b, angle_m) return Float64(a * a) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = a * a; end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(a * a), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
a \cdot a
\end{array}
Initial program 79.8%
associate-*r/79.8%
metadata-eval79.8%
metadata-eval79.8%
distribute-neg-frac279.8%
distribute-frac-neg79.8%
distribute-rgt-neg-out79.8%
associate-/l*79.8%
neg-mul-179.8%
*-commutative79.8%
associate-/l*79.9%
metadata-eval79.9%
metadata-eval79.9%
Simplified80.0%
Taylor expanded in angle around 0 59.2%
unpow259.2%
Applied egg-rr59.2%
herbie shell --seed 2024170
(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)))