
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* PI (/ angle 180.0)))) (* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) (sin t_0)) (cos t_0))))
double code(double a, double b, double angle) {
double t_0 = ((double) M_PI) * (angle / 180.0);
return ((2.0 * (pow(b, 2.0) - pow(a, 2.0))) * sin(t_0)) * cos(t_0);
}
public static double code(double a, double b, double angle) {
double t_0 = Math.PI * (angle / 180.0);
return ((2.0 * (Math.pow(b, 2.0) - Math.pow(a, 2.0))) * Math.sin(t_0)) * Math.cos(t_0);
}
def code(a, b, angle): t_0 = math.pi * (angle / 180.0) return ((2.0 * (math.pow(b, 2.0) - math.pow(a, 2.0))) * math.sin(t_0)) * math.cos(t_0)
function code(a, b, angle) t_0 = Float64(pi * Float64(angle / 180.0)) return Float64(Float64(Float64(2.0 * Float64((b ^ 2.0) - (a ^ 2.0))) * sin(t_0)) * cos(t_0)) end
function tmp = code(a, b, angle) t_0 = pi * (angle / 180.0); tmp = ((2.0 * ((b ^ 2.0) - (a ^ 2.0))) * sin(t_0)) * cos(t_0); end
code[a_, b_, angle_] := Block[{t$95$0 = N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(2.0 * N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \pi \cdot \frac{angle}{180}\\
\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin t_0\right) \cdot \cos t_0
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* PI (/ angle 180.0)))) (* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) (sin t_0)) (cos t_0))))
double code(double a, double b, double angle) {
double t_0 = ((double) M_PI) * (angle / 180.0);
return ((2.0 * (pow(b, 2.0) - pow(a, 2.0))) * sin(t_0)) * cos(t_0);
}
public static double code(double a, double b, double angle) {
double t_0 = Math.PI * (angle / 180.0);
return ((2.0 * (Math.pow(b, 2.0) - Math.pow(a, 2.0))) * Math.sin(t_0)) * Math.cos(t_0);
}
def code(a, b, angle): t_0 = math.pi * (angle / 180.0) return ((2.0 * (math.pow(b, 2.0) - math.pow(a, 2.0))) * math.sin(t_0)) * math.cos(t_0)
function code(a, b, angle) t_0 = Float64(pi * Float64(angle / 180.0)) return Float64(Float64(Float64(2.0 * Float64((b ^ 2.0) - (a ^ 2.0))) * sin(t_0)) * cos(t_0)) end
function tmp = code(a, b, angle) t_0 = pi * (angle / 180.0); tmp = ((2.0 * ((b ^ 2.0) - (a ^ 2.0))) * sin(t_0)) * cos(t_0); end
code[a_, b_, angle_] := Block[{t$95$0 = N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(2.0 * N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \pi \cdot \frac{angle}{180}\\
\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin t_0\right) \cdot \cos t_0
\end{array}
\end{array}
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (sin (* PI (* angle 0.005555555555555556))))
(t_1 (* (- b a) (+ b a)))
(t_2 (* t_0 t_1))
(t_3 (* angle (* PI -0.005555555555555556)))
(t_4 (cos t_3)))
(if (<= (/ angle 180.0) -1e+155)
(* 2.0 (* t_4 t_2))
(if (<= (/ angle 180.0) -2e+44)
(* 2.0 (* t_1 (* t_4 (sin t_3))))
(if (<= (/ angle 180.0) -5e-34)
(* 2.0 (* t_2 (cos (* PI (* angle -0.005555555555555556)))))
(* 2.0 (pow (cbrt (* (+ b a) (* (- b a) t_0))) 3.0)))))))
double code(double a, double b, double angle) {
double t_0 = sin((((double) M_PI) * (angle * 0.005555555555555556)));
double t_1 = (b - a) * (b + a);
double t_2 = t_0 * t_1;
double t_3 = angle * (((double) M_PI) * -0.005555555555555556);
double t_4 = cos(t_3);
double tmp;
if ((angle / 180.0) <= -1e+155) {
tmp = 2.0 * (t_4 * t_2);
} else if ((angle / 180.0) <= -2e+44) {
tmp = 2.0 * (t_1 * (t_4 * sin(t_3)));
} else if ((angle / 180.0) <= -5e-34) {
tmp = 2.0 * (t_2 * cos((((double) M_PI) * (angle * -0.005555555555555556))));
} else {
tmp = 2.0 * pow(cbrt(((b + a) * ((b - a) * t_0))), 3.0);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double t_0 = Math.sin((Math.PI * (angle * 0.005555555555555556)));
double t_1 = (b - a) * (b + a);
double t_2 = t_0 * t_1;
double t_3 = angle * (Math.PI * -0.005555555555555556);
double t_4 = Math.cos(t_3);
double tmp;
if ((angle / 180.0) <= -1e+155) {
tmp = 2.0 * (t_4 * t_2);
} else if ((angle / 180.0) <= -2e+44) {
tmp = 2.0 * (t_1 * (t_4 * Math.sin(t_3)));
} else if ((angle / 180.0) <= -5e-34) {
tmp = 2.0 * (t_2 * Math.cos((Math.PI * (angle * -0.005555555555555556))));
} else {
tmp = 2.0 * Math.pow(Math.cbrt(((b + a) * ((b - a) * t_0))), 3.0);
}
return tmp;
}
function code(a, b, angle) t_0 = sin(Float64(pi * Float64(angle * 0.005555555555555556))) t_1 = Float64(Float64(b - a) * Float64(b + a)) t_2 = Float64(t_0 * t_1) t_3 = Float64(angle * Float64(pi * -0.005555555555555556)) t_4 = cos(t_3) tmp = 0.0 if (Float64(angle / 180.0) <= -1e+155) tmp = Float64(2.0 * Float64(t_4 * t_2)); elseif (Float64(angle / 180.0) <= -2e+44) tmp = Float64(2.0 * Float64(t_1 * Float64(t_4 * sin(t_3)))); elseif (Float64(angle / 180.0) <= -5e-34) tmp = Float64(2.0 * Float64(t_2 * cos(Float64(pi * Float64(angle * -0.005555555555555556))))); else tmp = Float64(2.0 * (cbrt(Float64(Float64(b + a) * Float64(Float64(b - a) * t_0))) ^ 3.0)); end return tmp end
code[a_, b_, angle_] := Block[{t$95$0 = N[Sin[N[(Pi * N[(angle * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(b - a), $MachinePrecision] * N[(b + a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 * t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(angle * N[(Pi * -0.005555555555555556), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Cos[t$95$3], $MachinePrecision]}, If[LessEqual[N[(angle / 180.0), $MachinePrecision], -1e+155], N[(2.0 * N[(t$95$4 * t$95$2), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(angle / 180.0), $MachinePrecision], -2e+44], N[(2.0 * N[(t$95$1 * N[(t$95$4 * N[Sin[t$95$3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(angle / 180.0), $MachinePrecision], -5e-34], N[(2.0 * N[(t$95$2 * N[Cos[N[(Pi * N[(angle * -0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[Power[N[Power[N[(N[(b + a), $MachinePrecision] * N[(N[(b - a), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\\
t_1 := \left(b - a\right) \cdot \left(b + a\right)\\
t_2 := t_0 \cdot t_1\\
t_3 := angle \cdot \left(\pi \cdot -0.005555555555555556\right)\\
t_4 := \cos t_3\\
\mathbf{if}\;\frac{angle}{180} \leq -1 \cdot 10^{+155}:\\
\;\;\;\;2 \cdot \left(t_4 \cdot t_2\right)\\
\mathbf{elif}\;\frac{angle}{180} \leq -2 \cdot 10^{+44}:\\
\;\;\;\;2 \cdot \left(t_1 \cdot \left(t_4 \cdot \sin t_3\right)\right)\\
\mathbf{elif}\;\frac{angle}{180} \leq -5 \cdot 10^{-34}:\\
\;\;\;\;2 \cdot \left(t_2 \cdot \cos \left(\pi \cdot \left(angle \cdot -0.005555555555555556\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot {\left(\sqrt[3]{\left(b + a\right) \cdot \left(\left(b - a\right) \cdot t_0\right)}\right)}^{3}\\
\end{array}
\end{array}
if (/.f64 angle 180) < -1.00000000000000001e155Initial program 31.9%
associate-*l*31.9%
associate-*l*31.9%
cos-neg31.9%
distribute-rgt-neg-out31.9%
distribute-frac-neg31.9%
neg-mul-131.9%
associate-/l*31.2%
associate-*r/34.6%
associate-/r/36.5%
associate-/l*36.5%
metadata-eval36.5%
Simplified36.5%
unpow236.5%
unpow236.5%
difference-of-squares39.9%
Applied egg-rr39.9%
Taylor expanded in angle around inf 29.8%
Taylor expanded in angle around inf 29.1%
*-commutative29.1%
associate-*r*43.1%
+-commutative43.1%
*-commutative43.1%
+-commutative43.1%
*-commutative43.1%
*-commutative43.1%
*-commutative43.1%
associate-*r*47.2%
Simplified47.2%
if -1.00000000000000001e155 < (/.f64 angle 180) < -2.0000000000000002e44Initial program 22.7%
associate-*l*22.7%
associate-*l*22.7%
cos-neg22.7%
distribute-rgt-neg-out22.7%
distribute-frac-neg22.7%
neg-mul-122.7%
associate-/l*31.8%
associate-*r/31.8%
associate-/r/30.1%
associate-/l*30.1%
metadata-eval30.1%
Simplified30.1%
unpow230.1%
unpow230.1%
difference-of-squares30.1%
Applied egg-rr30.1%
Taylor expanded in angle around inf 22.4%
Applied egg-rr21.0%
expm1-def21.6%
expm1-log1p46.8%
associate-*r*46.8%
*-commutative46.8%
+-commutative46.8%
*-commutative46.8%
Simplified46.8%
if -2.0000000000000002e44 < (/.f64 angle 180) < -5.0000000000000003e-34Initial program 69.6%
associate-*l*69.5%
associate-*l*69.5%
cos-neg69.5%
distribute-rgt-neg-out69.5%
distribute-frac-neg69.5%
neg-mul-169.5%
associate-/l*68.6%
associate-*r/63.7%
associate-/r/64.7%
associate-/l*64.7%
metadata-eval64.7%
Simplified64.7%
unpow264.7%
unpow264.7%
difference-of-squares69.4%
Applied egg-rr69.4%
Taylor expanded in angle around inf 74.0%
*-commutative74.0%
*-commutative74.0%
associate-*r*69.2%
*-commutative69.2%
*-commutative69.2%
associate-*r*75.1%
*-commutative75.1%
*-commutative75.1%
*-commutative75.1%
Simplified75.1%
if -5.0000000000000003e-34 < (/.f64 angle 180) Initial program 65.3%
associate-*l*65.3%
associate-*l*65.3%
cos-neg65.3%
distribute-rgt-neg-out65.3%
distribute-frac-neg65.3%
neg-mul-165.3%
associate-/l*66.4%
associate-*r/65.8%
associate-/r/65.3%
associate-/l*65.3%
metadata-eval65.3%
Simplified65.3%
unpow265.3%
unpow265.3%
difference-of-squares68.1%
Applied egg-rr68.1%
add-cube-cbrt67.8%
pow367.7%
Applied egg-rr78.9%
Taylor expanded in angle around 0 79.7%
Final simplification72.8%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (cbrt (pow PI 3.0))))
(if (<= (pow b 2.0) 2e+109)
(*
2.0
(*
(*
(- b a)
(*
(sin (* PI (* angle 0.005555555555555556)))
(cos (* -0.005555555555555556 (* PI angle)))))
(+ b a)))
(*
2.0
(pow
(cbrt
(*
(+ b a)
(*
(- b a)
(*
(sin (* (* angle 0.005555555555555556) t_0))
(cos (* angle (* -0.005555555555555556 t_0)))))))
3.0)))))
double code(double a, double b, double angle) {
double t_0 = cbrt(pow(((double) M_PI), 3.0));
double tmp;
if (pow(b, 2.0) <= 2e+109) {
tmp = 2.0 * (((b - a) * (sin((((double) M_PI) * (angle * 0.005555555555555556))) * cos((-0.005555555555555556 * (((double) M_PI) * angle))))) * (b + a));
} else {
tmp = 2.0 * pow(cbrt(((b + a) * ((b - a) * (sin(((angle * 0.005555555555555556) * t_0)) * cos((angle * (-0.005555555555555556 * t_0))))))), 3.0);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double t_0 = Math.cbrt(Math.pow(Math.PI, 3.0));
double tmp;
if (Math.pow(b, 2.0) <= 2e+109) {
tmp = 2.0 * (((b - a) * (Math.sin((Math.PI * (angle * 0.005555555555555556))) * Math.cos((-0.005555555555555556 * (Math.PI * angle))))) * (b + a));
} else {
tmp = 2.0 * Math.pow(Math.cbrt(((b + a) * ((b - a) * (Math.sin(((angle * 0.005555555555555556) * t_0)) * Math.cos((angle * (-0.005555555555555556 * t_0))))))), 3.0);
}
return tmp;
}
function code(a, b, angle) t_0 = cbrt((pi ^ 3.0)) tmp = 0.0 if ((b ^ 2.0) <= 2e+109) tmp = Float64(2.0 * Float64(Float64(Float64(b - a) * Float64(sin(Float64(pi * Float64(angle * 0.005555555555555556))) * cos(Float64(-0.005555555555555556 * Float64(pi * angle))))) * Float64(b + a))); else tmp = Float64(2.0 * (cbrt(Float64(Float64(b + a) * Float64(Float64(b - a) * Float64(sin(Float64(Float64(angle * 0.005555555555555556) * t_0)) * cos(Float64(angle * Float64(-0.005555555555555556 * t_0))))))) ^ 3.0)); end return tmp end
code[a_, b_, angle_] := Block[{t$95$0 = N[Power[N[Power[Pi, 3.0], $MachinePrecision], 1/3], $MachinePrecision]}, If[LessEqual[N[Power[b, 2.0], $MachinePrecision], 2e+109], N[(2.0 * N[(N[(N[(b - a), $MachinePrecision] * N[(N[Sin[N[(Pi * N[(angle * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(-0.005555555555555556 * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(b + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[Power[N[Power[N[(N[(b + a), $MachinePrecision] * N[(N[(b - a), $MachinePrecision] * N[(N[Sin[N[(N[(angle * 0.005555555555555556), $MachinePrecision] * t$95$0), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(angle * N[(-0.005555555555555556 * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{{\pi}^{3}}\\
\mathbf{if}\;{b}^{2} \leq 2 \cdot 10^{+109}:\\
\;\;\;\;2 \cdot \left(\left(\left(b - a\right) \cdot \left(\sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right) \cdot \cos \left(-0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)\right)\right) \cdot \left(b + a\right)\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot {\left(\sqrt[3]{\left(b + a\right) \cdot \left(\left(b - a\right) \cdot \left(\sin \left(\left(angle \cdot 0.005555555555555556\right) \cdot t_0\right) \cdot \cos \left(angle \cdot \left(-0.005555555555555556 \cdot t_0\right)\right)\right)\right)}\right)}^{3}\\
\end{array}
\end{array}
if (pow.f64 b 2) < 1.99999999999999996e109Initial program 64.0%
associate-*l*64.0%
associate-*l*64.0%
cos-neg64.0%
distribute-rgt-neg-out64.0%
distribute-frac-neg64.0%
neg-mul-164.0%
associate-/l*63.9%
associate-*r/63.1%
associate-/r/63.2%
associate-/l*63.2%
metadata-eval63.2%
Simplified63.2%
unpow263.2%
unpow263.2%
difference-of-squares63.2%
Applied egg-rr63.2%
expm1-log1p-u51.6%
expm1-udef32.7%
Applied egg-rr36.5%
expm1-def55.6%
expm1-log1p70.4%
+-commutative70.4%
associate-*r*70.4%
*-commutative70.4%
Simplified70.4%
if 1.99999999999999996e109 < (pow.f64 b 2) Initial program 49.4%
associate-*l*49.4%
associate-*l*49.4%
cos-neg49.4%
distribute-rgt-neg-out49.4%
distribute-frac-neg49.4%
neg-mul-149.4%
associate-/l*53.0%
associate-*r/53.1%
associate-/r/52.4%
associate-/l*52.4%
metadata-eval52.4%
Simplified52.4%
unpow252.4%
unpow252.4%
difference-of-squares59.5%
Applied egg-rr59.5%
add-cube-cbrt59.3%
pow359.3%
Applied egg-rr70.3%
add-cbrt-cube73.2%
pow373.2%
Applied egg-rr73.2%
add-cbrt-cube73.2%
pow373.2%
Applied egg-rr75.9%
Final simplification72.6%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (cbrt (pow PI 3.0))))
(if (<= (/ angle 180.0) -1e+18)
(*
(* (- b a) (+ b a))
(* (* 2.0 (sin (* PI (/ angle 180.0)))) (cos (* t_0 (/ angle 180.0)))))
(*
2.0
(pow
(cbrt
(*
(+ b a)
(*
(- b a)
(*
(sin (* (* angle 0.005555555555555556) t_0))
(cos (* angle (* PI -0.005555555555555556)))))))
3.0)))))
double code(double a, double b, double angle) {
double t_0 = cbrt(pow(((double) M_PI), 3.0));
double tmp;
if ((angle / 180.0) <= -1e+18) {
tmp = ((b - a) * (b + a)) * ((2.0 * sin((((double) M_PI) * (angle / 180.0)))) * cos((t_0 * (angle / 180.0))));
} else {
tmp = 2.0 * pow(cbrt(((b + a) * ((b - a) * (sin(((angle * 0.005555555555555556) * t_0)) * cos((angle * (((double) M_PI) * -0.005555555555555556))))))), 3.0);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double t_0 = Math.cbrt(Math.pow(Math.PI, 3.0));
double tmp;
if ((angle / 180.0) <= -1e+18) {
tmp = ((b - a) * (b + a)) * ((2.0 * Math.sin((Math.PI * (angle / 180.0)))) * Math.cos((t_0 * (angle / 180.0))));
} else {
tmp = 2.0 * Math.pow(Math.cbrt(((b + a) * ((b - a) * (Math.sin(((angle * 0.005555555555555556) * t_0)) * Math.cos((angle * (Math.PI * -0.005555555555555556))))))), 3.0);
}
return tmp;
}
function code(a, b, angle) t_0 = cbrt((pi ^ 3.0)) tmp = 0.0 if (Float64(angle / 180.0) <= -1e+18) tmp = Float64(Float64(Float64(b - a) * Float64(b + a)) * Float64(Float64(2.0 * sin(Float64(pi * Float64(angle / 180.0)))) * cos(Float64(t_0 * Float64(angle / 180.0))))); else tmp = Float64(2.0 * (cbrt(Float64(Float64(b + a) * Float64(Float64(b - a) * Float64(sin(Float64(Float64(angle * 0.005555555555555556) * t_0)) * cos(Float64(angle * Float64(pi * -0.005555555555555556))))))) ^ 3.0)); end return tmp end
code[a_, b_, angle_] := Block[{t$95$0 = N[Power[N[Power[Pi, 3.0], $MachinePrecision], 1/3], $MachinePrecision]}, If[LessEqual[N[(angle / 180.0), $MachinePrecision], -1e+18], N[(N[(N[(b - a), $MachinePrecision] * N[(b + a), $MachinePrecision]), $MachinePrecision] * N[(N[(2.0 * N[Sin[N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(t$95$0 * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[Power[N[Power[N[(N[(b + a), $MachinePrecision] * N[(N[(b - a), $MachinePrecision] * N[(N[Sin[N[(N[(angle * 0.005555555555555556), $MachinePrecision] * t$95$0), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(angle * N[(Pi * -0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{{\pi}^{3}}\\
\mathbf{if}\;\frac{angle}{180} \leq -1 \cdot 10^{+18}:\\
\;\;\;\;\left(\left(b - a\right) \cdot \left(b + a\right)\right) \cdot \left(\left(2 \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \cos \left(t_0 \cdot \frac{angle}{180}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot {\left(\sqrt[3]{\left(b + a\right) \cdot \left(\left(b - a\right) \cdot \left(\sin \left(\left(angle \cdot 0.005555555555555556\right) \cdot t_0\right) \cdot \cos \left(angle \cdot \left(\pi \cdot -0.005555555555555556\right)\right)\right)\right)}\right)}^{3}\\
\end{array}
\end{array}
if (/.f64 angle 180) < -1e18Initial program 29.0%
*-commutative29.0%
associate-*l*29.0%
associate-*l*29.0%
Simplified29.0%
unpow232.4%
unpow232.4%
difference-of-squares34.1%
Applied egg-rr30.7%
add-cbrt-cube29.5%
pow329.5%
Applied egg-rr41.1%
if -1e18 < (/.f64 angle 180) Initial program 66.8%
associate-*l*66.8%
associate-*l*66.8%
cos-neg66.8%
distribute-rgt-neg-out66.8%
distribute-frac-neg66.8%
neg-mul-166.8%
associate-/l*67.7%
associate-*r/67.2%
associate-/r/66.7%
associate-/l*66.7%
metadata-eval66.7%
Simplified66.7%
unpow266.7%
unpow266.7%
difference-of-squares69.8%
Applied egg-rr69.8%
add-cube-cbrt69.5%
pow369.5%
Applied egg-rr79.8%
add-cbrt-cube81.8%
pow381.8%
Applied egg-rr81.8%
Final simplification72.5%
(FPCore (a b angle)
:precision binary64
(if (<= (/ angle 180.0) 2e+40)
(*
2.0
(*
(*
(- b a)
(*
(sin (* PI (* angle 0.005555555555555556)))
(cos (* -0.005555555555555556 (* PI angle)))))
(+ b a)))
(*
2.0
(*
(* (- b a) (+ b a))
(*
(sin (* PI (/ angle 180.0)))
(cos (* angle (/ (pow (sqrt PI) 2.0) -180.0))))))))
double code(double a, double b, double angle) {
double tmp;
if ((angle / 180.0) <= 2e+40) {
tmp = 2.0 * (((b - a) * (sin((((double) M_PI) * (angle * 0.005555555555555556))) * cos((-0.005555555555555556 * (((double) M_PI) * angle))))) * (b + a));
} else {
tmp = 2.0 * (((b - a) * (b + a)) * (sin((((double) M_PI) * (angle / 180.0))) * cos((angle * (pow(sqrt(((double) M_PI)), 2.0) / -180.0)))));
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if ((angle / 180.0) <= 2e+40) {
tmp = 2.0 * (((b - a) * (Math.sin((Math.PI * (angle * 0.005555555555555556))) * Math.cos((-0.005555555555555556 * (Math.PI * angle))))) * (b + a));
} else {
tmp = 2.0 * (((b - a) * (b + a)) * (Math.sin((Math.PI * (angle / 180.0))) * Math.cos((angle * (Math.pow(Math.sqrt(Math.PI), 2.0) / -180.0)))));
}
return tmp;
}
def code(a, b, angle): tmp = 0 if (angle / 180.0) <= 2e+40: tmp = 2.0 * (((b - a) * (math.sin((math.pi * (angle * 0.005555555555555556))) * math.cos((-0.005555555555555556 * (math.pi * angle))))) * (b + a)) else: tmp = 2.0 * (((b - a) * (b + a)) * (math.sin((math.pi * (angle / 180.0))) * math.cos((angle * (math.pow(math.sqrt(math.pi), 2.0) / -180.0))))) return tmp
function code(a, b, angle) tmp = 0.0 if (Float64(angle / 180.0) <= 2e+40) tmp = Float64(2.0 * Float64(Float64(Float64(b - a) * Float64(sin(Float64(pi * Float64(angle * 0.005555555555555556))) * cos(Float64(-0.005555555555555556 * Float64(pi * angle))))) * Float64(b + a))); else tmp = Float64(2.0 * Float64(Float64(Float64(b - a) * Float64(b + a)) * Float64(sin(Float64(pi * Float64(angle / 180.0))) * cos(Float64(angle * Float64((sqrt(pi) ^ 2.0) / -180.0)))))); end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if ((angle / 180.0) <= 2e+40) tmp = 2.0 * (((b - a) * (sin((pi * (angle * 0.005555555555555556))) * cos((-0.005555555555555556 * (pi * angle))))) * (b + a)); else tmp = 2.0 * (((b - a) * (b + a)) * (sin((pi * (angle / 180.0))) * cos((angle * ((sqrt(pi) ^ 2.0) / -180.0))))); end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[N[(angle / 180.0), $MachinePrecision], 2e+40], N[(2.0 * N[(N[(N[(b - a), $MachinePrecision] * N[(N[Sin[N[(Pi * N[(angle * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(-0.005555555555555556 * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(b + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(N[(b - a), $MachinePrecision] * N[(b + a), $MachinePrecision]), $MachinePrecision] * N[(N[Sin[N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(angle * N[(N[Power[N[Sqrt[Pi], $MachinePrecision], 2.0], $MachinePrecision] / -180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{angle}{180} \leq 2 \cdot 10^{+40}:\\
\;\;\;\;2 \cdot \left(\left(\left(b - a\right) \cdot \left(\sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right) \cdot \cos \left(-0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)\right)\right) \cdot \left(b + a\right)\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\left(\left(b - a\right) \cdot \left(b + a\right)\right) \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \cos \left(angle \cdot \frac{{\left(\sqrt{\pi}\right)}^{2}}{-180}\right)\right)\right)\\
\end{array}
\end{array}
if (/.f64 angle 180) < 2.00000000000000006e40Initial program 63.9%
associate-*l*63.9%
associate-*l*63.9%
cos-neg63.9%
distribute-rgt-neg-out63.9%
distribute-frac-neg63.9%
neg-mul-163.9%
associate-/l*64.6%
associate-*r/64.5%
associate-/r/64.7%
associate-/l*64.7%
metadata-eval64.7%
Simplified64.7%
unpow264.7%
unpow264.7%
difference-of-squares68.2%
Applied egg-rr68.2%
expm1-log1p-u49.9%
expm1-udef33.8%
Applied egg-rr39.5%
expm1-def55.8%
expm1-log1p79.8%
+-commutative79.8%
associate-*r*79.2%
*-commutative79.2%
Simplified79.2%
if 2.00000000000000006e40 < (/.f64 angle 180) Initial program 34.3%
associate-*l*34.3%
associate-*l*34.3%
cos-neg34.3%
distribute-rgt-neg-out34.3%
distribute-frac-neg34.3%
neg-mul-134.3%
associate-/l*38.6%
associate-*r/36.4%
associate-/r/34.5%
associate-/l*34.5%
metadata-eval34.5%
Simplified34.5%
unpow234.5%
unpow234.5%
difference-of-squares34.5%
Applied egg-rr34.5%
add-sqr-sqrt41.2%
pow241.2%
Applied egg-rr41.2%
Final simplification71.9%
(FPCore (a b angle)
:precision binary64
(if (<= (/ angle 180.0) 5e-45)
(*
2.0
(pow
(cbrt
(*
(+ b a)
(*
(- b a)
(*
(sin (* PI (* angle 0.005555555555555556)))
(cos (* angle (* PI -0.005555555555555556)))))))
3.0))
(*
2.0
(*
(* (- b a) (+ b a))
(*
(sin (* PI (/ angle 180.0)))
(cos (* angle (/ (pow (sqrt PI) 2.0) -180.0))))))))
double code(double a, double b, double angle) {
double tmp;
if ((angle / 180.0) <= 5e-45) {
tmp = 2.0 * pow(cbrt(((b + a) * ((b - a) * (sin((((double) M_PI) * (angle * 0.005555555555555556))) * cos((angle * (((double) M_PI) * -0.005555555555555556))))))), 3.0);
} else {
tmp = 2.0 * (((b - a) * (b + a)) * (sin((((double) M_PI) * (angle / 180.0))) * cos((angle * (pow(sqrt(((double) M_PI)), 2.0) / -180.0)))));
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if ((angle / 180.0) <= 5e-45) {
tmp = 2.0 * Math.pow(Math.cbrt(((b + a) * ((b - a) * (Math.sin((Math.PI * (angle * 0.005555555555555556))) * Math.cos((angle * (Math.PI * -0.005555555555555556))))))), 3.0);
} else {
tmp = 2.0 * (((b - a) * (b + a)) * (Math.sin((Math.PI * (angle / 180.0))) * Math.cos((angle * (Math.pow(Math.sqrt(Math.PI), 2.0) / -180.0)))));
}
return tmp;
}
function code(a, b, angle) tmp = 0.0 if (Float64(angle / 180.0) <= 5e-45) tmp = Float64(2.0 * (cbrt(Float64(Float64(b + a) * Float64(Float64(b - a) * Float64(sin(Float64(pi * Float64(angle * 0.005555555555555556))) * cos(Float64(angle * Float64(pi * -0.005555555555555556))))))) ^ 3.0)); else tmp = Float64(2.0 * Float64(Float64(Float64(b - a) * Float64(b + a)) * Float64(sin(Float64(pi * Float64(angle / 180.0))) * cos(Float64(angle * Float64((sqrt(pi) ^ 2.0) / -180.0)))))); end return tmp end
code[a_, b_, angle_] := If[LessEqual[N[(angle / 180.0), $MachinePrecision], 5e-45], N[(2.0 * N[Power[N[Power[N[(N[(b + a), $MachinePrecision] * N[(N[(b - a), $MachinePrecision] * N[(N[Sin[N[(Pi * N[(angle * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(angle * N[(Pi * -0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(N[(b - a), $MachinePrecision] * N[(b + a), $MachinePrecision]), $MachinePrecision] * N[(N[Sin[N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(angle * N[(N[Power[N[Sqrt[Pi], $MachinePrecision], 2.0], $MachinePrecision] / -180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{angle}{180} \leq 5 \cdot 10^{-45}:\\
\;\;\;\;2 \cdot {\left(\sqrt[3]{\left(b + a\right) \cdot \left(\left(b - a\right) \cdot \left(\sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right) \cdot \cos \left(angle \cdot \left(\pi \cdot -0.005555555555555556\right)\right)\right)\right)}\right)}^{3}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\left(\left(b - a\right) \cdot \left(b + a\right)\right) \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \cos \left(angle \cdot \frac{{\left(\sqrt{\pi}\right)}^{2}}{-180}\right)\right)\right)\\
\end{array}
\end{array}
if (/.f64 angle 180) < 4.99999999999999976e-45Initial program 62.0%
associate-*l*62.0%
associate-*l*62.0%
cos-neg62.0%
distribute-rgt-neg-out62.0%
distribute-frac-neg62.0%
neg-mul-162.0%
associate-/l*62.9%
associate-*r/62.9%
associate-/r/63.1%
associate-/l*63.1%
metadata-eval63.1%
Simplified63.1%
unpow263.1%
unpow263.1%
difference-of-squares66.4%
Applied egg-rr66.4%
add-cube-cbrt66.1%
pow366.0%
Applied egg-rr78.8%
if 4.99999999999999976e-45 < (/.f64 angle 180) Initial program 48.4%
associate-*l*48.4%
associate-*l*48.3%
cos-neg48.3%
distribute-rgt-neg-out48.3%
distribute-frac-neg48.3%
neg-mul-148.3%
associate-/l*51.0%
associate-*r/49.5%
associate-/r/48.2%
associate-/l*48.2%
metadata-eval48.2%
Simplified48.2%
unpow248.2%
unpow248.2%
difference-of-squares49.6%
Applied egg-rr49.6%
add-sqr-sqrt54.4%
pow254.4%
Applied egg-rr54.4%
Final simplification72.1%
(FPCore (a b angle)
:precision binary64
(if (<= (/ angle 180.0) -2e+44)
(*
(* (- b a) (+ b a))
(*
(* 2.0 (sin (* PI (/ angle 180.0))))
(cos (* (cbrt (pow PI 3.0)) (/ angle 180.0)))))
(*
2.0
(pow
(cbrt
(*
(+ b a)
(*
(- b a)
(*
(cos (* angle (* PI -0.005555555555555556)))
(sin (* 0.005555555555555556 (* PI angle)))))))
3.0))))
double code(double a, double b, double angle) {
double tmp;
if ((angle / 180.0) <= -2e+44) {
tmp = ((b - a) * (b + a)) * ((2.0 * sin((((double) M_PI) * (angle / 180.0)))) * cos((cbrt(pow(((double) M_PI), 3.0)) * (angle / 180.0))));
} else {
tmp = 2.0 * pow(cbrt(((b + a) * ((b - a) * (cos((angle * (((double) M_PI) * -0.005555555555555556))) * sin((0.005555555555555556 * (((double) M_PI) * angle))))))), 3.0);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if ((angle / 180.0) <= -2e+44) {
tmp = ((b - a) * (b + a)) * ((2.0 * Math.sin((Math.PI * (angle / 180.0)))) * Math.cos((Math.cbrt(Math.pow(Math.PI, 3.0)) * (angle / 180.0))));
} else {
tmp = 2.0 * Math.pow(Math.cbrt(((b + a) * ((b - a) * (Math.cos((angle * (Math.PI * -0.005555555555555556))) * Math.sin((0.005555555555555556 * (Math.PI * angle))))))), 3.0);
}
return tmp;
}
function code(a, b, angle) tmp = 0.0 if (Float64(angle / 180.0) <= -2e+44) tmp = Float64(Float64(Float64(b - a) * Float64(b + a)) * Float64(Float64(2.0 * sin(Float64(pi * Float64(angle / 180.0)))) * cos(Float64(cbrt((pi ^ 3.0)) * Float64(angle / 180.0))))); else tmp = Float64(2.0 * (cbrt(Float64(Float64(b + a) * Float64(Float64(b - a) * Float64(cos(Float64(angle * Float64(pi * -0.005555555555555556))) * sin(Float64(0.005555555555555556 * Float64(pi * angle))))))) ^ 3.0)); end return tmp end
code[a_, b_, angle_] := If[LessEqual[N[(angle / 180.0), $MachinePrecision], -2e+44], N[(N[(N[(b - a), $MachinePrecision] * N[(b + a), $MachinePrecision]), $MachinePrecision] * N[(N[(2.0 * N[Sin[N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(N[Power[N[Power[Pi, 3.0], $MachinePrecision], 1/3], $MachinePrecision] * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[Power[N[Power[N[(N[(b + a), $MachinePrecision] * N[(N[(b - a), $MachinePrecision] * N[(N[Cos[N[(angle * N[(Pi * -0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(0.005555555555555556 * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{angle}{180} \leq -2 \cdot 10^{+44}:\\
\;\;\;\;\left(\left(b - a\right) \cdot \left(b + a\right)\right) \cdot \left(\left(2 \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \cos \left(\sqrt[3]{{\pi}^{3}} \cdot \frac{angle}{180}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot {\left(\sqrt[3]{\left(b + a\right) \cdot \left(\left(b - a\right) \cdot \left(\cos \left(angle \cdot \left(\pi \cdot -0.005555555555555556\right)\right) \cdot \sin \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)\right)\right)}\right)}^{3}\\
\end{array}
\end{array}
if (/.f64 angle 180) < -2.0000000000000002e44Initial program 27.9%
*-commutative27.9%
associate-*l*27.9%
associate-*l*27.9%
Simplified27.9%
unpow233.7%
unpow233.7%
difference-of-squares35.7%
Applied egg-rr29.9%
add-cbrt-cube30.9%
pow330.9%
Applied egg-rr43.7%
if -2.0000000000000002e44 < (/.f64 angle 180) Initial program 65.8%
associate-*l*65.8%
associate-*l*65.8%
cos-neg65.8%
distribute-rgt-neg-out65.8%
distribute-frac-neg65.8%
neg-mul-165.8%
associate-/l*66.6%
associate-*r/65.6%
associate-/r/65.2%
associate-/l*65.2%
metadata-eval65.2%
Simplified65.2%
unpow265.2%
unpow265.2%
difference-of-squares68.2%
Applied egg-rr68.2%
add-cube-cbrt67.9%
pow367.9%
Applied egg-rr77.9%
Taylor expanded in angle around inf 79.3%
Final simplification72.2%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (sin (* PI (* angle 0.005555555555555556)))))
(if (<= (/ angle 180.0) -5e-34)
(*
2.0
(*
(cos (* angle (* PI -0.005555555555555556)))
(* t_0 (* (- b a) (+ b a)))))
(* 2.0 (pow (cbrt (* (+ b a) (* (- b a) t_0))) 3.0)))))
double code(double a, double b, double angle) {
double t_0 = sin((((double) M_PI) * (angle * 0.005555555555555556)));
double tmp;
if ((angle / 180.0) <= -5e-34) {
tmp = 2.0 * (cos((angle * (((double) M_PI) * -0.005555555555555556))) * (t_0 * ((b - a) * (b + a))));
} else {
tmp = 2.0 * pow(cbrt(((b + a) * ((b - a) * t_0))), 3.0);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double t_0 = Math.sin((Math.PI * (angle * 0.005555555555555556)));
double tmp;
if ((angle / 180.0) <= -5e-34) {
tmp = 2.0 * (Math.cos((angle * (Math.PI * -0.005555555555555556))) * (t_0 * ((b - a) * (b + a))));
} else {
tmp = 2.0 * Math.pow(Math.cbrt(((b + a) * ((b - a) * t_0))), 3.0);
}
return tmp;
}
function code(a, b, angle) t_0 = sin(Float64(pi * Float64(angle * 0.005555555555555556))) tmp = 0.0 if (Float64(angle / 180.0) <= -5e-34) tmp = Float64(2.0 * Float64(cos(Float64(angle * Float64(pi * -0.005555555555555556))) * Float64(t_0 * Float64(Float64(b - a) * Float64(b + a))))); else tmp = Float64(2.0 * (cbrt(Float64(Float64(b + a) * Float64(Float64(b - a) * t_0))) ^ 3.0)); end return tmp end
code[a_, b_, angle_] := Block[{t$95$0 = N[Sin[N[(Pi * N[(angle * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(angle / 180.0), $MachinePrecision], -5e-34], N[(2.0 * N[(N[Cos[N[(angle * N[(Pi * -0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 * N[(N[(b - a), $MachinePrecision] * N[(b + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[Power[N[Power[N[(N[(b + a), $MachinePrecision] * N[(N[(b - a), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\\
\mathbf{if}\;\frac{angle}{180} \leq -5 \cdot 10^{-34}:\\
\;\;\;\;2 \cdot \left(\cos \left(angle \cdot \left(\pi \cdot -0.005555555555555556\right)\right) \cdot \left(t_0 \cdot \left(\left(b - a\right) \cdot \left(b + a\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot {\left(\sqrt[3]{\left(b + a\right) \cdot \left(\left(b - a\right) \cdot t_0\right)}\right)}^{3}\\
\end{array}
\end{array}
if (/.f64 angle 180) < -5.0000000000000003e-34Initial program 40.1%
associate-*l*40.1%
associate-*l*40.1%
cos-neg40.1%
distribute-rgt-neg-out40.1%
distribute-frac-neg40.1%
neg-mul-140.1%
associate-/l*42.3%
associate-*r/42.2%
associate-/r/42.8%
associate-/l*42.8%
metadata-eval42.8%
Simplified42.8%
unpow242.8%
unpow242.8%
difference-of-squares45.5%
Applied egg-rr45.5%
Taylor expanded in angle around inf 40.5%
Taylor expanded in angle around inf 37.4%
*-commutative37.4%
associate-*r*46.0%
+-commutative46.0%
*-commutative46.0%
+-commutative46.0%
*-commutative46.0%
*-commutative46.0%
*-commutative46.0%
associate-*r*47.8%
Simplified47.8%
if -5.0000000000000003e-34 < (/.f64 angle 180) Initial program 65.3%
associate-*l*65.3%
associate-*l*65.3%
cos-neg65.3%
distribute-rgt-neg-out65.3%
distribute-frac-neg65.3%
neg-mul-165.3%
associate-/l*66.4%
associate-*r/65.8%
associate-/r/65.3%
associate-/l*65.3%
metadata-eval65.3%
Simplified65.3%
unpow265.3%
unpow265.3%
difference-of-squares68.1%
Applied egg-rr68.1%
add-cube-cbrt67.8%
pow367.7%
Applied egg-rr78.9%
Taylor expanded in angle around 0 79.7%
Final simplification70.7%
(FPCore (a b angle)
:precision binary64
(if (<= (/ angle 180.0) 40000000000000.0)
(*
2.0
(*
(*
(- b a)
(*
(sin (* PI (* angle 0.005555555555555556)))
(cos (* -0.005555555555555556 (* PI angle)))))
(+ b a)))
(*
2.0
(* (* (- b a) (+ b a)) (sin (* 0.005555555555555556 (* PI angle)))))))
double code(double a, double b, double angle) {
double tmp;
if ((angle / 180.0) <= 40000000000000.0) {
tmp = 2.0 * (((b - a) * (sin((((double) M_PI) * (angle * 0.005555555555555556))) * cos((-0.005555555555555556 * (((double) M_PI) * angle))))) * (b + a));
} else {
tmp = 2.0 * (((b - a) * (b + a)) * sin((0.005555555555555556 * (((double) M_PI) * angle))));
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if ((angle / 180.0) <= 40000000000000.0) {
tmp = 2.0 * (((b - a) * (Math.sin((Math.PI * (angle * 0.005555555555555556))) * Math.cos((-0.005555555555555556 * (Math.PI * angle))))) * (b + a));
} else {
tmp = 2.0 * (((b - a) * (b + a)) * Math.sin((0.005555555555555556 * (Math.PI * angle))));
}
return tmp;
}
def code(a, b, angle): tmp = 0 if (angle / 180.0) <= 40000000000000.0: tmp = 2.0 * (((b - a) * (math.sin((math.pi * (angle * 0.005555555555555556))) * math.cos((-0.005555555555555556 * (math.pi * angle))))) * (b + a)) else: tmp = 2.0 * (((b - a) * (b + a)) * math.sin((0.005555555555555556 * (math.pi * angle)))) return tmp
function code(a, b, angle) tmp = 0.0 if (Float64(angle / 180.0) <= 40000000000000.0) tmp = Float64(2.0 * Float64(Float64(Float64(b - a) * Float64(sin(Float64(pi * Float64(angle * 0.005555555555555556))) * cos(Float64(-0.005555555555555556 * Float64(pi * angle))))) * Float64(b + a))); else tmp = Float64(2.0 * Float64(Float64(Float64(b - a) * Float64(b + a)) * sin(Float64(0.005555555555555556 * Float64(pi * angle))))); end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if ((angle / 180.0) <= 40000000000000.0) tmp = 2.0 * (((b - a) * (sin((pi * (angle * 0.005555555555555556))) * cos((-0.005555555555555556 * (pi * angle))))) * (b + a)); else tmp = 2.0 * (((b - a) * (b + a)) * sin((0.005555555555555556 * (pi * angle)))); end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[N[(angle / 180.0), $MachinePrecision], 40000000000000.0], N[(2.0 * N[(N[(N[(b - a), $MachinePrecision] * N[(N[Sin[N[(Pi * N[(angle * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(-0.005555555555555556 * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(b + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(N[(b - a), $MachinePrecision] * N[(b + a), $MachinePrecision]), $MachinePrecision] * N[Sin[N[(0.005555555555555556 * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{angle}{180} \leq 40000000000000:\\
\;\;\;\;2 \cdot \left(\left(\left(b - a\right) \cdot \left(\sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right) \cdot \cos \left(-0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)\right)\right) \cdot \left(b + a\right)\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\left(\left(b - a\right) \cdot \left(b + a\right)\right) \cdot \sin \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)\right)\\
\end{array}
\end{array}
if (/.f64 angle 180) < 4e13Initial program 64.4%
associate-*l*64.4%
associate-*l*64.4%
cos-neg64.4%
distribute-rgt-neg-out64.4%
distribute-frac-neg64.4%
neg-mul-164.4%
associate-/l*65.1%
associate-*r/65.1%
associate-/r/65.3%
associate-/l*65.3%
metadata-eval65.3%
Simplified65.3%
unpow265.3%
unpow265.3%
difference-of-squares68.9%
Applied egg-rr68.9%
expm1-log1p-u50.1%
expm1-udef33.6%
Applied egg-rr39.4%
expm1-def56.0%
expm1-log1p80.7%
+-commutative80.7%
associate-*r*80.0%
*-commutative80.0%
Simplified80.0%
if 4e13 < (/.f64 angle 180) Initial program 35.3%
associate-*l*35.3%
associate-*l*35.3%
cos-neg35.3%
distribute-rgt-neg-out35.3%
distribute-frac-neg35.3%
neg-mul-135.3%
associate-/l*38.8%
associate-*r/36.9%
associate-/r/35.2%
associate-/l*35.2%
metadata-eval35.2%
Simplified35.2%
unpow235.2%
unpow235.2%
difference-of-squares35.2%
Applied egg-rr35.2%
Taylor expanded in angle around inf 35.9%
Taylor expanded in angle around 0 39.5%
Final simplification71.5%
(FPCore (a b angle)
:precision binary64
(if (<= (/ angle 180.0) -5e-34)
(* (* (- b a) (+ b a)) (sin (* PI (* 2.0 (* angle 0.005555555555555556)))))
(*
2.0
(pow
(cbrt (* (+ b a) (* (- b a) (sin (* PI (* angle 0.005555555555555556))))))
3.0))))
double code(double a, double b, double angle) {
double tmp;
if ((angle / 180.0) <= -5e-34) {
tmp = ((b - a) * (b + a)) * sin((((double) M_PI) * (2.0 * (angle * 0.005555555555555556))));
} else {
tmp = 2.0 * pow(cbrt(((b + a) * ((b - a) * sin((((double) M_PI) * (angle * 0.005555555555555556)))))), 3.0);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if ((angle / 180.0) <= -5e-34) {
tmp = ((b - a) * (b + a)) * Math.sin((Math.PI * (2.0 * (angle * 0.005555555555555556))));
} else {
tmp = 2.0 * Math.pow(Math.cbrt(((b + a) * ((b - a) * Math.sin((Math.PI * (angle * 0.005555555555555556)))))), 3.0);
}
return tmp;
}
function code(a, b, angle) tmp = 0.0 if (Float64(angle / 180.0) <= -5e-34) tmp = Float64(Float64(Float64(b - a) * Float64(b + a)) * sin(Float64(pi * Float64(2.0 * Float64(angle * 0.005555555555555556))))); else tmp = Float64(2.0 * (cbrt(Float64(Float64(b + a) * Float64(Float64(b - a) * sin(Float64(pi * Float64(angle * 0.005555555555555556)))))) ^ 3.0)); end return tmp end
code[a_, b_, angle_] := If[LessEqual[N[(angle / 180.0), $MachinePrecision], -5e-34], N[(N[(N[(b - a), $MachinePrecision] * N[(b + a), $MachinePrecision]), $MachinePrecision] * N[Sin[N[(Pi * N[(2.0 * N[(angle * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(2.0 * N[Power[N[Power[N[(N[(b + a), $MachinePrecision] * N[(N[(b - a), $MachinePrecision] * N[Sin[N[(Pi * N[(angle * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{angle}{180} \leq -5 \cdot 10^{-34}:\\
\;\;\;\;\left(\left(b - a\right) \cdot \left(b + a\right)\right) \cdot \sin \left(\pi \cdot \left(2 \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot {\left(\sqrt[3]{\left(b + a\right) \cdot \left(\left(b - a\right) \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}\right)}^{3}\\
\end{array}
\end{array}
if (/.f64 angle 180) < -5.0000000000000003e-34Initial program 40.1%
*-commutative40.1%
associate-*l*40.1%
associate-*l*40.1%
Simplified40.1%
unpow242.8%
unpow242.8%
difference-of-squares45.5%
Applied egg-rr42.8%
expm1-log1p-u22.5%
expm1-udef18.5%
Applied egg-rr19.8%
expm1-def24.0%
expm1-log1p46.6%
*-commutative46.6%
+-commutative46.6%
associate-*l*46.6%
Simplified46.6%
if -5.0000000000000003e-34 < (/.f64 angle 180) Initial program 65.3%
associate-*l*65.3%
associate-*l*65.3%
cos-neg65.3%
distribute-rgt-neg-out65.3%
distribute-frac-neg65.3%
neg-mul-165.3%
associate-/l*66.4%
associate-*r/65.8%
associate-/r/65.3%
associate-/l*65.3%
metadata-eval65.3%
Simplified65.3%
unpow265.3%
unpow265.3%
difference-of-squares68.1%
Applied egg-rr68.1%
add-cube-cbrt67.8%
pow367.7%
Applied egg-rr78.9%
Taylor expanded in angle around 0 79.7%
Final simplification70.4%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* (- b a) (+ b a))))
(if (<= a 1.15e+232)
(* t_0 (sin (* PI (* 2.0 (* angle 0.005555555555555556)))))
(* 2.0 (* t_0 (sin (* 0.005555555555555556 (* PI angle))))))))
double code(double a, double b, double angle) {
double t_0 = (b - a) * (b + a);
double tmp;
if (a <= 1.15e+232) {
tmp = t_0 * sin((((double) M_PI) * (2.0 * (angle * 0.005555555555555556))));
} else {
tmp = 2.0 * (t_0 * sin((0.005555555555555556 * (((double) M_PI) * angle))));
}
return tmp;
}
public static double code(double a, double b, double angle) {
double t_0 = (b - a) * (b + a);
double tmp;
if (a <= 1.15e+232) {
tmp = t_0 * Math.sin((Math.PI * (2.0 * (angle * 0.005555555555555556))));
} else {
tmp = 2.0 * (t_0 * Math.sin((0.005555555555555556 * (Math.PI * angle))));
}
return tmp;
}
def code(a, b, angle): t_0 = (b - a) * (b + a) tmp = 0 if a <= 1.15e+232: tmp = t_0 * math.sin((math.pi * (2.0 * (angle * 0.005555555555555556)))) else: tmp = 2.0 * (t_0 * math.sin((0.005555555555555556 * (math.pi * angle)))) return tmp
function code(a, b, angle) t_0 = Float64(Float64(b - a) * Float64(b + a)) tmp = 0.0 if (a <= 1.15e+232) tmp = Float64(t_0 * sin(Float64(pi * Float64(2.0 * Float64(angle * 0.005555555555555556))))); else tmp = Float64(2.0 * Float64(t_0 * sin(Float64(0.005555555555555556 * Float64(pi * angle))))); end return tmp end
function tmp_2 = code(a, b, angle) t_0 = (b - a) * (b + a); tmp = 0.0; if (a <= 1.15e+232) tmp = t_0 * sin((pi * (2.0 * (angle * 0.005555555555555556)))); else tmp = 2.0 * (t_0 * sin((0.005555555555555556 * (pi * angle)))); end tmp_2 = tmp; end
code[a_, b_, angle_] := Block[{t$95$0 = N[(N[(b - a), $MachinePrecision] * N[(b + a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, 1.15e+232], N[(t$95$0 * N[Sin[N[(Pi * N[(2.0 * N[(angle * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(t$95$0 * N[Sin[N[(0.005555555555555556 * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(b - a\right) \cdot \left(b + a\right)\\
\mathbf{if}\;a \leq 1.15 \cdot 10^{+232}:\\
\;\;\;\;t_0 \cdot \sin \left(\pi \cdot \left(2 \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(t_0 \cdot \sin \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)\right)\\
\end{array}
\end{array}
if a < 1.15000000000000003e232Initial program 58.0%
*-commutative58.0%
associate-*l*58.0%
associate-*l*58.0%
Simplified58.0%
unpow258.7%
unpow258.7%
difference-of-squares61.7%
Applied egg-rr60.9%
expm1-log1p-u43.8%
expm1-udef30.0%
Applied egg-rr30.8%
expm1-def44.7%
expm1-log1p61.8%
*-commutative61.8%
+-commutative61.8%
associate-*l*61.8%
Simplified61.8%
if 1.15000000000000003e232 < a Initial program 63.6%
associate-*l*63.6%
associate-*l*63.6%
cos-neg63.6%
distribute-rgt-neg-out63.6%
distribute-frac-neg63.6%
neg-mul-163.6%
associate-/l*72.7%
associate-*r/63.6%
associate-/r/63.6%
associate-/l*63.6%
metadata-eval63.6%
Simplified63.6%
unpow263.6%
unpow263.6%
difference-of-squares63.6%
Applied egg-rr63.6%
Taylor expanded in angle around inf 36.4%
Taylor expanded in angle around 0 72.7%
Final simplification62.3%
(FPCore (a b angle) :precision binary64 (* (* (- b a) (+ b a)) (sin (* PI (* 2.0 (* angle 0.005555555555555556))))))
double code(double a, double b, double angle) {
return ((b - a) * (b + a)) * sin((((double) M_PI) * (2.0 * (angle * 0.005555555555555556))));
}
public static double code(double a, double b, double angle) {
return ((b - a) * (b + a)) * Math.sin((Math.PI * (2.0 * (angle * 0.005555555555555556))));
}
def code(a, b, angle): return ((b - a) * (b + a)) * math.sin((math.pi * (2.0 * (angle * 0.005555555555555556))))
function code(a, b, angle) return Float64(Float64(Float64(b - a) * Float64(b + a)) * sin(Float64(pi * Float64(2.0 * Float64(angle * 0.005555555555555556))))) end
function tmp = code(a, b, angle) tmp = ((b - a) * (b + a)) * sin((pi * (2.0 * (angle * 0.005555555555555556)))); end
code[a_, b_, angle_] := N[(N[(N[(b - a), $MachinePrecision] * N[(b + a), $MachinePrecision]), $MachinePrecision] * N[Sin[N[(Pi * N[(2.0 * N[(angle * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(b - a\right) \cdot \left(b + a\right)\right) \cdot \sin \left(\pi \cdot \left(2 \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)
\end{array}
Initial program 58.2%
*-commutative58.2%
associate-*l*58.2%
associate-*l*58.2%
Simplified58.2%
unpow258.9%
unpow258.9%
difference-of-squares61.7%
Applied egg-rr61.0%
expm1-log1p-u43.0%
expm1-udef29.8%
Applied egg-rr30.2%
expm1-def43.6%
expm1-log1p61.1%
*-commutative61.1%
+-commutative61.1%
associate-*l*61.1%
Simplified61.1%
Final simplification61.1%
(FPCore (a b angle) :precision binary64 (* -0.011111111111111112 (* angle (* PI (* (+ b a) (- a b))))))
double code(double a, double b, double angle) {
return -0.011111111111111112 * (angle * (((double) M_PI) * ((b + a) * (a - b))));
}
public static double code(double a, double b, double angle) {
return -0.011111111111111112 * (angle * (Math.PI * ((b + a) * (a - b))));
}
def code(a, b, angle): return -0.011111111111111112 * (angle * (math.pi * ((b + a) * (a - b))))
function code(a, b, angle) return Float64(-0.011111111111111112 * Float64(angle * Float64(pi * Float64(Float64(b + a) * Float64(a - b))))) end
function tmp = code(a, b, angle) tmp = -0.011111111111111112 * (angle * (pi * ((b + a) * (a - b)))); end
code[a_, b_, angle_] := N[(-0.011111111111111112 * N[(angle * N[(Pi * N[(N[(b + a), $MachinePrecision] * N[(a - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-0.011111111111111112 \cdot \left(angle \cdot \left(\pi \cdot \left(\left(b + a\right) \cdot \left(a - b\right)\right)\right)\right)
\end{array}
Initial program 58.2%
Simplified57.1%
Taylor expanded in angle around 0 53.3%
unpow253.3%
unpow253.3%
difference-of-squares55.7%
Applied egg-rr55.7%
Final simplification55.7%
(FPCore (a b angle) :precision binary64 (* 0.011111111111111112 (* (* PI angle) (* (- b a) (+ b a)))))
double code(double a, double b, double angle) {
return 0.011111111111111112 * ((((double) M_PI) * angle) * ((b - a) * (b + a)));
}
public static double code(double a, double b, double angle) {
return 0.011111111111111112 * ((Math.PI * angle) * ((b - a) * (b + a)));
}
def code(a, b, angle): return 0.011111111111111112 * ((math.pi * angle) * ((b - a) * (b + a)))
function code(a, b, angle) return Float64(0.011111111111111112 * Float64(Float64(pi * angle) * Float64(Float64(b - a) * Float64(b + a)))) end
function tmp = code(a, b, angle) tmp = 0.011111111111111112 * ((pi * angle) * ((b - a) * (b + a))); end
code[a_, b_, angle_] := N[(0.011111111111111112 * N[(N[(Pi * angle), $MachinePrecision] * N[(N[(b - a), $MachinePrecision] * N[(b + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.011111111111111112 \cdot \left(\left(\pi \cdot angle\right) \cdot \left(\left(b - a\right) \cdot \left(b + a\right)\right)\right)
\end{array}
Initial program 58.2%
*-commutative58.2%
associate-*l*58.2%
associate-*l*58.2%
Simplified58.2%
unpow258.9%
unpow258.9%
difference-of-squares61.7%
Applied egg-rr61.0%
Taylor expanded in angle around 0 55.7%
associate-*r*55.8%
+-commutative55.8%
*-commutative55.8%
+-commutative55.8%
Simplified55.8%
Final simplification55.8%
herbie shell --seed 2023309
(FPCore (a b angle)
:name "ab-angle->ABCF B"
:precision binary64
(* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) (sin (* PI (/ angle 180.0)))) (cos (* PI (/ angle 180.0)))))