
(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 12 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 (let* ((t_0 (* angle_m (* PI 0.005555555555555556)))) (pow (hypot (* a (sin t_0)) (* b (cos (pow (sqrt t_0) 2.0)))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double t_0 = angle_m * (((double) M_PI) * 0.005555555555555556);
return pow(hypot((a * sin(t_0)), (b * cos(pow(sqrt(t_0), 2.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 * 0.005555555555555556);
return Math.pow(Math.hypot((a * Math.sin(t_0)), (b * Math.cos(Math.pow(Math.sqrt(t_0), 2.0)))), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): t_0 = angle_m * (math.pi * 0.005555555555555556) return math.pow(math.hypot((a * math.sin(t_0)), (b * math.cos(math.pow(math.sqrt(t_0), 2.0)))), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) t_0 = Float64(angle_m * Float64(pi * 0.005555555555555556)) return hypot(Float64(a * sin(t_0)), Float64(b * cos((sqrt(t_0) ^ 2.0)))) ^ 2.0 end
angle_m = abs(angle); function tmp = code(a, b, angle_m) t_0 = angle_m * (pi * 0.005555555555555556); tmp = hypot((a * sin(t_0)), (b * cos((sqrt(t_0) ^ 2.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 * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]}, N[Power[N[Sqrt[N[(a * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision] ^ 2 + N[(b * N[Cos[N[Power[N[Sqrt[t$95$0], $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision], 2.0], $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
t_0 := angle\_m \cdot \left(\pi \cdot 0.005555555555555556\right)\\
{\left(\mathsf{hypot}\left(a \cdot \sin t\_0, b \cdot \cos \left({\left(\sqrt{t\_0}\right)}^{2}\right)\right)\right)}^{2}
\end{array}
\end{array}
Initial program 80.0%
associate-*l/80.1%
associate-/l*80.1%
cos-neg80.1%
distribute-lft-neg-out80.1%
distribute-frac-neg80.1%
distribute-frac-neg80.1%
distribute-lft-neg-out80.1%
cos-neg80.1%
associate-*l/80.2%
associate-/l*80.1%
Simplified80.1%
Applied egg-rr80.2%
add-sqr-sqrt39.8%
pow239.8%
Applied egg-rr39.8%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (pow (hypot (* a (sin (* angle_m (* PI 0.005555555555555556)))) (* b (cos (/ 1.0 (/ 180.0 (* angle_m PI)))))) 2.0))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow(hypot((a * sin((angle_m * (((double) M_PI) * 0.005555555555555556)))), (b * cos((1.0 / (180.0 / (angle_m * ((double) M_PI))))))), 2.0);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return Math.pow(Math.hypot((a * Math.sin((angle_m * (Math.PI * 0.005555555555555556)))), (b * Math.cos((1.0 / (180.0 / (angle_m * Math.PI)))))), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow(math.hypot((a * math.sin((angle_m * (math.pi * 0.005555555555555556)))), (b * math.cos((1.0 / (180.0 / (angle_m * math.pi)))))), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) return hypot(Float64(a * sin(Float64(angle_m * Float64(pi * 0.005555555555555556)))), Float64(b * cos(Float64(1.0 / Float64(180.0 / Float64(angle_m * pi)))))) ^ 2.0 end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = hypot((a * sin((angle_m * (pi * 0.005555555555555556)))), (b * cos((1.0 / (180.0 / (angle_m * pi)))))) ^ 2.0; end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[Power[N[Sqrt[N[(a * N[Sin[N[(angle$95$m * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] ^ 2 + N[(b * N[Cos[N[(1.0 / N[(180.0 / N[(angle$95$m * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision], 2.0], $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{\left(\mathsf{hypot}\left(a \cdot \sin \left(angle\_m \cdot \left(\pi \cdot 0.005555555555555556\right)\right), b \cdot \cos \left(\frac{1}{\frac{180}{angle\_m \cdot \pi}}\right)\right)\right)}^{2}
\end{array}
Initial program 80.0%
associate-*l/80.1%
associate-/l*80.1%
cos-neg80.1%
distribute-lft-neg-out80.1%
distribute-frac-neg80.1%
distribute-frac-neg80.1%
distribute-lft-neg-out80.1%
cos-neg80.1%
associate-*l/80.2%
associate-/l*80.1%
Simplified80.1%
Applied egg-rr80.2%
associate-*r*80.1%
metadata-eval80.1%
div-inv80.2%
clear-num80.2%
Applied egg-rr80.2%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (pow (hypot (* a (sin (* angle_m (* PI 0.005555555555555556)))) (* b (cos (/ (* angle_m PI) 180.0)))) 2.0))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow(hypot((a * sin((angle_m * (((double) M_PI) * 0.005555555555555556)))), (b * cos(((angle_m * ((double) M_PI)) / 180.0)))), 2.0);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return Math.pow(Math.hypot((a * Math.sin((angle_m * (Math.PI * 0.005555555555555556)))), (b * Math.cos(((angle_m * Math.PI) / 180.0)))), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow(math.hypot((a * math.sin((angle_m * (math.pi * 0.005555555555555556)))), (b * math.cos(((angle_m * math.pi) / 180.0)))), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) return hypot(Float64(a * sin(Float64(angle_m * Float64(pi * 0.005555555555555556)))), Float64(b * cos(Float64(Float64(angle_m * pi) / 180.0)))) ^ 2.0 end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = hypot((a * sin((angle_m * (pi * 0.005555555555555556)))), (b * cos(((angle_m * pi) / 180.0)))) ^ 2.0; end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[Power[N[Sqrt[N[(a * N[Sin[N[(angle$95$m * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] ^ 2 + N[(b * N[Cos[N[(N[(angle$95$m * Pi), $MachinePrecision] / 180.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision], 2.0], $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{\left(\mathsf{hypot}\left(a \cdot \sin \left(angle\_m \cdot \left(\pi \cdot 0.005555555555555556\right)\right), b \cdot \cos \left(\frac{angle\_m \cdot \pi}{180}\right)\right)\right)}^{2}
\end{array}
Initial program 80.0%
associate-*l/80.1%
associate-/l*80.1%
cos-neg80.1%
distribute-lft-neg-out80.1%
distribute-frac-neg80.1%
distribute-frac-neg80.1%
distribute-lft-neg-out80.1%
cos-neg80.1%
associate-*l/80.2%
associate-/l*80.1%
Simplified80.1%
Applied egg-rr80.2%
associate-*r*80.1%
metadata-eval80.1%
div-inv80.2%
Applied egg-rr80.2%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (let* ((t_0 (* angle_m (* PI 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 = angle_m * (((double) M_PI) * 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 = angle_m * (Math.PI * 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 = angle_m * (math.pi * 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(angle_m * Float64(pi * 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 = angle_m * (pi * 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[(angle$95$m * N[(Pi * 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 := angle\_m \cdot \left(\pi \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 80.0%
associate-*l/80.1%
associate-/l*80.1%
cos-neg80.1%
distribute-lft-neg-out80.1%
distribute-frac-neg80.1%
distribute-frac-neg80.1%
distribute-lft-neg-out80.1%
cos-neg80.1%
associate-*l/80.2%
associate-/l*80.1%
Simplified80.1%
Applied egg-rr80.2%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (pow (hypot (* a (sin (/ (* angle_m PI) 180.0))) b) 2.0))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow(hypot((a * sin(((angle_m * ((double) M_PI)) / 180.0))), b), 2.0);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return Math.pow(Math.hypot((a * Math.sin(((angle_m * Math.PI) / 180.0))), b), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow(math.hypot((a * math.sin(((angle_m * math.pi) / 180.0))), b), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) return hypot(Float64(a * sin(Float64(Float64(angle_m * pi) / 180.0))), b) ^ 2.0 end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = hypot((a * sin(((angle_m * pi) / 180.0))), b) ^ 2.0; end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[Power[N[Sqrt[N[(a * N[Sin[N[(N[(angle$95$m * Pi), $MachinePrecision] / 180.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] ^ 2 + b ^ 2], $MachinePrecision], 2.0], $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{\left(\mathsf{hypot}\left(a \cdot \sin \left(\frac{angle\_m \cdot \pi}{180}\right), b\right)\right)}^{2}
\end{array}
Initial program 80.0%
associate-*l/80.1%
associate-/l*80.1%
cos-neg80.1%
distribute-lft-neg-out80.1%
distribute-frac-neg80.1%
distribute-frac-neg80.1%
distribute-lft-neg-out80.1%
cos-neg80.1%
associate-*l/80.2%
associate-/l*80.1%
Simplified80.1%
Applied egg-rr80.2%
associate-*r*80.1%
metadata-eval80.1%
div-inv80.2%
Applied egg-rr80.2%
Taylor expanded in angle around 0 79.8%
Final simplification79.8%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (pow (hypot (* a (sin (* angle_m (* PI 0.005555555555555556)))) b) 2.0))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow(hypot((a * sin((angle_m * (((double) M_PI) * 0.005555555555555556)))), b), 2.0);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return Math.pow(Math.hypot((a * Math.sin((angle_m * (Math.PI * 0.005555555555555556)))), b), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow(math.hypot((a * math.sin((angle_m * (math.pi * 0.005555555555555556)))), b), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) return hypot(Float64(a * sin(Float64(angle_m * Float64(pi * 0.005555555555555556)))), b) ^ 2.0 end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = hypot((a * sin((angle_m * (pi * 0.005555555555555556)))), b) ^ 2.0; end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[Power[N[Sqrt[N[(a * N[Sin[N[(angle$95$m * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] ^ 2 + b ^ 2], $MachinePrecision], 2.0], $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{\left(\mathsf{hypot}\left(a \cdot \sin \left(angle\_m \cdot \left(\pi \cdot 0.005555555555555556\right)\right), b\right)\right)}^{2}
\end{array}
Initial program 80.0%
associate-*l/80.1%
associate-/l*80.1%
cos-neg80.1%
distribute-lft-neg-out80.1%
distribute-frac-neg80.1%
distribute-frac-neg80.1%
distribute-lft-neg-out80.1%
cos-neg80.1%
associate-*l/80.2%
associate-/l*80.1%
Simplified80.1%
Applied egg-rr80.2%
Taylor expanded in angle around 0 79.8%
Final simplification79.8%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (let* ((t_0 (* angle_m (* PI 0.005555555555555556)))) (if (<= b 4.2e-65) (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) * 0.005555555555555556);
double tmp;
if (b <= 4.2e-65) {
tmp = pow((a * sin(t_0)), 2.0);
} else {
tmp = pow((b * cos(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 = angle_m * (Math.PI * 0.005555555555555556);
double tmp;
if (b <= 4.2e-65) {
tmp = Math.pow((a * Math.sin(t_0)), 2.0);
} else {
tmp = Math.pow((b * Math.cos(t_0)), 2.0);
}
return tmp;
}
angle_m = math.fabs(angle) def code(a, b, angle_m): t_0 = angle_m * (math.pi * 0.005555555555555556) tmp = 0 if b <= 4.2e-65: tmp = math.pow((a * math.sin(t_0)), 2.0) else: tmp = math.pow((b * math.cos(t_0)), 2.0) return tmp
angle_m = abs(angle) function code(a, b, angle_m) t_0 = Float64(angle_m * Float64(pi * 0.005555555555555556)) tmp = 0.0 if (b <= 4.2e-65) tmp = Float64(a * sin(t_0)) ^ 2.0; else tmp = Float64(b * cos(t_0)) ^ 2.0; end return tmp end
angle_m = abs(angle); function tmp_2 = code(a, b, angle_m) t_0 = angle_m * (pi * 0.005555555555555556); tmp = 0.0; if (b <= 4.2e-65) tmp = (a * sin(t_0)) ^ 2.0; else tmp = (b * cos(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[(angle$95$m * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 4.2e-65], 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]]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
t_0 := angle\_m \cdot \left(\pi \cdot 0.005555555555555556\right)\\
\mathbf{if}\;b \leq 4.2 \cdot 10^{-65}:\\
\;\;\;\;{\left(a \cdot \sin t\_0\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;{\left(b \cdot \cos t\_0\right)}^{2}\\
\end{array}
\end{array}
if b < 4.20000000000000006e-65Initial program 77.7%
associate-*l/77.8%
associate-/l*77.9%
cos-neg77.9%
distribute-lft-neg-out77.9%
distribute-frac-neg77.9%
distribute-frac-neg77.9%
distribute-lft-neg-out77.9%
cos-neg77.9%
associate-*l/78.0%
associate-/l*77.9%
Simplified77.9%
Applied egg-rr77.9%
associate-*r*78.0%
metadata-eval78.0%
div-inv78.0%
Applied egg-rr77.9%
Taylor expanded in a around inf 41.9%
unpow241.9%
unpow241.9%
swap-sqr47.9%
unpow247.9%
associate-*r*47.8%
*-commutative47.8%
associate-*r*47.9%
*-commutative47.9%
Simplified47.9%
if 4.20000000000000006e-65 < b Initial program 85.5%
associate-*l/85.5%
associate-/l*85.5%
cos-neg85.5%
distribute-lft-neg-out85.5%
distribute-frac-neg85.5%
distribute-frac-neg85.5%
distribute-lft-neg-out85.5%
cos-neg85.5%
associate-*l/85.7%
associate-/l*85.7%
Simplified85.7%
Applied egg-rr85.7%
associate-*r*85.4%
metadata-eval85.4%
div-inv85.7%
Applied egg-rr85.7%
Taylor expanded in a around 0 67.9%
unpow267.9%
unpow267.9%
swap-sqr67.9%
unpow267.9%
associate-*r*68.0%
*-commutative68.0%
associate-*r*68.2%
*-commutative68.2%
Simplified68.2%
Final simplification53.7%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (if (<= b 3.4e-65) (pow (* a (sin (* angle_m (* PI 0.005555555555555556)))) 2.0) (pow (* b (cos (* PI (* angle_m 0.005555555555555556)))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if (b <= 3.4e-65) {
tmp = pow((a * sin((angle_m * (((double) M_PI) * 0.005555555555555556)))), 2.0);
} else {
tmp = pow((b * cos((((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 (b <= 3.4e-65) {
tmp = Math.pow((a * Math.sin((angle_m * (Math.PI * 0.005555555555555556)))), 2.0);
} else {
tmp = Math.pow((b * Math.cos((Math.PI * (angle_m * 0.005555555555555556)))), 2.0);
}
return tmp;
}
angle_m = math.fabs(angle) def code(a, b, angle_m): tmp = 0 if b <= 3.4e-65: tmp = math.pow((a * math.sin((angle_m * (math.pi * 0.005555555555555556)))), 2.0) else: tmp = math.pow((b * math.cos((math.pi * (angle_m * 0.005555555555555556)))), 2.0) return tmp
angle_m = abs(angle) function code(a, b, angle_m) tmp = 0.0 if (b <= 3.4e-65) tmp = Float64(a * sin(Float64(angle_m * Float64(pi * 0.005555555555555556)))) ^ 2.0; else tmp = Float64(b * cos(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 (b <= 3.4e-65) tmp = (a * sin((angle_m * (pi * 0.005555555555555556)))) ^ 2.0; else tmp = (b * cos((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[b, 3.4e-65], N[Power[N[(a * N[Sin[N[(angle$95$m * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[Power[N[(b * N[Cos[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}\;b \leq 3.4 \cdot 10^{-65}:\\
\;\;\;\;{\left(a \cdot \sin \left(angle\_m \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;{\left(b \cdot \cos \left(\pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)\right)\right)}^{2}\\
\end{array}
\end{array}
if b < 3.39999999999999987e-65Initial program 77.7%
associate-*l/77.8%
associate-/l*77.9%
cos-neg77.9%
distribute-lft-neg-out77.9%
distribute-frac-neg77.9%
distribute-frac-neg77.9%
distribute-lft-neg-out77.9%
cos-neg77.9%
associate-*l/78.0%
associate-/l*77.9%
Simplified77.9%
Applied egg-rr77.9%
associate-*r*78.0%
metadata-eval78.0%
div-inv78.0%
Applied egg-rr77.9%
Taylor expanded in a around inf 41.9%
unpow241.9%
unpow241.9%
swap-sqr47.9%
unpow247.9%
associate-*r*47.8%
*-commutative47.8%
associate-*r*47.9%
*-commutative47.9%
Simplified47.9%
if 3.39999999999999987e-65 < b Initial program 85.5%
associate-*l/85.5%
associate-/l*85.5%
cos-neg85.5%
distribute-lft-neg-out85.5%
distribute-frac-neg85.5%
distribute-frac-neg85.5%
distribute-lft-neg-out85.5%
cos-neg85.5%
associate-*l/85.7%
associate-/l*85.7%
Simplified85.7%
Applied egg-rr85.7%
add-sqr-sqrt40.5%
pow240.5%
Applied egg-rr40.5%
Taylor expanded in a around 0 68.2%
Simplified68.0%
Final simplification53.7%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (if (<= b 4e-65) (pow (* a (sin (* angle_m (* PI 0.005555555555555556)))) 2.0) (pow (* b (cos (* 0.005555555555555556 (* angle_m PI)))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if (b <= 4e-65) {
tmp = pow((a * sin((angle_m * (((double) M_PI) * 0.005555555555555556)))), 2.0);
} else {
tmp = pow((b * cos((0.005555555555555556 * (angle_m * ((double) M_PI))))), 2.0);
}
return tmp;
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double tmp;
if (b <= 4e-65) {
tmp = Math.pow((a * Math.sin((angle_m * (Math.PI * 0.005555555555555556)))), 2.0);
} else {
tmp = Math.pow((b * Math.cos((0.005555555555555556 * (angle_m * Math.PI)))), 2.0);
}
return tmp;
}
angle_m = math.fabs(angle) def code(a, b, angle_m): tmp = 0 if b <= 4e-65: tmp = math.pow((a * math.sin((angle_m * (math.pi * 0.005555555555555556)))), 2.0) else: tmp = math.pow((b * math.cos((0.005555555555555556 * (angle_m * math.pi)))), 2.0) return tmp
angle_m = abs(angle) function code(a, b, angle_m) tmp = 0.0 if (b <= 4e-65) tmp = Float64(a * sin(Float64(angle_m * Float64(pi * 0.005555555555555556)))) ^ 2.0; else tmp = Float64(b * cos(Float64(0.005555555555555556 * Float64(angle_m * pi)))) ^ 2.0; end return tmp end
angle_m = abs(angle); function tmp_2 = code(a, b, angle_m) tmp = 0.0; if (b <= 4e-65) tmp = (a * sin((angle_m * (pi * 0.005555555555555556)))) ^ 2.0; else tmp = (b * cos((0.005555555555555556 * (angle_m * pi)))) ^ 2.0; end tmp_2 = tmp; end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := If[LessEqual[b, 4e-65], N[Power[N[(a * N[Sin[N[(angle$95$m * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[Power[N[(b * N[Cos[N[(0.005555555555555556 * N[(angle$95$m * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
\mathbf{if}\;b \leq 4 \cdot 10^{-65}:\\
\;\;\;\;{\left(a \cdot \sin \left(angle\_m \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;{\left(b \cdot \cos \left(0.005555555555555556 \cdot \left(angle\_m \cdot \pi\right)\right)\right)}^{2}\\
\end{array}
\end{array}
if b < 3.99999999999999969e-65Initial program 77.7%
associate-*l/77.8%
associate-/l*77.9%
cos-neg77.9%
distribute-lft-neg-out77.9%
distribute-frac-neg77.9%
distribute-frac-neg77.9%
distribute-lft-neg-out77.9%
cos-neg77.9%
associate-*l/78.0%
associate-/l*77.9%
Simplified77.9%
Applied egg-rr77.9%
associate-*r*78.0%
metadata-eval78.0%
div-inv78.0%
Applied egg-rr77.9%
Taylor expanded in a around inf 41.9%
unpow241.9%
unpow241.9%
swap-sqr47.9%
unpow247.9%
associate-*r*47.8%
*-commutative47.8%
associate-*r*47.9%
*-commutative47.9%
Simplified47.9%
if 3.99999999999999969e-65 < b Initial program 85.5%
associate-*l/85.5%
associate-/l*85.5%
cos-neg85.5%
distribute-lft-neg-out85.5%
distribute-frac-neg85.5%
distribute-frac-neg85.5%
distribute-lft-neg-out85.5%
cos-neg85.5%
associate-*l/85.7%
associate-/l*85.7%
Simplified85.7%
Taylor expanded in a around 0 67.9%
*-commutative67.9%
associate-*r*68.2%
unpow268.2%
unpow268.2%
swap-sqr68.2%
unpow268.2%
associate-*r*67.9%
*-commutative67.9%
Simplified67.9%
Final simplification53.7%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (if (<= b 3.6e-65) (pow (* a (sin (* angle_m (* PI 0.005555555555555556)))) 2.0) (* b b)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if (b <= 3.6e-65) {
tmp = pow((a * sin((angle_m * (((double) M_PI) * 0.005555555555555556)))), 2.0);
} else {
tmp = b * b;
}
return tmp;
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double tmp;
if (b <= 3.6e-65) {
tmp = Math.pow((a * Math.sin((angle_m * (Math.PI * 0.005555555555555556)))), 2.0);
} else {
tmp = b * b;
}
return tmp;
}
angle_m = math.fabs(angle) def code(a, b, angle_m): tmp = 0 if b <= 3.6e-65: tmp = math.pow((a * math.sin((angle_m * (math.pi * 0.005555555555555556)))), 2.0) else: tmp = b * b return tmp
angle_m = abs(angle) function code(a, b, angle_m) tmp = 0.0 if (b <= 3.6e-65) tmp = Float64(a * sin(Float64(angle_m * Float64(pi * 0.005555555555555556)))) ^ 2.0; else tmp = Float64(b * b); end return tmp end
angle_m = abs(angle); function tmp_2 = code(a, b, angle_m) tmp = 0.0; if (b <= 3.6e-65) tmp = (a * sin((angle_m * (pi * 0.005555555555555556)))) ^ 2.0; else tmp = b * b; end tmp_2 = tmp; end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := If[LessEqual[b, 3.6e-65], N[Power[N[(a * N[Sin[N[(angle$95$m * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[(b * b), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
\mathbf{if}\;b \leq 3.6 \cdot 10^{-65}:\\
\;\;\;\;{\left(a \cdot \sin \left(angle\_m \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;b \cdot b\\
\end{array}
\end{array}
if b < 3.5999999999999998e-65Initial program 77.7%
associate-*l/77.8%
associate-/l*77.9%
cos-neg77.9%
distribute-lft-neg-out77.9%
distribute-frac-neg77.9%
distribute-frac-neg77.9%
distribute-lft-neg-out77.9%
cos-neg77.9%
associate-*l/78.0%
associate-/l*77.9%
Simplified77.9%
Applied egg-rr77.9%
associate-*r*78.0%
metadata-eval78.0%
div-inv78.0%
Applied egg-rr77.9%
Taylor expanded in a around inf 41.9%
unpow241.9%
unpow241.9%
swap-sqr47.9%
unpow247.9%
associate-*r*47.8%
*-commutative47.8%
associate-*r*47.9%
*-commutative47.9%
Simplified47.9%
if 3.5999999999999998e-65 < b Initial program 85.5%
associate-*l/85.5%
associate-/l*85.5%
cos-neg85.5%
distribute-lft-neg-out85.5%
distribute-frac-neg85.5%
distribute-frac-neg85.5%
distribute-lft-neg-out85.5%
cos-neg85.5%
associate-*l/85.7%
associate-/l*85.7%
Simplified85.7%
Taylor expanded in angle around 0 67.1%
unpow267.1%
Applied egg-rr67.1%
Final simplification53.4%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (if (<= b 3.5e-65) (pow (* a (sin (* 0.005555555555555556 (* angle_m PI)))) 2.0) (* b b)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if (b <= 3.5e-65) {
tmp = pow((a * sin((0.005555555555555556 * (angle_m * ((double) M_PI))))), 2.0);
} else {
tmp = b * b;
}
return tmp;
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double tmp;
if (b <= 3.5e-65) {
tmp = Math.pow((a * Math.sin((0.005555555555555556 * (angle_m * Math.PI)))), 2.0);
} else {
tmp = b * b;
}
return tmp;
}
angle_m = math.fabs(angle) def code(a, b, angle_m): tmp = 0 if b <= 3.5e-65: tmp = math.pow((a * math.sin((0.005555555555555556 * (angle_m * math.pi)))), 2.0) else: tmp = b * b return tmp
angle_m = abs(angle) function code(a, b, angle_m) tmp = 0.0 if (b <= 3.5e-65) tmp = Float64(a * sin(Float64(0.005555555555555556 * Float64(angle_m * pi)))) ^ 2.0; else tmp = Float64(b * b); end return tmp end
angle_m = abs(angle); function tmp_2 = code(a, b, angle_m) tmp = 0.0; if (b <= 3.5e-65) tmp = (a * sin((0.005555555555555556 * (angle_m * pi)))) ^ 2.0; else tmp = b * b; end tmp_2 = tmp; end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := If[LessEqual[b, 3.5e-65], N[Power[N[(a * N[Sin[N[(0.005555555555555556 * N[(angle$95$m * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[(b * b), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
\mathbf{if}\;b \leq 3.5 \cdot 10^{-65}:\\
\;\;\;\;{\left(a \cdot \sin \left(0.005555555555555556 \cdot \left(angle\_m \cdot \pi\right)\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;b \cdot b\\
\end{array}
\end{array}
if b < 3.50000000000000005e-65Initial program 77.7%
associate-*l/77.8%
associate-/l*77.9%
cos-neg77.9%
distribute-lft-neg-out77.9%
distribute-frac-neg77.9%
distribute-frac-neg77.9%
distribute-lft-neg-out77.9%
cos-neg77.9%
associate-*l/78.0%
associate-/l*77.9%
Simplified77.9%
Taylor expanded in a around inf 41.9%
unpow241.9%
*-commutative41.9%
associate-*r*41.9%
unpow241.9%
swap-sqr47.9%
unpow247.9%
associate-*r*47.9%
*-commutative47.9%
Simplified47.9%
if 3.50000000000000005e-65 < b Initial program 85.5%
associate-*l/85.5%
associate-/l*85.5%
cos-neg85.5%
distribute-lft-neg-out85.5%
distribute-frac-neg85.5%
distribute-frac-neg85.5%
distribute-lft-neg-out85.5%
cos-neg85.5%
associate-*l/85.7%
associate-/l*85.7%
Simplified85.7%
Taylor expanded in angle around 0 67.1%
unpow267.1%
Applied egg-rr67.1%
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 80.0%
associate-*l/80.1%
associate-/l*80.1%
cos-neg80.1%
distribute-lft-neg-out80.1%
distribute-frac-neg80.1%
distribute-frac-neg80.1%
distribute-lft-neg-out80.1%
cos-neg80.1%
associate-*l/80.2%
associate-/l*80.1%
Simplified80.1%
Taylor expanded in angle around 0 59.2%
unpow259.2%
Applied egg-rr59.2%
herbie shell --seed 2024139
(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)))