
(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 11 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
(let* ((t_0 (sqrt (+ (cos (* angle (* PI 0.005555555555555556))) 1.0))))
(+
(pow (* a (sin (* angle (/ PI 180.0)))) 2.0)
(pow (* b (+ (exp (log1p (* (+ 1.0 t_0) (+ t_0 -1.0)))) -1.0)) 2.0))))
double code(double a, double b, double angle) {
double t_0 = sqrt((cos((angle * (((double) M_PI) * 0.005555555555555556))) + 1.0));
return pow((a * sin((angle * (((double) M_PI) / 180.0)))), 2.0) + pow((b * (exp(log1p(((1.0 + t_0) * (t_0 + -1.0)))) + -1.0)), 2.0);
}
public static double code(double a, double b, double angle) {
double t_0 = Math.sqrt((Math.cos((angle * (Math.PI * 0.005555555555555556))) + 1.0));
return Math.pow((a * Math.sin((angle * (Math.PI / 180.0)))), 2.0) + Math.pow((b * (Math.exp(Math.log1p(((1.0 + t_0) * (t_0 + -1.0)))) + -1.0)), 2.0);
}
def code(a, b, angle): t_0 = math.sqrt((math.cos((angle * (math.pi * 0.005555555555555556))) + 1.0)) return math.pow((a * math.sin((angle * (math.pi / 180.0)))), 2.0) + math.pow((b * (math.exp(math.log1p(((1.0 + t_0) * (t_0 + -1.0)))) + -1.0)), 2.0)
function code(a, b, angle) t_0 = sqrt(Float64(cos(Float64(angle * Float64(pi * 0.005555555555555556))) + 1.0)) return Float64((Float64(a * sin(Float64(angle * Float64(pi / 180.0)))) ^ 2.0) + (Float64(b * Float64(exp(log1p(Float64(Float64(1.0 + t_0) * Float64(t_0 + -1.0)))) + -1.0)) ^ 2.0)) end
code[a_, b_, angle_] := Block[{t$95$0 = N[Sqrt[N[(N[Cos[N[(angle * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]}, N[(N[Power[N[(a * N[Sin[N[(angle * N[(Pi / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[(N[Exp[N[Log[1 + N[(N[(1.0 + t$95$0), $MachinePrecision] * N[(t$95$0 + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\cos \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right) + 1}\\
{\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \left(e^{\mathsf{log1p}\left(\left(1 + t\_0\right) \cdot \left(t\_0 + -1\right)\right)} + -1\right)\right)}^{2}
\end{array}
\end{array}
Initial program 74.2%
associate-*l/74.2%
associate-/l*74.2%
associate-*l/74.2%
associate-/l*74.3%
Simplified74.3%
associate-*r/74.2%
associate-*l/74.2%
expm1-log1p-u74.2%
expm1-undefine74.2%
associate-*l/74.2%
associate-*r/74.3%
div-inv74.3%
metadata-eval74.3%
Applied egg-rr74.3%
expm1-log1p-u74.3%
expm1-undefine74.3%
add-sqr-sqrt73.5%
fma-neg74.3%
Applied egg-rr74.3%
fma-undefine73.5%
difference-of-sqr--174.3%
Applied egg-rr74.3%
Final simplification74.3%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (* PI (/ angle 180.0)))) 2.0) (pow (* b (+ (+ (cos (* angle (* PI 0.005555555555555556))) 1.0) -1.0)) 2.0)))
double code(double a, double b, double angle) {
return pow((a * sin((((double) M_PI) * (angle / 180.0)))), 2.0) + pow((b * ((cos((angle * (((double) M_PI) * 0.005555555555555556))) + 1.0) + -1.0)), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.sin((Math.PI * (angle / 180.0)))), 2.0) + Math.pow((b * ((Math.cos((angle * (Math.PI * 0.005555555555555556))) + 1.0) + -1.0)), 2.0);
}
def code(a, b, angle): return math.pow((a * math.sin((math.pi * (angle / 180.0)))), 2.0) + math.pow((b * ((math.cos((angle * (math.pi * 0.005555555555555556))) + 1.0) + -1.0)), 2.0)
function code(a, b, angle) return Float64((Float64(a * sin(Float64(pi * Float64(angle / 180.0)))) ^ 2.0) + (Float64(b * Float64(Float64(cos(Float64(angle * Float64(pi * 0.005555555555555556))) + 1.0) + -1.0)) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((a * sin((pi * (angle / 180.0)))) ^ 2.0) + ((b * ((cos((angle * (pi * 0.005555555555555556))) + 1.0) + -1.0)) ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Sin[N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[(N[(N[Cos[N[(angle * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \left(\left(\cos \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right) + 1\right) + -1\right)\right)}^{2}
\end{array}
Initial program 74.2%
associate-*l/74.2%
clear-num74.1%
Applied egg-rr74.1%
clear-num74.2%
div-inv74.2%
metadata-eval74.2%
associate-*r*74.3%
expm1-log1p-u74.3%
log1p-define74.3%
+-commutative74.3%
expm1-undefine74.3%
add-exp-log74.3%
Applied egg-rr74.3%
Final simplification74.3%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (* angle (/ PI 180.0)))) 2.0) (pow (* b (cos (* 0.005555555555555556 (* angle PI)))) 2.0)))
double code(double a, double b, double angle) {
return pow((a * sin((angle * (((double) M_PI) / 180.0)))), 2.0) + pow((b * cos((0.005555555555555556 * (angle * ((double) M_PI))))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.sin((angle * (Math.PI / 180.0)))), 2.0) + Math.pow((b * Math.cos((0.005555555555555556 * (angle * Math.PI)))), 2.0);
}
def code(a, b, angle): return math.pow((a * math.sin((angle * (math.pi / 180.0)))), 2.0) + math.pow((b * math.cos((0.005555555555555556 * (angle * math.pi)))), 2.0)
function code(a, b, angle) return Float64((Float64(a * sin(Float64(angle * Float64(pi / 180.0)))) ^ 2.0) + (Float64(b * cos(Float64(0.005555555555555556 * Float64(angle * pi)))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((a * sin((angle * (pi / 180.0)))) ^ 2.0) + ((b * cos((0.005555555555555556 * (angle * pi)))) ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Sin[N[(angle * N[(Pi / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2}
\end{array}
Initial program 74.2%
associate-*l/74.2%
associate-/l*74.2%
associate-*l/74.2%
associate-/l*74.3%
Simplified74.3%
Taylor expanded in angle around inf 74.2%
Final simplification74.2%
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* angle (/ PI 180.0)))) (+ (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 * (((double) M_PI) / 180.0);
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 * (Math.PI / 180.0);
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 * (math.pi / 180.0) 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(angle * Float64(pi / 180.0)) 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 * (pi / 180.0); tmp = ((a * sin(t_0)) ^ 2.0) + ((b * cos(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[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 := angle \cdot \frac{\pi}{180}\\
{\left(a \cdot \sin t\_0\right)}^{2} + {\left(b \cdot \cos t\_0\right)}^{2}
\end{array}
\end{array}
Initial program 74.2%
associate-*l/74.2%
associate-/l*74.2%
associate-*l/74.2%
associate-/l*74.3%
Simplified74.3%
Final simplification74.3%
(FPCore (a b angle)
:precision binary64
(if (<= a 4.3e-57)
(+ (pow (* a 0.0) 2.0) (pow (* b (cos (* PI (/ angle 180.0)))) 2.0))
(+
(pow b 2.0)
(*
(* 0.005555555555555556 (* PI (* 0.005555555555555556 (* a angle))))
(* angle (* a PI))))))
double code(double a, double b, double angle) {
double tmp;
if (a <= 4.3e-57) {
tmp = pow((a * 0.0), 2.0) + pow((b * cos((((double) M_PI) * (angle / 180.0)))), 2.0);
} else {
tmp = pow(b, 2.0) + ((0.005555555555555556 * (((double) M_PI) * (0.005555555555555556 * (a * angle)))) * (angle * (a * ((double) M_PI))));
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (a <= 4.3e-57) {
tmp = Math.pow((a * 0.0), 2.0) + Math.pow((b * Math.cos((Math.PI * (angle / 180.0)))), 2.0);
} else {
tmp = Math.pow(b, 2.0) + ((0.005555555555555556 * (Math.PI * (0.005555555555555556 * (a * angle)))) * (angle * (a * Math.PI)));
}
return tmp;
}
def code(a, b, angle): tmp = 0 if a <= 4.3e-57: tmp = math.pow((a * 0.0), 2.0) + math.pow((b * math.cos((math.pi * (angle / 180.0)))), 2.0) else: tmp = math.pow(b, 2.0) + ((0.005555555555555556 * (math.pi * (0.005555555555555556 * (a * angle)))) * (angle * (a * math.pi))) return tmp
function code(a, b, angle) tmp = 0.0 if (a <= 4.3e-57) tmp = Float64((Float64(a * 0.0) ^ 2.0) + (Float64(b * cos(Float64(pi * Float64(angle / 180.0)))) ^ 2.0)); else tmp = Float64((b ^ 2.0) + Float64(Float64(0.005555555555555556 * Float64(pi * Float64(0.005555555555555556 * Float64(a * angle)))) * Float64(angle * Float64(a * pi)))); end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (a <= 4.3e-57) tmp = ((a * 0.0) ^ 2.0) + ((b * cos((pi * (angle / 180.0)))) ^ 2.0); else tmp = (b ^ 2.0) + ((0.005555555555555556 * (pi * (0.005555555555555556 * (a * angle)))) * (angle * (a * pi))); end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[a, 4.3e-57], N[(N[Power[N[(a * 0.0), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], N[(N[Power[b, 2.0], $MachinePrecision] + N[(N[(0.005555555555555556 * N[(Pi * N[(0.005555555555555556 * N[(a * angle), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(angle * N[(a * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 4.3 \cdot 10^{-57}:\\
\;\;\;\;{\left(a \cdot 0\right)}^{2} + {\left(b \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;{b}^{2} + \left(0.005555555555555556 \cdot \left(\pi \cdot \left(0.005555555555555556 \cdot \left(a \cdot angle\right)\right)\right)\right) \cdot \left(angle \cdot \left(a \cdot \pi\right)\right)\\
\end{array}
\end{array}
if a < 4.30000000000000022e-57Initial program 72.0%
add-cube-cbrt71.7%
pow371.7%
associate-*l/71.6%
associate-*r/71.7%
div-inv71.7%
metadata-eval71.7%
Applied egg-rr71.7%
Taylor expanded in angle around 0 56.9%
if 4.30000000000000022e-57 < a Initial program 79.7%
associate-*l/79.8%
associate-/l*79.9%
associate-*l/80.0%
associate-/l*79.9%
Simplified79.9%
Taylor expanded in angle around 0 80.1%
Taylor expanded in angle around 0 76.5%
*-commutative76.5%
*-commutative76.5%
associate-*l*76.6%
Simplified76.6%
unpow276.6%
associate-*r*76.6%
*-commutative76.6%
associate-*l*76.6%
associate-*r*76.6%
*-commutative76.6%
associate-*l*76.6%
Applied egg-rr76.6%
Final simplification62.6%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (/ 1.0 (/ 180.0 (* angle PI))))) 2.0) (pow b 2.0)))
double code(double a, double b, double angle) {
return pow((a * sin((1.0 / (180.0 / (angle * ((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((1.0 / (180.0 / (angle * Math.PI))))), 2.0) + Math.pow(b, 2.0);
}
def code(a, b, angle): return math.pow((a * math.sin((1.0 / (180.0 / (angle * math.pi))))), 2.0) + math.pow(b, 2.0)
function code(a, b, angle) return Float64((Float64(a * sin(Float64(1.0 / Float64(180.0 / Float64(angle * pi))))) ^ 2.0) + (b ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((a * sin((1.0 / (180.0 / (angle * pi))))) ^ 2.0) + (b ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Sin[N[(1.0 / N[(180.0 / N[(angle * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \sin \left(\frac{1}{\frac{180}{angle \cdot \pi}}\right)\right)}^{2} + {b}^{2}
\end{array}
Initial program 74.2%
associate-*l/74.2%
associate-/l*74.2%
associate-*l/74.2%
associate-/l*74.3%
Simplified74.3%
Taylor expanded in angle around 0 73.4%
associate-*r/73.4%
clear-num73.4%
Applied egg-rr73.4%
Final simplification73.4%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (* angle (/ PI 180.0)))) 2.0) (pow b 2.0)))
double code(double a, double b, double angle) {
return pow((a * sin((angle * (((double) M_PI) / 180.0)))), 2.0) + pow(b, 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.sin((angle * (Math.PI / 180.0)))), 2.0) + Math.pow(b, 2.0);
}
def code(a, b, angle): return math.pow((a * math.sin((angle * (math.pi / 180.0)))), 2.0) + math.pow(b, 2.0)
function code(a, b, angle) return Float64((Float64(a * sin(Float64(angle * Float64(pi / 180.0)))) ^ 2.0) + (b ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((a * sin((angle * (pi / 180.0)))) ^ 2.0) + (b ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Sin[N[(angle * N[(Pi / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {b}^{2}
\end{array}
Initial program 74.2%
associate-*l/74.2%
associate-/l*74.2%
associate-*l/74.2%
associate-/l*74.3%
Simplified74.3%
Taylor expanded in angle around 0 73.4%
Final simplification73.4%
(FPCore (a b angle)
:precision binary64
(+
(pow b 2.0)
(*
PI
(*
0.005555555555555556
(* (* angle (* a PI)) (* angle (* a 0.005555555555555556)))))))
double code(double a, double b, double angle) {
return pow(b, 2.0) + (((double) M_PI) * (0.005555555555555556 * ((angle * (a * ((double) M_PI))) * (angle * (a * 0.005555555555555556)))));
}
public static double code(double a, double b, double angle) {
return Math.pow(b, 2.0) + (Math.PI * (0.005555555555555556 * ((angle * (a * Math.PI)) * (angle * (a * 0.005555555555555556)))));
}
def code(a, b, angle): return math.pow(b, 2.0) + (math.pi * (0.005555555555555556 * ((angle * (a * math.pi)) * (angle * (a * 0.005555555555555556)))))
function code(a, b, angle) return Float64((b ^ 2.0) + Float64(pi * Float64(0.005555555555555556 * Float64(Float64(angle * Float64(a * pi)) * Float64(angle * Float64(a * 0.005555555555555556)))))) end
function tmp = code(a, b, angle) tmp = (b ^ 2.0) + (pi * (0.005555555555555556 * ((angle * (a * pi)) * (angle * (a * 0.005555555555555556))))); end
code[a_, b_, angle_] := N[(N[Power[b, 2.0], $MachinePrecision] + N[(Pi * N[(0.005555555555555556 * N[(N[(angle * N[(a * Pi), $MachinePrecision]), $MachinePrecision] * N[(angle * N[(a * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{b}^{2} + \pi \cdot \left(0.005555555555555556 \cdot \left(\left(angle \cdot \left(a \cdot \pi\right)\right) \cdot \left(angle \cdot \left(a \cdot 0.005555555555555556\right)\right)\right)\right)
\end{array}
Initial program 74.2%
associate-*l/74.2%
associate-/l*74.2%
associate-*l/74.2%
associate-/l*74.3%
Simplified74.3%
Taylor expanded in angle around 0 73.4%
Taylor expanded in angle around 0 69.0%
*-commutative69.0%
*-commutative69.0%
associate-*l*69.0%
Simplified69.0%
unpow269.0%
associate-*r*69.0%
*-commutative69.0%
associate-*l*69.0%
*-commutative69.0%
associate-*l*69.0%
Applied egg-rr69.0%
associate-*l*69.0%
associate-*r*69.0%
*-commutative69.0%
associate-*r*69.0%
*-commutative69.0%
associate-*r*69.0%
*-commutative69.0%
associate-*l*69.0%
*-commutative69.0%
Simplified69.0%
Final simplification69.0%
(FPCore (a b angle) :precision binary64 (+ (pow b 2.0) (* (* PI 0.005555555555555556) (* (* a angle) (* PI (* 0.005555555555555556 (* a angle)))))))
double code(double a, double b, double angle) {
return pow(b, 2.0) + ((((double) M_PI) * 0.005555555555555556) * ((a * angle) * (((double) M_PI) * (0.005555555555555556 * (a * angle)))));
}
public static double code(double a, double b, double angle) {
return Math.pow(b, 2.0) + ((Math.PI * 0.005555555555555556) * ((a * angle) * (Math.PI * (0.005555555555555556 * (a * angle)))));
}
def code(a, b, angle): return math.pow(b, 2.0) + ((math.pi * 0.005555555555555556) * ((a * angle) * (math.pi * (0.005555555555555556 * (a * angle)))))
function code(a, b, angle) return Float64((b ^ 2.0) + Float64(Float64(pi * 0.005555555555555556) * Float64(Float64(a * angle) * Float64(pi * Float64(0.005555555555555556 * Float64(a * angle)))))) end
function tmp = code(a, b, angle) tmp = (b ^ 2.0) + ((pi * 0.005555555555555556) * ((a * angle) * (pi * (0.005555555555555556 * (a * angle))))); end
code[a_, b_, angle_] := N[(N[Power[b, 2.0], $MachinePrecision] + N[(N[(Pi * 0.005555555555555556), $MachinePrecision] * N[(N[(a * angle), $MachinePrecision] * N[(Pi * N[(0.005555555555555556 * N[(a * angle), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{b}^{2} + \left(\pi \cdot 0.005555555555555556\right) \cdot \left(\left(a \cdot angle\right) \cdot \left(\pi \cdot \left(0.005555555555555556 \cdot \left(a \cdot angle\right)\right)\right)\right)
\end{array}
Initial program 74.2%
associate-*l/74.2%
associate-/l*74.2%
associate-*l/74.2%
associate-/l*74.3%
Simplified74.3%
Taylor expanded in angle around 0 73.4%
Taylor expanded in angle around 0 69.0%
*-commutative69.0%
*-commutative69.0%
associate-*l*69.0%
Simplified69.0%
unpow269.0%
associate-*r*69.0%
*-commutative69.0%
associate-*l*69.0%
*-commutative69.0%
associate-*l*69.0%
Applied egg-rr69.0%
Final simplification69.0%
(FPCore (a b angle) :precision binary64 (+ (pow b 2.0) (* (* 0.005555555555555556 (* PI (* 0.005555555555555556 (* a angle)))) (* angle (* a PI)))))
double code(double a, double b, double angle) {
return pow(b, 2.0) + ((0.005555555555555556 * (((double) M_PI) * (0.005555555555555556 * (a * angle)))) * (angle * (a * ((double) M_PI))));
}
public static double code(double a, double b, double angle) {
return Math.pow(b, 2.0) + ((0.005555555555555556 * (Math.PI * (0.005555555555555556 * (a * angle)))) * (angle * (a * Math.PI)));
}
def code(a, b, angle): return math.pow(b, 2.0) + ((0.005555555555555556 * (math.pi * (0.005555555555555556 * (a * angle)))) * (angle * (a * math.pi)))
function code(a, b, angle) return Float64((b ^ 2.0) + Float64(Float64(0.005555555555555556 * Float64(pi * Float64(0.005555555555555556 * Float64(a * angle)))) * Float64(angle * Float64(a * pi)))) end
function tmp = code(a, b, angle) tmp = (b ^ 2.0) + ((0.005555555555555556 * (pi * (0.005555555555555556 * (a * angle)))) * (angle * (a * pi))); end
code[a_, b_, angle_] := N[(N[Power[b, 2.0], $MachinePrecision] + N[(N[(0.005555555555555556 * N[(Pi * N[(0.005555555555555556 * N[(a * angle), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(angle * N[(a * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{b}^{2} + \left(0.005555555555555556 \cdot \left(\pi \cdot \left(0.005555555555555556 \cdot \left(a \cdot angle\right)\right)\right)\right) \cdot \left(angle \cdot \left(a \cdot \pi\right)\right)
\end{array}
Initial program 74.2%
associate-*l/74.2%
associate-/l*74.2%
associate-*l/74.2%
associate-/l*74.3%
Simplified74.3%
Taylor expanded in angle around 0 73.4%
Taylor expanded in angle around 0 69.0%
*-commutative69.0%
*-commutative69.0%
associate-*l*69.0%
Simplified69.0%
unpow269.0%
associate-*r*69.0%
*-commutative69.0%
associate-*l*69.0%
associate-*r*69.0%
*-commutative69.0%
associate-*l*69.0%
Applied egg-rr69.0%
Final simplification69.0%
(FPCore (a b angle) :precision binary64 (pow b 2.0))
double code(double a, double b, double angle) {
return pow(b, 2.0);
}
real(8) function code(a, b, angle)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle
code = b ** 2.0d0
end function
public static double code(double a, double b, double angle) {
return Math.pow(b, 2.0);
}
def code(a, b, angle): return math.pow(b, 2.0)
function code(a, b, angle) return b ^ 2.0 end
function tmp = code(a, b, angle) tmp = b ^ 2.0; end
code[a_, b_, angle_] := N[Power[b, 2.0], $MachinePrecision]
\begin{array}{l}
\\
{b}^{2}
\end{array}
Initial program 74.2%
associate-*l/74.2%
associate-/l*74.2%
associate-*l/74.2%
associate-/l*74.3%
Simplified74.3%
Taylor expanded in angle around 0 73.4%
Taylor expanded in angle around 0 69.0%
*-commutative69.0%
*-commutative69.0%
associate-*l*69.0%
Simplified69.0%
Taylor expanded in angle around 0 51.8%
Final simplification51.8%
herbie shell --seed 2024044
(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)))