
(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 11 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 (cos (* 0.005555555555555556 (* PI angle)))))
(+
(* (* a (* a t_0)) t_0)
(pow (* b (sin (* PI (* 0.005555555555555556 angle)))) 2.0))))
double code(double a, double b, double angle) {
double t_0 = cos((0.005555555555555556 * (((double) M_PI) * angle)));
return ((a * (a * t_0)) * t_0) + pow((b * sin((((double) M_PI) * (0.005555555555555556 * angle)))), 2.0);
}
public static double code(double a, double b, double angle) {
double t_0 = Math.cos((0.005555555555555556 * (Math.PI * angle)));
return ((a * (a * t_0)) * t_0) + Math.pow((b * Math.sin((Math.PI * (0.005555555555555556 * angle)))), 2.0);
}
def code(a, b, angle): t_0 = math.cos((0.005555555555555556 * (math.pi * angle))) return ((a * (a * t_0)) * t_0) + math.pow((b * math.sin((math.pi * (0.005555555555555556 * angle)))), 2.0)
function code(a, b, angle) t_0 = cos(Float64(0.005555555555555556 * Float64(pi * angle))) return Float64(Float64(Float64(a * Float64(a * t_0)) * t_0) + (Float64(b * sin(Float64(pi * Float64(0.005555555555555556 * angle)))) ^ 2.0)) end
function tmp = code(a, b, angle) t_0 = cos((0.005555555555555556 * (pi * angle))); tmp = ((a * (a * t_0)) * t_0) + ((b * sin((pi * (0.005555555555555556 * angle)))) ^ 2.0); end
code[a_, b_, angle_] := Block[{t$95$0 = N[Cos[N[(0.005555555555555556 * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[(N[(N[(a * N[(a * t$95$0), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] + N[Power[N[(b * N[Sin[N[(Pi * N[(0.005555555555555556 * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)\\
\left(a \cdot \left(a \cdot t\_0\right)\right) \cdot t\_0 + {\left(b \cdot \sin \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)\right)}^{2}
\end{array}
\end{array}
Initial program 81.0%
associate-*r/81.0%
metadata-eval81.0%
metadata-eval81.0%
distribute-neg-frac281.0%
distribute-frac-neg81.0%
distribute-rgt-neg-out81.0%
associate-/l*81.0%
neg-mul-181.0%
*-commutative81.0%
associate-/l*81.0%
metadata-eval81.0%
metadata-eval81.0%
Simplified81.0%
metadata-eval81.0%
div-inv81.0%
unpow281.0%
associate-*r*81.0%
div-inv78.0%
metadata-eval78.0%
associate-*r*78.2%
*-commutative78.2%
div-inv80.5%
metadata-eval80.5%
associate-*r*81.2%
*-commutative81.2%
Applied egg-rr81.2%
Final simplification81.2%
(FPCore (a b angle) :precision binary64 (+ (pow (* b (sin (* PI (* 0.005555555555555556 angle)))) 2.0) (pow (* a (+ (+ 1.0 (cos (* 0.005555555555555556 (* PI angle)))) -1.0)) 2.0)))
double code(double a, double b, double angle) {
return pow((b * sin((((double) M_PI) * (0.005555555555555556 * angle)))), 2.0) + pow((a * ((1.0 + cos((0.005555555555555556 * (((double) M_PI) * angle)))) + -1.0)), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((b * Math.sin((Math.PI * (0.005555555555555556 * angle)))), 2.0) + Math.pow((a * ((1.0 + Math.cos((0.005555555555555556 * (Math.PI * angle)))) + -1.0)), 2.0);
}
def code(a, b, angle): return math.pow((b * math.sin((math.pi * (0.005555555555555556 * angle)))), 2.0) + math.pow((a * ((1.0 + math.cos((0.005555555555555556 * (math.pi * angle)))) + -1.0)), 2.0)
function code(a, b, angle) return Float64((Float64(b * sin(Float64(pi * Float64(0.005555555555555556 * angle)))) ^ 2.0) + (Float64(a * Float64(Float64(1.0 + cos(Float64(0.005555555555555556 * Float64(pi * angle)))) + -1.0)) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((b * sin((pi * (0.005555555555555556 * angle)))) ^ 2.0) + ((a * ((1.0 + cos((0.005555555555555556 * (pi * angle)))) + -1.0)) ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(b * N[Sin[N[(Pi * N[(0.005555555555555556 * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(a * N[(N[(1.0 + N[Cos[N[(0.005555555555555556 * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(b \cdot \sin \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)\right)}^{2} + {\left(a \cdot \left(\left(1 + \cos \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)\right) + -1\right)\right)}^{2}
\end{array}
Initial program 81.0%
associate-*r/81.0%
metadata-eval81.0%
metadata-eval81.0%
distribute-neg-frac281.0%
distribute-frac-neg81.0%
distribute-rgt-neg-out81.0%
associate-/l*81.0%
neg-mul-181.0%
*-commutative81.0%
associate-/l*81.0%
metadata-eval81.0%
metadata-eval81.0%
Simplified81.0%
metadata-eval81.0%
div-inv81.0%
expm1-log1p-u81.0%
div-inv81.0%
metadata-eval81.0%
associate-*r*81.1%
*-commutative81.1%
Applied egg-rr81.1%
Taylor expanded in angle around inf 81.1%
expm1-undefine81.1%
add-exp-log81.1%
Applied egg-rr81.1%
Final simplification81.1%
(FPCore (a b angle) :precision binary64 (+ (pow (* b (sin (* PI (* 0.005555555555555556 angle)))) 2.0) (pow (* a (+ 1.0 (+ (cos (* 0.005555555555555556 (* PI angle))) -1.0))) 2.0)))
double code(double a, double b, double angle) {
return pow((b * sin((((double) M_PI) * (0.005555555555555556 * angle)))), 2.0) + pow((a * (1.0 + (cos((0.005555555555555556 * (((double) M_PI) * angle))) + -1.0))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((b * Math.sin((Math.PI * (0.005555555555555556 * angle)))), 2.0) + Math.pow((a * (1.0 + (Math.cos((0.005555555555555556 * (Math.PI * angle))) + -1.0))), 2.0);
}
def code(a, b, angle): return math.pow((b * math.sin((math.pi * (0.005555555555555556 * angle)))), 2.0) + math.pow((a * (1.0 + (math.cos((0.005555555555555556 * (math.pi * angle))) + -1.0))), 2.0)
function code(a, b, angle) return Float64((Float64(b * sin(Float64(pi * Float64(0.005555555555555556 * angle)))) ^ 2.0) + (Float64(a * Float64(1.0 + Float64(cos(Float64(0.005555555555555556 * Float64(pi * angle))) + -1.0))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((b * sin((pi * (0.005555555555555556 * angle)))) ^ 2.0) + ((a * (1.0 + (cos((0.005555555555555556 * (pi * angle))) + -1.0))) ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(b * N[Sin[N[(Pi * N[(0.005555555555555556 * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(a * N[(1.0 + N[(N[Cos[N[(0.005555555555555556 * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(b \cdot \sin \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)\right)}^{2} + {\left(a \cdot \left(1 + \left(\cos \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right) + -1\right)\right)\right)}^{2}
\end{array}
Initial program 81.0%
associate-*r/81.0%
metadata-eval81.0%
metadata-eval81.0%
distribute-neg-frac281.0%
distribute-frac-neg81.0%
distribute-rgt-neg-out81.0%
associate-/l*81.0%
neg-mul-181.0%
*-commutative81.0%
associate-/l*81.0%
metadata-eval81.0%
metadata-eval81.0%
Simplified81.0%
metadata-eval81.0%
div-inv81.0%
expm1-log1p-u81.0%
div-inv81.0%
metadata-eval81.0%
associate-*r*81.1%
*-commutative81.1%
Applied egg-rr81.1%
Taylor expanded in angle around inf 81.1%
expm1-undefine81.1%
add-exp-log81.1%
associate--l+81.1%
Applied egg-rr81.1%
Final simplification81.1%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (cos (* PI (* 0.005555555555555556 angle)))) 2.0) (pow (* b (sin (* angle (/ PI 180.0)))) 2.0)))
double code(double a, double b, double angle) {
return pow((a * cos((((double) M_PI) * (0.005555555555555556 * angle)))), 2.0) + pow((b * sin((angle * (((double) M_PI) / 180.0)))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.cos((Math.PI * (0.005555555555555556 * angle)))), 2.0) + Math.pow((b * Math.sin((angle * (Math.PI / 180.0)))), 2.0);
}
def code(a, b, angle): return math.pow((a * math.cos((math.pi * (0.005555555555555556 * angle)))), 2.0) + math.pow((b * math.sin((angle * (math.pi / 180.0)))), 2.0)
function code(a, b, angle) return Float64((Float64(a * cos(Float64(pi * Float64(0.005555555555555556 * angle)))) ^ 2.0) + (Float64(b * sin(Float64(angle * Float64(pi / 180.0)))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((a * cos((pi * (0.005555555555555556 * angle)))) ^ 2.0) + ((b * sin((angle * (pi / 180.0)))) ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Cos[N[(Pi * N[(0.005555555555555556 * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[N[(angle * N[(Pi / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \cos \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2}
\end{array}
Initial program 81.0%
associate-*r/81.0%
metadata-eval81.0%
metadata-eval81.0%
distribute-neg-frac281.0%
distribute-frac-neg81.0%
distribute-rgt-neg-out81.0%
associate-/l*81.0%
neg-mul-181.0%
*-commutative81.0%
associate-/l*81.0%
metadata-eval81.0%
metadata-eval81.0%
Simplified81.0%
metadata-eval81.0%
div-inv81.0%
clear-num81.0%
un-div-inv81.0%
Applied egg-rr81.0%
associate-/r/81.0%
Simplified81.0%
Final simplification81.0%
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* PI (* 0.005555555555555556 angle)))) (+ (pow (* b (sin t_0)) 2.0) (pow (* a (cos t_0)) 2.0))))
double code(double a, double b, double angle) {
double t_0 = ((double) M_PI) * (0.005555555555555556 * angle);
return pow((b * sin(t_0)), 2.0) + pow((a * cos(t_0)), 2.0);
}
public static double code(double a, double b, double angle) {
double t_0 = Math.PI * (0.005555555555555556 * angle);
return Math.pow((b * Math.sin(t_0)), 2.0) + Math.pow((a * Math.cos(t_0)), 2.0);
}
def code(a, b, angle): t_0 = math.pi * (0.005555555555555556 * angle) return math.pow((b * math.sin(t_0)), 2.0) + math.pow((a * math.cos(t_0)), 2.0)
function code(a, b, angle) t_0 = Float64(pi * Float64(0.005555555555555556 * angle)) return Float64((Float64(b * sin(t_0)) ^ 2.0) + (Float64(a * cos(t_0)) ^ 2.0)) end
function tmp = code(a, b, angle) t_0 = pi * (0.005555555555555556 * angle); tmp = ((b * sin(t_0)) ^ 2.0) + ((a * cos(t_0)) ^ 2.0); end
code[a_, b_, angle_] := Block[{t$95$0 = N[(Pi * N[(0.005555555555555556 * angle), $MachinePrecision]), $MachinePrecision]}, N[(N[Power[N[(b * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(a * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \pi \cdot \left(0.005555555555555556 \cdot angle\right)\\
{\left(b \cdot \sin t\_0\right)}^{2} + {\left(a \cdot \cos t\_0\right)}^{2}
\end{array}
\end{array}
Initial program 81.0%
associate-*r/81.0%
metadata-eval81.0%
metadata-eval81.0%
distribute-neg-frac281.0%
distribute-frac-neg81.0%
distribute-rgt-neg-out81.0%
associate-/l*81.0%
neg-mul-181.0%
*-commutative81.0%
associate-/l*81.0%
metadata-eval81.0%
metadata-eval81.0%
Simplified81.0%
Final simplification81.0%
(FPCore (a b angle) :precision binary64 (if (<= a 0.00125) (pow (* b (sin (* angle (* 0.005555555555555556 PI)))) 2.0) (* (pow a 2.0) (pow (cos (* 0.005555555555555556 (* PI angle))) 2.0))))
double code(double a, double b, double angle) {
double tmp;
if (a <= 0.00125) {
tmp = pow((b * sin((angle * (0.005555555555555556 * ((double) M_PI))))), 2.0);
} else {
tmp = pow(a, 2.0) * pow(cos((0.005555555555555556 * (((double) M_PI) * angle))), 2.0);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (a <= 0.00125) {
tmp = Math.pow((b * Math.sin((angle * (0.005555555555555556 * Math.PI)))), 2.0);
} else {
tmp = Math.pow(a, 2.0) * Math.pow(Math.cos((0.005555555555555556 * (Math.PI * angle))), 2.0);
}
return tmp;
}
def code(a, b, angle): tmp = 0 if a <= 0.00125: tmp = math.pow((b * math.sin((angle * (0.005555555555555556 * math.pi)))), 2.0) else: tmp = math.pow(a, 2.0) * math.pow(math.cos((0.005555555555555556 * (math.pi * angle))), 2.0) return tmp
function code(a, b, angle) tmp = 0.0 if (a <= 0.00125) tmp = Float64(b * sin(Float64(angle * Float64(0.005555555555555556 * pi)))) ^ 2.0; else tmp = Float64((a ^ 2.0) * (cos(Float64(0.005555555555555556 * Float64(pi * angle))) ^ 2.0)); end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (a <= 0.00125) tmp = (b * sin((angle * (0.005555555555555556 * pi)))) ^ 2.0; else tmp = (a ^ 2.0) * (cos((0.005555555555555556 * (pi * angle))) ^ 2.0); end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[a, 0.00125], N[Power[N[(b * N[Sin[N[(angle * N[(0.005555555555555556 * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[(N[Power[a, 2.0], $MachinePrecision] * N[Power[N[Cos[N[(0.005555555555555556 * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 0.00125:\\
\;\;\;\;{\left(b \cdot \sin \left(angle \cdot \left(0.005555555555555556 \cdot \pi\right)\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;{a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)}^{2}\\
\end{array}
\end{array}
if a < 0.00125000000000000003Initial program 78.6%
associate-*r/78.7%
metadata-eval78.7%
metadata-eval78.7%
distribute-neg-frac278.7%
distribute-frac-neg78.7%
distribute-rgt-neg-out78.7%
associate-/l*78.6%
neg-mul-178.6%
*-commutative78.6%
associate-/l*78.7%
metadata-eval78.7%
metadata-eval78.7%
Simplified78.7%
metadata-eval78.7%
div-inv78.6%
unpow278.6%
associate-*r*78.6%
div-inv77.3%
metadata-eval77.3%
associate-*r*77.2%
*-commutative77.2%
div-inv78.5%
metadata-eval78.5%
associate-*r*78.8%
*-commutative78.8%
Applied egg-rr78.8%
Taylor expanded in a around 0 40.0%
unpow240.0%
associate-*r*40.1%
*-commutative40.1%
associate-*r*40.0%
unpow240.0%
swap-sqr50.0%
unpow250.0%
Simplified50.0%
if 0.00125000000000000003 < a Initial program 89.2%
associate-*r/89.1%
metadata-eval89.1%
metadata-eval89.1%
distribute-neg-frac289.1%
distribute-frac-neg89.1%
distribute-rgt-neg-out89.1%
associate-/l*89.2%
neg-mul-189.2%
*-commutative89.2%
associate-/l*89.0%
metadata-eval89.0%
metadata-eval89.0%
Simplified89.0%
Taylor expanded in a around inf 85.6%
Final simplification58.0%
(FPCore (a b angle) :precision binary64 (+ (pow (* b (sin (* PI (* 0.005555555555555556 angle)))) 2.0) (pow a 2.0)))
double code(double a, double b, double angle) {
return pow((b * sin((((double) M_PI) * (0.005555555555555556 * angle)))), 2.0) + pow(a, 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((b * Math.sin((Math.PI * (0.005555555555555556 * angle)))), 2.0) + Math.pow(a, 2.0);
}
def code(a, b, angle): return math.pow((b * math.sin((math.pi * (0.005555555555555556 * angle)))), 2.0) + math.pow(a, 2.0)
function code(a, b, angle) return Float64((Float64(b * sin(Float64(pi * Float64(0.005555555555555556 * angle)))) ^ 2.0) + (a ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((b * sin((pi * (0.005555555555555556 * angle)))) ^ 2.0) + (a ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(b * N[Sin[N[(Pi * N[(0.005555555555555556 * angle), $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(0.005555555555555556 \cdot angle\right)\right)\right)}^{2} + {a}^{2}
\end{array}
Initial program 81.0%
associate-*r/81.0%
metadata-eval81.0%
metadata-eval81.0%
distribute-neg-frac281.0%
distribute-frac-neg81.0%
distribute-rgt-neg-out81.0%
associate-/l*81.0%
neg-mul-181.0%
*-commutative81.0%
associate-/l*81.0%
metadata-eval81.0%
metadata-eval81.0%
Simplified81.0%
Taylor expanded in angle around 0 80.8%
Final simplification80.8%
(FPCore (a b angle) :precision binary64 (if (<= a 0.00048) (pow (* b (sin (* angle (* 0.005555555555555556 PI)))) 2.0) (pow (* a (cos (* 0.005555555555555556 (* PI angle)))) 2.0)))
double code(double a, double b, double angle) {
double tmp;
if (a <= 0.00048) {
tmp = pow((b * sin((angle * (0.005555555555555556 * ((double) M_PI))))), 2.0);
} else {
tmp = pow((a * cos((0.005555555555555556 * (((double) M_PI) * angle)))), 2.0);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (a <= 0.00048) {
tmp = Math.pow((b * Math.sin((angle * (0.005555555555555556 * Math.PI)))), 2.0);
} else {
tmp = Math.pow((a * Math.cos((0.005555555555555556 * (Math.PI * angle)))), 2.0);
}
return tmp;
}
def code(a, b, angle): tmp = 0 if a <= 0.00048: tmp = math.pow((b * math.sin((angle * (0.005555555555555556 * math.pi)))), 2.0) else: tmp = math.pow((a * math.cos((0.005555555555555556 * (math.pi * angle)))), 2.0) return tmp
function code(a, b, angle) tmp = 0.0 if (a <= 0.00048) tmp = Float64(b * sin(Float64(angle * Float64(0.005555555555555556 * pi)))) ^ 2.0; else tmp = Float64(a * cos(Float64(0.005555555555555556 * Float64(pi * angle)))) ^ 2.0; end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (a <= 0.00048) tmp = (b * sin((angle * (0.005555555555555556 * pi)))) ^ 2.0; else tmp = (a * cos((0.005555555555555556 * (pi * angle)))) ^ 2.0; end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[a, 0.00048], N[Power[N[(b * N[Sin[N[(angle * N[(0.005555555555555556 * Pi), $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]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 0.00048:\\
\;\;\;\;{\left(b \cdot \sin \left(angle \cdot \left(0.005555555555555556 \cdot \pi\right)\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;{\left(a \cdot \cos \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)\right)}^{2}\\
\end{array}
\end{array}
if a < 4.80000000000000012e-4Initial program 78.6%
associate-*r/78.7%
metadata-eval78.7%
metadata-eval78.7%
distribute-neg-frac278.7%
distribute-frac-neg78.7%
distribute-rgt-neg-out78.7%
associate-/l*78.6%
neg-mul-178.6%
*-commutative78.6%
associate-/l*78.7%
metadata-eval78.7%
metadata-eval78.7%
Simplified78.7%
metadata-eval78.7%
div-inv78.6%
unpow278.6%
associate-*r*78.6%
div-inv77.3%
metadata-eval77.3%
associate-*r*77.2%
*-commutative77.2%
div-inv78.5%
metadata-eval78.5%
associate-*r*78.8%
*-commutative78.8%
Applied egg-rr78.8%
Taylor expanded in a around 0 40.0%
unpow240.0%
associate-*r*40.1%
*-commutative40.1%
associate-*r*40.0%
unpow240.0%
swap-sqr50.0%
unpow250.0%
Simplified50.0%
if 4.80000000000000012e-4 < a Initial program 89.2%
associate-*r/89.1%
metadata-eval89.1%
metadata-eval89.1%
distribute-neg-frac289.1%
distribute-frac-neg89.1%
distribute-rgt-neg-out89.1%
associate-/l*89.2%
neg-mul-189.2%
*-commutative89.2%
associate-/l*89.0%
metadata-eval89.0%
metadata-eval89.0%
Simplified89.0%
Taylor expanded in a around inf 85.6%
unpow285.6%
*-commutative85.6%
unpow285.6%
swap-sqr85.6%
unpow285.6%
*-commutative85.6%
Simplified85.6%
Final simplification58.0%
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* 0.005555555555555556 (* PI angle)))) (if (<= a 0.00044) (pow (* b (sin t_0)) 2.0) (pow (* a (cos t_0)) 2.0))))
double code(double a, double b, double angle) {
double t_0 = 0.005555555555555556 * (((double) M_PI) * angle);
double tmp;
if (a <= 0.00044) {
tmp = pow((b * sin(t_0)), 2.0);
} else {
tmp = pow((a * cos(t_0)), 2.0);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double t_0 = 0.005555555555555556 * (Math.PI * angle);
double tmp;
if (a <= 0.00044) {
tmp = Math.pow((b * Math.sin(t_0)), 2.0);
} else {
tmp = Math.pow((a * Math.cos(t_0)), 2.0);
}
return tmp;
}
def code(a, b, angle): t_0 = 0.005555555555555556 * (math.pi * angle) tmp = 0 if a <= 0.00044: tmp = math.pow((b * math.sin(t_0)), 2.0) else: tmp = math.pow((a * math.cos(t_0)), 2.0) return tmp
function code(a, b, angle) t_0 = Float64(0.005555555555555556 * Float64(pi * angle)) tmp = 0.0 if (a <= 0.00044) tmp = Float64(b * sin(t_0)) ^ 2.0; else tmp = Float64(a * cos(t_0)) ^ 2.0; end return tmp end
function tmp_2 = code(a, b, angle) t_0 = 0.005555555555555556 * (pi * angle); tmp = 0.0; if (a <= 0.00044) tmp = (b * sin(t_0)) ^ 2.0; else tmp = (a * cos(t_0)) ^ 2.0; end tmp_2 = tmp; end
code[a_, b_, angle_] := Block[{t$95$0 = N[(0.005555555555555556 * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, 0.00044], N[Power[N[(b * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[Power[N[(a * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.005555555555555556 \cdot \left(\pi \cdot angle\right)\\
\mathbf{if}\;a \leq 0.00044:\\
\;\;\;\;{\left(b \cdot \sin t\_0\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;{\left(a \cdot \cos t\_0\right)}^{2}\\
\end{array}
\end{array}
if a < 4.40000000000000016e-4Initial program 78.6%
associate-*r/78.7%
metadata-eval78.7%
metadata-eval78.7%
distribute-neg-frac278.7%
distribute-frac-neg78.7%
distribute-rgt-neg-out78.7%
associate-/l*78.6%
neg-mul-178.6%
*-commutative78.6%
associate-/l*78.7%
metadata-eval78.7%
metadata-eval78.7%
Simplified78.7%
Taylor expanded in a around 0 40.0%
*-commutative40.0%
unpow240.0%
unpow240.0%
swap-sqr49.9%
unpow249.9%
*-commutative49.9%
Simplified49.9%
if 4.40000000000000016e-4 < a Initial program 89.2%
associate-*r/89.1%
metadata-eval89.1%
metadata-eval89.1%
distribute-neg-frac289.1%
distribute-frac-neg89.1%
distribute-rgt-neg-out89.1%
associate-/l*89.2%
neg-mul-189.2%
*-commutative89.2%
associate-/l*89.0%
metadata-eval89.0%
metadata-eval89.0%
Simplified89.0%
Taylor expanded in a around inf 85.6%
unpow285.6%
*-commutative85.6%
unpow285.6%
swap-sqr85.6%
unpow285.6%
*-commutative85.6%
Simplified85.6%
Final simplification58.0%
(FPCore (a b angle) :precision binary64 (pow (* a (cos (* 0.005555555555555556 (* PI angle)))) 2.0))
double code(double a, double b, double angle) {
return pow((a * cos((0.005555555555555556 * (((double) M_PI) * angle)))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.cos((0.005555555555555556 * (Math.PI * angle)))), 2.0);
}
def code(a, b, angle): return math.pow((a * math.cos((0.005555555555555556 * (math.pi * angle)))), 2.0)
function code(a, b, angle) return Float64(a * cos(Float64(0.005555555555555556 * Float64(pi * angle)))) ^ 2.0 end
function tmp = code(a, b, angle) tmp = (a * cos((0.005555555555555556 * (pi * angle)))) ^ 2.0; end
code[a_, b_, angle_] := N[Power[N[(a * N[Cos[N[(0.005555555555555556 * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \cos \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)\right)}^{2}
\end{array}
Initial program 81.0%
associate-*r/81.0%
metadata-eval81.0%
metadata-eval81.0%
distribute-neg-frac281.0%
distribute-frac-neg81.0%
distribute-rgt-neg-out81.0%
associate-/l*81.0%
neg-mul-181.0%
*-commutative81.0%
associate-/l*81.0%
metadata-eval81.0%
metadata-eval81.0%
Simplified81.0%
Taylor expanded in a around inf 56.6%
unpow256.6%
*-commutative56.6%
unpow256.6%
swap-sqr56.6%
unpow256.6%
*-commutative56.6%
Simplified56.6%
Final simplification56.6%
(FPCore (a b angle) :precision binary64 (* a a))
double code(double a, double b, double angle) {
return a * a;
}
real(8) function code(a, b, angle)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle
code = a * a
end function
public static double code(double a, double b, double angle) {
return a * a;
}
def code(a, b, angle): return a * a
function code(a, b, angle) return Float64(a * a) end
function tmp = code(a, b, angle) tmp = a * a; end
code[a_, b_, angle_] := N[(a * a), $MachinePrecision]
\begin{array}{l}
\\
a \cdot a
\end{array}
Initial program 81.0%
associate-*r/81.0%
metadata-eval81.0%
metadata-eval81.0%
distribute-neg-frac281.0%
distribute-frac-neg81.0%
distribute-rgt-neg-out81.0%
associate-/l*81.0%
neg-mul-181.0%
*-commutative81.0%
associate-/l*81.0%
metadata-eval81.0%
metadata-eval81.0%
Simplified81.0%
Taylor expanded in angle around 0 56.6%
unpow256.6%
Applied egg-rr56.6%
herbie shell --seed 2024152
(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)))