
(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 14 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
(pow
(sqrt (* 0.005555555555555556 (* (cbrt (exp (* 3.0 (log PI)))) angle_m)))
2.0)))
2.0)
(pow (* b (sin (* PI (* 0.005555555555555556 angle_m)))) 2.0)))angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow((a * cos(pow(sqrt((0.005555555555555556 * (cbrt(exp((3.0 * log(((double) M_PI))))) * angle_m))), 2.0))), 2.0) + pow((b * sin((((double) M_PI) * (0.005555555555555556 * 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.pow(Math.sqrt((0.005555555555555556 * (Math.cbrt(Math.exp((3.0 * Math.log(Math.PI)))) * angle_m))), 2.0))), 2.0) + Math.pow((b * Math.sin((Math.PI * (0.005555555555555556 * angle_m)))), 2.0);
}
angle_m = abs(angle) function code(a, b, angle_m) return Float64((Float64(a * cos((sqrt(Float64(0.005555555555555556 * Float64(cbrt(exp(Float64(3.0 * log(pi)))) * angle_m))) ^ 2.0))) ^ 2.0) + (Float64(b * sin(Float64(pi * Float64(0.005555555555555556 * 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[Power[N[Sqrt[N[(0.005555555555555556 * N[(N[Power[N[Exp[N[(3.0 * N[Log[Pi], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 1/3], $MachinePrecision] * angle$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[N[(Pi * N[(0.005555555555555556 * angle$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{\left(a \cdot \cos \left({\left(\sqrt{0.005555555555555556 \cdot \left(\sqrt[3]{e^{3 \cdot \log \pi}} \cdot angle\_m\right)}\right)}^{2}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(0.005555555555555556 \cdot angle\_m\right)\right)\right)}^{2}
\end{array}
Initial program 79.4%
Simplified79.4%
metadata-eval79.4%
div-inv79.4%
add-sqr-sqrt43.9%
pow243.9%
div-inv43.9%
metadata-eval43.9%
associate-*r*43.9%
*-commutative43.9%
Applied egg-rr43.9%
add-cbrt-cube43.9%
pow343.9%
Applied egg-rr43.9%
add-exp-log43.9%
log-pow43.9%
Applied egg-rr43.9%
Final simplification43.9%
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
:precision binary64
(+
(pow (* b (sin (* PI (* 0.005555555555555556 angle_m)))) 2.0)
(pow
(*
a
(cos
(pow
(sqrt (* 0.005555555555555556 (* angle_m (cbrt (pow PI 3.0)))))
2.0)))
2.0)))angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow((b * sin((((double) M_PI) * (0.005555555555555556 * angle_m)))), 2.0) + pow((a * cos(pow(sqrt((0.005555555555555556 * (angle_m * cbrt(pow(((double) M_PI), 3.0))))), 2.0))), 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 * (0.005555555555555556 * angle_m)))), 2.0) + Math.pow((a * Math.cos(Math.pow(Math.sqrt((0.005555555555555556 * (angle_m * Math.cbrt(Math.pow(Math.PI, 3.0))))), 2.0))), 2.0);
}
angle_m = abs(angle) function code(a, b, angle_m) return Float64((Float64(b * sin(Float64(pi * Float64(0.005555555555555556 * angle_m)))) ^ 2.0) + (Float64(a * cos((sqrt(Float64(0.005555555555555556 * Float64(angle_m * cbrt((pi ^ 3.0))))) ^ 2.0))) ^ 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[(0.005555555555555556 * angle$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(a * N[Cos[N[Power[N[Sqrt[N[(0.005555555555555556 * N[(angle$95$m * N[Power[N[Power[Pi, 3.0], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{\left(b \cdot \sin \left(\pi \cdot \left(0.005555555555555556 \cdot angle\_m\right)\right)\right)}^{2} + {\left(a \cdot \cos \left({\left(\sqrt{0.005555555555555556 \cdot \left(angle\_m \cdot \sqrt[3]{{\pi}^{3}}\right)}\right)}^{2}\right)\right)}^{2}
\end{array}
Initial program 79.4%
Simplified79.4%
metadata-eval79.4%
div-inv79.4%
add-sqr-sqrt43.9%
pow243.9%
div-inv43.9%
metadata-eval43.9%
associate-*r*43.9%
*-commutative43.9%
Applied egg-rr43.9%
add-cbrt-cube43.9%
pow343.9%
Applied egg-rr43.9%
Final simplification43.9%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow (* b (sin (* PI (* 0.005555555555555556 angle_m)))) 2.0) (pow (* a (cos (pow (sqrt (* 0.005555555555555556 (* PI angle_m))) 2.0))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow((b * sin((((double) M_PI) * (0.005555555555555556 * angle_m)))), 2.0) + pow((a * cos(pow(sqrt((0.005555555555555556 * (((double) M_PI) * angle_m))), 2.0))), 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 * (0.005555555555555556 * angle_m)))), 2.0) + Math.pow((a * Math.cos(Math.pow(Math.sqrt((0.005555555555555556 * (Math.PI * angle_m))), 2.0))), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow((b * math.sin((math.pi * (0.005555555555555556 * angle_m)))), 2.0) + math.pow((a * math.cos(math.pow(math.sqrt((0.005555555555555556 * (math.pi * angle_m))), 2.0))), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) return Float64((Float64(b * sin(Float64(pi * Float64(0.005555555555555556 * angle_m)))) ^ 2.0) + (Float64(a * cos((sqrt(Float64(0.005555555555555556 * Float64(pi * angle_m))) ^ 2.0))) ^ 2.0)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = ((b * sin((pi * (0.005555555555555556 * angle_m)))) ^ 2.0) + ((a * cos((sqrt((0.005555555555555556 * (pi * angle_m))) ^ 2.0))) ^ 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[(0.005555555555555556 * angle$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(a * N[Cos[N[Power[N[Sqrt[N[(0.005555555555555556 * N[(Pi * angle$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{\left(b \cdot \sin \left(\pi \cdot \left(0.005555555555555556 \cdot angle\_m\right)\right)\right)}^{2} + {\left(a \cdot \cos \left({\left(\sqrt{0.005555555555555556 \cdot \left(\pi \cdot angle\_m\right)}\right)}^{2}\right)\right)}^{2}
\end{array}
Initial program 79.4%
Simplified79.4%
metadata-eval79.4%
div-inv79.4%
add-sqr-sqrt43.9%
pow243.9%
div-inv43.9%
metadata-eval43.9%
associate-*r*43.9%
*-commutative43.9%
Applied egg-rr43.9%
Final simplification43.9%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow (* b (sin (* PI (* 0.005555555555555556 angle_m)))) 2.0) (pow (* a (cos (* (* 0.005555555555555556 angle_m) (cbrt (pow PI 3.0))))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow((b * sin((((double) M_PI) * (0.005555555555555556 * angle_m)))), 2.0) + pow((a * cos(((0.005555555555555556 * angle_m) * cbrt(pow(((double) M_PI), 3.0))))), 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 * (0.005555555555555556 * angle_m)))), 2.0) + Math.pow((a * Math.cos(((0.005555555555555556 * angle_m) * Math.cbrt(Math.pow(Math.PI, 3.0))))), 2.0);
}
angle_m = abs(angle) function code(a, b, angle_m) return Float64((Float64(b * sin(Float64(pi * Float64(0.005555555555555556 * angle_m)))) ^ 2.0) + (Float64(a * cos(Float64(Float64(0.005555555555555556 * angle_m) * cbrt((pi ^ 3.0))))) ^ 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[(0.005555555555555556 * angle$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(a * N[Cos[N[(N[(0.005555555555555556 * angle$95$m), $MachinePrecision] * N[Power[N[Power[Pi, 3.0], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{\left(b \cdot \sin \left(\pi \cdot \left(0.005555555555555556 \cdot angle\_m\right)\right)\right)}^{2} + {\left(a \cdot \cos \left(\left(0.005555555555555556 \cdot angle\_m\right) \cdot \sqrt[3]{{\pi}^{3}}\right)\right)}^{2}
\end{array}
Initial program 79.4%
Simplified79.4%
metadata-eval79.4%
div-inv79.4%
unpow279.4%
*-commutative79.4%
associate-*r*77.8%
Applied egg-rr77.8%
add-cbrt-cube43.9%
pow343.9%
Applied egg-rr77.8%
associate-*l*79.4%
*-commutative79.4%
pow279.4%
unpow-prod-down70.4%
*-commutative70.4%
associate-*r*70.5%
unpow-prod-down79.5%
add-sqr-sqrt79.5%
pow279.5%
Applied egg-rr79.5%
Final simplification79.5%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow (* a (cos (* PI (* 0.005555555555555556 angle_m)))) 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) * (0.005555555555555556 * angle_m)))), 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 * (0.005555555555555556 * angle_m)))), 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 * (0.005555555555555556 * angle_m)))), 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(0.005555555555555556 * angle_m)))) ^ 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[(0.005555555555555556 * angle$95$m), $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(0.005555555555555556 \cdot angle\_m\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 79.4%
Simplified79.4%
expm1-log1p-u65.3%
associate-*r*65.3%
*-commutative65.3%
Applied egg-rr65.3%
Final simplification65.3%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (let* ((t_0 (* PI (* 0.005555555555555556 angle_m)))) (+ (pow (* b (sin t_0)) 2.0) (pow (* 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) * (0.005555555555555556 * angle_m);
return pow((b * sin(t_0)), 2.0) + pow((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 * (0.005555555555555556 * angle_m);
return Math.pow((b * Math.sin(t_0)), 2.0) + Math.pow((a * Math.cos(t_0)), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): t_0 = math.pi * (0.005555555555555556 * angle_m) return math.pow((b * math.sin(t_0)), 2.0) + math.pow((a * math.cos(t_0)), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) t_0 = Float64(pi * Float64(0.005555555555555556 * angle_m)) return Float64((Float64(b * sin(t_0)) ^ 2.0) + (Float64(a * cos(t_0)) ^ 2.0)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) t_0 = pi * (0.005555555555555556 * angle_m); tmp = ((b * sin(t_0)) ^ 2.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[(0.005555555555555556 * angle$95$m), $MachinePrecision]), $MachinePrecision]}, N[(N[Power[N[(b * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(a * N[Cos[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(0.005555555555555556 \cdot angle\_m\right)\\
{\left(b \cdot \sin t\_0\right)}^{2} + {\left(a \cdot \cos t\_0\right)}^{2}
\end{array}
\end{array}
Initial program 79.4%
Simplified79.4%
Final simplification79.4%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (let* ((t_0 (* PI (* 0.005555555555555556 angle_m)))) (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) * (0.005555555555555556 * angle_m);
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 * (0.005555555555555556 * angle_m);
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 * (0.005555555555555556 * angle_m) 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(0.005555555555555556 * angle_m)) 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 * (0.005555555555555556 * angle_m); 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[(0.005555555555555556 * angle$95$m), $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(0.005555555555555556 \cdot angle\_m\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.4%
Simplified79.4%
metadata-eval79.4%
div-inv79.4%
add-sqr-sqrt43.9%
pow243.9%
div-inv43.9%
metadata-eval43.9%
associate-*r*43.9%
*-commutative43.9%
Applied egg-rr43.9%
Applied egg-rr79.4%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow (* b (sin (* PI (* 0.005555555555555556 angle_m)))) 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) * (0.005555555555555556 * angle_m)))), 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 * (0.005555555555555556 * angle_m)))), 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 * (0.005555555555555556 * angle_m)))), 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(0.005555555555555556 * angle_m)))) ^ 2.0) + (a ^ 2.0)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = ((b * sin((pi * (0.005555555555555556 * angle_m)))) ^ 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[(0.005555555555555556 * angle$95$m), $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(0.005555555555555556 \cdot angle\_m\right)\right)\right)}^{2} + {a}^{2}
\end{array}
Initial program 79.4%
Simplified79.4%
Taylor expanded in angle around 0 78.6%
Final simplification78.6%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (if (<= a 1.55e-32) (pow (* b (sin (* angle_m (* 0.005555555555555556 PI)))) 2.0) (pow (* a (cos (* angle_m (* PI -0.005555555555555556)))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if (a <= 1.55e-32) {
tmp = pow((b * sin((angle_m * (0.005555555555555556 * ((double) M_PI))))), 2.0);
} else {
tmp = pow((a * cos((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 <= 1.55e-32) {
tmp = Math.pow((b * Math.sin((angle_m * (0.005555555555555556 * Math.PI)))), 2.0);
} else {
tmp = Math.pow((a * Math.cos((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 <= 1.55e-32: tmp = math.pow((b * math.sin((angle_m * (0.005555555555555556 * math.pi)))), 2.0) else: tmp = math.pow((a * math.cos((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 <= 1.55e-32) tmp = Float64(b * sin(Float64(angle_m * Float64(0.005555555555555556 * pi)))) ^ 2.0; else tmp = Float64(a * cos(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 <= 1.55e-32) tmp = (b * sin((angle_m * (0.005555555555555556 * pi)))) ^ 2.0; else tmp = (a * cos((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, 1.55e-32], N[Power[N[(b * N[Sin[N[(angle$95$m * N[(0.005555555555555556 * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[Power[N[(a * N[Cos[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 1.55 \cdot 10^{-32}:\\
\;\;\;\;{\left(b \cdot \sin \left(angle\_m \cdot \left(0.005555555555555556 \cdot \pi\right)\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;{\left(a \cdot \cos \left(angle\_m \cdot \left(\pi \cdot -0.005555555555555556\right)\right)\right)}^{2}\\
\end{array}
\end{array}
if a < 1.55000000000000005e-32Initial program 75.7%
Simplified75.8%
metadata-eval75.8%
div-inv75.7%
add-sqr-sqrt40.0%
pow240.0%
div-inv40.0%
metadata-eval40.0%
associate-*r*40.0%
*-commutative40.0%
Applied egg-rr40.0%
Taylor expanded in a around 0 45.0%
unpow245.0%
associate-*r*45.1%
*-commutative45.1%
unpow245.1%
swap-sqr49.5%
unpow249.5%
*-commutative49.5%
*-commutative49.5%
associate-*r*49.5%
Simplified49.5%
if 1.55000000000000005e-32 < a Initial program 88.0%
Simplified87.9%
metadata-eval87.9%
div-inv88.1%
add-sqr-sqrt53.1%
pow253.1%
div-inv53.1%
metadata-eval53.1%
associate-*r*53.1%
*-commutative53.1%
Applied egg-rr53.1%
Taylor expanded in a around inf 74.7%
Simplified74.7%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (if (<= a 1.4e-32) (pow (* b (sin (* 0.005555555555555556 (* PI angle_m)))) 2.0) (pow (* a (cos (* angle_m (* PI -0.005555555555555556)))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if (a <= 1.4e-32) {
tmp = pow((b * sin((0.005555555555555556 * (((double) M_PI) * angle_m)))), 2.0);
} else {
tmp = pow((a * cos((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 <= 1.4e-32) {
tmp = Math.pow((b * Math.sin((0.005555555555555556 * (Math.PI * angle_m)))), 2.0);
} else {
tmp = Math.pow((a * Math.cos((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 <= 1.4e-32: tmp = math.pow((b * math.sin((0.005555555555555556 * (math.pi * angle_m)))), 2.0) else: tmp = math.pow((a * math.cos((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 <= 1.4e-32) tmp = Float64(b * sin(Float64(0.005555555555555556 * Float64(pi * angle_m)))) ^ 2.0; else tmp = Float64(a * cos(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 <= 1.4e-32) tmp = (b * sin((0.005555555555555556 * (pi * angle_m)))) ^ 2.0; else tmp = (a * cos((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, 1.4e-32], N[Power[N[(b * N[Sin[N[(0.005555555555555556 * N[(Pi * angle$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[Power[N[(a * N[Cos[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 1.4 \cdot 10^{-32}:\\
\;\;\;\;{\left(b \cdot \sin \left(0.005555555555555556 \cdot \left(\pi \cdot angle\_m\right)\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;{\left(a \cdot \cos \left(angle\_m \cdot \left(\pi \cdot -0.005555555555555556\right)\right)\right)}^{2}\\
\end{array}
\end{array}
if a < 1.3999999999999999e-32Initial program 75.7%
Simplified75.8%
Taylor expanded in a around 0 45.0%
*-commutative45.0%
unpow245.0%
unpow245.0%
swap-sqr49.4%
unpow249.4%
*-commutative49.4%
Simplified49.4%
if 1.3999999999999999e-32 < a Initial program 88.0%
Simplified87.9%
metadata-eval87.9%
div-inv88.1%
add-sqr-sqrt53.1%
pow253.1%
div-inv53.1%
metadata-eval53.1%
associate-*r*53.1%
*-commutative53.1%
Applied egg-rr53.1%
Taylor expanded in a around inf 74.7%
Simplified74.7%
Final simplification57.0%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (if (<= b 2.7e+164) (pow (* a (cos (* angle_m (* PI -0.005555555555555556)))) 2.0) (cbrt (pow a 6.0))))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if (b <= 2.7e+164) {
tmp = pow((a * cos((angle_m * (((double) M_PI) * -0.005555555555555556)))), 2.0);
} else {
tmp = cbrt(pow(a, 6.0));
}
return tmp;
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double tmp;
if (b <= 2.7e+164) {
tmp = Math.pow((a * Math.cos((angle_m * (Math.PI * -0.005555555555555556)))), 2.0);
} else {
tmp = Math.cbrt(Math.pow(a, 6.0));
}
return tmp;
}
angle_m = abs(angle) function code(a, b, angle_m) tmp = 0.0 if (b <= 2.7e+164) tmp = Float64(a * cos(Float64(angle_m * Float64(pi * -0.005555555555555556)))) ^ 2.0; else tmp = cbrt((a ^ 6.0)); end return tmp end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := If[LessEqual[b, 2.7e+164], N[Power[N[(a * N[Cos[N[(angle$95$m * N[(Pi * -0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[Power[N[Power[a, 6.0], $MachinePrecision], 1/3], $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
\mathbf{if}\;b \leq 2.7 \cdot 10^{+164}:\\
\;\;\;\;{\left(a \cdot \cos \left(angle\_m \cdot \left(\pi \cdot -0.005555555555555556\right)\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{{a}^{6}}\\
\end{array}
\end{array}
if b < 2.70000000000000006e164Initial program 76.5%
Simplified76.5%
metadata-eval76.5%
div-inv76.5%
add-sqr-sqrt43.1%
pow243.1%
div-inv43.1%
metadata-eval43.1%
associate-*r*43.1%
*-commutative43.1%
Applied egg-rr43.1%
Taylor expanded in a around inf 55.8%
Simplified55.8%
if 2.70000000000000006e164 < b Initial program 99.9%
Simplified99.9%
Taylor expanded in angle around 0 35.4%
add-sqr-sqrt35.4%
sqrt-unprod49.8%
pow-prod-up49.8%
metadata-eval49.8%
Applied egg-rr49.8%
add-cbrt-cube51.1%
pow1/351.1%
add-sqr-sqrt51.1%
sqrt-pow151.1%
metadata-eval51.1%
pow-prod-up51.1%
metadata-eval51.1%
Applied egg-rr51.1%
unpow1/351.1%
Simplified51.1%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (if (<= b 9.5e+163) (pow (* a (cos (* 0.005555555555555556 (* PI angle_m)))) 2.0) (cbrt (pow a 6.0))))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if (b <= 9.5e+163) {
tmp = pow((a * cos((0.005555555555555556 * (((double) M_PI) * angle_m)))), 2.0);
} else {
tmp = cbrt(pow(a, 6.0));
}
return tmp;
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double tmp;
if (b <= 9.5e+163) {
tmp = Math.pow((a * Math.cos((0.005555555555555556 * (Math.PI * angle_m)))), 2.0);
} else {
tmp = Math.cbrt(Math.pow(a, 6.0));
}
return tmp;
}
angle_m = abs(angle) function code(a, b, angle_m) tmp = 0.0 if (b <= 9.5e+163) tmp = Float64(a * cos(Float64(0.005555555555555556 * Float64(pi * angle_m)))) ^ 2.0; else tmp = cbrt((a ^ 6.0)); end return tmp end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := If[LessEqual[b, 9.5e+163], N[Power[N[(a * N[Cos[N[(0.005555555555555556 * N[(Pi * angle$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[Power[N[Power[a, 6.0], $MachinePrecision], 1/3], $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
\mathbf{if}\;b \leq 9.5 \cdot 10^{+163}:\\
\;\;\;\;{\left(a \cdot \cos \left(0.005555555555555556 \cdot \left(\pi \cdot angle\_m\right)\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{{a}^{6}}\\
\end{array}
\end{array}
if b < 9.50000000000000053e163Initial program 76.5%
Simplified76.5%
Taylor expanded in a around inf 55.8%
unpow255.8%
*-commutative55.8%
unpow255.8%
swap-sqr55.8%
unpow255.8%
*-commutative55.8%
Simplified55.8%
if 9.50000000000000053e163 < b Initial program 99.9%
Simplified99.9%
Taylor expanded in angle around 0 35.4%
add-sqr-sqrt35.4%
sqrt-unprod49.8%
pow-prod-up49.8%
metadata-eval49.8%
Applied egg-rr49.8%
add-cbrt-cube51.1%
pow1/351.1%
add-sqr-sqrt51.1%
sqrt-pow151.1%
metadata-eval51.1%
pow-prod-up51.1%
metadata-eval51.1%
Applied egg-rr51.1%
unpow1/351.1%
Simplified51.1%
Final simplification55.2%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (if (<= b 1.85e+164) (* a a) (cbrt (pow a 6.0))))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if (b <= 1.85e+164) {
tmp = a * a;
} else {
tmp = cbrt(pow(a, 6.0));
}
return tmp;
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double tmp;
if (b <= 1.85e+164) {
tmp = a * a;
} else {
tmp = Math.cbrt(Math.pow(a, 6.0));
}
return tmp;
}
angle_m = abs(angle) function code(a, b, angle_m) tmp = 0.0 if (b <= 1.85e+164) tmp = Float64(a * a); else tmp = cbrt((a ^ 6.0)); end return tmp end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := If[LessEqual[b, 1.85e+164], N[(a * a), $MachinePrecision], N[Power[N[Power[a, 6.0], $MachinePrecision], 1/3], $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.85 \cdot 10^{+164}:\\
\;\;\;\;a \cdot a\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{{a}^{6}}\\
\end{array}
\end{array}
if b < 1.85e164Initial program 76.5%
Simplified76.5%
Taylor expanded in angle around 0 54.9%
unpow254.9%
Applied egg-rr54.9%
if 1.85e164 < b Initial program 99.9%
Simplified99.9%
Taylor expanded in angle around 0 35.4%
add-sqr-sqrt35.4%
sqrt-unprod49.8%
pow-prod-up49.8%
metadata-eval49.8%
Applied egg-rr49.8%
add-cbrt-cube51.1%
pow1/351.1%
add-sqr-sqrt51.1%
sqrt-pow151.1%
metadata-eval51.1%
pow-prod-up51.1%
metadata-eval51.1%
Applied egg-rr51.1%
unpow1/351.1%
Simplified51.1%
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.4%
Simplified79.4%
Taylor expanded in angle around 0 52.4%
unpow252.4%
Applied egg-rr52.4%
herbie shell --seed 2024130
(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)))