
(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 9 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 (pow (cbrt (cos (* 0.005555555555555556 (* PI angle)))) 3.0)) 2.0) (pow (* b (sin (* PI (* 0.005555555555555556 angle)))) 2.0)))
double code(double a, double b, double angle) {
return pow((a * pow(cbrt(cos((0.005555555555555556 * (((double) M_PI) * angle)))), 3.0)), 2.0) + pow((b * sin((((double) M_PI) * (0.005555555555555556 * angle)))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.pow(Math.cbrt(Math.cos((0.005555555555555556 * (Math.PI * angle)))), 3.0)), 2.0) + Math.pow((b * Math.sin((Math.PI * (0.005555555555555556 * angle)))), 2.0);
}
function code(a, b, angle) return Float64((Float64(a * (cbrt(cos(Float64(0.005555555555555556 * Float64(pi * angle)))) ^ 3.0)) ^ 2.0) + (Float64(b * sin(Float64(pi * Float64(0.005555555555555556 * angle)))) ^ 2.0)) end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Power[N[Power[N[Cos[N[(0.005555555555555556 * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision], 2.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}
\\
{\left(a \cdot {\left(\sqrt[3]{\cos \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)}\right)}^{3}\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)\right)}^{2}
\end{array}
Initial program 79.3%
Simplified79.3%
metadata-eval79.3%
div-inv79.4%
add-cube-cbrt79.4%
pow379.4%
div-inv79.3%
metadata-eval79.3%
associate-*r*79.4%
*-commutative79.4%
Applied egg-rr79.4%
Final simplification79.4%
(FPCore (a b angle) :precision binary64 (+ (pow (* b (sin (* PI (* 0.005555555555555556 angle)))) 2.0) (* a (* a (pow (cos (* 0.005555555555555556 (* PI angle))) 2.0)))))
double code(double a, double b, double angle) {
return pow((b * sin((((double) M_PI) * (0.005555555555555556 * angle)))), 2.0) + (a * (a * pow(cos((0.005555555555555556 * (((double) M_PI) * angle))), 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) + (a * (a * Math.pow(Math.cos((0.005555555555555556 * (Math.PI * angle))), 2.0)));
}
def code(a, b, angle): return math.pow((b * math.sin((math.pi * (0.005555555555555556 * angle)))), 2.0) + (a * (a * math.pow(math.cos((0.005555555555555556 * (math.pi * angle))), 2.0)))
function code(a, b, angle) return Float64((Float64(b * sin(Float64(pi * Float64(0.005555555555555556 * angle)))) ^ 2.0) + Float64(a * Float64(a * (cos(Float64(0.005555555555555556 * Float64(pi * angle))) ^ 2.0)))) end
function tmp = code(a, b, angle) tmp = ((b * sin((pi * (0.005555555555555556 * angle)))) ^ 2.0) + (a * (a * (cos((0.005555555555555556 * (pi * angle))) ^ 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[(a * N[(a * N[Power[N[Cos[N[(0.005555555555555556 * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(b \cdot \sin \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)\right)}^{2} + a \cdot \left(a \cdot {\cos \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)}^{2}\right)
\end{array}
Initial program 79.3%
Simplified79.3%
metadata-eval79.3%
div-inv79.4%
add-cube-cbrt79.4%
pow379.4%
div-inv79.3%
metadata-eval79.3%
associate-*r*79.4%
*-commutative79.4%
Applied egg-rr79.4%
unpow279.4%
rem-cube-cbrt79.4%
add-cube-cbrt79.1%
unpow379.1%
rem-cube-cbrt79.1%
*-commutative79.1%
associate-*l*79.1%
unpow379.1%
add-cube-cbrt79.4%
Applied egg-rr79.4%
Final simplification79.4%
(FPCore (a b angle) :precision binary64 (+ (pow (* b (sin (* PI (* 0.005555555555555556 angle)))) 2.0) (* a (* a (/ (+ 1.0 (cos (* (* PI angle) 0.011111111111111112))) 2.0)))))
double code(double a, double b, double angle) {
return pow((b * sin((((double) M_PI) * (0.005555555555555556 * angle)))), 2.0) + (a * (a * ((1.0 + cos(((((double) M_PI) * angle) * 0.011111111111111112))) / 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) + (a * (a * ((1.0 + Math.cos(((Math.PI * angle) * 0.011111111111111112))) / 2.0)));
}
def code(a, b, angle): return math.pow((b * math.sin((math.pi * (0.005555555555555556 * angle)))), 2.0) + (a * (a * ((1.0 + math.cos(((math.pi * angle) * 0.011111111111111112))) / 2.0)))
function code(a, b, angle) return Float64((Float64(b * sin(Float64(pi * Float64(0.005555555555555556 * angle)))) ^ 2.0) + Float64(a * Float64(a * Float64(Float64(1.0 + cos(Float64(Float64(pi * angle) * 0.011111111111111112))) / 2.0)))) end
function tmp = code(a, b, angle) tmp = ((b * sin((pi * (0.005555555555555556 * angle)))) ^ 2.0) + (a * (a * ((1.0 + cos(((pi * angle) * 0.011111111111111112))) / 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[(a * N[(a * N[(N[(1.0 + N[Cos[N[(N[(Pi * angle), $MachinePrecision] * 0.011111111111111112), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(b \cdot \sin \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)\right)}^{2} + a \cdot \left(a \cdot \frac{1 + \cos \left(\left(\pi \cdot angle\right) \cdot 0.011111111111111112\right)}{2}\right)
\end{array}
Initial program 79.3%
Simplified79.3%
metadata-eval79.3%
div-inv79.4%
add-cube-cbrt79.4%
pow379.4%
div-inv79.3%
metadata-eval79.3%
associate-*r*79.4%
*-commutative79.4%
Applied egg-rr79.4%
unpow279.4%
rem-cube-cbrt79.4%
add-cube-cbrt79.1%
unpow379.1%
rem-cube-cbrt79.1%
*-commutative79.1%
associate-*l*79.1%
unpow379.1%
add-cube-cbrt79.4%
Applied egg-rr79.4%
unpow279.4%
*-commutative79.4%
*-commutative79.4%
sqr-cos-a79.4%
add-exp-log42.2%
*-un-lft-identity42.2%
pow-exp42.2%
e-exp-142.2%
sqr-cos-a42.2%
Applied egg-rr79.4%
+-commutative79.4%
+-inverses79.4%
cos-079.4%
distribute-rgt-out79.4%
*-commutative79.4%
metadata-eval79.4%
Simplified79.4%
Final simplification79.4%
(FPCore (a b angle) :precision binary64 (if (<= b 1.3e+154) (pow (* a (cos (* 0.005555555555555556 (* PI angle)))) 2.0) (pow (* b (sin (* angle (* 0.005555555555555556 PI)))) 2.0)))
double code(double a, double b, double angle) {
double tmp;
if (b <= 1.3e+154) {
tmp = pow((a * cos((0.005555555555555556 * (((double) M_PI) * angle)))), 2.0);
} else {
tmp = pow((b * sin((angle * (0.005555555555555556 * ((double) M_PI))))), 2.0);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (b <= 1.3e+154) {
tmp = Math.pow((a * Math.cos((0.005555555555555556 * (Math.PI * angle)))), 2.0);
} else {
tmp = Math.pow((b * Math.sin((angle * (0.005555555555555556 * Math.PI)))), 2.0);
}
return tmp;
}
def code(a, b, angle): tmp = 0 if b <= 1.3e+154: tmp = math.pow((a * math.cos((0.005555555555555556 * (math.pi * angle)))), 2.0) else: tmp = math.pow((b * math.sin((angle * (0.005555555555555556 * math.pi)))), 2.0) return tmp
function code(a, b, angle) tmp = 0.0 if (b <= 1.3e+154) tmp = Float64(a * cos(Float64(0.005555555555555556 * Float64(pi * angle)))) ^ 2.0; else tmp = Float64(b * sin(Float64(angle * Float64(0.005555555555555556 * pi)))) ^ 2.0; end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (b <= 1.3e+154) tmp = (a * cos((0.005555555555555556 * (pi * angle)))) ^ 2.0; else tmp = (b * sin((angle * (0.005555555555555556 * pi)))) ^ 2.0; end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[b, 1.3e+154], 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[(0.005555555555555556 * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.3 \cdot 10^{+154}:\\
\;\;\;\;{\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(0.005555555555555556 \cdot \pi\right)\right)\right)}^{2}\\
\end{array}
\end{array}
if b < 1.29999999999999994e154Initial program 77.2%
Simplified77.2%
Taylor expanded in a around inf 56.1%
*-commutative56.1%
unpow256.1%
unpow256.1%
swap-sqr56.1%
unpow256.1%
*-commutative56.1%
Simplified56.1%
if 1.29999999999999994e154 < b Initial program 99.1%
Simplified99.2%
metadata-eval99.2%
div-inv99.2%
add-cube-cbrt99.2%
pow399.2%
div-inv99.2%
metadata-eval99.2%
associate-*r*99.2%
*-commutative99.2%
Applied egg-rr99.2%
unpow299.2%
rem-cube-cbrt99.2%
add-cube-cbrt99.2%
unpow399.2%
rem-cube-cbrt99.2%
*-commutative99.2%
associate-*l*99.2%
unpow399.2%
add-cube-cbrt99.2%
Applied egg-rr99.2%
Taylor expanded in a around 0 56.9%
unpow256.9%
*-commutative56.9%
unpow256.9%
swap-sqr95.5%
unpow295.5%
associate-*r*95.5%
*-commutative95.5%
Simplified95.5%
Final simplification60.0%
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* 0.005555555555555556 (* PI angle)))) (if (<= b 1.5e+154) (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 <= 1.5e+154) {
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 <= 1.5e+154) {
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 <= 1.5e+154: 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 <= 1.5e+154) 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 <= 1.5e+154) 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, 1.5e+154], 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 1.5 \cdot 10^{+154}:\\
\;\;\;\;{\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.50000000000000013e154Initial program 77.2%
Simplified77.2%
Taylor expanded in a around inf 56.1%
*-commutative56.1%
unpow256.1%
unpow256.1%
swap-sqr56.1%
unpow256.1%
*-commutative56.1%
Simplified56.1%
if 1.50000000000000013e154 < b Initial program 99.1%
Simplified99.2%
Taylor expanded in a around 0 56.9%
unpow256.9%
*-commutative56.9%
unpow256.9%
swap-sqr95.5%
unpow295.5%
*-commutative95.5%
Simplified95.5%
Final simplification60.0%
(FPCore (a b angle) :precision binary64 (if (<= b 2.6e+172) (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.6e+172) {
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.6e+172) {
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.6e+172) 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.6e+172], 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.6 \cdot 10^{+172}:\\
\;\;\;\;{\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.6e172Initial program 77.4%
Simplified77.4%
Taylor expanded in a around inf 55.7%
*-commutative55.7%
unpow255.7%
unpow255.7%
swap-sqr55.7%
unpow255.7%
*-commutative55.7%
Simplified55.7%
if 2.6e172 < b Initial program 99.1%
Simplified99.2%
Taylor expanded in angle around 0 20.4%
add-sqr-sqrt20.4%
sqrt-unprod24.6%
pow-prod-up24.6%
metadata-eval24.6%
Applied egg-rr24.6%
add-cbrt-cube28.4%
pow1/328.4%
add-sqr-sqrt28.4%
sqrt-pow128.4%
metadata-eval28.4%
pow-prod-up28.4%
metadata-eval28.4%
Applied egg-rr28.4%
unpow1/328.4%
Simplified28.4%
Final simplification53.3%
(FPCore (a b angle) :precision binary64 (+ (pow (* b (sin (* PI (* 0.005555555555555556 angle)))) 2.0) (* a a)))
double code(double a, double b, double angle) {
return pow((b * sin((((double) M_PI) * (0.005555555555555556 * angle)))), 2.0) + (a * a);
}
public static double code(double a, double b, double angle) {
return Math.pow((b * Math.sin((Math.PI * (0.005555555555555556 * angle)))), 2.0) + (a * a);
}
def code(a, b, angle): return math.pow((b * math.sin((math.pi * (0.005555555555555556 * angle)))), 2.0) + (a * a)
function code(a, b, angle) return Float64((Float64(b * sin(Float64(pi * Float64(0.005555555555555556 * angle)))) ^ 2.0) + Float64(a * a)) end
function tmp = code(a, b, angle) tmp = ((b * sin((pi * (0.005555555555555556 * angle)))) ^ 2.0) + (a * a); 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[(a * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(b \cdot \sin \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)\right)}^{2} + a \cdot a
\end{array}
Initial program 79.3%
Simplified79.3%
metadata-eval79.3%
div-inv79.4%
add-cube-cbrt79.4%
pow379.4%
div-inv79.3%
metadata-eval79.3%
associate-*r*79.4%
*-commutative79.4%
Applied egg-rr79.4%
unpow279.4%
rem-cube-cbrt79.4%
add-cube-cbrt79.1%
unpow379.1%
rem-cube-cbrt79.1%
*-commutative79.1%
associate-*l*79.1%
unpow379.1%
add-cube-cbrt79.4%
Applied egg-rr79.4%
Taylor expanded in angle around 0 78.9%
Final simplification78.9%
(FPCore (a b angle) :precision binary64 (if (<= b 1.38e+172) (* a a) (cbrt (pow a 6.0))))
double code(double a, double b, double angle) {
double tmp;
if (b <= 1.38e+172) {
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.38e+172) {
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.38e+172) tmp = Float64(a * a); else tmp = cbrt((a ^ 6.0)); end return tmp end
code[a_, b_, angle_] := If[LessEqual[b, 1.38e+172], 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.38 \cdot 10^{+172}:\\
\;\;\;\;a \cdot a\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{{a}^{6}}\\
\end{array}
\end{array}
if b < 1.38000000000000002e172Initial program 77.4%
Simplified77.4%
Taylor expanded in angle around 0 55.1%
unpow255.1%
Applied egg-rr55.1%
if 1.38000000000000002e172 < b Initial program 99.1%
Simplified99.2%
Taylor expanded in angle around 0 20.4%
add-sqr-sqrt20.4%
sqrt-unprod24.6%
pow-prod-up24.6%
metadata-eval24.6%
Applied egg-rr24.6%
add-cbrt-cube28.4%
pow1/328.4%
add-sqr-sqrt28.4%
sqrt-pow128.4%
metadata-eval28.4%
pow-prod-up28.4%
metadata-eval28.4%
Applied egg-rr28.4%
unpow1/328.4%
Simplified28.4%
(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 79.3%
Simplified79.3%
Taylor expanded in angle around 0 52.0%
unpow252.0%
Applied egg-rr52.0%
herbie shell --seed 2024132
(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)))