
(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}
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (cos (/ PI (/ 180.0 angle)))))
(+
(pow (* a (sin (* angle (/ PI 180.0)))) 2.0)
(* b (* b (* (pow (cbrt t_0) 2.0) (cbrt (pow t_0 4.0))))))))
double code(double a, double b, double angle) {
double t_0 = cos((((double) M_PI) / (180.0 / angle)));
return pow((a * sin((angle * (((double) M_PI) / 180.0)))), 2.0) + (b * (b * (pow(cbrt(t_0), 2.0) * cbrt(pow(t_0, 4.0)))));
}
public static double code(double a, double b, double angle) {
double t_0 = Math.cos((Math.PI / (180.0 / angle)));
return Math.pow((a * Math.sin((angle * (Math.PI / 180.0)))), 2.0) + (b * (b * (Math.pow(Math.cbrt(t_0), 2.0) * Math.cbrt(Math.pow(t_0, 4.0)))));
}
function code(a, b, angle) t_0 = cos(Float64(pi / Float64(180.0 / angle))) return Float64((Float64(a * sin(Float64(angle * Float64(pi / 180.0)))) ^ 2.0) + Float64(b * Float64(b * Float64((cbrt(t_0) ^ 2.0) * cbrt((t_0 ^ 4.0)))))) end
code[a_, b_, angle_] := Block[{t$95$0 = N[Cos[N[(Pi / N[(180.0 / angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[(N[Power[N[(a * N[Sin[N[(angle * N[(Pi / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(b * N[(b * N[(N[Power[N[Power[t$95$0, 1/3], $MachinePrecision], 2.0], $MachinePrecision] * N[Power[N[Power[t$95$0, 4.0], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{\pi}{\frac{180}{angle}}\right)\\
{\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + b \cdot \left(b \cdot \left({\left(\sqrt[3]{t\_0}\right)}^{2} \cdot \sqrt[3]{{t\_0}^{4}}\right)\right)
\end{array}
\end{array}
Initial program 79.3%
unpow279.3%
associate-*l/78.9%
associate-/l*79.4%
unpow279.4%
Simplified79.7%
associate-*r/79.3%
associate-*l/79.4%
log1p-expm1-u79.4%
associate-*l/79.3%
associate-*r/79.7%
div-inv79.7%
metadata-eval79.7%
Applied egg-rr79.7%
log1p-expm1-u79.7%
metadata-eval79.7%
div-inv79.7%
*-commutative79.7%
associate-/r/79.7%
unpow-prod-down79.7%
unpow279.7%
associate-/r/79.7%
*-commutative79.7%
div-inv79.7%
metadata-eval79.7%
associate-*l*79.7%
Applied egg-rr79.7%
add-cube-cbrt79.7%
cbrt-unprod79.7%
Applied egg-rr79.7%
*-commutative79.7%
associate-*r*79.3%
*-commutative79.3%
associate-*r*79.7%
metadata-eval79.7%
associate-/r/79.7%
associate-*l/79.7%
*-lft-identity79.7%
Simplified79.7%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (pow (sqrt (* angle (* PI 0.005555555555555556))) 2.0))) 2.0) (pow (* b (cos (/ PI (/ 180.0 angle)))) 2.0)))
double code(double a, double b, double angle) {
return pow((a * sin(pow(sqrt((angle * (((double) M_PI) * 0.005555555555555556))), 2.0))), 2.0) + pow((b * cos((((double) M_PI) / (180.0 / angle)))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.sin(Math.pow(Math.sqrt((angle * (Math.PI * 0.005555555555555556))), 2.0))), 2.0) + Math.pow((b * Math.cos((Math.PI / (180.0 / angle)))), 2.0);
}
def code(a, b, angle): return math.pow((a * math.sin(math.pow(math.sqrt((angle * (math.pi * 0.005555555555555556))), 2.0))), 2.0) + math.pow((b * math.cos((math.pi / (180.0 / angle)))), 2.0)
function code(a, b, angle) return Float64((Float64(a * sin((sqrt(Float64(angle * Float64(pi * 0.005555555555555556))) ^ 2.0))) ^ 2.0) + (Float64(b * cos(Float64(pi / Float64(180.0 / angle)))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((a * sin((sqrt((angle * (pi * 0.005555555555555556))) ^ 2.0))) ^ 2.0) + ((b * cos((pi / (180.0 / angle)))) ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Sin[N[Power[N[Sqrt[N[(angle * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[N[(Pi / N[(180.0 / angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \sin \left({\left(\sqrt{angle \cdot \left(\pi \cdot 0.005555555555555556\right)}\right)}^{2}\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2}
\end{array}
Initial program 79.3%
*-commutative79.3%
clear-num79.3%
un-div-inv79.6%
Applied egg-rr79.6%
add-sqr-sqrt42.0%
pow242.0%
associate-*l/42.0%
associate-*r/42.0%
div-inv42.0%
metadata-eval42.0%
Applied egg-rr42.0%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (/ 1.0 (/ (/ 180.0 angle) PI)))) 2.0) (* b (* b (pow (cos (* angle (* PI 0.005555555555555556))) 2.0)))))
double code(double a, double b, double angle) {
return pow((a * sin((1.0 / ((180.0 / angle) / ((double) M_PI))))), 2.0) + (b * (b * pow(cos((angle * (((double) M_PI) * 0.005555555555555556))), 2.0)));
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.sin((1.0 / ((180.0 / angle) / Math.PI)))), 2.0) + (b * (b * Math.pow(Math.cos((angle * (Math.PI * 0.005555555555555556))), 2.0)));
}
def code(a, b, angle): return math.pow((a * math.sin((1.0 / ((180.0 / angle) / math.pi)))), 2.0) + (b * (b * math.pow(math.cos((angle * (math.pi * 0.005555555555555556))), 2.0)))
function code(a, b, angle) return Float64((Float64(a * sin(Float64(1.0 / Float64(Float64(180.0 / angle) / pi)))) ^ 2.0) + Float64(b * Float64(b * (cos(Float64(angle * Float64(pi * 0.005555555555555556))) ^ 2.0)))) end
function tmp = code(a, b, angle) tmp = ((a * sin((1.0 / ((180.0 / angle) / pi)))) ^ 2.0) + (b * (b * (cos((angle * (pi * 0.005555555555555556))) ^ 2.0))); end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Sin[N[(1.0 / N[(N[(180.0 / angle), $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(b * N[(b * N[Power[N[Cos[N[(angle * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \sin \left(\frac{1}{\frac{\frac{180}{angle}}{\pi}}\right)\right)}^{2} + b \cdot \left(b \cdot {\cos \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)}^{2}\right)
\end{array}
Initial program 79.3%
unpow279.3%
associate-*l/78.9%
associate-/l*79.4%
unpow279.4%
Simplified79.7%
associate-*r/79.3%
associate-*l/79.4%
log1p-expm1-u79.4%
associate-*l/79.3%
associate-*r/79.7%
div-inv79.7%
metadata-eval79.7%
Applied egg-rr79.7%
log1p-expm1-u79.7%
metadata-eval79.7%
div-inv79.7%
*-commutative79.7%
associate-/r/79.7%
unpow-prod-down79.7%
unpow279.7%
associate-/r/79.7%
*-commutative79.7%
div-inv79.7%
metadata-eval79.7%
associate-*l*79.7%
Applied egg-rr79.7%
*-commutative79.7%
associate-/r/79.6%
clear-num79.7%
Applied egg-rr79.7%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (* angle (/ PI 180.0)))) 2.0) (* b (* b (pow (cos (* angle (* PI 0.005555555555555556))) 2.0)))))
double code(double a, double b, double angle) {
return pow((a * sin((angle * (((double) M_PI) / 180.0)))), 2.0) + (b * (b * pow(cos((angle * (((double) M_PI) * 0.005555555555555556))), 2.0)));
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.sin((angle * (Math.PI / 180.0)))), 2.0) + (b * (b * Math.pow(Math.cos((angle * (Math.PI * 0.005555555555555556))), 2.0)));
}
def code(a, b, angle): return math.pow((a * math.sin((angle * (math.pi / 180.0)))), 2.0) + (b * (b * math.pow(math.cos((angle * (math.pi * 0.005555555555555556))), 2.0)))
function code(a, b, angle) return Float64((Float64(a * sin(Float64(angle * Float64(pi / 180.0)))) ^ 2.0) + Float64(b * Float64(b * (cos(Float64(angle * Float64(pi * 0.005555555555555556))) ^ 2.0)))) end
function tmp = code(a, b, angle) tmp = ((a * sin((angle * (pi / 180.0)))) ^ 2.0) + (b * (b * (cos((angle * (pi * 0.005555555555555556))) ^ 2.0))); end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Sin[N[(angle * N[(Pi / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(b * N[(b * N[Power[N[Cos[N[(angle * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + b \cdot \left(b \cdot {\cos \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)}^{2}\right)
\end{array}
Initial program 79.3%
unpow279.3%
associate-*l/78.9%
associate-/l*79.4%
unpow279.4%
Simplified79.7%
associate-*r/79.3%
associate-*l/79.4%
log1p-expm1-u79.4%
associate-*l/79.3%
associate-*r/79.7%
div-inv79.7%
metadata-eval79.7%
Applied egg-rr79.7%
log1p-expm1-u79.7%
metadata-eval79.7%
div-inv79.7%
*-commutative79.7%
associate-/r/79.7%
unpow-prod-down79.7%
unpow279.7%
associate-/r/79.7%
*-commutative79.7%
div-inv79.7%
metadata-eval79.7%
associate-*l*79.7%
Applied egg-rr79.7%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (* angle (/ PI 180.0)))) 2.0) (* b (* b (/ (+ 1.0 (cos (* angle (* PI 0.011111111111111112)))) 2.0)))))
double code(double a, double b, double angle) {
return pow((a * sin((angle * (((double) M_PI) / 180.0)))), 2.0) + (b * (b * ((1.0 + cos((angle * (((double) M_PI) * 0.011111111111111112)))) / 2.0)));
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.sin((angle * (Math.PI / 180.0)))), 2.0) + (b * (b * ((1.0 + Math.cos((angle * (Math.PI * 0.011111111111111112)))) / 2.0)));
}
def code(a, b, angle): return math.pow((a * math.sin((angle * (math.pi / 180.0)))), 2.0) + (b * (b * ((1.0 + math.cos((angle * (math.pi * 0.011111111111111112)))) / 2.0)))
function code(a, b, angle) return Float64((Float64(a * sin(Float64(angle * Float64(pi / 180.0)))) ^ 2.0) + Float64(b * Float64(b * Float64(Float64(1.0 + cos(Float64(angle * Float64(pi * 0.011111111111111112)))) / 2.0)))) end
function tmp = code(a, b, angle) tmp = ((a * sin((angle * (pi / 180.0)))) ^ 2.0) + (b * (b * ((1.0 + cos((angle * (pi * 0.011111111111111112)))) / 2.0))); end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Sin[N[(angle * N[(Pi / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(b * N[(b * N[(N[(1.0 + N[Cos[N[(angle * N[(Pi * 0.011111111111111112), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + b \cdot \left(b \cdot \frac{1 + \cos \left(angle \cdot \left(\pi \cdot 0.011111111111111112\right)\right)}{2}\right)
\end{array}
Initial program 79.3%
unpow279.3%
associate-*l/78.9%
associate-/l*79.4%
unpow279.4%
Simplified79.7%
associate-*r/79.3%
associate-*l/79.4%
log1p-expm1-u79.4%
associate-*l/79.3%
associate-*r/79.7%
div-inv79.7%
metadata-eval79.7%
Applied egg-rr79.7%
log1p-expm1-u79.7%
metadata-eval79.7%
div-inv79.7%
*-commutative79.7%
associate-/r/79.7%
unpow-prod-down79.7%
unpow279.7%
associate-/r/79.7%
*-commutative79.7%
div-inv79.7%
metadata-eval79.7%
associate-*l*79.7%
Applied egg-rr79.7%
metadata-eval79.7%
div-inv79.7%
*-commutative79.7%
pow279.7%
associate-/r/77.2%
associate-/r/79.7%
cos-mult79.7%
Applied egg-rr79.7%
+-commutative79.7%
+-inverses79.7%
cos-079.7%
distribute-lft-out79.7%
distribute-lft-out79.7%
metadata-eval79.7%
Simplified79.7%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (* angle (/ PI 180.0)))) 2.0) (pow b 2.0)))
double code(double a, double b, double angle) {
return pow((a * sin((angle * (((double) M_PI) / 180.0)))), 2.0) + pow(b, 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.sin((angle * (Math.PI / 180.0)))), 2.0) + Math.pow(b, 2.0);
}
def code(a, b, angle): return math.pow((a * math.sin((angle * (math.pi / 180.0)))), 2.0) + math.pow(b, 2.0)
function code(a, b, angle) return Float64((Float64(a * sin(Float64(angle * Float64(pi / 180.0)))) ^ 2.0) + (b ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((a * sin((angle * (pi / 180.0)))) ^ 2.0) + (b ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Sin[N[(angle * N[(Pi / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {b}^{2}
\end{array}
Initial program 79.3%
unpow279.3%
associate-*l/78.9%
associate-/l*79.4%
unpow279.4%
Simplified79.7%
associate-*r/79.3%
associate-*l/79.4%
log1p-expm1-u79.4%
associate-*l/79.3%
associate-*r/79.7%
div-inv79.7%
metadata-eval79.7%
Applied egg-rr79.7%
Taylor expanded in angle around 0 79.2%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* (* angle PI) (* a 0.005555555555555556))))
(if (<= b 5.8e-158)
(pow (* a (sin (* angle (* PI 0.005555555555555556)))) 2.0)
(+ (pow (* b (cos (/ PI (/ 180.0 angle)))) 2.0) (* t_0 t_0)))))
double code(double a, double b, double angle) {
double t_0 = (angle * ((double) M_PI)) * (a * 0.005555555555555556);
double tmp;
if (b <= 5.8e-158) {
tmp = pow((a * sin((angle * (((double) M_PI) * 0.005555555555555556)))), 2.0);
} else {
tmp = pow((b * cos((((double) M_PI) / (180.0 / angle)))), 2.0) + (t_0 * t_0);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double t_0 = (angle * Math.PI) * (a * 0.005555555555555556);
double tmp;
if (b <= 5.8e-158) {
tmp = Math.pow((a * Math.sin((angle * (Math.PI * 0.005555555555555556)))), 2.0);
} else {
tmp = Math.pow((b * Math.cos((Math.PI / (180.0 / angle)))), 2.0) + (t_0 * t_0);
}
return tmp;
}
def code(a, b, angle): t_0 = (angle * math.pi) * (a * 0.005555555555555556) tmp = 0 if b <= 5.8e-158: tmp = math.pow((a * math.sin((angle * (math.pi * 0.005555555555555556)))), 2.0) else: tmp = math.pow((b * math.cos((math.pi / (180.0 / angle)))), 2.0) + (t_0 * t_0) return tmp
function code(a, b, angle) t_0 = Float64(Float64(angle * pi) * Float64(a * 0.005555555555555556)) tmp = 0.0 if (b <= 5.8e-158) tmp = Float64(a * sin(Float64(angle * Float64(pi * 0.005555555555555556)))) ^ 2.0; else tmp = Float64((Float64(b * cos(Float64(pi / Float64(180.0 / angle)))) ^ 2.0) + Float64(t_0 * t_0)); end return tmp end
function tmp_2 = code(a, b, angle) t_0 = (angle * pi) * (a * 0.005555555555555556); tmp = 0.0; if (b <= 5.8e-158) tmp = (a * sin((angle * (pi * 0.005555555555555556)))) ^ 2.0; else tmp = ((b * cos((pi / (180.0 / angle)))) ^ 2.0) + (t_0 * t_0); end tmp_2 = tmp; end
code[a_, b_, angle_] := Block[{t$95$0 = N[(N[(angle * Pi), $MachinePrecision] * N[(a * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 5.8e-158], N[Power[N[(a * N[Sin[N[(angle * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[(N[Power[N[(b * N[Cos[N[(Pi / N[(180.0 / angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(angle \cdot \pi\right) \cdot \left(a \cdot 0.005555555555555556\right)\\
\mathbf{if}\;b \leq 5.8 \cdot 10^{-158}:\\
\;\;\;\;{\left(a \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;{\left(b \cdot \cos \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2} + t\_0 \cdot t\_0\\
\end{array}
\end{array}
if b < 5.79999999999999961e-158Initial program 78.9%
unpow278.9%
associate-*l/78.4%
associate-/l*79.1%
unpow279.1%
Simplified79.5%
Applied egg-rr63.5%
expm1-define78.4%
associate-*r*77.7%
*-commutative77.7%
associate-*r*78.2%
associate-*r*77.5%
*-commutative77.5%
associate-*r*77.7%
Simplified77.7%
Taylor expanded in b around 0 35.4%
log1p-define39.2%
unpow239.2%
*-commutative39.2%
associate-*r*39.9%
unpow239.9%
swap-sqr46.1%
unpow246.1%
associate-*r*45.4%
*-commutative45.4%
associate-*r*45.9%
associate-*r*45.4%
*-commutative45.4%
*-commutative45.4%
Simplified45.4%
expm1-log1p-u45.7%
*-commutative45.7%
associate-*r*46.4%
add-cube-cbrt46.1%
unpow246.1%
add-sqr-sqrt46.1%
pow246.1%
Applied egg-rr46.4%
if 5.79999999999999961e-158 < b Initial program 79.9%
*-commutative79.9%
clear-num80.0%
un-div-inv80.0%
Applied egg-rr80.0%
Taylor expanded in angle around 0 77.6%
associate-*r*77.6%
Simplified77.6%
unpow277.6%
*-commutative77.6%
*-commutative77.6%
Applied egg-rr77.6%
Final simplification58.0%
(FPCore (a b angle) :precision binary64 (if (<= a 3e-22) (pow (* b (cos (/ PI (/ 180.0 angle)))) 2.0) (+ (pow b 2.0) (pow (* (* angle PI) (* a 0.005555555555555556)) 2.0))))
double code(double a, double b, double angle) {
double tmp;
if (a <= 3e-22) {
tmp = pow((b * cos((((double) M_PI) / (180.0 / angle)))), 2.0);
} else {
tmp = pow(b, 2.0) + pow(((angle * ((double) M_PI)) * (a * 0.005555555555555556)), 2.0);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (a <= 3e-22) {
tmp = Math.pow((b * Math.cos((Math.PI / (180.0 / angle)))), 2.0);
} else {
tmp = Math.pow(b, 2.0) + Math.pow(((angle * Math.PI) * (a * 0.005555555555555556)), 2.0);
}
return tmp;
}
def code(a, b, angle): tmp = 0 if a <= 3e-22: tmp = math.pow((b * math.cos((math.pi / (180.0 / angle)))), 2.0) else: tmp = math.pow(b, 2.0) + math.pow(((angle * math.pi) * (a * 0.005555555555555556)), 2.0) return tmp
function code(a, b, angle) tmp = 0.0 if (a <= 3e-22) tmp = Float64(b * cos(Float64(pi / Float64(180.0 / angle)))) ^ 2.0; else tmp = Float64((b ^ 2.0) + (Float64(Float64(angle * pi) * Float64(a * 0.005555555555555556)) ^ 2.0)); end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (a <= 3e-22) tmp = (b * cos((pi / (180.0 / angle)))) ^ 2.0; else tmp = (b ^ 2.0) + (((angle * pi) * (a * 0.005555555555555556)) ^ 2.0); end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[a, 3e-22], N[Power[N[(b * N[Cos[N[(Pi / N[(180.0 / angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[(N[Power[b, 2.0], $MachinePrecision] + N[Power[N[(N[(angle * Pi), $MachinePrecision] * N[(a * 0.005555555555555556), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 3 \cdot 10^{-22}:\\
\;\;\;\;{\left(b \cdot \cos \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;{b}^{2} + {\left(\left(angle \cdot \pi\right) \cdot \left(a \cdot 0.005555555555555556\right)\right)}^{2}\\
\end{array}
\end{array}
if a < 2.9999999999999999e-22Initial program 77.9%
*-commutative77.9%
clear-num77.9%
un-div-inv78.3%
Applied egg-rr78.3%
Taylor expanded in angle around 0 69.5%
associate-*r*69.5%
Simplified69.5%
expm1-log1p-u69.5%
expm1-undefine69.5%
associate-/r/69.5%
Applied egg-rr69.5%
Taylor expanded in a around 0 67.6%
unpow267.6%
*-commutative67.6%
associate-*r*68.1%
unpow268.1%
swap-sqr68.0%
unpow268.0%
associate-*r*67.6%
*-commutative67.6%
associate-*r*67.7%
metadata-eval67.7%
associate-/r/67.7%
associate-*l/68.1%
*-lft-identity68.1%
Simplified68.1%
if 2.9999999999999999e-22 < a Initial program 84.0%
*-commutative84.0%
clear-num83.9%
un-div-inv84.0%
Applied egg-rr84.0%
Taylor expanded in angle around 0 81.9%
associate-*r*81.9%
Simplified81.9%
Taylor expanded in angle around 0 81.9%
Final simplification71.2%
(FPCore (a b angle) :precision binary64 (if (<= a 5.2e+80) (pow (* b (cos (/ PI (/ 180.0 angle)))) 2.0) (* 3.08641975308642e-5 (pow (* a (* angle PI)) 2.0))))
double code(double a, double b, double angle) {
double tmp;
if (a <= 5.2e+80) {
tmp = pow((b * cos((((double) M_PI) / (180.0 / angle)))), 2.0);
} else {
tmp = 3.08641975308642e-5 * pow((a * (angle * ((double) M_PI))), 2.0);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (a <= 5.2e+80) {
tmp = Math.pow((b * Math.cos((Math.PI / (180.0 / angle)))), 2.0);
} else {
tmp = 3.08641975308642e-5 * Math.pow((a * (angle * Math.PI)), 2.0);
}
return tmp;
}
def code(a, b, angle): tmp = 0 if a <= 5.2e+80: tmp = math.pow((b * math.cos((math.pi / (180.0 / angle)))), 2.0) else: tmp = 3.08641975308642e-5 * math.pow((a * (angle * math.pi)), 2.0) return tmp
function code(a, b, angle) tmp = 0.0 if (a <= 5.2e+80) tmp = Float64(b * cos(Float64(pi / Float64(180.0 / angle)))) ^ 2.0; else tmp = Float64(3.08641975308642e-5 * (Float64(a * Float64(angle * pi)) ^ 2.0)); end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (a <= 5.2e+80) tmp = (b * cos((pi / (180.0 / angle)))) ^ 2.0; else tmp = 3.08641975308642e-5 * ((a * (angle * pi)) ^ 2.0); end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[a, 5.2e+80], N[Power[N[(b * N[Cos[N[(Pi / N[(180.0 / angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[(3.08641975308642e-5 * N[Power[N[(a * N[(angle * Pi), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 5.2 \cdot 10^{+80}:\\
\;\;\;\;{\left(b \cdot \cos \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;3.08641975308642 \cdot 10^{-5} \cdot {\left(a \cdot \left(angle \cdot \pi\right)\right)}^{2}\\
\end{array}
\end{array}
if a < 5.19999999999999963e80Initial program 76.9%
*-commutative76.9%
clear-num76.9%
un-div-inv77.3%
Applied egg-rr77.3%
Taylor expanded in angle around 0 68.8%
associate-*r*68.8%
Simplified68.8%
expm1-log1p-u68.8%
expm1-undefine68.8%
associate-/r/68.8%
Applied egg-rr68.8%
Taylor expanded in a around 0 66.6%
unpow266.6%
*-commutative66.6%
associate-*r*67.1%
unpow267.1%
swap-sqr67.1%
unpow267.1%
associate-*r*66.6%
*-commutative66.6%
associate-*r*66.7%
metadata-eval66.7%
associate-/r/66.7%
associate-*l/67.1%
*-lft-identity67.1%
Simplified67.1%
if 5.19999999999999963e80 < a Initial program 91.6%
*-commutative91.6%
clear-num91.6%
un-div-inv91.6%
Applied egg-rr91.6%
Taylor expanded in angle around 0 90.7%
associate-*r*90.7%
Simplified90.7%
Taylor expanded in a around inf 70.3%
unpow270.3%
unpow270.3%
unpow270.3%
swap-sqr70.3%
swap-sqr86.1%
unpow286.1%
*-commutative86.1%
Simplified86.1%
Final simplification70.1%
(FPCore (a b angle) :precision binary64 (if (<= a 9e+80) (pow (* b (cos (* 0.005555555555555556 (* angle PI)))) 2.0) (* 3.08641975308642e-5 (pow (* a (* angle PI)) 2.0))))
double code(double a, double b, double angle) {
double tmp;
if (a <= 9e+80) {
tmp = pow((b * cos((0.005555555555555556 * (angle * ((double) M_PI))))), 2.0);
} else {
tmp = 3.08641975308642e-5 * pow((a * (angle * ((double) M_PI))), 2.0);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (a <= 9e+80) {
tmp = Math.pow((b * Math.cos((0.005555555555555556 * (angle * Math.PI)))), 2.0);
} else {
tmp = 3.08641975308642e-5 * Math.pow((a * (angle * Math.PI)), 2.0);
}
return tmp;
}
def code(a, b, angle): tmp = 0 if a <= 9e+80: tmp = math.pow((b * math.cos((0.005555555555555556 * (angle * math.pi)))), 2.0) else: tmp = 3.08641975308642e-5 * math.pow((a * (angle * math.pi)), 2.0) return tmp
function code(a, b, angle) tmp = 0.0 if (a <= 9e+80) tmp = Float64(b * cos(Float64(0.005555555555555556 * Float64(angle * pi)))) ^ 2.0; else tmp = Float64(3.08641975308642e-5 * (Float64(a * Float64(angle * pi)) ^ 2.0)); end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (a <= 9e+80) tmp = (b * cos((0.005555555555555556 * (angle * pi)))) ^ 2.0; else tmp = 3.08641975308642e-5 * ((a * (angle * pi)) ^ 2.0); end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[a, 9e+80], N[Power[N[(b * N[Cos[N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[(3.08641975308642e-5 * N[Power[N[(a * N[(angle * Pi), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 9 \cdot 10^{+80}:\\
\;\;\;\;{\left(b \cdot \cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;3.08641975308642 \cdot 10^{-5} \cdot {\left(a \cdot \left(angle \cdot \pi\right)\right)}^{2}\\
\end{array}
\end{array}
if a < 9.00000000000000013e80Initial program 76.9%
unpow276.9%
associate-*l/76.5%
associate-/l*77.0%
unpow277.0%
Simplified77.4%
Taylor expanded in a around 0 66.6%
*-commutative66.6%
associate-*r*67.1%
unpow267.1%
unpow267.1%
swap-sqr67.1%
unpow267.1%
associate-*r*66.6%
*-commutative66.6%
Simplified66.6%
if 9.00000000000000013e80 < a Initial program 91.6%
*-commutative91.6%
clear-num91.6%
un-div-inv91.6%
Applied egg-rr91.6%
Taylor expanded in angle around 0 90.7%
associate-*r*90.7%
Simplified90.7%
Taylor expanded in a around inf 70.3%
unpow270.3%
unpow270.3%
unpow270.3%
swap-sqr70.3%
swap-sqr86.1%
unpow286.1%
*-commutative86.1%
Simplified86.1%
Final simplification69.7%
(FPCore (a b angle) :precision binary64 (if (<= a 9.5e+80) (* b b) (* 3.08641975308642e-5 (pow (* a (* angle PI)) 2.0))))
double code(double a, double b, double angle) {
double tmp;
if (a <= 9.5e+80) {
tmp = b * b;
} else {
tmp = 3.08641975308642e-5 * pow((a * (angle * ((double) M_PI))), 2.0);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (a <= 9.5e+80) {
tmp = b * b;
} else {
tmp = 3.08641975308642e-5 * Math.pow((a * (angle * Math.PI)), 2.0);
}
return tmp;
}
def code(a, b, angle): tmp = 0 if a <= 9.5e+80: tmp = b * b else: tmp = 3.08641975308642e-5 * math.pow((a * (angle * math.pi)), 2.0) return tmp
function code(a, b, angle) tmp = 0.0 if (a <= 9.5e+80) tmp = Float64(b * b); else tmp = Float64(3.08641975308642e-5 * (Float64(a * Float64(angle * pi)) ^ 2.0)); end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (a <= 9.5e+80) tmp = b * b; else tmp = 3.08641975308642e-5 * ((a * (angle * pi)) ^ 2.0); end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[a, 9.5e+80], N[(b * b), $MachinePrecision], N[(3.08641975308642e-5 * N[Power[N[(a * N[(angle * Pi), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 9.5 \cdot 10^{+80}:\\
\;\;\;\;b \cdot b\\
\mathbf{else}:\\
\;\;\;\;3.08641975308642 \cdot 10^{-5} \cdot {\left(a \cdot \left(angle \cdot \pi\right)\right)}^{2}\\
\end{array}
\end{array}
if a < 9.499999999999999e80Initial program 76.9%
unpow276.9%
associate-*l/76.5%
associate-/l*77.0%
unpow277.0%
Simplified77.4%
Taylor expanded in angle around 0 66.6%
unpow266.6%
Applied egg-rr66.6%
if 9.499999999999999e80 < a Initial program 91.6%
*-commutative91.6%
clear-num91.6%
un-div-inv91.6%
Applied egg-rr91.6%
Taylor expanded in angle around 0 90.7%
associate-*r*90.7%
Simplified90.7%
Taylor expanded in a around inf 70.3%
unpow270.3%
unpow270.3%
unpow270.3%
swap-sqr70.3%
swap-sqr86.1%
unpow286.1%
*-commutative86.1%
Simplified86.1%
Final simplification69.7%
(FPCore (a b angle) :precision binary64 (* b b))
double code(double a, double b, double angle) {
return b * b;
}
real(8) function code(a, b, angle)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle
code = b * b
end function
public static double code(double a, double b, double angle) {
return b * b;
}
def code(a, b, angle): return b * b
function code(a, b, angle) return Float64(b * b) end
function tmp = code(a, b, angle) tmp = b * b; end
code[a_, b_, angle_] := N[(b * b), $MachinePrecision]
\begin{array}{l}
\\
b \cdot b
\end{array}
Initial program 79.3%
unpow279.3%
associate-*l/78.9%
associate-/l*79.4%
unpow279.4%
Simplified79.7%
Taylor expanded in angle around 0 61.4%
unpow261.4%
Applied egg-rr61.4%
herbie shell --seed 2024170
(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)))