
(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 14 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 (+ (pow (* a (sin (* (/ angle 180.0) PI))) 2.0) (pow (* b (cos (pow (* (cbrt (* angle 0.005555555555555556)) (cbrt PI)) 3.0))) 2.0)))
double code(double a, double b, double angle) {
return pow((a * sin(((angle / 180.0) * ((double) M_PI)))), 2.0) + pow((b * cos(pow((cbrt((angle * 0.005555555555555556)) * cbrt(((double) M_PI))), 3.0))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.sin(((angle / 180.0) * Math.PI))), 2.0) + Math.pow((b * Math.cos(Math.pow((Math.cbrt((angle * 0.005555555555555556)) * Math.cbrt(Math.PI)), 3.0))), 2.0);
}
function code(a, b, angle) return Float64((Float64(a * sin(Float64(Float64(angle / 180.0) * pi))) ^ 2.0) + (Float64(b * cos((Float64(cbrt(Float64(angle * 0.005555555555555556)) * cbrt(pi)) ^ 3.0))) ^ 2.0)) end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Sin[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[N[Power[N[(N[Power[N[(angle * 0.005555555555555556), $MachinePrecision], 1/3], $MachinePrecision] * N[Power[Pi, 1/3], $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left({\left(\sqrt[3]{angle \cdot 0.005555555555555556} \cdot \sqrt[3]{\pi}\right)}^{3}\right)\right)}^{2}
\end{array}
Initial program 81.5%
add-cube-cbrt81.5%
pow381.6%
associate-*l/81.6%
associate-*r/81.6%
div-inv81.6%
metadata-eval81.6%
Applied egg-rr81.6%
*-commutative81.6%
associate-*r*81.5%
*-commutative81.5%
*-commutative81.5%
cbrt-prod81.7%
*-commutative81.7%
Applied egg-rr81.7%
*-commutative81.7%
Simplified81.7%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (* (/ angle 180.0) PI))) 2.0) (pow (* b (cos (pow (cbrt (* angle (* PI 0.005555555555555556))) 3.0))) 2.0)))
double code(double a, double b, double angle) {
return pow((a * sin(((angle / 180.0) * ((double) M_PI)))), 2.0) + pow((b * cos(pow(cbrt((angle * (((double) M_PI) * 0.005555555555555556))), 3.0))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.sin(((angle / 180.0) * Math.PI))), 2.0) + Math.pow((b * Math.cos(Math.pow(Math.cbrt((angle * (Math.PI * 0.005555555555555556))), 3.0))), 2.0);
}
function code(a, b, angle) return Float64((Float64(a * sin(Float64(Float64(angle / 180.0) * pi))) ^ 2.0) + (Float64(b * cos((cbrt(Float64(angle * Float64(pi * 0.005555555555555556))) ^ 3.0))) ^ 2.0)) end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Sin[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[N[Power[N[Power[N[(angle * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left({\left(\sqrt[3]{angle \cdot \left(\pi \cdot 0.005555555555555556\right)}\right)}^{3}\right)\right)}^{2}
\end{array}
Initial program 81.5%
add-cube-cbrt81.5%
pow381.6%
associate-*l/81.6%
associate-*r/81.6%
div-inv81.6%
metadata-eval81.6%
Applied egg-rr81.6%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (* (/ angle 180.0) PI))) 2.0) (pow (* b (cos (* angle (* PI (pow (cbrt 0.005555555555555556) 3.0))))) 2.0)))
double code(double a, double b, double angle) {
return pow((a * sin(((angle / 180.0) * ((double) M_PI)))), 2.0) + pow((b * cos((angle * (((double) M_PI) * pow(cbrt(0.005555555555555556), 3.0))))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.sin(((angle / 180.0) * Math.PI))), 2.0) + Math.pow((b * Math.cos((angle * (Math.PI * Math.pow(Math.cbrt(0.005555555555555556), 3.0))))), 2.0);
}
function code(a, b, angle) return Float64((Float64(a * sin(Float64(Float64(angle / 180.0) * pi))) ^ 2.0) + (Float64(b * cos(Float64(angle * Float64(pi * (cbrt(0.005555555555555556) ^ 3.0))))) ^ 2.0)) end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Sin[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[N[(angle * N[(Pi * N[Power[N[Power[0.005555555555555556, 1/3], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(angle \cdot \left(\pi \cdot {\left(\sqrt[3]{0.005555555555555556}\right)}^{3}\right)\right)\right)}^{2}
\end{array}
Initial program 81.5%
add-cube-cbrt81.5%
pow381.6%
associate-*l/81.6%
associate-*r/81.6%
div-inv81.6%
metadata-eval81.6%
Applied egg-rr81.6%
Taylor expanded in b around 0 81.6%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (* (/ angle 180.0) PI))) 2.0) (pow (* b (cos (* PI (/ -1.0 (/ -180.0 angle))))) 2.0)))
double code(double a, double b, double angle) {
return pow((a * sin(((angle / 180.0) * ((double) M_PI)))), 2.0) + pow((b * cos((((double) M_PI) * (-1.0 / (-180.0 / angle))))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.sin(((angle / 180.0) * Math.PI))), 2.0) + Math.pow((b * Math.cos((Math.PI * (-1.0 / (-180.0 / angle))))), 2.0);
}
def code(a, b, angle): return math.pow((a * math.sin(((angle / 180.0) * math.pi))), 2.0) + math.pow((b * math.cos((math.pi * (-1.0 / (-180.0 / angle))))), 2.0)
function code(a, b, angle) return Float64((Float64(a * sin(Float64(Float64(angle / 180.0) * pi))) ^ 2.0) + (Float64(b * cos(Float64(pi * Float64(-1.0 / Float64(-180.0 / angle))))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((a * sin(((angle / 180.0) * pi))) ^ 2.0) + ((b * cos((pi * (-1.0 / (-180.0 / angle))))) ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Sin[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[N[(Pi * N[(-1.0 / N[(-180.0 / angle), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\pi \cdot \frac{-1}{\frac{-180}{angle}}\right)\right)}^{2}
\end{array}
Initial program 81.5%
add-cube-cbrt81.5%
pow381.6%
associate-*l/81.6%
associate-*r/81.6%
div-inv81.6%
metadata-eval81.6%
Applied egg-rr81.6%
*-commutative81.6%
associate-*r*81.5%
*-commutative81.5%
*-commutative81.5%
cbrt-prod81.7%
*-commutative81.7%
Applied egg-rr81.7%
*-commutative81.7%
Simplified81.7%
unpow-prod-down81.6%
metadata-eval81.6%
div-inv81.6%
rem-cube-cbrt81.4%
clear-num81.4%
rem-cube-cbrt81.6%
associate-/r/81.6%
frac-2neg81.6%
clear-num81.6%
div-inv81.6%
distribute-neg-frac81.6%
metadata-eval81.6%
Applied egg-rr81.6%
Final simplification81.6%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (* (/ angle 180.0) PI))) 2.0) (pow (* b (cos (/ PI (/ 180.0 angle)))) 2.0)))
double code(double a, double b, double angle) {
return pow((a * sin(((angle / 180.0) * ((double) M_PI)))), 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(((angle / 180.0) * Math.PI))), 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(((angle / 180.0) * math.pi))), 2.0) + math.pow((b * math.cos((math.pi / (180.0 / angle)))), 2.0)
function code(a, b, angle) return Float64((Float64(a * sin(Float64(Float64(angle / 180.0) * pi))) ^ 2.0) + (Float64(b * cos(Float64(pi / Float64(180.0 / angle)))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((a * sin(((angle / 180.0) * pi))) ^ 2.0) + ((b * cos((pi / (180.0 / angle)))) ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Sin[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $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(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2}
\end{array}
Initial program 81.5%
*-commutative81.5%
clear-num81.6%
un-div-inv81.6%
Applied egg-rr81.6%
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* angle (* PI 0.005555555555555556)))) (pow (hypot (* a (sin t_0)) (* b (cos t_0))) 2.0)))
double code(double a, double b, double angle) {
double t_0 = angle * (((double) M_PI) * 0.005555555555555556);
return pow(hypot((a * sin(t_0)), (b * cos(t_0))), 2.0);
}
public static double code(double a, double b, double angle) {
double t_0 = angle * (Math.PI * 0.005555555555555556);
return Math.pow(Math.hypot((a * Math.sin(t_0)), (b * Math.cos(t_0))), 2.0);
}
def code(a, b, angle): t_0 = angle * (math.pi * 0.005555555555555556) return math.pow(math.hypot((a * math.sin(t_0)), (b * math.cos(t_0))), 2.0)
function code(a, b, angle) t_0 = Float64(angle * Float64(pi * 0.005555555555555556)) return hypot(Float64(a * sin(t_0)), Float64(b * cos(t_0))) ^ 2.0 end
function tmp = code(a, b, angle) t_0 = angle * (pi * 0.005555555555555556); tmp = hypot((a * sin(t_0)), (b * cos(t_0))) ^ 2.0; end
code[a_, b_, angle_] := Block[{t$95$0 = N[(angle * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]}, N[Power[N[Sqrt[N[(a * 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}
\\
\begin{array}{l}
t_0 := angle \cdot \left(\pi \cdot 0.005555555555555556\right)\\
{\left(\mathsf{hypot}\left(a \cdot \sin t\_0, b \cdot \cos t\_0\right)\right)}^{2}
\end{array}
\end{array}
Initial program 81.5%
associate-*l/81.6%
associate-/l*81.6%
cos-neg81.6%
distribute-lft-neg-out81.6%
distribute-frac-neg81.6%
distribute-frac-neg81.6%
distribute-lft-neg-out81.6%
cos-neg81.6%
associate-*l/81.5%
associate-/l*81.6%
Simplified81.6%
Applied egg-rr81.6%
(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 81.5%
associate-*l/81.6%
associate-/l*81.6%
cos-neg81.6%
distribute-lft-neg-out81.6%
distribute-frac-neg81.6%
distribute-frac-neg81.6%
distribute-lft-neg-out81.6%
cos-neg81.6%
associate-*l/81.5%
associate-/l*81.6%
Simplified81.6%
Taylor expanded in angle around 0 81.3%
Final simplification81.3%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (* (/ angle 180.0) PI))) 2.0) (pow b 2.0)))
double code(double a, double b, double angle) {
return pow((a * sin(((angle / 180.0) * ((double) M_PI)))), 2.0) + pow(b, 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.sin(((angle / 180.0) * Math.PI))), 2.0) + Math.pow(b, 2.0);
}
def code(a, b, angle): return math.pow((a * math.sin(((angle / 180.0) * math.pi))), 2.0) + math.pow(b, 2.0)
function code(a, b, angle) return Float64((Float64(a * sin(Float64(Float64(angle / 180.0) * pi))) ^ 2.0) + (b ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((a * sin(((angle / 180.0) * pi))) ^ 2.0) + (b ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Sin[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {b}^{2}
\end{array}
Initial program 81.5%
add-cube-cbrt81.5%
pow381.6%
associate-*l/81.6%
associate-*r/81.6%
div-inv81.6%
metadata-eval81.6%
Applied egg-rr81.6%
Taylor expanded in angle around 0 81.3%
(FPCore (a b angle) :precision binary64 (if (<= b 3.1e-12) (pow (* a (sin (* 0.005555555555555556 (* angle PI)))) 2.0) (pow (* b (cos (/ PI (/ 180.0 angle)))) 2.0)))
double code(double a, double b, double angle) {
double tmp;
if (b <= 3.1e-12) {
tmp = pow((a * sin((0.005555555555555556 * (angle * ((double) M_PI))))), 2.0);
} else {
tmp = pow((b * cos((((double) M_PI) / (180.0 / angle)))), 2.0);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (b <= 3.1e-12) {
tmp = Math.pow((a * Math.sin((0.005555555555555556 * (angle * Math.PI)))), 2.0);
} else {
tmp = Math.pow((b * Math.cos((Math.PI / (180.0 / angle)))), 2.0);
}
return tmp;
}
def code(a, b, angle): tmp = 0 if b <= 3.1e-12: tmp = math.pow((a * math.sin((0.005555555555555556 * (angle * math.pi)))), 2.0) else: tmp = math.pow((b * math.cos((math.pi / (180.0 / angle)))), 2.0) return tmp
function code(a, b, angle) tmp = 0.0 if (b <= 3.1e-12) tmp = Float64(a * sin(Float64(0.005555555555555556 * Float64(angle * pi)))) ^ 2.0; else tmp = Float64(b * cos(Float64(pi / Float64(180.0 / angle)))) ^ 2.0; end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (b <= 3.1e-12) tmp = (a * sin((0.005555555555555556 * (angle * pi)))) ^ 2.0; else tmp = (b * cos((pi / (180.0 / angle)))) ^ 2.0; end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[b, 3.1e-12], N[Power[N[(a * N[Sin[N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $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]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 3.1 \cdot 10^{-12}:\\
\;\;\;\;{\left(a \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;{\left(b \cdot \cos \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2}\\
\end{array}
\end{array}
if b < 3.1000000000000001e-12Initial program 78.6%
associate-*l/78.6%
associate-/l*78.6%
cos-neg78.6%
distribute-lft-neg-out78.6%
distribute-frac-neg78.6%
distribute-frac-neg78.6%
distribute-lft-neg-out78.6%
cos-neg78.6%
associate-*l/78.5%
associate-/l*78.7%
Simplified78.7%
Taylor expanded in a around inf 43.7%
unpow243.7%
*-commutative43.7%
associate-*r*43.7%
unpow243.7%
swap-sqr50.4%
unpow250.4%
associate-*r*50.4%
*-commutative50.4%
Simplified50.4%
if 3.1000000000000001e-12 < b Initial program 87.8%
add-cube-cbrt87.8%
pow387.9%
associate-*l/88.0%
associate-*r/88.0%
div-inv88.0%
metadata-eval88.0%
Applied egg-rr88.0%
associate-*r*88.1%
metadata-eval88.1%
div-inv88.0%
cbrt-div87.9%
Applied egg-rr87.9%
Taylor expanded in a around 0 77.0%
unpow277.0%
rem-cube-cbrt77.0%
associate-*r/77.0%
unpow277.0%
swap-sqr77.0%
unpow277.0%
associate-*r/77.0%
rem-cube-cbrt77.0%
*-commutative77.0%
rem-cube-cbrt77.0%
associate-*l/77.0%
associate-/r/77.2%
Simplified77.2%
(FPCore (a b angle) :precision binary64 (if (<= b 6e-12) (pow (* a (sin (* 0.005555555555555556 (* angle PI)))) 2.0) (pow (* b (cos (* PI (* angle 0.005555555555555556)))) 2.0)))
double code(double a, double b, double angle) {
double tmp;
if (b <= 6e-12) {
tmp = pow((a * sin((0.005555555555555556 * (angle * ((double) M_PI))))), 2.0);
} else {
tmp = pow((b * cos((((double) M_PI) * (angle * 0.005555555555555556)))), 2.0);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (b <= 6e-12) {
tmp = Math.pow((a * Math.sin((0.005555555555555556 * (angle * Math.PI)))), 2.0);
} else {
tmp = Math.pow((b * Math.cos((Math.PI * (angle * 0.005555555555555556)))), 2.0);
}
return tmp;
}
def code(a, b, angle): tmp = 0 if b <= 6e-12: tmp = math.pow((a * math.sin((0.005555555555555556 * (angle * math.pi)))), 2.0) else: tmp = math.pow((b * math.cos((math.pi * (angle * 0.005555555555555556)))), 2.0) return tmp
function code(a, b, angle) tmp = 0.0 if (b <= 6e-12) tmp = Float64(a * sin(Float64(0.005555555555555556 * Float64(angle * pi)))) ^ 2.0; else tmp = Float64(b * cos(Float64(pi * Float64(angle * 0.005555555555555556)))) ^ 2.0; end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (b <= 6e-12) tmp = (a * sin((0.005555555555555556 * (angle * pi)))) ^ 2.0; else tmp = (b * cos((pi * (angle * 0.005555555555555556)))) ^ 2.0; end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[b, 6e-12], N[Power[N[(a * N[Sin[N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[Power[N[(b * N[Cos[N[(Pi * N[(angle * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 6 \cdot 10^{-12}:\\
\;\;\;\;{\left(a \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;{\left(b \cdot \cos \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2}\\
\end{array}
\end{array}
if b < 6.0000000000000003e-12Initial program 78.6%
associate-*l/78.6%
associate-/l*78.6%
cos-neg78.6%
distribute-lft-neg-out78.6%
distribute-frac-neg78.6%
distribute-frac-neg78.6%
distribute-lft-neg-out78.6%
cos-neg78.6%
associate-*l/78.5%
associate-/l*78.7%
Simplified78.7%
Taylor expanded in a around inf 43.7%
unpow243.7%
*-commutative43.7%
associate-*r*43.7%
unpow243.7%
swap-sqr50.4%
unpow250.4%
associate-*r*50.4%
*-commutative50.4%
Simplified50.4%
if 6.0000000000000003e-12 < b Initial program 87.8%
add-cube-cbrt87.8%
pow387.9%
associate-*l/88.0%
associate-*r/88.0%
div-inv88.0%
metadata-eval88.0%
Applied egg-rr88.0%
Taylor expanded in a around 0 77.3%
unpow277.3%
rem-cube-cbrt77.0%
unpow277.0%
swap-sqr77.0%
unpow277.0%
associate-*r*77.0%
*-commutative77.0%
*-commutative77.0%
*-commutative77.0%
associate-*r*77.1%
Simplified77.1%
(FPCore (a b angle) :precision binary64 (if (<= b 3.6e-12) (pow (* a (sin (* 0.005555555555555556 (* angle PI)))) 2.0) (pow (* b (cos (* angle (* PI -0.005555555555555556)))) 2.0)))
double code(double a, double b, double angle) {
double tmp;
if (b <= 3.6e-12) {
tmp = pow((a * sin((0.005555555555555556 * (angle * ((double) M_PI))))), 2.0);
} else {
tmp = pow((b * cos((angle * (((double) M_PI) * -0.005555555555555556)))), 2.0);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (b <= 3.6e-12) {
tmp = Math.pow((a * Math.sin((0.005555555555555556 * (angle * Math.PI)))), 2.0);
} else {
tmp = Math.pow((b * Math.cos((angle * (Math.PI * -0.005555555555555556)))), 2.0);
}
return tmp;
}
def code(a, b, angle): tmp = 0 if b <= 3.6e-12: tmp = math.pow((a * math.sin((0.005555555555555556 * (angle * math.pi)))), 2.0) else: tmp = math.pow((b * math.cos((angle * (math.pi * -0.005555555555555556)))), 2.0) return tmp
function code(a, b, angle) tmp = 0.0 if (b <= 3.6e-12) tmp = Float64(a * sin(Float64(0.005555555555555556 * Float64(angle * pi)))) ^ 2.0; else tmp = Float64(b * cos(Float64(angle * Float64(pi * -0.005555555555555556)))) ^ 2.0; end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (b <= 3.6e-12) tmp = (a * sin((0.005555555555555556 * (angle * pi)))) ^ 2.0; else tmp = (b * cos((angle * (pi * -0.005555555555555556)))) ^ 2.0; end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[b, 3.6e-12], N[Power[N[(a * N[Sin[N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[Power[N[(b * N[Cos[N[(angle * N[(Pi * -0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 3.6 \cdot 10^{-12}:\\
\;\;\;\;{\left(a \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;{\left(b \cdot \cos \left(angle \cdot \left(\pi \cdot -0.005555555555555556\right)\right)\right)}^{2}\\
\end{array}
\end{array}
if b < 3.6e-12Initial program 78.6%
associate-*l/78.6%
associate-/l*78.6%
cos-neg78.6%
distribute-lft-neg-out78.6%
distribute-frac-neg78.6%
distribute-frac-neg78.6%
distribute-lft-neg-out78.6%
cos-neg78.6%
associate-*l/78.5%
associate-/l*78.7%
Simplified78.7%
Taylor expanded in a around inf 43.7%
unpow243.7%
*-commutative43.7%
associate-*r*43.7%
unpow243.7%
swap-sqr50.4%
unpow250.4%
associate-*r*50.4%
*-commutative50.4%
Simplified50.4%
if 3.6e-12 < b Initial program 87.8%
add-cube-cbrt87.8%
pow387.9%
associate-*l/88.0%
associate-*r/88.0%
div-inv88.0%
metadata-eval88.0%
Applied egg-rr88.0%
Taylor expanded in a around 0 77.3%
unpow277.3%
rem-cube-cbrt77.0%
unpow277.0%
swap-sqr77.0%
unpow277.0%
Simplified77.0%
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* 0.005555555555555556 (* angle PI)))) (if (<= b 5.2e-12) (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 = 0.005555555555555556 * (angle * ((double) M_PI));
double tmp;
if (b <= 5.2e-12) {
tmp = pow((a * sin(t_0)), 2.0);
} else {
tmp = pow((b * cos(t_0)), 2.0);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double t_0 = 0.005555555555555556 * (angle * Math.PI);
double tmp;
if (b <= 5.2e-12) {
tmp = Math.pow((a * Math.sin(t_0)), 2.0);
} else {
tmp = Math.pow((b * Math.cos(t_0)), 2.0);
}
return tmp;
}
def code(a, b, angle): t_0 = 0.005555555555555556 * (angle * math.pi) tmp = 0 if b <= 5.2e-12: tmp = math.pow((a * math.sin(t_0)), 2.0) else: tmp = math.pow((b * math.cos(t_0)), 2.0) return tmp
function code(a, b, angle) t_0 = Float64(0.005555555555555556 * Float64(angle * pi)) tmp = 0.0 if (b <= 5.2e-12) tmp = Float64(a * sin(t_0)) ^ 2.0; else tmp = Float64(b * cos(t_0)) ^ 2.0; end return tmp end
function tmp_2 = code(a, b, angle) t_0 = 0.005555555555555556 * (angle * pi); tmp = 0.0; if (b <= 5.2e-12) tmp = (a * sin(t_0)) ^ 2.0; else tmp = (b * cos(t_0)) ^ 2.0; end tmp_2 = tmp; end
code[a_, b_, angle_] := Block[{t$95$0 = N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 5.2e-12], 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]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.005555555555555556 \cdot \left(angle \cdot \pi\right)\\
\mathbf{if}\;b \leq 5.2 \cdot 10^{-12}:\\
\;\;\;\;{\left(a \cdot \sin t\_0\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;{\left(b \cdot \cos t\_0\right)}^{2}\\
\end{array}
\end{array}
if b < 5.19999999999999965e-12Initial program 78.6%
associate-*l/78.6%
associate-/l*78.6%
cos-neg78.6%
distribute-lft-neg-out78.6%
distribute-frac-neg78.6%
distribute-frac-neg78.6%
distribute-lft-neg-out78.6%
cos-neg78.6%
associate-*l/78.5%
associate-/l*78.7%
Simplified78.7%
Taylor expanded in a around inf 43.7%
unpow243.7%
*-commutative43.7%
associate-*r*43.7%
unpow243.7%
swap-sqr50.4%
unpow250.4%
associate-*r*50.4%
*-commutative50.4%
Simplified50.4%
if 5.19999999999999965e-12 < b Initial program 87.8%
associate-*l/87.9%
associate-/l*87.8%
cos-neg87.8%
distribute-lft-neg-out87.8%
distribute-frac-neg87.8%
distribute-frac-neg87.8%
distribute-lft-neg-out87.8%
cos-neg87.8%
associate-*l/87.8%
associate-/l*87.8%
Simplified87.8%
Taylor expanded in a around 0 77.0%
*-commutative77.0%
associate-*r*77.0%
unpow277.0%
unpow277.0%
swap-sqr77.0%
unpow277.0%
associate-*r*77.0%
*-commutative77.0%
Simplified77.0%
(FPCore (a b angle) :precision binary64 (if (<= b 3.2e-12) (pow (* a (sin (* 0.005555555555555556 (* angle PI)))) 2.0) (* b b)))
double code(double a, double b, double angle) {
double tmp;
if (b <= 3.2e-12) {
tmp = pow((a * sin((0.005555555555555556 * (angle * ((double) M_PI))))), 2.0);
} else {
tmp = b * b;
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (b <= 3.2e-12) {
tmp = Math.pow((a * Math.sin((0.005555555555555556 * (angle * Math.PI)))), 2.0);
} else {
tmp = b * b;
}
return tmp;
}
def code(a, b, angle): tmp = 0 if b <= 3.2e-12: tmp = math.pow((a * math.sin((0.005555555555555556 * (angle * math.pi)))), 2.0) else: tmp = b * b return tmp
function code(a, b, angle) tmp = 0.0 if (b <= 3.2e-12) tmp = Float64(a * sin(Float64(0.005555555555555556 * Float64(angle * pi)))) ^ 2.0; else tmp = Float64(b * b); end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (b <= 3.2e-12) tmp = (a * sin((0.005555555555555556 * (angle * pi)))) ^ 2.0; else tmp = b * b; end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[b, 3.2e-12], N[Power[N[(a * N[Sin[N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[(b * b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 3.2 \cdot 10^{-12}:\\
\;\;\;\;{\left(a \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;b \cdot b\\
\end{array}
\end{array}
if b < 3.2000000000000001e-12Initial program 78.6%
associate-*l/78.6%
associate-/l*78.6%
cos-neg78.6%
distribute-lft-neg-out78.6%
distribute-frac-neg78.6%
distribute-frac-neg78.6%
distribute-lft-neg-out78.6%
cos-neg78.6%
associate-*l/78.5%
associate-/l*78.7%
Simplified78.7%
Taylor expanded in a around inf 43.7%
unpow243.7%
*-commutative43.7%
associate-*r*43.7%
unpow243.7%
swap-sqr50.4%
unpow250.4%
associate-*r*50.4%
*-commutative50.4%
Simplified50.4%
if 3.2000000000000001e-12 < b Initial program 87.8%
associate-*l/87.9%
associate-/l*87.8%
cos-neg87.8%
distribute-lft-neg-out87.8%
distribute-frac-neg87.8%
distribute-frac-neg87.8%
distribute-lft-neg-out87.8%
cos-neg87.8%
associate-*l/87.8%
associate-/l*87.8%
Simplified87.8%
Taylor expanded in angle around 0 77.3%
unpow277.3%
Applied egg-rr77.3%
(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 81.5%
associate-*l/81.6%
associate-/l*81.6%
cos-neg81.6%
distribute-lft-neg-out81.6%
distribute-frac-neg81.6%
distribute-frac-neg81.6%
distribute-lft-neg-out81.6%
cos-neg81.6%
associate-*l/81.5%
associate-/l*81.6%
Simplified81.6%
Taylor expanded in angle around 0 58.9%
unpow258.9%
Applied egg-rr58.9%
herbie shell --seed 2024129
(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)))