
(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}
(FPCore (a b angle) :precision binary64 (+ (pow (* a (cos (* PI (/ angle 180.0)))) 2.0) (pow (* b (sin (* PI (* angle -0.005555555555555556)))) 2.0)))
double code(double a, double b, double angle) {
return pow((a * cos((((double) M_PI) * (angle / 180.0)))), 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 * Math.cos((Math.PI * (angle / 180.0)))), 2.0) + Math.pow((b * Math.sin((Math.PI * (angle * -0.005555555555555556)))), 2.0);
}
def code(a, b, angle): return math.pow((a * math.cos((math.pi * (angle / 180.0)))), 2.0) + math.pow((b * math.sin((math.pi * (angle * -0.005555555555555556)))), 2.0)
function code(a, b, angle) return Float64((Float64(a * cos(Float64(pi * Float64(angle / 180.0)))) ^ 2.0) + (Float64(b * sin(Float64(pi * Float64(angle * -0.005555555555555556)))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((a * cos((pi * (angle / 180.0)))) ^ 2.0) + ((b * sin((pi * (angle * -0.005555555555555556)))) ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Cos[N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 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}
\\
{\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot -0.005555555555555556\right)\right)\right)}^{2}
\end{array}
Initial program 81.1%
unpow281.1%
swap-sqr72.4%
sqr-neg72.4%
swap-sqr81.1%
unpow281.1%
distribute-lft-neg-out81.1%
distribute-rgt-neg-in81.1%
sin-neg81.1%
distribute-rgt-neg-out81.1%
distribute-frac-neg81.1%
unpow281.1%
associate-*l*80.0%
Simplified81.2%
Final simplification81.2%
(FPCore (a b angle) :precision binary64 (+ (pow (* b (sin (* PI (/ angle 180.0)))) 2.0) (pow (* a (cos (* 0.005555555555555556 (* PI angle)))) 2.0)))
double code(double a, double b, double angle) {
return pow((b * sin((((double) M_PI) * (angle / 180.0)))), 2.0) + pow((a * 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 * (angle / 180.0)))), 2.0) + Math.pow((a * Math.cos((0.005555555555555556 * (Math.PI * angle)))), 2.0);
}
def code(a, b, angle): return math.pow((b * math.sin((math.pi * (angle / 180.0)))), 2.0) + math.pow((a * math.cos((0.005555555555555556 * (math.pi * angle)))), 2.0)
function code(a, b, angle) return Float64((Float64(b * sin(Float64(pi * Float64(angle / 180.0)))) ^ 2.0) + (Float64(a * cos(Float64(0.005555555555555556 * Float64(pi * angle)))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((b * sin((pi * (angle / 180.0)))) ^ 2.0) + ((a * cos((0.005555555555555556 * (pi * angle)))) ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(b * N[Sin[N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(a * N[Cos[N[(0.005555555555555556 * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(a \cdot \cos \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)\right)}^{2}
\end{array}
Initial program 81.1%
Taylor expanded in angle around inf 81.0%
Final simplification81.0%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (cos (* angle (/ PI 180.0)))) 2.0) (pow (* b (sin (* PI (/ angle 180.0)))) 2.0)))
double code(double a, double b, double angle) {
return pow((a * cos((angle * (((double) M_PI) / 180.0)))), 2.0) + pow((b * sin((((double) M_PI) * (angle / 180.0)))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.cos((angle * (Math.PI / 180.0)))), 2.0) + Math.pow((b * Math.sin((Math.PI * (angle / 180.0)))), 2.0);
}
def code(a, b, angle): return math.pow((a * math.cos((angle * (math.pi / 180.0)))), 2.0) + math.pow((b * math.sin((math.pi * (angle / 180.0)))), 2.0)
function code(a, b, angle) return Float64((Float64(a * cos(Float64(angle * Float64(pi / 180.0)))) ^ 2.0) + (Float64(b * sin(Float64(pi * Float64(angle / 180.0)))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((a * cos((angle * (pi / 180.0)))) ^ 2.0) + ((b * sin((pi * (angle / 180.0)))) ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Cos[N[(angle * N[(Pi / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \cos \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2}
\end{array}
Initial program 81.1%
Taylor expanded in angle around inf 81.0%
*-commutative81.0%
associate-*r*81.0%
metadata-eval81.0%
associate-/r/81.0%
associate-*l/81.0%
*-lft-identity81.0%
associate-/l*81.0%
associate-*r/81.0%
Simplified81.0%
Final simplification81.0%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (cos (* PI (/ angle 180.0)))) 2.0) (pow (* b (sin (* angle (/ PI 180.0)))) 2.0)))
double code(double a, double b, double angle) {
return pow((a * cos((((double) M_PI) * (angle / 180.0)))), 2.0) + pow((b * sin((angle * (((double) M_PI) / 180.0)))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.cos((Math.PI * (angle / 180.0)))), 2.0) + Math.pow((b * Math.sin((angle * (Math.PI / 180.0)))), 2.0);
}
def code(a, b, angle): return math.pow((a * math.cos((math.pi * (angle / 180.0)))), 2.0) + math.pow((b * math.sin((angle * (math.pi / 180.0)))), 2.0)
function code(a, b, angle) return Float64((Float64(a * cos(Float64(pi * Float64(angle / 180.0)))) ^ 2.0) + (Float64(b * sin(Float64(angle * Float64(pi / 180.0)))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((a * cos((pi * (angle / 180.0)))) ^ 2.0) + ((b * sin((angle * (pi / 180.0)))) ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Cos[N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[N[(angle * N[(Pi / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2}
\end{array}
Initial program 81.1%
unpow281.1%
swap-sqr72.4%
sqr-neg72.4%
swap-sqr81.1%
unpow281.1%
distribute-lft-neg-out81.1%
distribute-rgt-neg-in81.1%
sin-neg81.1%
distribute-rgt-neg-out81.1%
distribute-frac-neg81.1%
unpow281.1%
associate-*l*80.0%
Simplified81.2%
Taylor expanded in angle around inf 81.1%
associate-*r*80.6%
*-commutative80.6%
*-commutative80.6%
unpow180.6%
sqr-pow38.7%
fabs-sqr38.7%
sqr-pow80.6%
unpow180.6%
associate-*r*80.5%
*-commutative80.5%
associate-*r*80.5%
fabs-mul80.5%
fabs-mul80.5%
metadata-eval80.5%
unpow180.5%
sqr-pow80.3%
fabs-sqr80.3%
sqr-pow80.5%
unpow180.5%
unpow180.5%
sqr-pow41.7%
fabs-sqr41.7%
sqr-pow80.5%
unpow180.5%
Simplified81.1%
Final simplification81.1%
(FPCore (a b angle) :precision binary64 (+ (pow (* b (sin (* angle (/ PI 180.0)))) 2.0) (pow a 2.0)))
double code(double a, double b, double angle) {
return pow((b * sin((angle * (((double) M_PI) / 180.0)))), 2.0) + pow(a, 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((b * Math.sin((angle * (Math.PI / 180.0)))), 2.0) + Math.pow(a, 2.0);
}
def code(a, b, angle): return math.pow((b * math.sin((angle * (math.pi / 180.0)))), 2.0) + math.pow(a, 2.0)
function code(a, b, angle) return Float64((Float64(b * sin(Float64(angle * Float64(pi / 180.0)))) ^ 2.0) + (a ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((b * sin((angle * (pi / 180.0)))) ^ 2.0) + (a ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(b * N[Sin[N[(angle * N[(Pi / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(b \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {a}^{2}
\end{array}
Initial program 81.1%
unpow281.1%
swap-sqr72.4%
sqr-neg72.4%
swap-sqr81.1%
unpow281.1%
distribute-lft-neg-out81.1%
distribute-rgt-neg-in81.1%
sin-neg81.1%
distribute-rgt-neg-out81.1%
distribute-frac-neg81.1%
unpow281.1%
associate-*l*80.0%
Simplified81.2%
Taylor expanded in angle around 0 80.6%
Taylor expanded in angle around inf 80.5%
associate-*r*80.6%
*-commutative80.6%
*-commutative80.6%
unpow180.6%
sqr-pow38.7%
fabs-sqr38.7%
sqr-pow80.6%
unpow180.6%
associate-*r*80.5%
*-commutative80.5%
associate-*r*80.5%
fabs-mul80.5%
fabs-mul80.5%
metadata-eval80.5%
unpow180.5%
sqr-pow80.3%
fabs-sqr80.3%
sqr-pow80.5%
unpow180.5%
unpow180.5%
sqr-pow41.7%
fabs-sqr41.7%
sqr-pow80.5%
unpow180.5%
Simplified80.5%
Final simplification80.5%
(FPCore (a b angle) :precision binary64 (+ (pow (* b (sin (* PI (* angle -0.005555555555555556)))) 2.0) (pow a 2.0)))
double code(double a, double b, double angle) {
return pow((b * sin((((double) M_PI) * (angle * -0.005555555555555556)))), 2.0) + pow(a, 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((b * Math.sin((Math.PI * (angle * -0.005555555555555556)))), 2.0) + Math.pow(a, 2.0);
}
def code(a, b, angle): return math.pow((b * math.sin((math.pi * (angle * -0.005555555555555556)))), 2.0) + math.pow(a, 2.0)
function code(a, b, angle) return Float64((Float64(b * sin(Float64(pi * Float64(angle * -0.005555555555555556)))) ^ 2.0) + (a ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((b * sin((pi * (angle * -0.005555555555555556)))) ^ 2.0) + (a ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(b * N[Sin[N[(Pi * N[(angle * -0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot -0.005555555555555556\right)\right)\right)}^{2} + {a}^{2}
\end{array}
Initial program 81.1%
unpow281.1%
swap-sqr72.4%
sqr-neg72.4%
swap-sqr81.1%
unpow281.1%
distribute-lft-neg-out81.1%
distribute-rgt-neg-in81.1%
sin-neg81.1%
distribute-rgt-neg-out81.1%
distribute-frac-neg81.1%
unpow281.1%
associate-*l*80.0%
Simplified81.2%
Taylor expanded in angle around 0 80.6%
Final simplification80.6%
(FPCore (a b angle) :precision binary64 (if (<= b 1.1e-112) (* a a) (+ (pow a 2.0) (pow (* b (* angle (/ PI 180.0))) 2.0))))
double code(double a, double b, double angle) {
double tmp;
if (b <= 1.1e-112) {
tmp = a * a;
} else {
tmp = pow(a, 2.0) + pow((b * (angle * (((double) M_PI) / 180.0))), 2.0);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (b <= 1.1e-112) {
tmp = a * a;
} else {
tmp = Math.pow(a, 2.0) + Math.pow((b * (angle * (Math.PI / 180.0))), 2.0);
}
return tmp;
}
def code(a, b, angle): tmp = 0 if b <= 1.1e-112: tmp = a * a else: tmp = math.pow(a, 2.0) + math.pow((b * (angle * (math.pi / 180.0))), 2.0) return tmp
function code(a, b, angle) tmp = 0.0 if (b <= 1.1e-112) tmp = Float64(a * a); else tmp = Float64((a ^ 2.0) + (Float64(b * Float64(angle * Float64(pi / 180.0))) ^ 2.0)); end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (b <= 1.1e-112) tmp = a * a; else tmp = (a ^ 2.0) + ((b * (angle * (pi / 180.0))) ^ 2.0); end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[b, 1.1e-112], N[(a * a), $MachinePrecision], N[(N[Power[a, 2.0], $MachinePrecision] + N[Power[N[(b * N[(angle * N[(Pi / 180.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.1 \cdot 10^{-112}:\\
\;\;\;\;a \cdot a\\
\mathbf{else}:\\
\;\;\;\;{a}^{2} + {\left(b \cdot \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2}\\
\end{array}
\end{array}
if b < 1.10000000000000011e-112Initial program 81.2%
unpow281.2%
swap-sqr76.6%
sqr-neg76.6%
swap-sqr81.2%
unpow281.2%
distribute-lft-neg-out81.2%
distribute-rgt-neg-in81.2%
sin-neg81.2%
distribute-rgt-neg-out81.2%
distribute-frac-neg81.2%
unpow281.2%
associate-*l*80.8%
Simplified81.2%
Taylor expanded in angle around 0 80.8%
Taylor expanded in angle around 0 75.6%
associate-*r*75.6%
*-commutative75.6%
*-commutative75.6%
unpow175.6%
sqr-pow36.2%
fabs-sqr36.2%
sqr-pow75.6%
unpow175.6%
associate-*r*75.6%
*-commutative75.6%
associate-*r*75.6%
fabs-mul75.6%
fabs-mul75.6%
metadata-eval75.6%
unpow175.6%
sqr-pow75.5%
fabs-sqr75.5%
sqr-pow75.6%
unpow175.6%
unpow175.6%
sqr-pow39.4%
fabs-sqr39.4%
sqr-pow75.6%
unpow175.6%
Simplified75.6%
Taylor expanded in a around inf 65.2%
unpow265.2%
Simplified65.2%
if 1.10000000000000011e-112 < b Initial program 80.7%
unpow280.7%
swap-sqr61.1%
sqr-neg61.1%
swap-sqr80.7%
unpow280.7%
distribute-lft-neg-out80.7%
distribute-rgt-neg-in80.7%
sin-neg80.7%
distribute-rgt-neg-out80.7%
distribute-frac-neg80.7%
unpow280.7%
associate-*l*78.1%
Simplified80.9%
Taylor expanded in angle around 0 80.0%
Taylor expanded in angle around 0 75.1%
associate-*r*75.2%
*-commutative75.2%
*-commutative75.2%
unpow175.2%
sqr-pow35.3%
fabs-sqr35.3%
sqr-pow75.2%
unpow175.2%
associate-*r*75.1%
*-commutative75.1%
associate-*r*75.2%
fabs-mul75.2%
fabs-mul75.2%
metadata-eval75.2%
unpow175.2%
sqr-pow74.9%
fabs-sqr74.9%
sqr-pow75.2%
unpow175.2%
unpow175.2%
sqr-pow39.8%
fabs-sqr39.8%
sqr-pow75.2%
unpow175.2%
Simplified75.2%
Final simplification68.0%
(FPCore (a b angle) :precision binary64 (if (<= b 4.8e-112) (* a a) (+ (pow a 2.0) (pow (* b (* PI (* angle -0.005555555555555556))) 2.0))))
double code(double a, double b, double angle) {
double tmp;
if (b <= 4.8e-112) {
tmp = a * a;
} else {
tmp = pow(a, 2.0) + pow((b * (((double) M_PI) * (angle * -0.005555555555555556))), 2.0);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (b <= 4.8e-112) {
tmp = a * a;
} else {
tmp = Math.pow(a, 2.0) + Math.pow((b * (Math.PI * (angle * -0.005555555555555556))), 2.0);
}
return tmp;
}
def code(a, b, angle): tmp = 0 if b <= 4.8e-112: tmp = a * a else: tmp = math.pow(a, 2.0) + math.pow((b * (math.pi * (angle * -0.005555555555555556))), 2.0) return tmp
function code(a, b, angle) tmp = 0.0 if (b <= 4.8e-112) tmp = Float64(a * a); else tmp = Float64((a ^ 2.0) + (Float64(b * Float64(pi * Float64(angle * -0.005555555555555556))) ^ 2.0)); end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (b <= 4.8e-112) tmp = a * a; else tmp = (a ^ 2.0) + ((b * (pi * (angle * -0.005555555555555556))) ^ 2.0); end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[b, 4.8e-112], N[(a * a), $MachinePrecision], N[(N[Power[a, 2.0], $MachinePrecision] + N[Power[N[(b * N[(Pi * N[(angle * -0.005555555555555556), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 4.8 \cdot 10^{-112}:\\
\;\;\;\;a \cdot a\\
\mathbf{else}:\\
\;\;\;\;{a}^{2} + {\left(b \cdot \left(\pi \cdot \left(angle \cdot -0.005555555555555556\right)\right)\right)}^{2}\\
\end{array}
\end{array}
if b < 4.8000000000000001e-112Initial program 81.2%
unpow281.2%
swap-sqr76.6%
sqr-neg76.6%
swap-sqr81.2%
unpow281.2%
distribute-lft-neg-out81.2%
distribute-rgt-neg-in81.2%
sin-neg81.2%
distribute-rgt-neg-out81.2%
distribute-frac-neg81.2%
unpow281.2%
associate-*l*80.8%
Simplified81.2%
Taylor expanded in angle around 0 80.8%
Taylor expanded in angle around 0 75.6%
associate-*r*75.6%
*-commutative75.6%
*-commutative75.6%
unpow175.6%
sqr-pow36.2%
fabs-sqr36.2%
sqr-pow75.6%
unpow175.6%
associate-*r*75.6%
*-commutative75.6%
associate-*r*75.6%
fabs-mul75.6%
fabs-mul75.6%
metadata-eval75.6%
unpow175.6%
sqr-pow75.5%
fabs-sqr75.5%
sqr-pow75.6%
unpow175.6%
unpow175.6%
sqr-pow39.4%
fabs-sqr39.4%
sqr-pow75.6%
unpow175.6%
Simplified75.6%
Taylor expanded in a around inf 65.2%
unpow265.2%
Simplified65.2%
if 4.8000000000000001e-112 < b Initial program 80.7%
unpow280.7%
swap-sqr61.1%
sqr-neg61.1%
swap-sqr80.7%
unpow280.7%
distribute-lft-neg-out80.7%
distribute-rgt-neg-in80.7%
sin-neg80.7%
distribute-rgt-neg-out80.7%
distribute-frac-neg80.7%
unpow280.7%
associate-*l*78.1%
Simplified80.9%
Taylor expanded in angle around 0 80.0%
Taylor expanded in angle around 0 75.1%
*-commutative75.1%
*-commutative75.1%
associate-*r*75.2%
*-commutative75.2%
Simplified75.2%
Final simplification68.0%
(FPCore (a b angle) :precision binary64 (if (<= b 3.1e-112) (* a a) (pow (hypot (* angle (* b (* PI 0.005555555555555556))) a) 2.0)))
double code(double a, double b, double angle) {
double tmp;
if (b <= 3.1e-112) {
tmp = a * a;
} else {
tmp = pow(hypot((angle * (b * (((double) M_PI) * 0.005555555555555556))), a), 2.0);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (b <= 3.1e-112) {
tmp = a * a;
} else {
tmp = Math.pow(Math.hypot((angle * (b * (Math.PI * 0.005555555555555556))), a), 2.0);
}
return tmp;
}
def code(a, b, angle): tmp = 0 if b <= 3.1e-112: tmp = a * a else: tmp = math.pow(math.hypot((angle * (b * (math.pi * 0.005555555555555556))), a), 2.0) return tmp
function code(a, b, angle) tmp = 0.0 if (b <= 3.1e-112) tmp = Float64(a * a); else tmp = hypot(Float64(angle * Float64(b * Float64(pi * 0.005555555555555556))), a) ^ 2.0; end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (b <= 3.1e-112) tmp = a * a; else tmp = hypot((angle * (b * (pi * 0.005555555555555556))), a) ^ 2.0; end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[b, 3.1e-112], N[(a * a), $MachinePrecision], N[Power[N[Sqrt[N[(angle * N[(b * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] ^ 2 + a ^ 2], $MachinePrecision], 2.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 3.1 \cdot 10^{-112}:\\
\;\;\;\;a \cdot a\\
\mathbf{else}:\\
\;\;\;\;{\left(\mathsf{hypot}\left(angle \cdot \left(b \cdot \left(\pi \cdot 0.005555555555555556\right)\right), a\right)\right)}^{2}\\
\end{array}
\end{array}
if b < 3.0999999999999998e-112Initial program 81.2%
unpow281.2%
swap-sqr76.6%
sqr-neg76.6%
swap-sqr81.2%
unpow281.2%
distribute-lft-neg-out81.2%
distribute-rgt-neg-in81.2%
sin-neg81.2%
distribute-rgt-neg-out81.2%
distribute-frac-neg81.2%
unpow281.2%
associate-*l*80.8%
Simplified81.2%
Taylor expanded in angle around 0 80.8%
Taylor expanded in angle around 0 75.6%
associate-*r*75.6%
*-commutative75.6%
*-commutative75.6%
unpow175.6%
sqr-pow36.2%
fabs-sqr36.2%
sqr-pow75.6%
unpow175.6%
associate-*r*75.6%
*-commutative75.6%
associate-*r*75.6%
fabs-mul75.6%
fabs-mul75.6%
metadata-eval75.6%
unpow175.6%
sqr-pow75.5%
fabs-sqr75.5%
sqr-pow75.6%
unpow175.6%
unpow175.6%
sqr-pow39.4%
fabs-sqr39.4%
sqr-pow75.6%
unpow175.6%
Simplified75.6%
Taylor expanded in a around inf 65.2%
unpow265.2%
Simplified65.2%
if 3.0999999999999998e-112 < b Initial program 80.7%
unpow280.7%
swap-sqr61.1%
sqr-neg61.1%
swap-sqr80.7%
unpow280.7%
distribute-lft-neg-out80.7%
distribute-rgt-neg-in80.7%
sin-neg80.7%
distribute-rgt-neg-out80.7%
distribute-frac-neg80.7%
unpow280.7%
associate-*l*78.1%
Simplified80.9%
Taylor expanded in angle around 0 80.0%
Taylor expanded in angle around 0 75.1%
associate-*r*75.2%
*-commutative75.2%
*-commutative75.2%
unpow175.2%
sqr-pow35.3%
fabs-sqr35.3%
sqr-pow75.2%
unpow175.2%
associate-*r*75.1%
*-commutative75.1%
associate-*r*75.2%
fabs-mul75.2%
fabs-mul75.2%
metadata-eval75.2%
unpow175.2%
sqr-pow74.9%
fabs-sqr74.9%
sqr-pow75.2%
unpow175.2%
unpow175.2%
sqr-pow39.8%
fabs-sqr39.8%
sqr-pow75.2%
unpow175.2%
Simplified75.2%
add-sqr-sqrt75.2%
pow275.2%
+-commutative75.2%
unpow275.2%
*-rgt-identity75.2%
pow275.2%
hypot-def75.2%
*-commutative75.2%
associate-*l*75.2%
div-inv75.2%
metadata-eval75.2%
Applied egg-rr75.2%
Final simplification68.0%
(FPCore (a b angle) :precision binary64 (if (<= b 4.8e-112) (* a a) (+ (* a a) (pow (* angle (* PI (* b 0.005555555555555556))) 2.0))))
double code(double a, double b, double angle) {
double tmp;
if (b <= 4.8e-112) {
tmp = a * a;
} else {
tmp = (a * a) + pow((angle * (((double) M_PI) * (b * 0.005555555555555556))), 2.0);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (b <= 4.8e-112) {
tmp = a * a;
} else {
tmp = (a * a) + Math.pow((angle * (Math.PI * (b * 0.005555555555555556))), 2.0);
}
return tmp;
}
def code(a, b, angle): tmp = 0 if b <= 4.8e-112: tmp = a * a else: tmp = (a * a) + math.pow((angle * (math.pi * (b * 0.005555555555555556))), 2.0) return tmp
function code(a, b, angle) tmp = 0.0 if (b <= 4.8e-112) tmp = Float64(a * a); else tmp = Float64(Float64(a * a) + (Float64(angle * Float64(pi * Float64(b * 0.005555555555555556))) ^ 2.0)); end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (b <= 4.8e-112) tmp = a * a; else tmp = (a * a) + ((angle * (pi * (b * 0.005555555555555556))) ^ 2.0); end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[b, 4.8e-112], N[(a * a), $MachinePrecision], N[(N[(a * a), $MachinePrecision] + N[Power[N[(angle * N[(Pi * N[(b * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 4.8 \cdot 10^{-112}:\\
\;\;\;\;a \cdot a\\
\mathbf{else}:\\
\;\;\;\;a \cdot a + {\left(angle \cdot \left(\pi \cdot \left(b \cdot 0.005555555555555556\right)\right)\right)}^{2}\\
\end{array}
\end{array}
if b < 4.8000000000000001e-112Initial program 81.2%
unpow281.2%
swap-sqr76.6%
sqr-neg76.6%
swap-sqr81.2%
unpow281.2%
distribute-lft-neg-out81.2%
distribute-rgt-neg-in81.2%
sin-neg81.2%
distribute-rgt-neg-out81.2%
distribute-frac-neg81.2%
unpow281.2%
associate-*l*80.8%
Simplified81.2%
Taylor expanded in angle around 0 80.8%
Taylor expanded in angle around 0 75.6%
associate-*r*75.6%
*-commutative75.6%
*-commutative75.6%
unpow175.6%
sqr-pow36.2%
fabs-sqr36.2%
sqr-pow75.6%
unpow175.6%
associate-*r*75.6%
*-commutative75.6%
associate-*r*75.6%
fabs-mul75.6%
fabs-mul75.6%
metadata-eval75.6%
unpow175.6%
sqr-pow75.5%
fabs-sqr75.5%
sqr-pow75.6%
unpow175.6%
unpow175.6%
sqr-pow39.4%
fabs-sqr39.4%
sqr-pow75.6%
unpow175.6%
Simplified75.6%
Taylor expanded in a around inf 65.2%
unpow265.2%
Simplified65.2%
if 4.8000000000000001e-112 < b Initial program 80.7%
unpow280.7%
swap-sqr61.1%
sqr-neg61.1%
swap-sqr80.7%
unpow280.7%
distribute-lft-neg-out80.7%
distribute-rgt-neg-in80.7%
sin-neg80.7%
distribute-rgt-neg-out80.7%
distribute-frac-neg80.7%
unpow280.7%
associate-*l*78.1%
Simplified80.9%
Taylor expanded in angle around 0 80.0%
Taylor expanded in angle around 0 75.1%
associate-*r*75.2%
*-commutative75.2%
*-commutative75.2%
unpow175.2%
sqr-pow35.3%
fabs-sqr35.3%
sqr-pow75.2%
unpow175.2%
associate-*r*75.1%
*-commutative75.1%
associate-*r*75.2%
fabs-mul75.2%
fabs-mul75.2%
metadata-eval75.2%
unpow175.2%
sqr-pow74.9%
fabs-sqr74.9%
sqr-pow75.2%
unpow175.2%
unpow175.2%
sqr-pow39.8%
fabs-sqr39.8%
sqr-pow75.2%
unpow175.2%
Simplified75.2%
+-commutative75.2%
unpow275.2%
fma-def75.2%
*-commutative75.2%
associate-*l*75.2%
div-inv75.2%
metadata-eval75.2%
*-commutative75.2%
associate-*l*75.2%
div-inv75.2%
metadata-eval75.2%
*-rgt-identity75.2%
pow275.2%
Applied egg-rr75.2%
fma-udef75.2%
unpow275.2%
associate-*l*75.2%
Simplified75.2%
Final simplification67.9%
(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 81.1%
unpow281.1%
swap-sqr72.4%
sqr-neg72.4%
swap-sqr81.1%
unpow281.1%
distribute-lft-neg-out81.1%
distribute-rgt-neg-in81.1%
sin-neg81.1%
distribute-rgt-neg-out81.1%
distribute-frac-neg81.1%
unpow281.1%
associate-*l*80.0%
Simplified81.2%
Taylor expanded in angle around 0 80.6%
Taylor expanded in angle around 0 75.5%
associate-*r*75.5%
*-commutative75.5%
*-commutative75.5%
unpow175.5%
sqr-pow35.9%
fabs-sqr35.9%
sqr-pow75.5%
unpow175.5%
associate-*r*75.5%
*-commutative75.5%
associate-*r*75.5%
fabs-mul75.5%
fabs-mul75.5%
metadata-eval75.5%
unpow175.5%
sqr-pow75.3%
fabs-sqr75.3%
sqr-pow75.5%
unpow175.5%
unpow175.5%
sqr-pow39.5%
fabs-sqr39.5%
sqr-pow75.5%
unpow175.5%
Simplified75.5%
Taylor expanded in a around inf 59.7%
unpow259.7%
Simplified59.7%
Final simplification59.7%
herbie shell --seed 2023271
(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)))