
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* PI (/ angle 180.0)))) (+ (pow (* a (cos t_0)) 2.0) (pow (* b (sin t_0)) 2.0))))
double code(double a, double b, double angle) {
double t_0 = ((double) M_PI) * (angle / 180.0);
return pow((a * cos(t_0)), 2.0) + pow((b * sin(t_0)), 2.0);
}
public static double code(double a, double b, double angle) {
double t_0 = Math.PI * (angle / 180.0);
return Math.pow((a * Math.cos(t_0)), 2.0) + Math.pow((b * Math.sin(t_0)), 2.0);
}
def code(a, b, angle): t_0 = math.pi * (angle / 180.0) return math.pow((a * math.cos(t_0)), 2.0) + math.pow((b * math.sin(t_0)), 2.0)
function code(a, b, angle) t_0 = Float64(pi * Float64(angle / 180.0)) return Float64((Float64(a * cos(t_0)) ^ 2.0) + (Float64(b * sin(t_0)) ^ 2.0)) end
function tmp = code(a, b, angle) t_0 = pi * (angle / 180.0); tmp = ((a * cos(t_0)) ^ 2.0) + ((b * sin(t_0)) ^ 2.0); end
code[a_, b_, angle_] := Block[{t$95$0 = N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]}, N[(N[Power[N[(a * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \pi \cdot \frac{angle}{180}\\
{\left(a \cdot \cos t\_0\right)}^{2} + {\left(b \cdot \sin t\_0\right)}^{2}
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* PI (/ angle 180.0)))) (+ (pow (* a (cos t_0)) 2.0) (pow (* b (sin t_0)) 2.0))))
double code(double a, double b, double angle) {
double t_0 = ((double) M_PI) * (angle / 180.0);
return pow((a * cos(t_0)), 2.0) + pow((b * sin(t_0)), 2.0);
}
public static double code(double a, double b, double angle) {
double t_0 = Math.PI * (angle / 180.0);
return Math.pow((a * Math.cos(t_0)), 2.0) + Math.pow((b * Math.sin(t_0)), 2.0);
}
def code(a, b, angle): t_0 = math.pi * (angle / 180.0) return math.pow((a * math.cos(t_0)), 2.0) + math.pow((b * math.sin(t_0)), 2.0)
function code(a, b, angle) t_0 = Float64(pi * Float64(angle / 180.0)) return Float64((Float64(a * cos(t_0)) ^ 2.0) + (Float64(b * sin(t_0)) ^ 2.0)) end
function tmp = code(a, b, angle) t_0 = pi * (angle / 180.0); tmp = ((a * cos(t_0)) ^ 2.0) + ((b * sin(t_0)) ^ 2.0); end
code[a_, b_, angle_] := Block[{t$95$0 = N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]}, N[(N[Power[N[(a * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \pi \cdot \frac{angle}{180}\\
{\left(a \cdot \cos t\_0\right)}^{2} + {\left(b \cdot \sin t\_0\right)}^{2}
\end{array}
\end{array}
(FPCore (a b angle) :precision binary64 (+ (pow (* a (cos (/ 1.0 (/ 180.0 (* PI angle))))) 2.0) (pow (* b (sin (* PI (/ 1.0 (/ 180.0 angle))))) 2.0)))
double code(double a, double b, double angle) {
return pow((a * cos((1.0 / (180.0 / (((double) M_PI) * angle))))), 2.0) + pow((b * sin((((double) M_PI) * (1.0 / (180.0 / angle))))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.cos((1.0 / (180.0 / (Math.PI * angle))))), 2.0) + Math.pow((b * Math.sin((Math.PI * (1.0 / (180.0 / angle))))), 2.0);
}
def code(a, b, angle): return math.pow((a * math.cos((1.0 / (180.0 / (math.pi * angle))))), 2.0) + math.pow((b * math.sin((math.pi * (1.0 / (180.0 / angle))))), 2.0)
function code(a, b, angle) return Float64((Float64(a * cos(Float64(1.0 / Float64(180.0 / Float64(pi * angle))))) ^ 2.0) + (Float64(b * sin(Float64(pi * Float64(1.0 / Float64(180.0 / angle))))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((a * cos((1.0 / (180.0 / (pi * angle))))) ^ 2.0) + ((b * sin((pi * (1.0 / (180.0 / angle))))) ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Cos[N[(1.0 / N[(180.0 / N[(Pi * angle), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[N[(Pi * N[(1.0 / N[(180.0 / angle), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \cos \left(\frac{1}{\frac{180}{\pi \cdot angle}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{1}{\frac{180}{angle}}\right)\right)}^{2}
\end{array}
Initial program 80.0%
Simplified80.0%
metadata-eval80.0%
div-inv80.0%
clear-num80.0%
Applied egg-rr80.0%
metadata-eval80.0%
div-inv80.0%
associate-*r/79.6%
clear-num80.1%
Applied egg-rr80.1%
(FPCore (a b angle) :precision binary64 (+ (pow (* b (sin (* PI (/ 1.0 (/ 180.0 angle))))) 2.0) (pow (* a (cos (* PI (* angle 0.005555555555555556)))) 2.0)))
double code(double a, double b, double angle) {
return pow((b * sin((((double) M_PI) * (1.0 / (180.0 / angle))))), 2.0) + pow((a * cos((((double) M_PI) * (angle * 0.005555555555555556)))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((b * Math.sin((Math.PI * (1.0 / (180.0 / angle))))), 2.0) + Math.pow((a * Math.cos((Math.PI * (angle * 0.005555555555555556)))), 2.0);
}
def code(a, b, angle): return math.pow((b * math.sin((math.pi * (1.0 / (180.0 / angle))))), 2.0) + math.pow((a * math.cos((math.pi * (angle * 0.005555555555555556)))), 2.0)
function code(a, b, angle) return Float64((Float64(b * sin(Float64(pi * Float64(1.0 / Float64(180.0 / angle))))) ^ 2.0) + (Float64(a * cos(Float64(pi * Float64(angle * 0.005555555555555556)))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((b * sin((pi * (1.0 / (180.0 / angle))))) ^ 2.0) + ((a * cos((pi * (angle * 0.005555555555555556)))) ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(b * N[Sin[N[(Pi * N[(1.0 / N[(180.0 / angle), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(a * N[Cos[N[(Pi * N[(angle * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(b \cdot \sin \left(\pi \cdot \frac{1}{\frac{180}{angle}}\right)\right)}^{2} + {\left(a \cdot \cos \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2}
\end{array}
Initial program 80.0%
Simplified80.0%
metadata-eval80.0%
div-inv80.0%
clear-num80.0%
Applied egg-rr80.0%
Final simplification80.0%
(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.0%
Simplified80.0%
metadata-eval80.0%
div-inv80.0%
clear-num80.0%
Applied egg-rr80.0%
Applied egg-rr80.0%
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* angle (* PI 0.005555555555555556)))) (pow (hypot (* a (cos t_0)) (* b (sin t_0))) 2.0)))
double code(double a, double b, double angle) {
double t_0 = angle * (((double) M_PI) * 0.005555555555555556);
return pow(hypot((a * cos(t_0)), (b * sin(t_0))), 2.0);
}
public static double code(double a, double b, double angle) {
double t_0 = angle * (Math.PI * 0.005555555555555556);
return Math.pow(Math.hypot((a * Math.cos(t_0)), (b * Math.sin(t_0))), 2.0);
}
def code(a, b, angle): t_0 = angle * (math.pi * 0.005555555555555556) return math.pow(math.hypot((a * math.cos(t_0)), (b * math.sin(t_0))), 2.0)
function code(a, b, angle) t_0 = Float64(angle * Float64(pi * 0.005555555555555556)) return hypot(Float64(a * cos(t_0)), Float64(b * sin(t_0))) ^ 2.0 end
function tmp = code(a, b, angle) t_0 = angle * (pi * 0.005555555555555556); tmp = hypot((a * cos(t_0)), (b * sin(t_0))) ^ 2.0; end
code[a_, b_, angle_] := Block[{t$95$0 = N[(angle * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]}, N[Power[N[Sqrt[N[(a * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision] ^ 2 + N[(b * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision], 2.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := angle \cdot \left(\pi \cdot 0.005555555555555556\right)\\
{\left(\mathsf{hypot}\left(a \cdot \cos t\_0, b \cdot \sin t\_0\right)\right)}^{2}
\end{array}
\end{array}
Initial program 80.0%
Simplified80.0%
Taylor expanded in a around 0 70.7%
*-commutative70.7%
unpow270.7%
unpow270.7%
swap-sqr70.4%
unpow270.4%
*-commutative70.4%
unpow270.4%
swap-sqr79.6%
Simplified79.5%
Final simplification79.5%
(FPCore (a b angle) :precision binary64 (if (<= b 1.45e+128) (* (pow a 2.0) (pow (cos (* 0.005555555555555556 (* PI angle))) 2.0)) (pow (* b (sin (* PI (* angle 0.005555555555555556)))) 2.0)))
double code(double a, double b, double angle) {
double tmp;
if (b <= 1.45e+128) {
tmp = pow(a, 2.0) * pow(cos((0.005555555555555556 * (((double) M_PI) * angle))), 2.0);
} else {
tmp = pow((b * sin((((double) M_PI) * (angle * 0.005555555555555556)))), 2.0);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (b <= 1.45e+128) {
tmp = Math.pow(a, 2.0) * Math.pow(Math.cos((0.005555555555555556 * (Math.PI * angle))), 2.0);
} else {
tmp = Math.pow((b * Math.sin((Math.PI * (angle * 0.005555555555555556)))), 2.0);
}
return tmp;
}
def code(a, b, angle): tmp = 0 if b <= 1.45e+128: tmp = math.pow(a, 2.0) * math.pow(math.cos((0.005555555555555556 * (math.pi * angle))), 2.0) else: tmp = math.pow((b * math.sin((math.pi * (angle * 0.005555555555555556)))), 2.0) return tmp
function code(a, b, angle) tmp = 0.0 if (b <= 1.45e+128) tmp = Float64((a ^ 2.0) * (cos(Float64(0.005555555555555556 * Float64(pi * angle))) ^ 2.0)); else tmp = Float64(b * sin(Float64(pi * Float64(angle * 0.005555555555555556)))) ^ 2.0; end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (b <= 1.45e+128) tmp = (a ^ 2.0) * (cos((0.005555555555555556 * (pi * angle))) ^ 2.0); else tmp = (b * sin((pi * (angle * 0.005555555555555556)))) ^ 2.0; end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[b, 1.45e+128], 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[(Pi * N[(angle * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.45 \cdot 10^{+128}:\\
\;\;\;\;{a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;{\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2}\\
\end{array}
\end{array}
if b < 1.45e128Initial program 78.1%
Simplified78.1%
Taylor expanded in a around inf 58.8%
if 1.45e128 < b Initial program 88.0%
Simplified88.0%
metadata-eval88.0%
div-inv88.0%
clear-num87.9%
Applied egg-rr87.9%
metadata-eval87.9%
div-inv87.9%
associate-*r/87.9%
clear-num87.9%
Applied egg-rr87.9%
associate-/r/88.0%
metadata-eval88.0%
*-commutative88.0%
expm1-log1p-u72.5%
Applied egg-rr72.5%
Taylor expanded in a around 0 60.7%
unpow260.7%
associate-*r*60.9%
*-commutative60.9%
*-commutative60.9%
unpow260.9%
swap-sqr72.7%
unpow272.7%
*-commutative72.7%
Simplified72.7%
Final simplification61.5%
(FPCore (a b angle) :precision binary64 (+ (pow (* b (sin (* PI (/ 1.0 (/ 180.0 angle))))) 2.0) (pow a 2.0)))
double code(double a, double b, double angle) {
return pow((b * sin((((double) M_PI) * (1.0 / (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 * (1.0 / (180.0 / angle))))), 2.0) + Math.pow(a, 2.0);
}
def code(a, b, angle): return math.pow((b * math.sin((math.pi * (1.0 / (180.0 / angle))))), 2.0) + math.pow(a, 2.0)
function code(a, b, angle) return Float64((Float64(b * sin(Float64(pi * Float64(1.0 / Float64(180.0 / angle))))) ^ 2.0) + (a ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((b * sin((pi * (1.0 / (180.0 / angle))))) ^ 2.0) + (a ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(b * N[Sin[N[(Pi * N[(1.0 / N[(180.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(\pi \cdot \frac{1}{\frac{180}{angle}}\right)\right)}^{2} + {a}^{2}
\end{array}
Initial program 80.0%
Simplified80.0%
metadata-eval80.0%
div-inv80.0%
clear-num80.0%
Applied egg-rr80.0%
metadata-eval80.0%
div-inv80.0%
associate-*r/79.6%
clear-num80.1%
Applied egg-rr80.1%
Taylor expanded in angle around 0 79.4%
Final simplification79.4%
(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.0%
Simplified80.0%
Taylor expanded in angle around 0 79.3%
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* PI (* angle 0.005555555555555556)))) (if (<= b 1.6e+126) (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 * 0.005555555555555556);
double tmp;
if (b <= 1.6e+126) {
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 = Math.PI * (angle * 0.005555555555555556);
double tmp;
if (b <= 1.6e+126) {
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 = math.pi * (angle * 0.005555555555555556) tmp = 0 if b <= 1.6e+126: 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(pi * Float64(angle * 0.005555555555555556)) tmp = 0.0 if (b <= 1.6e+126) 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 = pi * (angle * 0.005555555555555556); tmp = 0.0; if (b <= 1.6e+126) 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[(Pi * N[(angle * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 1.6e+126], 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 := \pi \cdot \left(angle \cdot 0.005555555555555556\right)\\
\mathbf{if}\;b \leq 1.6 \cdot 10^{+126}:\\
\;\;\;\;{\left(a \cdot \cos t\_0\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;{\left(b \cdot \sin t\_0\right)}^{2}\\
\end{array}
\end{array}
if b < 1.5999999999999999e126Initial program 78.1%
Simplified78.1%
metadata-eval78.1%
div-inv78.1%
clear-num78.1%
Applied egg-rr78.1%
metadata-eval78.1%
div-inv78.1%
associate-*r/77.6%
clear-num78.2%
Applied egg-rr78.2%
associate-/r/78.1%
metadata-eval78.1%
*-commutative78.1%
expm1-log1p-u61.6%
Applied egg-rr61.6%
Taylor expanded in a around inf 58.8%
unpow258.8%
associate-*r*58.8%
*-commutative58.8%
*-commutative58.8%
unpow258.8%
swap-sqr58.8%
unpow258.8%
*-commutative58.8%
*-commutative58.8%
associate-*r*58.4%
associate-*r*58.8%
*-commutative58.8%
*-commutative58.8%
*-commutative58.8%
Simplified58.8%
if 1.5999999999999999e126 < b Initial program 88.0%
Simplified88.0%
metadata-eval88.0%
div-inv88.0%
clear-num87.9%
Applied egg-rr87.9%
metadata-eval87.9%
div-inv87.9%
associate-*r/87.9%
clear-num87.9%
Applied egg-rr87.9%
associate-/r/88.0%
metadata-eval88.0%
*-commutative88.0%
expm1-log1p-u72.5%
Applied egg-rr72.5%
Taylor expanded in a around 0 60.7%
unpow260.7%
associate-*r*60.9%
*-commutative60.9%
*-commutative60.9%
unpow260.9%
swap-sqr72.7%
unpow272.7%
*-commutative72.7%
Simplified72.7%
Final simplification61.5%
(FPCore (a b angle) :precision binary64 (if (<= b 5.8e+128) (pow (* a (cos (* PI (* angle 0.005555555555555556)))) 2.0) (pow (* b (sin (* 0.005555555555555556 (* PI angle)))) 2.0)))
double code(double a, double b, double angle) {
double tmp;
if (b <= 5.8e+128) {
tmp = pow((a * cos((((double) M_PI) * (angle * 0.005555555555555556)))), 2.0);
} else {
tmp = pow((b * sin((0.005555555555555556 * (((double) M_PI) * angle)))), 2.0);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (b <= 5.8e+128) {
tmp = Math.pow((a * Math.cos((Math.PI * (angle * 0.005555555555555556)))), 2.0);
} else {
tmp = Math.pow((b * Math.sin((0.005555555555555556 * (Math.PI * angle)))), 2.0);
}
return tmp;
}
def code(a, b, angle): tmp = 0 if b <= 5.8e+128: tmp = math.pow((a * math.cos((math.pi * (angle * 0.005555555555555556)))), 2.0) else: tmp = math.pow((b * math.sin((0.005555555555555556 * (math.pi * angle)))), 2.0) return tmp
function code(a, b, angle) tmp = 0.0 if (b <= 5.8e+128) tmp = Float64(a * cos(Float64(pi * Float64(angle * 0.005555555555555556)))) ^ 2.0; else tmp = Float64(b * sin(Float64(0.005555555555555556 * Float64(pi * angle)))) ^ 2.0; end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (b <= 5.8e+128) tmp = (a * cos((pi * (angle * 0.005555555555555556)))) ^ 2.0; else tmp = (b * sin((0.005555555555555556 * (pi * angle)))) ^ 2.0; end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[b, 5.8e+128], 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 * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 5.8 \cdot 10^{+128}:\\
\;\;\;\;{\left(a \cdot \cos \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;{\left(b \cdot \sin \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)\right)}^{2}\\
\end{array}
\end{array}
if b < 5.8000000000000001e128Initial program 78.1%
Simplified78.1%
metadata-eval78.1%
div-inv78.1%
clear-num78.1%
Applied egg-rr78.1%
metadata-eval78.1%
div-inv78.1%
associate-*r/77.6%
clear-num78.2%
Applied egg-rr78.2%
associate-/r/78.1%
metadata-eval78.1%
*-commutative78.1%
expm1-log1p-u61.6%
Applied egg-rr61.6%
Taylor expanded in a around inf 58.8%
unpow258.8%
associate-*r*58.8%
*-commutative58.8%
*-commutative58.8%
unpow258.8%
swap-sqr58.8%
unpow258.8%
*-commutative58.8%
*-commutative58.8%
associate-*r*58.4%
associate-*r*58.8%
*-commutative58.8%
*-commutative58.8%
*-commutative58.8%
Simplified58.8%
if 5.8000000000000001e128 < b Initial program 88.0%
Simplified88.0%
Taylor expanded in a around 0 60.7%
unpow260.7%
*-commutative60.7%
unpow260.7%
swap-sqr72.4%
unpow272.4%
*-commutative72.4%
Simplified72.4%
Final simplification61.4%
(FPCore (a b angle) :precision binary64 (if (<= b 4.8e+222) (pow (* a (cos (* PI (* angle 0.005555555555555556)))) 2.0) (pow (pow a 6.0) 0.3333333333333333)))
double code(double a, double b, double angle) {
double tmp;
if (b <= 4.8e+222) {
tmp = pow((a * cos((((double) M_PI) * (angle * 0.005555555555555556)))), 2.0);
} else {
tmp = pow(pow(a, 6.0), 0.3333333333333333);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (b <= 4.8e+222) {
tmp = Math.pow((a * Math.cos((Math.PI * (angle * 0.005555555555555556)))), 2.0);
} else {
tmp = Math.pow(Math.pow(a, 6.0), 0.3333333333333333);
}
return tmp;
}
def code(a, b, angle): tmp = 0 if b <= 4.8e+222: tmp = math.pow((a * math.cos((math.pi * (angle * 0.005555555555555556)))), 2.0) else: tmp = math.pow(math.pow(a, 6.0), 0.3333333333333333) return tmp
function code(a, b, angle) tmp = 0.0 if (b <= 4.8e+222) tmp = Float64(a * cos(Float64(pi * Float64(angle * 0.005555555555555556)))) ^ 2.0; else tmp = (a ^ 6.0) ^ 0.3333333333333333; end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (b <= 4.8e+222) tmp = (a * cos((pi * (angle * 0.005555555555555556)))) ^ 2.0; else tmp = (a ^ 6.0) ^ 0.3333333333333333; end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[b, 4.8e+222], N[Power[N[(a * N[Cos[N[(Pi * N[(angle * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[Power[N[Power[a, 6.0], $MachinePrecision], 0.3333333333333333], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 4.8 \cdot 10^{+222}:\\
\;\;\;\;{\left(a \cdot \cos \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;{\left({a}^{6}\right)}^{0.3333333333333333}\\
\end{array}
\end{array}
if b < 4.8000000000000002e222Initial program 78.7%
Simplified78.7%
metadata-eval78.7%
div-inv78.7%
clear-num78.8%
Applied egg-rr78.8%
metadata-eval78.8%
div-inv78.8%
associate-*r/78.3%
clear-num78.8%
Applied egg-rr78.8%
associate-/r/78.8%
metadata-eval78.8%
*-commutative78.8%
expm1-log1p-u62.4%
Applied egg-rr62.4%
Taylor expanded in a around inf 55.5%
unpow255.5%
associate-*r*55.5%
*-commutative55.5%
*-commutative55.5%
unpow255.5%
swap-sqr55.5%
unpow255.5%
*-commutative55.5%
*-commutative55.5%
associate-*r*55.1%
associate-*r*55.5%
*-commutative55.5%
*-commutative55.5%
*-commutative55.5%
Simplified55.5%
if 4.8000000000000002e222 < b Initial program 94.9%
Simplified95.0%
Taylor expanded in angle around 0 51.9%
add-sqr-sqrt51.9%
sqrt-unprod61.0%
pow-prod-up61.0%
metadata-eval61.0%
Applied egg-rr61.0%
add-cbrt-cube61.0%
pow1/361.0%
add-sqr-sqrt61.0%
sqrt-pow161.0%
metadata-eval61.0%
pow-prod-up61.0%
metadata-eval61.0%
Applied egg-rr61.0%
Final simplification55.9%
(FPCore (a b angle) :precision binary64 (if (<= b 9.5e+220) (pow (* a (cos (* 0.005555555555555556 (* PI angle)))) 2.0) (pow (pow a 6.0) 0.3333333333333333)))
double code(double a, double b, double angle) {
double tmp;
if (b <= 9.5e+220) {
tmp = pow((a * cos((0.005555555555555556 * (((double) M_PI) * angle)))), 2.0);
} else {
tmp = pow(pow(a, 6.0), 0.3333333333333333);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (b <= 9.5e+220) {
tmp = Math.pow((a * Math.cos((0.005555555555555556 * (Math.PI * angle)))), 2.0);
} else {
tmp = Math.pow(Math.pow(a, 6.0), 0.3333333333333333);
}
return tmp;
}
def code(a, b, angle): tmp = 0 if b <= 9.5e+220: tmp = math.pow((a * math.cos((0.005555555555555556 * (math.pi * angle)))), 2.0) else: tmp = math.pow(math.pow(a, 6.0), 0.3333333333333333) return tmp
function code(a, b, angle) tmp = 0.0 if (b <= 9.5e+220) tmp = Float64(a * cos(Float64(0.005555555555555556 * Float64(pi * angle)))) ^ 2.0; else tmp = (a ^ 6.0) ^ 0.3333333333333333; end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (b <= 9.5e+220) tmp = (a * cos((0.005555555555555556 * (pi * angle)))) ^ 2.0; else tmp = (a ^ 6.0) ^ 0.3333333333333333; end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[b, 9.5e+220], 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], 0.3333333333333333], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 9.5 \cdot 10^{+220}:\\
\;\;\;\;{\left(a \cdot \cos \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;{\left({a}^{6}\right)}^{0.3333333333333333}\\
\end{array}
\end{array}
if b < 9.50000000000000084e220Initial program 78.7%
Simplified78.7%
Taylor expanded in a around inf 55.5%
*-commutative55.5%
unpow255.5%
unpow255.5%
swap-sqr55.1%
unpow255.1%
*-commutative55.1%
Simplified55.1%
if 9.50000000000000084e220 < b Initial program 94.9%
Simplified95.0%
Taylor expanded in angle around 0 51.9%
add-sqr-sqrt51.9%
sqrt-unprod61.0%
pow-prod-up61.0%
metadata-eval61.0%
Applied egg-rr61.0%
add-cbrt-cube61.0%
pow1/361.0%
add-sqr-sqrt61.0%
sqrt-pow161.0%
metadata-eval61.0%
pow-prod-up61.0%
metadata-eval61.0%
Applied egg-rr61.0%
Final simplification55.6%
(FPCore (a b angle) :precision binary64 (if (<= b 2.9e+226) (* a a) (pow (pow a 6.0) 0.3333333333333333)))
double code(double a, double b, double angle) {
double tmp;
if (b <= 2.9e+226) {
tmp = a * a;
} else {
tmp = pow(pow(a, 6.0), 0.3333333333333333);
}
return tmp;
}
real(8) function code(a, b, angle)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle
real(8) :: tmp
if (b <= 2.9d+226) then
tmp = a * a
else
tmp = (a ** 6.0d0) ** 0.3333333333333333d0
end if
code = tmp
end function
public static double code(double a, double b, double angle) {
double tmp;
if (b <= 2.9e+226) {
tmp = a * a;
} else {
tmp = Math.pow(Math.pow(a, 6.0), 0.3333333333333333);
}
return tmp;
}
def code(a, b, angle): tmp = 0 if b <= 2.9e+226: tmp = a * a else: tmp = math.pow(math.pow(a, 6.0), 0.3333333333333333) return tmp
function code(a, b, angle) tmp = 0.0 if (b <= 2.9e+226) tmp = Float64(a * a); else tmp = (a ^ 6.0) ^ 0.3333333333333333; end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (b <= 2.9e+226) tmp = a * a; else tmp = (a ^ 6.0) ^ 0.3333333333333333; end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[b, 2.9e+226], N[(a * a), $MachinePrecision], N[Power[N[Power[a, 6.0], $MachinePrecision], 0.3333333333333333], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 2.9 \cdot 10^{+226}:\\
\;\;\;\;a \cdot a\\
\mathbf{else}:\\
\;\;\;\;{\left({a}^{6}\right)}^{0.3333333333333333}\\
\end{array}
\end{array}
if b < 2.89999999999999974e226Initial program 78.8%
Simplified78.8%
Taylor expanded in angle around 0 54.9%
unpow254.9%
Applied egg-rr54.9%
if 2.89999999999999974e226 < b Initial program 94.6%
Simplified94.7%
Taylor expanded in angle around 0 54.4%
add-sqr-sqrt54.4%
sqrt-unprod64.1%
pow-prod-up64.1%
metadata-eval64.1%
Applied egg-rr64.1%
add-cbrt-cube64.1%
pow1/364.1%
add-sqr-sqrt64.1%
sqrt-pow164.1%
metadata-eval64.1%
pow-prod-up64.1%
metadata-eval64.1%
Applied egg-rr64.1%
(FPCore (a b angle) :precision binary64 (if (<= b 1.65e+220) (* a a) (cbrt (pow a 6.0))))
double code(double a, double b, double angle) {
double tmp;
if (b <= 1.65e+220) {
tmp = a * a;
} else {
tmp = cbrt(pow(a, 6.0));
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (b <= 1.65e+220) {
tmp = a * a;
} else {
tmp = Math.cbrt(Math.pow(a, 6.0));
}
return tmp;
}
function code(a, b, angle) tmp = 0.0 if (b <= 1.65e+220) tmp = Float64(a * a); else tmp = cbrt((a ^ 6.0)); end return tmp end
code[a_, b_, angle_] := If[LessEqual[b, 1.65e+220], N[(a * a), $MachinePrecision], N[Power[N[Power[a, 6.0], $MachinePrecision], 1/3], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.65 \cdot 10^{+220}:\\
\;\;\;\;a \cdot a\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{{a}^{6}}\\
\end{array}
\end{array}
if b < 1.65000000000000011e220Initial program 78.7%
Simplified78.7%
Taylor expanded in angle around 0 55.1%
unpow255.1%
Applied egg-rr55.1%
if 1.65000000000000011e220 < b Initial program 94.9%
Simplified95.0%
Taylor expanded in angle around 0 51.9%
add-sqr-sqrt51.9%
sqrt-unprod61.0%
pow-prod-up61.0%
metadata-eval61.0%
Applied egg-rr61.0%
add-cbrt-cube61.0%
pow1/361.0%
add-sqr-sqrt61.0%
sqrt-pow161.0%
metadata-eval61.0%
pow-prod-up61.0%
metadata-eval61.0%
Applied egg-rr61.0%
unpow1/361.0%
Simplified61.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.0%
Simplified80.0%
Taylor expanded in angle around 0 54.8%
unpow254.8%
Applied egg-rr54.8%
herbie shell --seed 2024146
(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)))