
(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 12 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}
a_m = (fabs.f64 a) (FPCore (a_m b angle) :precision binary64 (+ (* a_m (pow (* (sqrt a_m) (sin (* angle (* PI 0.005555555555555556)))) 2.0)) (pow (* b (cos (* angle (/ PI 180.0)))) 2.0)))
a_m = fabs(a);
double code(double a_m, double b, double angle) {
return (a_m * pow((sqrt(a_m) * sin((angle * (((double) M_PI) * 0.005555555555555556)))), 2.0)) + pow((b * cos((angle * (((double) M_PI) / 180.0)))), 2.0);
}
a_m = Math.abs(a);
public static double code(double a_m, double b, double angle) {
return (a_m * Math.pow((Math.sqrt(a_m) * Math.sin((angle * (Math.PI * 0.005555555555555556)))), 2.0)) + Math.pow((b * Math.cos((angle * (Math.PI / 180.0)))), 2.0);
}
a_m = math.fabs(a) def code(a_m, b, angle): return (a_m * math.pow((math.sqrt(a_m) * math.sin((angle * (math.pi * 0.005555555555555556)))), 2.0)) + math.pow((b * math.cos((angle * (math.pi / 180.0)))), 2.0)
a_m = abs(a) function code(a_m, b, angle) return Float64(Float64(a_m * (Float64(sqrt(a_m) * sin(Float64(angle * Float64(pi * 0.005555555555555556)))) ^ 2.0)) + (Float64(b * cos(Float64(angle * Float64(pi / 180.0)))) ^ 2.0)) end
a_m = abs(a); function tmp = code(a_m, b, angle) tmp = (a_m * ((sqrt(a_m) * sin((angle * (pi * 0.005555555555555556)))) ^ 2.0)) + ((b * cos((angle * (pi / 180.0)))) ^ 2.0); end
a_m = N[Abs[a], $MachinePrecision] code[a$95$m_, b_, angle_] := N[(N[(a$95$m * N[Power[N[(N[Sqrt[a$95$m], $MachinePrecision] * N[Sin[N[(angle * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + N[Power[N[(b * N[Cos[N[(angle * N[(Pi / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
a\_m \cdot {\left(\sqrt{a\_m} \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)}^{2} + {\left(b \cdot \cos \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2}
\end{array}
Initial program 74.6%
unpow274.6%
associate-*l/74.6%
associate-/l*74.7%
unpow274.7%
Simplified74.8%
associate-*r/74.6%
associate-*l/74.6%
unpow274.6%
*-commutative74.6%
associate-*r*74.6%
Applied egg-rr74.8%
add-sqr-sqrt48.1%
pow248.1%
Applied egg-rr36.4%
Final simplification36.4%
a_m = (fabs.f64 a)
(FPCore (a_m b angle)
:precision binary64
(let* ((t_0 (sin (* angle (* PI 0.005555555555555556)))))
(+
(pow (* b (cos (* angle (/ PI 180.0)))) 2.0)
(* a_m (* t_0 (* a_m t_0))))))a_m = fabs(a);
double code(double a_m, double b, double angle) {
double t_0 = sin((angle * (((double) M_PI) * 0.005555555555555556)));
return pow((b * cos((angle * (((double) M_PI) / 180.0)))), 2.0) + (a_m * (t_0 * (a_m * t_0)));
}
a_m = Math.abs(a);
public static double code(double a_m, double b, double angle) {
double t_0 = Math.sin((angle * (Math.PI * 0.005555555555555556)));
return Math.pow((b * Math.cos((angle * (Math.PI / 180.0)))), 2.0) + (a_m * (t_0 * (a_m * t_0)));
}
a_m = math.fabs(a) def code(a_m, b, angle): t_0 = math.sin((angle * (math.pi * 0.005555555555555556))) return math.pow((b * math.cos((angle * (math.pi / 180.0)))), 2.0) + (a_m * (t_0 * (a_m * t_0)))
a_m = abs(a) function code(a_m, b, angle) t_0 = sin(Float64(angle * Float64(pi * 0.005555555555555556))) return Float64((Float64(b * cos(Float64(angle * Float64(pi / 180.0)))) ^ 2.0) + Float64(a_m * Float64(t_0 * Float64(a_m * t_0)))) end
a_m = abs(a); function tmp = code(a_m, b, angle) t_0 = sin((angle * (pi * 0.005555555555555556))); tmp = ((b * cos((angle * (pi / 180.0)))) ^ 2.0) + (a_m * (t_0 * (a_m * t_0))); end
a_m = N[Abs[a], $MachinePrecision]
code[a$95$m_, b_, angle_] := Block[{t$95$0 = N[Sin[N[(angle * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[(N[Power[N[(b * N[Cos[N[(angle * N[(Pi / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(a$95$m * N[(t$95$0 * N[(a$95$m * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
t_0 := \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\\
{\left(b \cdot \cos \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + a\_m \cdot \left(t\_0 \cdot \left(a\_m \cdot t\_0\right)\right)
\end{array}
\end{array}
Initial program 74.6%
unpow274.6%
associate-*l/74.6%
associate-/l*74.7%
unpow274.7%
Simplified74.8%
associate-*r/74.6%
associate-*l/74.6%
unpow274.6%
*-commutative74.6%
associate-*r*74.6%
Applied egg-rr74.8%
Final simplification74.8%
a_m = (fabs.f64 a) (FPCore (a_m b angle) :precision binary64 (let* ((t_0 (* angle (* PI 0.005555555555555556)))) (pow (hypot (* a_m (sin t_0)) (* b (cos t_0))) 2.0)))
a_m = fabs(a);
double code(double a_m, double b, double angle) {
double t_0 = angle * (((double) M_PI) * 0.005555555555555556);
return pow(hypot((a_m * sin(t_0)), (b * cos(t_0))), 2.0);
}
a_m = Math.abs(a);
public static double code(double a_m, double b, double angle) {
double t_0 = angle * (Math.PI * 0.005555555555555556);
return Math.pow(Math.hypot((a_m * Math.sin(t_0)), (b * Math.cos(t_0))), 2.0);
}
a_m = math.fabs(a) def code(a_m, b, angle): t_0 = angle * (math.pi * 0.005555555555555556) return math.pow(math.hypot((a_m * math.sin(t_0)), (b * math.cos(t_0))), 2.0)
a_m = abs(a) function code(a_m, b, angle) t_0 = Float64(angle * Float64(pi * 0.005555555555555556)) return hypot(Float64(a_m * sin(t_0)), Float64(b * cos(t_0))) ^ 2.0 end
a_m = abs(a); function tmp = code(a_m, b, angle) t_0 = angle * (pi * 0.005555555555555556); tmp = hypot((a_m * sin(t_0)), (b * cos(t_0))) ^ 2.0; end
a_m = N[Abs[a], $MachinePrecision]
code[a$95$m_, b_, angle_] := Block[{t$95$0 = N[(angle * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]}, N[Power[N[Sqrt[N[(a$95$m * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision] ^ 2 + N[(b * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision], 2.0], $MachinePrecision]]
\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
t_0 := angle \cdot \left(\pi \cdot 0.005555555555555556\right)\\
{\left(\mathsf{hypot}\left(a\_m \cdot \sin t\_0, b \cdot \cos t\_0\right)\right)}^{2}
\end{array}
\end{array}
Initial program 74.6%
unpow274.6%
associate-*l/74.6%
associate-/l*74.7%
unpow274.7%
Simplified74.8%
Applied egg-rr74.8%
a_m = (fabs.f64 a) (FPCore (a_m b angle) :precision binary64 (+ (* a_m (pow (* (sqrt a_m) (sin (* angle (* PI 0.005555555555555556)))) 2.0)) (pow b 2.0)))
a_m = fabs(a);
double code(double a_m, double b, double angle) {
return (a_m * pow((sqrt(a_m) * sin((angle * (((double) M_PI) * 0.005555555555555556)))), 2.0)) + pow(b, 2.0);
}
a_m = Math.abs(a);
public static double code(double a_m, double b, double angle) {
return (a_m * Math.pow((Math.sqrt(a_m) * Math.sin((angle * (Math.PI * 0.005555555555555556)))), 2.0)) + Math.pow(b, 2.0);
}
a_m = math.fabs(a) def code(a_m, b, angle): return (a_m * math.pow((math.sqrt(a_m) * math.sin((angle * (math.pi * 0.005555555555555556)))), 2.0)) + math.pow(b, 2.0)
a_m = abs(a) function code(a_m, b, angle) return Float64(Float64(a_m * (Float64(sqrt(a_m) * sin(Float64(angle * Float64(pi * 0.005555555555555556)))) ^ 2.0)) + (b ^ 2.0)) end
a_m = abs(a); function tmp = code(a_m, b, angle) tmp = (a_m * ((sqrt(a_m) * sin((angle * (pi * 0.005555555555555556)))) ^ 2.0)) + (b ^ 2.0); end
a_m = N[Abs[a], $MachinePrecision] code[a$95$m_, b_, angle_] := N[(N[(a$95$m * N[Power[N[(N[Sqrt[a$95$m], $MachinePrecision] * N[Sin[N[(angle * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
a\_m \cdot {\left(\sqrt{a\_m} \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)}^{2} + {b}^{2}
\end{array}
Initial program 74.6%
unpow274.6%
associate-*l/74.6%
associate-/l*74.7%
unpow274.7%
Simplified74.8%
associate-*r/74.6%
associate-*l/74.6%
unpow274.6%
*-commutative74.6%
associate-*r*74.6%
Applied egg-rr74.8%
add-sqr-sqrt48.1%
pow248.1%
Applied egg-rr36.4%
Taylor expanded in angle around 0 36.0%
Final simplification36.0%
a_m = (fabs.f64 a) (FPCore (a_m b angle) :precision binary64 (let* ((t_0 (sin (* angle (* PI 0.005555555555555556))))) (+ (* a_m (* t_0 (* a_m t_0))) (pow b 2.0))))
a_m = fabs(a);
double code(double a_m, double b, double angle) {
double t_0 = sin((angle * (((double) M_PI) * 0.005555555555555556)));
return (a_m * (t_0 * (a_m * t_0))) + pow(b, 2.0);
}
a_m = Math.abs(a);
public static double code(double a_m, double b, double angle) {
double t_0 = Math.sin((angle * (Math.PI * 0.005555555555555556)));
return (a_m * (t_0 * (a_m * t_0))) + Math.pow(b, 2.0);
}
a_m = math.fabs(a) def code(a_m, b, angle): t_0 = math.sin((angle * (math.pi * 0.005555555555555556))) return (a_m * (t_0 * (a_m * t_0))) + math.pow(b, 2.0)
a_m = abs(a) function code(a_m, b, angle) t_0 = sin(Float64(angle * Float64(pi * 0.005555555555555556))) return Float64(Float64(a_m * Float64(t_0 * Float64(a_m * t_0))) + (b ^ 2.0)) end
a_m = abs(a); function tmp = code(a_m, b, angle) t_0 = sin((angle * (pi * 0.005555555555555556))); tmp = (a_m * (t_0 * (a_m * t_0))) + (b ^ 2.0); end
a_m = N[Abs[a], $MachinePrecision]
code[a$95$m_, b_, angle_] := Block[{t$95$0 = N[Sin[N[(angle * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[(N[(a$95$m * N[(t$95$0 * N[(a$95$m * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
t_0 := \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\\
a\_m \cdot \left(t\_0 \cdot \left(a\_m \cdot t\_0\right)\right) + {b}^{2}
\end{array}
\end{array}
Initial program 74.6%
unpow274.6%
associate-*l/74.6%
associate-/l*74.7%
unpow274.7%
Simplified74.8%
associate-*r/74.6%
associate-*l/74.6%
unpow274.6%
*-commutative74.6%
associate-*r*74.6%
Applied egg-rr74.8%
Taylor expanded in angle around 0 73.9%
Final simplification73.9%
a_m = (fabs.f64 a) (FPCore (a_m b angle) :precision binary64 (fma b b (pow (* a_m (sin (* angle (* PI 0.005555555555555556)))) 2.0)))
a_m = fabs(a);
double code(double a_m, double b, double angle) {
return fma(b, b, pow((a_m * sin((angle * (((double) M_PI) * 0.005555555555555556)))), 2.0));
}
a_m = abs(a) function code(a_m, b, angle) return fma(b, b, (Float64(a_m * sin(Float64(angle * Float64(pi * 0.005555555555555556)))) ^ 2.0)) end
a_m = N[Abs[a], $MachinePrecision] code[a$95$m_, b_, angle_] := N[(b * b + N[Power[N[(a$95$m * N[Sin[N[(angle * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
\mathsf{fma}\left(b, b, {\left(a\_m \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)}^{2}\right)
\end{array}
Initial program 74.6%
unpow274.6%
associate-*l/74.6%
associate-/l*74.7%
unpow274.7%
Simplified74.8%
+-commutative74.8%
associate-*r/74.8%
associate-*l/74.7%
unpow274.7%
*-commutative74.7%
associate-*r*74.7%
associate-*r/74.6%
associate-*l/74.6%
fma-define74.6%
Applied egg-rr74.8%
Taylor expanded in angle around 0 73.9%
a_m = (fabs.f64 a)
(FPCore (a_m b angle)
:precision binary64
(let* ((t_0 (* angle (* PI 0.005555555555555556))))
(if (<= a_m 1.25e+131)
(pow (* b (cos t_0)) 2.0)
(pow (* a_m (sin t_0)) 2.0))))a_m = fabs(a);
double code(double a_m, double b, double angle) {
double t_0 = angle * (((double) M_PI) * 0.005555555555555556);
double tmp;
if (a_m <= 1.25e+131) {
tmp = pow((b * cos(t_0)), 2.0);
} else {
tmp = pow((a_m * sin(t_0)), 2.0);
}
return tmp;
}
a_m = Math.abs(a);
public static double code(double a_m, double b, double angle) {
double t_0 = angle * (Math.PI * 0.005555555555555556);
double tmp;
if (a_m <= 1.25e+131) {
tmp = Math.pow((b * Math.cos(t_0)), 2.0);
} else {
tmp = Math.pow((a_m * Math.sin(t_0)), 2.0);
}
return tmp;
}
a_m = math.fabs(a) def code(a_m, b, angle): t_0 = angle * (math.pi * 0.005555555555555556) tmp = 0 if a_m <= 1.25e+131: tmp = math.pow((b * math.cos(t_0)), 2.0) else: tmp = math.pow((a_m * math.sin(t_0)), 2.0) return tmp
a_m = abs(a) function code(a_m, b, angle) t_0 = Float64(angle * Float64(pi * 0.005555555555555556)) tmp = 0.0 if (a_m <= 1.25e+131) tmp = Float64(b * cos(t_0)) ^ 2.0; else tmp = Float64(a_m * sin(t_0)) ^ 2.0; end return tmp end
a_m = abs(a); function tmp_2 = code(a_m, b, angle) t_0 = angle * (pi * 0.005555555555555556); tmp = 0.0; if (a_m <= 1.25e+131) tmp = (b * cos(t_0)) ^ 2.0; else tmp = (a_m * sin(t_0)) ^ 2.0; end tmp_2 = tmp; end
a_m = N[Abs[a], $MachinePrecision]
code[a$95$m_, b_, angle_] := Block[{t$95$0 = N[(angle * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a$95$m, 1.25e+131], N[Power[N[(b * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[Power[N[(a$95$m * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]]]
\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
t_0 := angle \cdot \left(\pi \cdot 0.005555555555555556\right)\\
\mathbf{if}\;a\_m \leq 1.25 \cdot 10^{+131}:\\
\;\;\;\;{\left(b \cdot \cos t\_0\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;{\left(a\_m \cdot \sin t\_0\right)}^{2}\\
\end{array}
\end{array}
if a < 1.24999999999999999e131Initial program 72.3%
unpow272.3%
associate-*l/72.2%
associate-/l*72.4%
unpow272.4%
Simplified72.4%
associate-*r/72.3%
associate-*l/72.3%
unpow272.3%
*-commutative72.3%
associate-*r*72.4%
Applied egg-rr72.5%
add-sqr-sqrt42.5%
pow242.5%
Applied egg-rr29.4%
Taylor expanded in a around 0 56.6%
unpow256.6%
unpow256.6%
unpow256.6%
associate-*r*56.6%
metadata-eval56.6%
associate-/r/56.6%
associate-*l/56.7%
*-lft-identity56.7%
unpow256.7%
swap-sqr56.7%
unpow256.7%
Simplified56.7%
if 1.24999999999999999e131 < a Initial program 93.4%
unpow293.4%
associate-*l/93.6%
associate-/l*93.9%
unpow293.9%
Simplified93.9%
associate-*r/93.6%
associate-*l/93.4%
unpow293.4%
*-commutative93.4%
associate-*r*93.3%
Applied egg-rr93.6%
add-sqr-sqrt93.7%
pow293.7%
Applied egg-rr93.7%
Taylor expanded in a around inf 51.4%
unpow251.4%
unpow251.4%
unpow251.4%
associate-*r*51.6%
metadata-eval51.6%
associate-/r/51.3%
associate-*l/51.3%
*-lft-identity51.3%
unpow251.3%
swap-sqr72.8%
unpow272.8%
Simplified73.1%
Final simplification58.5%
a_m = (fabs.f64 a) (FPCore (a_m b angle) :precision binary64 (if (<= a_m 9.6e+132) (pow (* b (cos (* 0.005555555555555556 (* angle PI)))) 2.0) (pow (* a_m (sin (* angle (* PI 0.005555555555555556)))) 2.0)))
a_m = fabs(a);
double code(double a_m, double b, double angle) {
double tmp;
if (a_m <= 9.6e+132) {
tmp = pow((b * cos((0.005555555555555556 * (angle * ((double) M_PI))))), 2.0);
} else {
tmp = pow((a_m * sin((angle * (((double) M_PI) * 0.005555555555555556)))), 2.0);
}
return tmp;
}
a_m = Math.abs(a);
public static double code(double a_m, double b, double angle) {
double tmp;
if (a_m <= 9.6e+132) {
tmp = Math.pow((b * Math.cos((0.005555555555555556 * (angle * Math.PI)))), 2.0);
} else {
tmp = Math.pow((a_m * Math.sin((angle * (Math.PI * 0.005555555555555556)))), 2.0);
}
return tmp;
}
a_m = math.fabs(a) def code(a_m, b, angle): tmp = 0 if a_m <= 9.6e+132: tmp = math.pow((b * math.cos((0.005555555555555556 * (angle * math.pi)))), 2.0) else: tmp = math.pow((a_m * math.sin((angle * (math.pi * 0.005555555555555556)))), 2.0) return tmp
a_m = abs(a) function code(a_m, b, angle) tmp = 0.0 if (a_m <= 9.6e+132) tmp = Float64(b * cos(Float64(0.005555555555555556 * Float64(angle * pi)))) ^ 2.0; else tmp = Float64(a_m * sin(Float64(angle * Float64(pi * 0.005555555555555556)))) ^ 2.0; end return tmp end
a_m = abs(a); function tmp_2 = code(a_m, b, angle) tmp = 0.0; if (a_m <= 9.6e+132) tmp = (b * cos((0.005555555555555556 * (angle * pi)))) ^ 2.0; else tmp = (a_m * sin((angle * (pi * 0.005555555555555556)))) ^ 2.0; end tmp_2 = tmp; end
a_m = N[Abs[a], $MachinePrecision] code[a$95$m_, b_, angle_] := If[LessEqual[a$95$m, 9.6e+132], N[Power[N[(b * N[Cos[N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[Power[N[(a$95$m * N[Sin[N[(angle * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]]
\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
\mathbf{if}\;a\_m \leq 9.6 \cdot 10^{+132}:\\
\;\;\;\;{\left(b \cdot \cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;{\left(a\_m \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)}^{2}\\
\end{array}
\end{array}
if a < 9.6000000000000004e132Initial program 72.3%
unpow272.3%
associate-*l/72.2%
associate-/l*72.4%
unpow272.4%
Simplified72.4%
Taylor expanded in a around 0 56.6%
*-commutative56.6%
associate-*r*56.7%
unpow256.7%
unpow256.7%
swap-sqr56.7%
unpow256.7%
associate-*r*56.6%
*-commutative56.6%
Simplified56.6%
if 9.6000000000000004e132 < a Initial program 93.4%
unpow293.4%
associate-*l/93.6%
associate-/l*93.9%
unpow293.9%
Simplified93.9%
associate-*r/93.6%
associate-*l/93.4%
unpow293.4%
*-commutative93.4%
associate-*r*93.3%
Applied egg-rr93.6%
add-sqr-sqrt93.7%
pow293.7%
Applied egg-rr93.7%
Taylor expanded in a around inf 51.4%
unpow251.4%
unpow251.4%
unpow251.4%
associate-*r*51.6%
metadata-eval51.6%
associate-/r/51.3%
associate-*l/51.3%
*-lft-identity51.3%
unpow251.3%
swap-sqr72.8%
unpow272.8%
Simplified73.1%
Final simplification58.4%
a_m = (fabs.f64 a) (FPCore (a_m b angle) :precision binary64 (if (<= a_m 2.4e+130) (* b b) (pow (* a_m (sin (* angle (* PI 0.005555555555555556)))) 2.0)))
a_m = fabs(a);
double code(double a_m, double b, double angle) {
double tmp;
if (a_m <= 2.4e+130) {
tmp = b * b;
} else {
tmp = pow((a_m * sin((angle * (((double) M_PI) * 0.005555555555555556)))), 2.0);
}
return tmp;
}
a_m = Math.abs(a);
public static double code(double a_m, double b, double angle) {
double tmp;
if (a_m <= 2.4e+130) {
tmp = b * b;
} else {
tmp = Math.pow((a_m * Math.sin((angle * (Math.PI * 0.005555555555555556)))), 2.0);
}
return tmp;
}
a_m = math.fabs(a) def code(a_m, b, angle): tmp = 0 if a_m <= 2.4e+130: tmp = b * b else: tmp = math.pow((a_m * math.sin((angle * (math.pi * 0.005555555555555556)))), 2.0) return tmp
a_m = abs(a) function code(a_m, b, angle) tmp = 0.0 if (a_m <= 2.4e+130) tmp = Float64(b * b); else tmp = Float64(a_m * sin(Float64(angle * Float64(pi * 0.005555555555555556)))) ^ 2.0; end return tmp end
a_m = abs(a); function tmp_2 = code(a_m, b, angle) tmp = 0.0; if (a_m <= 2.4e+130) tmp = b * b; else tmp = (a_m * sin((angle * (pi * 0.005555555555555556)))) ^ 2.0; end tmp_2 = tmp; end
a_m = N[Abs[a], $MachinePrecision] code[a$95$m_, b_, angle_] := If[LessEqual[a$95$m, 2.4e+130], N[(b * b), $MachinePrecision], N[Power[N[(a$95$m * N[Sin[N[(angle * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]]
\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
\mathbf{if}\;a\_m \leq 2.4 \cdot 10^{+130}:\\
\;\;\;\;b \cdot b\\
\mathbf{else}:\\
\;\;\;\;{\left(a\_m \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)}^{2}\\
\end{array}
\end{array}
if a < 2.40000000000000024e130Initial program 72.3%
unpow272.3%
associate-*l/72.2%
associate-/l*72.4%
unpow272.4%
Simplified72.4%
Taylor expanded in angle around 0 55.7%
unpow255.7%
Applied egg-rr55.7%
if 2.40000000000000024e130 < a Initial program 93.4%
unpow293.4%
associate-*l/93.6%
associate-/l*93.9%
unpow293.9%
Simplified93.9%
associate-*r/93.6%
associate-*l/93.4%
unpow293.4%
*-commutative93.4%
associate-*r*93.3%
Applied egg-rr93.6%
add-sqr-sqrt93.7%
pow293.7%
Applied egg-rr93.7%
Taylor expanded in a around inf 51.4%
unpow251.4%
unpow251.4%
unpow251.4%
associate-*r*51.6%
metadata-eval51.6%
associate-/r/51.3%
associate-*l/51.3%
*-lft-identity51.3%
unpow251.3%
swap-sqr72.8%
unpow272.8%
Simplified73.1%
Final simplification57.6%
a_m = (fabs.f64 a) (FPCore (a_m b angle) :precision binary64 (if (<= a_m 1e+133) (* b b) (pow (* a_m (sin (* 0.005555555555555556 (* angle PI)))) 2.0)))
a_m = fabs(a);
double code(double a_m, double b, double angle) {
double tmp;
if (a_m <= 1e+133) {
tmp = b * b;
} else {
tmp = pow((a_m * sin((0.005555555555555556 * (angle * ((double) M_PI))))), 2.0);
}
return tmp;
}
a_m = Math.abs(a);
public static double code(double a_m, double b, double angle) {
double tmp;
if (a_m <= 1e+133) {
tmp = b * b;
} else {
tmp = Math.pow((a_m * Math.sin((0.005555555555555556 * (angle * Math.PI)))), 2.0);
}
return tmp;
}
a_m = math.fabs(a) def code(a_m, b, angle): tmp = 0 if a_m <= 1e+133: tmp = b * b else: tmp = math.pow((a_m * math.sin((0.005555555555555556 * (angle * math.pi)))), 2.0) return tmp
a_m = abs(a) function code(a_m, b, angle) tmp = 0.0 if (a_m <= 1e+133) tmp = Float64(b * b); else tmp = Float64(a_m * sin(Float64(0.005555555555555556 * Float64(angle * pi)))) ^ 2.0; end return tmp end
a_m = abs(a); function tmp_2 = code(a_m, b, angle) tmp = 0.0; if (a_m <= 1e+133) tmp = b * b; else tmp = (a_m * sin((0.005555555555555556 * (angle * pi)))) ^ 2.0; end tmp_2 = tmp; end
a_m = N[Abs[a], $MachinePrecision] code[a$95$m_, b_, angle_] := If[LessEqual[a$95$m, 1e+133], N[(b * b), $MachinePrecision], N[Power[N[(a$95$m * N[Sin[N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]]
\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
\mathbf{if}\;a\_m \leq 10^{+133}:\\
\;\;\;\;b \cdot b\\
\mathbf{else}:\\
\;\;\;\;{\left(a\_m \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2}\\
\end{array}
\end{array}
if a < 1e133Initial program 72.3%
unpow272.3%
associate-*l/72.2%
associate-/l*72.4%
unpow272.4%
Simplified72.4%
Taylor expanded in angle around 0 55.7%
unpow255.7%
Applied egg-rr55.7%
if 1e133 < a Initial program 93.4%
unpow293.4%
associate-*l/93.6%
associate-/l*93.9%
unpow293.9%
Simplified93.9%
Taylor expanded in a around inf 51.4%
unpow251.4%
*-commutative51.4%
associate-*r*51.4%
unpow251.4%
swap-sqr73.1%
unpow273.1%
associate-*r*73.0%
*-commutative73.0%
Simplified73.0%
a_m = (fabs.f64 a) (FPCore (a_m b angle) :precision binary64 (if (<= a_m 3.1e+155) (* b b) (cbrt (pow b 6.0))))
a_m = fabs(a);
double code(double a_m, double b, double angle) {
double tmp;
if (a_m <= 3.1e+155) {
tmp = b * b;
} else {
tmp = cbrt(pow(b, 6.0));
}
return tmp;
}
a_m = Math.abs(a);
public static double code(double a_m, double b, double angle) {
double tmp;
if (a_m <= 3.1e+155) {
tmp = b * b;
} else {
tmp = Math.cbrt(Math.pow(b, 6.0));
}
return tmp;
}
a_m = abs(a) function code(a_m, b, angle) tmp = 0.0 if (a_m <= 3.1e+155) tmp = Float64(b * b); else tmp = cbrt((b ^ 6.0)); end return tmp end
a_m = N[Abs[a], $MachinePrecision] code[a$95$m_, b_, angle_] := If[LessEqual[a$95$m, 3.1e+155], N[(b * b), $MachinePrecision], N[Power[N[Power[b, 6.0], $MachinePrecision], 1/3], $MachinePrecision]]
\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
\mathbf{if}\;a\_m \leq 3.1 \cdot 10^{+155}:\\
\;\;\;\;b \cdot b\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{{b}^{6}}\\
\end{array}
\end{array}
if a < 3.09999999999999989e155Initial program 72.3%
unpow272.3%
associate-*l/72.2%
associate-/l*72.4%
unpow272.4%
Simplified72.4%
Taylor expanded in angle around 0 55.2%
unpow255.2%
Applied egg-rr55.2%
if 3.09999999999999989e155 < a Initial program 99.5%
unpow299.5%
associate-*l/99.7%
associate-/l*99.8%
unpow299.8%
Simplified99.8%
Taylor expanded in angle around 0 33.7%
add-sqr-sqrt33.7%
sqrt-unprod29.5%
pow-prod-up29.5%
metadata-eval29.5%
Applied egg-rr29.5%
add-cbrt-cube33.7%
pow1/333.3%
add-sqr-sqrt33.3%
sqrt-pow133.3%
metadata-eval33.3%
pow-prod-up33.3%
metadata-eval33.3%
Applied egg-rr33.3%
unpow1/333.7%
Simplified33.7%
a_m = (fabs.f64 a) (FPCore (a_m b angle) :precision binary64 (* b b))
a_m = fabs(a);
double code(double a_m, double b, double angle) {
return b * b;
}
a_m = abs(a)
real(8) function code(a_m, b, angle)
real(8), intent (in) :: a_m
real(8), intent (in) :: b
real(8), intent (in) :: angle
code = b * b
end function
a_m = Math.abs(a);
public static double code(double a_m, double b, double angle) {
return b * b;
}
a_m = math.fabs(a) def code(a_m, b, angle): return b * b
a_m = abs(a) function code(a_m, b, angle) return Float64(b * b) end
a_m = abs(a); function tmp = code(a_m, b, angle) tmp = b * b; end
a_m = N[Abs[a], $MachinePrecision] code[a$95$m_, b_, angle_] := N[(b * b), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
b \cdot b
\end{array}
Initial program 74.6%
unpow274.6%
associate-*l/74.6%
associate-/l*74.7%
unpow274.7%
Simplified74.8%
Taylor expanded in angle around 0 53.3%
unpow253.3%
Applied egg-rr53.3%
herbie shell --seed 2024163
(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)))