
(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 12 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 (+ (pow (* a (cos (* PI (* angle 0.005555555555555556)))) 2.0) (pow (* b (sin (* 0.005555555555555556 (/ PI (/ 1.0 angle))))) 2.0)))
double code(double a, double b, double angle) {
return pow((a * cos((((double) M_PI) * (angle * 0.005555555555555556)))), 2.0) + pow((b * sin((0.005555555555555556 * (((double) M_PI) / (1.0 / angle))))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.cos((Math.PI * (angle * 0.005555555555555556)))), 2.0) + Math.pow((b * Math.sin((0.005555555555555556 * (Math.PI / (1.0 / angle))))), 2.0);
}
def code(a, b, angle): return math.pow((a * math.cos((math.pi * (angle * 0.005555555555555556)))), 2.0) + math.pow((b * math.sin((0.005555555555555556 * (math.pi / (1.0 / angle))))), 2.0)
function code(a, b, angle) return Float64((Float64(a * cos(Float64(pi * Float64(angle * 0.005555555555555556)))) ^ 2.0) + (Float64(b * sin(Float64(0.005555555555555556 * Float64(pi / Float64(1.0 / angle))))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((a * cos((pi * (angle * 0.005555555555555556)))) ^ 2.0) + ((b * sin((0.005555555555555556 * (pi / (1.0 / angle))))) ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Cos[N[(Pi * N[(angle * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[N[(0.005555555555555556 * N[(Pi / N[(1.0 / angle), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \cos \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(0.005555555555555556 \cdot \frac{\pi}{\frac{1}{angle}}\right)\right)}^{2}
\end{array}
Initial program 80.3%
associate-*r/80.3%
metadata-eval80.3%
metadata-eval80.3%
distribute-neg-frac280.3%
distribute-frac-neg80.3%
distribute-rgt-neg-out80.3%
associate-/l*80.3%
neg-mul-180.3%
*-commutative80.3%
associate-/l*80.3%
metadata-eval80.3%
metadata-eval80.3%
Simplified80.3%
metadata-eval80.3%
div-inv80.3%
clear-num80.3%
un-div-inv80.4%
Applied egg-rr80.4%
*-un-lft-identity80.4%
div-inv80.3%
times-frac80.4%
metadata-eval80.4%
Applied egg-rr80.4%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (cos (* PI (* angle 0.005555555555555556)))) 2.0) (pow (* b (sin (/ PI (/ 180.0 angle)))) 2.0)))
double code(double a, double b, double angle) {
return pow((a * cos((((double) M_PI) * (angle * 0.005555555555555556)))), 2.0) + pow((b * sin((((double) M_PI) / (180.0 / angle)))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.cos((Math.PI * (angle * 0.005555555555555556)))), 2.0) + Math.pow((b * Math.sin((Math.PI / (180.0 / angle)))), 2.0);
}
def code(a, b, angle): return math.pow((a * math.cos((math.pi * (angle * 0.005555555555555556)))), 2.0) + math.pow((b * math.sin((math.pi / (180.0 / angle)))), 2.0)
function code(a, b, angle) return Float64((Float64(a * cos(Float64(pi * Float64(angle * 0.005555555555555556)))) ^ 2.0) + (Float64(b * sin(Float64(pi / Float64(180.0 / angle)))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((a * cos((pi * (angle * 0.005555555555555556)))) ^ 2.0) + ((b * sin((pi / (180.0 / angle)))) ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Cos[N[(Pi * N[(angle * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[N[(Pi / N[(180.0 / angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \cos \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2}
\end{array}
Initial program 80.3%
associate-*r/80.3%
metadata-eval80.3%
metadata-eval80.3%
distribute-neg-frac280.3%
distribute-frac-neg80.3%
distribute-rgt-neg-out80.3%
associate-/l*80.3%
neg-mul-180.3%
*-commutative80.3%
associate-/l*80.3%
metadata-eval80.3%
metadata-eval80.3%
Simplified80.3%
metadata-eval80.3%
div-inv80.3%
clear-num80.3%
un-div-inv80.4%
Applied egg-rr80.4%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (cos (* PI (* angle 0.005555555555555556)))) 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) * (angle * 0.005555555555555556)))), 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 * (angle * 0.005555555555555556)))), 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 * (angle * 0.005555555555555556)))), 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(angle * 0.005555555555555556)))) ^ 2.0) + (Float64(b * sin(Float64(angle * Float64(pi / 180.0)))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((a * cos((pi * (angle * 0.005555555555555556)))) ^ 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[(angle * 0.005555555555555556), $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(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2}
\end{array}
Initial program 80.3%
associate-*r/80.3%
metadata-eval80.3%
metadata-eval80.3%
distribute-neg-frac280.3%
distribute-frac-neg80.3%
distribute-rgt-neg-out80.3%
associate-/l*80.3%
neg-mul-180.3%
*-commutative80.3%
associate-/l*80.3%
metadata-eval80.3%
metadata-eval80.3%
Simplified80.3%
metadata-eval80.3%
div-inv80.3%
clear-num80.3%
un-div-inv80.4%
Applied egg-rr80.4%
associate-/r/80.3%
Simplified80.3%
Final simplification80.3%
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* PI (* angle 0.005555555555555556)))) (pow (hypot (* b (sin t_0)) (* a (cos t_0))) 2.0)))
double code(double a, double b, double angle) {
double t_0 = ((double) M_PI) * (angle * 0.005555555555555556);
return pow(hypot((b * sin(t_0)), (a * cos(t_0))), 2.0);
}
public static double code(double a, double b, double angle) {
double t_0 = Math.PI * (angle * 0.005555555555555556);
return Math.pow(Math.hypot((b * Math.sin(t_0)), (a * Math.cos(t_0))), 2.0);
}
def code(a, b, angle): t_0 = math.pi * (angle * 0.005555555555555556) return math.pow(math.hypot((b * math.sin(t_0)), (a * math.cos(t_0))), 2.0)
function code(a, b, angle) t_0 = Float64(pi * Float64(angle * 0.005555555555555556)) return hypot(Float64(b * sin(t_0)), Float64(a * cos(t_0))) ^ 2.0 end
function tmp = code(a, b, angle) t_0 = pi * (angle * 0.005555555555555556); tmp = hypot((b * sin(t_0)), (a * cos(t_0))) ^ 2.0; end
code[a_, b_, angle_] := Block[{t$95$0 = N[(Pi * N[(angle * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]}, N[Power[N[Sqrt[N[(b * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision] ^ 2 + N[(a * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision], 2.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \pi \cdot \left(angle \cdot 0.005555555555555556\right)\\
{\left(\mathsf{hypot}\left(b \cdot \sin t\_0, a \cdot \cos t\_0\right)\right)}^{2}
\end{array}
\end{array}
Initial program 80.3%
associate-*r/80.3%
metadata-eval80.3%
metadata-eval80.3%
distribute-neg-frac280.3%
distribute-frac-neg80.3%
distribute-rgt-neg-out80.3%
associate-/l*80.3%
neg-mul-180.3%
*-commutative80.3%
associate-/l*80.3%
metadata-eval80.3%
metadata-eval80.3%
Simplified80.3%
metadata-eval80.3%
div-inv80.3%
clear-num80.3%
un-div-inv80.4%
Applied egg-rr80.4%
*-un-lft-identity80.4%
div-inv80.3%
times-frac80.4%
metadata-eval80.4%
Applied egg-rr80.4%
Applied egg-rr80.3%
(FPCore (a b angle) :precision binary64 (if (<= b 8e+87) (* (pow a 2.0) (pow (cos (* 0.005555555555555556 (* PI angle))) 2.0)) (pow (* b (sin (* angle (* PI 0.005555555555555556)))) 2.0)))
double code(double a, double b, double angle) {
double tmp;
if (b <= 8e+87) {
tmp = pow(a, 2.0) * pow(cos((0.005555555555555556 * (((double) M_PI) * angle))), 2.0);
} else {
tmp = pow((b * sin((angle * (((double) M_PI) * 0.005555555555555556)))), 2.0);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (b <= 8e+87) {
tmp = Math.pow(a, 2.0) * Math.pow(Math.cos((0.005555555555555556 * (Math.PI * angle))), 2.0);
} else {
tmp = Math.pow((b * Math.sin((angle * (Math.PI * 0.005555555555555556)))), 2.0);
}
return tmp;
}
def code(a, b, angle): tmp = 0 if b <= 8e+87: tmp = math.pow(a, 2.0) * math.pow(math.cos((0.005555555555555556 * (math.pi * angle))), 2.0) else: tmp = math.pow((b * math.sin((angle * (math.pi * 0.005555555555555556)))), 2.0) return tmp
function code(a, b, angle) tmp = 0.0 if (b <= 8e+87) tmp = Float64((a ^ 2.0) * (cos(Float64(0.005555555555555556 * Float64(pi * angle))) ^ 2.0)); else tmp = Float64(b * sin(Float64(angle * Float64(pi * 0.005555555555555556)))) ^ 2.0; end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (b <= 8e+87) tmp = (a ^ 2.0) * (cos((0.005555555555555556 * (pi * angle))) ^ 2.0); else tmp = (b * sin((angle * (pi * 0.005555555555555556)))) ^ 2.0; end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[b, 8e+87], N[(N[Power[a, 2.0], $MachinePrecision] * N[Power[N[Cos[N[(0.005555555555555556 * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], N[Power[N[(b * N[Sin[N[(angle * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 8 \cdot 10^{+87}:\\
\;\;\;\;{a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;{\left(b \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)}^{2}\\
\end{array}
\end{array}
if b < 7.9999999999999997e87Initial program 78.3%
associate-*r/78.3%
metadata-eval78.3%
metadata-eval78.3%
distribute-neg-frac278.3%
distribute-frac-neg78.3%
distribute-rgt-neg-out78.3%
associate-/l*78.3%
neg-mul-178.3%
*-commutative78.3%
associate-/l*78.3%
metadata-eval78.3%
metadata-eval78.3%
Simplified78.3%
Taylor expanded in a around inf 61.4%
if 7.9999999999999997e87 < b Initial program 91.5%
associate-*r/91.5%
metadata-eval91.5%
metadata-eval91.5%
distribute-neg-frac291.5%
distribute-frac-neg91.5%
distribute-rgt-neg-out91.5%
associate-/l*91.5%
neg-mul-191.5%
*-commutative91.5%
associate-/l*91.5%
metadata-eval91.5%
metadata-eval91.5%
Simplified91.4%
metadata-eval91.4%
div-inv91.5%
clear-num91.6%
un-div-inv91.6%
Applied egg-rr91.6%
Taylor expanded in a around 0 52.0%
unpow252.0%
associate-*r*52.1%
*-commutative52.1%
associate-*l*52.0%
*-commutative52.0%
unpow252.0%
swap-sqr67.2%
unpow267.2%
*-commutative67.2%
Simplified67.2%
Final simplification62.3%
(FPCore (a b angle) :precision binary64 (+ (pow (* b (sin (* 0.005555555555555556 (/ PI (/ 1.0 angle))))) 2.0) (pow a 2.0)))
double code(double a, double b, double angle) {
return pow((b * sin((0.005555555555555556 * (((double) M_PI) / (1.0 / angle))))), 2.0) + pow(a, 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((b * Math.sin((0.005555555555555556 * (Math.PI / (1.0 / angle))))), 2.0) + Math.pow(a, 2.0);
}
def code(a, b, angle): return math.pow((b * math.sin((0.005555555555555556 * (math.pi / (1.0 / angle))))), 2.0) + math.pow(a, 2.0)
function code(a, b, angle) return Float64((Float64(b * sin(Float64(0.005555555555555556 * Float64(pi / Float64(1.0 / angle))))) ^ 2.0) + (a ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((b * sin((0.005555555555555556 * (pi / (1.0 / angle))))) ^ 2.0) + (a ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(b * N[Sin[N[(0.005555555555555556 * N[(Pi / N[(1.0 / angle), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(b \cdot \sin \left(0.005555555555555556 \cdot \frac{\pi}{\frac{1}{angle}}\right)\right)}^{2} + {a}^{2}
\end{array}
Initial program 80.3%
associate-*r/80.3%
metadata-eval80.3%
metadata-eval80.3%
distribute-neg-frac280.3%
distribute-frac-neg80.3%
distribute-rgt-neg-out80.3%
associate-/l*80.3%
neg-mul-180.3%
*-commutative80.3%
associate-/l*80.3%
metadata-eval80.3%
metadata-eval80.3%
Simplified80.3%
metadata-eval80.3%
div-inv80.3%
clear-num80.3%
un-div-inv80.4%
Applied egg-rr80.4%
*-un-lft-identity80.4%
div-inv80.3%
times-frac80.4%
metadata-eval80.4%
Applied egg-rr80.4%
Taylor expanded in angle around 0 80.2%
Final simplification80.2%
(FPCore (a b angle) :precision binary64 (+ (pow (* b (sin (/ PI (/ 180.0 angle)))) 2.0) (pow a 2.0)))
double code(double a, double b, double angle) {
return pow((b * sin((((double) M_PI) / (180.0 / 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 / (180.0 / angle)))), 2.0) + Math.pow(a, 2.0);
}
def code(a, b, angle): return math.pow((b * math.sin((math.pi / (180.0 / angle)))), 2.0) + math.pow(a, 2.0)
function code(a, b, angle) return Float64((Float64(b * sin(Float64(pi / Float64(180.0 / angle)))) ^ 2.0) + (a ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((b * sin((pi / (180.0 / angle)))) ^ 2.0) + (a ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(b * N[Sin[N[(Pi / N[(180.0 / angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(b \cdot \sin \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2} + {a}^{2}
\end{array}
Initial program 80.3%
associate-*r/80.3%
metadata-eval80.3%
metadata-eval80.3%
distribute-neg-frac280.3%
distribute-frac-neg80.3%
distribute-rgt-neg-out80.3%
associate-/l*80.3%
neg-mul-180.3%
*-commutative80.3%
associate-/l*80.3%
metadata-eval80.3%
metadata-eval80.3%
Simplified80.3%
metadata-eval80.3%
div-inv80.3%
clear-num80.3%
un-div-inv80.4%
Applied egg-rr80.4%
Taylor expanded in angle around 0 80.2%
Final simplification80.2%
(FPCore (a b angle) :precision binary64 (+ (pow a 2.0) (pow (* b (sin (* PI (* angle 0.005555555555555556)))) 2.0)))
double code(double a, double b, double angle) {
return pow(a, 2.0) + pow((b * sin((((double) M_PI) * (angle * 0.005555555555555556)))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow(a, 2.0) + Math.pow((b * Math.sin((Math.PI * (angle * 0.005555555555555556)))), 2.0);
}
def code(a, b, angle): return math.pow(a, 2.0) + math.pow((b * math.sin((math.pi * (angle * 0.005555555555555556)))), 2.0)
function code(a, b, angle) return Float64((a ^ 2.0) + (Float64(b * sin(Float64(pi * Float64(angle * 0.005555555555555556)))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = (a ^ 2.0) + ((b * sin((pi * (angle * 0.005555555555555556)))) ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[a, 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[N[(Pi * N[(angle * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{a}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2}
\end{array}
Initial program 80.3%
associate-*r/80.3%
metadata-eval80.3%
metadata-eval80.3%
distribute-neg-frac280.3%
distribute-frac-neg80.3%
distribute-rgt-neg-out80.3%
associate-/l*80.3%
neg-mul-180.3%
*-commutative80.3%
associate-/l*80.3%
metadata-eval80.3%
metadata-eval80.3%
Simplified80.3%
Taylor expanded in angle around 0 80.1%
(FPCore (a b angle) :precision binary64 (if (<= b 6.8e+87) (pow (* a (cos (* 0.005555555555555556 (* PI angle)))) 2.0) (pow (* b (sin (* angle (* PI 0.005555555555555556)))) 2.0)))
double code(double a, double b, double angle) {
double tmp;
if (b <= 6.8e+87) {
tmp = pow((a * cos((0.005555555555555556 * (((double) M_PI) * angle)))), 2.0);
} else {
tmp = pow((b * sin((angle * (((double) M_PI) * 0.005555555555555556)))), 2.0);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (b <= 6.8e+87) {
tmp = Math.pow((a * Math.cos((0.005555555555555556 * (Math.PI * angle)))), 2.0);
} else {
tmp = Math.pow((b * Math.sin((angle * (Math.PI * 0.005555555555555556)))), 2.0);
}
return tmp;
}
def code(a, b, angle): tmp = 0 if b <= 6.8e+87: tmp = math.pow((a * math.cos((0.005555555555555556 * (math.pi * angle)))), 2.0) else: tmp = math.pow((b * math.sin((angle * (math.pi * 0.005555555555555556)))), 2.0) return tmp
function code(a, b, angle) tmp = 0.0 if (b <= 6.8e+87) tmp = Float64(a * cos(Float64(0.005555555555555556 * Float64(pi * angle)))) ^ 2.0; else tmp = Float64(b * sin(Float64(angle * Float64(pi * 0.005555555555555556)))) ^ 2.0; end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (b <= 6.8e+87) tmp = (a * cos((0.005555555555555556 * (pi * angle)))) ^ 2.0; else tmp = (b * sin((angle * (pi * 0.005555555555555556)))) ^ 2.0; end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[b, 6.8e+87], N[Power[N[(a * N[Cos[N[(0.005555555555555556 * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[Power[N[(b * N[Sin[N[(angle * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 6.8 \cdot 10^{+87}:\\
\;\;\;\;{\left(a \cdot \cos \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;{\left(b \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)}^{2}\\
\end{array}
\end{array}
if b < 6.8000000000000004e87Initial program 78.3%
associate-*r/78.3%
metadata-eval78.3%
metadata-eval78.3%
distribute-neg-frac278.3%
distribute-frac-neg78.3%
distribute-rgt-neg-out78.3%
associate-/l*78.3%
neg-mul-178.3%
*-commutative78.3%
associate-/l*78.3%
metadata-eval78.3%
metadata-eval78.3%
Simplified78.3%
Taylor expanded in a around inf 61.4%
unpow261.4%
*-commutative61.4%
unpow261.4%
swap-sqr61.4%
unpow261.4%
*-commutative61.4%
Simplified61.4%
if 6.8000000000000004e87 < b Initial program 91.5%
associate-*r/91.5%
metadata-eval91.5%
metadata-eval91.5%
distribute-neg-frac291.5%
distribute-frac-neg91.5%
distribute-rgt-neg-out91.5%
associate-/l*91.5%
neg-mul-191.5%
*-commutative91.5%
associate-/l*91.5%
metadata-eval91.5%
metadata-eval91.5%
Simplified91.4%
metadata-eval91.4%
div-inv91.5%
clear-num91.6%
un-div-inv91.6%
Applied egg-rr91.6%
Taylor expanded in a around 0 52.0%
unpow252.0%
associate-*r*52.1%
*-commutative52.1%
associate-*l*52.0%
*-commutative52.0%
unpow252.0%
swap-sqr67.2%
unpow267.2%
*-commutative67.2%
Simplified67.2%
Final simplification62.3%
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* 0.005555555555555556 (* PI angle)))) (if (<= b 2.4e+87) (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 = 0.005555555555555556 * (((double) M_PI) * angle);
double tmp;
if (b <= 2.4e+87) {
tmp = pow((a * cos(t_0)), 2.0);
} else {
tmp = pow((b * sin(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 (b <= 2.4e+87) {
tmp = Math.pow((a * Math.cos(t_0)), 2.0);
} else {
tmp = Math.pow((b * Math.sin(t_0)), 2.0);
}
return tmp;
}
def code(a, b, angle): t_0 = 0.005555555555555556 * (math.pi * angle) tmp = 0 if b <= 2.4e+87: tmp = math.pow((a * math.cos(t_0)), 2.0) else: tmp = math.pow((b * math.sin(t_0)), 2.0) return tmp
function code(a, b, angle) t_0 = Float64(0.005555555555555556 * Float64(pi * angle)) tmp = 0.0 if (b <= 2.4e+87) tmp = Float64(a * cos(t_0)) ^ 2.0; else tmp = Float64(b * sin(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 (b <= 2.4e+87) tmp = (a * cos(t_0)) ^ 2.0; else tmp = (b * sin(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[b, 2.4e+87], 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]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.005555555555555556 \cdot \left(\pi \cdot angle\right)\\
\mathbf{if}\;b \leq 2.4 \cdot 10^{+87}:\\
\;\;\;\;{\left(a \cdot \cos t\_0\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;{\left(b \cdot \sin t\_0\right)}^{2}\\
\end{array}
\end{array}
if b < 2.39999999999999981e87Initial program 78.3%
associate-*r/78.3%
metadata-eval78.3%
metadata-eval78.3%
distribute-neg-frac278.3%
distribute-frac-neg78.3%
distribute-rgt-neg-out78.3%
associate-/l*78.3%
neg-mul-178.3%
*-commutative78.3%
associate-/l*78.3%
metadata-eval78.3%
metadata-eval78.3%
Simplified78.3%
Taylor expanded in a around inf 61.4%
unpow261.4%
*-commutative61.4%
unpow261.4%
swap-sqr61.4%
unpow261.4%
*-commutative61.4%
Simplified61.4%
if 2.39999999999999981e87 < b Initial program 91.5%
associate-*r/91.5%
metadata-eval91.5%
metadata-eval91.5%
distribute-neg-frac291.5%
distribute-frac-neg91.5%
distribute-rgt-neg-out91.5%
associate-/l*91.5%
neg-mul-191.5%
*-commutative91.5%
associate-/l*91.5%
metadata-eval91.5%
metadata-eval91.5%
Simplified91.4%
Taylor expanded in a around 0 52.0%
*-commutative52.0%
unpow252.0%
unpow252.0%
swap-sqr67.2%
unpow267.2%
*-commutative67.2%
Simplified67.2%
Final simplification62.3%
(FPCore (a b angle) :precision binary64 (if (<= b 2.7e+206) (pow (* a (cos (* 0.005555555555555556 (* PI angle)))) 2.0) (cbrt (pow a 6.0))))
double code(double a, double b, double angle) {
double tmp;
if (b <= 2.7e+206) {
tmp = pow((a * cos((0.005555555555555556 * (((double) M_PI) * angle)))), 2.0);
} else {
tmp = cbrt(pow(a, 6.0));
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (b <= 2.7e+206) {
tmp = Math.pow((a * Math.cos((0.005555555555555556 * (Math.PI * angle)))), 2.0);
} else {
tmp = Math.cbrt(Math.pow(a, 6.0));
}
return tmp;
}
function code(a, b, angle) tmp = 0.0 if (b <= 2.7e+206) tmp = Float64(a * cos(Float64(0.005555555555555556 * Float64(pi * angle)))) ^ 2.0; else tmp = cbrt((a ^ 6.0)); end return tmp end
code[a_, b_, angle_] := If[LessEqual[b, 2.7e+206], N[Power[N[(a * N[Cos[N[(0.005555555555555556 * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[Power[N[Power[a, 6.0], $MachinePrecision], 1/3], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 2.7 \cdot 10^{+206}:\\
\;\;\;\;{\left(a \cdot \cos \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{{a}^{6}}\\
\end{array}
\end{array}
if b < 2.70000000000000003e206Initial program 79.0%
associate-*r/79.0%
metadata-eval79.0%
metadata-eval79.0%
distribute-neg-frac279.0%
distribute-frac-neg79.0%
distribute-rgt-neg-out79.0%
associate-/l*79.0%
neg-mul-179.0%
*-commutative79.0%
associate-/l*79.0%
metadata-eval79.0%
metadata-eval79.0%
Simplified79.0%
Taylor expanded in a around inf 60.0%
unpow260.0%
*-commutative60.0%
unpow260.0%
swap-sqr60.0%
unpow260.0%
*-commutative60.0%
Simplified60.0%
if 2.70000000000000003e206 < b Initial program 95.4%
associate-*r/95.4%
metadata-eval95.4%
metadata-eval95.4%
distribute-neg-frac295.4%
distribute-frac-neg95.4%
distribute-rgt-neg-out95.4%
associate-/l*95.4%
neg-mul-195.4%
*-commutative95.4%
associate-/l*95.4%
metadata-eval95.4%
metadata-eval95.4%
Simplified95.3%
Taylor expanded in angle around 0 42.2%
add-sqr-sqrt42.2%
sqrt-unprod47.4%
pow-prod-up47.4%
metadata-eval47.4%
Applied egg-rr47.4%
Applied egg-rr46.8%
unpow1/347.2%
Simplified47.2%
Final simplification59.0%
(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 80.3%
associate-*r/80.3%
metadata-eval80.3%
metadata-eval80.3%
distribute-neg-frac280.3%
distribute-frac-neg80.3%
distribute-rgt-neg-out80.3%
associate-/l*80.3%
neg-mul-180.3%
*-commutative80.3%
associate-/l*80.3%
metadata-eval80.3%
metadata-eval80.3%
Simplified80.3%
Taylor expanded in angle around 0 58.4%
unpow258.4%
Applied egg-rr58.4%
herbie shell --seed 2024169
(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)))