
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* (/ angle 180.0) PI))) (+ (pow (* a (sin t_0)) 2.0) (pow (* b (cos t_0)) 2.0))))
double code(double a, double b, double angle) {
double t_0 = (angle / 180.0) * ((double) M_PI);
return pow((a * sin(t_0)), 2.0) + pow((b * cos(t_0)), 2.0);
}
public static double code(double a, double b, double angle) {
double t_0 = (angle / 180.0) * Math.PI;
return Math.pow((a * Math.sin(t_0)), 2.0) + Math.pow((b * Math.cos(t_0)), 2.0);
}
def code(a, b, angle): t_0 = (angle / 180.0) * math.pi return math.pow((a * math.sin(t_0)), 2.0) + math.pow((b * math.cos(t_0)), 2.0)
function code(a, b, angle) t_0 = Float64(Float64(angle / 180.0) * pi) return Float64((Float64(a * sin(t_0)) ^ 2.0) + (Float64(b * cos(t_0)) ^ 2.0)) end
function tmp = code(a, b, angle) t_0 = (angle / 180.0) * pi; tmp = ((a * sin(t_0)) ^ 2.0) + ((b * cos(t_0)) ^ 2.0); end
code[a_, b_, angle_] := Block[{t$95$0 = N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]}, N[(N[Power[N[(a * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{angle}{180} \cdot \pi\\
{\left(a \cdot \sin t\_0\right)}^{2} + {\left(b \cdot \cos 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 (* (/ angle 180.0) PI))) (+ (pow (* a (sin t_0)) 2.0) (pow (* b (cos t_0)) 2.0))))
double code(double a, double b, double angle) {
double t_0 = (angle / 180.0) * ((double) M_PI);
return pow((a * sin(t_0)), 2.0) + pow((b * cos(t_0)), 2.0);
}
public static double code(double a, double b, double angle) {
double t_0 = (angle / 180.0) * Math.PI;
return Math.pow((a * Math.sin(t_0)), 2.0) + Math.pow((b * Math.cos(t_0)), 2.0);
}
def code(a, b, angle): t_0 = (angle / 180.0) * math.pi return math.pow((a * math.sin(t_0)), 2.0) + math.pow((b * math.cos(t_0)), 2.0)
function code(a, b, angle) t_0 = Float64(Float64(angle / 180.0) * pi) return Float64((Float64(a * sin(t_0)) ^ 2.0) + (Float64(b * cos(t_0)) ^ 2.0)) end
function tmp = code(a, b, angle) t_0 = (angle / 180.0) * pi; tmp = ((a * sin(t_0)) ^ 2.0) + ((b * cos(t_0)) ^ 2.0); end
code[a_, b_, angle_] := Block[{t$95$0 = N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]}, N[(N[Power[N[(a * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{angle}{180} \cdot \pi\\
{\left(a \cdot \sin t\_0\right)}^{2} + {\left(b \cdot \cos t\_0\right)}^{2}
\end{array}
\end{array}
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow (* a (sin (expm1 (log1p (* angle_m (* PI 0.005555555555555556)))))) 2.0) (pow (* b (cos (* PI (/ angle_m 180.0)))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow((a * sin(expm1(log1p((angle_m * (((double) M_PI) * 0.005555555555555556)))))), 2.0) + pow((b * cos((((double) M_PI) * (angle_m / 180.0)))), 2.0);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return Math.pow((a * Math.sin(Math.expm1(Math.log1p((angle_m * (Math.PI * 0.005555555555555556)))))), 2.0) + Math.pow((b * Math.cos((Math.PI * (angle_m / 180.0)))), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow((a * math.sin(math.expm1(math.log1p((angle_m * (math.pi * 0.005555555555555556)))))), 2.0) + math.pow((b * math.cos((math.pi * (angle_m / 180.0)))), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) return Float64((Float64(a * sin(expm1(log1p(Float64(angle_m * Float64(pi * 0.005555555555555556)))))) ^ 2.0) + (Float64(b * cos(Float64(pi * Float64(angle_m / 180.0)))) ^ 2.0)) end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(N[Power[N[(a * N[Sin[N[(Exp[N[Log[1 + N[(angle$95$m * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[N[(Pi * N[(angle$95$m / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{\left(a \cdot \sin \left(\mathsf{expm1}\left(\mathsf{log1p}\left(angle\_m \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)\right)\right)}^{2} + {\left(b \cdot \cos \left(\pi \cdot \frac{angle\_m}{180}\right)\right)}^{2}
\end{array}
Initial program 81.0%
expm1-log1p-u63.2%
expm1-undefine52.0%
associate-*l/52.0%
associate-*r/52.0%
div-inv52.0%
metadata-eval52.0%
Applied egg-rr52.0%
expm1-define63.2%
Simplified63.2%
Final simplification63.2%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (let* ((t_0 (* PI (/ angle_m 180.0)))) (+ (pow (* b (cos t_0)) 2.0) (pow (* a (sin 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 / 180.0);
return pow((b * cos(t_0)), 2.0) + pow((a * sin(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 / 180.0);
return Math.pow((b * Math.cos(t_0)), 2.0) + Math.pow((a * Math.sin(t_0)), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): t_0 = math.pi * (angle_m / 180.0) return math.pow((b * math.cos(t_0)), 2.0) + math.pow((a * math.sin(t_0)), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) t_0 = Float64(pi * Float64(angle_m / 180.0)) return Float64((Float64(b * cos(t_0)) ^ 2.0) + (Float64(a * sin(t_0)) ^ 2.0)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) t_0 = pi * (angle_m / 180.0); tmp = ((b * cos(t_0)) ^ 2.0) + ((a * sin(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 / 180.0), $MachinePrecision]), $MachinePrecision]}, N[(N[Power[N[(b * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(a * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
t_0 := \pi \cdot \frac{angle\_m}{180}\\
{\left(b \cdot \cos t\_0\right)}^{2} + {\left(a \cdot \sin t\_0\right)}^{2}
\end{array}
\end{array}
Initial program 81.0%
Final simplification81.0%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (let* ((t_0 (* angle_m (/ PI 180.0)))) (+ (pow (* a (sin t_0)) 2.0) (pow (* b (cos t_0)) 2.0))))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double t_0 = angle_m * (((double) M_PI) / 180.0);
return pow((a * sin(t_0)), 2.0) + pow((b * cos(t_0)), 2.0);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double t_0 = angle_m * (Math.PI / 180.0);
return Math.pow((a * Math.sin(t_0)), 2.0) + Math.pow((b * Math.cos(t_0)), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): t_0 = angle_m * (math.pi / 180.0) return math.pow((a * math.sin(t_0)), 2.0) + math.pow((b * math.cos(t_0)), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) t_0 = Float64(angle_m * Float64(pi / 180.0)) return Float64((Float64(a * sin(t_0)) ^ 2.0) + (Float64(b * cos(t_0)) ^ 2.0)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) t_0 = angle_m * (pi / 180.0); tmp = ((a * sin(t_0)) ^ 2.0) + ((b * cos(t_0)) ^ 2.0); end
angle_m = N[Abs[angle], $MachinePrecision]
code[a_, b_, angle$95$m_] := Block[{t$95$0 = N[(angle$95$m * N[(Pi / 180.0), $MachinePrecision]), $MachinePrecision]}, N[(N[Power[N[(a * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
t_0 := angle\_m \cdot \frac{\pi}{180}\\
{\left(a \cdot \sin t\_0\right)}^{2} + {\left(b \cdot \cos t\_0\right)}^{2}
\end{array}
\end{array}
Initial program 81.0%
associate-*l/81.0%
associate-/l*81.0%
cos-neg81.0%
distribute-lft-neg-out81.0%
distribute-frac-neg81.0%
distribute-frac-neg81.0%
distribute-lft-neg-out81.0%
cos-neg81.0%
associate-*l/80.9%
associate-/l*80.9%
Simplified80.9%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (let* ((t_0 (* PI (* angle_m 0.005555555555555556)))) (pow (hypot (* a (sin t_0)) (* b (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((a * sin(t_0)), (b * 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((a * Math.sin(t_0)), (b * 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((a * math.sin(t_0)), (b * 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(a * sin(t_0)), Float64(b * 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((a * sin(t_0)), (b * 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[(a * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision] ^ 2 + N[(b * 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(a \cdot \sin t\_0, b \cdot \cos t\_0\right)\right)}^{2}
\end{array}
\end{array}
Initial program 81.0%
associate-*l/81.0%
associate-/l*81.0%
cos-neg81.0%
distribute-lft-neg-out81.0%
distribute-frac-neg81.0%
distribute-frac-neg81.0%
distribute-lft-neg-out81.0%
cos-neg81.0%
associate-*l/80.9%
associate-/l*80.9%
Simplified80.9%
Applied egg-rr51.5%
Applied egg-rr80.9%
Final simplification80.9%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow (* a (sin (* PI (/ angle_m 180.0)))) 2.0) (pow b 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow((a * sin((((double) M_PI) * (angle_m / 180.0)))), 2.0) + pow(b, 2.0);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return Math.pow((a * Math.sin((Math.PI * (angle_m / 180.0)))), 2.0) + Math.pow(b, 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow((a * math.sin((math.pi * (angle_m / 180.0)))), 2.0) + math.pow(b, 2.0)
angle_m = abs(angle) function code(a, b, angle_m) return Float64((Float64(a * sin(Float64(pi * Float64(angle_m / 180.0)))) ^ 2.0) + (b ^ 2.0)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = ((a * sin((pi * (angle_m / 180.0)))) ^ 2.0) + (b ^ 2.0); end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(N[Power[N[(a * N[Sin[N[(Pi * N[(angle$95$m / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{\left(a \cdot \sin \left(\pi \cdot \frac{angle\_m}{180}\right)\right)}^{2} + {b}^{2}
\end{array}
Initial program 81.0%
associate-*l/80.9%
clear-num80.9%
Applied egg-rr80.9%
Taylor expanded in angle around 0 80.9%
Final simplification80.9%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (if (<= a 3.2e+148) (* b b) (pow (* a (sin (* angle_m (* PI 0.005555555555555556)))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if (a <= 3.2e+148) {
tmp = b * b;
} else {
tmp = pow((a * 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 (a <= 3.2e+148) {
tmp = b * b;
} else {
tmp = Math.pow((a * 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 a <= 3.2e+148: tmp = b * b else: tmp = math.pow((a * 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 (a <= 3.2e+148) tmp = Float64(b * b); else tmp = Float64(a * 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 (a <= 3.2e+148) tmp = b * b; else tmp = (a * 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[a, 3.2e+148], N[(b * b), $MachinePrecision], N[Power[N[(a * 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}\;a \leq 3.2 \cdot 10^{+148}:\\
\;\;\;\;b \cdot b\\
\mathbf{else}:\\
\;\;\;\;{\left(a \cdot \sin \left(angle\_m \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)}^{2}\\
\end{array}
\end{array}
if a < 3.1999999999999999e148Initial program 78.5%
associate-*l/78.5%
associate-/l*78.4%
cos-neg78.4%
distribute-lft-neg-out78.4%
distribute-frac-neg78.4%
distribute-frac-neg78.4%
distribute-lft-neg-out78.4%
cos-neg78.4%
associate-*l/78.4%
associate-/l*78.4%
Simplified78.4%
Taylor expanded in angle around 0 63.1%
unpow263.1%
Applied egg-rr63.1%
if 3.1999999999999999e148 < a Initial program 97.4%
associate-*l/97.3%
associate-/l*97.5%
cos-neg97.5%
distribute-lft-neg-out97.5%
distribute-frac-neg97.5%
distribute-frac-neg97.5%
distribute-lft-neg-out97.5%
cos-neg97.5%
associate-*l/97.5%
associate-/l*97.5%
Simplified97.5%
Applied egg-rr66.8%
Applied egg-rr77.2%
Taylor expanded in a around -inf 71.8%
mul-1-neg71.8%
associate-*r*71.8%
*-commutative71.8%
associate-*l*71.8%
*-commutative71.8%
distribute-rgt-neg-in71.8%
associate-*r*71.8%
*-commutative71.8%
*-commutative71.8%
*-commutative71.8%
Simplified71.8%
Applied egg-rr84.2%
Final simplification65.9%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (if (<= a 1.1e+148) (* b b) (pow (* a (sin (* PI (* angle_m 0.005555555555555556)))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if (a <= 1.1e+148) {
tmp = b * b;
} else {
tmp = pow((a * sin((((double) M_PI) * (angle_m * 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 (a <= 1.1e+148) {
tmp = b * b;
} else {
tmp = Math.pow((a * Math.sin((Math.PI * (angle_m * 0.005555555555555556)))), 2.0);
}
return tmp;
}
angle_m = math.fabs(angle) def code(a, b, angle_m): tmp = 0 if a <= 1.1e+148: tmp = b * b else: tmp = math.pow((a * math.sin((math.pi * (angle_m * 0.005555555555555556)))), 2.0) return tmp
angle_m = abs(angle) function code(a, b, angle_m) tmp = 0.0 if (a <= 1.1e+148) tmp = Float64(b * b); else tmp = Float64(a * sin(Float64(pi * Float64(angle_m * 0.005555555555555556)))) ^ 2.0; end return tmp end
angle_m = abs(angle); function tmp_2 = code(a, b, angle_m) tmp = 0.0; if (a <= 1.1e+148) tmp = b * b; else tmp = (a * sin((pi * (angle_m * 0.005555555555555556)))) ^ 2.0; end tmp_2 = tmp; end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := If[LessEqual[a, 1.1e+148], N[(b * b), $MachinePrecision], N[Power[N[(a * N[Sin[N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
\mathbf{if}\;a \leq 1.1 \cdot 10^{+148}:\\
\;\;\;\;b \cdot b\\
\mathbf{else}:\\
\;\;\;\;{\left(a \cdot \sin \left(\pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)\right)\right)}^{2}\\
\end{array}
\end{array}
if a < 1.0999999999999999e148Initial program 78.5%
associate-*l/78.5%
associate-/l*78.4%
cos-neg78.4%
distribute-lft-neg-out78.4%
distribute-frac-neg78.4%
distribute-frac-neg78.4%
distribute-lft-neg-out78.4%
cos-neg78.4%
associate-*l/78.4%
associate-/l*78.4%
Simplified78.4%
Taylor expanded in angle around 0 63.1%
unpow263.1%
Applied egg-rr63.1%
if 1.0999999999999999e148 < a Initial program 97.4%
associate-*l/97.3%
associate-/l*97.5%
cos-neg97.5%
distribute-lft-neg-out97.5%
distribute-frac-neg97.5%
distribute-frac-neg97.5%
distribute-lft-neg-out97.5%
cos-neg97.5%
associate-*l/97.5%
associate-/l*97.5%
Simplified97.5%
Applied egg-rr66.8%
Applied egg-rr77.2%
Taylor expanded in a around inf 66.7%
*-commutative66.7%
associate-*r*66.8%
*-commutative66.8%
associate-*l*66.9%
*-commutative66.9%
unpow266.9%
unpow266.9%
swap-sqr84.2%
unpow284.2%
*-commutative84.2%
*-commutative84.2%
associate-*l*84.1%
Simplified84.1%
Final simplification65.9%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (* b b))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return b * b;
}
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 = b * b
end function
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return b * b;
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return b * b
angle_m = abs(angle) function code(a, b, angle_m) return Float64(b * b) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = b * b; end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(b * b), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
b \cdot b
\end{array}
Initial program 81.0%
associate-*l/81.0%
associate-/l*81.0%
cos-neg81.0%
distribute-lft-neg-out81.0%
distribute-frac-neg81.0%
distribute-frac-neg81.0%
distribute-lft-neg-out81.0%
cos-neg81.0%
associate-*l/80.9%
associate-/l*80.9%
Simplified80.9%
Taylor expanded in angle around 0 59.3%
unpow259.3%
Applied egg-rr59.3%
herbie shell --seed 2024123
(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)))