
(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 10 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
(let* ((t_0 (sqrt (* angle_m 0.005555555555555556))))
(+
(pow (* a (cos (* PI (* angle_m 0.005555555555555556)))) 2.0)
(pow (* b (sin (* t_0 (* PI t_0)))) 2.0))))angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double t_0 = sqrt((angle_m * 0.005555555555555556));
return pow((a * cos((((double) M_PI) * (angle_m * 0.005555555555555556)))), 2.0) + pow((b * sin((t_0 * (((double) M_PI) * t_0)))), 2.0);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double t_0 = Math.sqrt((angle_m * 0.005555555555555556));
return Math.pow((a * Math.cos((Math.PI * (angle_m * 0.005555555555555556)))), 2.0) + Math.pow((b * Math.sin((t_0 * (Math.PI * t_0)))), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): t_0 = math.sqrt((angle_m * 0.005555555555555556)) return math.pow((a * math.cos((math.pi * (angle_m * 0.005555555555555556)))), 2.0) + math.pow((b * math.sin((t_0 * (math.pi * t_0)))), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) t_0 = sqrt(Float64(angle_m * 0.005555555555555556)) return Float64((Float64(a * cos(Float64(pi * Float64(angle_m * 0.005555555555555556)))) ^ 2.0) + (Float64(b * sin(Float64(t_0 * Float64(pi * t_0)))) ^ 2.0)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) t_0 = sqrt((angle_m * 0.005555555555555556)); tmp = ((a * cos((pi * (angle_m * 0.005555555555555556)))) ^ 2.0) + ((b * sin((t_0 * (pi * t_0)))) ^ 2.0); end
angle_m = N[Abs[angle], $MachinePrecision]
code[a_, b_, angle$95$m_] := Block[{t$95$0 = N[Sqrt[N[(angle$95$m * 0.005555555555555556), $MachinePrecision]], $MachinePrecision]}, 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[(t$95$0 * N[(Pi * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
t_0 := \sqrt{angle\_m \cdot 0.005555555555555556}\\
{\left(a \cdot \cos \left(\pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(t\_0 \cdot \left(\pi \cdot t\_0\right)\right)\right)}^{2}
\end{array}
\end{array}
Initial program 81.2%
Simplified81.2%
metadata-eval81.2%
div-inv81.2%
clear-num81.1%
un-div-inv81.2%
Applied egg-rr81.2%
div-inv81.1%
clear-num81.2%
div-inv81.2%
metadata-eval81.2%
add-sqr-sqrt37.8%
associate-*r*37.9%
Applied egg-rr37.9%
Final simplification37.9%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (let* ((t_0 (* PI (* angle_m 0.005555555555555556)))) (+ (pow (* a (cos t_0)) 2.0) (pow (* b (sin (expm1 (log1p t_0)))) 2.0))))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double t_0 = ((double) M_PI) * (angle_m * 0.005555555555555556);
return pow((a * cos(t_0)), 2.0) + pow((b * sin(expm1(log1p(t_0)))), 2.0);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double t_0 = Math.PI * (angle_m * 0.005555555555555556);
return Math.pow((a * Math.cos(t_0)), 2.0) + Math.pow((b * Math.sin(Math.expm1(Math.log1p(t_0)))), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): t_0 = math.pi * (angle_m * 0.005555555555555556) return math.pow((a * math.cos(t_0)), 2.0) + math.pow((b * math.sin(math.expm1(math.log1p(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 * cos(t_0)) ^ 2.0) + (Float64(b * sin(expm1(log1p(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[Power[N[(a * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[N[(Exp[N[Log[1 + t$95$0], $MachinePrecision]] - 1), $MachinePrecision]], $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)\\
{\left(a \cdot \cos t\_0\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{expm1}\left(\mathsf{log1p}\left(t\_0\right)\right)\right)\right)}^{2}
\end{array}
\end{array}
Initial program 81.2%
Simplified81.2%
metadata-eval81.2%
div-inv81.2%
clear-num81.1%
un-div-inv81.2%
Applied egg-rr81.2%
expm1-log1p-u64.9%
expm1-undefine55.5%
associate-/r/55.5%
div-inv55.5%
metadata-eval55.5%
*-commutative55.5%
*-commutative55.5%
*-commutative55.5%
Applied egg-rr55.5%
expm1-define64.9%
*-commutative64.9%
associate-*l*64.9%
Simplified64.9%
Final simplification64.9%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (pow (hypot (* a (cos (* PI (* angle_m 0.005555555555555556)))) (* b (sin (/ PI (* 180.0 (/ 1.0 angle_m)))))) 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) / (180.0 * (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(Math.hypot((a * Math.cos((Math.PI * (angle_m * 0.005555555555555556)))), (b * Math.sin((Math.PI / (180.0 * (1.0 / angle_m)))))), 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 / (180.0 * (1.0 / angle_m)))))), 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(pi / Float64(180.0 * Float64(1.0 / angle_m)))))) ^ 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 / (180.0 * (1.0 / angle_m)))))) ^ 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[(Pi / N[(180.0 * N[(1.0 / angle$95$m), $MachinePrecision]), $MachinePrecision]), $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}{180 \cdot \frac{1}{angle\_m}}\right)\right)\right)}^{2}
\end{array}
Initial program 81.2%
Simplified81.2%
metadata-eval81.2%
div-inv81.2%
clear-num81.1%
un-div-inv81.2%
Applied egg-rr81.2%
add-sqr-sqrt81.1%
div-inv81.1%
times-frac81.1%
Applied egg-rr81.1%
Applied egg-rr81.2%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (let* ((t_0 (* PI (/ angle_m 180.0)))) (+ (pow (* a (cos t_0)) 2.0) (pow (* b (sin t_0)) 2.0))))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double t_0 = ((double) M_PI) * (angle_m / 180.0);
return pow((a * 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 / 180.0);
return Math.pow((a * 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 / 180.0) return math.pow((a * 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 / 180.0)) return Float64((Float64(a * cos(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 / 180.0); tmp = ((a * 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 / 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}
angle_m = \left|angle\right|
\\
\begin{array}{l}
t_0 := \pi \cdot \frac{angle\_m}{180}\\
{\left(a \cdot \cos t\_0\right)}^{2} + {\left(b \cdot \sin t\_0\right)}^{2}
\end{array}
\end{array}
Initial program 81.2%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (let* ((t_0 (* PI (* angle_m 0.005555555555555556)))) (pow (hypot (* b (sin t_0)) (* a (cos t_0))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double t_0 = ((double) M_PI) * (angle_m * 0.005555555555555556);
return pow(hypot((b * sin(t_0)), (a * cos(t_0))), 2.0);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double t_0 = Math.PI * (angle_m * 0.005555555555555556);
return Math.pow(Math.hypot((b * Math.sin(t_0)), (a * Math.cos(t_0))), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): t_0 = math.pi * (angle_m * 0.005555555555555556) return math.pow(math.hypot((b * math.sin(t_0)), (a * math.cos(t_0))), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) t_0 = Float64(pi * Float64(angle_m * 0.005555555555555556)) return hypot(Float64(b * sin(t_0)), Float64(a * cos(t_0))) ^ 2.0 end
angle_m = abs(angle); function tmp = code(a, b, angle_m) t_0 = pi * (angle_m * 0.005555555555555556); tmp = hypot((b * sin(t_0)), (a * cos(t_0))) ^ 2.0; end
angle_m = N[Abs[angle], $MachinePrecision]
code[a_, b_, angle$95$m_] := Block[{t$95$0 = N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]}, N[Power[N[Sqrt[N[(b * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision] ^ 2 + N[(a * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision], 2.0], $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
t_0 := \pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)\\
{\left(\mathsf{hypot}\left(b \cdot \sin t\_0, a \cdot \cos t\_0\right)\right)}^{2}
\end{array}
\end{array}
Initial program 81.2%
Simplified81.2%
metadata-eval81.2%
div-inv81.2%
clear-num81.1%
un-div-inv81.2%
Applied egg-rr81.2%
div-inv81.1%
clear-num81.2%
div-inv81.2%
metadata-eval81.2%
add-sqr-sqrt37.8%
associate-*r*37.9%
Applied egg-rr37.9%
Applied egg-rr81.2%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (* a (* a (/ (+ 1.0 (cos (* PI (* angle_m 0.011111111111111112)))) 2.0))) (pow (* b (sin (* PI (* angle_m 0.005555555555555556)))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return (a * (a * ((1.0 + cos((((double) M_PI) * (angle_m * 0.011111111111111112)))) / 2.0))) + pow((b * sin((((double) M_PI) * (angle_m * 0.005555555555555556)))), 2.0);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return (a * (a * ((1.0 + Math.cos((Math.PI * (angle_m * 0.011111111111111112)))) / 2.0))) + Math.pow((b * Math.sin((Math.PI * (angle_m * 0.005555555555555556)))), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return (a * (a * ((1.0 + math.cos((math.pi * (angle_m * 0.011111111111111112)))) / 2.0))) + math.pow((b * math.sin((math.pi * (angle_m * 0.005555555555555556)))), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) return Float64(Float64(a * Float64(a * Float64(Float64(1.0 + cos(Float64(pi * Float64(angle_m * 0.011111111111111112)))) / 2.0))) + (Float64(b * sin(Float64(pi * Float64(angle_m * 0.005555555555555556)))) ^ 2.0)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = (a * (a * ((1.0 + cos((pi * (angle_m * 0.011111111111111112)))) / 2.0))) + ((b * sin((pi * (angle_m * 0.005555555555555556)))) ^ 2.0); end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(N[(a * N[(a * N[(N[(1.0 + N[Cos[N[(Pi * N[(angle$95$m * 0.011111111111111112), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Power[N[(b * N[Sin[N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
a \cdot \left(a \cdot \frac{1 + \cos \left(\pi \cdot \left(angle\_m \cdot 0.011111111111111112\right)\right)}{2}\right) + {\left(b \cdot \sin \left(\pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)\right)\right)}^{2}
\end{array}
Initial program 81.2%
Simplified81.2%
metadata-eval81.2%
div-inv81.2%
unpow281.2%
*-commutative81.2%
associate-*r*81.2%
Applied egg-rr81.1%
Taylor expanded in a around 0 81.0%
unpow281.0%
associate-*r*80.0%
*-commutative80.0%
*-commutative80.0%
associate-*r*81.2%
*-commutative81.2%
*-commutative81.2%
cos-mult81.2%
Applied egg-rr81.2%
+-commutative81.2%
+-inverses81.2%
cos-081.2%
distribute-lft-out81.2%
distribute-lft-out81.2%
metadata-eval81.2%
Simplified81.2%
Final simplification81.2%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (if (<= a 7.8e-34) (pow (* b (sin (* angle_m (* PI 0.005555555555555556)))) 2.0) (pow (* a (cos (* PI (* angle_m 0.005555555555555556)))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if (a <= 7.8e-34) {
tmp = pow((b * sin((angle_m * (((double) M_PI) * 0.005555555555555556)))), 2.0);
} else {
tmp = pow((a * 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 (a <= 7.8e-34) {
tmp = Math.pow((b * Math.sin((angle_m * (Math.PI * 0.005555555555555556)))), 2.0);
} else {
tmp = Math.pow((a * 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 a <= 7.8e-34: tmp = math.pow((b * math.sin((angle_m * (math.pi * 0.005555555555555556)))), 2.0) else: tmp = math.pow((a * 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 (a <= 7.8e-34) tmp = Float64(b * sin(Float64(angle_m * Float64(pi * 0.005555555555555556)))) ^ 2.0; else tmp = Float64(a * 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 (a <= 7.8e-34) tmp = (b * sin((angle_m * (pi * 0.005555555555555556)))) ^ 2.0; else tmp = (a * 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[a, 7.8e-34], N[Power[N[(b * N[Sin[N[(angle$95$m * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[Power[N[(a * 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}\;a \leq 7.8 \cdot 10^{-34}:\\
\;\;\;\;{\left(b \cdot \sin \left(angle\_m \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;{\left(a \cdot \cos \left(\pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)\right)\right)}^{2}\\
\end{array}
\end{array}
if a < 7.79999999999999982e-34Initial program 79.5%
Simplified79.5%
metadata-eval79.5%
div-inv79.6%
clear-num79.4%
un-div-inv79.5%
Applied egg-rr79.5%
div-inv79.4%
clear-num79.6%
div-inv79.5%
metadata-eval79.5%
add-sqr-sqrt37.5%
associate-*r*37.7%
Applied egg-rr37.7%
Taylor expanded in a around 0 45.3%
unpow245.3%
associate-*r*45.2%
unpow245.2%
rem-square-sqrt45.2%
*-commutative45.2%
*-commutative45.2%
*-commutative45.2%
associate-*r*45.2%
unpow245.2%
swap-sqr49.2%
unpow249.2%
Simplified49.2%
if 7.79999999999999982e-34 < a Initial program 87.1%
Simplified87.1%
metadata-eval87.1%
div-inv87.1%
clear-num87.1%
un-div-inv87.1%
Applied egg-rr87.1%
Taylor expanded in a around inf 78.2%
unpow278.2%
*-commutative78.2%
associate-*r*78.2%
*-commutative78.2%
*-commutative78.2%
unpow278.2%
swap-sqr76.8%
unpow276.8%
Simplified78.2%
Final simplification55.6%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (if (<= a 7.2e-33) (pow (* b (sin (* 0.005555555555555556 (* PI angle_m)))) 2.0) (pow (* a (cos (* PI (* angle_m 0.005555555555555556)))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if (a <= 7.2e-33) {
tmp = pow((b * sin((0.005555555555555556 * (((double) M_PI) * angle_m)))), 2.0);
} else {
tmp = pow((a * 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 (a <= 7.2e-33) {
tmp = Math.pow((b * Math.sin((0.005555555555555556 * (Math.PI * angle_m)))), 2.0);
} else {
tmp = Math.pow((a * 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 a <= 7.2e-33: tmp = math.pow((b * math.sin((0.005555555555555556 * (math.pi * angle_m)))), 2.0) else: tmp = math.pow((a * 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 (a <= 7.2e-33) tmp = Float64(b * sin(Float64(0.005555555555555556 * Float64(pi * angle_m)))) ^ 2.0; else tmp = Float64(a * 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 (a <= 7.2e-33) tmp = (b * sin((0.005555555555555556 * (pi * angle_m)))) ^ 2.0; else tmp = (a * 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[a, 7.2e-33], 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[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
\mathbf{if}\;a \leq 7.2 \cdot 10^{-33}:\\
\;\;\;\;{\left(b \cdot \sin \left(0.005555555555555556 \cdot \left(\pi \cdot angle\_m\right)\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;{\left(a \cdot \cos \left(\pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)\right)\right)}^{2}\\
\end{array}
\end{array}
if a < 7.20000000000000068e-33Initial program 79.5%
Simplified79.5%
Taylor expanded in a around 0 45.2%
unpow245.2%
*-commutative45.2%
unpow245.2%
swap-sqr49.1%
unpow249.1%
*-commutative49.1%
Simplified49.1%
if 7.20000000000000068e-33 < a Initial program 87.1%
Simplified87.1%
metadata-eval87.1%
div-inv87.1%
clear-num87.1%
un-div-inv87.1%
Applied egg-rr87.1%
Taylor expanded in a around inf 78.2%
unpow278.2%
*-commutative78.2%
associate-*r*78.2%
*-commutative78.2%
*-commutative78.2%
unpow278.2%
swap-sqr76.8%
unpow276.8%
Simplified78.2%
Final simplification55.6%
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 81.2%
Simplified81.2%
metadata-eval81.2%
div-inv81.2%
unpow281.2%
*-commutative81.2%
associate-*r*81.2%
Applied egg-rr81.1%
Taylor expanded in angle around 0 81.0%
Final simplification81.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 81.2%
Simplified81.2%
Taylor expanded in angle around 0 60.5%
unpow260.5%
Applied egg-rr60.5%
herbie shell --seed 2024141
(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)))