
(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 11 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 (+ (pow (* a (cos (pow (sqrt (* PI (* angle_m 0.005555555555555556))) 2.0))) 2.0) (pow (* b (sin (* (cbrt (pow PI 3.0)) (/ angle_m 180.0)))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow((a * cos(pow(sqrt((((double) M_PI) * (angle_m * 0.005555555555555556))), 2.0))), 2.0) + pow((b * sin((cbrt(pow(((double) M_PI), 3.0)) * (angle_m / 180.0)))), 2.0);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return Math.pow((a * Math.cos(Math.pow(Math.sqrt((Math.PI * (angle_m * 0.005555555555555556))), 2.0))), 2.0) + Math.pow((b * Math.sin((Math.cbrt(Math.pow(Math.PI, 3.0)) * (angle_m / 180.0)))), 2.0);
}
angle_m = abs(angle) function code(a, b, angle_m) return Float64((Float64(a * cos((sqrt(Float64(pi * Float64(angle_m * 0.005555555555555556))) ^ 2.0))) ^ 2.0) + (Float64(b * sin(Float64(cbrt((pi ^ 3.0)) * Float64(angle_m / 180.0)))) ^ 2.0)) end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(N[Power[N[(a * N[Cos[N[Power[N[Sqrt[N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[N[(N[Power[N[Power[Pi, 3.0], $MachinePrecision], 1/3], $MachinePrecision] * N[(angle$95$m / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{\left(a \cdot \cos \left({\left(\sqrt{\pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)}\right)}^{2}\right)\right)}^{2} + {\left(b \cdot \sin \left(\sqrt[3]{{\pi}^{3}} \cdot \frac{angle\_m}{180}\right)\right)}^{2}
\end{array}
Initial program 82.1%
clear-num82.1%
un-div-inv82.2%
Applied egg-rr82.2%
clear-num82.2%
associate-/r*82.1%
add-sqr-sqrt41.5%
pow241.5%
pow141.5%
pow141.5%
clear-num41.1%
*-commutative41.1%
associate-/l*41.1%
div-inv41.1%
metadata-eval41.1%
Applied egg-rr41.1%
add-cbrt-cube41.2%
pow341.2%
Applied egg-rr41.2%
Final simplification41.2%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow (* b (sin (* PI (/ angle_m 180.0)))) 2.0) (pow (* a (cos (* 0.005555555555555556 (* PI angle_m)))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow((b * sin((((double) M_PI) * (angle_m / 180.0)))), 2.0) + pow((a * cos((0.005555555555555556 * (((double) M_PI) * angle_m)))), 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 / 180.0)))), 2.0) + Math.pow((a * Math.cos((0.005555555555555556 * (Math.PI * angle_m)))), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow((b * math.sin((math.pi * (angle_m / 180.0)))), 2.0) + math.pow((a * math.cos((0.005555555555555556 * (math.pi * angle_m)))), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) return Float64((Float64(b * sin(Float64(pi * Float64(angle_m / 180.0)))) ^ 2.0) + (Float64(a * cos(Float64(0.005555555555555556 * Float64(pi * angle_m)))) ^ 2.0)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = ((b * sin((pi * (angle_m / 180.0)))) ^ 2.0) + ((a * cos((0.005555555555555556 * (pi * angle_m)))) ^ 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 / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(a * N[Cos[N[(0.005555555555555556 * N[(Pi * angle$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{\left(b \cdot \sin \left(\pi \cdot \frac{angle\_m}{180}\right)\right)}^{2} + {\left(a \cdot \cos \left(0.005555555555555556 \cdot \left(\pi \cdot angle\_m\right)\right)\right)}^{2}
\end{array}
Initial program 82.1%
Taylor expanded in angle around inf 82.1%
Final simplification82.1%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (let* ((t_0 (* angle_m (/ PI -180.0)))) (+ (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 = angle_m * (((double) M_PI) / -180.0);
return pow((a * cos(t_0)), 2.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 = angle_m * (Math.PI / -180.0);
return Math.pow((a * Math.cos(t_0)), 2.0) + Math.pow((b * Math.sin(t_0)), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): t_0 = angle_m * (math.pi / -180.0) return math.pow((a * math.cos(t_0)), 2.0) + math.pow((b * math.sin(t_0)), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) t_0 = Float64(angle_m * Float64(pi / -180.0)) return Float64((Float64(a * cos(t_0)) ^ 2.0) + (Float64(b * sin(t_0)) ^ 2.0)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) t_0 = angle_m * (pi / -180.0); tmp = ((a * cos(t_0)) ^ 2.0) + ((b * sin(t_0)) ^ 2.0); end
angle_m = N[Abs[angle], $MachinePrecision]
code[a_, b_, angle$95$m_] := Block[{t$95$0 = N[(angle$95$m * N[(Pi / -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}
angle_m = \left|angle\right|
\\
\begin{array}{l}
t_0 := angle\_m \cdot \frac{\pi}{-180}\\
{\left(a \cdot \cos t\_0\right)}^{2} + {\left(b \cdot \sin t\_0\right)}^{2}
\end{array}
\end{array}
Initial program 82.1%
Simplified82.1%
Final simplification82.1%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow (* a (cos (* PI (/ angle_m 180.0)))) 2.0) (pow (* b (sin (* PI (* angle_m 0.005555555555555556)))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow((a * cos((((double) M_PI) * (angle_m / 180.0)))), 2.0) + pow((b * sin((((double) M_PI) * (angle_m * 0.005555555555555556)))), 2.0);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return Math.pow((a * Math.cos((Math.PI * (angle_m / 180.0)))), 2.0) + Math.pow((b * Math.sin((Math.PI * (angle_m * 0.005555555555555556)))), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow((a * math.cos((math.pi * (angle_m / 180.0)))), 2.0) + math.pow((b * math.sin((math.pi * (angle_m * 0.005555555555555556)))), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) return Float64((Float64(a * cos(Float64(pi * Float64(angle_m / 180.0)))) ^ 2.0) + (Float64(b * sin(Float64(pi * Float64(angle_m * 0.005555555555555556)))) ^ 2.0)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = ((a * cos((pi * (angle_m / 180.0)))) ^ 2.0) + ((b * sin((pi * (angle_m * 0.005555555555555556)))) ^ 2.0); end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(N[Power[N[(a * N[Cos[N[(Pi * N[(angle$95$m / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{\left(a \cdot \cos \left(\pi \cdot \frac{angle\_m}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)\right)\right)}^{2}
\end{array}
Initial program 82.1%
Taylor expanded in angle around inf 82.1%
*-commutative82.1%
*-commutative82.1%
associate-*l*82.1%
Simplified82.1%
Final simplification82.1%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow (* a (cos (/ PI (/ 180.0 angle_m)))) 2.0) (pow (* b (sin (* PI (/ angle_m 180.0)))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow((a * cos((((double) M_PI) / (180.0 / angle_m)))), 2.0) + pow((b * sin((((double) M_PI) * (angle_m / 180.0)))), 2.0);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return Math.pow((a * Math.cos((Math.PI / (180.0 / angle_m)))), 2.0) + Math.pow((b * Math.sin((Math.PI * (angle_m / 180.0)))), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow((a * math.cos((math.pi / (180.0 / angle_m)))), 2.0) + math.pow((b * math.sin((math.pi * (angle_m / 180.0)))), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) return Float64((Float64(a * cos(Float64(pi / Float64(180.0 / angle_m)))) ^ 2.0) + (Float64(b * sin(Float64(pi * Float64(angle_m / 180.0)))) ^ 2.0)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = ((a * cos((pi / (180.0 / angle_m)))) ^ 2.0) + ((b * sin((pi * (angle_m / 180.0)))) ^ 2.0); end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(N[Power[N[(a * N[Cos[N[(Pi / N[(180.0 / angle$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[N[(Pi * N[(angle$95$m / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{\left(a \cdot \cos \left(\frac{\pi}{\frac{180}{angle\_m}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle\_m}{180}\right)\right)}^{2}
\end{array}
Initial program 82.1%
clear-num82.1%
un-div-inv82.2%
Applied egg-rr82.2%
Final simplification82.2%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow (* b (sin (* angle_m (/ PI -180.0)))) 2.0) (pow a 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow((b * sin((angle_m * (((double) M_PI) / -180.0)))), 2.0) + pow(a, 2.0);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return Math.pow((b * Math.sin((angle_m * (Math.PI / -180.0)))), 2.0) + Math.pow(a, 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow((b * math.sin((angle_m * (math.pi / -180.0)))), 2.0) + math.pow(a, 2.0)
angle_m = abs(angle) function code(a, b, angle_m) return Float64((Float64(b * sin(Float64(angle_m * Float64(pi / -180.0)))) ^ 2.0) + (a ^ 2.0)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = ((b * sin((angle_m * (pi / -180.0)))) ^ 2.0) + (a ^ 2.0); end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(N[Power[N[(b * N[Sin[N[(angle$95$m * N[(Pi / -180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{\left(b \cdot \sin \left(angle\_m \cdot \frac{\pi}{-180}\right)\right)}^{2} + {a}^{2}
\end{array}
Initial program 82.1%
Simplified82.1%
Taylor expanded in angle around 0 77.3%
Taylor expanded in angle around 0 81.5%
Final simplification81.5%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow (* b (sin (* PI (/ angle_m 180.0)))) 2.0) (pow a 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow((b * sin((((double) M_PI) * (angle_m / 180.0)))), 2.0) + pow(a, 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 / 180.0)))), 2.0) + Math.pow(a, 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow((b * math.sin((math.pi * (angle_m / 180.0)))), 2.0) + math.pow(a, 2.0)
angle_m = abs(angle) function code(a, b, angle_m) return Float64((Float64(b * sin(Float64(pi * Float64(angle_m / 180.0)))) ^ 2.0) + (a ^ 2.0)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = ((b * sin((pi * (angle_m / 180.0)))) ^ 2.0) + (a ^ 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 / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{\left(b \cdot \sin \left(\pi \cdot \frac{angle\_m}{180}\right)\right)}^{2} + {a}^{2}
\end{array}
Initial program 82.1%
clear-num82.1%
un-div-inv82.2%
Applied egg-rr82.2%
clear-num82.2%
associate-/r*82.1%
add-sqr-sqrt41.5%
pow241.5%
pow141.5%
pow141.5%
clear-num41.1%
*-commutative41.1%
associate-/l*41.1%
div-inv41.1%
metadata-eval41.1%
Applied egg-rr41.1%
Taylor expanded in angle around 0 81.6%
Final simplification81.6%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow (* b (sin (* PI (* angle_m -0.005555555555555556)))) 2.0) (pow a 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) + pow(a, 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) + Math.pow(a, 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) + math.pow(a, 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) + (a ^ 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 ^ 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[Power[a, 2.0], $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}^{2}
\end{array}
Initial program 82.1%
Simplified82.1%
Taylor expanded in angle around 0 81.5%
Taylor expanded in angle around 0 81.5%
associate-*r*81.6%
*-commutative81.6%
*-commutative81.6%
Simplified81.6%
Final simplification81.6%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (if (<= b 4e-52) (pow a 2.0) (+ (pow a 2.0) (* 3.08641975308642e-5 (pow (* angle_m (* PI b)) 2.0)))))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if (b <= 4e-52) {
tmp = pow(a, 2.0);
} else {
tmp = pow(a, 2.0) + (3.08641975308642e-5 * pow((angle_m * (((double) M_PI) * b)), 2.0));
}
return tmp;
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double tmp;
if (b <= 4e-52) {
tmp = Math.pow(a, 2.0);
} else {
tmp = Math.pow(a, 2.0) + (3.08641975308642e-5 * Math.pow((angle_m * (Math.PI * b)), 2.0));
}
return tmp;
}
angle_m = math.fabs(angle) def code(a, b, angle_m): tmp = 0 if b <= 4e-52: tmp = math.pow(a, 2.0) else: tmp = math.pow(a, 2.0) + (3.08641975308642e-5 * math.pow((angle_m * (math.pi * b)), 2.0)) return tmp
angle_m = abs(angle) function code(a, b, angle_m) tmp = 0.0 if (b <= 4e-52) tmp = a ^ 2.0; else tmp = Float64((a ^ 2.0) + Float64(3.08641975308642e-5 * (Float64(angle_m * Float64(pi * b)) ^ 2.0))); end return tmp end
angle_m = abs(angle); function tmp_2 = code(a, b, angle_m) tmp = 0.0; if (b <= 4e-52) tmp = a ^ 2.0; else tmp = (a ^ 2.0) + (3.08641975308642e-5 * ((angle_m * (pi * b)) ^ 2.0)); end tmp_2 = tmp; end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := If[LessEqual[b, 4e-52], N[Power[a, 2.0], $MachinePrecision], N[(N[Power[a, 2.0], $MachinePrecision] + N[(3.08641975308642e-5 * N[Power[N[(angle$95$m * N[(Pi * b), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
\mathbf{if}\;b \leq 4 \cdot 10^{-52}:\\
\;\;\;\;{a}^{2}\\
\mathbf{else}:\\
\;\;\;\;{a}^{2} + 3.08641975308642 \cdot 10^{-5} \cdot {\left(angle\_m \cdot \left(\pi \cdot b\right)\right)}^{2}\\
\end{array}
\end{array}
if b < 4e-52Initial program 79.3%
Simplified79.3%
Taylor expanded in angle around 0 78.4%
Taylor expanded in angle around 0 73.7%
unpow273.7%
*-commutative73.7%
associate-*l*73.7%
*-commutative73.7%
associate-*l*73.7%
add-sqr-sqrt45.8%
sqrt-prod60.1%
unpow260.1%
unpow-prod-down60.1%
sqrt-prod60.1%
metadata-eval60.1%
metadata-eval60.1%
pow260.1%
sqrt-unprod31.6%
add-sqr-sqrt50.9%
*-commutative50.9%
associate-*l*50.9%
Applied egg-rr50.9%
associate-*l*50.3%
*-commutative50.3%
associate-*r*50.3%
metadata-eval50.3%
*-commutative50.3%
Simplified50.3%
Taylor expanded in a around inf 60.2%
if 4e-52 < b Initial program 88.6%
Simplified88.6%
Taylor expanded in angle around 0 88.8%
Taylor expanded in angle around 0 86.4%
Taylor expanded in angle around 0 71.2%
*-commutative71.2%
*-commutative71.2%
unpow271.2%
unpow271.2%
swap-sqr71.3%
unpow271.3%
swap-sqr86.4%
*-commutative86.4%
associate-*r*86.4%
*-commutative86.4%
associate-*r*86.4%
unpow286.4%
associate-*r*86.4%
*-commutative86.4%
*-commutative86.4%
Simplified86.4%
Final simplification68.1%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (let* ((t_0 (* 0.005555555555555556 (* b (* PI angle_m))))) (if (<= b 7.2e-53) (pow a 2.0) (+ (pow a 2.0) (* t_0 t_0)))))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double t_0 = 0.005555555555555556 * (b * (((double) M_PI) * angle_m));
double tmp;
if (b <= 7.2e-53) {
tmp = pow(a, 2.0);
} else {
tmp = pow(a, 2.0) + (t_0 * t_0);
}
return tmp;
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double t_0 = 0.005555555555555556 * (b * (Math.PI * angle_m));
double tmp;
if (b <= 7.2e-53) {
tmp = Math.pow(a, 2.0);
} else {
tmp = Math.pow(a, 2.0) + (t_0 * t_0);
}
return tmp;
}
angle_m = math.fabs(angle) def code(a, b, angle_m): t_0 = 0.005555555555555556 * (b * (math.pi * angle_m)) tmp = 0 if b <= 7.2e-53: tmp = math.pow(a, 2.0) else: tmp = math.pow(a, 2.0) + (t_0 * t_0) return tmp
angle_m = abs(angle) function code(a, b, angle_m) t_0 = Float64(0.005555555555555556 * Float64(b * Float64(pi * angle_m))) tmp = 0.0 if (b <= 7.2e-53) tmp = a ^ 2.0; else tmp = Float64((a ^ 2.0) + Float64(t_0 * t_0)); end return tmp end
angle_m = abs(angle); function tmp_2 = code(a, b, angle_m) t_0 = 0.005555555555555556 * (b * (pi * angle_m)); tmp = 0.0; if (b <= 7.2e-53) tmp = a ^ 2.0; else tmp = (a ^ 2.0) + (t_0 * t_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[(b * N[(Pi * angle$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 7.2e-53], N[Power[a, 2.0], $MachinePrecision], N[(N[Power[a, 2.0], $MachinePrecision] + N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
t_0 := 0.005555555555555556 \cdot \left(b \cdot \left(\pi \cdot angle\_m\right)\right)\\
\mathbf{if}\;b \leq 7.2 \cdot 10^{-53}:\\
\;\;\;\;{a}^{2}\\
\mathbf{else}:\\
\;\;\;\;{a}^{2} + t\_0 \cdot t\_0\\
\end{array}
\end{array}
if b < 7.1999999999999998e-53Initial program 79.3%
Simplified79.3%
Taylor expanded in angle around 0 78.4%
Taylor expanded in angle around 0 73.7%
unpow273.7%
*-commutative73.7%
associate-*l*73.7%
*-commutative73.7%
associate-*l*73.7%
add-sqr-sqrt45.8%
sqrt-prod60.1%
unpow260.1%
unpow-prod-down60.1%
sqrt-prod60.1%
metadata-eval60.1%
metadata-eval60.1%
pow260.1%
sqrt-unprod31.6%
add-sqr-sqrt50.9%
*-commutative50.9%
associate-*l*50.9%
Applied egg-rr50.9%
associate-*l*50.3%
*-commutative50.3%
associate-*r*50.3%
metadata-eval50.3%
*-commutative50.3%
Simplified50.3%
Taylor expanded in a around inf 60.2%
if 7.1999999999999998e-53 < b Initial program 88.6%
Simplified88.6%
Taylor expanded in angle around 0 88.8%
Taylor expanded in angle around 0 86.4%
unpow-prod-down86.4%
add-sqr-sqrt86.4%
sqrt-prod86.4%
metadata-eval86.4%
metadata-eval86.4%
pow286.4%
sqrt-unprod50.7%
add-sqr-sqrt69.0%
*-commutative69.0%
associate-*l*69.0%
sqrt-prod69.0%
metadata-eval69.0%
metadata-eval69.0%
pow269.0%
sqrt-unprod50.8%
add-sqr-sqrt86.4%
*-commutative86.4%
associate-*l*86.4%
Applied egg-rr86.4%
Final simplification68.1%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (pow a 2.0))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow(a, 2.0);
}
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 ** 2.0d0
end function
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return Math.pow(a, 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow(a, 2.0)
angle_m = abs(angle) function code(a, b, angle_m) return a ^ 2.0 end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = a ^ 2.0; end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[Power[a, 2.0], $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{a}^{2}
\end{array}
Initial program 82.1%
Simplified82.1%
Taylor expanded in angle around 0 81.5%
Taylor expanded in angle around 0 77.5%
unpow277.5%
*-commutative77.5%
associate-*l*77.5%
*-commutative77.5%
associate-*l*77.6%
add-sqr-sqrt42.7%
sqrt-prod57.9%
unpow257.9%
unpow-prod-down57.9%
sqrt-prod57.9%
metadata-eval57.9%
metadata-eval57.9%
pow257.9%
sqrt-unprod27.2%
add-sqr-sqrt46.2%
*-commutative46.2%
associate-*l*46.2%
Applied egg-rr46.2%
associate-*l*45.8%
*-commutative45.8%
associate-*r*45.8%
metadata-eval45.8%
*-commutative45.8%
Simplified45.8%
Taylor expanded in a around inf 58.1%
Final simplification58.1%
herbie shell --seed 2024039
(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)))