
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* PI (/ angle 180.0)))) (+ (pow (* a (cos t_0)) 2.0) (pow (* b (sin t_0)) 2.0))))
double code(double a, double b, double angle) {
double t_0 = ((double) M_PI) * (angle / 180.0);
return pow((a * cos(t_0)), 2.0) + pow((b * sin(t_0)), 2.0);
}
public static double code(double a, double b, double angle) {
double t_0 = Math.PI * (angle / 180.0);
return Math.pow((a * Math.cos(t_0)), 2.0) + Math.pow((b * Math.sin(t_0)), 2.0);
}
def code(a, b, angle): t_0 = math.pi * (angle / 180.0) return math.pow((a * math.cos(t_0)), 2.0) + math.pow((b * math.sin(t_0)), 2.0)
function code(a, b, angle) t_0 = Float64(pi * Float64(angle / 180.0)) return Float64((Float64(a * cos(t_0)) ^ 2.0) + (Float64(b * sin(t_0)) ^ 2.0)) end
function tmp = code(a, b, angle) t_0 = pi * (angle / 180.0); tmp = ((a * cos(t_0)) ^ 2.0) + ((b * sin(t_0)) ^ 2.0); end
code[a_, b_, angle_] := Block[{t$95$0 = N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]}, N[(N[Power[N[(a * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \pi \cdot \frac{angle}{180}\\
{\left(a \cdot \cos t_0\right)}^{2} + {\left(b \cdot \sin t_0\right)}^{2}
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* PI (/ angle 180.0)))) (+ (pow (* a (cos t_0)) 2.0) (pow (* b (sin t_0)) 2.0))))
double code(double a, double b, double angle) {
double t_0 = ((double) M_PI) * (angle / 180.0);
return pow((a * cos(t_0)), 2.0) + pow((b * sin(t_0)), 2.0);
}
public static double code(double a, double b, double angle) {
double t_0 = Math.PI * (angle / 180.0);
return Math.pow((a * Math.cos(t_0)), 2.0) + Math.pow((b * Math.sin(t_0)), 2.0);
}
def code(a, b, angle): t_0 = math.pi * (angle / 180.0) return math.pow((a * math.cos(t_0)), 2.0) + math.pow((b * math.sin(t_0)), 2.0)
function code(a, b, angle) t_0 = Float64(pi * Float64(angle / 180.0)) return Float64((Float64(a * cos(t_0)) ^ 2.0) + (Float64(b * sin(t_0)) ^ 2.0)) end
function tmp = code(a, b, angle) t_0 = pi * (angle / 180.0); tmp = ((a * cos(t_0)) ^ 2.0) + ((b * sin(t_0)) ^ 2.0); end
code[a_, b_, angle_] := Block[{t$95$0 = N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]}, N[(N[Power[N[(a * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \pi \cdot \frac{angle}{180}\\
{\left(a \cdot \cos t_0\right)}^{2} + {\left(b \cdot \sin t_0\right)}^{2}
\end{array}
\end{array}
(FPCore (a b angle)
:precision binary64
(+
(pow
(*
a
(cos
(*
(pow
(* (cbrt angle) (+ (exp (log1p (cbrt 0.005555555555555556))) -1.0))
2.0)
(* (cbrt (* angle 0.005555555555555556)) PI))))
2.0)
(pow (* b (sin (/ PI (/ -180.0 angle)))) 2.0)))
double code(double a, double b, double angle) {
return pow((a * cos((pow((cbrt(angle) * (exp(log1p(cbrt(0.005555555555555556))) + -1.0)), 2.0) * (cbrt((angle * 0.005555555555555556)) * ((double) M_PI))))), 2.0) + pow((b * sin((((double) M_PI) / (-180.0 / angle)))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.cos((Math.pow((Math.cbrt(angle) * (Math.exp(Math.log1p(Math.cbrt(0.005555555555555556))) + -1.0)), 2.0) * (Math.cbrt((angle * 0.005555555555555556)) * Math.PI)))), 2.0) + Math.pow((b * Math.sin((Math.PI / (-180.0 / angle)))), 2.0);
}
function code(a, b, angle) return Float64((Float64(a * cos(Float64((Float64(cbrt(angle) * Float64(exp(log1p(cbrt(0.005555555555555556))) + -1.0)) ^ 2.0) * Float64(cbrt(Float64(angle * 0.005555555555555556)) * pi)))) ^ 2.0) + (Float64(b * sin(Float64(pi / Float64(-180.0 / angle)))) ^ 2.0)) end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Cos[N[(N[Power[N[(N[Power[angle, 1/3], $MachinePrecision] * N[(N[Exp[N[Log[1 + N[Power[0.005555555555555556, 1/3], $MachinePrecision]], $MachinePrecision]], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[Power[N[(angle * 0.005555555555555556), $MachinePrecision], 1/3], $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[N[(Pi / N[(-180.0 / angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \cos \left({\left(\sqrt[3]{angle} \cdot \left(e^{\mathsf{log1p}\left(\sqrt[3]{0.005555555555555556}\right)} + -1\right)\right)}^{2} \cdot \left(\sqrt[3]{angle \cdot 0.005555555555555556} \cdot \pi\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\pi}{\frac{-180}{angle}}\right)\right)}^{2}
\end{array}
Initial program 77.7%
Simplified77.9%
associate-/r/77.9%
*-commutative77.9%
add-sqr-sqrt37.7%
sqrt-unprod64.3%
associate-*r/64.3%
associate-*r/64.3%
frac-times64.0%
*-commutative64.0%
*-commutative64.0%
metadata-eval64.0%
metadata-eval64.0%
frac-times64.3%
associate-*r/64.3%
associate-*r/64.3%
sqrt-unprod40.2%
add-sqr-sqrt77.8%
*-commutative77.8%
add-cube-cbrt77.9%
Applied egg-rr78.0%
cbrt-prod78.0%
Applied egg-rr78.0%
expm1-log1p-u78.0%
expm1-udef78.0%
Applied egg-rr78.0%
Final simplification78.0%
(FPCore (a b angle)
:precision binary64
(+
(pow (* b (sin (/ PI (/ -180.0 angle)))) 2.0)
(pow
(*
a
(cos
(*
(* (cbrt (* angle 0.005555555555555556)) PI)
(pow
(* (cbrt 0.005555555555555556) (pow (cbrt (cbrt angle)) 3.0))
2.0))))
2.0)))
double code(double a, double b, double angle) {
return pow((b * sin((((double) M_PI) / (-180.0 / angle)))), 2.0) + pow((a * cos(((cbrt((angle * 0.005555555555555556)) * ((double) M_PI)) * pow((cbrt(0.005555555555555556) * pow(cbrt(cbrt(angle)), 3.0)), 2.0)))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((b * Math.sin((Math.PI / (-180.0 / angle)))), 2.0) + Math.pow((a * Math.cos(((Math.cbrt((angle * 0.005555555555555556)) * Math.PI) * Math.pow((Math.cbrt(0.005555555555555556) * Math.pow(Math.cbrt(Math.cbrt(angle)), 3.0)), 2.0)))), 2.0);
}
function code(a, b, angle) return Float64((Float64(b * sin(Float64(pi / Float64(-180.0 / angle)))) ^ 2.0) + (Float64(a * cos(Float64(Float64(cbrt(Float64(angle * 0.005555555555555556)) * pi) * (Float64(cbrt(0.005555555555555556) * (cbrt(cbrt(angle)) ^ 3.0)) ^ 2.0)))) ^ 2.0)) end
code[a_, b_, angle_] := N[(N[Power[N[(b * N[Sin[N[(Pi / N[(-180.0 / angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(a * N[Cos[N[(N[(N[Power[N[(angle * 0.005555555555555556), $MachinePrecision], 1/3], $MachinePrecision] * Pi), $MachinePrecision] * N[Power[N[(N[Power[0.005555555555555556, 1/3], $MachinePrecision] * N[Power[N[Power[N[Power[angle, 1/3], $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(b \cdot \sin \left(\frac{\pi}{\frac{-180}{angle}}\right)\right)}^{2} + {\left(a \cdot \cos \left(\left(\sqrt[3]{angle \cdot 0.005555555555555556} \cdot \pi\right) \cdot {\left(\sqrt[3]{0.005555555555555556} \cdot {\left(\sqrt[3]{\sqrt[3]{angle}}\right)}^{3}\right)}^{2}\right)\right)}^{2}
\end{array}
Initial program 77.7%
Simplified77.9%
associate-/r/77.9%
*-commutative77.9%
add-sqr-sqrt37.7%
sqrt-unprod64.3%
associate-*r/64.3%
associate-*r/64.3%
frac-times64.0%
*-commutative64.0%
*-commutative64.0%
metadata-eval64.0%
metadata-eval64.0%
frac-times64.3%
associate-*r/64.3%
associate-*r/64.3%
sqrt-unprod40.2%
add-sqr-sqrt77.8%
*-commutative77.8%
add-cube-cbrt77.9%
Applied egg-rr78.0%
cbrt-prod78.0%
Applied egg-rr78.0%
add-cube-cbrt78.0%
pow378.0%
Applied egg-rr78.0%
Final simplification78.0%
(FPCore (a b angle)
:precision binary64
(+
(pow (* b (sin (/ PI (/ -180.0 angle)))) 2.0)
(pow
(*
a
(cos
(*
(* (cbrt (* angle 0.005555555555555556)) PI)
(pow
(*
(cbrt angle)
(pow (pow 0.005555555555555556 0.16666666666666666) 2.0))
2.0))))
2.0)))
double code(double a, double b, double angle) {
return pow((b * sin((((double) M_PI) / (-180.0 / angle)))), 2.0) + pow((a * cos(((cbrt((angle * 0.005555555555555556)) * ((double) M_PI)) * pow((cbrt(angle) * pow(pow(0.005555555555555556, 0.16666666666666666), 2.0)), 2.0)))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((b * Math.sin((Math.PI / (-180.0 / angle)))), 2.0) + Math.pow((a * Math.cos(((Math.cbrt((angle * 0.005555555555555556)) * Math.PI) * Math.pow((Math.cbrt(angle) * Math.pow(Math.pow(0.005555555555555556, 0.16666666666666666), 2.0)), 2.0)))), 2.0);
}
function code(a, b, angle) return Float64((Float64(b * sin(Float64(pi / Float64(-180.0 / angle)))) ^ 2.0) + (Float64(a * cos(Float64(Float64(cbrt(Float64(angle * 0.005555555555555556)) * pi) * (Float64(cbrt(angle) * ((0.005555555555555556 ^ 0.16666666666666666) ^ 2.0)) ^ 2.0)))) ^ 2.0)) end
code[a_, b_, angle_] := N[(N[Power[N[(b * N[Sin[N[(Pi / N[(-180.0 / angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(a * N[Cos[N[(N[(N[Power[N[(angle * 0.005555555555555556), $MachinePrecision], 1/3], $MachinePrecision] * Pi), $MachinePrecision] * N[Power[N[(N[Power[angle, 1/3], $MachinePrecision] * N[Power[N[Power[0.005555555555555556, 0.16666666666666666], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(b \cdot \sin \left(\frac{\pi}{\frac{-180}{angle}}\right)\right)}^{2} + {\left(a \cdot \cos \left(\left(\sqrt[3]{angle \cdot 0.005555555555555556} \cdot \pi\right) \cdot {\left(\sqrt[3]{angle} \cdot {\left({0.005555555555555556}^{0.16666666666666666}\right)}^{2}\right)}^{2}\right)\right)}^{2}
\end{array}
Initial program 77.7%
Simplified77.9%
associate-/r/77.9%
*-commutative77.9%
add-sqr-sqrt37.7%
sqrt-unprod64.3%
associate-*r/64.3%
associate-*r/64.3%
frac-times64.0%
*-commutative64.0%
*-commutative64.0%
metadata-eval64.0%
metadata-eval64.0%
frac-times64.3%
associate-*r/64.3%
associate-*r/64.3%
sqrt-unprod40.2%
add-sqr-sqrt77.8%
*-commutative77.8%
add-cube-cbrt77.9%
Applied egg-rr78.0%
cbrt-prod78.0%
Applied egg-rr78.0%
add-sqr-sqrt78.0%
pow278.0%
pow1/378.0%
sqrt-pow178.0%
metadata-eval78.0%
Applied egg-rr78.0%
Final simplification78.0%
(FPCore (a b angle) :precision binary64 (+ (pow a 2.0) (pow (* b (sin (* -0.005555555555555556 (* angle PI)))) 2.0)))
double code(double a, double b, double angle) {
return pow(a, 2.0) + pow((b * sin((-0.005555555555555556 * (angle * ((double) M_PI))))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow(a, 2.0) + Math.pow((b * Math.sin((-0.005555555555555556 * (angle * Math.PI)))), 2.0);
}
def code(a, b, angle): return math.pow(a, 2.0) + math.pow((b * math.sin((-0.005555555555555556 * (angle * math.pi)))), 2.0)
function code(a, b, angle) return Float64((a ^ 2.0) + (Float64(b * sin(Float64(-0.005555555555555556 * Float64(angle * pi)))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = (a ^ 2.0) + ((b * sin((-0.005555555555555556 * (angle * pi)))) ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[a, 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[N[(-0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{a}^{2} + {\left(b \cdot \sin \left(-0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2}
\end{array}
Initial program 77.7%
Simplified77.8%
Taylor expanded in angle around 0 77.9%
Taylor expanded in angle around inf 77.9%
Final simplification77.9%
(FPCore (a b angle) :precision binary64 (+ (pow a 2.0) (pow (* b (sin (/ angle (/ -180.0 PI)))) 2.0)))
double code(double a, double b, double angle) {
return pow(a, 2.0) + pow((b * sin((angle / (-180.0 / ((double) M_PI))))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow(a, 2.0) + Math.pow((b * Math.sin((angle / (-180.0 / Math.PI)))), 2.0);
}
def code(a, b, angle): return math.pow(a, 2.0) + math.pow((b * math.sin((angle / (-180.0 / math.pi)))), 2.0)
function code(a, b, angle) return Float64((a ^ 2.0) + (Float64(b * sin(Float64(angle / Float64(-180.0 / pi)))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = (a ^ 2.0) + ((b * sin((angle / (-180.0 / pi)))) ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[a, 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[N[(angle / N[(-180.0 / Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{a}^{2} + {\left(b \cdot \sin \left(\frac{angle}{\frac{-180}{\pi}}\right)\right)}^{2}
\end{array}
Initial program 77.7%
Simplified77.8%
Taylor expanded in angle around 0 77.9%
add-cube-cbrt77.6%
unpow277.6%
Applied egg-rr77.6%
Taylor expanded in angle around inf 77.9%
metadata-eval77.9%
associate-/r/77.9%
associate-/l*77.9%
*-commutative77.9%
associate-/l*77.9%
metadata-eval77.9%
associate-/l*78.0%
Simplified78.0%
Final simplification78.0%
(FPCore (a b angle) :precision binary64 (+ (pow (* b (sin (/ PI (/ -180.0 angle)))) 2.0) (pow a 2.0)))
double code(double a, double b, double angle) {
return pow((b * sin((((double) M_PI) / (-180.0 / angle)))), 2.0) + pow(a, 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((b * Math.sin((Math.PI / (-180.0 / angle)))), 2.0) + Math.pow(a, 2.0);
}
def code(a, b, angle): return math.pow((b * math.sin((math.pi / (-180.0 / angle)))), 2.0) + math.pow(a, 2.0)
function code(a, b, angle) return Float64((Float64(b * sin(Float64(pi / Float64(-180.0 / angle)))) ^ 2.0) + (a ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((b * sin((pi / (-180.0 / angle)))) ^ 2.0) + (a ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(b * N[Sin[N[(Pi / N[(-180.0 / angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(b \cdot \sin \left(\frac{\pi}{\frac{-180}{angle}}\right)\right)}^{2} + {a}^{2}
\end{array}
Initial program 77.7%
Simplified77.9%
associate-/r/77.9%
*-commutative77.9%
add-sqr-sqrt37.7%
sqrt-unprod64.3%
associate-*r/64.3%
associate-*r/64.3%
frac-times64.0%
*-commutative64.0%
*-commutative64.0%
metadata-eval64.0%
metadata-eval64.0%
frac-times64.3%
associate-*r/64.3%
associate-*r/64.3%
sqrt-unprod40.2%
add-sqr-sqrt77.8%
*-commutative77.8%
add-cube-cbrt77.9%
Applied egg-rr78.0%
Taylor expanded in angle around 0 78.0%
Final simplification78.0%
(FPCore (a b angle) :precision binary64 (+ (pow a 2.0) (* (* angle -0.005555555555555556) (* (* b (* PI (* angle -0.005555555555555556))) (* PI b)))))
double code(double a, double b, double angle) {
return pow(a, 2.0) + ((angle * -0.005555555555555556) * ((b * (((double) M_PI) * (angle * -0.005555555555555556))) * (((double) M_PI) * b)));
}
public static double code(double a, double b, double angle) {
return Math.pow(a, 2.0) + ((angle * -0.005555555555555556) * ((b * (Math.PI * (angle * -0.005555555555555556))) * (Math.PI * b)));
}
def code(a, b, angle): return math.pow(a, 2.0) + ((angle * -0.005555555555555556) * ((b * (math.pi * (angle * -0.005555555555555556))) * (math.pi * b)))
function code(a, b, angle) return Float64((a ^ 2.0) + Float64(Float64(angle * -0.005555555555555556) * Float64(Float64(b * Float64(pi * Float64(angle * -0.005555555555555556))) * Float64(pi * b)))) end
function tmp = code(a, b, angle) tmp = (a ^ 2.0) + ((angle * -0.005555555555555556) * ((b * (pi * (angle * -0.005555555555555556))) * (pi * b))); end
code[a_, b_, angle_] := N[(N[Power[a, 2.0], $MachinePrecision] + N[(N[(angle * -0.005555555555555556), $MachinePrecision] * N[(N[(b * N[(Pi * N[(angle * -0.005555555555555556), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(Pi * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{a}^{2} + \left(angle \cdot -0.005555555555555556\right) \cdot \left(\left(b \cdot \left(\pi \cdot \left(angle \cdot -0.005555555555555556\right)\right)\right) \cdot \left(\pi \cdot b\right)\right)
\end{array}
Initial program 77.7%
Simplified77.8%
Taylor expanded in angle around 0 77.9%
Taylor expanded in angle around 0 72.1%
unpow272.1%
associate-*r*72.1%
associate-*l*71.6%
*-commutative71.6%
associate-*r*71.6%
*-commutative71.6%
associate-*r*71.6%
metadata-eval71.6%
associate-/r/71.6%
clear-num71.6%
*-commutative71.6%
div-inv71.6%
metadata-eval71.6%
Applied egg-rr71.6%
Final simplification71.6%
(FPCore (a b angle) :precision binary64 (+ (pow a 2.0) (* (* angle -0.005555555555555556) (* (* PI b) (* b (* PI (/ angle -180.0)))))))
double code(double a, double b, double angle) {
return pow(a, 2.0) + ((angle * -0.005555555555555556) * ((((double) M_PI) * b) * (b * (((double) M_PI) * (angle / -180.0)))));
}
public static double code(double a, double b, double angle) {
return Math.pow(a, 2.0) + ((angle * -0.005555555555555556) * ((Math.PI * b) * (b * (Math.PI * (angle / -180.0)))));
}
def code(a, b, angle): return math.pow(a, 2.0) + ((angle * -0.005555555555555556) * ((math.pi * b) * (b * (math.pi * (angle / -180.0)))))
function code(a, b, angle) return Float64((a ^ 2.0) + Float64(Float64(angle * -0.005555555555555556) * Float64(Float64(pi * b) * Float64(b * Float64(pi * Float64(angle / -180.0)))))) end
function tmp = code(a, b, angle) tmp = (a ^ 2.0) + ((angle * -0.005555555555555556) * ((pi * b) * (b * (pi * (angle / -180.0))))); end
code[a_, b_, angle_] := N[(N[Power[a, 2.0], $MachinePrecision] + N[(N[(angle * -0.005555555555555556), $MachinePrecision] * N[(N[(Pi * b), $MachinePrecision] * N[(b * N[(Pi * N[(angle / -180.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{a}^{2} + \left(angle \cdot -0.005555555555555556\right) \cdot \left(\left(\pi \cdot b\right) \cdot \left(b \cdot \left(\pi \cdot \frac{angle}{-180}\right)\right)\right)
\end{array}
Initial program 77.7%
Simplified77.8%
Taylor expanded in angle around 0 77.9%
Taylor expanded in angle around 0 72.1%
unpow272.1%
associate-*r*72.1%
associate-*l*71.6%
*-commutative71.6%
associate-*r*71.6%
*-commutative71.6%
associate-*r*71.6%
metadata-eval71.6%
associate-/r/71.6%
clear-num71.6%
*-commutative71.6%
div-inv71.6%
metadata-eval71.6%
Applied egg-rr71.6%
metadata-eval71.6%
div-inv71.6%
Applied egg-rr71.6%
Final simplification71.6%
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* b (* PI (* angle -0.005555555555555556))))) (+ (pow a 2.0) (* t_0 t_0))))
double code(double a, double b, double angle) {
double t_0 = b * (((double) M_PI) * (angle * -0.005555555555555556));
return pow(a, 2.0) + (t_0 * t_0);
}
public static double code(double a, double b, double angle) {
double t_0 = b * (Math.PI * (angle * -0.005555555555555556));
return Math.pow(a, 2.0) + (t_0 * t_0);
}
def code(a, b, angle): t_0 = b * (math.pi * (angle * -0.005555555555555556)) return math.pow(a, 2.0) + (t_0 * t_0)
function code(a, b, angle) t_0 = Float64(b * Float64(pi * Float64(angle * -0.005555555555555556))) return Float64((a ^ 2.0) + Float64(t_0 * t_0)) end
function tmp = code(a, b, angle) t_0 = b * (pi * (angle * -0.005555555555555556)); tmp = (a ^ 2.0) + (t_0 * t_0); end
code[a_, b_, angle_] := Block[{t$95$0 = N[(b * N[(Pi * N[(angle * -0.005555555555555556), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(N[Power[a, 2.0], $MachinePrecision] + N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := b \cdot \left(\pi \cdot \left(angle \cdot -0.005555555555555556\right)\right)\\
{a}^{2} + t_0 \cdot t_0
\end{array}
\end{array}
Initial program 77.7%
Simplified77.8%
Taylor expanded in angle around 0 77.9%
Taylor expanded in angle around 0 72.1%
unpow272.1%
associate-*r*72.1%
*-commutative72.1%
associate-*r*72.1%
metadata-eval72.1%
associate-/r/72.1%
clear-num72.1%
*-commutative72.1%
div-inv72.1%
metadata-eval72.1%
associate-*r*72.1%
*-commutative72.1%
associate-*r*72.1%
metadata-eval72.1%
associate-/r/72.1%
clear-num72.1%
*-commutative72.1%
div-inv72.1%
metadata-eval72.1%
Applied egg-rr72.1%
Final simplification72.1%
(FPCore (a b angle) :precision binary64 (+ (pow a 2.0) (* (* -0.005555555555555556 (* b (* PI (* angle -0.005555555555555556)))) (* b (* angle PI)))))
double code(double a, double b, double angle) {
return pow(a, 2.0) + ((-0.005555555555555556 * (b * (((double) M_PI) * (angle * -0.005555555555555556)))) * (b * (angle * ((double) M_PI))));
}
public static double code(double a, double b, double angle) {
return Math.pow(a, 2.0) + ((-0.005555555555555556 * (b * (Math.PI * (angle * -0.005555555555555556)))) * (b * (angle * Math.PI)));
}
def code(a, b, angle): return math.pow(a, 2.0) + ((-0.005555555555555556 * (b * (math.pi * (angle * -0.005555555555555556)))) * (b * (angle * math.pi)))
function code(a, b, angle) return Float64((a ^ 2.0) + Float64(Float64(-0.005555555555555556 * Float64(b * Float64(pi * Float64(angle * -0.005555555555555556)))) * Float64(b * Float64(angle * pi)))) end
function tmp = code(a, b, angle) tmp = (a ^ 2.0) + ((-0.005555555555555556 * (b * (pi * (angle * -0.005555555555555556)))) * (b * (angle * pi))); end
code[a_, b_, angle_] := N[(N[Power[a, 2.0], $MachinePrecision] + N[(N[(-0.005555555555555556 * N[(b * N[(Pi * N[(angle * -0.005555555555555556), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(b * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{a}^{2} + \left(-0.005555555555555556 \cdot \left(b \cdot \left(\pi \cdot \left(angle \cdot -0.005555555555555556\right)\right)\right)\right) \cdot \left(b \cdot \left(angle \cdot \pi\right)\right)
\end{array}
Initial program 77.7%
Simplified77.8%
Taylor expanded in angle around 0 77.9%
Taylor expanded in angle around 0 72.1%
unpow272.1%
associate-*r*72.1%
associate-*r*72.1%
*-commutative72.1%
associate-*r*72.1%
metadata-eval72.1%
associate-/r/72.1%
clear-num72.1%
*-commutative72.1%
div-inv72.1%
metadata-eval72.1%
*-commutative72.1%
associate-*l*72.1%
Applied egg-rr72.1%
Final simplification72.1%
herbie shell --seed 2024023
(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)))