
(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 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* (/ angle 180.0) PI))) (+ (pow (* a (sin t_0)) 2.0) (pow (* b (cos t_0)) 2.0))))
double code(double a, double b, double angle) {
double t_0 = (angle / 180.0) * ((double) M_PI);
return pow((a * sin(t_0)), 2.0) + pow((b * cos(t_0)), 2.0);
}
public static double code(double a, double b, double angle) {
double t_0 = (angle / 180.0) * Math.PI;
return Math.pow((a * Math.sin(t_0)), 2.0) + Math.pow((b * Math.cos(t_0)), 2.0);
}
def code(a, b, angle): t_0 = (angle / 180.0) * math.pi return math.pow((a * math.sin(t_0)), 2.0) + math.pow((b * math.cos(t_0)), 2.0)
function code(a, b, angle) t_0 = Float64(Float64(angle / 180.0) * pi) return Float64((Float64(a * sin(t_0)) ^ 2.0) + (Float64(b * cos(t_0)) ^ 2.0)) end
function tmp = code(a, b, angle) t_0 = (angle / 180.0) * pi; tmp = ((a * sin(t_0)) ^ 2.0) + ((b * cos(t_0)) ^ 2.0); end
code[a_, b_, angle_] := Block[{t$95$0 = N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]}, N[(N[Power[N[(a * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{angle}{180} \cdot \pi\\
{\left(a \cdot \sin t\_0\right)}^{2} + {\left(b \cdot \cos t\_0\right)}^{2}
\end{array}
\end{array}
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
:precision binary64
(+
(pow (* a (sin (* angle_m (/ PI 180.0)))) 2.0)
(*
(pow
(log (exp (cos (pow (sqrt (* PI (* angle_m 0.005555555555555556))) 2.0))))
2.0)
(pow b 2.0))))angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow((a * sin((angle_m * (((double) M_PI) / 180.0)))), 2.0) + (pow(log(exp(cos(pow(sqrt((((double) M_PI) * (angle_m * 0.005555555555555556))), 2.0)))), 2.0) * pow(b, 2.0));
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return Math.pow((a * Math.sin((angle_m * (Math.PI / 180.0)))), 2.0) + (Math.pow(Math.log(Math.exp(Math.cos(Math.pow(Math.sqrt((Math.PI * (angle_m * 0.005555555555555556))), 2.0)))), 2.0) * Math.pow(b, 2.0));
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow((a * math.sin((angle_m * (math.pi / 180.0)))), 2.0) + (math.pow(math.log(math.exp(math.cos(math.pow(math.sqrt((math.pi * (angle_m * 0.005555555555555556))), 2.0)))), 2.0) * math.pow(b, 2.0))
angle_m = abs(angle) function code(a, b, angle_m) return Float64((Float64(a * sin(Float64(angle_m * Float64(pi / 180.0)))) ^ 2.0) + Float64((log(exp(cos((sqrt(Float64(pi * Float64(angle_m * 0.005555555555555556))) ^ 2.0)))) ^ 2.0) * (b ^ 2.0))) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = ((a * sin((angle_m * (pi / 180.0)))) ^ 2.0) + ((log(exp(cos((sqrt((pi * (angle_m * 0.005555555555555556))) ^ 2.0)))) ^ 2.0) * (b ^ 2.0)); end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(N[Power[N[(a * N[Sin[N[(angle$95$m * N[(Pi / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(N[Power[N[Log[N[Exp[N[Cos[N[Power[N[Sqrt[N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] * N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{\left(a \cdot \sin \left(angle\_m \cdot \frac{\pi}{180}\right)\right)}^{2} + {\log \left(e^{\cos \left({\left(\sqrt{\pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)}\right)}^{2}\right)}\right)}^{2} \cdot {b}^{2}
\end{array}
Initial program 81.7%
unpow281.7%
swap-sqr81.7%
*-commutative81.7%
associate-*r/81.7%
associate-*l/81.7%
*-commutative81.7%
swap-sqr81.7%
unpow281.7%
*-commutative81.7%
associate-*r/81.7%
associate-*l/81.7%
*-commutative81.7%
Simplified81.7%
*-commutative81.7%
associate-*r/81.7%
associate-*l/81.7%
unpow-prod-down81.7%
associate-*l/81.7%
associate-*r/81.7%
div-inv81.7%
metadata-eval81.7%
Applied egg-rr81.7%
add-log-exp81.7%
Applied egg-rr81.7%
expm1-log1p-u63.9%
add-sqr-sqrt40.5%
pow240.5%
expm1-log1p-u40.5%
*-commutative40.5%
associate-*l*40.5%
Applied egg-rr40.5%
Final simplification40.5%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow (* a (sin (* PI (/ angle_m 180.0)))) 2.0) (pow (* b (cos (pow (sqrt (* angle_m (* PI 0.005555555555555556))) 2.0))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow((a * sin((((double) M_PI) * (angle_m / 180.0)))), 2.0) + pow((b * cos(pow(sqrt((angle_m * (((double) M_PI) * 0.005555555555555556))), 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.sin((Math.PI * (angle_m / 180.0)))), 2.0) + Math.pow((b * Math.cos(Math.pow(Math.sqrt((angle_m * (Math.PI * 0.005555555555555556))), 2.0))), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow((a * math.sin((math.pi * (angle_m / 180.0)))), 2.0) + math.pow((b * math.cos(math.pow(math.sqrt((angle_m * (math.pi * 0.005555555555555556))), 2.0))), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) return Float64((Float64(a * sin(Float64(pi * Float64(angle_m / 180.0)))) ^ 2.0) + (Float64(b * cos((sqrt(Float64(angle_m * Float64(pi * 0.005555555555555556))) ^ 2.0))) ^ 2.0)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = ((a * sin((pi * (angle_m / 180.0)))) ^ 2.0) + ((b * cos((sqrt((angle_m * (pi * 0.005555555555555556))) ^ 2.0))) ^ 2.0); end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(N[Power[N[(a * N[Sin[N[(Pi * N[(angle$95$m / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[N[Power[N[Sqrt[N[(angle$95$m * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{\left(a \cdot \sin \left(\pi \cdot \frac{angle\_m}{180}\right)\right)}^{2} + {\left(b \cdot \cos \left({\left(\sqrt{angle\_m \cdot \left(\pi \cdot 0.005555555555555556\right)}\right)}^{2}\right)\right)}^{2}
\end{array}
Initial program 81.7%
add-sqr-sqrt40.5%
pow240.5%
associate-*l/40.5%
associate-*r/40.5%
div-inv40.5%
metadata-eval40.5%
Applied egg-rr40.5%
Final simplification40.5%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow (* a (sin (* angle_m (/ PI 180.0)))) 2.0) (* (pow b 2.0) (pow (cos (* angle_m (* PI 0.005555555555555556))) 2.0))))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow((a * sin((angle_m * (((double) M_PI) / 180.0)))), 2.0) + (pow(b, 2.0) * pow(cos((angle_m * (((double) M_PI) * 0.005555555555555556))), 2.0));
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return Math.pow((a * Math.sin((angle_m * (Math.PI / 180.0)))), 2.0) + (Math.pow(b, 2.0) * Math.pow(Math.cos((angle_m * (Math.PI * 0.005555555555555556))), 2.0));
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow((a * math.sin((angle_m * (math.pi / 180.0)))), 2.0) + (math.pow(b, 2.0) * math.pow(math.cos((angle_m * (math.pi * 0.005555555555555556))), 2.0))
angle_m = abs(angle) function code(a, b, angle_m) return Float64((Float64(a * sin(Float64(angle_m * Float64(pi / 180.0)))) ^ 2.0) + Float64((b ^ 2.0) * (cos(Float64(angle_m * Float64(pi * 0.005555555555555556))) ^ 2.0))) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = ((a * sin((angle_m * (pi / 180.0)))) ^ 2.0) + ((b ^ 2.0) * (cos((angle_m * (pi * 0.005555555555555556))) ^ 2.0)); end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(N[Power[N[(a * N[Sin[N[(angle$95$m * N[(Pi / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(N[Power[b, 2.0], $MachinePrecision] * N[Power[N[Cos[N[(angle$95$m * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{\left(a \cdot \sin \left(angle\_m \cdot \frac{\pi}{180}\right)\right)}^{2} + {b}^{2} \cdot {\cos \left(angle\_m \cdot \left(\pi \cdot 0.005555555555555556\right)\right)}^{2}
\end{array}
Initial program 81.7%
unpow281.7%
swap-sqr81.7%
*-commutative81.7%
associate-*r/81.7%
associate-*l/81.7%
*-commutative81.7%
swap-sqr81.7%
unpow281.7%
*-commutative81.7%
associate-*r/81.7%
associate-*l/81.7%
*-commutative81.7%
Simplified81.7%
*-commutative81.7%
associate-*r/81.7%
associate-*l/81.7%
unpow-prod-down81.7%
associate-*l/81.7%
associate-*r/81.7%
div-inv81.7%
metadata-eval81.7%
Applied egg-rr81.7%
Final simplification81.7%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (let* ((t_0 (cos (* angle_m (* PI 0.005555555555555556))))) (+ (pow (* a (sin (* angle_m (/ PI 180.0)))) 2.0) (* t_0 (* b (* b t_0))))))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double t_0 = cos((angle_m * (((double) M_PI) * 0.005555555555555556)));
return pow((a * sin((angle_m * (((double) M_PI) / 180.0)))), 2.0) + (t_0 * (b * (b * t_0)));
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double t_0 = Math.cos((angle_m * (Math.PI * 0.005555555555555556)));
return Math.pow((a * Math.sin((angle_m * (Math.PI / 180.0)))), 2.0) + (t_0 * (b * (b * t_0)));
}
angle_m = math.fabs(angle) def code(a, b, angle_m): t_0 = math.cos((angle_m * (math.pi * 0.005555555555555556))) return math.pow((a * math.sin((angle_m * (math.pi / 180.0)))), 2.0) + (t_0 * (b * (b * t_0)))
angle_m = abs(angle) function code(a, b, angle_m) t_0 = cos(Float64(angle_m * Float64(pi * 0.005555555555555556))) return Float64((Float64(a * sin(Float64(angle_m * Float64(pi / 180.0)))) ^ 2.0) + Float64(t_0 * Float64(b * Float64(b * t_0)))) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) t_0 = cos((angle_m * (pi * 0.005555555555555556))); tmp = ((a * sin((angle_m * (pi / 180.0)))) ^ 2.0) + (t_0 * (b * (b * t_0))); end
angle_m = N[Abs[angle], $MachinePrecision]
code[a_, b_, angle$95$m_] := Block[{t$95$0 = N[Cos[N[(angle$95$m * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[(N[Power[N[(a * N[Sin[N[(angle$95$m * N[(Pi / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(t$95$0 * N[(b * N[(b * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
t_0 := \cos \left(angle\_m \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\\
{\left(a \cdot \sin \left(angle\_m \cdot \frac{\pi}{180}\right)\right)}^{2} + t\_0 \cdot \left(b \cdot \left(b \cdot t\_0\right)\right)
\end{array}
\end{array}
Initial program 81.7%
unpow281.7%
swap-sqr81.7%
*-commutative81.7%
associate-*r/81.7%
associate-*l/81.7%
*-commutative81.7%
swap-sqr81.7%
unpow281.7%
*-commutative81.7%
associate-*r/81.7%
associate-*l/81.7%
*-commutative81.7%
Simplified81.7%
unpow281.7%
associate-*r/80.2%
associate-*l/80.8%
associate-*r*80.8%
div-inv80.8%
metadata-eval80.8%
associate-/r/81.5%
div-inv81.7%
clear-num81.7%
div-inv81.7%
metadata-eval81.7%
Applied egg-rr81.7%
Final simplification81.7%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow (* b (cos (* angle_m (/ PI 180.0)))) 2.0) (pow (* a (sin (* 0.005555555555555556 (* angle_m PI)))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow((b * cos((angle_m * (((double) M_PI) / 180.0)))), 2.0) + pow((a * sin((0.005555555555555556 * (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((b * Math.cos((angle_m * (Math.PI / 180.0)))), 2.0) + Math.pow((a * Math.sin((0.005555555555555556 * (angle_m * Math.PI)))), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow((b * math.cos((angle_m * (math.pi / 180.0)))), 2.0) + math.pow((a * math.sin((0.005555555555555556 * (angle_m * math.pi)))), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) return Float64((Float64(b * cos(Float64(angle_m * Float64(pi / 180.0)))) ^ 2.0) + (Float64(a * sin(Float64(0.005555555555555556 * Float64(angle_m * pi)))) ^ 2.0)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = ((b * cos((angle_m * (pi / 180.0)))) ^ 2.0) + ((a * sin((0.005555555555555556 * (angle_m * pi)))) ^ 2.0); end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(N[Power[N[(b * N[Cos[N[(angle$95$m * N[(Pi / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(a * N[Sin[N[(0.005555555555555556 * N[(angle$95$m * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{\left(b \cdot \cos \left(angle\_m \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(a \cdot \sin \left(0.005555555555555556 \cdot \left(angle\_m \cdot \pi\right)\right)\right)}^{2}
\end{array}
Initial program 81.7%
unpow281.7%
swap-sqr81.7%
*-commutative81.7%
associate-*r/81.7%
associate-*l/81.7%
*-commutative81.7%
swap-sqr81.7%
unpow281.7%
*-commutative81.7%
associate-*r/81.7%
associate-*l/81.7%
*-commutative81.7%
Simplified81.7%
Taylor expanded in angle around inf 81.7%
Final simplification81.7%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (let* ((t_0 (* angle_m (/ PI 180.0)))) (+ (pow (* a (sin t_0)) 2.0) (pow (* b (cos t_0)) 2.0))))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double t_0 = angle_m * (((double) M_PI) / 180.0);
return pow((a * sin(t_0)), 2.0) + pow((b * cos(t_0)), 2.0);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double t_0 = angle_m * (Math.PI / 180.0);
return Math.pow((a * Math.sin(t_0)), 2.0) + Math.pow((b * Math.cos(t_0)), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): t_0 = angle_m * (math.pi / 180.0) return math.pow((a * math.sin(t_0)), 2.0) + math.pow((b * math.cos(t_0)), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) t_0 = Float64(angle_m * Float64(pi / 180.0)) return Float64((Float64(a * sin(t_0)) ^ 2.0) + (Float64(b * cos(t_0)) ^ 2.0)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) t_0 = angle_m * (pi / 180.0); tmp = ((a * sin(t_0)) ^ 2.0) + ((b * cos(t_0)) ^ 2.0); end
angle_m = N[Abs[angle], $MachinePrecision]
code[a_, b_, angle$95$m_] := Block[{t$95$0 = N[(angle$95$m * N[(Pi / 180.0), $MachinePrecision]), $MachinePrecision]}, N[(N[Power[N[(a * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
t_0 := angle\_m \cdot \frac{\pi}{180}\\
{\left(a \cdot \sin t\_0\right)}^{2} + {\left(b \cdot \cos t\_0\right)}^{2}
\end{array}
\end{array}
Initial program 81.7%
unpow281.7%
swap-sqr81.7%
*-commutative81.7%
associate-*r/81.7%
associate-*l/81.7%
*-commutative81.7%
swap-sqr81.7%
unpow281.7%
*-commutative81.7%
associate-*r/81.7%
associate-*l/81.7%
*-commutative81.7%
Simplified81.7%
Final simplification81.7%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow (* a (sin (* PI (/ angle_m 180.0)))) 2.0) (pow (* b (cos (/ (* angle_m PI) 180.0))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow((a * sin((((double) M_PI) * (angle_m / 180.0)))), 2.0) + pow((b * 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((a * Math.sin((Math.PI * (angle_m / 180.0)))), 2.0) + Math.pow((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((a * math.sin((math.pi * (angle_m / 180.0)))), 2.0) + math.pow((b * math.cos(((angle_m * math.pi) / 180.0))), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) return Float64((Float64(a * sin(Float64(pi * Float64(angle_m / 180.0)))) ^ 2.0) + (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 = ((a * sin((pi * (angle_m / 180.0)))) ^ 2.0) + ((b * cos(((angle_m * pi) / 180.0))) ^ 2.0); end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(N[Power[N[(a * N[Sin[N[(Pi * N[(angle$95$m / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[N[(N[(angle$95$m * Pi), $MachinePrecision] / 180.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{\left(a \cdot \sin \left(\pi \cdot \frac{angle\_m}{180}\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle\_m \cdot \pi}{180}\right)\right)}^{2}
\end{array}
Initial program 81.7%
associate-*l/81.7%
Applied egg-rr81.7%
Final simplification81.7%
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
:precision binary64
(if (<= a 5e-198)
(+
(pow b 2.0)
(cbrt (pow (* a (* PI (* angle_m 0.005555555555555556))) 6.0)))
(+
(pow b 2.0)
(*
0.005555555555555556
(* (* 0.005555555555555556 (* a (* angle_m PI))) (* PI (* a angle_m)))))))angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if (a <= 5e-198) {
tmp = pow(b, 2.0) + cbrt(pow((a * (((double) M_PI) * (angle_m * 0.005555555555555556))), 6.0));
} else {
tmp = pow(b, 2.0) + (0.005555555555555556 * ((0.005555555555555556 * (a * (angle_m * ((double) M_PI)))) * (((double) M_PI) * (a * angle_m))));
}
return tmp;
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double tmp;
if (a <= 5e-198) {
tmp = Math.pow(b, 2.0) + Math.cbrt(Math.pow((a * (Math.PI * (angle_m * 0.005555555555555556))), 6.0));
} else {
tmp = Math.pow(b, 2.0) + (0.005555555555555556 * ((0.005555555555555556 * (a * (angle_m * Math.PI))) * (Math.PI * (a * angle_m))));
}
return tmp;
}
angle_m = abs(angle) function code(a, b, angle_m) tmp = 0.0 if (a <= 5e-198) tmp = Float64((b ^ 2.0) + cbrt((Float64(a * Float64(pi * Float64(angle_m * 0.005555555555555556))) ^ 6.0))); else tmp = Float64((b ^ 2.0) + Float64(0.005555555555555556 * Float64(Float64(0.005555555555555556 * Float64(a * Float64(angle_m * pi))) * Float64(pi * Float64(a * angle_m))))); end return tmp end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := If[LessEqual[a, 5e-198], N[(N[Power[b, 2.0], $MachinePrecision] + N[Power[N[Power[N[(a * N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 6.0], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(N[Power[b, 2.0], $MachinePrecision] + N[(0.005555555555555556 * N[(N[(0.005555555555555556 * N[(a * N[(angle$95$m * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(Pi * N[(a * angle$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
\mathbf{if}\;a \leq 5 \cdot 10^{-198}:\\
\;\;\;\;{b}^{2} + \sqrt[3]{{\left(a \cdot \left(\pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)\right)\right)}^{6}}\\
\mathbf{else}:\\
\;\;\;\;{b}^{2} + 0.005555555555555556 \cdot \left(\left(0.005555555555555556 \cdot \left(a \cdot \left(angle\_m \cdot \pi\right)\right)\right) \cdot \left(\pi \cdot \left(a \cdot angle\_m\right)\right)\right)\\
\end{array}
\end{array}
if a < 4.9999999999999999e-198Initial program 80.3%
unpow280.3%
swap-sqr80.3%
*-commutative80.3%
associate-*r/80.3%
associate-*l/80.3%
*-commutative80.3%
swap-sqr80.2%
unpow280.2%
*-commutative80.2%
associate-*r/80.3%
associate-*l/80.3%
*-commutative80.3%
Simplified80.3%
Taylor expanded in angle around 0 79.9%
div-inv79.9%
metadata-eval79.9%
pow279.9%
rem-cbrt-cube76.6%
rem-cbrt-cube76.6%
cbrt-unprod73.4%
pow-prod-up73.4%
metadata-eval73.4%
Applied egg-rr73.4%
Taylor expanded in angle around 0 66.4%
associate-*r*66.4%
*-commutative66.4%
Simplified66.4%
if 4.9999999999999999e-198 < a Initial program 83.6%
unpow283.6%
swap-sqr83.6%
*-commutative83.6%
associate-*r/83.6%
associate-*l/83.7%
*-commutative83.7%
swap-sqr83.7%
unpow283.7%
*-commutative83.7%
associate-*r/83.7%
associate-*l/83.7%
*-commutative83.7%
Simplified83.7%
Taylor expanded in angle around 0 83.7%
Taylor expanded in angle around 0 80.7%
*-commutative80.7%
associate-*l*80.6%
Simplified80.6%
unpow280.6%
associate-*l*80.7%
associate-*r*80.7%
*-commutative80.7%
associate-*l*80.7%
*-commutative80.7%
associate-*l*80.7%
Applied egg-rr80.7%
*-commutative80.7%
associate-*l*80.7%
Simplified80.7%
Taylor expanded in angle around 0 80.7%
*-commutative80.7%
Simplified80.7%
Final simplification72.4%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow b 2.0) (pow (* a (sin (* 0.005555555555555556 (* angle_m PI)))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow(b, 2.0) + pow((a * sin((0.005555555555555556 * (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(b, 2.0) + Math.pow((a * Math.sin((0.005555555555555556 * (angle_m * Math.PI)))), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow(b, 2.0) + math.pow((a * math.sin((0.005555555555555556 * (angle_m * math.pi)))), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) return Float64((b ^ 2.0) + (Float64(a * sin(Float64(0.005555555555555556 * Float64(angle_m * pi)))) ^ 2.0)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = (b ^ 2.0) + ((a * sin((0.005555555555555556 * (angle_m * pi)))) ^ 2.0); end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(N[Power[b, 2.0], $MachinePrecision] + N[Power[N[(a * N[Sin[N[(0.005555555555555556 * N[(angle$95$m * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{b}^{2} + {\left(a \cdot \sin \left(0.005555555555555556 \cdot \left(angle\_m \cdot \pi\right)\right)\right)}^{2}
\end{array}
Initial program 81.7%
unpow281.7%
swap-sqr81.7%
*-commutative81.7%
associate-*r/81.7%
associate-*l/81.7%
*-commutative81.7%
swap-sqr81.7%
unpow281.7%
*-commutative81.7%
associate-*r/81.7%
associate-*l/81.7%
*-commutative81.7%
Simplified81.7%
Taylor expanded in angle around 0 81.5%
Taylor expanded in a around 0 73.3%
*-commutative73.3%
associate-*r*73.3%
unpow273.3%
unpow273.3%
swap-sqr81.5%
unpow281.5%
associate-*r*81.5%
*-commutative81.5%
Simplified81.5%
Final simplification81.5%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow (* a (sin (* angle_m (/ PI 180.0)))) 2.0) (pow b 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow((a * sin((angle_m * (((double) M_PI) / 180.0)))), 2.0) + pow(b, 2.0);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return Math.pow((a * Math.sin((angle_m * (Math.PI / 180.0)))), 2.0) + Math.pow(b, 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow((a * math.sin((angle_m * (math.pi / 180.0)))), 2.0) + math.pow(b, 2.0)
angle_m = abs(angle) function code(a, b, angle_m) return Float64((Float64(a * sin(Float64(angle_m * Float64(pi / 180.0)))) ^ 2.0) + (b ^ 2.0)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = ((a * sin((angle_m * (pi / 180.0)))) ^ 2.0) + (b ^ 2.0); end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(N[Power[N[(a * N[Sin[N[(angle$95$m * N[(Pi / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{\left(a \cdot \sin \left(angle\_m \cdot \frac{\pi}{180}\right)\right)}^{2} + {b}^{2}
\end{array}
Initial program 81.7%
unpow281.7%
swap-sqr81.7%
*-commutative81.7%
associate-*r/81.7%
associate-*l/81.7%
*-commutative81.7%
swap-sqr81.7%
unpow281.7%
*-commutative81.7%
associate-*r/81.7%
associate-*l/81.7%
*-commutative81.7%
Simplified81.7%
Taylor expanded in angle around 0 81.5%
Final simplification81.5%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow b 2.0) (* 0.005555555555555556 (* (* 0.005555555555555556 (* a (* angle_m PI))) (* PI (* a angle_m))))))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow(b, 2.0) + (0.005555555555555556 * ((0.005555555555555556 * (a * (angle_m * ((double) M_PI)))) * (((double) M_PI) * (a * angle_m))));
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return Math.pow(b, 2.0) + (0.005555555555555556 * ((0.005555555555555556 * (a * (angle_m * Math.PI))) * (Math.PI * (a * angle_m))));
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow(b, 2.0) + (0.005555555555555556 * ((0.005555555555555556 * (a * (angle_m * math.pi))) * (math.pi * (a * angle_m))))
angle_m = abs(angle) function code(a, b, angle_m) return Float64((b ^ 2.0) + Float64(0.005555555555555556 * Float64(Float64(0.005555555555555556 * Float64(a * Float64(angle_m * pi))) * Float64(pi * Float64(a * angle_m))))) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = (b ^ 2.0) + (0.005555555555555556 * ((0.005555555555555556 * (a * (angle_m * pi))) * (pi * (a * angle_m)))); end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(N[Power[b, 2.0], $MachinePrecision] + N[(0.005555555555555556 * N[(N[(0.005555555555555556 * N[(a * N[(angle$95$m * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(Pi * N[(a * angle$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{b}^{2} + 0.005555555555555556 \cdot \left(\left(0.005555555555555556 \cdot \left(a \cdot \left(angle\_m \cdot \pi\right)\right)\right) \cdot \left(\pi \cdot \left(a \cdot angle\_m\right)\right)\right)
\end{array}
Initial program 81.7%
unpow281.7%
swap-sqr81.7%
*-commutative81.7%
associate-*r/81.7%
associate-*l/81.7%
*-commutative81.7%
swap-sqr81.7%
unpow281.7%
*-commutative81.7%
associate-*r/81.7%
associate-*l/81.7%
*-commutative81.7%
Simplified81.7%
Taylor expanded in angle around 0 81.5%
Taylor expanded in angle around 0 73.7%
*-commutative73.7%
associate-*l*73.7%
Simplified73.7%
unpow273.7%
associate-*l*73.7%
associate-*r*73.7%
*-commutative73.7%
associate-*l*73.7%
*-commutative73.7%
associate-*l*73.7%
Applied egg-rr73.7%
*-commutative73.7%
associate-*l*73.7%
Simplified73.7%
Taylor expanded in angle around 0 73.7%
*-commutative73.7%
Simplified73.7%
Final simplification73.7%
herbie shell --seed 2024027
(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)))