
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* (/ angle 180.0) PI))) (+ (pow (* a (sin t_0)) 2.0) (pow (* b (cos t_0)) 2.0))))
double code(double a, double b, double angle) {
double t_0 = (angle / 180.0) * ((double) M_PI);
return pow((a * sin(t_0)), 2.0) + pow((b * cos(t_0)), 2.0);
}
public static double code(double a, double b, double angle) {
double t_0 = (angle / 180.0) * Math.PI;
return Math.pow((a * Math.sin(t_0)), 2.0) + Math.pow((b * Math.cos(t_0)), 2.0);
}
def code(a, b, angle): t_0 = (angle / 180.0) * math.pi return math.pow((a * math.sin(t_0)), 2.0) + math.pow((b * math.cos(t_0)), 2.0)
function code(a, b, angle) t_0 = Float64(Float64(angle / 180.0) * pi) return Float64((Float64(a * sin(t_0)) ^ 2.0) + (Float64(b * cos(t_0)) ^ 2.0)) end
function tmp = code(a, b, angle) t_0 = (angle / 180.0) * pi; tmp = ((a * sin(t_0)) ^ 2.0) + ((b * cos(t_0)) ^ 2.0); end
code[a_, b_, angle_] := Block[{t$95$0 = N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]}, N[(N[Power[N[(a * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{angle}{180} \cdot \pi\\
{\left(a \cdot \sin t\_0\right)}^{2} + {\left(b \cdot \cos 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 (* (/ angle 180.0) PI))) (+ (pow (* a (sin t_0)) 2.0) (pow (* b (cos t_0)) 2.0))))
double code(double a, double b, double angle) {
double t_0 = (angle / 180.0) * ((double) M_PI);
return pow((a * sin(t_0)), 2.0) + pow((b * cos(t_0)), 2.0);
}
public static double code(double a, double b, double angle) {
double t_0 = (angle / 180.0) * Math.PI;
return Math.pow((a * Math.sin(t_0)), 2.0) + Math.pow((b * Math.cos(t_0)), 2.0);
}
def code(a, b, angle): t_0 = (angle / 180.0) * math.pi return math.pow((a * math.sin(t_0)), 2.0) + math.pow((b * math.cos(t_0)), 2.0)
function code(a, b, angle) t_0 = Float64(Float64(angle / 180.0) * pi) return Float64((Float64(a * sin(t_0)) ^ 2.0) + (Float64(b * cos(t_0)) ^ 2.0)) end
function tmp = code(a, b, angle) t_0 = (angle / 180.0) * pi; tmp = ((a * sin(t_0)) ^ 2.0) + ((b * cos(t_0)) ^ 2.0); end
code[a_, b_, angle_] := Block[{t$95$0 = N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]}, N[(N[Power[N[(a * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{angle}{180} \cdot \pi\\
{\left(a \cdot \sin t\_0\right)}^{2} + {\left(b \cdot \cos t\_0\right)}^{2}
\end{array}
\end{array}
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
:precision binary64
(let* ((t_0 (* 0.005555555555555556 (* angle_m PI))) (t_1 (sqrt t_0)))
(+
(pow (* a (sin (* (/ angle_m 180.0) PI))) 2.0)
(pow (* b (cos (* t_1 (* (cbrt t_0) (cbrt t_1))))) 2.0))))angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double t_0 = 0.005555555555555556 * (angle_m * ((double) M_PI));
double t_1 = sqrt(t_0);
return pow((a * sin(((angle_m / 180.0) * ((double) M_PI)))), 2.0) + pow((b * cos((t_1 * (cbrt(t_0) * cbrt(t_1))))), 2.0);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double t_0 = 0.005555555555555556 * (angle_m * Math.PI);
double t_1 = Math.sqrt(t_0);
return Math.pow((a * Math.sin(((angle_m / 180.0) * Math.PI))), 2.0) + Math.pow((b * Math.cos((t_1 * (Math.cbrt(t_0) * Math.cbrt(t_1))))), 2.0);
}
angle_m = abs(angle) function code(a, b, angle_m) t_0 = Float64(0.005555555555555556 * Float64(angle_m * pi)) t_1 = sqrt(t_0) return Float64((Float64(a * sin(Float64(Float64(angle_m / 180.0) * pi))) ^ 2.0) + (Float64(b * cos(Float64(t_1 * Float64(cbrt(t_0) * cbrt(t_1))))) ^ 2.0)) end
angle_m = N[Abs[angle], $MachinePrecision]
code[a_, b_, angle$95$m_] := Block[{t$95$0 = N[(0.005555555555555556 * N[(angle$95$m * Pi), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[t$95$0], $MachinePrecision]}, N[(N[Power[N[(a * N[Sin[N[(N[(angle$95$m / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[N[(t$95$1 * N[(N[Power[t$95$0, 1/3], $MachinePrecision] * N[Power[t$95$1, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
t_0 := 0.005555555555555556 \cdot \left(angle\_m \cdot \pi\right)\\
t_1 := \sqrt{t\_0}\\
{\left(a \cdot \sin \left(\frac{angle\_m}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(t\_1 \cdot \left(\sqrt[3]{t\_0} \cdot \sqrt[3]{t\_1}\right)\right)\right)}^{2}
\end{array}
\end{array}
Initial program 81.6%
add-sqr-sqrt40.4%
pow240.4%
associate-*l/40.4%
associate-*r/40.4%
div-inv40.4%
metadata-eval40.4%
Applied egg-rr40.4%
unpow240.4%
add-cbrt-cube36.7%
add-sqr-sqrt36.7%
metadata-eval36.7%
div-inv36.7%
associate-*r/37.0%
associate-*l/36.7%
cbrt-prod40.7%
associate-*r*40.4%
Applied egg-rr40.4%
associate-*l*40.7%
associate-*r*40.7%
*-commutative40.7%
associate-*r*40.7%
*-commutative40.7%
associate-*r*40.7%
*-commutative40.7%
Simplified40.7%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (if (<= a 9.5e-17) (pow (* b (cos (* PI (* angle_m -0.005555555555555556)))) 2.0) (+ (* b b) (pow (* a (* PI (* angle_m 0.005555555555555556))) 2.0))))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if (a <= 9.5e-17) {
tmp = pow((b * cos((((double) M_PI) * (angle_m * -0.005555555555555556)))), 2.0);
} else {
tmp = (b * b) + pow((a * (((double) M_PI) * (angle_m * 0.005555555555555556))), 2.0);
}
return tmp;
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double tmp;
if (a <= 9.5e-17) {
tmp = Math.pow((b * Math.cos((Math.PI * (angle_m * -0.005555555555555556)))), 2.0);
} else {
tmp = (b * b) + Math.pow((a * (Math.PI * (angle_m * 0.005555555555555556))), 2.0);
}
return tmp;
}
angle_m = math.fabs(angle) def code(a, b, angle_m): tmp = 0 if a <= 9.5e-17: tmp = math.pow((b * math.cos((math.pi * (angle_m * -0.005555555555555556)))), 2.0) else: tmp = (b * b) + math.pow((a * (math.pi * (angle_m * 0.005555555555555556))), 2.0) return tmp
angle_m = abs(angle) function code(a, b, angle_m) tmp = 0.0 if (a <= 9.5e-17) tmp = Float64(b * cos(Float64(pi * Float64(angle_m * -0.005555555555555556)))) ^ 2.0; else tmp = Float64(Float64(b * b) + (Float64(a * Float64(pi * Float64(angle_m * 0.005555555555555556))) ^ 2.0)); end return tmp end
angle_m = abs(angle); function tmp_2 = code(a, b, angle_m) tmp = 0.0; if (a <= 9.5e-17) tmp = (b * cos((pi * (angle_m * -0.005555555555555556)))) ^ 2.0; else tmp = (b * b) + ((a * (pi * (angle_m * 0.005555555555555556))) ^ 2.0); end tmp_2 = tmp; end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := If[LessEqual[a, 9.5e-17], N[Power[N[(b * N[Cos[N[(Pi * N[(angle$95$m * -0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[(N[(b * b), $MachinePrecision] + N[Power[N[(a * N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
\mathbf{if}\;a \leq 9.5 \cdot 10^{-17}:\\
\;\;\;\;{\left(b \cdot \cos \left(\pi \cdot \left(angle\_m \cdot -0.005555555555555556\right)\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;b \cdot b + {\left(a \cdot \left(\pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)\right)\right)}^{2}\\
\end{array}
\end{array}
if a < 9.50000000000000029e-17Initial program 79.7%
expm1-log1p-u67.1%
expm1-undefine67.1%
associate-*l/67.1%
associate-*r/67.1%
div-inv67.1%
metadata-eval67.1%
Applied egg-rr67.1%
expm1-define67.1%
associate-*r*67.1%
*-commutative67.1%
associate-*r*67.1%
Simplified67.1%
Taylor expanded in a around 0 67.0%
unpow267.0%
*-commutative67.0%
associate-*r*67.0%
unpow267.0%
swap-sqr66.6%
unpow266.6%
Simplified66.6%
if 9.50000000000000029e-17 < a Initial program 87.9%
unpow287.9%
associate-*l/87.9%
associate-/l*88.0%
unpow288.0%
Simplified87.8%
Taylor expanded in angle around 0 88.1%
*-rgt-identity88.1%
unpow288.1%
Applied egg-rr88.1%
Taylor expanded in angle around 0 84.2%
associate-*r*84.2%
Simplified84.2%
Final simplification70.7%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (if (<= a 8.8e-17) (pow (* b (cos (* 0.005555555555555556 (* angle_m PI)))) 2.0) (+ (* b b) (pow (* a (* PI (* angle_m 0.005555555555555556))) 2.0))))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if (a <= 8.8e-17) {
tmp = pow((b * cos((0.005555555555555556 * (angle_m * ((double) M_PI))))), 2.0);
} else {
tmp = (b * b) + pow((a * (((double) M_PI) * (angle_m * 0.005555555555555556))), 2.0);
}
return tmp;
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double tmp;
if (a <= 8.8e-17) {
tmp = Math.pow((b * Math.cos((0.005555555555555556 * (angle_m * Math.PI)))), 2.0);
} else {
tmp = (b * b) + Math.pow((a * (Math.PI * (angle_m * 0.005555555555555556))), 2.0);
}
return tmp;
}
angle_m = math.fabs(angle) def code(a, b, angle_m): tmp = 0 if a <= 8.8e-17: tmp = math.pow((b * math.cos((0.005555555555555556 * (angle_m * math.pi)))), 2.0) else: tmp = (b * b) + math.pow((a * (math.pi * (angle_m * 0.005555555555555556))), 2.0) return tmp
angle_m = abs(angle) function code(a, b, angle_m) tmp = 0.0 if (a <= 8.8e-17) tmp = Float64(b * cos(Float64(0.005555555555555556 * Float64(angle_m * pi)))) ^ 2.0; else tmp = Float64(Float64(b * b) + (Float64(a * Float64(pi * Float64(angle_m * 0.005555555555555556))) ^ 2.0)); end return tmp end
angle_m = abs(angle); function tmp_2 = code(a, b, angle_m) tmp = 0.0; if (a <= 8.8e-17) tmp = (b * cos((0.005555555555555556 * (angle_m * pi)))) ^ 2.0; else tmp = (b * b) + ((a * (pi * (angle_m * 0.005555555555555556))) ^ 2.0); end tmp_2 = tmp; end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := If[LessEqual[a, 8.8e-17], N[Power[N[(b * N[Cos[N[(0.005555555555555556 * N[(angle$95$m * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[(N[(b * b), $MachinePrecision] + N[Power[N[(a * N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
\mathbf{if}\;a \leq 8.8 \cdot 10^{-17}:\\
\;\;\;\;{\left(b \cdot \cos \left(0.005555555555555556 \cdot \left(angle\_m \cdot \pi\right)\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;b \cdot b + {\left(a \cdot \left(\pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)\right)\right)}^{2}\\
\end{array}
\end{array}
if a < 8.8e-17Initial program 79.7%
unpow279.7%
associate-*l/79.8%
associate-/l*79.8%
unpow279.8%
Simplified79.7%
Taylor expanded in a around 0 67.0%
*-commutative67.0%
associate-*r*67.0%
unpow267.0%
unpow267.0%
swap-sqr66.6%
unpow266.6%
associate-*r*66.6%
*-commutative66.6%
Simplified66.6%
if 8.8e-17 < a Initial program 87.9%
unpow287.9%
associate-*l/87.9%
associate-/l*88.0%
unpow288.0%
Simplified87.8%
Taylor expanded in angle around 0 88.1%
*-rgt-identity88.1%
unpow288.1%
Applied egg-rr88.1%
Taylor expanded in angle around 0 84.2%
associate-*r*84.2%
Simplified84.2%
Final simplification70.7%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow (* a (sin (/ PI (/ 180.0 angle_m)))) 2.0) (* b b)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow((a * sin((((double) M_PI) / (180.0 / angle_m)))), 2.0) + (b * b);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return Math.pow((a * Math.sin((Math.PI / (180.0 / angle_m)))), 2.0) + (b * b);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow((a * math.sin((math.pi / (180.0 / angle_m)))), 2.0) + (b * b)
angle_m = abs(angle) function code(a, b, angle_m) return Float64((Float64(a * sin(Float64(pi / Float64(180.0 / angle_m)))) ^ 2.0) + Float64(b * b)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = ((a * sin((pi / (180.0 / angle_m)))) ^ 2.0) + (b * b); end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(N[Power[N[(a * N[Sin[N[(Pi / N[(180.0 / angle$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{\left(a \cdot \sin \left(\frac{\pi}{\frac{180}{angle\_m}}\right)\right)}^{2} + b \cdot b
\end{array}
Initial program 81.6%
unpow281.6%
associate-*l/81.7%
associate-/l*81.7%
unpow281.7%
Simplified81.6%
Taylor expanded in angle around 0 81.8%
*-rgt-identity81.8%
unpow281.8%
Applied egg-rr81.8%
associate-*r/81.8%
associate-*l/81.8%
*-commutative81.8%
clear-num81.7%
un-div-inv81.8%
Applied egg-rr81.8%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (* b b) (pow (* a (sin (* angle_m (/ PI 180.0)))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return (b * b) + pow((a * sin((angle_m * (((double) M_PI) / 180.0)))), 2.0);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return (b * b) + Math.pow((a * Math.sin((angle_m * (Math.PI / 180.0)))), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return (b * b) + math.pow((a * math.sin((angle_m * (math.pi / 180.0)))), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) return Float64(Float64(b * b) + (Float64(a * sin(Float64(angle_m * Float64(pi / 180.0)))) ^ 2.0)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = (b * b) + ((a * sin((angle_m * (pi / 180.0)))) ^ 2.0); end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(N[(b * b), $MachinePrecision] + N[Power[N[(a * N[Sin[N[(angle$95$m * N[(Pi / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
b \cdot b + {\left(a \cdot \sin \left(angle\_m \cdot \frac{\pi}{180}\right)\right)}^{2}
\end{array}
Initial program 81.6%
unpow281.6%
associate-*l/81.7%
associate-/l*81.7%
unpow281.7%
Simplified81.6%
Taylor expanded in angle around 0 81.8%
*-rgt-identity81.8%
unpow281.8%
Applied egg-rr81.8%
Final simplification81.8%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (if (<= a 8.8e-17) (* b b) (+ (* b b) (pow (* a (* PI (* angle_m 0.005555555555555556))) 2.0))))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if (a <= 8.8e-17) {
tmp = b * b;
} else {
tmp = (b * b) + pow((a * (((double) M_PI) * (angle_m * 0.005555555555555556))), 2.0);
}
return tmp;
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double tmp;
if (a <= 8.8e-17) {
tmp = b * b;
} else {
tmp = (b * b) + Math.pow((a * (Math.PI * (angle_m * 0.005555555555555556))), 2.0);
}
return tmp;
}
angle_m = math.fabs(angle) def code(a, b, angle_m): tmp = 0 if a <= 8.8e-17: tmp = b * b else: tmp = (b * b) + math.pow((a * (math.pi * (angle_m * 0.005555555555555556))), 2.0) return tmp
angle_m = abs(angle) function code(a, b, angle_m) tmp = 0.0 if (a <= 8.8e-17) tmp = Float64(b * b); else tmp = Float64(Float64(b * b) + (Float64(a * Float64(pi * Float64(angle_m * 0.005555555555555556))) ^ 2.0)); end return tmp end
angle_m = abs(angle); function tmp_2 = code(a, b, angle_m) tmp = 0.0; if (a <= 8.8e-17) tmp = b * b; else tmp = (b * b) + ((a * (pi * (angle_m * 0.005555555555555556))) ^ 2.0); end tmp_2 = tmp; end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := If[LessEqual[a, 8.8e-17], N[(b * b), $MachinePrecision], N[(N[(b * b), $MachinePrecision] + N[Power[N[(a * N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
\mathbf{if}\;a \leq 8.8 \cdot 10^{-17}:\\
\;\;\;\;b \cdot b\\
\mathbf{else}:\\
\;\;\;\;b \cdot b + {\left(a \cdot \left(\pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)\right)\right)}^{2}\\
\end{array}
\end{array}
if a < 8.8e-17Initial program 79.7%
associate-*l/79.8%
clear-num79.7%
Applied egg-rr79.7%
Applied egg-rr77.4%
Taylor expanded in angle around 0 34.2%
*-commutative34.2%
pow-to-exp66.9%
pow266.9%
Applied egg-rr66.9%
if 8.8e-17 < a Initial program 87.9%
unpow287.9%
associate-*l/87.9%
associate-/l*88.0%
unpow288.0%
Simplified87.8%
Taylor expanded in angle around 0 88.1%
*-rgt-identity88.1%
unpow288.1%
Applied egg-rr88.1%
Taylor expanded in angle around 0 84.2%
associate-*r*84.2%
Simplified84.2%
Final simplification70.8%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (if (<= a 1.8e+164) (* b b) (pow (* 0.005555555555555556 (* PI (* a angle_m))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if (a <= 1.8e+164) {
tmp = b * b;
} else {
tmp = pow((0.005555555555555556 * (((double) M_PI) * (a * angle_m))), 2.0);
}
return tmp;
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double tmp;
if (a <= 1.8e+164) {
tmp = b * b;
} else {
tmp = Math.pow((0.005555555555555556 * (Math.PI * (a * angle_m))), 2.0);
}
return tmp;
}
angle_m = math.fabs(angle) def code(a, b, angle_m): tmp = 0 if a <= 1.8e+164: tmp = b * b else: tmp = math.pow((0.005555555555555556 * (math.pi * (a * angle_m))), 2.0) return tmp
angle_m = abs(angle) function code(a, b, angle_m) tmp = 0.0 if (a <= 1.8e+164) tmp = Float64(b * b); else tmp = Float64(0.005555555555555556 * Float64(pi * Float64(a * angle_m))) ^ 2.0; end return tmp end
angle_m = abs(angle); function tmp_2 = code(a, b, angle_m) tmp = 0.0; if (a <= 1.8e+164) tmp = b * b; else tmp = (0.005555555555555556 * (pi * (a * angle_m))) ^ 2.0; end tmp_2 = tmp; end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := If[LessEqual[a, 1.8e+164], N[(b * b), $MachinePrecision], N[Power[N[(0.005555555555555556 * N[(Pi * N[(a * angle$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
\mathbf{if}\;a \leq 1.8 \cdot 10^{+164}:\\
\;\;\;\;b \cdot b\\
\mathbf{else}:\\
\;\;\;\;{\left(0.005555555555555556 \cdot \left(\pi \cdot \left(a \cdot angle\_m\right)\right)\right)}^{2}\\
\end{array}
\end{array}
if a < 1.79999999999999995e164Initial program 79.4%
associate-*l/79.5%
clear-num79.4%
Applied egg-rr79.4%
Applied egg-rr77.0%
Taylor expanded in angle around 0 31.2%
*-commutative31.2%
pow-to-exp64.1%
pow264.1%
Applied egg-rr64.1%
if 1.79999999999999995e164 < a Initial program 99.7%
unpow299.7%
associate-*l/99.7%
associate-/l*99.7%
unpow299.7%
Simplified99.7%
Taylor expanded in a around inf 72.0%
unpow272.0%
*-commutative72.0%
associate-*r*72.0%
unpow272.0%
swap-sqr96.3%
unpow296.3%
associate-*r*96.3%
*-commutative96.3%
Simplified96.3%
add-cbrt-cube32.9%
pow1/311.5%
pow311.5%
Applied egg-rr11.5%
Taylor expanded in angle around 0 96.2%
associate-*r*96.2%
*-commutative96.2%
*-commutative96.2%
Simplified96.2%
Final simplification67.6%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (* b b))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return b * b;
}
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 = b * b
end function
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return b * b;
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return b * b
angle_m = abs(angle) function code(a, b, angle_m) return Float64(b * b) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = b * b; end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(b * b), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
b \cdot b
\end{array}
Initial program 81.6%
associate-*l/81.7%
clear-num81.6%
Applied egg-rr81.6%
Applied egg-rr79.3%
Taylor expanded in angle around 0 28.0%
*-commutative28.0%
pow-to-exp59.0%
pow259.0%
Applied egg-rr59.0%
herbie shell --seed 2024152
(FPCore (a b angle)
:name "ab-angle->ABCF A"
:precision binary64
(+ (pow (* a (sin (* (/ angle 180.0) PI))) 2.0) (pow (* b (cos (* (/ angle 180.0) PI))) 2.0)))