
(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 9 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}
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (/ angle (/ 180.0 PI)))) 2.0) (pow b 2.0)))
double code(double a, double b, double angle) {
return pow((a * sin((angle / (180.0 / ((double) M_PI))))), 2.0) + pow(b, 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.sin((angle / (180.0 / Math.PI)))), 2.0) + Math.pow(b, 2.0);
}
def code(a, b, angle): return math.pow((a * math.sin((angle / (180.0 / math.pi)))), 2.0) + math.pow(b, 2.0)
function code(a, b, angle) return Float64((Float64(a * sin(Float64(angle / Float64(180.0 / pi)))) ^ 2.0) + (b ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((a * sin((angle / (180.0 / pi)))) ^ 2.0) + (b ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Sin[N[(angle / N[(180.0 / Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \sin \left(\frac{angle}{\frac{180}{\pi}}\right)\right)}^{2} + {b}^{2}
\end{array}
Initial program 81.1%
associate-*l/81.2%
associate-/l*81.2%
associate-*l/81.1%
associate-/l*81.2%
Simplified81.2%
Taylor expanded in angle around 0 81.3%
*-un-lft-identity81.3%
*-commutative81.3%
add-sqr-sqrt81.3%
pow281.3%
sqrt-pow181.3%
metadata-eval81.3%
pow181.3%
clear-num81.3%
un-div-inv81.4%
Applied egg-rr81.4%
Final simplification81.4%
(FPCore (a b angle) :precision binary64 (+ (pow b 2.0) (pow (* a (sin (* 0.005555555555555556 (* angle PI)))) 2.0)))
double code(double a, double b, double angle) {
return pow(b, 2.0) + pow((a * sin((0.005555555555555556 * (angle * ((double) M_PI))))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow(b, 2.0) + Math.pow((a * Math.sin((0.005555555555555556 * (angle * Math.PI)))), 2.0);
}
def code(a, b, angle): return math.pow(b, 2.0) + math.pow((a * math.sin((0.005555555555555556 * (angle * math.pi)))), 2.0)
function code(a, b, angle) return Float64((b ^ 2.0) + (Float64(a * sin(Float64(0.005555555555555556 * Float64(angle * pi)))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = (b ^ 2.0) + ((a * sin((0.005555555555555556 * (angle * pi)))) ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[b, 2.0], $MachinePrecision] + N[Power[N[(a * N[Sin[N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{b}^{2} + {\left(a \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2}
\end{array}
Initial program 81.1%
associate-*l/81.2%
associate-/l*81.2%
associate-*l/81.1%
associate-/l*81.2%
Simplified81.2%
Taylor expanded in angle around 0 81.3%
Taylor expanded in angle around inf 81.3%
Final simplification81.3%
(FPCore (a b angle) :precision binary64 (+ (pow b 2.0) (pow (* a (sin (* angle (/ PI 180.0)))) 2.0)))
double code(double a, double b, double angle) {
return pow(b, 2.0) + pow((a * sin((angle * (((double) M_PI) / 180.0)))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow(b, 2.0) + Math.pow((a * Math.sin((angle * (Math.PI / 180.0)))), 2.0);
}
def code(a, b, angle): return math.pow(b, 2.0) + math.pow((a * math.sin((angle * (math.pi / 180.0)))), 2.0)
function code(a, b, angle) return Float64((b ^ 2.0) + (Float64(a * sin(Float64(angle * Float64(pi / 180.0)))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = (b ^ 2.0) + ((a * sin((angle * (pi / 180.0)))) ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[b, 2.0], $MachinePrecision] + N[Power[N[(a * N[Sin[N[(angle * N[(Pi / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{b}^{2} + {\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2}
\end{array}
Initial program 81.1%
associate-*l/81.2%
associate-/l*81.2%
associate-*l/81.1%
associate-/l*81.2%
Simplified81.2%
Taylor expanded in angle around 0 81.3%
Final simplification81.3%
(FPCore (a b angle) :precision binary64 (if (<= a 2.8e-62) (+ (pow b 2.0) (* 0.0 (pow a 2.0))) (+ (pow b 2.0) (* (pow (* angle (* a PI)) 2.0) 3.08641975308642e-5))))
double code(double a, double b, double angle) {
double tmp;
if (a <= 2.8e-62) {
tmp = pow(b, 2.0) + (0.0 * pow(a, 2.0));
} else {
tmp = pow(b, 2.0) + (pow((angle * (a * ((double) M_PI))), 2.0) * 3.08641975308642e-5);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (a <= 2.8e-62) {
tmp = Math.pow(b, 2.0) + (0.0 * Math.pow(a, 2.0));
} else {
tmp = Math.pow(b, 2.0) + (Math.pow((angle * (a * Math.PI)), 2.0) * 3.08641975308642e-5);
}
return tmp;
}
def code(a, b, angle): tmp = 0 if a <= 2.8e-62: tmp = math.pow(b, 2.0) + (0.0 * math.pow(a, 2.0)) else: tmp = math.pow(b, 2.0) + (math.pow((angle * (a * math.pi)), 2.0) * 3.08641975308642e-5) return tmp
function code(a, b, angle) tmp = 0.0 if (a <= 2.8e-62) tmp = Float64((b ^ 2.0) + Float64(0.0 * (a ^ 2.0))); else tmp = Float64((b ^ 2.0) + Float64((Float64(angle * Float64(a * pi)) ^ 2.0) * 3.08641975308642e-5)); end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (a <= 2.8e-62) tmp = (b ^ 2.0) + (0.0 * (a ^ 2.0)); else tmp = (b ^ 2.0) + (((angle * (a * pi)) ^ 2.0) * 3.08641975308642e-5); end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[a, 2.8e-62], N[(N[Power[b, 2.0], $MachinePrecision] + N[(0.0 * N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[b, 2.0], $MachinePrecision] + N[(N[Power[N[(angle * N[(a * Pi), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * 3.08641975308642e-5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 2.8 \cdot 10^{-62}:\\
\;\;\;\;{b}^{2} + 0 \cdot {a}^{2}\\
\mathbf{else}:\\
\;\;\;\;{b}^{2} + {\left(angle \cdot \left(a \cdot \pi\right)\right)}^{2} \cdot 3.08641975308642 \cdot 10^{-5}\\
\end{array}
\end{array}
if a < 2.80000000000000002e-62Initial program 81.0%
associate-*l/81.2%
associate-/l*81.1%
associate-*l/80.9%
associate-/l*81.0%
Simplified81.0%
Taylor expanded in angle around 0 81.1%
*-commutative81.1%
unpow-prod-down75.7%
clear-num75.7%
un-div-inv75.8%
Applied egg-rr75.8%
unpow275.8%
div-inv74.9%
clear-num74.9%
div-inv74.9%
metadata-eval74.9%
div-inv75.7%
clear-num75.7%
div-inv75.7%
metadata-eval75.7%
sqr-sin-a72.4%
add-sqr-sqrt33.6%
sqrt-unprod56.5%
associate-*r*56.5%
*-commutative56.5%
associate-*r*56.5%
*-commutative56.5%
Applied egg-rr72.4%
Simplified61.7%
if 2.80000000000000002e-62 < a Initial program 81.4%
associate-*l/81.4%
associate-/l*81.6%
associate-*l/81.6%
associate-/l*81.6%
Simplified81.6%
Taylor expanded in angle around 0 81.9%
Taylor expanded in angle around 0 76.5%
*-commutative76.5%
*-commutative76.5%
associate-*l*76.5%
Simplified76.5%
*-commutative76.5%
unpow-prod-down76.6%
*-commutative76.6%
associate-*l*76.6%
metadata-eval76.6%
Applied egg-rr76.6%
Final simplification66.0%
(FPCore (a b angle)
:precision binary64
(if (<= a 1.26e-61)
(+ (pow b 2.0) (* 0.0 (pow a 2.0)))
(+
(pow b 2.0)
(*
(* (* PI 0.005555555555555556) (* a angle))
(* angle (* a (* PI 0.005555555555555556)))))))
double code(double a, double b, double angle) {
double tmp;
if (a <= 1.26e-61) {
tmp = pow(b, 2.0) + (0.0 * pow(a, 2.0));
} else {
tmp = pow(b, 2.0) + (((((double) M_PI) * 0.005555555555555556) * (a * angle)) * (angle * (a * (((double) M_PI) * 0.005555555555555556))));
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (a <= 1.26e-61) {
tmp = Math.pow(b, 2.0) + (0.0 * Math.pow(a, 2.0));
} else {
tmp = Math.pow(b, 2.0) + (((Math.PI * 0.005555555555555556) * (a * angle)) * (angle * (a * (Math.PI * 0.005555555555555556))));
}
return tmp;
}
def code(a, b, angle): tmp = 0 if a <= 1.26e-61: tmp = math.pow(b, 2.0) + (0.0 * math.pow(a, 2.0)) else: tmp = math.pow(b, 2.0) + (((math.pi * 0.005555555555555556) * (a * angle)) * (angle * (a * (math.pi * 0.005555555555555556)))) return tmp
function code(a, b, angle) tmp = 0.0 if (a <= 1.26e-61) tmp = Float64((b ^ 2.0) + Float64(0.0 * (a ^ 2.0))); else tmp = Float64((b ^ 2.0) + Float64(Float64(Float64(pi * 0.005555555555555556) * Float64(a * angle)) * Float64(angle * Float64(a * Float64(pi * 0.005555555555555556))))); end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (a <= 1.26e-61) tmp = (b ^ 2.0) + (0.0 * (a ^ 2.0)); else tmp = (b ^ 2.0) + (((pi * 0.005555555555555556) * (a * angle)) * (angle * (a * (pi * 0.005555555555555556)))); end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[a, 1.26e-61], N[(N[Power[b, 2.0], $MachinePrecision] + N[(0.0 * N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[b, 2.0], $MachinePrecision] + N[(N[(N[(Pi * 0.005555555555555556), $MachinePrecision] * N[(a * angle), $MachinePrecision]), $MachinePrecision] * N[(angle * N[(a * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 1.26 \cdot 10^{-61}:\\
\;\;\;\;{b}^{2} + 0 \cdot {a}^{2}\\
\mathbf{else}:\\
\;\;\;\;{b}^{2} + \left(\left(\pi \cdot 0.005555555555555556\right) \cdot \left(a \cdot angle\right)\right) \cdot \left(angle \cdot \left(a \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)\\
\end{array}
\end{array}
if a < 1.2599999999999999e-61Initial program 81.0%
associate-*l/81.2%
associate-/l*81.1%
associate-*l/80.9%
associate-/l*81.0%
Simplified81.0%
Taylor expanded in angle around 0 81.1%
*-commutative81.1%
unpow-prod-down75.7%
clear-num75.7%
un-div-inv75.8%
Applied egg-rr75.8%
unpow275.8%
div-inv74.9%
clear-num74.9%
div-inv74.9%
metadata-eval74.9%
div-inv75.7%
clear-num75.7%
div-inv75.7%
metadata-eval75.7%
sqr-sin-a72.4%
add-sqr-sqrt33.6%
sqrt-unprod56.5%
associate-*r*56.5%
*-commutative56.5%
associate-*r*56.5%
*-commutative56.5%
Applied egg-rr72.4%
Simplified61.7%
if 1.2599999999999999e-61 < a Initial program 81.4%
associate-*l/81.4%
associate-/l*81.6%
associate-*l/81.6%
associate-/l*81.6%
Simplified81.6%
Taylor expanded in angle around 0 81.9%
Taylor expanded in angle around 0 76.5%
*-commutative76.5%
*-commutative76.5%
associate-*l*76.5%
Simplified76.5%
unpow276.5%
associate-*r*76.6%
associate-*l*76.6%
*-commutative76.6%
associate-*r*76.6%
associate-*r*76.6%
metadata-eval76.6%
associate-/r/76.6%
associate-*l/76.6%
*-un-lft-identity76.6%
div-inv76.6%
clear-num76.6%
div-inv76.6%
metadata-eval76.6%
Applied egg-rr76.6%
associate-*r*76.6%
*-commutative76.6%
associate-*l*76.6%
*-commutative76.6%
Simplified76.6%
Final simplification66.0%
(FPCore (a b angle) :precision binary64 (+ (pow b 2.0) (* 0.005555555555555556 (* a (* (* 0.005555555555555556 (* angle PI)) (* PI (* a angle)))))))
double code(double a, double b, double angle) {
return pow(b, 2.0) + (0.005555555555555556 * (a * ((0.005555555555555556 * (angle * ((double) M_PI))) * (((double) M_PI) * (a * angle)))));
}
public static double code(double a, double b, double angle) {
return Math.pow(b, 2.0) + (0.005555555555555556 * (a * ((0.005555555555555556 * (angle * Math.PI)) * (Math.PI * (a * angle)))));
}
def code(a, b, angle): return math.pow(b, 2.0) + (0.005555555555555556 * (a * ((0.005555555555555556 * (angle * math.pi)) * (math.pi * (a * angle)))))
function code(a, b, angle) return Float64((b ^ 2.0) + Float64(0.005555555555555556 * Float64(a * Float64(Float64(0.005555555555555556 * Float64(angle * pi)) * Float64(pi * Float64(a * angle)))))) end
function tmp = code(a, b, angle) tmp = (b ^ 2.0) + (0.005555555555555556 * (a * ((0.005555555555555556 * (angle * pi)) * (pi * (a * angle))))); end
code[a_, b_, angle_] := N[(N[Power[b, 2.0], $MachinePrecision] + N[(0.005555555555555556 * N[(a * N[(N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision] * N[(Pi * N[(a * angle), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{b}^{2} + 0.005555555555555556 \cdot \left(a \cdot \left(\left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right) \cdot \left(\pi \cdot \left(a \cdot angle\right)\right)\right)\right)
\end{array}
Initial program 81.1%
associate-*l/81.2%
associate-/l*81.2%
associate-*l/81.1%
associate-/l*81.2%
Simplified81.2%
Taylor expanded in angle around 0 81.3%
Taylor expanded in angle around 0 76.1%
*-commutative76.1%
*-commutative76.1%
associate-*l*76.1%
Simplified76.1%
unpow276.1%
*-commutative76.1%
associate-*l*76.1%
*-commutative76.1%
associate-*l*76.1%
associate-*r*76.1%
associate-*r*76.1%
metadata-eval76.1%
associate-/r/76.1%
associate-*l/76.1%
*-un-lft-identity76.1%
div-inv76.1%
clear-num76.1%
div-inv76.1%
metadata-eval76.1%
Applied egg-rr76.1%
associate-*r*76.1%
associate-*r*76.1%
*-commutative76.1%
associate-*r*76.1%
*-commutative76.1%
associate-*r*76.1%
*-commutative76.1%
associate-*r*76.1%
associate-*r*76.1%
associate-*r*75.4%
*-commutative75.4%
*-commutative75.4%
associate-*r*75.4%
*-commutative75.4%
associate-*r*75.4%
*-commutative75.4%
Simplified75.4%
Final simplification75.4%
(FPCore (a b angle) :precision binary64 (+ (pow b 2.0) (* 0.005555555555555556 (* a (* (/ (* angle PI) 180.0) (* PI (* a angle)))))))
double code(double a, double b, double angle) {
return pow(b, 2.0) + (0.005555555555555556 * (a * (((angle * ((double) M_PI)) / 180.0) * (((double) M_PI) * (a * angle)))));
}
public static double code(double a, double b, double angle) {
return Math.pow(b, 2.0) + (0.005555555555555556 * (a * (((angle * Math.PI) / 180.0) * (Math.PI * (a * angle)))));
}
def code(a, b, angle): return math.pow(b, 2.0) + (0.005555555555555556 * (a * (((angle * math.pi) / 180.0) * (math.pi * (a * angle)))))
function code(a, b, angle) return Float64((b ^ 2.0) + Float64(0.005555555555555556 * Float64(a * Float64(Float64(Float64(angle * pi) / 180.0) * Float64(pi * Float64(a * angle)))))) end
function tmp = code(a, b, angle) tmp = (b ^ 2.0) + (0.005555555555555556 * (a * (((angle * pi) / 180.0) * (pi * (a * angle))))); end
code[a_, b_, angle_] := N[(N[Power[b, 2.0], $MachinePrecision] + N[(0.005555555555555556 * N[(a * N[(N[(N[(angle * Pi), $MachinePrecision] / 180.0), $MachinePrecision] * N[(Pi * N[(a * angle), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{b}^{2} + 0.005555555555555556 \cdot \left(a \cdot \left(\frac{angle \cdot \pi}{180} \cdot \left(\pi \cdot \left(a \cdot angle\right)\right)\right)\right)
\end{array}
Initial program 81.1%
associate-*l/81.2%
associate-/l*81.2%
associate-*l/81.1%
associate-/l*81.2%
Simplified81.2%
Taylor expanded in angle around 0 81.3%
Taylor expanded in angle around 0 76.1%
*-commutative76.1%
*-commutative76.1%
associate-*l*76.1%
Simplified76.1%
unpow276.1%
*-commutative76.1%
associate-*l*76.1%
*-commutative76.1%
associate-*l*76.1%
associate-*r*76.1%
associate-*r*76.1%
metadata-eval76.1%
associate-/r/76.1%
associate-*l/76.1%
*-un-lft-identity76.1%
div-inv76.1%
clear-num76.1%
div-inv76.1%
metadata-eval76.1%
Applied egg-rr76.1%
associate-*r*76.1%
associate-*r*76.1%
*-commutative76.1%
associate-*r*76.1%
*-commutative76.1%
associate-*r*76.1%
*-commutative76.1%
associate-*r*76.1%
associate-*r*76.1%
associate-*r*75.4%
*-commutative75.4%
*-commutative75.4%
associate-*r*75.4%
*-commutative75.4%
associate-*r*75.4%
*-commutative75.4%
Simplified75.4%
*-commutative75.4%
metadata-eval75.4%
div-inv75.4%
Applied egg-rr75.4%
Final simplification75.4%
(FPCore (a b angle) :precision binary64 (+ (pow b 2.0) (* (* angle (* a PI)) (* (* 0.005555555555555556 (* angle PI)) (* a 0.005555555555555556)))))
double code(double a, double b, double angle) {
return pow(b, 2.0) + ((angle * (a * ((double) M_PI))) * ((0.005555555555555556 * (angle * ((double) M_PI))) * (a * 0.005555555555555556)));
}
public static double code(double a, double b, double angle) {
return Math.pow(b, 2.0) + ((angle * (a * Math.PI)) * ((0.005555555555555556 * (angle * Math.PI)) * (a * 0.005555555555555556)));
}
def code(a, b, angle): return math.pow(b, 2.0) + ((angle * (a * math.pi)) * ((0.005555555555555556 * (angle * math.pi)) * (a * 0.005555555555555556)))
function code(a, b, angle) return Float64((b ^ 2.0) + Float64(Float64(angle * Float64(a * pi)) * Float64(Float64(0.005555555555555556 * Float64(angle * pi)) * Float64(a * 0.005555555555555556)))) end
function tmp = code(a, b, angle) tmp = (b ^ 2.0) + ((angle * (a * pi)) * ((0.005555555555555556 * (angle * pi)) * (a * 0.005555555555555556))); end
code[a_, b_, angle_] := N[(N[Power[b, 2.0], $MachinePrecision] + N[(N[(angle * N[(a * Pi), $MachinePrecision]), $MachinePrecision] * N[(N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision] * N[(a * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{b}^{2} + \left(angle \cdot \left(a \cdot \pi\right)\right) \cdot \left(\left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right) \cdot \left(a \cdot 0.005555555555555556\right)\right)
\end{array}
Initial program 81.1%
associate-*l/81.2%
associate-/l*81.2%
associate-*l/81.1%
associate-/l*81.2%
Simplified81.2%
Taylor expanded in angle around 0 81.3%
Taylor expanded in angle around 0 76.1%
*-commutative76.1%
*-commutative76.1%
associate-*l*76.1%
Simplified76.1%
unpow276.1%
*-commutative76.1%
associate-*l*76.1%
*-commutative76.1%
associate-*l*76.1%
associate-*r*76.1%
associate-*r*76.1%
metadata-eval76.1%
associate-/r/76.1%
associate-*l/76.1%
*-un-lft-identity76.1%
div-inv76.1%
clear-num76.1%
div-inv76.1%
metadata-eval76.1%
Applied egg-rr76.1%
*-commutative76.1%
*-commutative76.1%
associate-*l*76.1%
associate-*r*76.1%
*-commutative76.1%
Simplified76.1%
Final simplification76.1%
(FPCore (a b angle) :precision binary64 (+ (pow b 2.0) (* (* (* PI 0.005555555555555556) (* a angle)) (* angle (* a (* PI 0.005555555555555556))))))
double code(double a, double b, double angle) {
return pow(b, 2.0) + (((((double) M_PI) * 0.005555555555555556) * (a * angle)) * (angle * (a * (((double) M_PI) * 0.005555555555555556))));
}
public static double code(double a, double b, double angle) {
return Math.pow(b, 2.0) + (((Math.PI * 0.005555555555555556) * (a * angle)) * (angle * (a * (Math.PI * 0.005555555555555556))));
}
def code(a, b, angle): return math.pow(b, 2.0) + (((math.pi * 0.005555555555555556) * (a * angle)) * (angle * (a * (math.pi * 0.005555555555555556))))
function code(a, b, angle) return Float64((b ^ 2.0) + Float64(Float64(Float64(pi * 0.005555555555555556) * Float64(a * angle)) * Float64(angle * Float64(a * Float64(pi * 0.005555555555555556))))) end
function tmp = code(a, b, angle) tmp = (b ^ 2.0) + (((pi * 0.005555555555555556) * (a * angle)) * (angle * (a * (pi * 0.005555555555555556)))); end
code[a_, b_, angle_] := N[(N[Power[b, 2.0], $MachinePrecision] + N[(N[(N[(Pi * 0.005555555555555556), $MachinePrecision] * N[(a * angle), $MachinePrecision]), $MachinePrecision] * N[(angle * N[(a * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{b}^{2} + \left(\left(\pi \cdot 0.005555555555555556\right) \cdot \left(a \cdot angle\right)\right) \cdot \left(angle \cdot \left(a \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)
\end{array}
Initial program 81.1%
associate-*l/81.2%
associate-/l*81.2%
associate-*l/81.1%
associate-/l*81.2%
Simplified81.2%
Taylor expanded in angle around 0 81.3%
Taylor expanded in angle around 0 76.1%
*-commutative76.1%
*-commutative76.1%
associate-*l*76.1%
Simplified76.1%
unpow276.1%
associate-*r*76.1%
associate-*l*76.1%
*-commutative76.1%
associate-*r*76.2%
associate-*r*76.2%
metadata-eval76.2%
associate-/r/76.2%
associate-*l/76.2%
*-un-lft-identity76.2%
div-inv76.2%
clear-num76.2%
div-inv76.2%
metadata-eval76.2%
Applied egg-rr76.2%
associate-*r*76.2%
*-commutative76.2%
associate-*l*76.2%
*-commutative76.2%
Simplified76.2%
Final simplification76.2%
herbie shell --seed 2024046
(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)))