
(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 15 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 (cbrt (* angle_m 0.005555555555555556))))
(+
(pow (* a (cos (* (exp (* 2.0 (log t_0))) (* t_0 PI)))) 2.0)
(pow (* b (sin (* PI (/ angle_m 180.0)))) 2.0))))angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double t_0 = cbrt((angle_m * 0.005555555555555556));
return pow((a * cos((exp((2.0 * log(t_0))) * (t_0 * ((double) M_PI))))), 2.0) + pow((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) {
double t_0 = Math.cbrt((angle_m * 0.005555555555555556));
return Math.pow((a * Math.cos((Math.exp((2.0 * Math.log(t_0))) * (t_0 * Math.PI)))), 2.0) + Math.pow((b * Math.sin((Math.PI * (angle_m / 180.0)))), 2.0);
}
angle_m = abs(angle) function code(a, b, angle_m) t_0 = cbrt(Float64(angle_m * 0.005555555555555556)) return Float64((Float64(a * cos(Float64(exp(Float64(2.0 * log(t_0))) * Float64(t_0 * pi)))) ^ 2.0) + (Float64(b * sin(Float64(pi * Float64(angle_m / 180.0)))) ^ 2.0)) end
angle_m = N[Abs[angle], $MachinePrecision]
code[a_, b_, angle$95$m_] := Block[{t$95$0 = N[Power[N[(angle$95$m * 0.005555555555555556), $MachinePrecision], 1/3], $MachinePrecision]}, N[(N[Power[N[(a * N[Cos[N[(N[Exp[N[(2.0 * N[Log[t$95$0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[N[(Pi * N[(angle$95$m / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
t_0 := \sqrt[3]{angle_m \cdot 0.005555555555555556}\\
{\left(a \cdot \cos \left(e^{2 \cdot \log t_0} \cdot \left(t_0 \cdot \pi\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle_m}{180}\right)\right)}^{2}
\end{array}
\end{array}
Initial program 80.3%
expm1-log1p-u64.2%
div-inv64.2%
metadata-eval64.2%
Applied egg-rr64.2%
expm1-log1p-u80.4%
metadata-eval80.4%
div-inv80.3%
*-commutative80.3%
div-inv80.4%
metadata-eval80.4%
add-cube-cbrt80.6%
associate-*l*80.6%
pow280.6%
Applied egg-rr80.6%
add-exp-log80.6%
log-pow38.5%
Applied egg-rr38.5%
Final simplification38.5%
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
:precision binary64
(let* ((t_0 (cbrt (* angle_m 0.005555555555555556))))
(+
(pow (* b (sin (* PI (/ angle_m 180.0)))) 2.0)
(pow (* a (cos (* t_0 (* PI (pow t_0 2.0))))) 2.0))))angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double t_0 = cbrt((angle_m * 0.005555555555555556));
return pow((b * sin((((double) M_PI) * (angle_m / 180.0)))), 2.0) + pow((a * cos((t_0 * (((double) M_PI) * pow(t_0, 2.0))))), 2.0);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double t_0 = Math.cbrt((angle_m * 0.005555555555555556));
return Math.pow((b * Math.sin((Math.PI * (angle_m / 180.0)))), 2.0) + Math.pow((a * Math.cos((t_0 * (Math.PI * Math.pow(t_0, 2.0))))), 2.0);
}
angle_m = abs(angle) function code(a, b, angle_m) t_0 = cbrt(Float64(angle_m * 0.005555555555555556)) return Float64((Float64(b * sin(Float64(pi * Float64(angle_m / 180.0)))) ^ 2.0) + (Float64(a * cos(Float64(t_0 * Float64(pi * (t_0 ^ 2.0))))) ^ 2.0)) end
angle_m = N[Abs[angle], $MachinePrecision]
code[a_, b_, angle$95$m_] := Block[{t$95$0 = N[Power[N[(angle$95$m * 0.005555555555555556), $MachinePrecision], 1/3], $MachinePrecision]}, N[(N[Power[N[(b * N[Sin[N[(Pi * N[(angle$95$m / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(a * N[Cos[N[(t$95$0 * N[(Pi * N[Power[t$95$0, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
t_0 := \sqrt[3]{angle_m \cdot 0.005555555555555556}\\
{\left(b \cdot \sin \left(\pi \cdot \frac{angle_m}{180}\right)\right)}^{2} + {\left(a \cdot \cos \left(t_0 \cdot \left(\pi \cdot {t_0}^{2}\right)\right)\right)}^{2}
\end{array}
\end{array}
Initial program 80.3%
expm1-log1p-u64.2%
div-inv64.2%
metadata-eval64.2%
Applied egg-rr64.2%
expm1-log1p-u80.4%
add-cube-cbrt80.6%
associate-*r*80.5%
pow280.5%
Applied egg-rr80.5%
Final simplification80.5%
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
:precision binary64
(let* ((t_0 (cbrt (* angle_m 0.005555555555555556))))
(+
(pow (* b (sin (* PI (/ angle_m 180.0)))) 2.0)
(pow (* a (cos (* (* t_0 PI) (pow t_0 2.0)))) 2.0))))angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double t_0 = cbrt((angle_m * 0.005555555555555556));
return pow((b * sin((((double) M_PI) * (angle_m / 180.0)))), 2.0) + pow((a * cos(((t_0 * ((double) M_PI)) * pow(t_0, 2.0)))), 2.0);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double t_0 = Math.cbrt((angle_m * 0.005555555555555556));
return Math.pow((b * Math.sin((Math.PI * (angle_m / 180.0)))), 2.0) + Math.pow((a * Math.cos(((t_0 * Math.PI) * Math.pow(t_0, 2.0)))), 2.0);
}
angle_m = abs(angle) function code(a, b, angle_m) t_0 = cbrt(Float64(angle_m * 0.005555555555555556)) return Float64((Float64(b * sin(Float64(pi * Float64(angle_m / 180.0)))) ^ 2.0) + (Float64(a * cos(Float64(Float64(t_0 * pi) * (t_0 ^ 2.0)))) ^ 2.0)) end
angle_m = N[Abs[angle], $MachinePrecision]
code[a_, b_, angle$95$m_] := Block[{t$95$0 = N[Power[N[(angle$95$m * 0.005555555555555556), $MachinePrecision], 1/3], $MachinePrecision]}, N[(N[Power[N[(b * N[Sin[N[(Pi * N[(angle$95$m / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(a * N[Cos[N[(N[(t$95$0 * Pi), $MachinePrecision] * N[Power[t$95$0, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
t_0 := \sqrt[3]{angle_m \cdot 0.005555555555555556}\\
{\left(b \cdot \sin \left(\pi \cdot \frac{angle_m}{180}\right)\right)}^{2} + {\left(a \cdot \cos \left(\left(t_0 \cdot \pi\right) \cdot {t_0}^{2}\right)\right)}^{2}
\end{array}
\end{array}
Initial program 80.3%
expm1-log1p-u64.2%
div-inv64.2%
metadata-eval64.2%
Applied egg-rr64.2%
expm1-log1p-u80.4%
metadata-eval80.4%
div-inv80.3%
*-commutative80.3%
div-inv80.4%
metadata-eval80.4%
add-cube-cbrt80.6%
associate-*l*80.6%
pow280.6%
Applied egg-rr80.6%
Final simplification80.6%
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
:precision binary64
(+
(pow (* b (sin (* PI (/ angle_m 180.0)))) 2.0)
(pow
(*
a
(cos
(pow
(pow (cbrt (* angle_m (* 0.005555555555555556 PI))) 0.16666666666666666)
18.0)))
2.0)))angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow((b * sin((((double) M_PI) * (angle_m / 180.0)))), 2.0) + pow((a * cos(pow(pow(cbrt((angle_m * (0.005555555555555556 * ((double) M_PI)))), 0.16666666666666666), 18.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 * (angle_m / 180.0)))), 2.0) + Math.pow((a * Math.cos(Math.pow(Math.pow(Math.cbrt((angle_m * (0.005555555555555556 * Math.PI))), 0.16666666666666666), 18.0))), 2.0);
}
angle_m = abs(angle) function code(a, b, angle_m) return Float64((Float64(b * sin(Float64(pi * Float64(angle_m / 180.0)))) ^ 2.0) + (Float64(a * cos(((cbrt(Float64(angle_m * Float64(0.005555555555555556 * pi))) ^ 0.16666666666666666) ^ 18.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[(angle$95$m / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(a * N[Cos[N[Power[N[Power[N[Power[N[(angle$95$m * N[(0.005555555555555556 * Pi), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], 0.16666666666666666], $MachinePrecision], 18.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{\left(b \cdot \sin \left(\pi \cdot \frac{angle_m}{180}\right)\right)}^{2} + {\left(a \cdot \cos \left({\left({\left(\sqrt[3]{angle_m \cdot \left(0.005555555555555556 \cdot \pi\right)}\right)}^{0.16666666666666666}\right)}^{18}\right)\right)}^{2}
\end{array}
Initial program 80.3%
add-cube-cbrt80.4%
pow380.4%
div-inv80.4%
metadata-eval80.4%
Applied egg-rr80.4%
add-cube-cbrt80.4%
pow380.3%
Applied egg-rr80.3%
pow-pow80.5%
add-sqr-sqrt38.4%
unpow-prod-down38.3%
pow1/338.4%
sqrt-pow138.4%
*-commutative38.4%
associate-*l*38.4%
metadata-eval38.4%
metadata-eval38.4%
Applied egg-rr38.4%
pow-sqr38.5%
*-commutative38.5%
metadata-eval38.5%
Simplified38.5%
Final simplification38.5%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow (* b (sin (* PI (/ angle_m 180.0)))) 2.0) (pow (* a (cos (pow (cbrt (cbrt (* angle_m (* 0.005555555555555556 PI)))) 9.0))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow((b * sin((((double) M_PI) * (angle_m / 180.0)))), 2.0) + pow((a * cos(pow(cbrt(cbrt((angle_m * (0.005555555555555556 * ((double) M_PI))))), 9.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 * (angle_m / 180.0)))), 2.0) + Math.pow((a * Math.cos(Math.pow(Math.cbrt(Math.cbrt((angle_m * (0.005555555555555556 * Math.PI)))), 9.0))), 2.0);
}
angle_m = abs(angle) function code(a, b, angle_m) return Float64((Float64(b * sin(Float64(pi * Float64(angle_m / 180.0)))) ^ 2.0) + (Float64(a * cos((cbrt(cbrt(Float64(angle_m * Float64(0.005555555555555556 * pi)))) ^ 9.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[(angle$95$m / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(a * N[Cos[N[Power[N[Power[N[Power[N[(angle$95$m * N[(0.005555555555555556 * Pi), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], 1/3], $MachinePrecision], 9.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{\left(b \cdot \sin \left(\pi \cdot \frac{angle_m}{180}\right)\right)}^{2} + {\left(a \cdot \cos \left({\left(\sqrt[3]{\sqrt[3]{angle_m \cdot \left(0.005555555555555556 \cdot \pi\right)}}\right)}^{9}\right)\right)}^{2}
\end{array}
Initial program 80.3%
add-cube-cbrt80.4%
pow380.4%
div-inv80.4%
metadata-eval80.4%
Applied egg-rr80.4%
add-cube-cbrt80.4%
pow380.3%
Applied egg-rr80.3%
pow-pow80.5%
pow-to-exp38.4%
Applied egg-rr38.4%
exp-to-pow80.5%
*-commutative80.5%
Simplified80.5%
Final simplification80.5%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow (* b (sin (* PI (/ angle_m 180.0)))) 2.0) (pow (* a (cos (expm1 (log1p (* (* angle_m 0.005555555555555556) PI))))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow((b * sin((((double) M_PI) * (angle_m / 180.0)))), 2.0) + pow((a * cos(expm1(log1p(((angle_m * 0.005555555555555556) * ((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.sin((Math.PI * (angle_m / 180.0)))), 2.0) + Math.pow((a * Math.cos(Math.expm1(Math.log1p(((angle_m * 0.005555555555555556) * Math.PI))))), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow((b * math.sin((math.pi * (angle_m / 180.0)))), 2.0) + math.pow((a * math.cos(math.expm1(math.log1p(((angle_m * 0.005555555555555556) * math.pi))))), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) return Float64((Float64(b * sin(Float64(pi * Float64(angle_m / 180.0)))) ^ 2.0) + (Float64(a * cos(expm1(log1p(Float64(Float64(angle_m * 0.005555555555555556) * pi))))) ^ 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[(angle$95$m / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(a * N[Cos[N[(Exp[N[Log[1 + N[(N[(angle$95$m * 0.005555555555555556), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{\left(b \cdot \sin \left(\pi \cdot \frac{angle_m}{180}\right)\right)}^{2} + {\left(a \cdot \cos \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\left(angle_m \cdot 0.005555555555555556\right) \cdot \pi\right)\right)\right)\right)}^{2}
\end{array}
Initial program 80.3%
expm1-log1p-u64.2%
div-inv64.2%
metadata-eval64.2%
Applied egg-rr64.2%
Final simplification64.2%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow (* a (cos (* -0.005555555555555556 (* angle_m PI)))) 2.0) (pow (* b (sin (* angle_m (/ PI -180.0)))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow((a * cos((-0.005555555555555556 * (angle_m * ((double) M_PI))))), 2.0) + pow((b * sin((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.cos((-0.005555555555555556 * (angle_m * Math.PI)))), 2.0) + Math.pow((b * Math.sin((angle_m * (Math.PI / -180.0)))), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow((a * math.cos((-0.005555555555555556 * (angle_m * math.pi)))), 2.0) + math.pow((b * math.sin((angle_m * (math.pi / -180.0)))), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) return Float64((Float64(a * cos(Float64(-0.005555555555555556 * Float64(angle_m * pi)))) ^ 2.0) + (Float64(b * sin(Float64(angle_m * Float64(pi / -180.0)))) ^ 2.0)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = ((a * cos((-0.005555555555555556 * (angle_m * pi)))) ^ 2.0) + ((b * sin((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[Cos[N[(-0.005555555555555556 * N[(angle$95$m * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[N[(angle$95$m * N[(Pi / -180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{\left(a \cdot \cos \left(-0.005555555555555556 \cdot \left(angle_m \cdot \pi\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(angle_m \cdot \frac{\pi}{-180}\right)\right)}^{2}
\end{array}
Initial program 80.3%
Simplified80.4%
Taylor expanded in angle around inf 80.4%
Final simplification80.4%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow (* b (sin (* PI (/ angle_m 180.0)))) 2.0) (pow (* a (cos (* (* angle_m 0.005555555555555556) PI))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow((b * sin((((double) M_PI) * (angle_m / 180.0)))), 2.0) + pow((a * cos(((angle_m * 0.005555555555555556) * ((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.sin((Math.PI * (angle_m / 180.0)))), 2.0) + Math.pow((a * Math.cos(((angle_m * 0.005555555555555556) * Math.PI))), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow((b * math.sin((math.pi * (angle_m / 180.0)))), 2.0) + math.pow((a * math.cos(((angle_m * 0.005555555555555556) * math.pi))), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) return Float64((Float64(b * sin(Float64(pi * Float64(angle_m / 180.0)))) ^ 2.0) + (Float64(a * cos(Float64(Float64(angle_m * 0.005555555555555556) * pi))) ^ 2.0)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = ((b * sin((pi * (angle_m / 180.0)))) ^ 2.0) + ((a * cos(((angle_m * 0.005555555555555556) * pi))) ^ 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[(angle$95$m / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(a * N[Cos[N[(N[(angle$95$m * 0.005555555555555556), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{\left(b \cdot \sin \left(\pi \cdot \frac{angle_m}{180}\right)\right)}^{2} + {\left(a \cdot \cos \left(\left(angle_m \cdot 0.005555555555555556\right) \cdot \pi\right)\right)}^{2}
\end{array}
Initial program 80.3%
expm1-log1p-u64.2%
div-inv64.2%
metadata-eval64.2%
Applied egg-rr64.2%
expm1-log1p-u80.4%
metadata-eval80.4%
div-inv80.3%
*-commutative80.3%
div-inv80.4%
metadata-eval80.4%
Applied egg-rr80.4%
Final simplification80.4%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow a 2.0) (pow (* b (sin (expm1 (log1p (* (* angle_m 0.005555555555555556) PI))))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow(a, 2.0) + pow((b * sin(expm1(log1p(((angle_m * 0.005555555555555556) * ((double) M_PI)))))), 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(Math.expm1(Math.log1p(((angle_m * 0.005555555555555556) * Math.PI))))), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow(a, 2.0) + math.pow((b * math.sin(math.expm1(math.log1p(((angle_m * 0.005555555555555556) * math.pi))))), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) return Float64((a ^ 2.0) + (Float64(b * sin(expm1(log1p(Float64(Float64(angle_m * 0.005555555555555556) * pi))))) ^ 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[(Exp[N[Log[1 + N[(N[(angle$95$m * 0.005555555555555556), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{a}^{2} + {\left(b \cdot \sin \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\left(angle_m \cdot 0.005555555555555556\right) \cdot \pi\right)\right)\right)\right)}^{2}
\end{array}
Initial program 80.3%
Taylor expanded in angle around 0 80.3%
expm1-log1p-u64.2%
div-inv64.2%
metadata-eval64.2%
Applied egg-rr64.0%
Final simplification64.0%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow a 2.0) (pow (* b (sin (* 0.005555555555555556 (* angle_m PI)))) 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 * (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(a, 2.0) + Math.pow((b * Math.sin((0.005555555555555556 * (angle_m * Math.PI)))), 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 * (angle_m * math.pi)))), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) return Float64((a ^ 2.0) + (Float64(b * sin(Float64(0.005555555555555556 * Float64(angle_m * pi)))) ^ 2.0)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = (a ^ 2.0) + ((b * sin((0.005555555555555556 * (angle_m * pi)))) ^ 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[(angle$95$m * Pi), $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 \left(angle_m \cdot \pi\right)\right)\right)}^{2}
\end{array}
Initial program 80.3%
Taylor expanded in angle around 0 80.3%
Taylor expanded in b around 0 80.4%
Final simplification80.4%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow a 2.0) (pow (* b (sin (/ (* angle_m PI) 180.0))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow(a, 2.0) + pow((b * sin(((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, 2.0) + Math.pow((b * Math.sin(((angle_m * Math.PI) / 180.0))), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow(a, 2.0) + math.pow((b * math.sin(((angle_m * math.pi) / 180.0))), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) return Float64((a ^ 2.0) + (Float64(b * sin(Float64(Float64(angle_m * pi) / 180.0))) ^ 2.0)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = (a ^ 2.0) + ((b * sin(((angle_m * pi) / 180.0))) ^ 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[(N[(angle$95$m * Pi), $MachinePrecision] / 180.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{a}^{2} + {\left(b \cdot \sin \left(\frac{angle_m \cdot \pi}{180}\right)\right)}^{2}
\end{array}
Initial program 80.3%
Taylor expanded in angle around 0 80.3%
expm1-log1p-u64.2%
div-inv64.2%
metadata-eval64.2%
Applied egg-rr64.0%
expm1-log1p-u80.3%
metadata-eval80.3%
div-inv80.3%
associate-*r/80.4%
Applied egg-rr80.4%
Final simplification80.4%
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
:precision binary64
(if (<= b 3.8e-129)
(pow a 2.0)
(+
(pow a 2.0)
(* (* (* PI (* angle_m (* PI b))) (* angle_m b)) 3.08641975308642e-5))))angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if (b <= 3.8e-129) {
tmp = pow(a, 2.0);
} else {
tmp = pow(a, 2.0) + (((((double) M_PI) * (angle_m * (((double) M_PI) * b))) * (angle_m * b)) * 3.08641975308642e-5);
}
return tmp;
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double tmp;
if (b <= 3.8e-129) {
tmp = Math.pow(a, 2.0);
} else {
tmp = Math.pow(a, 2.0) + (((Math.PI * (angle_m * (Math.PI * b))) * (angle_m * b)) * 3.08641975308642e-5);
}
return tmp;
}
angle_m = math.fabs(angle) def code(a, b, angle_m): tmp = 0 if b <= 3.8e-129: tmp = math.pow(a, 2.0) else: tmp = math.pow(a, 2.0) + (((math.pi * (angle_m * (math.pi * b))) * (angle_m * b)) * 3.08641975308642e-5) return tmp
angle_m = abs(angle) function code(a, b, angle_m) tmp = 0.0 if (b <= 3.8e-129) tmp = a ^ 2.0; else tmp = Float64((a ^ 2.0) + Float64(Float64(Float64(pi * Float64(angle_m * Float64(pi * b))) * Float64(angle_m * b)) * 3.08641975308642e-5)); end return tmp end
angle_m = abs(angle); function tmp_2 = code(a, b, angle_m) tmp = 0.0; if (b <= 3.8e-129) tmp = a ^ 2.0; else tmp = (a ^ 2.0) + (((pi * (angle_m * (pi * b))) * (angle_m * b)) * 3.08641975308642e-5); end tmp_2 = tmp; end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := If[LessEqual[b, 3.8e-129], N[Power[a, 2.0], $MachinePrecision], N[(N[Power[a, 2.0], $MachinePrecision] + N[(N[(N[(Pi * N[(angle$95$m * N[(Pi * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(angle$95$m * b), $MachinePrecision]), $MachinePrecision] * 3.08641975308642e-5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
\mathbf{if}\;b \leq 3.8 \cdot 10^{-129}:\\
\;\;\;\;{a}^{2}\\
\mathbf{else}:\\
\;\;\;\;{a}^{2} + \left(\left(\pi \cdot \left(angle_m \cdot \left(\pi \cdot b\right)\right)\right) \cdot \left(angle_m \cdot b\right)\right) \cdot 3.08641975308642 \cdot 10^{-5}\\
\end{array}
\end{array}
if b < 3.79999999999999985e-129Initial program 82.0%
Taylor expanded in angle around 0 82.1%
Taylor expanded in angle around 0 76.1%
*-commutative76.1%
unpow-prod-down76.1%
associate-*r*76.1%
*-commutative76.1%
metadata-eval76.1%
Applied egg-rr76.1%
Taylor expanded in a around inf 63.2%
if 3.79999999999999985e-129 < b Initial program 76.8%
Taylor expanded in angle around 0 76.8%
Taylor expanded in angle around 0 72.9%
*-commutative72.9%
unpow-prod-down72.9%
associate-*r*72.9%
*-commutative72.9%
metadata-eval72.9%
Applied egg-rr72.9%
unpow272.9%
associate-*r*72.9%
*-commutative72.9%
associate-*l*72.9%
Applied egg-rr72.9%
Final simplification66.4%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (if (<= b 1.12e-129) (pow a 2.0) (fma a a (* 3.08641975308642e-5 (pow (* angle_m (* PI b)) 2.0)))))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if (b <= 1.12e-129) {
tmp = pow(a, 2.0);
} else {
tmp = fma(a, a, (3.08641975308642e-5 * pow((angle_m * (((double) M_PI) * b)), 2.0)));
}
return tmp;
}
angle_m = abs(angle) function code(a, b, angle_m) tmp = 0.0 if (b <= 1.12e-129) tmp = a ^ 2.0; else tmp = fma(a, a, Float64(3.08641975308642e-5 * (Float64(angle_m * Float64(pi * b)) ^ 2.0))); end return tmp end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := If[LessEqual[b, 1.12e-129], N[Power[a, 2.0], $MachinePrecision], N[(a * a + N[(3.08641975308642e-5 * N[Power[N[(angle$95$m * N[(Pi * b), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.12 \cdot 10^{-129}:\\
\;\;\;\;{a}^{2}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, a, 3.08641975308642 \cdot 10^{-5} \cdot {\left(angle_m \cdot \left(\pi \cdot b\right)\right)}^{2}\right)\\
\end{array}
\end{array}
if b < 1.12000000000000006e-129Initial program 82.0%
Taylor expanded in angle around 0 82.1%
Taylor expanded in angle around 0 76.1%
*-commutative76.1%
unpow-prod-down76.1%
associate-*r*76.1%
*-commutative76.1%
metadata-eval76.1%
Applied egg-rr76.1%
Taylor expanded in a around inf 63.2%
if 1.12000000000000006e-129 < b Initial program 76.8%
Taylor expanded in angle around 0 76.8%
Taylor expanded in angle around 0 72.9%
*-commutative72.9%
unpow-prod-down72.9%
associate-*r*72.9%
*-commutative72.9%
metadata-eval72.9%
Applied egg-rr72.9%
*-rgt-identity72.9%
pow272.9%
fma-def72.9%
*-commutative72.9%
associate-*l*72.9%
Applied egg-rr72.9%
Final simplification66.4%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (if (<= b 3.5e-129) (pow a 2.0) (pow (hypot a (* 0.005555555555555556 (* angle_m (* PI b)))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if (b <= 3.5e-129) {
tmp = pow(a, 2.0);
} else {
tmp = pow(hypot(a, (0.005555555555555556 * (angle_m * (((double) M_PI) * b)))), 2.0);
}
return tmp;
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double tmp;
if (b <= 3.5e-129) {
tmp = Math.pow(a, 2.0);
} else {
tmp = Math.pow(Math.hypot(a, (0.005555555555555556 * (angle_m * (Math.PI * b)))), 2.0);
}
return tmp;
}
angle_m = math.fabs(angle) def code(a, b, angle_m): tmp = 0 if b <= 3.5e-129: tmp = math.pow(a, 2.0) else: tmp = math.pow(math.hypot(a, (0.005555555555555556 * (angle_m * (math.pi * b)))), 2.0) return tmp
angle_m = abs(angle) function code(a, b, angle_m) tmp = 0.0 if (b <= 3.5e-129) tmp = a ^ 2.0; else tmp = hypot(a, Float64(0.005555555555555556 * Float64(angle_m * Float64(pi * b)))) ^ 2.0; end return tmp end
angle_m = abs(angle); function tmp_2 = code(a, b, angle_m) tmp = 0.0; if (b <= 3.5e-129) tmp = a ^ 2.0; else tmp = hypot(a, (0.005555555555555556 * (angle_m * (pi * b)))) ^ 2.0; end tmp_2 = tmp; end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := If[LessEqual[b, 3.5e-129], N[Power[a, 2.0], $MachinePrecision], N[Power[N[Sqrt[a ^ 2 + N[(0.005555555555555556 * N[(angle$95$m * N[(Pi * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision], 2.0], $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
\mathbf{if}\;b \leq 3.5 \cdot 10^{-129}:\\
\;\;\;\;{a}^{2}\\
\mathbf{else}:\\
\;\;\;\;{\left(\mathsf{hypot}\left(a, 0.005555555555555556 \cdot \left(angle_m \cdot \left(\pi \cdot b\right)\right)\right)\right)}^{2}\\
\end{array}
\end{array}
if b < 3.4999999999999997e-129Initial program 82.0%
Taylor expanded in angle around 0 82.1%
Taylor expanded in angle around 0 76.1%
*-commutative76.1%
unpow-prod-down76.1%
associate-*r*76.1%
*-commutative76.1%
metadata-eval76.1%
Applied egg-rr76.1%
Taylor expanded in a around inf 63.2%
if 3.4999999999999997e-129 < b Initial program 76.8%
Taylor expanded in angle around 0 76.8%
Taylor expanded in angle around 0 72.9%
*-commutative72.9%
unpow-prod-down72.9%
associate-*r*72.9%
*-commutative72.9%
metadata-eval72.9%
Applied egg-rr72.9%
expm1-log1p-u72.3%
expm1-udef57.1%
Applied egg-rr57.1%
expm1-def72.3%
expm1-log1p72.9%
*-commutative72.9%
Simplified72.9%
Final simplification66.4%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (pow a 2.0))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow(a, 2.0);
}
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 ** 2.0d0
end function
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return Math.pow(a, 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow(a, 2.0)
angle_m = abs(angle) function code(a, b, angle_m) return a ^ 2.0 end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = a ^ 2.0; end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[Power[a, 2.0], $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{a}^{2}
\end{array}
Initial program 80.3%
Taylor expanded in angle around 0 80.3%
Taylor expanded in angle around 0 75.0%
*-commutative75.0%
unpow-prod-down75.1%
associate-*r*75.0%
*-commutative75.0%
metadata-eval75.0%
Applied egg-rr75.0%
Taylor expanded in a around inf 60.5%
Final simplification60.5%
herbie shell --seed 2023333
(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)))