
(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 (* PI angle))))
(+
(pow
(*
a
(cos
(*
t_0
(*
0.005555555555555556
(pow (pow (cbrt (pow (cbrt t_0) 3.0)) 3.0) 2.0)))))
2.0)
(pow (* b (sin (* PI (/ angle 180.0)))) 2.0))))
double code(double a, double b, double angle) {
double t_0 = cbrt((((double) M_PI) * angle));
return pow((a * cos((t_0 * (0.005555555555555556 * pow(pow(cbrt(pow(cbrt(t_0), 3.0)), 3.0), 2.0))))), 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.PI * angle));
return Math.pow((a * Math.cos((t_0 * (0.005555555555555556 * Math.pow(Math.pow(Math.cbrt(Math.pow(Math.cbrt(t_0), 3.0)), 3.0), 2.0))))), 2.0) + Math.pow((b * Math.sin((Math.PI * (angle / 180.0)))), 2.0);
}
function code(a, b, angle) t_0 = cbrt(Float64(pi * angle)) return Float64((Float64(a * cos(Float64(t_0 * Float64(0.005555555555555556 * ((cbrt((cbrt(t_0) ^ 3.0)) ^ 3.0) ^ 2.0))))) ^ 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[(Pi * angle), $MachinePrecision], 1/3], $MachinePrecision]}, N[(N[Power[N[(a * N[Cos[N[(t$95$0 * N[(0.005555555555555556 * N[Power[N[Power[N[Power[N[Power[N[Power[t$95$0, 1/3], $MachinePrecision], 3.0], $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision], 2.0], $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]{\pi \cdot angle}\\
{\left(a \cdot \cos \left(t_0 \cdot \left(0.005555555555555556 \cdot {\left({\left(\sqrt[3]{{\left(\sqrt[3]{t_0}\right)}^{3}}\right)}^{3}\right)}^{2}\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2}
\end{array}
\end{array}
Initial program 81.7%
add-cube-cbrt81.7%
pow381.7%
div-inv81.8%
metadata-eval81.8%
Applied egg-rr81.8%
rem-cube-cbrt81.7%
associate-*r*81.8%
*-commutative81.8%
add-cube-cbrt81.8%
associate-*r*81.8%
pow281.8%
Applied egg-rr81.8%
add-cube-cbrt81.8%
pow381.9%
Applied egg-rr81.9%
add-cube-cbrt81.8%
pow381.9%
Applied egg-rr81.9%
Final simplification81.9%
(FPCore (a b angle)
:precision binary64
(+
(pow (* b (sin (* PI (/ angle 180.0)))) 2.0)
(pow
(*
a
(cos
(*
(cbrt (* PI angle))
(*
0.005555555555555556
(pow (cbrt (* angle (cbrt (pow PI 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) * angle)) * (0.005555555555555556 * pow(cbrt((angle * cbrt(pow(((double) M_PI), 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 * angle)) * (0.005555555555555556 * Math.pow(Math.cbrt((angle * Math.cbrt(Math.pow(Math.PI, 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(cbrt(Float64(pi * angle)) * Float64(0.005555555555555556 * (cbrt(Float64(angle * cbrt((pi ^ 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[Power[N[(Pi * angle), $MachinePrecision], 1/3], $MachinePrecision] * N[(0.005555555555555556 * N[Power[N[Power[N[(angle * N[Power[N[Power[Pi, 3.0], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], 1/3], $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(\sqrt[3]{\pi \cdot angle} \cdot \left(0.005555555555555556 \cdot {\left(\sqrt[3]{angle \cdot \sqrt[3]{{\pi}^{3}}}\right)}^{2}\right)\right)\right)}^{2}
\end{array}
Initial program 81.7%
add-cube-cbrt81.7%
pow381.7%
div-inv81.8%
metadata-eval81.8%
Applied egg-rr81.8%
rem-cube-cbrt81.7%
associate-*r*81.8%
*-commutative81.8%
add-cube-cbrt81.8%
associate-*r*81.8%
pow281.8%
Applied egg-rr81.8%
rem-cbrt-cube81.9%
Applied egg-rr81.9%
Final simplification81.9%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (cbrt (* PI angle))))
(+
(pow (* b (sin (* PI (/ angle 180.0)))) 2.0)
(pow
(*
a
(cos (* t_0 (* 0.005555555555555556 (pow (pow (cbrt t_0) 3.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((t_0 * (0.005555555555555556 * pow(pow(cbrt(t_0), 3.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((t_0 * (0.005555555555555556 * Math.pow(Math.pow(Math.cbrt(t_0), 3.0), 2.0))))), 2.0);
}
function code(a, b, angle) t_0 = cbrt(Float64(pi * angle)) return Float64((Float64(b * sin(Float64(pi * Float64(angle / 180.0)))) ^ 2.0) + (Float64(a * cos(Float64(t_0 * Float64(0.005555555555555556 * ((cbrt(t_0) ^ 3.0) ^ 2.0))))) ^ 2.0)) end
code[a_, b_, angle_] := Block[{t$95$0 = N[Power[N[(Pi * angle), $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[(t$95$0 * N[(0.005555555555555556 * N[Power[N[Power[N[Power[t$95$0, 1/3], $MachinePrecision], 3.0], $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(t_0 \cdot \left(0.005555555555555556 \cdot {\left({\left(\sqrt[3]{t_0}\right)}^{3}\right)}^{2}\right)\right)\right)}^{2}
\end{array}
\end{array}
Initial program 81.7%
add-cube-cbrt81.7%
pow381.7%
div-inv81.8%
metadata-eval81.8%
Applied egg-rr81.8%
rem-cube-cbrt81.7%
associate-*r*81.8%
*-commutative81.8%
add-cube-cbrt81.8%
associate-*r*81.8%
pow281.8%
Applied egg-rr81.8%
add-cube-cbrt81.8%
pow381.9%
Applied egg-rr81.9%
Final simplification81.9%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (cbrt (* PI angle))))
(+
(pow (* b (sin (* PI (/ angle 180.0)))) 2.0)
(pow (* a (cos (* t_0 (* 0.005555555555555556 (pow 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((t_0 * (0.005555555555555556 * pow(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((t_0 * (0.005555555555555556 * Math.pow(t_0, 2.0))))), 2.0);
}
function code(a, b, angle) t_0 = cbrt(Float64(pi * angle)) return Float64((Float64(b * sin(Float64(pi * Float64(angle / 180.0)))) ^ 2.0) + (Float64(a * cos(Float64(t_0 * Float64(0.005555555555555556 * (t_0 ^ 2.0))))) ^ 2.0)) end
code[a_, b_, angle_] := Block[{t$95$0 = N[Power[N[(Pi * angle), $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[(t$95$0 * N[(0.005555555555555556 * 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]{\pi \cdot angle}\\
{\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(a \cdot \cos \left(t_0 \cdot \left(0.005555555555555556 \cdot {t_0}^{2}\right)\right)\right)}^{2}
\end{array}
\end{array}
Initial program 81.7%
add-cube-cbrt81.7%
pow381.7%
div-inv81.8%
metadata-eval81.8%
Applied egg-rr81.8%
rem-cube-cbrt81.7%
associate-*r*81.8%
*-commutative81.8%
add-cube-cbrt81.8%
associate-*r*81.8%
pow281.8%
Applied egg-rr81.8%
Final simplification81.8%
(FPCore (a b angle) :precision binary64 (+ (pow (* b (sin (* PI (/ angle 180.0)))) 2.0) (pow (* a (cos (pow (/ 1.0 (cbrt (/ (/ 180.0 angle) PI))) 3.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(pow((1.0 / cbrt(((180.0 / angle) / ((double) M_PI)))), 3.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.pow((1.0 / Math.cbrt(((180.0 / angle) / Math.PI))), 3.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(1.0 / cbrt(Float64(Float64(180.0 / angle) / pi))) ^ 3.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[Power[N[(1.0 / N[Power[N[(N[(180.0 / angle), $MachinePrecision] / Pi), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], 3.0], $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({\left(\frac{1}{\sqrt[3]{\frac{\frac{180}{angle}}{\pi}}}\right)}^{3}\right)\right)}^{2}
\end{array}
Initial program 81.7%
add-cube-cbrt81.7%
pow381.7%
div-inv81.8%
metadata-eval81.8%
Applied egg-rr81.8%
metadata-eval81.8%
div-inv81.7%
associate-*r/81.8%
clear-num81.8%
clear-num81.8%
cbrt-div81.7%
metadata-eval81.7%
/-rgt-identity81.7%
*-commutative81.7%
associate-/r*81.8%
Applied egg-rr81.8%
Final simplification81.8%
(FPCore (a b angle) :precision binary64 (+ (pow (* b (sin (* PI (/ angle 180.0)))) 2.0) (pow (* a (cos (pow (cbrt (* 0.005555555555555556 (* PI angle))) 3.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(pow(cbrt((0.005555555555555556 * (((double) M_PI) * angle))), 3.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.pow(Math.cbrt((0.005555555555555556 * (Math.PI * angle))), 3.0))), 2.0);
}
function code(a, b, angle) return Float64((Float64(b * sin(Float64(pi * Float64(angle / 180.0)))) ^ 2.0) + (Float64(a * cos((cbrt(Float64(0.005555555555555556 * Float64(pi * angle))) ^ 3.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[Power[N[Power[N[(0.005555555555555556 * N[(Pi * angle), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $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({\left(\sqrt[3]{0.005555555555555556 \cdot \left(\pi \cdot angle\right)}\right)}^{3}\right)\right)}^{2}
\end{array}
Initial program 81.7%
add-cube-cbrt81.7%
pow381.7%
div-inv81.8%
metadata-eval81.8%
Applied egg-rr81.8%
expm1-log1p-u68.2%
expm1-udef68.1%
metadata-eval68.1%
div-inv68.1%
Applied egg-rr68.1%
expm1-def68.2%
expm1-log1p81.7%
associate-*r/81.8%
associate-/l*81.7%
*-lft-identity81.7%
associate-*l/81.7%
associate-/r/81.8%
metadata-eval81.8%
associate-*r*81.8%
Simplified81.8%
Final simplification81.8%
(FPCore (a b angle) :precision binary64 (+ (pow (* b (sin (* PI (/ angle 180.0)))) 2.0) (pow (* a (cos (* 0.005555555555555556 (* PI angle)))) 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((0.005555555555555556 * (((double) M_PI) * angle)))), 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((0.005555555555555556 * (Math.PI * angle)))), 2.0);
}
def code(a, b, angle): return math.pow((b * math.sin((math.pi * (angle / 180.0)))), 2.0) + math.pow((a * math.cos((0.005555555555555556 * (math.pi * angle)))), 2.0)
function code(a, b, angle) return Float64((Float64(b * sin(Float64(pi * Float64(angle / 180.0)))) ^ 2.0) + (Float64(a * cos(Float64(0.005555555555555556 * Float64(pi * angle)))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((b * sin((pi * (angle / 180.0)))) ^ 2.0) + ((a * cos((0.005555555555555556 * (pi * angle)))) ^ 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[(0.005555555555555556 * N[(Pi * angle), $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(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)\right)}^{2}
\end{array}
Initial program 81.7%
Taylor expanded in angle around inf 81.8%
Final simplification81.8%
(FPCore (a b angle) :precision binary64 (+ (pow (* b (sin (* PI (/ angle 180.0)))) 2.0) (pow (* a (cos (* angle (/ PI 180.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((angle * (((double) M_PI) / 180.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((angle * (Math.PI / 180.0)))), 2.0);
}
def code(a, b, angle): return math.pow((b * math.sin((math.pi * (angle / 180.0)))), 2.0) + math.pow((a * math.cos((angle * (math.pi / 180.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(angle * Float64(pi / 180.0)))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((b * sin((pi * (angle / 180.0)))) ^ 2.0) + ((a * cos((angle * (pi / 180.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[(angle * N[(Pi / 180.0), $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(angle \cdot \frac{\pi}{180}\right)\right)}^{2}
\end{array}
Initial program 81.7%
Taylor expanded in angle around inf 81.8%
metadata-eval81.8%
*-commutative81.8%
associate-/r/81.7%
associate-/l*81.6%
*-commutative81.6%
associate-/l*81.6%
metadata-eval81.6%
*-commutative81.6%
associate-*r/81.8%
Simplified81.8%
Final simplification81.8%
(FPCore (a b angle) :precision binary64 (+ (pow a 2.0) (pow (* b (expm1 (log1p (sin (* PI (* 0.005555555555555556 angle)))))) 2.0)))
double code(double a, double b, double angle) {
return pow(a, 2.0) + pow((b * expm1(log1p(sin((((double) M_PI) * (0.005555555555555556 * angle)))))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow(a, 2.0) + Math.pow((b * Math.expm1(Math.log1p(Math.sin((Math.PI * (0.005555555555555556 * angle)))))), 2.0);
}
def code(a, b, angle): return math.pow(a, 2.0) + math.pow((b * math.expm1(math.log1p(math.sin((math.pi * (0.005555555555555556 * angle)))))), 2.0)
function code(a, b, angle) return Float64((a ^ 2.0) + (Float64(b * expm1(log1p(sin(Float64(pi * Float64(0.005555555555555556 * angle)))))) ^ 2.0)) end
code[a_, b_, angle_] := N[(N[Power[a, 2.0], $MachinePrecision] + N[Power[N[(b * N[(Exp[N[Log[1 + N[Sin[N[(Pi * N[(0.005555555555555556 * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{a}^{2} + {\left(b \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(\sin \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)\right)\right)\right)}^{2}
\end{array}
Initial program 81.7%
Taylor expanded in angle around 0 81.6%
expm1-log1p-u81.6%
div-inv81.7%
metadata-eval81.7%
Applied egg-rr81.7%
Final simplification81.7%
(FPCore (a b angle) :precision binary64 (+ (pow a 2.0) (pow (* b (sin (* 0.005555555555555556 (* PI angle)))) 2.0)))
double code(double a, double b, double angle) {
return pow(a, 2.0) + pow((b * sin((0.005555555555555556 * (((double) M_PI) * angle)))), 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 * (Math.PI * angle)))), 2.0);
}
def code(a, b, angle): return math.pow(a, 2.0) + math.pow((b * math.sin((0.005555555555555556 * (math.pi * angle)))), 2.0)
function code(a, b, angle) return Float64((a ^ 2.0) + (Float64(b * sin(Float64(0.005555555555555556 * Float64(pi * angle)))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = (a ^ 2.0) + ((b * sin((0.005555555555555556 * (pi * angle)))) ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[a, 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[N[(0.005555555555555556 * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{a}^{2} + {\left(b \cdot \sin \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)\right)}^{2}
\end{array}
Initial program 81.7%
Taylor expanded in angle around 0 81.6%
Taylor expanded in b around 0 81.6%
Final simplification81.6%
(FPCore (a b angle) :precision binary64 (+ (pow a 2.0) (* (* 0.005555555555555556 (* b (* PI angle))) (* b (* angle (* 0.005555555555555556 PI))))))
double code(double a, double b, double angle) {
return pow(a, 2.0) + ((0.005555555555555556 * (b * (((double) M_PI) * angle))) * (b * (angle * (0.005555555555555556 * ((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))) * (b * (angle * (0.005555555555555556 * Math.PI))));
}
def code(a, b, angle): return math.pow(a, 2.0) + ((0.005555555555555556 * (b * (math.pi * angle))) * (b * (angle * (0.005555555555555556 * math.pi))))
function code(a, b, angle) return Float64((a ^ 2.0) + Float64(Float64(0.005555555555555556 * Float64(b * Float64(pi * angle))) * Float64(b * Float64(angle * Float64(0.005555555555555556 * pi))))) end
function tmp = code(a, b, angle) tmp = (a ^ 2.0) + ((0.005555555555555556 * (b * (pi * angle))) * (b * (angle * (0.005555555555555556 * pi)))); end
code[a_, b_, angle_] := N[(N[Power[a, 2.0], $MachinePrecision] + N[(N[(0.005555555555555556 * N[(b * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(b * N[(angle * N[(0.005555555555555556 * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{a}^{2} + \left(0.005555555555555556 \cdot \left(b \cdot \left(\pi \cdot angle\right)\right)\right) \cdot \left(b \cdot \left(angle \cdot \left(0.005555555555555556 \cdot \pi\right)\right)\right)
\end{array}
Initial program 81.7%
Taylor expanded in angle around 0 81.6%
Taylor expanded in angle around 0 75.8%
metadata-eval75.8%
*-commutative75.8%
associate-/r/75.7%
associate-/l*75.8%
*-commutative75.8%
associate-/l*75.8%
metadata-eval75.8%
*-commutative75.8%
associate-*r/75.8%
Simplified75.8%
unpow275.8%
associate-*r*74.0%
*-commutative74.0%
associate-*r/74.0%
div-inv74.0%
*-commutative74.0%
metadata-eval74.0%
associate-*r*74.0%
*-commutative74.0%
*-commutative74.0%
associate-*r*74.0%
associate-*r*74.0%
*-commutative74.0%
*-commutative74.0%
associate-*r/74.0%
div-inv74.0%
metadata-eval74.0%
*-commutative74.0%
associate-*r*74.0%
*-commutative74.0%
*-commutative74.0%
Applied egg-rr74.0%
associate-*l*75.8%
Simplified75.8%
Final simplification75.8%
(FPCore (a b angle) :precision binary64 (+ (pow a 2.0) (* 3.08641975308642e-5 (pow (* PI (* angle b)) 2.0))))
double code(double a, double b, double angle) {
return pow(a, 2.0) + (3.08641975308642e-5 * pow((((double) M_PI) * (angle * b)), 2.0));
}
public static double code(double a, double b, double angle) {
return Math.pow(a, 2.0) + (3.08641975308642e-5 * Math.pow((Math.PI * (angle * b)), 2.0));
}
def code(a, b, angle): return math.pow(a, 2.0) + (3.08641975308642e-5 * math.pow((math.pi * (angle * b)), 2.0))
function code(a, b, angle) return Float64((a ^ 2.0) + Float64(3.08641975308642e-5 * (Float64(pi * Float64(angle * b)) ^ 2.0))) end
function tmp = code(a, b, angle) tmp = (a ^ 2.0) + (3.08641975308642e-5 * ((pi * (angle * b)) ^ 2.0)); end
code[a_, b_, angle_] := N[(N[Power[a, 2.0], $MachinePrecision] + N[(3.08641975308642e-5 * N[Power[N[(Pi * N[(angle * b), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{a}^{2} + 3.08641975308642 \cdot 10^{-5} \cdot {\left(\pi \cdot \left(angle \cdot b\right)\right)}^{2}
\end{array}
Initial program 81.7%
Taylor expanded in angle around 0 81.6%
Taylor expanded in angle around 0 75.8%
metadata-eval75.8%
*-commutative75.8%
associate-/r/75.7%
associate-/l*75.8%
*-commutative75.8%
associate-/l*75.8%
metadata-eval75.8%
*-commutative75.8%
associate-*r/75.8%
Simplified75.8%
Taylor expanded in b around 0 60.9%
metadata-eval60.9%
*-commutative60.9%
unpow260.9%
unpow260.9%
unswap-sqr60.9%
unpow260.9%
swap-sqr75.8%
associate-*r*75.8%
associate-*r*75.8%
swap-sqr75.8%
unpow275.8%
associate-*r*75.8%
*-commutative75.8%
associate-*r*75.8%
*-commutative75.8%
*-commutative75.8%
*-commutative75.8%
Simplified75.8%
Taylor expanded in angle around 0 60.9%
unpow260.9%
unpow260.9%
unswap-sqr60.9%
unpow260.9%
swap-sqr75.8%
unpow275.8%
associate-*r*75.8%
*-commutative75.8%
Simplified75.8%
Final simplification75.8%
(FPCore (a b angle) :precision binary64 (+ (pow a 2.0) (* (pow (* angle (* PI b)) 2.0) 3.08641975308642e-5)))
double code(double a, double b, double angle) {
return pow(a, 2.0) + (pow((angle * (((double) M_PI) * b)), 2.0) * 3.08641975308642e-5);
}
public static double code(double a, double b, double angle) {
return Math.pow(a, 2.0) + (Math.pow((angle * (Math.PI * b)), 2.0) * 3.08641975308642e-5);
}
def code(a, b, angle): return math.pow(a, 2.0) + (math.pow((angle * (math.pi * b)), 2.0) * 3.08641975308642e-5)
function code(a, b, angle) return Float64((a ^ 2.0) + Float64((Float64(angle * Float64(pi * b)) ^ 2.0) * 3.08641975308642e-5)) end
function tmp = code(a, b, angle) tmp = (a ^ 2.0) + (((angle * (pi * b)) ^ 2.0) * 3.08641975308642e-5); end
code[a_, b_, angle_] := N[(N[Power[a, 2.0], $MachinePrecision] + N[(N[Power[N[(angle * N[(Pi * b), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * 3.08641975308642e-5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{a}^{2} + {\left(angle \cdot \left(\pi \cdot b\right)\right)}^{2} \cdot 3.08641975308642 \cdot 10^{-5}
\end{array}
Initial program 81.7%
Taylor expanded in angle around 0 81.6%
Taylor expanded in angle around 0 75.8%
metadata-eval75.8%
*-commutative75.8%
associate-/r/75.7%
associate-/l*75.8%
*-commutative75.8%
associate-/l*75.8%
metadata-eval75.8%
*-commutative75.8%
associate-*r/75.8%
Simplified75.8%
Taylor expanded in b around 0 60.9%
metadata-eval60.9%
*-commutative60.9%
unpow260.9%
unpow260.9%
unswap-sqr60.9%
unpow260.9%
swap-sqr75.8%
associate-*r*75.8%
associate-*r*75.8%
swap-sqr75.8%
unpow275.8%
associate-*r*75.8%
*-commutative75.8%
associate-*r*75.8%
*-commutative75.8%
*-commutative75.8%
*-commutative75.8%
Simplified75.8%
*-commutative75.8%
unpow-prod-down75.8%
*-commutative75.8%
associate-*l*75.8%
metadata-eval75.8%
Applied egg-rr75.8%
Final simplification75.8%
(FPCore (a b angle) :precision binary64 (+ (pow a 2.0) (pow (* b (* angle (/ PI 180.0))) 2.0)))
double code(double a, double b, double angle) {
return pow(a, 2.0) + pow((b * (angle * (((double) M_PI) / 180.0))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow(a, 2.0) + Math.pow((b * (angle * (Math.PI / 180.0))), 2.0);
}
def code(a, b, angle): return math.pow(a, 2.0) + math.pow((b * (angle * (math.pi / 180.0))), 2.0)
function code(a, b, angle) return Float64((a ^ 2.0) + (Float64(b * Float64(angle * Float64(pi / 180.0))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = (a ^ 2.0) + ((b * (angle * (pi / 180.0))) ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[a, 2.0], $MachinePrecision] + N[Power[N[(b * N[(angle * N[(Pi / 180.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{a}^{2} + {\left(b \cdot \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2}
\end{array}
Initial program 81.7%
Taylor expanded in angle around 0 81.6%
Taylor expanded in angle around 0 75.8%
metadata-eval75.8%
*-commutative75.8%
associate-/r/75.7%
associate-/l*75.8%
*-commutative75.8%
associate-/l*75.8%
metadata-eval75.8%
*-commutative75.8%
associate-*r/75.8%
Simplified75.8%
Final simplification75.8%
herbie shell --seed 2023196
(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)))