
(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 12 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 (* (pow (cbrt PI) 2.0) (* (cbrt PI) (* 0.005555555555555556 angle)))))
2.0)
(pow (* b (sin (* PI (* 0.005555555555555556 angle)))) 2.0)))
double code(double a, double b, double angle) {
return pow((a * cos((pow(cbrt(((double) M_PI)), 2.0) * (cbrt(((double) M_PI)) * (0.005555555555555556 * angle))))), 2.0) + pow((b * sin((((double) M_PI) * (0.005555555555555556 * angle)))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.cos((Math.pow(Math.cbrt(Math.PI), 2.0) * (Math.cbrt(Math.PI) * (0.005555555555555556 * angle))))), 2.0) + Math.pow((b * Math.sin((Math.PI * (0.005555555555555556 * angle)))), 2.0);
}
function code(a, b, angle) return Float64((Float64(a * cos(Float64((cbrt(pi) ^ 2.0) * Float64(cbrt(pi) * Float64(0.005555555555555556 * angle))))) ^ 2.0) + (Float64(b * sin(Float64(pi * Float64(0.005555555555555556 * angle)))) ^ 2.0)) end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Cos[N[(N[Power[N[Power[Pi, 1/3], $MachinePrecision], 2.0], $MachinePrecision] * N[(N[Power[Pi, 1/3], $MachinePrecision] * N[(0.005555555555555556 * angle), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[N[(Pi * N[(0.005555555555555556 * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \cos \left({\left(\sqrt[3]{\pi}\right)}^{2} \cdot \left(\sqrt[3]{\pi} \cdot \left(0.005555555555555556 \cdot angle\right)\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)\right)}^{2}
\end{array}
Initial program 81.0%
associate-*r/81.0%
metadata-eval81.0%
metadata-eval81.0%
distribute-neg-frac281.0%
distribute-frac-neg81.0%
distribute-rgt-neg-out81.0%
associate-/l*81.0%
neg-mul-181.0%
*-commutative81.0%
associate-/l*81.1%
metadata-eval81.1%
metadata-eval81.1%
Simplified81.2%
metadata-eval81.2%
div-inv81.1%
add-sqr-sqrt42.4%
pow242.4%
div-inv42.5%
metadata-eval42.5%
associate-*r*42.5%
*-commutative42.5%
Applied egg-rr42.5%
unpow242.5%
add-sqr-sqrt81.1%
*-commutative81.1%
associate-*r*81.2%
add-cube-cbrt81.3%
associate-*l*81.3%
pow281.3%
*-commutative81.3%
Applied egg-rr81.3%
Final simplification81.3%
(FPCore (a b angle) :precision binary64 (+ (pow (* b (sin (* PI (* 0.005555555555555556 angle)))) 2.0) (pow (* a (cos (* (sqrt PI) (* (* 0.005555555555555556 angle) (sqrt PI))))) 2.0)))
double code(double a, double b, double angle) {
return pow((b * sin((((double) M_PI) * (0.005555555555555556 * angle)))), 2.0) + pow((a * cos((sqrt(((double) M_PI)) * ((0.005555555555555556 * angle) * sqrt(((double) M_PI)))))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((b * Math.sin((Math.PI * (0.005555555555555556 * angle)))), 2.0) + Math.pow((a * Math.cos((Math.sqrt(Math.PI) * ((0.005555555555555556 * angle) * Math.sqrt(Math.PI))))), 2.0);
}
def code(a, b, angle): return math.pow((b * math.sin((math.pi * (0.005555555555555556 * angle)))), 2.0) + math.pow((a * math.cos((math.sqrt(math.pi) * ((0.005555555555555556 * angle) * math.sqrt(math.pi))))), 2.0)
function code(a, b, angle) return Float64((Float64(b * sin(Float64(pi * Float64(0.005555555555555556 * angle)))) ^ 2.0) + (Float64(a * cos(Float64(sqrt(pi) * Float64(Float64(0.005555555555555556 * angle) * sqrt(pi))))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((b * sin((pi * (0.005555555555555556 * angle)))) ^ 2.0) + ((a * cos((sqrt(pi) * ((0.005555555555555556 * angle) * sqrt(pi))))) ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(b * N[Sin[N[(Pi * N[(0.005555555555555556 * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(a * N[Cos[N[(N[Sqrt[Pi], $MachinePrecision] * N[(N[(0.005555555555555556 * angle), $MachinePrecision] * N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(b \cdot \sin \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)\right)}^{2} + {\left(a \cdot \cos \left(\sqrt{\pi} \cdot \left(\left(0.005555555555555556 \cdot angle\right) \cdot \sqrt{\pi}\right)\right)\right)}^{2}
\end{array}
Initial program 81.0%
associate-*r/81.0%
metadata-eval81.0%
metadata-eval81.0%
distribute-neg-frac281.0%
distribute-frac-neg81.0%
distribute-rgt-neg-out81.0%
associate-/l*81.0%
neg-mul-181.0%
*-commutative81.0%
associate-/l*81.1%
metadata-eval81.1%
metadata-eval81.1%
Simplified81.2%
metadata-eval81.2%
div-inv81.1%
add-sqr-sqrt42.4%
pow242.4%
div-inv42.5%
metadata-eval42.5%
associate-*r*42.5%
*-commutative42.5%
Applied egg-rr42.5%
unpow242.5%
add-sqr-sqrt81.1%
*-commutative81.1%
associate-*r*81.2%
*-commutative81.2%
add-sqr-sqrt81.2%
associate-*r*81.3%
*-commutative81.3%
Applied egg-rr81.3%
Final simplification81.3%
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* PI (* 0.005555555555555556 angle)))) (+ (pow (* b (sin t_0)) 2.0) (pow (* a (cos (pow (cbrt t_0) 3.0))) 2.0))))
double code(double a, double b, double angle) {
double t_0 = ((double) M_PI) * (0.005555555555555556 * angle);
return pow((b * sin(t_0)), 2.0) + pow((a * cos(pow(cbrt(t_0), 3.0))), 2.0);
}
public static double code(double a, double b, double angle) {
double t_0 = Math.PI * (0.005555555555555556 * angle);
return Math.pow((b * Math.sin(t_0)), 2.0) + Math.pow((a * Math.cos(Math.pow(Math.cbrt(t_0), 3.0))), 2.0);
}
function code(a, b, angle) t_0 = Float64(pi * Float64(0.005555555555555556 * angle)) return Float64((Float64(b * sin(t_0)) ^ 2.0) + (Float64(a * cos((cbrt(t_0) ^ 3.0))) ^ 2.0)) end
code[a_, b_, angle_] := Block[{t$95$0 = N[(Pi * N[(0.005555555555555556 * angle), $MachinePrecision]), $MachinePrecision]}, N[(N[Power[N[(b * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(a * N[Cos[N[Power[N[Power[t$95$0, 1/3], $MachinePrecision], 3.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \pi \cdot \left(0.005555555555555556 \cdot angle\right)\\
{\left(b \cdot \sin t\_0\right)}^{2} + {\left(a \cdot \cos \left({\left(\sqrt[3]{t\_0}\right)}^{3}\right)\right)}^{2}
\end{array}
\end{array}
Initial program 81.0%
associate-*r/81.0%
metadata-eval81.0%
metadata-eval81.0%
distribute-neg-frac281.0%
distribute-frac-neg81.0%
distribute-rgt-neg-out81.0%
associate-/l*81.0%
neg-mul-181.0%
*-commutative81.0%
associate-/l*81.1%
metadata-eval81.1%
metadata-eval81.1%
Simplified81.2%
metadata-eval81.2%
div-inv81.1%
associate-*r/81.1%
clear-num81.1%
Applied egg-rr81.1%
associate-/r/81.1%
metadata-eval81.1%
add-sqr-sqrt42.5%
unpow242.5%
add-cube-cbrt42.5%
pow342.5%
unpow242.5%
add-sqr-sqrt81.2%
*-commutative81.2%
associate-*r*81.2%
*-commutative81.2%
Applied egg-rr81.2%
Final simplification81.2%
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* PI (* 0.005555555555555556 angle)))) (pow (hypot (* a (cos t_0)) (* b (sin t_0))) 2.0)))
double code(double a, double b, double angle) {
double t_0 = ((double) M_PI) * (0.005555555555555556 * angle);
return pow(hypot((a * cos(t_0)), (b * sin(t_0))), 2.0);
}
public static double code(double a, double b, double angle) {
double t_0 = Math.PI * (0.005555555555555556 * angle);
return Math.pow(Math.hypot((a * Math.cos(t_0)), (b * Math.sin(t_0))), 2.0);
}
def code(a, b, angle): t_0 = math.pi * (0.005555555555555556 * angle) return math.pow(math.hypot((a * math.cos(t_0)), (b * math.sin(t_0))), 2.0)
function code(a, b, angle) t_0 = Float64(pi * Float64(0.005555555555555556 * angle)) return hypot(Float64(a * cos(t_0)), Float64(b * sin(t_0))) ^ 2.0 end
function tmp = code(a, b, angle) t_0 = pi * (0.005555555555555556 * angle); tmp = hypot((a * cos(t_0)), (b * sin(t_0))) ^ 2.0; end
code[a_, b_, angle_] := Block[{t$95$0 = N[(Pi * N[(0.005555555555555556 * angle), $MachinePrecision]), $MachinePrecision]}, N[Power[N[Sqrt[N[(a * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision] ^ 2 + N[(b * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision], 2.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \pi \cdot \left(0.005555555555555556 \cdot angle\right)\\
{\left(\mathsf{hypot}\left(a \cdot \cos t\_0, b \cdot \sin t\_0\right)\right)}^{2}
\end{array}
\end{array}
Initial program 81.0%
associate-*r/81.0%
metadata-eval81.0%
metadata-eval81.0%
distribute-neg-frac281.0%
distribute-frac-neg81.0%
distribute-rgt-neg-out81.0%
associate-/l*81.0%
neg-mul-181.0%
*-commutative81.0%
associate-/l*81.1%
metadata-eval81.1%
metadata-eval81.1%
Simplified81.2%
metadata-eval81.2%
div-inv81.1%
add-sqr-sqrt42.4%
pow242.4%
div-inv42.5%
metadata-eval42.5%
associate-*r*42.5%
*-commutative42.5%
Applied egg-rr42.5%
Applied egg-rr81.2%
(FPCore (a b angle) :precision binary64 (+ (pow (* b (sin (* PI (* 0.005555555555555556 angle)))) 2.0) (pow a 2.0)))
double code(double a, double b, double angle) {
return pow((b * sin((((double) M_PI) * (0.005555555555555556 * angle)))), 2.0) + pow(a, 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((b * Math.sin((Math.PI * (0.005555555555555556 * angle)))), 2.0) + Math.pow(a, 2.0);
}
def code(a, b, angle): return math.pow((b * math.sin((math.pi * (0.005555555555555556 * angle)))), 2.0) + math.pow(a, 2.0)
function code(a, b, angle) return Float64((Float64(b * sin(Float64(pi * Float64(0.005555555555555556 * angle)))) ^ 2.0) + (a ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((b * sin((pi * (0.005555555555555556 * angle)))) ^ 2.0) + (a ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(b * N[Sin[N[(Pi * N[(0.005555555555555556 * angle), $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(0.005555555555555556 \cdot angle\right)\right)\right)}^{2} + {a}^{2}
\end{array}
Initial program 81.0%
associate-*r/81.0%
metadata-eval81.0%
metadata-eval81.0%
distribute-neg-frac281.0%
distribute-frac-neg81.0%
distribute-rgt-neg-out81.0%
associate-/l*81.0%
neg-mul-181.0%
*-commutative81.0%
associate-/l*81.1%
metadata-eval81.1%
metadata-eval81.1%
Simplified81.2%
Taylor expanded in angle around 0 81.0%
Final simplification81.0%
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* PI (* 0.005555555555555556 angle)))) (if (<= a 1.4e-132) (pow (* b (sin t_0)) 2.0) (pow (* a (cos t_0)) 2.0))))
double code(double a, double b, double angle) {
double t_0 = ((double) M_PI) * (0.005555555555555556 * angle);
double tmp;
if (a <= 1.4e-132) {
tmp = pow((b * sin(t_0)), 2.0);
} else {
tmp = pow((a * cos(t_0)), 2.0);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double t_0 = Math.PI * (0.005555555555555556 * angle);
double tmp;
if (a <= 1.4e-132) {
tmp = Math.pow((b * Math.sin(t_0)), 2.0);
} else {
tmp = Math.pow((a * Math.cos(t_0)), 2.0);
}
return tmp;
}
def code(a, b, angle): t_0 = math.pi * (0.005555555555555556 * angle) tmp = 0 if a <= 1.4e-132: tmp = math.pow((b * math.sin(t_0)), 2.0) else: tmp = math.pow((a * math.cos(t_0)), 2.0) return tmp
function code(a, b, angle) t_0 = Float64(pi * Float64(0.005555555555555556 * angle)) tmp = 0.0 if (a <= 1.4e-132) tmp = Float64(b * sin(t_0)) ^ 2.0; else tmp = Float64(a * cos(t_0)) ^ 2.0; end return tmp end
function tmp_2 = code(a, b, angle) t_0 = pi * (0.005555555555555556 * angle); tmp = 0.0; if (a <= 1.4e-132) tmp = (b * sin(t_0)) ^ 2.0; else tmp = (a * cos(t_0)) ^ 2.0; end tmp_2 = tmp; end
code[a_, b_, angle_] := Block[{t$95$0 = N[(Pi * N[(0.005555555555555556 * angle), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, 1.4e-132], N[Power[N[(b * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[Power[N[(a * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \pi \cdot \left(0.005555555555555556 \cdot angle\right)\\
\mathbf{if}\;a \leq 1.4 \cdot 10^{-132}:\\
\;\;\;\;{\left(b \cdot \sin t\_0\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;{\left(a \cdot \cos t\_0\right)}^{2}\\
\end{array}
\end{array}
if a < 1.40000000000000001e-132Initial program 78.9%
associate-*r/78.9%
metadata-eval78.9%
metadata-eval78.9%
distribute-neg-frac278.9%
distribute-frac-neg78.9%
distribute-rgt-neg-out78.9%
associate-/l*78.9%
neg-mul-178.9%
*-commutative78.9%
associate-/l*78.9%
metadata-eval78.9%
metadata-eval78.9%
Simplified79.0%
metadata-eval79.0%
div-inv79.0%
add-sqr-sqrt44.0%
pow244.0%
div-inv44.0%
metadata-eval44.0%
associate-*r*44.1%
*-commutative44.1%
Applied egg-rr44.1%
unpow244.1%
add-sqr-sqrt79.0%
metadata-eval79.0%
associate-/r/79.0%
clear-num79.0%
expm1-log1p-u67.4%
div-inv67.4%
metadata-eval67.4%
associate-*r*67.4%
*-commutative67.4%
Applied egg-rr67.4%
expm1-log1p-u79.0%
add-cube-cbrt79.1%
unpow279.1%
associate-*r*79.2%
*-commutative79.2%
associate-*r*79.1%
associate-*l*79.1%
Applied egg-rr79.1%
Taylor expanded in a around 0 40.1%
unpow240.1%
associate-*r*40.2%
*-commutative40.2%
unpow240.2%
swap-sqr45.2%
unpow245.2%
Simplified45.2%
if 1.40000000000000001e-132 < a Initial program 84.9%
associate-*r/85.0%
metadata-eval85.0%
metadata-eval85.0%
distribute-neg-frac285.0%
distribute-frac-neg85.0%
distribute-rgt-neg-out85.0%
associate-/l*84.9%
neg-mul-184.9%
*-commutative84.9%
associate-/l*85.1%
metadata-eval85.1%
metadata-eval85.1%
Simplified85.1%
metadata-eval85.1%
div-inv84.9%
add-sqr-sqrt39.6%
pow239.6%
div-inv39.6%
metadata-eval39.6%
associate-*r*39.6%
*-commutative39.6%
Applied egg-rr39.6%
unpow239.6%
add-sqr-sqrt84.9%
metadata-eval84.9%
associate-/r/85.0%
clear-num85.0%
expm1-log1p-u68.4%
div-inv68.4%
metadata-eval68.4%
associate-*r*68.4%
*-commutative68.4%
Applied egg-rr68.4%
expm1-log1p-u85.1%
add-cube-cbrt85.2%
unpow285.2%
associate-*r*85.1%
*-commutative85.1%
associate-*r*85.1%
associate-*l*85.1%
Applied egg-rr85.1%
Taylor expanded in a around inf 74.9%
unpow274.9%
associate-*r*75.1%
*-commutative75.1%
unpow275.1%
swap-sqr75.1%
unpow275.1%
Simplified75.1%
(FPCore (a b angle) :precision binary64 (if (<= a 9e-132) (pow (* b (sin (* angle (* PI 0.005555555555555556)))) 2.0) (pow (* a (cos (* PI (* 0.005555555555555556 angle)))) 2.0)))
double code(double a, double b, double angle) {
double tmp;
if (a <= 9e-132) {
tmp = pow((b * sin((angle * (((double) M_PI) * 0.005555555555555556)))), 2.0);
} else {
tmp = pow((a * cos((((double) M_PI) * (0.005555555555555556 * angle)))), 2.0);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (a <= 9e-132) {
tmp = Math.pow((b * Math.sin((angle * (Math.PI * 0.005555555555555556)))), 2.0);
} else {
tmp = Math.pow((a * Math.cos((Math.PI * (0.005555555555555556 * angle)))), 2.0);
}
return tmp;
}
def code(a, b, angle): tmp = 0 if a <= 9e-132: tmp = math.pow((b * math.sin((angle * (math.pi * 0.005555555555555556)))), 2.0) else: tmp = math.pow((a * math.cos((math.pi * (0.005555555555555556 * angle)))), 2.0) return tmp
function code(a, b, angle) tmp = 0.0 if (a <= 9e-132) tmp = Float64(b * sin(Float64(angle * Float64(pi * 0.005555555555555556)))) ^ 2.0; else tmp = Float64(a * cos(Float64(pi * Float64(0.005555555555555556 * angle)))) ^ 2.0; end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (a <= 9e-132) tmp = (b * sin((angle * (pi * 0.005555555555555556)))) ^ 2.0; else tmp = (a * cos((pi * (0.005555555555555556 * angle)))) ^ 2.0; end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[a, 9e-132], N[Power[N[(b * N[Sin[N[(angle * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[Power[N[(a * N[Cos[N[(Pi * N[(0.005555555555555556 * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 9 \cdot 10^{-132}:\\
\;\;\;\;{\left(b \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;{\left(a \cdot \cos \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)\right)}^{2}\\
\end{array}
\end{array}
if a < 8.9999999999999999e-132Initial program 78.9%
associate-*r/78.9%
metadata-eval78.9%
metadata-eval78.9%
distribute-neg-frac278.9%
distribute-frac-neg78.9%
distribute-rgt-neg-out78.9%
associate-/l*78.9%
neg-mul-178.9%
*-commutative78.9%
associate-/l*78.9%
metadata-eval78.9%
metadata-eval78.9%
Simplified79.0%
metadata-eval79.0%
div-inv79.0%
add-sqr-sqrt44.0%
pow244.0%
div-inv44.0%
metadata-eval44.0%
associate-*r*44.1%
*-commutative44.1%
Applied egg-rr44.1%
Taylor expanded in a around 0 40.1%
unpow240.1%
associate-*r*40.2%
*-commutative40.2%
unpow240.2%
swap-sqr45.2%
unpow245.2%
associate-*r*45.2%
*-commutative45.2%
*-commutative45.2%
Simplified45.2%
if 8.9999999999999999e-132 < a Initial program 84.9%
associate-*r/85.0%
metadata-eval85.0%
metadata-eval85.0%
distribute-neg-frac285.0%
distribute-frac-neg85.0%
distribute-rgt-neg-out85.0%
associate-/l*84.9%
neg-mul-184.9%
*-commutative84.9%
associate-/l*85.1%
metadata-eval85.1%
metadata-eval85.1%
Simplified85.1%
metadata-eval85.1%
div-inv84.9%
add-sqr-sqrt39.6%
pow239.6%
div-inv39.6%
metadata-eval39.6%
associate-*r*39.6%
*-commutative39.6%
Applied egg-rr39.6%
unpow239.6%
add-sqr-sqrt84.9%
metadata-eval84.9%
associate-/r/85.0%
clear-num85.0%
expm1-log1p-u68.4%
div-inv68.4%
metadata-eval68.4%
associate-*r*68.4%
*-commutative68.4%
Applied egg-rr68.4%
expm1-log1p-u85.1%
add-cube-cbrt85.2%
unpow285.2%
associate-*r*85.1%
*-commutative85.1%
associate-*r*85.1%
associate-*l*85.1%
Applied egg-rr85.1%
Taylor expanded in a around inf 74.9%
unpow274.9%
associate-*r*75.1%
*-commutative75.1%
unpow275.1%
swap-sqr75.1%
unpow275.1%
Simplified75.1%
Final simplification55.9%
(FPCore (a b angle) :precision binary64 (if (<= a 1.4e-132) (pow (* b (sin (* 0.005555555555555556 (* PI angle)))) 2.0) (pow (* a (cos (* PI (* 0.005555555555555556 angle)))) 2.0)))
double code(double a, double b, double angle) {
double tmp;
if (a <= 1.4e-132) {
tmp = pow((b * sin((0.005555555555555556 * (((double) M_PI) * angle)))), 2.0);
} else {
tmp = pow((a * cos((((double) M_PI) * (0.005555555555555556 * angle)))), 2.0);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (a <= 1.4e-132) {
tmp = Math.pow((b * Math.sin((0.005555555555555556 * (Math.PI * angle)))), 2.0);
} else {
tmp = Math.pow((a * Math.cos((Math.PI * (0.005555555555555556 * angle)))), 2.0);
}
return tmp;
}
def code(a, b, angle): tmp = 0 if a <= 1.4e-132: tmp = math.pow((b * math.sin((0.005555555555555556 * (math.pi * angle)))), 2.0) else: tmp = math.pow((a * math.cos((math.pi * (0.005555555555555556 * angle)))), 2.0) return tmp
function code(a, b, angle) tmp = 0.0 if (a <= 1.4e-132) tmp = Float64(b * sin(Float64(0.005555555555555556 * Float64(pi * angle)))) ^ 2.0; else tmp = Float64(a * cos(Float64(pi * Float64(0.005555555555555556 * angle)))) ^ 2.0; end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (a <= 1.4e-132) tmp = (b * sin((0.005555555555555556 * (pi * angle)))) ^ 2.0; else tmp = (a * cos((pi * (0.005555555555555556 * angle)))) ^ 2.0; end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[a, 1.4e-132], N[Power[N[(b * N[Sin[N[(0.005555555555555556 * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[Power[N[(a * N[Cos[N[(Pi * N[(0.005555555555555556 * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 1.4 \cdot 10^{-132}:\\
\;\;\;\;{\left(b \cdot \sin \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;{\left(a \cdot \cos \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)\right)}^{2}\\
\end{array}
\end{array}
if a < 1.40000000000000001e-132Initial program 78.9%
associate-*r/78.9%
metadata-eval78.9%
metadata-eval78.9%
distribute-neg-frac278.9%
distribute-frac-neg78.9%
distribute-rgt-neg-out78.9%
associate-/l*78.9%
neg-mul-178.9%
*-commutative78.9%
associate-/l*78.9%
metadata-eval78.9%
metadata-eval78.9%
Simplified79.0%
Taylor expanded in a around 0 40.1%
unpow240.1%
*-commutative40.1%
unpow240.1%
swap-sqr45.1%
unpow245.1%
*-commutative45.1%
Simplified45.1%
if 1.40000000000000001e-132 < a Initial program 84.9%
associate-*r/85.0%
metadata-eval85.0%
metadata-eval85.0%
distribute-neg-frac285.0%
distribute-frac-neg85.0%
distribute-rgt-neg-out85.0%
associate-/l*84.9%
neg-mul-184.9%
*-commutative84.9%
associate-/l*85.1%
metadata-eval85.1%
metadata-eval85.1%
Simplified85.1%
metadata-eval85.1%
div-inv84.9%
add-sqr-sqrt39.6%
pow239.6%
div-inv39.6%
metadata-eval39.6%
associate-*r*39.6%
*-commutative39.6%
Applied egg-rr39.6%
unpow239.6%
add-sqr-sqrt84.9%
metadata-eval84.9%
associate-/r/85.0%
clear-num85.0%
expm1-log1p-u68.4%
div-inv68.4%
metadata-eval68.4%
associate-*r*68.4%
*-commutative68.4%
Applied egg-rr68.4%
expm1-log1p-u85.1%
add-cube-cbrt85.2%
unpow285.2%
associate-*r*85.1%
*-commutative85.1%
associate-*r*85.1%
associate-*l*85.1%
Applied egg-rr85.1%
Taylor expanded in a around inf 74.9%
unpow274.9%
associate-*r*75.1%
*-commutative75.1%
unpow275.1%
swap-sqr75.1%
unpow275.1%
Simplified75.1%
Final simplification55.8%
(FPCore (a b angle) :precision binary64 (pow (* a (cos (* PI (* 0.005555555555555556 angle)))) 2.0))
double code(double a, double b, double angle) {
return pow((a * cos((((double) M_PI) * (0.005555555555555556 * angle)))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.cos((Math.PI * (0.005555555555555556 * angle)))), 2.0);
}
def code(a, b, angle): return math.pow((a * math.cos((math.pi * (0.005555555555555556 * angle)))), 2.0)
function code(a, b, angle) return Float64(a * cos(Float64(pi * Float64(0.005555555555555556 * angle)))) ^ 2.0 end
function tmp = code(a, b, angle) tmp = (a * cos((pi * (0.005555555555555556 * angle)))) ^ 2.0; end
code[a_, b_, angle_] := N[Power[N[(a * N[Cos[N[(Pi * N[(0.005555555555555556 * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \cos \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)\right)}^{2}
\end{array}
Initial program 81.0%
associate-*r/81.0%
metadata-eval81.0%
metadata-eval81.0%
distribute-neg-frac281.0%
distribute-frac-neg81.0%
distribute-rgt-neg-out81.0%
associate-/l*81.0%
neg-mul-181.0%
*-commutative81.0%
associate-/l*81.1%
metadata-eval81.1%
metadata-eval81.1%
Simplified81.2%
metadata-eval81.2%
div-inv81.1%
add-sqr-sqrt42.4%
pow242.4%
div-inv42.5%
metadata-eval42.5%
associate-*r*42.5%
*-commutative42.5%
Applied egg-rr42.5%
unpow242.5%
add-sqr-sqrt81.1%
metadata-eval81.1%
associate-/r/81.1%
clear-num81.1%
expm1-log1p-u67.8%
div-inv67.8%
metadata-eval67.8%
associate-*r*67.8%
*-commutative67.8%
Applied egg-rr67.8%
expm1-log1p-u81.2%
add-cube-cbrt81.3%
unpow281.3%
associate-*r*81.3%
*-commutative81.3%
associate-*r*81.2%
associate-*l*81.2%
Applied egg-rr81.2%
Taylor expanded in a around inf 64.0%
unpow264.0%
associate-*r*64.0%
*-commutative64.0%
unpow264.0%
swap-sqr64.0%
unpow264.0%
Simplified64.0%
(FPCore (a b angle) :precision binary64 (pow (* a (cos (* angle (* PI -0.005555555555555556)))) 2.0))
double code(double a, double b, double angle) {
return pow((a * cos((angle * (((double) M_PI) * -0.005555555555555556)))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.cos((angle * (Math.PI * -0.005555555555555556)))), 2.0);
}
def code(a, b, angle): return math.pow((a * math.cos((angle * (math.pi * -0.005555555555555556)))), 2.0)
function code(a, b, angle) return Float64(a * cos(Float64(angle * Float64(pi * -0.005555555555555556)))) ^ 2.0 end
function tmp = code(a, b, angle) tmp = (a * cos((angle * (pi * -0.005555555555555556)))) ^ 2.0; end
code[a_, b_, angle_] := N[Power[N[(a * N[Cos[N[(angle * N[(Pi * -0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \cos \left(angle \cdot \left(\pi \cdot -0.005555555555555556\right)\right)\right)}^{2}
\end{array}
Initial program 81.0%
associate-*r/81.0%
metadata-eval81.0%
metadata-eval81.0%
distribute-neg-frac281.0%
distribute-frac-neg81.0%
distribute-rgt-neg-out81.0%
associate-/l*81.0%
neg-mul-181.0%
*-commutative81.0%
associate-/l*81.1%
metadata-eval81.1%
metadata-eval81.1%
Simplified81.2%
metadata-eval81.2%
div-inv81.1%
add-sqr-sqrt42.4%
pow242.4%
div-inv42.5%
metadata-eval42.5%
associate-*r*42.5%
*-commutative42.5%
Applied egg-rr42.5%
Taylor expanded in a around inf 64.0%
Simplified64.0%
(FPCore (a b angle) :precision binary64 (pow (* a (cos (* 0.005555555555555556 (* PI angle)))) 2.0))
double code(double a, double b, double angle) {
return pow((a * cos((0.005555555555555556 * (((double) M_PI) * angle)))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.cos((0.005555555555555556 * (Math.PI * angle)))), 2.0);
}
def code(a, b, angle): return math.pow((a * math.cos((0.005555555555555556 * (math.pi * angle)))), 2.0)
function code(a, b, angle) return Float64(a * cos(Float64(0.005555555555555556 * Float64(pi * angle)))) ^ 2.0 end
function tmp = code(a, b, angle) tmp = (a * cos((0.005555555555555556 * (pi * angle)))) ^ 2.0; end
code[a_, b_, angle_] := N[Power[N[(a * N[Cos[N[(0.005555555555555556 * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \cos \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)\right)}^{2}
\end{array}
Initial program 81.0%
associate-*r/81.0%
metadata-eval81.0%
metadata-eval81.0%
distribute-neg-frac281.0%
distribute-frac-neg81.0%
distribute-rgt-neg-out81.0%
associate-/l*81.0%
neg-mul-181.0%
*-commutative81.0%
associate-/l*81.1%
metadata-eval81.1%
metadata-eval81.1%
Simplified81.2%
Taylor expanded in a around inf 64.0%
*-commutative64.0%
unpow264.0%
unpow264.0%
swap-sqr64.0%
unpow264.0%
*-commutative64.0%
Simplified64.0%
Final simplification64.0%
(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.0%
associate-*r/81.0%
metadata-eval81.0%
metadata-eval81.0%
distribute-neg-frac281.0%
distribute-frac-neg81.0%
distribute-rgt-neg-out81.0%
associate-/l*81.0%
neg-mul-181.0%
*-commutative81.0%
associate-/l*81.1%
metadata-eval81.1%
metadata-eval81.1%
Simplified81.2%
Taylor expanded in angle around 0 63.9%
unpow263.9%
Applied egg-rr63.9%
herbie shell --seed 2024177
(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)))