
(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}
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 (pow (sqrt (* angle_m (/ PI 180.0))) 2.0))) 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(pow(sqrt((angle_m * (((double) M_PI) / 180.0))), 2.0))), 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.pow(Math.sqrt((angle_m * (Math.PI / 180.0))), 2.0))), 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.pow(math.sqrt((angle_m * (math.pi / 180.0))), 2.0))), 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((sqrt(Float64(angle_m * Float64(pi / 180.0))) ^ 2.0))) ^ 2.0)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = ((a * cos((pi * (angle_m * 0.005555555555555556)))) ^ 2.0) + ((b * sin((sqrt((angle_m * (pi / 180.0))) ^ 2.0))) ^ 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[Power[N[Sqrt[N[(angle$95$m * N[(Pi / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $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({\left(\sqrt{angle\_m \cdot \frac{\pi}{180}}\right)}^{2}\right)\right)}^{2}
\end{array}
Initial program 74.2%
associate-*r/74.2%
metadata-eval74.2%
metadata-eval74.2%
distribute-neg-frac274.2%
distribute-frac-neg74.2%
distribute-rgt-neg-out74.2%
associate-/l*74.2%
neg-mul-174.2%
*-commutative74.2%
associate-/l*74.2%
metadata-eval74.2%
metadata-eval74.2%
Simplified74.1%
expm1-log1p-u56.2%
associate-*r*56.2%
*-commutative56.2%
Applied egg-rr56.2%
expm1-log1p-u74.2%
rem-cube-cbrt74.1%
add-sqr-sqrt35.5%
pow235.5%
rem-cube-cbrt35.6%
*-commutative35.6%
associate-*r*35.6%
metadata-eval35.6%
associate-/r/36.0%
associate-*l/36.0%
*-un-lft-identity36.0%
associate-/r/35.6%
Applied egg-rr35.6%
Final simplification35.6%
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 (* 0.005555555555555556 (expm1 (log1p (* PI angle_m)))))) 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((0.005555555555555556 * expm1(log1p((((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((Math.PI * (angle_m * 0.005555555555555556)))), 2.0) + Math.pow((b * Math.sin((0.005555555555555556 * Math.expm1(Math.log1p((Math.PI * angle_m)))))), 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((0.005555555555555556 * math.expm1(math.log1p((math.pi * angle_m)))))), 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(0.005555555555555556 * expm1(log1p(Float64(pi * angle_m)))))) ^ 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[(0.005555555555555556 * N[(Exp[N[Log[1 + N[(Pi * angle$95$m), $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(0.005555555555555556 \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(\pi \cdot angle\_m\right)\right)\right)\right)}^{2}
\end{array}
Initial program 74.2%
associate-*r/74.2%
metadata-eval74.2%
metadata-eval74.2%
distribute-neg-frac274.2%
distribute-frac-neg74.2%
distribute-rgt-neg-out74.2%
associate-/l*74.2%
neg-mul-174.2%
*-commutative74.2%
associate-/l*74.2%
metadata-eval74.2%
metadata-eval74.2%
Simplified74.1%
expm1-log1p-u56.2%
associate-*r*56.2%
*-commutative56.2%
Applied egg-rr56.2%
expm1-log1p-u74.2%
*-commutative74.2%
associate-*r*74.1%
metadata-eval74.1%
associate-/r/74.1%
associate-*l/74.2%
div-inv74.1%
times-frac74.2%
metadata-eval74.2%
Applied egg-rr74.2%
div-inv74.2%
inv-pow74.2%
pow-flip74.2%
metadata-eval74.2%
pow174.2%
expm1-log1p-u56.3%
Applied egg-rr56.3%
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 (expm1 (log1p (* 0.005555555555555556 (* PI angle_m)))))) 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(expm1(log1p((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((Math.PI * (angle_m * 0.005555555555555556)))), 2.0) + Math.pow((b * Math.sin(Math.expm1(Math.log1p((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((math.pi * (angle_m * 0.005555555555555556)))), 2.0) + math.pow((b * math.sin(math.expm1(math.log1p((0.005555555555555556 * (math.pi * angle_m)))))), 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(expm1(log1p(Float64(0.005555555555555556 * Float64(pi * angle_m)))))) ^ 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[(Exp[N[Log[1 + N[(0.005555555555555556 * N[(Pi * angle$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]] - 1), $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(\mathsf{expm1}\left(\mathsf{log1p}\left(0.005555555555555556 \cdot \left(\pi \cdot angle\_m\right)\right)\right)\right)\right)}^{2}
\end{array}
Initial program 74.2%
associate-*r/74.2%
metadata-eval74.2%
metadata-eval74.2%
distribute-neg-frac274.2%
distribute-frac-neg74.2%
distribute-rgt-neg-out74.2%
associate-/l*74.2%
neg-mul-174.2%
*-commutative74.2%
associate-/l*74.2%
metadata-eval74.2%
metadata-eval74.2%
Simplified74.1%
expm1-log1p-u56.2%
associate-*r*56.2%
*-commutative56.2%
Applied egg-rr56.2%
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 (/ 180.0 angle_m)))) 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) / (180.0 / 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((Math.PI * (angle_m * 0.005555555555555556)))), 2.0) + Math.pow((b * Math.sin((Math.PI / (180.0 / angle_m)))), 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 / (180.0 / angle_m)))), 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 / Float64(180.0 / angle_m)))) ^ 2.0)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = ((a * cos((pi * (angle_m * 0.005555555555555556)))) ^ 2.0) + ((b * sin((pi / (180.0 / angle_m)))) ^ 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[(180.0 / angle$95$m), $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(\frac{\pi}{\frac{180}{angle\_m}}\right)\right)}^{2}
\end{array}
Initial program 74.2%
associate-*r/74.2%
metadata-eval74.2%
metadata-eval74.2%
distribute-neg-frac274.2%
distribute-frac-neg74.2%
distribute-rgt-neg-out74.2%
associate-/l*74.2%
neg-mul-174.2%
*-commutative74.2%
associate-/l*74.2%
metadata-eval74.2%
metadata-eval74.2%
Simplified74.1%
metadata-eval74.1%
div-inv74.2%
clear-num74.1%
un-div-inv74.2%
Applied egg-rr74.2%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (let* ((t_0 (* PI (/ angle_m 180.0)))) (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 / 180.0);
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 / 180.0);
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 / 180.0) 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 / 180.0)) 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 / 180.0); 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 / 180.0), $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 \frac{angle\_m}{180}\\
{\left(\mathsf{hypot}\left(b \cdot \sin t\_0, a \cdot \cos t\_0\right)\right)}^{2}
\end{array}
\end{array}
Initial program 74.2%
associate-*r/74.2%
metadata-eval74.2%
metadata-eval74.2%
distribute-neg-frac274.2%
distribute-frac-neg74.2%
distribute-rgt-neg-out74.2%
associate-/l*74.2%
neg-mul-174.2%
*-commutative74.2%
associate-/l*74.2%
metadata-eval74.2%
metadata-eval74.2%
Simplified74.1%
Applied egg-rr73.7%
Applied egg-rr73.5%
*-lft-identity73.5%
associate-/r/73.5%
associate-/r/73.5%
Simplified73.5%
Applied egg-rr74.1%
unpow274.1%
unpow274.1%
rem-square-sqrt74.1%
hypot-undefine74.1%
hypot-undefine74.1%
unpow274.1%
Simplified74.2%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (let* ((t_0 (* angle_m (/ PI 180.0)))) (pow (hypot (* a (cos t_0)) (* b (sin 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(hypot((a * cos(t_0)), (b * sin(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(Math.hypot((a * Math.cos(t_0)), (b * Math.sin(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(math.hypot((a * math.cos(t_0)), (b * math.sin(t_0))), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) t_0 = Float64(angle_m * Float64(pi / 180.0)) return hypot(Float64(a * cos(t_0)), Float64(b * sin(t_0))) ^ 2.0 end
angle_m = abs(angle); function tmp = code(a, b, angle_m) t_0 = angle_m * (pi / 180.0); tmp = hypot((a * cos(t_0)), (b * sin(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[Power[N[Sqrt[N[(a * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision] ^ 2 + N[(b * N[Sin[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 \frac{\pi}{180}\\
{\left(\mathsf{hypot}\left(a \cdot \cos t\_0, b \cdot \sin t\_0\right)\right)}^{2}
\end{array}
\end{array}
Initial program 74.2%
associate-*r/74.2%
metadata-eval74.2%
metadata-eval74.2%
distribute-neg-frac274.2%
distribute-frac-neg74.2%
distribute-rgt-neg-out74.2%
associate-/l*74.2%
neg-mul-174.2%
*-commutative74.2%
associate-/l*74.2%
metadata-eval74.2%
metadata-eval74.2%
Simplified74.1%
expm1-log1p-u56.2%
associate-*r*56.2%
*-commutative56.2%
Applied egg-rr56.2%
Applied egg-rr74.2%
Final simplification74.2%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (pow (hypot (* a (cos (* PI (* angle_m 0.005555555555555556)))) (* b (sin (/ (* PI angle_m) 180.0)))) 2.0))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow(hypot((a * cos((((double) M_PI) * (angle_m * 0.005555555555555556)))), (b * sin(((((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(Math.hypot((a * Math.cos((Math.PI * (angle_m * 0.005555555555555556)))), (b * Math.sin(((Math.PI * angle_m) / 180.0)))), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow(math.hypot((a * math.cos((math.pi * (angle_m * 0.005555555555555556)))), (b * math.sin(((math.pi * angle_m) / 180.0)))), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) return hypot(Float64(a * cos(Float64(pi * Float64(angle_m * 0.005555555555555556)))), Float64(b * sin(Float64(Float64(pi * angle_m) / 180.0)))) ^ 2.0 end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = hypot((a * cos((pi * (angle_m * 0.005555555555555556)))), (b * sin(((pi * angle_m) / 180.0)))) ^ 2.0; end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[Power[N[Sqrt[N[(a * N[Cos[N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] ^ 2 + N[(b * N[Sin[N[(N[(Pi * angle$95$m), $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 \cos \left(\pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)\right), b \cdot \sin \left(\frac{\pi \cdot angle\_m}{180}\right)\right)\right)}^{2}
\end{array}
Initial program 74.2%
associate-*r/74.2%
metadata-eval74.2%
metadata-eval74.2%
distribute-neg-frac274.2%
distribute-frac-neg74.2%
distribute-rgt-neg-out74.2%
associate-/l*74.2%
neg-mul-174.2%
*-commutative74.2%
associate-/l*74.2%
metadata-eval74.2%
metadata-eval74.2%
Simplified74.1%
expm1-log1p-u56.2%
associate-*r*56.2%
*-commutative56.2%
Applied egg-rr56.2%
expm1-log1p-u74.2%
rem-cube-cbrt74.1%
add-sqr-sqrt35.5%
pow235.5%
rem-cube-cbrt35.6%
*-commutative35.6%
associate-*r*35.6%
metadata-eval35.6%
associate-/r/36.0%
associate-*l/36.0%
*-un-lft-identity36.0%
associate-/r/35.6%
Applied egg-rr35.6%
add-sqr-sqrt35.6%
pow235.6%
Applied egg-rr74.1%
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
:precision binary64
(let* ((t_0 (* PI (* angle_m 0.005555555555555556))))
(+
(* a (* a (+ 0.5 (* 0.5 (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 = ((double) M_PI) * (angle_m * 0.005555555555555556);
return (a * (a * (0.5 + (0.5 * cos((t_0 * 2.0)))))) + pow((b * 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 * 0.005555555555555556);
return (a * (a * (0.5 + (0.5 * Math.cos((t_0 * 2.0)))))) + Math.pow((b * Math.sin(t_0)), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): t_0 = math.pi * (angle_m * 0.005555555555555556) return (a * (a * (0.5 + (0.5 * math.cos((t_0 * 2.0)))))) + math.pow((b * math.sin(t_0)), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) t_0 = Float64(pi * Float64(angle_m * 0.005555555555555556)) return Float64(Float64(a * Float64(a * Float64(0.5 + Float64(0.5 * cos(Float64(t_0 * 2.0)))))) + (Float64(b * sin(t_0)) ^ 2.0)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) t_0 = pi * (angle_m * 0.005555555555555556); tmp = (a * (a * (0.5 + (0.5 * cos((t_0 * 2.0)))))) + ((b * 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 * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]}, N[(N[(a * N[(a * N[(0.5 + N[(0.5 * N[Cos[N[(t$95$0 * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Power[N[(b * 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 \left(angle\_m \cdot 0.005555555555555556\right)\\
a \cdot \left(a \cdot \left(0.5 + 0.5 \cdot \cos \left(t\_0 \cdot 2\right)\right)\right) + {\left(b \cdot \sin t\_0\right)}^{2}
\end{array}
\end{array}
Initial program 74.2%
associate-*r/74.2%
metadata-eval74.2%
metadata-eval74.2%
distribute-neg-frac274.2%
distribute-frac-neg74.2%
distribute-rgt-neg-out74.2%
associate-/l*74.2%
neg-mul-174.2%
*-commutative74.2%
associate-/l*74.2%
metadata-eval74.2%
metadata-eval74.2%
Simplified74.1%
metadata-eval74.1%
div-inv74.1%
add-cube-cbrt74.0%
pow374.0%
div-inv74.1%
metadata-eval74.1%
associate-*r*74.0%
*-commutative74.0%
Applied egg-rr74.0%
unpow-prod-down74.0%
unpow274.0%
rem-cube-cbrt74.0%
*-commutative74.0%
associate-*r*74.1%
associate-*l*74.1%
associate-*r*74.0%
*-commutative74.0%
rem-cube-cbrt74.0%
Applied egg-rr74.1%
unpow274.1%
sqr-cos-a74.1%
associate-*l/74.1%
associate-*r/74.1%
div-inv74.1%
metadata-eval74.1%
Applied egg-rr74.1%
Final simplification74.1%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow a 2.0) (pow (* b (sin (* 0.005555555555555556 (/ PI (/ 1.0 angle_m))))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow(a, 2.0) + pow((b * sin((0.005555555555555556 * (((double) M_PI) / (1.0 / angle_m))))), 2.0);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return Math.pow(a, 2.0) + Math.pow((b * Math.sin((0.005555555555555556 * (Math.PI / (1.0 / angle_m))))), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow(a, 2.0) + math.pow((b * math.sin((0.005555555555555556 * (math.pi / (1.0 / angle_m))))), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) return Float64((a ^ 2.0) + (Float64(b * sin(Float64(0.005555555555555556 * Float64(pi / Float64(1.0 / angle_m))))) ^ 2.0)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = (a ^ 2.0) + ((b * sin((0.005555555555555556 * (pi / (1.0 / angle_m))))) ^ 2.0); end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(N[Power[a, 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[N[(0.005555555555555556 * N[(Pi / N[(1.0 / angle$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{a}^{2} + {\left(b \cdot \sin \left(0.005555555555555556 \cdot \frac{\pi}{\frac{1}{angle\_m}}\right)\right)}^{2}
\end{array}
Initial program 74.2%
associate-*r/74.2%
metadata-eval74.2%
metadata-eval74.2%
distribute-neg-frac274.2%
distribute-frac-neg74.2%
distribute-rgt-neg-out74.2%
associate-/l*74.2%
neg-mul-174.2%
*-commutative74.2%
associate-/l*74.2%
metadata-eval74.2%
metadata-eval74.2%
Simplified74.1%
expm1-log1p-u56.2%
associate-*r*56.2%
*-commutative56.2%
Applied egg-rr56.2%
expm1-log1p-u74.2%
*-commutative74.2%
associate-*r*74.1%
metadata-eval74.1%
associate-/r/74.1%
associate-*l/74.2%
div-inv74.1%
times-frac74.2%
metadata-eval74.2%
Applied egg-rr74.2%
Taylor expanded in angle around 0 74.1%
Final simplification74.1%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (if (<= a 5.2e-14) (pow (* b (sin (* angle_m (* PI 0.005555555555555556)))) 2.0) (* a a)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if (a <= 5.2e-14) {
tmp = pow((b * sin((angle_m * (((double) M_PI) * 0.005555555555555556)))), 2.0);
} else {
tmp = a * a;
}
return tmp;
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double tmp;
if (a <= 5.2e-14) {
tmp = Math.pow((b * Math.sin((angle_m * (Math.PI * 0.005555555555555556)))), 2.0);
} else {
tmp = a * a;
}
return tmp;
}
angle_m = math.fabs(angle) def code(a, b, angle_m): tmp = 0 if a <= 5.2e-14: tmp = math.pow((b * math.sin((angle_m * (math.pi * 0.005555555555555556)))), 2.0) else: tmp = a * a return tmp
angle_m = abs(angle) function code(a, b, angle_m) tmp = 0.0 if (a <= 5.2e-14) tmp = Float64(b * sin(Float64(angle_m * Float64(pi * 0.005555555555555556)))) ^ 2.0; else tmp = Float64(a * a); end return tmp end
angle_m = abs(angle); function tmp_2 = code(a, b, angle_m) tmp = 0.0; if (a <= 5.2e-14) tmp = (b * sin((angle_m * (pi * 0.005555555555555556)))) ^ 2.0; else tmp = a * a; end tmp_2 = tmp; end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := If[LessEqual[a, 5.2e-14], N[Power[N[(b * N[Sin[N[(angle$95$m * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[(a * a), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
\mathbf{if}\;a \leq 5.2 \cdot 10^{-14}:\\
\;\;\;\;{\left(b \cdot \sin \left(angle\_m \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;a \cdot a\\
\end{array}
\end{array}
if a < 5.19999999999999993e-14Initial program 72.9%
associate-*r/72.9%
metadata-eval72.9%
metadata-eval72.9%
distribute-neg-frac272.9%
distribute-frac-neg72.9%
distribute-rgt-neg-out72.9%
associate-/l*72.9%
neg-mul-172.9%
*-commutative72.9%
associate-/l*72.9%
metadata-eval72.9%
metadata-eval72.9%
Simplified72.8%
expm1-log1p-u56.2%
associate-*r*56.2%
*-commutative56.2%
Applied egg-rr56.2%
Taylor expanded in a around 0 37.8%
unpow237.8%
unpow237.8%
unpow237.8%
associate-*r*37.7%
metadata-eval37.7%
distribute-lft-neg-in37.7%
metadata-eval37.7%
associate-/r/37.8%
distribute-neg-frac37.8%
metadata-eval37.8%
associate-*l/37.8%
associate-*r/37.8%
associate-/r/37.8%
*-lft-identity37.8%
unpow237.8%
Simplified43.0%
if 5.19999999999999993e-14 < a Initial program 78.9%
associate-*r/78.9%
metadata-eval78.9%
metadata-eval78.9%
distribute-neg-frac278.9%
distribute-frac-neg78.9%
distribute-rgt-neg-out78.9%
associate-/l*78.9%
neg-mul-178.9%
*-commutative78.9%
associate-/l*78.9%
metadata-eval78.9%
metadata-eval78.9%
Simplified78.9%
Taylor expanded in angle around 0 73.3%
unpow273.3%
Applied egg-rr73.3%
Final simplification49.5%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (if (<= a 6.2e-15) (pow (* b (sin (* 0.005555555555555556 (* PI angle_m)))) 2.0) (* a a)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if (a <= 6.2e-15) {
tmp = pow((b * sin((0.005555555555555556 * (((double) M_PI) * angle_m)))), 2.0);
} else {
tmp = a * a;
}
return tmp;
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double tmp;
if (a <= 6.2e-15) {
tmp = Math.pow((b * Math.sin((0.005555555555555556 * (Math.PI * angle_m)))), 2.0);
} else {
tmp = a * a;
}
return tmp;
}
angle_m = math.fabs(angle) def code(a, b, angle_m): tmp = 0 if a <= 6.2e-15: tmp = math.pow((b * math.sin((0.005555555555555556 * (math.pi * angle_m)))), 2.0) else: tmp = a * a return tmp
angle_m = abs(angle) function code(a, b, angle_m) tmp = 0.0 if (a <= 6.2e-15) tmp = Float64(b * sin(Float64(0.005555555555555556 * Float64(pi * angle_m)))) ^ 2.0; else tmp = Float64(a * a); end return tmp end
angle_m = abs(angle); function tmp_2 = code(a, b, angle_m) tmp = 0.0; if (a <= 6.2e-15) tmp = (b * sin((0.005555555555555556 * (pi * angle_m)))) ^ 2.0; else tmp = a * a; end tmp_2 = tmp; end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := If[LessEqual[a, 6.2e-15], N[Power[N[(b * N[Sin[N[(0.005555555555555556 * N[(Pi * angle$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[(a * a), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
\mathbf{if}\;a \leq 6.2 \cdot 10^{-15}:\\
\;\;\;\;{\left(b \cdot \sin \left(0.005555555555555556 \cdot \left(\pi \cdot angle\_m\right)\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;a \cdot a\\
\end{array}
\end{array}
if a < 6.1999999999999998e-15Initial program 72.9%
associate-*r/72.9%
metadata-eval72.9%
metadata-eval72.9%
distribute-neg-frac272.9%
distribute-frac-neg72.9%
distribute-rgt-neg-out72.9%
associate-/l*72.9%
neg-mul-172.9%
*-commutative72.9%
associate-/l*72.9%
metadata-eval72.9%
metadata-eval72.9%
Simplified72.8%
Taylor expanded in a around 0 37.8%
unpow237.8%
*-commutative37.8%
unpow237.8%
swap-sqr43.0%
unpow243.0%
*-commutative43.0%
Simplified43.0%
if 6.1999999999999998e-15 < a Initial program 78.9%
associate-*r/78.9%
metadata-eval78.9%
metadata-eval78.9%
distribute-neg-frac278.9%
distribute-frac-neg78.9%
distribute-rgt-neg-out78.9%
associate-/l*78.9%
neg-mul-178.9%
*-commutative78.9%
associate-/l*78.9%
metadata-eval78.9%
metadata-eval78.9%
Simplified78.9%
Taylor expanded in angle around 0 73.3%
unpow273.3%
Applied egg-rr73.3%
Final simplification49.5%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow (* b (sin (* PI (* angle_m 0.005555555555555556)))) 2.0) (* a a)))
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) + (a * a);
}
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) + (a * a);
}
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) + (a * a)
angle_m = abs(angle) function code(a, b, angle_m) return Float64((Float64(b * sin(Float64(pi * Float64(angle_m * 0.005555555555555556)))) ^ 2.0) + Float64(a * a)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = ((b * sin((pi * (angle_m * 0.005555555555555556)))) ^ 2.0) + (a * a); 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[(a * a), $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 \cdot a
\end{array}
Initial program 74.2%
associate-*r/74.2%
metadata-eval74.2%
metadata-eval74.2%
distribute-neg-frac274.2%
distribute-frac-neg74.2%
distribute-rgt-neg-out74.2%
associate-/l*74.2%
neg-mul-174.2%
*-commutative74.2%
associate-/l*74.2%
metadata-eval74.2%
metadata-eval74.2%
Simplified74.1%
metadata-eval74.1%
div-inv74.1%
add-cube-cbrt74.0%
pow374.0%
div-inv74.1%
metadata-eval74.1%
associate-*r*74.0%
*-commutative74.0%
Applied egg-rr74.0%
unpow-prod-down74.0%
unpow274.0%
rem-cube-cbrt74.0%
*-commutative74.0%
associate-*r*74.1%
associate-*l*74.1%
associate-*r*74.0%
*-commutative74.0%
rem-cube-cbrt74.0%
Applied egg-rr74.1%
Taylor expanded in angle around 0 74.0%
Final simplification74.0%
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 74.2%
associate-*r/74.2%
metadata-eval74.2%
metadata-eval74.2%
distribute-neg-frac274.2%
distribute-frac-neg74.2%
distribute-rgt-neg-out74.2%
associate-/l*74.2%
neg-mul-174.2%
*-commutative74.2%
associate-/l*74.2%
metadata-eval74.2%
metadata-eval74.2%
Simplified74.1%
Taylor expanded in angle around 0 52.8%
unpow252.8%
Applied egg-rr52.8%
herbie shell --seed 2024157
(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)))