
(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 14 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
(let* ((t_0 (cbrt (sqrt PI))))
(+
(pow
(*
a
(cos
(*
(/
(* t_0 t_0)
(pow (pow (cbrt (cbrt (/ (/ -180.0 (cbrt PI)) angle))) 3.0) 2.0))
(/ (cbrt PI) (cbrt (/ -180.0 (* (cbrt PI) angle)))))))
2.0)
(pow (* b (sin (* PI (/ angle 180.0)))) 2.0))))
double code(double a, double b, double angle) {
double t_0 = cbrt(sqrt(((double) M_PI)));
return pow((a * cos((((t_0 * t_0) / pow(pow(cbrt(cbrt(((-180.0 / cbrt(((double) M_PI))) / angle))), 3.0), 2.0)) * (cbrt(((double) M_PI)) / cbrt((-180.0 / (cbrt(((double) M_PI)) * angle))))))), 2.0) + pow((b * sin((((double) M_PI) * (angle / 180.0)))), 2.0);
}
public static double code(double a, double b, double angle) {
double t_0 = Math.cbrt(Math.sqrt(Math.PI));
return Math.pow((a * Math.cos((((t_0 * t_0) / Math.pow(Math.pow(Math.cbrt(Math.cbrt(((-180.0 / Math.cbrt(Math.PI)) / angle))), 3.0), 2.0)) * (Math.cbrt(Math.PI) / Math.cbrt((-180.0 / (Math.cbrt(Math.PI) * angle))))))), 2.0) + Math.pow((b * Math.sin((Math.PI * (angle / 180.0)))), 2.0);
}
function code(a, b, angle) t_0 = cbrt(sqrt(pi)) return Float64((Float64(a * cos(Float64(Float64(Float64(t_0 * t_0) / ((cbrt(cbrt(Float64(Float64(-180.0 / cbrt(pi)) / angle))) ^ 3.0) ^ 2.0)) * Float64(cbrt(pi) / cbrt(Float64(-180.0 / Float64(cbrt(pi) * angle))))))) ^ 2.0) + (Float64(b * sin(Float64(pi * Float64(angle / 180.0)))) ^ 2.0)) end
code[a_, b_, angle_] := Block[{t$95$0 = N[Power[N[Sqrt[Pi], $MachinePrecision], 1/3], $MachinePrecision]}, N[(N[Power[N[(a * N[Cos[N[(N[(N[(t$95$0 * t$95$0), $MachinePrecision] / N[Power[N[Power[N[Power[N[Power[N[(N[(-180.0 / N[Power[Pi, 1/3], $MachinePrecision]), $MachinePrecision] / angle), $MachinePrecision], 1/3], $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(N[Power[Pi, 1/3], $MachinePrecision] / N[Power[N[(-180.0 / N[(N[Power[Pi, 1/3], $MachinePrecision] * angle), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{\sqrt{\pi}}\\
{\left(a \cdot \cos \left(\frac{t\_0 \cdot t\_0}{{\left({\left(\sqrt[3]{\sqrt[3]{\frac{\frac{-180}{\sqrt[3]{\pi}}}{angle}}}\right)}^{3}\right)}^{2}} \cdot \frac{\sqrt[3]{\pi}}{\sqrt[3]{\frac{-180}{\sqrt[3]{\pi} \cdot angle}}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2}
\end{array}
\end{array}
Initial program 78.0%
add-sqr-sqrt36.8%
sqrt-unprod66.7%
associate-*r/66.7%
associate-*r/66.7%
frac-times66.8%
*-commutative66.8%
*-commutative66.8%
metadata-eval66.8%
metadata-eval66.8%
frac-times66.7%
associate-*r/66.7%
associate-*r/66.7%
sqrt-unprod41.2%
add-sqr-sqrt78.0%
*-commutative78.0%
associate-/r/77.9%
add-cube-cbrt78.0%
associate-/l*78.0%
Applied egg-rr78.0%
unpow278.0%
add-cube-cbrt78.0%
times-frac78.1%
pow278.1%
associate-/l/78.1%
associate-/l/78.1%
Applied egg-rr78.1%
add-cube-cbrt78.1%
pow378.1%
associate-/r*78.1%
Applied egg-rr78.1%
pow1/378.1%
add-sqr-sqrt78.1%
unpow-prod-down78.2%
Applied egg-rr78.2%
unpow1/378.1%
unpow1/378.1%
Simplified78.1%
Final simplification78.1%
(FPCore (a b angle)
:precision binary64
(+
(pow (* b (sin (* PI (/ angle 180.0)))) 2.0)
(pow
(*
a
(cos
(*
(/ (cbrt PI) (cbrt (/ -180.0 (* (cbrt PI) angle))))
(/
(cbrt PI)
(pow (pow (cbrt (cbrt (/ (/ -180.0 (cbrt PI)) angle))) 3.0) 2.0)))))
2.0)))
double code(double a, double b, double angle) {
return pow((b * sin((((double) M_PI) * (angle / 180.0)))), 2.0) + pow((a * cos(((cbrt(((double) M_PI)) / cbrt((-180.0 / (cbrt(((double) M_PI)) * angle)))) * (cbrt(((double) M_PI)) / pow(pow(cbrt(cbrt(((-180.0 / cbrt(((double) M_PI))) / 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 * (angle / 180.0)))), 2.0) + Math.pow((a * Math.cos(((Math.cbrt(Math.PI) / Math.cbrt((-180.0 / (Math.cbrt(Math.PI) * angle)))) * (Math.cbrt(Math.PI) / Math.pow(Math.pow(Math.cbrt(Math.cbrt(((-180.0 / Math.cbrt(Math.PI)) / angle))), 3.0), 2.0))))), 2.0);
}
function code(a, b, angle) return Float64((Float64(b * sin(Float64(pi * Float64(angle / 180.0)))) ^ 2.0) + (Float64(a * cos(Float64(Float64(cbrt(pi) / cbrt(Float64(-180.0 / Float64(cbrt(pi) * angle)))) * Float64(cbrt(pi) / ((cbrt(cbrt(Float64(Float64(-180.0 / cbrt(pi)) / angle))) ^ 3.0) ^ 2.0))))) ^ 2.0)) end
code[a_, b_, angle_] := N[(N[Power[N[(b * N[Sin[N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(a * N[Cos[N[(N[(N[Power[Pi, 1/3], $MachinePrecision] / N[Power[N[(-180.0 / N[(N[Power[Pi, 1/3], $MachinePrecision] * angle), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision] * N[(N[Power[Pi, 1/3], $MachinePrecision] / N[Power[N[Power[N[Power[N[Power[N[(N[(-180.0 / N[Power[Pi, 1/3], $MachinePrecision]), $MachinePrecision] / angle), $MachinePrecision], 1/3], $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(a \cdot \cos \left(\frac{\sqrt[3]{\pi}}{\sqrt[3]{\frac{-180}{\sqrt[3]{\pi} \cdot angle}}} \cdot \frac{\sqrt[3]{\pi}}{{\left({\left(\sqrt[3]{\sqrt[3]{\frac{\frac{-180}{\sqrt[3]{\pi}}}{angle}}}\right)}^{3}\right)}^{2}}\right)\right)}^{2}
\end{array}
Initial program 78.0%
add-sqr-sqrt36.8%
sqrt-unprod66.7%
associate-*r/66.7%
associate-*r/66.7%
frac-times66.8%
*-commutative66.8%
*-commutative66.8%
metadata-eval66.8%
metadata-eval66.8%
frac-times66.7%
associate-*r/66.7%
associate-*r/66.7%
sqrt-unprod41.2%
add-sqr-sqrt78.0%
*-commutative78.0%
associate-/r/77.9%
add-cube-cbrt78.0%
associate-/l*78.0%
Applied egg-rr78.0%
unpow278.0%
add-cube-cbrt78.0%
times-frac78.1%
pow278.1%
associate-/l/78.1%
associate-/l/78.1%
Applied egg-rr78.1%
add-cube-cbrt78.1%
pow378.1%
associate-/r*78.1%
Applied egg-rr78.1%
Final simplification78.1%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* (cbrt PI) angle)))
(+
(pow (* b (sin (* PI (/ angle 180.0)))) 2.0)
(pow
(*
a
(cos
(*
(/ (cbrt PI) (cbrt (/ -180.0 t_0)))
(/
(cbrt PI)
(pow (* (cbrt -180.0) (pow (/ 1.0 t_0) 0.3333333333333333)) 2.0)))))
2.0))))
double code(double a, double b, double angle) {
double t_0 = cbrt(((double) M_PI)) * angle;
return pow((b * sin((((double) M_PI) * (angle / 180.0)))), 2.0) + pow((a * cos(((cbrt(((double) M_PI)) / cbrt((-180.0 / t_0))) * (cbrt(((double) M_PI)) / pow((cbrt(-180.0) * pow((1.0 / t_0), 0.3333333333333333)), 2.0))))), 2.0);
}
public static double code(double a, double b, double angle) {
double t_0 = Math.cbrt(Math.PI) * angle;
return Math.pow((b * Math.sin((Math.PI * (angle / 180.0)))), 2.0) + Math.pow((a * Math.cos(((Math.cbrt(Math.PI) / Math.cbrt((-180.0 / t_0))) * (Math.cbrt(Math.PI) / Math.pow((Math.cbrt(-180.0) * Math.pow((1.0 / t_0), 0.3333333333333333)), 2.0))))), 2.0);
}
function code(a, b, angle) t_0 = Float64(cbrt(pi) * angle) return Float64((Float64(b * sin(Float64(pi * Float64(angle / 180.0)))) ^ 2.0) + (Float64(a * cos(Float64(Float64(cbrt(pi) / cbrt(Float64(-180.0 / t_0))) * Float64(cbrt(pi) / (Float64(cbrt(-180.0) * (Float64(1.0 / t_0) ^ 0.3333333333333333)) ^ 2.0))))) ^ 2.0)) end
code[a_, b_, angle_] := Block[{t$95$0 = N[(N[Power[Pi, 1/3], $MachinePrecision] * angle), $MachinePrecision]}, N[(N[Power[N[(b * N[Sin[N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(a * N[Cos[N[(N[(N[Power[Pi, 1/3], $MachinePrecision] / N[Power[N[(-180.0 / t$95$0), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision] * N[(N[Power[Pi, 1/3], $MachinePrecision] / N[Power[N[(N[Power[-180.0, 1/3], $MachinePrecision] * N[Power[N[(1.0 / t$95$0), $MachinePrecision], 0.3333333333333333], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{\pi} \cdot angle\\
{\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(a \cdot \cos \left(\frac{\sqrt[3]{\pi}}{\sqrt[3]{\frac{-180}{t\_0}}} \cdot \frac{\sqrt[3]{\pi}}{{\left(\sqrt[3]{-180} \cdot {\left(\frac{1}{t\_0}\right)}^{0.3333333333333333}\right)}^{2}}\right)\right)}^{2}
\end{array}
\end{array}
Initial program 78.0%
add-sqr-sqrt36.8%
sqrt-unprod66.7%
associate-*r/66.7%
associate-*r/66.7%
frac-times66.8%
*-commutative66.8%
*-commutative66.8%
metadata-eval66.8%
metadata-eval66.8%
frac-times66.7%
associate-*r/66.7%
associate-*r/66.7%
sqrt-unprod41.2%
add-sqr-sqrt78.0%
*-commutative78.0%
associate-/r/77.9%
add-cube-cbrt78.0%
associate-/l*78.0%
Applied egg-rr78.0%
unpow278.0%
add-cube-cbrt78.0%
times-frac78.1%
pow278.1%
associate-/l/78.1%
associate-/l/78.1%
Applied egg-rr78.1%
pow1/341.7%
div-inv41.7%
unpow-prod-down0.0%
pow1/336.8%
Applied egg-rr36.8%
Final simplification36.8%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* (cbrt PI) angle)))
(+
(pow (* b (sin (* PI (/ angle 180.0)))) 2.0)
(pow
(*
a
(cos
(*
(/ (cbrt PI) (cbrt (/ -180.0 t_0)))
(/ (cbrt PI) (pow (/ (cbrt -180.0) (cbrt t_0)) 2.0)))))
2.0))))
double code(double a, double b, double angle) {
double t_0 = cbrt(((double) M_PI)) * angle;
return pow((b * sin((((double) M_PI) * (angle / 180.0)))), 2.0) + pow((a * cos(((cbrt(((double) M_PI)) / cbrt((-180.0 / t_0))) * (cbrt(((double) M_PI)) / pow((cbrt(-180.0) / cbrt(t_0)), 2.0))))), 2.0);
}
public static double code(double a, double b, double angle) {
double t_0 = Math.cbrt(Math.PI) * angle;
return Math.pow((b * Math.sin((Math.PI * (angle / 180.0)))), 2.0) + Math.pow((a * Math.cos(((Math.cbrt(Math.PI) / Math.cbrt((-180.0 / t_0))) * (Math.cbrt(Math.PI) / Math.pow((Math.cbrt(-180.0) / Math.cbrt(t_0)), 2.0))))), 2.0);
}
function code(a, b, angle) t_0 = Float64(cbrt(pi) * angle) return Float64((Float64(b * sin(Float64(pi * Float64(angle / 180.0)))) ^ 2.0) + (Float64(a * cos(Float64(Float64(cbrt(pi) / cbrt(Float64(-180.0 / t_0))) * Float64(cbrt(pi) / (Float64(cbrt(-180.0) / cbrt(t_0)) ^ 2.0))))) ^ 2.0)) end
code[a_, b_, angle_] := Block[{t$95$0 = N[(N[Power[Pi, 1/3], $MachinePrecision] * angle), $MachinePrecision]}, N[(N[Power[N[(b * N[Sin[N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(a * N[Cos[N[(N[(N[Power[Pi, 1/3], $MachinePrecision] / N[Power[N[(-180.0 / t$95$0), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision] * N[(N[Power[Pi, 1/3], $MachinePrecision] / N[Power[N[(N[Power[-180.0, 1/3], $MachinePrecision] / N[Power[t$95$0, 1/3], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{\pi} \cdot angle\\
{\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(a \cdot \cos \left(\frac{\sqrt[3]{\pi}}{\sqrt[3]{\frac{-180}{t\_0}}} \cdot \frac{\sqrt[3]{\pi}}{{\left(\frac{\sqrt[3]{-180}}{\sqrt[3]{t\_0}}\right)}^{2}}\right)\right)}^{2}
\end{array}
\end{array}
Initial program 78.0%
add-sqr-sqrt36.8%
sqrt-unprod66.7%
associate-*r/66.7%
associate-*r/66.7%
frac-times66.8%
*-commutative66.8%
*-commutative66.8%
metadata-eval66.8%
metadata-eval66.8%
frac-times66.7%
associate-*r/66.7%
associate-*r/66.7%
sqrt-unprod41.2%
add-sqr-sqrt78.0%
*-commutative78.0%
associate-/r/77.9%
add-cube-cbrt78.0%
associate-/l*78.0%
Applied egg-rr78.0%
unpow278.0%
add-cube-cbrt78.0%
times-frac78.1%
pow278.1%
associate-/l/78.1%
associate-/l/78.1%
Applied egg-rr78.1%
cbrt-div78.1%
Applied egg-rr78.1%
Final simplification78.1%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (cbrt (/ -180.0 (* (cbrt PI) angle)))))
(+
(pow (* b (sin (* PI (/ angle 180.0)))) 2.0)
(pow (* a (cos (* (/ (cbrt PI) t_0) (/ (cbrt PI) (pow t_0 2.0))))) 2.0))))
double code(double a, double b, double angle) {
double t_0 = cbrt((-180.0 / (cbrt(((double) M_PI)) * angle)));
return pow((b * sin((((double) M_PI) * (angle / 180.0)))), 2.0) + pow((a * cos(((cbrt(((double) M_PI)) / t_0) * (cbrt(((double) M_PI)) / pow(t_0, 2.0))))), 2.0);
}
public static double code(double a, double b, double angle) {
double t_0 = Math.cbrt((-180.0 / (Math.cbrt(Math.PI) * angle)));
return Math.pow((b * Math.sin((Math.PI * (angle / 180.0)))), 2.0) + Math.pow((a * Math.cos(((Math.cbrt(Math.PI) / t_0) * (Math.cbrt(Math.PI) / Math.pow(t_0, 2.0))))), 2.0);
}
function code(a, b, angle) t_0 = cbrt(Float64(-180.0 / Float64(cbrt(pi) * angle))) return Float64((Float64(b * sin(Float64(pi * Float64(angle / 180.0)))) ^ 2.0) + (Float64(a * cos(Float64(Float64(cbrt(pi) / t_0) * Float64(cbrt(pi) / (t_0 ^ 2.0))))) ^ 2.0)) end
code[a_, b_, angle_] := Block[{t$95$0 = N[Power[N[(-180.0 / N[(N[Power[Pi, 1/3], $MachinePrecision] * angle), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]}, N[(N[Power[N[(b * N[Sin[N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(a * N[Cos[N[(N[(N[Power[Pi, 1/3], $MachinePrecision] / t$95$0), $MachinePrecision] * N[(N[Power[Pi, 1/3], $MachinePrecision] / N[Power[t$95$0, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{\frac{-180}{\sqrt[3]{\pi} \cdot angle}}\\
{\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(a \cdot \cos \left(\frac{\sqrt[3]{\pi}}{t\_0} \cdot \frac{\sqrt[3]{\pi}}{{t\_0}^{2}}\right)\right)}^{2}
\end{array}
\end{array}
Initial program 78.0%
add-sqr-sqrt36.8%
sqrt-unprod66.7%
associate-*r/66.7%
associate-*r/66.7%
frac-times66.8%
*-commutative66.8%
*-commutative66.8%
metadata-eval66.8%
metadata-eval66.8%
frac-times66.7%
associate-*r/66.7%
associate-*r/66.7%
sqrt-unprod41.2%
add-sqr-sqrt78.0%
*-commutative78.0%
associate-/r/77.9%
add-cube-cbrt78.0%
associate-/l*78.0%
Applied egg-rr78.0%
unpow278.0%
add-cube-cbrt78.0%
times-frac78.1%
pow278.1%
associate-/l/78.1%
associate-/l/78.1%
Applied egg-rr78.1%
Final simplification78.1%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (cbrt (sqrt PI))))
(+
(pow (* b (sin (* PI (/ angle 180.0)))) 2.0)
(pow
(* a (cos (/ (pow (* t_0 t_0) 2.0) (/ (/ -180.0 angle) (cbrt PI)))))
2.0))))
double code(double a, double b, double angle) {
double t_0 = cbrt(sqrt(((double) M_PI)));
return pow((b * sin((((double) M_PI) * (angle / 180.0)))), 2.0) + pow((a * cos((pow((t_0 * t_0), 2.0) / ((-180.0 / angle) / cbrt(((double) M_PI)))))), 2.0);
}
public static double code(double a, double b, double angle) {
double t_0 = Math.cbrt(Math.sqrt(Math.PI));
return Math.pow((b * Math.sin((Math.PI * (angle / 180.0)))), 2.0) + Math.pow((a * Math.cos((Math.pow((t_0 * t_0), 2.0) / ((-180.0 / angle) / Math.cbrt(Math.PI))))), 2.0);
}
function code(a, b, angle) t_0 = cbrt(sqrt(pi)) return Float64((Float64(b * sin(Float64(pi * Float64(angle / 180.0)))) ^ 2.0) + (Float64(a * cos(Float64((Float64(t_0 * t_0) ^ 2.0) / Float64(Float64(-180.0 / angle) / cbrt(pi))))) ^ 2.0)) end
code[a_, b_, angle_] := Block[{t$95$0 = N[Power[N[Sqrt[Pi], $MachinePrecision], 1/3], $MachinePrecision]}, N[(N[Power[N[(b * N[Sin[N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(a * N[Cos[N[(N[Power[N[(t$95$0 * t$95$0), $MachinePrecision], 2.0], $MachinePrecision] / N[(N[(-180.0 / angle), $MachinePrecision] / N[Power[Pi, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{\sqrt{\pi}}\\
{\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(a \cdot \cos \left(\frac{{\left(t\_0 \cdot t\_0\right)}^{2}}{\frac{\frac{-180}{angle}}{\sqrt[3]{\pi}}}\right)\right)}^{2}
\end{array}
\end{array}
Initial program 78.0%
add-sqr-sqrt36.8%
sqrt-unprod66.7%
associate-*r/66.7%
associate-*r/66.7%
frac-times66.8%
*-commutative66.8%
*-commutative66.8%
metadata-eval66.8%
metadata-eval66.8%
frac-times66.7%
associate-*r/66.7%
associate-*r/66.7%
sqrt-unprod41.2%
add-sqr-sqrt78.0%
*-commutative78.0%
associate-/r/77.9%
add-cube-cbrt78.0%
associate-/l*78.0%
Applied egg-rr78.0%
pow1/378.1%
add-sqr-sqrt78.1%
unpow-prod-down78.2%
Applied egg-rr78.0%
unpow1/378.1%
unpow1/378.1%
Simplified78.0%
Final simplification78.0%
(FPCore (a b angle) :precision binary64 (+ (pow (* b (sin (* PI (/ angle 180.0)))) 2.0) (pow (* a (cos (/ (pow (cbrt PI) 2.0) (/ (/ -180.0 angle) (cbrt PI))))) 2.0)))
double code(double a, double b, double angle) {
return pow((b * sin((((double) M_PI) * (angle / 180.0)))), 2.0) + pow((a * cos((pow(cbrt(((double) M_PI)), 2.0) / ((-180.0 / angle) / cbrt(((double) M_PI)))))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((b * Math.sin((Math.PI * (angle / 180.0)))), 2.0) + Math.pow((a * Math.cos((Math.pow(Math.cbrt(Math.PI), 2.0) / ((-180.0 / angle) / Math.cbrt(Math.PI))))), 2.0);
}
function code(a, b, angle) return Float64((Float64(b * sin(Float64(pi * Float64(angle / 180.0)))) ^ 2.0) + (Float64(a * cos(Float64((cbrt(pi) ^ 2.0) / Float64(Float64(-180.0 / angle) / cbrt(pi))))) ^ 2.0)) end
code[a_, b_, angle_] := N[(N[Power[N[(b * N[Sin[N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(a * N[Cos[N[(N[Power[N[Power[Pi, 1/3], $MachinePrecision], 2.0], $MachinePrecision] / N[(N[(-180.0 / angle), $MachinePrecision] / N[Power[Pi, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(a \cdot \cos \left(\frac{{\left(\sqrt[3]{\pi}\right)}^{2}}{\frac{\frac{-180}{angle}}{\sqrt[3]{\pi}}}\right)\right)}^{2}
\end{array}
Initial program 78.0%
add-sqr-sqrt36.8%
sqrt-unprod66.7%
associate-*r/66.7%
associate-*r/66.7%
frac-times66.8%
*-commutative66.8%
*-commutative66.8%
metadata-eval66.8%
metadata-eval66.8%
frac-times66.7%
associate-*r/66.7%
associate-*r/66.7%
sqrt-unprod41.2%
add-sqr-sqrt78.0%
*-commutative78.0%
associate-/r/77.9%
add-cube-cbrt78.0%
associate-/l*78.0%
Applied egg-rr78.0%
Final simplification78.0%
(FPCore (a b angle) :precision binary64 (+ (pow (* b (sin (* PI (/ angle 180.0)))) 2.0) (pow (* a (cos (expm1 (log1p (* (* PI angle) (cbrt 1.7146776406035666e-7)))))) 2.0)))
double code(double a, double b, double angle) {
return pow((b * sin((((double) M_PI) * (angle / 180.0)))), 2.0) + pow((a * cos(expm1(log1p(((((double) M_PI) * angle) * cbrt(1.7146776406035666e-7)))))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((b * Math.sin((Math.PI * (angle / 180.0)))), 2.0) + Math.pow((a * Math.cos(Math.expm1(Math.log1p(((Math.PI * angle) * Math.cbrt(1.7146776406035666e-7)))))), 2.0);
}
function code(a, b, angle) return Float64((Float64(b * sin(Float64(pi * Float64(angle / 180.0)))) ^ 2.0) + (Float64(a * cos(expm1(log1p(Float64(Float64(pi * angle) * cbrt(1.7146776406035666e-7)))))) ^ 2.0)) end
code[a_, b_, angle_] := N[(N[Power[N[(b * N[Sin[N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(a * N[Cos[N[(Exp[N[Log[1 + N[(N[(Pi * angle), $MachinePrecision] * N[Power[1.7146776406035666e-7, 1/3], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(a \cdot \cos \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\left(\pi \cdot angle\right) \cdot \sqrt[3]{1.7146776406035666 \cdot 10^{-7}}\right)\right)\right)\right)}^{2}
\end{array}
Initial program 78.0%
add-cbrt-cube78.0%
add-cbrt-cube62.8%
cbrt-unprod62.9%
pow362.9%
pow362.9%
div-inv62.8%
metadata-eval62.8%
Applied egg-rr62.8%
cube-prod62.8%
associate-*r*62.8%
*-commutative62.8%
cube-prod62.8%
metadata-eval62.9%
Simplified62.9%
expm1-log1p-u58.6%
cbrt-prod58.6%
rem-cbrt-cube64.9%
*-commutative64.9%
Applied egg-rr64.9%
Final simplification64.9%
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* angle (/ PI -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 = angle * (((double) M_PI) / -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 = angle * (Math.PI / -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 = angle * (math.pi / -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(angle * Float64(pi / -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 = angle * (pi / -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[(angle * N[(Pi / -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 := angle \cdot \frac{\pi}{-180}\\
{\left(a \cdot \cos t\_0\right)}^{2} + {\left(b \cdot \sin t\_0\right)}^{2}
\end{array}
\end{array}
Initial program 78.0%
Simplified77.9%
Final simplification77.9%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (cos (* angle (/ PI -180.0)))) 2.0) (pow (* b (sin (* PI (* angle -0.005555555555555556)))) 2.0)))
double code(double a, double b, double angle) {
return pow((a * cos((angle * (((double) M_PI) / -180.0)))), 2.0) + pow((b * sin((((double) M_PI) * (angle * -0.005555555555555556)))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.cos((angle * (Math.PI / -180.0)))), 2.0) + Math.pow((b * Math.sin((Math.PI * (angle * -0.005555555555555556)))), 2.0);
}
def code(a, b, angle): return math.pow((a * math.cos((angle * (math.pi / -180.0)))), 2.0) + math.pow((b * math.sin((math.pi * (angle * -0.005555555555555556)))), 2.0)
function code(a, b, angle) return Float64((Float64(a * cos(Float64(angle * Float64(pi / -180.0)))) ^ 2.0) + (Float64(b * sin(Float64(pi * Float64(angle * -0.005555555555555556)))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((a * cos((angle * (pi / -180.0)))) ^ 2.0) + ((b * sin((pi * (angle * -0.005555555555555556)))) ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Cos[N[(angle * N[(Pi / -180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[N[(Pi * N[(angle * -0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \cos \left(angle \cdot \frac{\pi}{-180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot -0.005555555555555556\right)\right)\right)}^{2}
\end{array}
Initial program 78.0%
Simplified77.9%
Taylor expanded in b around 0 64.4%
*-commutative64.4%
pow-prod-down77.9%
*-commutative77.9%
*-commutative77.9%
associate-*l*78.0%
Applied egg-rr78.0%
Final simplification78.0%
(FPCore (a b angle) :precision binary64 (+ (pow a 2.0) (pow (* b (sin (/ (* PI -0.005555555555555556) (/ 1.0 angle)))) 2.0)))
double code(double a, double b, double angle) {
return pow(a, 2.0) + pow((b * sin(((((double) M_PI) * -0.005555555555555556) / (1.0 / angle)))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow(a, 2.0) + Math.pow((b * Math.sin(((Math.PI * -0.005555555555555556) / (1.0 / angle)))), 2.0);
}
def code(a, b, angle): return math.pow(a, 2.0) + math.pow((b * math.sin(((math.pi * -0.005555555555555556) / (1.0 / angle)))), 2.0)
function code(a, b, angle) return Float64((a ^ 2.0) + (Float64(b * sin(Float64(Float64(pi * -0.005555555555555556) / Float64(1.0 / angle)))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = (a ^ 2.0) + ((b * sin(((pi * -0.005555555555555556) / (1.0 / angle)))) ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[a, 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[N[(N[(Pi * -0.005555555555555556), $MachinePrecision] / N[(1.0 / angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{a}^{2} + {\left(b \cdot \sin \left(\frac{\pi \cdot -0.005555555555555556}{\frac{1}{angle}}\right)\right)}^{2}
\end{array}
Initial program 78.0%
Simplified77.9%
Taylor expanded in angle around 0 77.7%
*-commutative77.7%
associate-/r/77.4%
div-inv77.4%
associate-/r*77.8%
div-inv77.8%
metadata-eval77.8%
Applied egg-rr77.8%
Final simplification77.8%
(FPCore (a b angle) :precision binary64 (+ (pow (* b (sin (* angle (/ PI -180.0)))) 2.0) (pow a 2.0)))
double code(double a, double b, double angle) {
return pow((b * sin((angle * (((double) M_PI) / -180.0)))), 2.0) + pow(a, 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((b * Math.sin((angle * (Math.PI / -180.0)))), 2.0) + Math.pow(a, 2.0);
}
def code(a, b, angle): return math.pow((b * math.sin((angle * (math.pi / -180.0)))), 2.0) + math.pow(a, 2.0)
function code(a, b, angle) return Float64((Float64(b * sin(Float64(angle * Float64(pi / -180.0)))) ^ 2.0) + (a ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((b * sin((angle * (pi / -180.0)))) ^ 2.0) + (a ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(b * N[Sin[N[(angle * N[(Pi / -180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(b \cdot \sin \left(angle \cdot \frac{\pi}{-180}\right)\right)}^{2} + {a}^{2}
\end{array}
Initial program 78.0%
Simplified77.9%
Taylor expanded in angle around 0 77.7%
Final simplification77.7%
(FPCore (a b angle) :precision binary64 (+ (pow (* b (sin (* PI (* angle -0.005555555555555556)))) 2.0) (pow a 2.0)))
double code(double a, double b, double angle) {
return pow((b * sin((((double) M_PI) * (angle * -0.005555555555555556)))), 2.0) + pow(a, 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((b * Math.sin((Math.PI * (angle * -0.005555555555555556)))), 2.0) + Math.pow(a, 2.0);
}
def code(a, b, angle): return math.pow((b * math.sin((math.pi * (angle * -0.005555555555555556)))), 2.0) + math.pow(a, 2.0)
function code(a, b, angle) return Float64((Float64(b * sin(Float64(pi * Float64(angle * -0.005555555555555556)))) ^ 2.0) + (a ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((b * sin((pi * (angle * -0.005555555555555556)))) ^ 2.0) + (a ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(b * N[Sin[N[(Pi * N[(angle * -0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot -0.005555555555555556\right)\right)\right)}^{2} + {a}^{2}
\end{array}
Initial program 78.0%
Simplified77.9%
Taylor expanded in angle around 0 77.7%
add-sqr-sqrt43.3%
sqrt-prod77.7%
unpow277.7%
add-exp-log76.8%
sqrt-pow142.9%
*-commutative42.9%
metadata-eval42.9%
pow142.9%
div-inv42.9%
metadata-eval42.9%
Applied egg-rr42.9%
Taylor expanded in angle around inf 77.7%
associate-*r*77.8%
*-commutative77.8%
*-commutative77.8%
Simplified77.8%
Final simplification77.8%
(FPCore (a b angle) :precision binary64 (+ (pow a 2.0) (* (* (* angle -0.005555555555555556) (* PI b)) (* -0.005555555555555556 (* angle (* PI b))))))
double code(double a, double b, double angle) {
return pow(a, 2.0) + (((angle * -0.005555555555555556) * (((double) M_PI) * b)) * (-0.005555555555555556 * (angle * (((double) M_PI) * b))));
}
public static double code(double a, double b, double angle) {
return Math.pow(a, 2.0) + (((angle * -0.005555555555555556) * (Math.PI * b)) * (-0.005555555555555556 * (angle * (Math.PI * b))));
}
def code(a, b, angle): return math.pow(a, 2.0) + (((angle * -0.005555555555555556) * (math.pi * b)) * (-0.005555555555555556 * (angle * (math.pi * b))))
function code(a, b, angle) return Float64((a ^ 2.0) + Float64(Float64(Float64(angle * -0.005555555555555556) * Float64(pi * b)) * Float64(-0.005555555555555556 * Float64(angle * Float64(pi * b))))) end
function tmp = code(a, b, angle) tmp = (a ^ 2.0) + (((angle * -0.005555555555555556) * (pi * b)) * (-0.005555555555555556 * (angle * (pi * b)))); end
code[a_, b_, angle_] := N[(N[Power[a, 2.0], $MachinePrecision] + N[(N[(N[(angle * -0.005555555555555556), $MachinePrecision] * N[(Pi * b), $MachinePrecision]), $MachinePrecision] * N[(-0.005555555555555556 * N[(angle * N[(Pi * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{a}^{2} + \left(\left(angle \cdot -0.005555555555555556\right) \cdot \left(\pi \cdot b\right)\right) \cdot \left(-0.005555555555555556 \cdot \left(angle \cdot \left(\pi \cdot b\right)\right)\right)
\end{array}
Initial program 78.0%
Simplified77.9%
Taylor expanded in angle around 0 77.7%
Taylor expanded in angle around 0 73.4%
associate-*r*73.4%
*-commutative73.4%
associate-*l*73.4%
*-commutative73.4%
Simplified73.4%
unpow273.4%
associate-*r*73.4%
associate-*r*73.4%
Applied egg-rr73.4%
Taylor expanded in angle around 0 73.4%
Final simplification73.4%
herbie shell --seed 2024026
(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)))