
(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 11 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
(if (<= (pow b 2.0) 2e+285)
(*
(pow
(cbrt
(*
2.0
(* (- b a) (* (+ b a) (sin (* angle (* PI 0.005555555555555556)))))))
3.0)
(cos (* PI (/ angle 180.0))))
(* (* (- b a) (* (+ b a) angle)) (* PI 0.011111111111111112))))
double code(double a, double b, double angle) {
double tmp;
if (pow(b, 2.0) <= 2e+285) {
tmp = pow(cbrt((2.0 * ((b - a) * ((b + a) * sin((angle * (((double) M_PI) * 0.005555555555555556))))))), 3.0) * cos((((double) M_PI) * (angle / 180.0)));
} else {
tmp = ((b - a) * ((b + a) * angle)) * (((double) M_PI) * 0.011111111111111112);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (Math.pow(b, 2.0) <= 2e+285) {
tmp = Math.pow(Math.cbrt((2.0 * ((b - a) * ((b + a) * Math.sin((angle * (Math.PI * 0.005555555555555556))))))), 3.0) * Math.cos((Math.PI * (angle / 180.0)));
} else {
tmp = ((b - a) * ((b + a) * angle)) * (Math.PI * 0.011111111111111112);
}
return tmp;
}
function code(a, b, angle) tmp = 0.0 if ((b ^ 2.0) <= 2e+285) tmp = Float64((cbrt(Float64(2.0 * Float64(Float64(b - a) * Float64(Float64(b + a) * sin(Float64(angle * Float64(pi * 0.005555555555555556))))))) ^ 3.0) * cos(Float64(pi * Float64(angle / 180.0)))); else tmp = Float64(Float64(Float64(b - a) * Float64(Float64(b + a) * angle)) * Float64(pi * 0.011111111111111112)); end return tmp end
code[a_, b_, angle_] := If[LessEqual[N[Power[b, 2.0], $MachinePrecision], 2e+285], N[(N[Power[N[Power[N[(2.0 * N[(N[(b - a), $MachinePrecision] * N[(N[(b + a), $MachinePrecision] * N[Sin[N[(angle * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision] * N[Cos[N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(b - a), $MachinePrecision] * N[(N[(b + a), $MachinePrecision] * angle), $MachinePrecision]), $MachinePrecision] * N[(Pi * 0.011111111111111112), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{b}^{2} \leq 2 \cdot 10^{+285}:\\
\;\;\;\;{\left(\sqrt[3]{2 \cdot \left(\left(b - a\right) \cdot \left(\left(b + a\right) \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)\right)}\right)}^{3} \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(b - a\right) \cdot \left(\left(b + a\right) \cdot angle\right)\right) \cdot \left(\pi \cdot 0.011111111111111112\right)\\
\end{array}
\end{array}
if (pow.f64 b 2) < 2e285Initial program 58.3%
add-cube-cbrt57.9%
pow357.9%
*-commutative57.9%
div-inv58.1%
metadata-eval58.1%
unpow258.1%
unpow258.1%
Applied egg-rr58.1%
expm1-log1p-u44.2%
expm1-udef29.1%
Applied egg-rr29.1%
expm1-def44.2%
expm1-log1p58.1%
*-commutative58.1%
associate-*r*56.8%
*-commutative56.8%
*-commutative56.8%
unpow256.8%
unpow256.8%
associate-*r*56.8%
unpow256.8%
unpow256.8%
difference-of-squares56.8%
*-commutative56.8%
Simplified67.5%
if 2e285 < (pow.f64 b 2) Initial program 47.1%
Taylor expanded in angle around 0 36.4%
associate-*r*36.4%
unpow236.4%
unpow236.4%
Simplified36.4%
pow136.4%
*-commutative36.4%
difference-of-squares45.7%
associate-*l*62.4%
Applied egg-rr62.4%
Taylor expanded in angle around 0 82.1%
Taylor expanded in angle around 0 65.3%
*-commutative65.3%
associate-*r*82.1%
*-commutative82.1%
associate-*l*82.1%
+-commutative82.1%
associate-*r*82.1%
associate-*l*82.1%
+-commutative82.1%
Simplified82.1%
Final simplification70.7%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* angle (* PI 0.005555555555555556)))
(t_1 (- (pow b 2.0) (pow a 2.0))))
(if (<= t_1 -1e+297)
(* 2.0 (* (- b a) (* (+ b a) (sin t_0))))
(if (<= t_1 4e+250)
(* (* (* 2.0 t_1) (sin (* PI (/ angle 180.0)))) (cos t_0))
(* (* (- b a) (* (+ b a) angle)) (* PI 0.011111111111111112))))))
double code(double a, double b, double angle) {
double t_0 = angle * (((double) M_PI) * 0.005555555555555556);
double t_1 = pow(b, 2.0) - pow(a, 2.0);
double tmp;
if (t_1 <= -1e+297) {
tmp = 2.0 * ((b - a) * ((b + a) * sin(t_0)));
} else if (t_1 <= 4e+250) {
tmp = ((2.0 * t_1) * sin((((double) M_PI) * (angle / 180.0)))) * cos(t_0);
} else {
tmp = ((b - a) * ((b + a) * angle)) * (((double) M_PI) * 0.011111111111111112);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double t_0 = angle * (Math.PI * 0.005555555555555556);
double t_1 = Math.pow(b, 2.0) - Math.pow(a, 2.0);
double tmp;
if (t_1 <= -1e+297) {
tmp = 2.0 * ((b - a) * ((b + a) * Math.sin(t_0)));
} else if (t_1 <= 4e+250) {
tmp = ((2.0 * t_1) * Math.sin((Math.PI * (angle / 180.0)))) * Math.cos(t_0);
} else {
tmp = ((b - a) * ((b + a) * angle)) * (Math.PI * 0.011111111111111112);
}
return tmp;
}
def code(a, b, angle): t_0 = angle * (math.pi * 0.005555555555555556) t_1 = math.pow(b, 2.0) - math.pow(a, 2.0) tmp = 0 if t_1 <= -1e+297: tmp = 2.0 * ((b - a) * ((b + a) * math.sin(t_0))) elif t_1 <= 4e+250: tmp = ((2.0 * t_1) * math.sin((math.pi * (angle / 180.0)))) * math.cos(t_0) else: tmp = ((b - a) * ((b + a) * angle)) * (math.pi * 0.011111111111111112) return tmp
function code(a, b, angle) t_0 = Float64(angle * Float64(pi * 0.005555555555555556)) t_1 = Float64((b ^ 2.0) - (a ^ 2.0)) tmp = 0.0 if (t_1 <= -1e+297) tmp = Float64(2.0 * Float64(Float64(b - a) * Float64(Float64(b + a) * sin(t_0)))); elseif (t_1 <= 4e+250) tmp = Float64(Float64(Float64(2.0 * t_1) * sin(Float64(pi * Float64(angle / 180.0)))) * cos(t_0)); else tmp = Float64(Float64(Float64(b - a) * Float64(Float64(b + a) * angle)) * Float64(pi * 0.011111111111111112)); end return tmp end
function tmp_2 = code(a, b, angle) t_0 = angle * (pi * 0.005555555555555556); t_1 = (b ^ 2.0) - (a ^ 2.0); tmp = 0.0; if (t_1 <= -1e+297) tmp = 2.0 * ((b - a) * ((b + a) * sin(t_0))); elseif (t_1 <= 4e+250) tmp = ((2.0 * t_1) * sin((pi * (angle / 180.0)))) * cos(t_0); else tmp = ((b - a) * ((b + a) * angle)) * (pi * 0.011111111111111112); end tmp_2 = tmp; end
code[a_, b_, angle_] := Block[{t$95$0 = N[(angle * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+297], N[(2.0 * N[(N[(b - a), $MachinePrecision] * N[(N[(b + a), $MachinePrecision] * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 4e+250], N[(N[(N[(2.0 * t$95$1), $MachinePrecision] * N[Sin[N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], N[(N[(N[(b - a), $MachinePrecision] * N[(N[(b + a), $MachinePrecision] * angle), $MachinePrecision]), $MachinePrecision] * N[(Pi * 0.011111111111111112), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := angle \cdot \left(\pi \cdot 0.005555555555555556\right)\\
t_1 := {b}^{2} - {a}^{2}\\
\mathbf{if}\;t_1 \leq -1 \cdot 10^{+297}:\\
\;\;\;\;2 \cdot \left(\left(b - a\right) \cdot \left(\left(b + a\right) \cdot \sin t_0\right)\right)\\
\mathbf{elif}\;t_1 \leq 4 \cdot 10^{+250}:\\
\;\;\;\;\left(\left(2 \cdot t_1\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \cos t_0\\
\mathbf{else}:\\
\;\;\;\;\left(\left(b - a\right) \cdot \left(\left(b + a\right) \cdot angle\right)\right) \cdot \left(\pi \cdot 0.011111111111111112\right)\\
\end{array}
\end{array}
if (-.f64 (pow.f64 b 2) (pow.f64 a 2)) < -1e297Initial program 53.6%
add-cube-cbrt53.6%
pow353.6%
unpow253.6%
unpow253.6%
Applied egg-rr53.6%
Taylor expanded in angle around 0 50.7%
add-sqr-sqrt27.6%
sqrt-unprod35.6%
pow235.6%
Applied egg-rr35.6%
Taylor expanded in angle around inf 49.4%
unpow249.4%
unpow249.4%
difference-of-squares49.4%
*-commutative49.4%
associate-*l*80.1%
+-commutative80.1%
*-commutative80.1%
associate-*l*80.1%
Simplified80.1%
if -1e297 < (-.f64 (pow.f64 b 2) (pow.f64 a 2)) < 3.9999999999999997e250Initial program 60.3%
Taylor expanded in angle around inf 59.5%
*-commutative59.5%
*-commutative59.5%
associate-*r*60.2%
*-commutative60.2%
associate-*l*60.0%
Simplified60.0%
if 3.9999999999999997e250 < (-.f64 (pow.f64 b 2) (pow.f64 a 2)) Initial program 48.3%
Taylor expanded in angle around 0 39.5%
associate-*r*39.5%
unpow239.5%
unpow239.5%
Simplified39.5%
pow139.5%
*-commutative39.5%
difference-of-squares48.3%
associate-*l*62.6%
Applied egg-rr62.6%
Taylor expanded in angle around 0 79.7%
Taylor expanded in angle around 0 65.4%
*-commutative65.4%
associate-*r*79.7%
*-commutative79.7%
associate-*l*79.7%
+-commutative79.7%
associate-*r*79.7%
associate-*l*79.7%
+-commutative79.7%
Simplified79.7%
Final simplification69.6%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (- (pow b 2.0) (pow a 2.0))) (t_1 (* PI (/ angle 180.0))))
(if (<= t_0 -1e+297)
(*
2.0
(* (- b a) (* (+ b a) (sin (* angle (* PI 0.005555555555555556))))))
(if (<= t_0 2e+285)
(* (cos t_1) (* (* 2.0 t_0) (sin t_1)))
(* (* (- b a) (* (+ b a) angle)) (* PI 0.011111111111111112))))))
double code(double a, double b, double angle) {
double t_0 = pow(b, 2.0) - pow(a, 2.0);
double t_1 = ((double) M_PI) * (angle / 180.0);
double tmp;
if (t_0 <= -1e+297) {
tmp = 2.0 * ((b - a) * ((b + a) * sin((angle * (((double) M_PI) * 0.005555555555555556)))));
} else if (t_0 <= 2e+285) {
tmp = cos(t_1) * ((2.0 * t_0) * sin(t_1));
} else {
tmp = ((b - a) * ((b + a) * angle)) * (((double) M_PI) * 0.011111111111111112);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double t_0 = Math.pow(b, 2.0) - Math.pow(a, 2.0);
double t_1 = Math.PI * (angle / 180.0);
double tmp;
if (t_0 <= -1e+297) {
tmp = 2.0 * ((b - a) * ((b + a) * Math.sin((angle * (Math.PI * 0.005555555555555556)))));
} else if (t_0 <= 2e+285) {
tmp = Math.cos(t_1) * ((2.0 * t_0) * Math.sin(t_1));
} else {
tmp = ((b - a) * ((b + a) * angle)) * (Math.PI * 0.011111111111111112);
}
return tmp;
}
def code(a, b, angle): t_0 = math.pow(b, 2.0) - math.pow(a, 2.0) t_1 = math.pi * (angle / 180.0) tmp = 0 if t_0 <= -1e+297: tmp = 2.0 * ((b - a) * ((b + a) * math.sin((angle * (math.pi * 0.005555555555555556))))) elif t_0 <= 2e+285: tmp = math.cos(t_1) * ((2.0 * t_0) * math.sin(t_1)) else: tmp = ((b - a) * ((b + a) * angle)) * (math.pi * 0.011111111111111112) return tmp
function code(a, b, angle) t_0 = Float64((b ^ 2.0) - (a ^ 2.0)) t_1 = Float64(pi * Float64(angle / 180.0)) tmp = 0.0 if (t_0 <= -1e+297) tmp = Float64(2.0 * Float64(Float64(b - a) * Float64(Float64(b + a) * sin(Float64(angle * Float64(pi * 0.005555555555555556)))))); elseif (t_0 <= 2e+285) tmp = Float64(cos(t_1) * Float64(Float64(2.0 * t_0) * sin(t_1))); else tmp = Float64(Float64(Float64(b - a) * Float64(Float64(b + a) * angle)) * Float64(pi * 0.011111111111111112)); end return tmp end
function tmp_2 = code(a, b, angle) t_0 = (b ^ 2.0) - (a ^ 2.0); t_1 = pi * (angle / 180.0); tmp = 0.0; if (t_0 <= -1e+297) tmp = 2.0 * ((b - a) * ((b + a) * sin((angle * (pi * 0.005555555555555556))))); elseif (t_0 <= 2e+285) tmp = cos(t_1) * ((2.0 * t_0) * sin(t_1)); else tmp = ((b - a) * ((b + a) * angle)) * (pi * 0.011111111111111112); end tmp_2 = tmp; end
code[a_, b_, angle_] := Block[{t$95$0 = N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -1e+297], N[(2.0 * N[(N[(b - a), $MachinePrecision] * N[(N[(b + a), $MachinePrecision] * N[Sin[N[(angle * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2e+285], N[(N[Cos[t$95$1], $MachinePrecision] * N[(N[(2.0 * t$95$0), $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(b - a), $MachinePrecision] * N[(N[(b + a), $MachinePrecision] * angle), $MachinePrecision]), $MachinePrecision] * N[(Pi * 0.011111111111111112), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {b}^{2} - {a}^{2}\\
t_1 := \pi \cdot \frac{angle}{180}\\
\mathbf{if}\;t_0 \leq -1 \cdot 10^{+297}:\\
\;\;\;\;2 \cdot \left(\left(b - a\right) \cdot \left(\left(b + a\right) \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)\right)\\
\mathbf{elif}\;t_0 \leq 2 \cdot 10^{+285}:\\
\;\;\;\;\cos t_1 \cdot \left(\left(2 \cdot t_0\right) \cdot \sin t_1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(b - a\right) \cdot \left(\left(b + a\right) \cdot angle\right)\right) \cdot \left(\pi \cdot 0.011111111111111112\right)\\
\end{array}
\end{array}
if (-.f64 (pow.f64 b 2) (pow.f64 a 2)) < -1e297Initial program 53.6%
add-cube-cbrt53.6%
pow353.6%
unpow253.6%
unpow253.6%
Applied egg-rr53.6%
Taylor expanded in angle around 0 50.7%
add-sqr-sqrt27.6%
sqrt-unprod35.6%
pow235.6%
Applied egg-rr35.6%
Taylor expanded in angle around inf 49.4%
unpow249.4%
unpow249.4%
difference-of-squares49.4%
*-commutative49.4%
associate-*l*80.1%
+-commutative80.1%
*-commutative80.1%
associate-*l*80.1%
Simplified80.1%
if -1e297 < (-.f64 (pow.f64 b 2) (pow.f64 a 2)) < 2e285Initial program 60.4%
if 2e285 < (-.f64 (pow.f64 b 2) (pow.f64 a 2)) Initial program 46.9%
Taylor expanded in angle around 0 37.6%
associate-*r*37.6%
unpow237.6%
unpow237.6%
Simplified37.6%
pow137.6%
*-commutative37.6%
difference-of-squares47.2%
associate-*l*62.9%
Applied egg-rr62.9%
Taylor expanded in angle around 0 81.4%
Taylor expanded in angle around 0 65.7%
*-commutative65.7%
associate-*r*81.4%
*-commutative81.4%
associate-*l*81.4%
+-commutative81.4%
associate-*r*81.4%
associate-*l*81.4%
+-commutative81.4%
Simplified81.4%
Final simplification69.8%
(FPCore (a b angle)
:precision binary64
(if (<= (/ angle 180.0) 1e-10)
(* (* (- b a) (* (+ b a) angle)) (* PI 0.011111111111111112))
(*
(cos (* PI (/ angle 180.0)))
(*
(* 2.0 (pow (cbrt (- (* b b) (* a a))) 3.0))
(sin (/ PI (/ 180.0 angle)))))))
double code(double a, double b, double angle) {
double tmp;
if ((angle / 180.0) <= 1e-10) {
tmp = ((b - a) * ((b + a) * angle)) * (((double) M_PI) * 0.011111111111111112);
} else {
tmp = cos((((double) M_PI) * (angle / 180.0))) * ((2.0 * pow(cbrt(((b * b) - (a * a))), 3.0)) * sin((((double) M_PI) / (180.0 / angle))));
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if ((angle / 180.0) <= 1e-10) {
tmp = ((b - a) * ((b + a) * angle)) * (Math.PI * 0.011111111111111112);
} else {
tmp = Math.cos((Math.PI * (angle / 180.0))) * ((2.0 * Math.pow(Math.cbrt(((b * b) - (a * a))), 3.0)) * Math.sin((Math.PI / (180.0 / angle))));
}
return tmp;
}
function code(a, b, angle) tmp = 0.0 if (Float64(angle / 180.0) <= 1e-10) tmp = Float64(Float64(Float64(b - a) * Float64(Float64(b + a) * angle)) * Float64(pi * 0.011111111111111112)); else tmp = Float64(cos(Float64(pi * Float64(angle / 180.0))) * Float64(Float64(2.0 * (cbrt(Float64(Float64(b * b) - Float64(a * a))) ^ 3.0)) * sin(Float64(pi / Float64(180.0 / angle))))); end return tmp end
code[a_, b_, angle_] := If[LessEqual[N[(angle / 180.0), $MachinePrecision], 1e-10], N[(N[(N[(b - a), $MachinePrecision] * N[(N[(b + a), $MachinePrecision] * angle), $MachinePrecision]), $MachinePrecision] * N[(Pi * 0.011111111111111112), $MachinePrecision]), $MachinePrecision], N[(N[Cos[N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(2.0 * N[Power[N[Power[N[(N[(b * b), $MachinePrecision] - N[(a * a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision] * N[Sin[N[(Pi / N[(180.0 / angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{angle}{180} \leq 10^{-10}:\\
\;\;\;\;\left(\left(b - a\right) \cdot \left(\left(b + a\right) \cdot angle\right)\right) \cdot \left(\pi \cdot 0.011111111111111112\right)\\
\mathbf{else}:\\
\;\;\;\;\cos \left(\pi \cdot \frac{angle}{180}\right) \cdot \left(\left(2 \cdot {\left(\sqrt[3]{b \cdot b - a \cdot a}\right)}^{3}\right) \cdot \sin \left(\frac{\pi}{\frac{180}{angle}}\right)\right)\\
\end{array}
\end{array}
if (/.f64 angle 180) < 1.00000000000000004e-10Initial program 61.9%
Taylor expanded in angle around 0 57.5%
associate-*r*57.6%
unpow257.6%
unpow257.6%
Simplified57.6%
pow157.6%
*-commutative57.6%
difference-of-squares60.0%
associate-*l*74.9%
Applied egg-rr74.9%
Taylor expanded in angle around 0 80.5%
Taylor expanded in angle around 0 65.6%
*-commutative65.6%
associate-*r*80.5%
*-commutative80.5%
associate-*l*80.5%
+-commutative80.5%
associate-*r*80.5%
associate-*l*80.6%
+-commutative80.6%
Simplified80.6%
if 1.00000000000000004e-10 < (/.f64 angle 180) Initial program 42.5%
add-cube-cbrt42.4%
pow342.5%
unpow242.5%
unpow242.5%
Applied egg-rr42.5%
clear-num41.6%
un-div-inv45.6%
Applied egg-rr45.6%
Final simplification69.6%
(FPCore (a b angle) :precision binary64 (if (<= (pow b 2.0) 2e+285) (* 2.0 (* (- b a) (* (+ b a) (sin (* angle (* PI 0.005555555555555556)))))) (* (* (- b a) (* (+ b a) angle)) (* PI 0.011111111111111112))))
double code(double a, double b, double angle) {
double tmp;
if (pow(b, 2.0) <= 2e+285) {
tmp = 2.0 * ((b - a) * ((b + a) * sin((angle * (((double) M_PI) * 0.005555555555555556)))));
} else {
tmp = ((b - a) * ((b + a) * angle)) * (((double) M_PI) * 0.011111111111111112);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (Math.pow(b, 2.0) <= 2e+285) {
tmp = 2.0 * ((b - a) * ((b + a) * Math.sin((angle * (Math.PI * 0.005555555555555556)))));
} else {
tmp = ((b - a) * ((b + a) * angle)) * (Math.PI * 0.011111111111111112);
}
return tmp;
}
def code(a, b, angle): tmp = 0 if math.pow(b, 2.0) <= 2e+285: tmp = 2.0 * ((b - a) * ((b + a) * math.sin((angle * (math.pi * 0.005555555555555556))))) else: tmp = ((b - a) * ((b + a) * angle)) * (math.pi * 0.011111111111111112) return tmp
function code(a, b, angle) tmp = 0.0 if ((b ^ 2.0) <= 2e+285) tmp = Float64(2.0 * Float64(Float64(b - a) * Float64(Float64(b + a) * sin(Float64(angle * Float64(pi * 0.005555555555555556)))))); else tmp = Float64(Float64(Float64(b - a) * Float64(Float64(b + a) * angle)) * Float64(pi * 0.011111111111111112)); end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if ((b ^ 2.0) <= 2e+285) tmp = 2.0 * ((b - a) * ((b + a) * sin((angle * (pi * 0.005555555555555556))))); else tmp = ((b - a) * ((b + a) * angle)) * (pi * 0.011111111111111112); end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[N[Power[b, 2.0], $MachinePrecision], 2e+285], N[(2.0 * N[(N[(b - a), $MachinePrecision] * N[(N[(b + a), $MachinePrecision] * N[Sin[N[(angle * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(b - a), $MachinePrecision] * N[(N[(b + a), $MachinePrecision] * angle), $MachinePrecision]), $MachinePrecision] * N[(Pi * 0.011111111111111112), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{b}^{2} \leq 2 \cdot 10^{+285}:\\
\;\;\;\;2 \cdot \left(\left(b - a\right) \cdot \left(\left(b + a\right) \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(b - a\right) \cdot \left(\left(b + a\right) \cdot angle\right)\right) \cdot \left(\pi \cdot 0.011111111111111112\right)\\
\end{array}
\end{array}
if (pow.f64 b 2) < 2e285Initial program 58.3%
add-cube-cbrt58.0%
pow358.0%
unpow258.0%
unpow258.0%
Applied egg-rr58.0%
Taylor expanded in angle around 0 54.6%
add-sqr-sqrt35.0%
sqrt-unprod35.5%
pow235.5%
Applied egg-rr35.7%
Taylor expanded in angle around inf 54.8%
unpow254.8%
unpow254.8%
difference-of-squares54.8%
*-commutative54.8%
associate-*l*64.1%
+-commutative64.1%
*-commutative64.1%
associate-*l*64.0%
Simplified64.0%
if 2e285 < (pow.f64 b 2) Initial program 47.1%
Taylor expanded in angle around 0 36.4%
associate-*r*36.4%
unpow236.4%
unpow236.4%
Simplified36.4%
pow136.4%
*-commutative36.4%
difference-of-squares45.7%
associate-*l*62.4%
Applied egg-rr62.4%
Taylor expanded in angle around 0 82.1%
Taylor expanded in angle around 0 65.3%
*-commutative65.3%
associate-*r*82.1%
*-commutative82.1%
associate-*l*82.1%
+-commutative82.1%
associate-*r*82.1%
associate-*l*82.1%
+-commutative82.1%
Simplified82.1%
Final simplification68.0%
(FPCore (a b angle) :precision binary64 (if (<= angle 2.1e+99) (* (* (- b a) (* (+ b a) angle)) (* PI 0.011111111111111112)) (* (sin (* PI (* angle 0.005555555555555556))) (* (* a a) -2.0))))
double code(double a, double b, double angle) {
double tmp;
if (angle <= 2.1e+99) {
tmp = ((b - a) * ((b + a) * angle)) * (((double) M_PI) * 0.011111111111111112);
} else {
tmp = sin((((double) M_PI) * (angle * 0.005555555555555556))) * ((a * a) * -2.0);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (angle <= 2.1e+99) {
tmp = ((b - a) * ((b + a) * angle)) * (Math.PI * 0.011111111111111112);
} else {
tmp = Math.sin((Math.PI * (angle * 0.005555555555555556))) * ((a * a) * -2.0);
}
return tmp;
}
def code(a, b, angle): tmp = 0 if angle <= 2.1e+99: tmp = ((b - a) * ((b + a) * angle)) * (math.pi * 0.011111111111111112) else: tmp = math.sin((math.pi * (angle * 0.005555555555555556))) * ((a * a) * -2.0) return tmp
function code(a, b, angle) tmp = 0.0 if (angle <= 2.1e+99) tmp = Float64(Float64(Float64(b - a) * Float64(Float64(b + a) * angle)) * Float64(pi * 0.011111111111111112)); else tmp = Float64(sin(Float64(pi * Float64(angle * 0.005555555555555556))) * Float64(Float64(a * a) * -2.0)); end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (angle <= 2.1e+99) tmp = ((b - a) * ((b + a) * angle)) * (pi * 0.011111111111111112); else tmp = sin((pi * (angle * 0.005555555555555556))) * ((a * a) * -2.0); end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[angle, 2.1e+99], N[(N[(N[(b - a), $MachinePrecision] * N[(N[(b + a), $MachinePrecision] * angle), $MachinePrecision]), $MachinePrecision] * N[(Pi * 0.011111111111111112), $MachinePrecision]), $MachinePrecision], N[(N[Sin[N[(Pi * N[(angle * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(a * a), $MachinePrecision] * -2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;angle \leq 2.1 \cdot 10^{+99}:\\
\;\;\;\;\left(\left(b - a\right) \cdot \left(\left(b + a\right) \cdot angle\right)\right) \cdot \left(\pi \cdot 0.011111111111111112\right)\\
\mathbf{else}:\\
\;\;\;\;\sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right) \cdot \left(\left(a \cdot a\right) \cdot -2\right)\\
\end{array}
\end{array}
if angle < 2.1000000000000001e99Initial program 58.7%
Taylor expanded in angle around 0 51.1%
associate-*r*51.2%
unpow251.2%
unpow251.2%
Simplified51.2%
pow151.2%
*-commutative51.2%
difference-of-squares53.2%
associate-*l*65.6%
Applied egg-rr65.6%
Taylor expanded in angle around 0 72.9%
Taylor expanded in angle around 0 60.4%
*-commutative60.4%
associate-*r*72.9%
*-commutative72.9%
associate-*l*72.9%
+-commutative72.9%
associate-*r*72.9%
associate-*l*73.0%
+-commutative73.0%
Simplified73.0%
if 2.1000000000000001e99 < angle Initial program 42.9%
add-cube-cbrt42.9%
pow342.9%
unpow242.9%
unpow242.9%
Applied egg-rr42.9%
Taylor expanded in angle around 0 43.1%
Taylor expanded in b around 0 31.3%
unpow231.3%
associate-*r*31.3%
associate-*r*32.0%
*-commutative32.0%
associate-*r*29.5%
*-commutative29.5%
associate-*r*32.0%
*-commutative32.0%
associate-*r*31.3%
*-commutative31.3%
*-commutative31.3%
associate-*l*32.0%
Simplified32.0%
Final simplification65.6%
(FPCore (a b angle) :precision binary64 (if (<= angle 5e+87) (* (* (- b a) (* (+ b a) angle)) (* PI 0.011111111111111112)) (* 0.011111111111111112 (* angle (* (- b a) (* (+ b a) PI))))))
double code(double a, double b, double angle) {
double tmp;
if (angle <= 5e+87) {
tmp = ((b - a) * ((b + a) * angle)) * (((double) M_PI) * 0.011111111111111112);
} else {
tmp = 0.011111111111111112 * (angle * ((b - a) * ((b + a) * ((double) M_PI))));
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (angle <= 5e+87) {
tmp = ((b - a) * ((b + a) * angle)) * (Math.PI * 0.011111111111111112);
} else {
tmp = 0.011111111111111112 * (angle * ((b - a) * ((b + a) * Math.PI)));
}
return tmp;
}
def code(a, b, angle): tmp = 0 if angle <= 5e+87: tmp = ((b - a) * ((b + a) * angle)) * (math.pi * 0.011111111111111112) else: tmp = 0.011111111111111112 * (angle * ((b - a) * ((b + a) * math.pi))) return tmp
function code(a, b, angle) tmp = 0.0 if (angle <= 5e+87) tmp = Float64(Float64(Float64(b - a) * Float64(Float64(b + a) * angle)) * Float64(pi * 0.011111111111111112)); else tmp = Float64(0.011111111111111112 * Float64(angle * Float64(Float64(b - a) * Float64(Float64(b + a) * pi)))); end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (angle <= 5e+87) tmp = ((b - a) * ((b + a) * angle)) * (pi * 0.011111111111111112); else tmp = 0.011111111111111112 * (angle * ((b - a) * ((b + a) * pi))); end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[angle, 5e+87], N[(N[(N[(b - a), $MachinePrecision] * N[(N[(b + a), $MachinePrecision] * angle), $MachinePrecision]), $MachinePrecision] * N[(Pi * 0.011111111111111112), $MachinePrecision]), $MachinePrecision], N[(0.011111111111111112 * N[(angle * N[(N[(b - a), $MachinePrecision] * N[(N[(b + a), $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;angle \leq 5 \cdot 10^{+87}:\\
\;\;\;\;\left(\left(b - a\right) \cdot \left(\left(b + a\right) \cdot angle\right)\right) \cdot \left(\pi \cdot 0.011111111111111112\right)\\
\mathbf{else}:\\
\;\;\;\;0.011111111111111112 \cdot \left(angle \cdot \left(\left(b - a\right) \cdot \left(\left(b + a\right) \cdot \pi\right)\right)\right)\\
\end{array}
\end{array}
if angle < 4.9999999999999998e87Initial program 59.2%
Taylor expanded in angle around 0 51.6%
associate-*r*51.6%
unpow251.6%
unpow251.6%
Simplified51.6%
pow151.6%
*-commutative51.6%
difference-of-squares53.7%
associate-*l*66.4%
Applied egg-rr66.4%
Taylor expanded in angle around 0 73.3%
Taylor expanded in angle around 0 60.6%
*-commutative60.6%
associate-*r*73.3%
*-commutative73.3%
associate-*l*73.3%
+-commutative73.3%
associate-*r*73.3%
associate-*l*73.4%
+-commutative73.4%
Simplified73.4%
if 4.9999999999999998e87 < angle Initial program 42.0%
Taylor expanded in angle around 0 29.3%
associate-*r*29.3%
unpow229.3%
unpow229.3%
Simplified29.3%
pow129.3%
*-commutative29.3%
difference-of-squares31.3%
associate-*l*21.8%
Applied egg-rr21.8%
Taylor expanded in angle around 0 21.9%
Taylor expanded in angle around 0 31.4%
Final simplification65.2%
(FPCore (a b angle) :precision binary64 (if (or (<= b -9e-17) (not (<= b 1.25e+100))) (* 0.011111111111111112 (* PI (* angle (* b b)))) (* -0.011111111111111112 (* PI (* angle (* a a))))))
double code(double a, double b, double angle) {
double tmp;
if ((b <= -9e-17) || !(b <= 1.25e+100)) {
tmp = 0.011111111111111112 * (((double) M_PI) * (angle * (b * b)));
} else {
tmp = -0.011111111111111112 * (((double) M_PI) * (angle * (a * a)));
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if ((b <= -9e-17) || !(b <= 1.25e+100)) {
tmp = 0.011111111111111112 * (Math.PI * (angle * (b * b)));
} else {
tmp = -0.011111111111111112 * (Math.PI * (angle * (a * a)));
}
return tmp;
}
def code(a, b, angle): tmp = 0 if (b <= -9e-17) or not (b <= 1.25e+100): tmp = 0.011111111111111112 * (math.pi * (angle * (b * b))) else: tmp = -0.011111111111111112 * (math.pi * (angle * (a * a))) return tmp
function code(a, b, angle) tmp = 0.0 if ((b <= -9e-17) || !(b <= 1.25e+100)) tmp = Float64(0.011111111111111112 * Float64(pi * Float64(angle * Float64(b * b)))); else tmp = Float64(-0.011111111111111112 * Float64(pi * Float64(angle * Float64(a * a)))); end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if ((b <= -9e-17) || ~((b <= 1.25e+100))) tmp = 0.011111111111111112 * (pi * (angle * (b * b))); else tmp = -0.011111111111111112 * (pi * (angle * (a * a))); end tmp_2 = tmp; end
code[a_, b_, angle_] := If[Or[LessEqual[b, -9e-17], N[Not[LessEqual[b, 1.25e+100]], $MachinePrecision]], N[(0.011111111111111112 * N[(Pi * N[(angle * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.011111111111111112 * N[(Pi * N[(angle * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -9 \cdot 10^{-17} \lor \neg \left(b \leq 1.25 \cdot 10^{+100}\right):\\
\;\;\;\;0.011111111111111112 \cdot \left(\pi \cdot \left(angle \cdot \left(b \cdot b\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-0.011111111111111112 \cdot \left(\pi \cdot \left(angle \cdot \left(a \cdot a\right)\right)\right)\\
\end{array}
\end{array}
if b < -8.99999999999999957e-17 or 1.25e100 < b Initial program 50.3%
Taylor expanded in angle around 0 39.6%
associate-*r*39.6%
unpow239.6%
unpow239.6%
Simplified39.6%
Taylor expanded in angle around 0 48.7%
Taylor expanded in b around inf 45.0%
unpow245.0%
Simplified45.0%
if -8.99999999999999957e-17 < b < 1.25e100Initial program 60.1%
Taylor expanded in angle around 0 53.1%
associate-*r*53.2%
unpow253.2%
unpow253.2%
Simplified53.2%
pow153.2%
*-commutative53.2%
difference-of-squares53.2%
associate-*l*58.9%
Applied egg-rr58.9%
Taylor expanded in angle around 0 60.4%
Taylor expanded in b around 0 51.4%
associate-*r*51.4%
unpow251.4%
Simplified51.4%
Final simplification48.6%
(FPCore (a b angle) :precision binary64 (if (or (<= b -1.7e-16) (not (<= b 1.15e+100))) (* 0.011111111111111112 (* PI (* b (* b angle)))) (* -0.011111111111111112 (* PI (* angle (* a a))))))
double code(double a, double b, double angle) {
double tmp;
if ((b <= -1.7e-16) || !(b <= 1.15e+100)) {
tmp = 0.011111111111111112 * (((double) M_PI) * (b * (b * angle)));
} else {
tmp = -0.011111111111111112 * (((double) M_PI) * (angle * (a * a)));
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if ((b <= -1.7e-16) || !(b <= 1.15e+100)) {
tmp = 0.011111111111111112 * (Math.PI * (b * (b * angle)));
} else {
tmp = -0.011111111111111112 * (Math.PI * (angle * (a * a)));
}
return tmp;
}
def code(a, b, angle): tmp = 0 if (b <= -1.7e-16) or not (b <= 1.15e+100): tmp = 0.011111111111111112 * (math.pi * (b * (b * angle))) else: tmp = -0.011111111111111112 * (math.pi * (angle * (a * a))) return tmp
function code(a, b, angle) tmp = 0.0 if ((b <= -1.7e-16) || !(b <= 1.15e+100)) tmp = Float64(0.011111111111111112 * Float64(pi * Float64(b * Float64(b * angle)))); else tmp = Float64(-0.011111111111111112 * Float64(pi * Float64(angle * Float64(a * a)))); end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if ((b <= -1.7e-16) || ~((b <= 1.15e+100))) tmp = 0.011111111111111112 * (pi * (b * (b * angle))); else tmp = -0.011111111111111112 * (pi * (angle * (a * a))); end tmp_2 = tmp; end
code[a_, b_, angle_] := If[Or[LessEqual[b, -1.7e-16], N[Not[LessEqual[b, 1.15e+100]], $MachinePrecision]], N[(0.011111111111111112 * N[(Pi * N[(b * N[(b * angle), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.011111111111111112 * N[(Pi * N[(angle * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.7 \cdot 10^{-16} \lor \neg \left(b \leq 1.15 \cdot 10^{+100}\right):\\
\;\;\;\;0.011111111111111112 \cdot \left(\pi \cdot \left(b \cdot \left(b \cdot angle\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-0.011111111111111112 \cdot \left(\pi \cdot \left(angle \cdot \left(a \cdot a\right)\right)\right)\\
\end{array}
\end{array}
if b < -1.7e-16 or 1.14999999999999995e100 < b Initial program 50.3%
Taylor expanded in angle around 0 39.6%
associate-*r*39.6%
unpow239.6%
unpow239.6%
Simplified39.6%
Taylor expanded in angle around 0 48.7%
Taylor expanded in b around inf 45.0%
unpow245.0%
*-commutative45.0%
associate-*l*50.9%
Simplified50.9%
if -1.7e-16 < b < 1.14999999999999995e100Initial program 60.1%
Taylor expanded in angle around 0 53.1%
associate-*r*53.2%
unpow253.2%
unpow253.2%
Simplified53.2%
pow153.2%
*-commutative53.2%
difference-of-squares53.2%
associate-*l*58.9%
Applied egg-rr58.9%
Taylor expanded in angle around 0 60.4%
Taylor expanded in b around 0 51.4%
associate-*r*51.4%
unpow251.4%
Simplified51.4%
Final simplification51.2%
(FPCore (a b angle) :precision binary64 (* 0.011111111111111112 (* angle (* (- b a) (* (+ b a) PI)))))
double code(double a, double b, double angle) {
return 0.011111111111111112 * (angle * ((b - a) * ((b + a) * ((double) M_PI))));
}
public static double code(double a, double b, double angle) {
return 0.011111111111111112 * (angle * ((b - a) * ((b + a) * Math.PI)));
}
def code(a, b, angle): return 0.011111111111111112 * (angle * ((b - a) * ((b + a) * math.pi)))
function code(a, b, angle) return Float64(0.011111111111111112 * Float64(angle * Float64(Float64(b - a) * Float64(Float64(b + a) * pi)))) end
function tmp = code(a, b, angle) tmp = 0.011111111111111112 * (angle * ((b - a) * ((b + a) * pi))); end
code[a_, b_, angle_] := N[(0.011111111111111112 * N[(angle * N[(N[(b - a), $MachinePrecision] * N[(N[(b + a), $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.011111111111111112 \cdot \left(angle \cdot \left(\left(b - a\right) \cdot \left(\left(b + a\right) \cdot \pi\right)\right)\right)
\end{array}
Initial program 55.8%
Taylor expanded in angle around 0 47.2%
associate-*r*47.3%
unpow247.3%
unpow247.3%
Simplified47.3%
pow147.3%
*-commutative47.3%
difference-of-squares49.3%
associate-*l*57.7%
Applied egg-rr57.7%
Taylor expanded in angle around 0 63.3%
Taylor expanded in angle around 0 54.9%
Final simplification54.9%
(FPCore (a b angle) :precision binary64 (* -0.011111111111111112 (* PI (* angle (* a a)))))
double code(double a, double b, double angle) {
return -0.011111111111111112 * (((double) M_PI) * (angle * (a * a)));
}
public static double code(double a, double b, double angle) {
return -0.011111111111111112 * (Math.PI * (angle * (a * a)));
}
def code(a, b, angle): return -0.011111111111111112 * (math.pi * (angle * (a * a)))
function code(a, b, angle) return Float64(-0.011111111111111112 * Float64(pi * Float64(angle * Float64(a * a)))) end
function tmp = code(a, b, angle) tmp = -0.011111111111111112 * (pi * (angle * (a * a))); end
code[a_, b_, angle_] := N[(-0.011111111111111112 * N[(Pi * N[(angle * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-0.011111111111111112 \cdot \left(\pi \cdot \left(angle \cdot \left(a \cdot a\right)\right)\right)
\end{array}
Initial program 55.8%
Taylor expanded in angle around 0 47.2%
associate-*r*47.3%
unpow247.3%
unpow247.3%
Simplified47.3%
pow147.3%
*-commutative47.3%
difference-of-squares49.3%
associate-*l*57.7%
Applied egg-rr57.7%
Taylor expanded in angle around 0 63.3%
Taylor expanded in b around 0 34.7%
associate-*r*34.7%
unpow234.7%
Simplified34.7%
Final simplification34.7%
herbie shell --seed 2023187
(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)))))