
(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 8 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}
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
:precision binary64
(let* ((t_0 (* PI (* angle_m 0.005555555555555556))))
(+
(* a (* a (+ 0.5 (* 0.5 (cos (* 2.0 (expm1 (log1p t_0))))))))
(pow (* b (sin t_0)) 2.0))))angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double t_0 = ((double) M_PI) * (angle_m * 0.005555555555555556);
return (a * (a * (0.5 + (0.5 * cos((2.0 * expm1(log1p(t_0)))))))) + pow((b * sin(t_0)), 2.0);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double t_0 = Math.PI * (angle_m * 0.005555555555555556);
return (a * (a * (0.5 + (0.5 * Math.cos((2.0 * Math.expm1(Math.log1p(t_0)))))))) + Math.pow((b * Math.sin(t_0)), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): t_0 = math.pi * (angle_m * 0.005555555555555556) return (a * (a * (0.5 + (0.5 * math.cos((2.0 * math.expm1(math.log1p(t_0)))))))) + math.pow((b * math.sin(t_0)), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) t_0 = Float64(pi * Float64(angle_m * 0.005555555555555556)) return Float64(Float64(a * Float64(a * Float64(0.5 + Float64(0.5 * cos(Float64(2.0 * expm1(log1p(t_0)))))))) + (Float64(b * sin(t_0)) ^ 2.0)) end
angle_m = N[Abs[angle], $MachinePrecision]
code[a_, b_, angle$95$m_] := Block[{t$95$0 = N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]}, N[(N[(a * N[(a * N[(0.5 + N[(0.5 * N[Cos[N[(2.0 * N[(Exp[N[Log[1 + t$95$0], $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Power[N[(b * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
t_0 := \pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)\\
a \cdot \left(a \cdot \left(0.5 + 0.5 \cdot \cos \left(2 \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(t\_0\right)\right)\right)\right)\right) + {\left(b \cdot \sin t\_0\right)}^{2}
\end{array}
\end{array}
Initial program 82.2%
Simplified82.2%
expm1-log1p-u66.5%
associate-*r*66.5%
*-commutative66.5%
Applied egg-rr66.5%
unpow-prod-down66.5%
unpow266.5%
expm1-log1p-u82.3%
*-commutative82.3%
associate-*r*82.3%
associate-*l*82.2%
associate-*r*82.3%
*-commutative82.3%
expm1-log1p-u66.5%
expm1-log1p-u82.3%
*-commutative82.3%
associate-*r*82.2%
*-commutative82.2%
Applied egg-rr82.2%
unpow282.2%
*-commutative82.2%
associate-*r*81.3%
*-commutative81.3%
*-commutative81.3%
associate-*r*82.3%
*-commutative82.3%
sqr-cos-a82.3%
*-commutative82.3%
*-commutative82.3%
associate-*l*82.2%
Applied egg-rr82.2%
associate-*r*82.3%
*-commutative82.3%
Simplified82.3%
expm1-log1p-u66.5%
expm1-undefine66.5%
*-commutative66.5%
associate-*r*66.5%
*-commutative66.5%
associate-*r*66.5%
Applied egg-rr66.5%
expm1-define66.5%
*-commutative66.5%
Simplified66.5%
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
:precision binary64
(+
(pow (* b (sin (* PI (* angle_m 0.005555555555555556)))) 2.0)
(*
a
(*
a
(+ 0.5 (* 0.5 (cos (* 2.0 (* 0.005555555555555556 (* PI angle_m))))))))))angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow((b * sin((((double) M_PI) * (angle_m * 0.005555555555555556)))), 2.0) + (a * (a * (0.5 + (0.5 * cos((2.0 * (0.005555555555555556 * (((double) M_PI) * angle_m))))))));
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return Math.pow((b * Math.sin((Math.PI * (angle_m * 0.005555555555555556)))), 2.0) + (a * (a * (0.5 + (0.5 * Math.cos((2.0 * (0.005555555555555556 * (Math.PI * angle_m))))))));
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow((b * math.sin((math.pi * (angle_m * 0.005555555555555556)))), 2.0) + (a * (a * (0.5 + (0.5 * math.cos((2.0 * (0.005555555555555556 * (math.pi * angle_m))))))))
angle_m = abs(angle) function code(a, b, angle_m) return Float64((Float64(b * sin(Float64(pi * Float64(angle_m * 0.005555555555555556)))) ^ 2.0) + Float64(a * Float64(a * Float64(0.5 + Float64(0.5 * cos(Float64(2.0 * Float64(0.005555555555555556 * Float64(pi * angle_m))))))))) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = ((b * sin((pi * (angle_m * 0.005555555555555556)))) ^ 2.0) + (a * (a * (0.5 + (0.5 * cos((2.0 * (0.005555555555555556 * (pi * angle_m)))))))); end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(N[Power[N[(b * N[Sin[N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(a * N[(a * N[(0.5 + N[(0.5 * N[Cos[N[(2.0 * N[(0.005555555555555556 * N[(Pi * angle$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{\left(b \cdot \sin \left(\pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)\right)\right)}^{2} + a \cdot \left(a \cdot \left(0.5 + 0.5 \cdot \cos \left(2 \cdot \left(0.005555555555555556 \cdot \left(\pi \cdot angle\_m\right)\right)\right)\right)\right)
\end{array}
Initial program 82.2%
Simplified82.2%
expm1-log1p-u66.5%
associate-*r*66.5%
*-commutative66.5%
Applied egg-rr66.5%
unpow-prod-down66.5%
unpow266.5%
expm1-log1p-u82.3%
*-commutative82.3%
associate-*r*82.3%
associate-*l*82.2%
associate-*r*82.3%
*-commutative82.3%
expm1-log1p-u66.5%
expm1-log1p-u82.3%
*-commutative82.3%
associate-*r*82.2%
*-commutative82.2%
Applied egg-rr82.2%
unpow282.2%
*-commutative82.2%
associate-*r*81.3%
*-commutative81.3%
*-commutative81.3%
associate-*r*82.3%
*-commutative82.3%
sqr-cos-a82.3%
*-commutative82.3%
*-commutative82.3%
associate-*l*82.2%
Applied egg-rr82.2%
associate-*r*82.3%
*-commutative82.3%
Simplified82.3%
Final simplification82.3%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow (* b (sin (* PI (* angle_m 0.005555555555555556)))) 2.0) (* a (* a (/ (+ 1.0 (cos (* angle_m (* PI 0.011111111111111112)))) 2.0)))))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow((b * sin((((double) M_PI) * (angle_m * 0.005555555555555556)))), 2.0) + (a * (a * ((1.0 + cos((angle_m * (((double) M_PI) * 0.011111111111111112)))) / 2.0)));
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return Math.pow((b * Math.sin((Math.PI * (angle_m * 0.005555555555555556)))), 2.0) + (a * (a * ((1.0 + Math.cos((angle_m * (Math.PI * 0.011111111111111112)))) / 2.0)));
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow((b * math.sin((math.pi * (angle_m * 0.005555555555555556)))), 2.0) + (a * (a * ((1.0 + math.cos((angle_m * (math.pi * 0.011111111111111112)))) / 2.0)))
angle_m = abs(angle) function code(a, b, angle_m) return Float64((Float64(b * sin(Float64(pi * Float64(angle_m * 0.005555555555555556)))) ^ 2.0) + Float64(a * Float64(a * Float64(Float64(1.0 + cos(Float64(angle_m * Float64(pi * 0.011111111111111112)))) / 2.0)))) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = ((b * sin((pi * (angle_m * 0.005555555555555556)))) ^ 2.0) + (a * (a * ((1.0 + cos((angle_m * (pi * 0.011111111111111112)))) / 2.0))); end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(N[Power[N[(b * N[Sin[N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(a * N[(a * N[(N[(1.0 + N[Cos[N[(angle$95$m * N[(Pi * 0.011111111111111112), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{\left(b \cdot \sin \left(\pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)\right)\right)}^{2} + a \cdot \left(a \cdot \frac{1 + \cos \left(angle\_m \cdot \left(\pi \cdot 0.011111111111111112\right)\right)}{2}\right)
\end{array}
Initial program 82.2%
Simplified82.2%
expm1-log1p-u66.5%
associate-*r*66.5%
*-commutative66.5%
Applied egg-rr66.5%
unpow-prod-down66.5%
unpow266.5%
expm1-log1p-u82.3%
*-commutative82.3%
associate-*r*82.3%
associate-*l*82.2%
associate-*r*82.3%
*-commutative82.3%
expm1-log1p-u66.5%
expm1-log1p-u82.3%
*-commutative82.3%
associate-*r*82.2%
*-commutative82.2%
Applied egg-rr82.2%
unpow282.2%
*-commutative82.2%
associate-*r*81.3%
*-commutative81.3%
*-commutative81.3%
associate-*r*82.3%
*-commutative82.3%
cos-mult82.3%
Applied egg-rr82.2%
+-commutative82.2%
+-inverses82.2%
cos-082.2%
distribute-lft-out82.2%
distribute-lft-out82.2%
metadata-eval82.2%
Simplified82.2%
Final simplification82.2%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (let* ((t_0 (* 0.005555555555555556 (* PI angle_m)))) (if (<= b 3e+141) (pow (* a (cos t_0)) 2.0) (pow (* b (sin t_0)) 2.0))))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double t_0 = 0.005555555555555556 * (((double) M_PI) * angle_m);
double tmp;
if (b <= 3e+141) {
tmp = pow((a * cos(t_0)), 2.0);
} else {
tmp = pow((b * sin(t_0)), 2.0);
}
return tmp;
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double t_0 = 0.005555555555555556 * (Math.PI * angle_m);
double tmp;
if (b <= 3e+141) {
tmp = Math.pow((a * Math.cos(t_0)), 2.0);
} else {
tmp = Math.pow((b * Math.sin(t_0)), 2.0);
}
return tmp;
}
angle_m = math.fabs(angle) def code(a, b, angle_m): t_0 = 0.005555555555555556 * (math.pi * angle_m) tmp = 0 if b <= 3e+141: tmp = math.pow((a * math.cos(t_0)), 2.0) else: tmp = math.pow((b * math.sin(t_0)), 2.0) return tmp
angle_m = abs(angle) function code(a, b, angle_m) t_0 = Float64(0.005555555555555556 * Float64(pi * angle_m)) tmp = 0.0 if (b <= 3e+141) tmp = Float64(a * cos(t_0)) ^ 2.0; else tmp = Float64(b * sin(t_0)) ^ 2.0; end return tmp end
angle_m = abs(angle); function tmp_2 = code(a, b, angle_m) t_0 = 0.005555555555555556 * (pi * angle_m); tmp = 0.0; if (b <= 3e+141) tmp = (a * cos(t_0)) ^ 2.0; else tmp = (b * sin(t_0)) ^ 2.0; end tmp_2 = tmp; end
angle_m = N[Abs[angle], $MachinePrecision]
code[a_, b_, angle$95$m_] := Block[{t$95$0 = N[(0.005555555555555556 * N[(Pi * angle$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 3e+141], 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}
angle_m = \left|angle\right|
\\
\begin{array}{l}
t_0 := 0.005555555555555556 \cdot \left(\pi \cdot angle\_m\right)\\
\mathbf{if}\;b \leq 3 \cdot 10^{+141}:\\
\;\;\;\;{\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.9999999999999999e141Initial program 79.7%
Simplified79.8%
Taylor expanded in a around inf 62.6%
unpow262.6%
*-commutative62.6%
unpow262.6%
swap-sqr62.6%
unpow262.6%
*-commutative62.6%
Simplified62.6%
if 2.9999999999999999e141 < b Initial program 93.9%
Simplified93.9%
Taylor expanded in a around 0 57.1%
*-commutative57.1%
unpow257.1%
unpow257.1%
swap-sqr76.7%
unpow276.7%
*-commutative76.7%
Simplified76.7%
Final simplification65.0%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (if (<= b 4.4e+159) (pow (* a (cos (* 0.005555555555555556 (* PI angle_m)))) 2.0) (cbrt (pow a 6.0))))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if (b <= 4.4e+159) {
tmp = pow((a * cos((0.005555555555555556 * (((double) M_PI) * angle_m)))), 2.0);
} else {
tmp = cbrt(pow(a, 6.0));
}
return tmp;
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double tmp;
if (b <= 4.4e+159) {
tmp = Math.pow((a * Math.cos((0.005555555555555556 * (Math.PI * angle_m)))), 2.0);
} else {
tmp = Math.cbrt(Math.pow(a, 6.0));
}
return tmp;
}
angle_m = abs(angle) function code(a, b, angle_m) tmp = 0.0 if (b <= 4.4e+159) tmp = Float64(a * cos(Float64(0.005555555555555556 * Float64(pi * angle_m)))) ^ 2.0; else tmp = cbrt((a ^ 6.0)); end return tmp end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := If[LessEqual[b, 4.4e+159], N[Power[N[(a * N[Cos[N[(0.005555555555555556 * N[(Pi * angle$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[Power[N[Power[a, 6.0], $MachinePrecision], 1/3], $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
\mathbf{if}\;b \leq 4.4 \cdot 10^{+159}:\\
\;\;\;\;{\left(a \cdot \cos \left(0.005555555555555556 \cdot \left(\pi \cdot angle\_m\right)\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{{a}^{6}}\\
\end{array}
\end{array}
if b < 4.3999999999999998e159Initial program 79.7%
Simplified79.8%
Taylor expanded in a around inf 60.7%
unpow260.7%
*-commutative60.7%
unpow260.7%
swap-sqr60.7%
unpow260.7%
*-commutative60.7%
Simplified60.7%
if 4.3999999999999998e159 < b Initial program 99.5%
Simplified99.5%
Taylor expanded in angle around 0 39.7%
add-sqr-sqrt39.7%
sqrt-unprod45.7%
pow-prod-up45.7%
metadata-eval45.7%
Applied egg-rr45.7%
add-cbrt-cube48.7%
pow1/348.7%
add-sqr-sqrt48.7%
sqrt-pow148.7%
metadata-eval48.7%
pow-prod-up48.7%
metadata-eval48.7%
Applied egg-rr48.7%
unpow1/348.7%
Simplified48.7%
Final simplification59.2%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow (* b (sin (* PI (* angle_m 0.005555555555555556)))) 2.0) (* a a)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow((b * sin((((double) M_PI) * (angle_m * 0.005555555555555556)))), 2.0) + (a * a);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return Math.pow((b * Math.sin((Math.PI * (angle_m * 0.005555555555555556)))), 2.0) + (a * a);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow((b * math.sin((math.pi * (angle_m * 0.005555555555555556)))), 2.0) + (a * a)
angle_m = abs(angle) function code(a, b, angle_m) return Float64((Float64(b * sin(Float64(pi * Float64(angle_m * 0.005555555555555556)))) ^ 2.0) + Float64(a * a)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = ((b * sin((pi * (angle_m * 0.005555555555555556)))) ^ 2.0) + (a * a); end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(N[Power[N[(b * N[Sin[N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(a * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{\left(b \cdot \sin \left(\pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)\right)\right)}^{2} + a \cdot a
\end{array}
Initial program 82.2%
Simplified82.2%
expm1-log1p-u66.5%
associate-*r*66.5%
*-commutative66.5%
Applied egg-rr66.5%
unpow-prod-down66.5%
unpow266.5%
expm1-log1p-u82.3%
*-commutative82.3%
associate-*r*82.3%
associate-*l*82.2%
associate-*r*82.3%
*-commutative82.3%
expm1-log1p-u66.5%
expm1-log1p-u82.3%
*-commutative82.3%
associate-*r*82.2%
*-commutative82.2%
Applied egg-rr82.2%
add-sqr-sqrt39.7%
pow239.7%
*-commutative39.7%
sqrt-prod39.7%
unpow239.7%
sqrt-prod30.7%
add-sqr-sqrt39.7%
associate-*r*39.7%
*-commutative39.7%
Applied egg-rr39.7%
Taylor expanded in angle around 0 82.1%
Final simplification82.1%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (if (<= b 4.7e+154) (* a a) (cbrt (pow a 6.0))))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if (b <= 4.7e+154) {
tmp = a * a;
} else {
tmp = cbrt(pow(a, 6.0));
}
return tmp;
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double tmp;
if (b <= 4.7e+154) {
tmp = a * a;
} else {
tmp = Math.cbrt(Math.pow(a, 6.0));
}
return tmp;
}
angle_m = abs(angle) function code(a, b, angle_m) tmp = 0.0 if (b <= 4.7e+154) tmp = Float64(a * a); else tmp = cbrt((a ^ 6.0)); end return tmp end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := If[LessEqual[b, 4.7e+154], N[(a * a), $MachinePrecision], N[Power[N[Power[a, 6.0], $MachinePrecision], 1/3], $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
\mathbf{if}\;b \leq 4.7 \cdot 10^{+154}:\\
\;\;\;\;a \cdot a\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{{a}^{6}}\\
\end{array}
\end{array}
if b < 4.69999999999999983e154Initial program 79.3%
Simplified79.4%
Taylor expanded in angle around 0 60.6%
unpow260.6%
Applied egg-rr60.6%
if 4.69999999999999983e154 < b Initial program 99.5%
Simplified99.5%
Taylor expanded in angle around 0 41.0%
add-sqr-sqrt41.0%
sqrt-unprod46.4%
pow-prod-up46.4%
metadata-eval46.4%
Applied egg-rr46.4%
add-cbrt-cube49.0%
pow1/349.0%
add-sqr-sqrt49.0%
sqrt-pow149.0%
metadata-eval49.0%
pow-prod-up49.0%
metadata-eval49.0%
Applied egg-rr49.0%
unpow1/349.0%
Simplified49.0%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (* a a))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return a * a;
}
angle_m = abs(angle)
real(8) function code(a, b, angle_m)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle_m
code = a * a
end function
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return a * a;
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return a * a
angle_m = abs(angle) function code(a, b, angle_m) return Float64(a * a) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = a * a; end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(a * a), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
a \cdot a
\end{array}
Initial program 82.2%
Simplified82.2%
Taylor expanded in angle around 0 57.9%
unpow257.9%
Applied egg-rr57.9%
herbie shell --seed 2024129
(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)))