
(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 12 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
(let* ((t_0 (exp (log1p (* angle_m (* PI 0.005555555555555556))))))
(+
(pow (* a (sin (* angle_m (/ PI 180.0)))) 2.0)
(pow (* b (+ (* (cos t_0) (cos 1.0)) (* (sin t_0) (sin 1.0)))) 2.0))))angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double t_0 = exp(log1p((angle_m * (((double) M_PI) * 0.005555555555555556))));
return pow((a * sin((angle_m * (((double) M_PI) / 180.0)))), 2.0) + pow((b * ((cos(t_0) * cos(1.0)) + (sin(t_0) * sin(1.0)))), 2.0);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double t_0 = Math.exp(Math.log1p((angle_m * (Math.PI * 0.005555555555555556))));
return Math.pow((a * Math.sin((angle_m * (Math.PI / 180.0)))), 2.0) + Math.pow((b * ((Math.cos(t_0) * Math.cos(1.0)) + (Math.sin(t_0) * Math.sin(1.0)))), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): t_0 = math.exp(math.log1p((angle_m * (math.pi * 0.005555555555555556)))) return math.pow((a * math.sin((angle_m * (math.pi / 180.0)))), 2.0) + math.pow((b * ((math.cos(t_0) * math.cos(1.0)) + (math.sin(t_0) * math.sin(1.0)))), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) t_0 = exp(log1p(Float64(angle_m * Float64(pi * 0.005555555555555556)))) return Float64((Float64(a * sin(Float64(angle_m * Float64(pi / 180.0)))) ^ 2.0) + (Float64(b * Float64(Float64(cos(t_0) * cos(1.0)) + Float64(sin(t_0) * sin(1.0)))) ^ 2.0)) end
angle_m = N[Abs[angle], $MachinePrecision]
code[a_, b_, angle$95$m_] := Block[{t$95$0 = N[Exp[N[Log[1 + N[(angle$95$m * N[(Pi * 0.005555555555555556), $MachinePrecision]), $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[Power[N[(b * N[(N[(N[Cos[t$95$0], $MachinePrecision] * N[Cos[1.0], $MachinePrecision]), $MachinePrecision] + N[(N[Sin[t$95$0], $MachinePrecision] * N[Sin[1.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
t_0 := e^{\mathsf{log1p}\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} + {\left(b \cdot \left(\cos t\_0 \cdot \cos 1 + \sin t\_0 \cdot \sin 1\right)\right)}^{2}
\end{array}
\end{array}
Initial program 78.2%
unpow278.2%
swap-sqr78.2%
*-commutative78.2%
associate-*r/78.2%
associate-*l/78.3%
*-commutative78.3%
swap-sqr78.3%
unpow278.3%
*-commutative78.3%
associate-*r/78.2%
associate-*l/78.3%
*-commutative78.3%
Simplified78.3%
associate-*r/78.2%
associate-*l/78.3%
expm1-log1p-u65.6%
expm1-udef65.6%
cos-diff65.6%
associate-*l/65.6%
associate-*r/65.6%
div-inv65.6%
metadata-eval65.6%
Applied egg-rr65.6%
Final simplification65.6%
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
:precision binary64
(+
(pow (* a (sin (/ PI (/ 180.0 angle_m)))) 2.0)
(pow
(*
b
(cos
(*
(/ (pow (cbrt PI) 2.0) (pow (cbrt (/ 180.0 angle_m)) 2.0))
(cbrt (* angle_m (* PI 0.005555555555555556))))))
2.0)))angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow((a * sin((((double) M_PI) / (180.0 / angle_m)))), 2.0) + pow((b * cos(((pow(cbrt(((double) M_PI)), 2.0) / pow(cbrt((180.0 / angle_m)), 2.0)) * cbrt((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((Math.PI / (180.0 / angle_m)))), 2.0) + Math.pow((b * Math.cos(((Math.pow(Math.cbrt(Math.PI), 2.0) / Math.pow(Math.cbrt((180.0 / angle_m)), 2.0)) * Math.cbrt((angle_m * (Math.PI * 0.005555555555555556)))))), 2.0);
}
angle_m = abs(angle) function code(a, b, angle_m) return Float64((Float64(a * sin(Float64(pi / Float64(180.0 / angle_m)))) ^ 2.0) + (Float64(b * cos(Float64(Float64((cbrt(pi) ^ 2.0) / (cbrt(Float64(180.0 / angle_m)) ^ 2.0)) * cbrt(Float64(angle_m * Float64(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[(Pi / N[(180.0 / angle$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[N[(N[(N[Power[N[Power[Pi, 1/3], $MachinePrecision], 2.0], $MachinePrecision] / N[Power[N[Power[N[(180.0 / angle$95$m), $MachinePrecision], 1/3], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[Power[N[(angle$95$m * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{\left(a \cdot \sin \left(\frac{\pi}{\frac{180}{angle\_m}}\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{{\left(\sqrt[3]{\pi}\right)}^{2}}{{\left(\sqrt[3]{\frac{180}{angle\_m}}\right)}^{2}} \cdot \sqrt[3]{angle\_m \cdot \left(\pi \cdot 0.005555555555555556\right)}\right)\right)}^{2}
\end{array}
Initial program 78.2%
unpow278.2%
*-commutative78.2%
associate-*r/78.2%
associate-/l*78.2%
unpow278.2%
*-commutative78.2%
associate-*r/78.2%
associate-/l*78.3%
Simplified78.3%
add-cube-cbrt78.3%
add-cube-cbrt78.2%
times-frac78.3%
pow278.3%
pow278.3%
cbrt-div78.4%
associate-/r/78.4%
*-commutative78.4%
div-inv78.4%
metadata-eval78.4%
Applied egg-rr78.4%
Final simplification78.4%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow (* a (sin (/ PI (/ 180.0 angle_m)))) 2.0) (pow (* b (cos (* (cbrt (pow PI 3.0)) (/ -1.0 (/ -180.0 angle_m))))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow((a * sin((((double) M_PI) / (180.0 / angle_m)))), 2.0) + pow((b * cos((cbrt(pow(((double) M_PI), 3.0)) * (-1.0 / (-180.0 / angle_m))))), 2.0);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return Math.pow((a * Math.sin((Math.PI / (180.0 / angle_m)))), 2.0) + Math.pow((b * Math.cos((Math.cbrt(Math.pow(Math.PI, 3.0)) * (-1.0 / (-180.0 / angle_m))))), 2.0);
}
angle_m = abs(angle) function code(a, b, angle_m) return Float64((Float64(a * sin(Float64(pi / Float64(180.0 / angle_m)))) ^ 2.0) + (Float64(b * cos(Float64(cbrt((pi ^ 3.0)) * Float64(-1.0 / Float64(-180.0 / angle_m))))) ^ 2.0)) end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(N[Power[N[(a * N[Sin[N[(Pi / N[(180.0 / angle$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[N[(N[Power[N[Power[Pi, 3.0], $MachinePrecision], 1/3], $MachinePrecision] * N[(-1.0 / N[(-180.0 / angle$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{\left(a \cdot \sin \left(\frac{\pi}{\frac{180}{angle\_m}}\right)\right)}^{2} + {\left(b \cdot \cos \left(\sqrt[3]{{\pi}^{3}} \cdot \frac{-1}{\frac{-180}{angle\_m}}\right)\right)}^{2}
\end{array}
Initial program 78.2%
unpow278.2%
*-commutative78.2%
associate-*r/78.2%
associate-/l*78.2%
unpow278.2%
*-commutative78.2%
associate-*r/78.2%
associate-/l*78.3%
Simplified78.3%
frac-2neg78.3%
div-inv78.2%
distribute-neg-frac78.2%
metadata-eval78.2%
Applied egg-rr78.2%
add-cbrt-cube78.4%
pow378.4%
Applied egg-rr78.4%
Final simplification78.4%
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 (* (sqrt PI) (/ (sqrt PI) (/ 180.0 angle_m))))) 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((sqrt(((double) M_PI)) * (sqrt(((double) M_PI)) / (180.0 / angle_m))))), 2.0);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return Math.pow((a * Math.sin((Math.PI * (angle_m / 180.0)))), 2.0) + Math.pow((b * Math.cos((Math.sqrt(Math.PI) * (Math.sqrt(Math.PI) / (180.0 / angle_m))))), 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.sqrt(math.pi) * (math.sqrt(math.pi) / (180.0 / angle_m))))), 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(sqrt(pi) * Float64(sqrt(pi) / Float64(180.0 / angle_m))))) ^ 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(pi) * (sqrt(pi) / (180.0 / angle_m))))) ^ 2.0); end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(N[Power[N[(a * N[Sin[N[(Pi * N[(angle$95$m / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[N[(N[Sqrt[Pi], $MachinePrecision] * N[(N[Sqrt[Pi], $MachinePrecision] / N[(180.0 / angle$95$m), $MachinePrecision]), $MachinePrecision]), $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(\sqrt{\pi} \cdot \frac{\sqrt{\pi}}{\frac{180}{angle\_m}}\right)\right)}^{2}
\end{array}
Initial program 78.2%
clear-num78.2%
associate-*l/78.2%
*-un-lft-identity78.2%
add-sqr-sqrt78.3%
associate-/l*78.4%
Applied egg-rr78.4%
expm1-log1p-u50.3%
expm1-udef29.1%
Applied egg-rr29.1%
expm1-def50.3%
expm1-log1p78.4%
associate-/r*78.4%
Simplified78.4%
associate-/r*78.4%
associate-/r/78.3%
Applied egg-rr78.3%
Final simplification78.3%
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 (/ (sqrt PI) (/ 180.0 (* angle_m (sqrt PI)))))) 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((sqrt(((double) M_PI)) / (180.0 / (angle_m * sqrt(((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 * Math.sin((Math.PI * (angle_m / 180.0)))), 2.0) + Math.pow((b * Math.cos((Math.sqrt(Math.PI) / (180.0 / (angle_m * Math.sqrt(Math.PI)))))), 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.sqrt(math.pi) / (180.0 / (angle_m * math.sqrt(math.pi)))))), 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(sqrt(pi) / Float64(180.0 / Float64(angle_m * sqrt(pi)))))) ^ 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(pi) / (180.0 / (angle_m * sqrt(pi)))))) ^ 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[Sqrt[Pi], $MachinePrecision] / N[(180.0 / N[(angle$95$m * N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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{\sqrt{\pi}}{\frac{180}{angle\_m \cdot \sqrt{\pi}}}\right)\right)}^{2}
\end{array}
Initial program 78.2%
clear-num78.2%
associate-*l/78.2%
*-un-lft-identity78.2%
add-sqr-sqrt78.3%
associate-/l*78.4%
Applied egg-rr78.4%
expm1-log1p-u50.3%
expm1-udef29.1%
Applied egg-rr29.1%
expm1-def50.3%
expm1-log1p78.4%
associate-/r*78.4%
Simplified78.4%
Final simplification78.4%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow (* a (sin (* angle_m (/ PI 180.0)))) 2.0) (pow (* b (log1p (expm1 (cos (/ PI (/ -180.0 angle_m)))))) 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 * log1p(expm1(cos((((double) M_PI) / (-180.0 / angle_m)))))), 2.0);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return Math.pow((a * Math.sin((angle_m * (Math.PI / 180.0)))), 2.0) + Math.pow((b * Math.log1p(Math.expm1(Math.cos((Math.PI / (-180.0 / angle_m)))))), 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 * math.log1p(math.expm1(math.cos((math.pi / (-180.0 / angle_m)))))), 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 * log1p(expm1(cos(Float64(pi / Float64(-180.0 / angle_m)))))) ^ 2.0)) end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(N[Power[N[(a * N[Sin[N[(angle$95$m * N[(Pi / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Log[1 + N[(Exp[N[Cos[N[(Pi / N[(-180.0 / 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 \sin \left(angle\_m \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\cos \left(\frac{\pi}{\frac{-180}{angle\_m}}\right)\right)\right)\right)}^{2}
\end{array}
Initial program 78.2%
unpow278.2%
swap-sqr78.2%
*-commutative78.2%
associate-*r/78.2%
associate-*l/78.3%
*-commutative78.3%
swap-sqr78.3%
unpow278.3%
*-commutative78.3%
associate-*r/78.2%
associate-*l/78.3%
*-commutative78.3%
Simplified78.3%
log1p-expm1-u78.3%
*-commutative78.3%
associate-/r/78.3%
frac-2neg78.3%
distribute-frac-neg78.3%
cos-neg78.3%
distribute-neg-frac78.3%
metadata-eval78.3%
Applied egg-rr78.3%
Final simplification78.3%
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 (expm1 (log1p (* angle_m (* PI 0.005555555555555556)))))) 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(expm1(log1p((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((Math.PI * (angle_m / 180.0)))), 2.0) + Math.pow((b * Math.cos(Math.expm1(Math.log1p((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((math.pi * (angle_m / 180.0)))), 2.0) + math.pow((b * math.cos(math.expm1(math.log1p((angle_m * (math.pi * 0.005555555555555556)))))), 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(expm1(log1p(Float64(angle_m * Float64(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[(Pi * N[(angle$95$m / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[N[(Exp[N[Log[1 + N[(angle$95$m * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]] - 1), $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(\mathsf{expm1}\left(\mathsf{log1p}\left(angle\_m \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)\right)\right)}^{2}
\end{array}
Initial program 78.2%
clear-num78.2%
associate-/r/78.3%
expm1-log1p-u65.6%
clear-num65.6%
associate-/r/65.6%
*-commutative65.6%
div-inv65.6%
metadata-eval65.6%
Applied egg-rr65.6%
Final simplification65.6%
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 (/ 1.0 (/ 180.0 (* angle_m PI))))) 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((1.0 / (180.0 / (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 * Math.sin((Math.PI * (angle_m / 180.0)))), 2.0) + Math.pow((b * Math.cos((1.0 / (180.0 / (angle_m * Math.PI))))), 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((1.0 / (180.0 / (angle_m * math.pi))))), 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(1.0 / Float64(180.0 / Float64(angle_m * pi))))) ^ 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((1.0 / (180.0 / (angle_m * pi))))) ^ 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[(1.0 / N[(180.0 / N[(angle$95$m * Pi), $MachinePrecision]), $MachinePrecision]), $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{1}{\frac{180}{angle\_m \cdot \pi}}\right)\right)}^{2}
\end{array}
Initial program 78.2%
associate-*l/78.2%
clear-num78.3%
Applied egg-rr78.3%
Final simplification78.3%
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 78.2%
unpow278.2%
swap-sqr78.2%
*-commutative78.2%
associate-*r/78.2%
associate-*l/78.3%
*-commutative78.3%
swap-sqr78.3%
unpow278.3%
*-commutative78.3%
associate-*r/78.2%
associate-*l/78.3%
*-commutative78.3%
Simplified78.3%
Final simplification78.3%
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 78.2%
unpow278.2%
swap-sqr78.2%
*-commutative78.2%
associate-*r/78.2%
associate-*l/78.3%
*-commutative78.3%
swap-sqr78.3%
unpow278.3%
*-commutative78.3%
associate-*r/78.2%
associate-*l/78.3%
*-commutative78.3%
Simplified78.3%
Taylor expanded in angle around 0 77.9%
Final simplification77.9%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow b 2.0) (* (* angle_m 0.005555555555555556) (* PI (* a (* angle_m (* PI (* a 0.005555555555555556))))))))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow(b, 2.0) + ((angle_m * 0.005555555555555556) * (((double) M_PI) * (a * (angle_m * (((double) M_PI) * (a * 0.005555555555555556))))));
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return Math.pow(b, 2.0) + ((angle_m * 0.005555555555555556) * (Math.PI * (a * (angle_m * (Math.PI * (a * 0.005555555555555556))))));
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow(b, 2.0) + ((angle_m * 0.005555555555555556) * (math.pi * (a * (angle_m * (math.pi * (a * 0.005555555555555556))))))
angle_m = abs(angle) function code(a, b, angle_m) return Float64((b ^ 2.0) + Float64(Float64(angle_m * 0.005555555555555556) * Float64(pi * Float64(a * Float64(angle_m * Float64(pi * Float64(a * 0.005555555555555556))))))) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = (b ^ 2.0) + ((angle_m * 0.005555555555555556) * (pi * (a * (angle_m * (pi * (a * 0.005555555555555556)))))); end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(N[Power[b, 2.0], $MachinePrecision] + N[(N[(angle$95$m * 0.005555555555555556), $MachinePrecision] * N[(Pi * N[(a * N[(angle$95$m * N[(Pi * N[(a * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{b}^{2} + \left(angle\_m \cdot 0.005555555555555556\right) \cdot \left(\pi \cdot \left(a \cdot \left(angle\_m \cdot \left(\pi \cdot \left(a \cdot 0.005555555555555556\right)\right)\right)\right)\right)
\end{array}
Initial program 78.2%
unpow278.2%
swap-sqr78.2%
*-commutative78.2%
associate-*r/78.2%
associate-*l/78.3%
*-commutative78.3%
swap-sqr78.3%
unpow278.3%
*-commutative78.3%
associate-*r/78.2%
associate-*l/78.3%
*-commutative78.3%
Simplified78.3%
Taylor expanded in angle around 0 77.9%
Taylor expanded in angle around 0 73.4%
*-commutative73.4%
associate-*l*73.4%
Simplified73.4%
unpow273.4%
associate-*r*73.4%
associate-*l*70.2%
*-commutative70.2%
*-commutative70.2%
associate-*l*70.2%
Applied egg-rr70.2%
*-commutative70.2%
associate-*l*70.2%
associate-*l*70.2%
*-commutative70.2%
Simplified70.2%
Final simplification70.2%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow b 2.0) (* (* 0.005555555555555556 (* angle_m (* 0.005555555555555556 (* a 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 * (angle_m * (0.005555555555555556 * (a * ((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 * (angle_m * (0.005555555555555556 * (a * 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 * (angle_m * (0.005555555555555556 * (a * math.pi)))) * (math.pi * (a * angle_m)))
angle_m = abs(angle) function code(a, b, angle_m) return Float64((b ^ 2.0) + Float64(Float64(0.005555555555555556 * Float64(angle_m * Float64(0.005555555555555556 * Float64(a * 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 * (angle_m * (0.005555555555555556 * (a * 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[(N[(0.005555555555555556 * N[(angle$95$m * N[(0.005555555555555556 * N[(a * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(Pi * N[(a * angle$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{b}^{2} + \left(0.005555555555555556 \cdot \left(angle\_m \cdot \left(0.005555555555555556 \cdot \left(a \cdot \pi\right)\right)\right)\right) \cdot \left(\pi \cdot \left(a \cdot angle\_m\right)\right)
\end{array}
Initial program 78.2%
unpow278.2%
swap-sqr78.2%
*-commutative78.2%
associate-*r/78.2%
associate-*l/78.3%
*-commutative78.3%
swap-sqr78.3%
unpow278.3%
*-commutative78.3%
associate-*r/78.2%
associate-*l/78.3%
*-commutative78.3%
Simplified78.3%
Taylor expanded in angle around 0 77.9%
Taylor expanded in angle around 0 73.4%
*-commutative73.4%
associate-*l*73.4%
Simplified73.4%
unpow273.4%
associate-*r*73.4%
*-commutative73.4%
associate-*l*73.4%
*-commutative73.4%
associate-*l*73.5%
Applied egg-rr73.5%
Final simplification73.5%
herbie shell --seed 2024026
(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)))