
(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 12 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 (* 0.005555555555555556 (* angle PI))))
(if (<= (pow a 2.0) 5e-137)
(*
2.0
(*
(cos (* angle (/ PI -180.0)))
(pow (* (cbrt (sin t_0)) (pow (cbrt b) 2.0)) 3.0)))
(*
(*
(* 2.0 (* (- b a) (+ a b)))
(sin (* (pow (sqrt PI) 2.0) (/ angle 180.0))))
(cos t_0)))))
double code(double a, double b, double angle) {
double t_0 = 0.005555555555555556 * (angle * ((double) M_PI));
double tmp;
if (pow(a, 2.0) <= 5e-137) {
tmp = 2.0 * (cos((angle * (((double) M_PI) / -180.0))) * pow((cbrt(sin(t_0)) * pow(cbrt(b), 2.0)), 3.0));
} else {
tmp = ((2.0 * ((b - a) * (a + b))) * sin((pow(sqrt(((double) M_PI)), 2.0) * (angle / 180.0)))) * cos(t_0);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double t_0 = 0.005555555555555556 * (angle * Math.PI);
double tmp;
if (Math.pow(a, 2.0) <= 5e-137) {
tmp = 2.0 * (Math.cos((angle * (Math.PI / -180.0))) * Math.pow((Math.cbrt(Math.sin(t_0)) * Math.pow(Math.cbrt(b), 2.0)), 3.0));
} else {
tmp = ((2.0 * ((b - a) * (a + b))) * Math.sin((Math.pow(Math.sqrt(Math.PI), 2.0) * (angle / 180.0)))) * Math.cos(t_0);
}
return tmp;
}
function code(a, b, angle) t_0 = Float64(0.005555555555555556 * Float64(angle * pi)) tmp = 0.0 if ((a ^ 2.0) <= 5e-137) tmp = Float64(2.0 * Float64(cos(Float64(angle * Float64(pi / -180.0))) * (Float64(cbrt(sin(t_0)) * (cbrt(b) ^ 2.0)) ^ 3.0))); else tmp = Float64(Float64(Float64(2.0 * Float64(Float64(b - a) * Float64(a + b))) * sin(Float64((sqrt(pi) ^ 2.0) * Float64(angle / 180.0)))) * cos(t_0)); end return tmp end
code[a_, b_, angle_] := Block[{t$95$0 = N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[a, 2.0], $MachinePrecision], 5e-137], N[(2.0 * N[(N[Cos[N[(angle * N[(Pi / -180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Power[N[(N[Power[N[Sin[t$95$0], $MachinePrecision], 1/3], $MachinePrecision] * N[Power[N[Power[b, 1/3], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(2.0 * N[(N[(b - a), $MachinePrecision] * N[(a + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[N[(N[Power[N[Sqrt[Pi], $MachinePrecision], 2.0], $MachinePrecision] * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.005555555555555556 \cdot \left(angle \cdot \pi\right)\\
\mathbf{if}\;{a}^{2} \leq 5 \cdot 10^{-137}:\\
\;\;\;\;2 \cdot \left(\cos \left(angle \cdot \frac{\pi}{-180}\right) \cdot {\left(\sqrt[3]{\sin t\_0} \cdot {\left(\sqrt[3]{b}\right)}^{2}\right)}^{3}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(2 \cdot \left(\left(b - a\right) \cdot \left(a + b\right)\right)\right) \cdot \sin \left({\left(\sqrt{\pi}\right)}^{2} \cdot \frac{angle}{180}\right)\right) \cdot \cos t\_0\\
\end{array}
\end{array}
if (pow.f64 a 2) < 5.00000000000000001e-137Initial program 55.2%
Simplified54.4%
Taylor expanded in a around 0 54.5%
mul-1-neg54.5%
*-commutative54.5%
distribute-rgt-neg-in54.5%
*-commutative54.5%
*-commutative54.5%
associate-*l*52.6%
*-commutative52.6%
Simplified52.6%
add-cube-cbrt52.4%
pow352.4%
Applied egg-rr52.4%
cbrt-prod52.4%
unpow252.4%
cbrt-prod58.4%
pow258.4%
Applied egg-rr58.4%
*-commutative58.4%
*-commutative58.4%
associate-*r*60.4%
Simplified60.4%
if 5.00000000000000001e-137 < (pow.f64 a 2) Initial program 48.6%
unpow248.6%
unpow248.6%
difference-of-squares53.2%
Applied egg-rr53.2%
add-sqr-sqrt56.5%
pow256.5%
Applied egg-rr56.5%
Taylor expanded in angle around inf 57.3%
Final simplification58.5%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (cos (* PI (/ angle 180.0)))))
(if (<= (pow a 2.0) 1e+65)
(*
(*
(* 2.0 (* (- b a) (+ a b)))
(sin (* (/ angle 180.0) (cbrt (pow PI 3.0)))))
t_0)
(*
t_0
(*
(sin (* (pow (sqrt PI) 2.0) (/ angle 180.0)))
(* 2.0 (+ (* b (- b a)) (* a (- b a)))))))))
double code(double a, double b, double angle) {
double t_0 = cos((((double) M_PI) * (angle / 180.0)));
double tmp;
if (pow(a, 2.0) <= 1e+65) {
tmp = ((2.0 * ((b - a) * (a + b))) * sin(((angle / 180.0) * cbrt(pow(((double) M_PI), 3.0))))) * t_0;
} else {
tmp = t_0 * (sin((pow(sqrt(((double) M_PI)), 2.0) * (angle / 180.0))) * (2.0 * ((b * (b - a)) + (a * (b - a)))));
}
return tmp;
}
public static double code(double a, double b, double angle) {
double t_0 = Math.cos((Math.PI * (angle / 180.0)));
double tmp;
if (Math.pow(a, 2.0) <= 1e+65) {
tmp = ((2.0 * ((b - a) * (a + b))) * Math.sin(((angle / 180.0) * Math.cbrt(Math.pow(Math.PI, 3.0))))) * t_0;
} else {
tmp = t_0 * (Math.sin((Math.pow(Math.sqrt(Math.PI), 2.0) * (angle / 180.0))) * (2.0 * ((b * (b - a)) + (a * (b - a)))));
}
return tmp;
}
function code(a, b, angle) t_0 = cos(Float64(pi * Float64(angle / 180.0))) tmp = 0.0 if ((a ^ 2.0) <= 1e+65) tmp = Float64(Float64(Float64(2.0 * Float64(Float64(b - a) * Float64(a + b))) * sin(Float64(Float64(angle / 180.0) * cbrt((pi ^ 3.0))))) * t_0); else tmp = Float64(t_0 * Float64(sin(Float64((sqrt(pi) ^ 2.0) * Float64(angle / 180.0))) * Float64(2.0 * Float64(Float64(b * Float64(b - a)) + Float64(a * Float64(b - a)))))); end return tmp end
code[a_, b_, angle_] := Block[{t$95$0 = N[Cos[N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[Power[a, 2.0], $MachinePrecision], 1e+65], N[(N[(N[(2.0 * N[(N[(b - a), $MachinePrecision] * N[(a + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[N[(N[(angle / 180.0), $MachinePrecision] * N[Power[N[Power[Pi, 3.0], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(t$95$0 * N[(N[Sin[N[(N[Power[N[Sqrt[Pi], $MachinePrecision], 2.0], $MachinePrecision] * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(2.0 * N[(N[(b * N[(b - a), $MachinePrecision]), $MachinePrecision] + N[(a * N[(b - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\pi \cdot \frac{angle}{180}\right)\\
\mathbf{if}\;{a}^{2} \leq 10^{+65}:\\
\;\;\;\;\left(\left(2 \cdot \left(\left(b - a\right) \cdot \left(a + b\right)\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \sqrt[3]{{\pi}^{3}}\right)\right) \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \left(\sin \left({\left(\sqrt{\pi}\right)}^{2} \cdot \frac{angle}{180}\right) \cdot \left(2 \cdot \left(b \cdot \left(b - a\right) + a \cdot \left(b - a\right)\right)\right)\right)\\
\end{array}
\end{array}
if (pow.f64 a 2) < 9.9999999999999999e64Initial program 52.7%
unpow252.7%
unpow252.7%
difference-of-squares52.7%
Applied egg-rr52.7%
add-cbrt-cube52.9%
pow352.9%
Applied egg-rr55.2%
if 9.9999999999999999e64 < (pow.f64 a 2) Initial program 49.2%
unpow249.2%
unpow249.2%
difference-of-squares55.4%
Applied egg-rr55.4%
add-sqr-sqrt60.2%
pow260.2%
Applied egg-rr60.2%
*-commutative60.2%
distribute-lft-in50.4%
Applied egg-rr50.4%
Final simplification53.0%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* 2.0 (* (- b a) (+ a b)))) (t_1 (* PI (/ angle 180.0))))
(if (<= (pow a 2.0) 5e-168)
(* (cos t_1) (* t_0 (sin (* PI (* angle 0.005555555555555556)))))
(* (* t_0 (sin t_1)) (cos (* (/ angle 180.0) (cbrt (pow PI 3.0))))))))
double code(double a, double b, double angle) {
double t_0 = 2.0 * ((b - a) * (a + b));
double t_1 = ((double) M_PI) * (angle / 180.0);
double tmp;
if (pow(a, 2.0) <= 5e-168) {
tmp = cos(t_1) * (t_0 * sin((((double) M_PI) * (angle * 0.005555555555555556))));
} else {
tmp = (t_0 * sin(t_1)) * cos(((angle / 180.0) * cbrt(pow(((double) M_PI), 3.0))));
}
return tmp;
}
public static double code(double a, double b, double angle) {
double t_0 = 2.0 * ((b - a) * (a + b));
double t_1 = Math.PI * (angle / 180.0);
double tmp;
if (Math.pow(a, 2.0) <= 5e-168) {
tmp = Math.cos(t_1) * (t_0 * Math.sin((Math.PI * (angle * 0.005555555555555556))));
} else {
tmp = (t_0 * Math.sin(t_1)) * Math.cos(((angle / 180.0) * Math.cbrt(Math.pow(Math.PI, 3.0))));
}
return tmp;
}
function code(a, b, angle) t_0 = Float64(2.0 * Float64(Float64(b - a) * Float64(a + b))) t_1 = Float64(pi * Float64(angle / 180.0)) tmp = 0.0 if ((a ^ 2.0) <= 5e-168) tmp = Float64(cos(t_1) * Float64(t_0 * sin(Float64(pi * Float64(angle * 0.005555555555555556))))); else tmp = Float64(Float64(t_0 * sin(t_1)) * cos(Float64(Float64(angle / 180.0) * cbrt((pi ^ 3.0))))); end return tmp end
code[a_, b_, angle_] := Block[{t$95$0 = N[(2.0 * N[(N[(b - a), $MachinePrecision] * N[(a + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[a, 2.0], $MachinePrecision], 5e-168], N[(N[Cos[t$95$1], $MachinePrecision] * N[(t$95$0 * N[Sin[N[(Pi * N[(angle * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(N[(angle / 180.0), $MachinePrecision] * N[Power[N[Power[Pi, 3.0], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 2 \cdot \left(\left(b - a\right) \cdot \left(a + b\right)\right)\\
t_1 := \pi \cdot \frac{angle}{180}\\
\mathbf{if}\;{a}^{2} \leq 5 \cdot 10^{-168}:\\
\;\;\;\;\cos t\_1 \cdot \left(t\_0 \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_0 \cdot \sin t\_1\right) \cdot \cos \left(\frac{angle}{180} \cdot \sqrt[3]{{\pi}^{3}}\right)\\
\end{array}
\end{array}
if (pow.f64 a 2) < 5.00000000000000001e-168Initial program 57.3%
unpow257.3%
unpow257.3%
difference-of-squares57.3%
Applied egg-rr57.3%
Taylor expanded in angle around inf 58.2%
associate-*r*59.3%
*-commutative59.3%
Simplified59.3%
if 5.00000000000000001e-168 < (pow.f64 a 2) Initial program 47.8%
unpow247.8%
unpow247.8%
difference-of-squares52.1%
Applied egg-rr52.1%
add-cbrt-cube55.4%
pow355.4%
Applied egg-rr55.4%
Final simplification56.8%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* 2.0 (* (- b a) (+ a b)))))
(if (<= (pow a 2.0) 2e-116)
(*
(* t_0 (sin (* (/ angle 180.0) (cbrt (pow PI 3.0)))))
(cos (* PI (/ angle 180.0))))
(*
(* t_0 (sin (* (pow (sqrt PI) 2.0) (/ angle 180.0))))
(cos (* 0.005555555555555556 (* angle PI)))))))
double code(double a, double b, double angle) {
double t_0 = 2.0 * ((b - a) * (a + b));
double tmp;
if (pow(a, 2.0) <= 2e-116) {
tmp = (t_0 * sin(((angle / 180.0) * cbrt(pow(((double) M_PI), 3.0))))) * cos((((double) M_PI) * (angle / 180.0)));
} else {
tmp = (t_0 * sin((pow(sqrt(((double) M_PI)), 2.0) * (angle / 180.0)))) * cos((0.005555555555555556 * (angle * ((double) M_PI))));
}
return tmp;
}
public static double code(double a, double b, double angle) {
double t_0 = 2.0 * ((b - a) * (a + b));
double tmp;
if (Math.pow(a, 2.0) <= 2e-116) {
tmp = (t_0 * Math.sin(((angle / 180.0) * Math.cbrt(Math.pow(Math.PI, 3.0))))) * Math.cos((Math.PI * (angle / 180.0)));
} else {
tmp = (t_0 * Math.sin((Math.pow(Math.sqrt(Math.PI), 2.0) * (angle / 180.0)))) * Math.cos((0.005555555555555556 * (angle * Math.PI)));
}
return tmp;
}
function code(a, b, angle) t_0 = Float64(2.0 * Float64(Float64(b - a) * Float64(a + b))) tmp = 0.0 if ((a ^ 2.0) <= 2e-116) tmp = Float64(Float64(t_0 * sin(Float64(Float64(angle / 180.0) * cbrt((pi ^ 3.0))))) * cos(Float64(pi * Float64(angle / 180.0)))); else tmp = Float64(Float64(t_0 * sin(Float64((sqrt(pi) ^ 2.0) * Float64(angle / 180.0)))) * cos(Float64(0.005555555555555556 * Float64(angle * pi)))); end return tmp end
code[a_, b_, angle_] := Block[{t$95$0 = N[(2.0 * N[(N[(b - a), $MachinePrecision] * N[(a + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[a, 2.0], $MachinePrecision], 2e-116], N[(N[(t$95$0 * N[Sin[N[(N[(angle / 180.0), $MachinePrecision] * N[Power[N[Power[Pi, 3.0], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 * N[Sin[N[(N[Power[N[Sqrt[Pi], $MachinePrecision], 2.0], $MachinePrecision] * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 2 \cdot \left(\left(b - a\right) \cdot \left(a + b\right)\right)\\
\mathbf{if}\;{a}^{2} \leq 2 \cdot 10^{-116}:\\
\;\;\;\;\left(t\_0 \cdot \sin \left(\frac{angle}{180} \cdot \sqrt[3]{{\pi}^{3}}\right)\right) \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_0 \cdot \sin \left({\left(\sqrt{\pi}\right)}^{2} \cdot \frac{angle}{180}\right)\right) \cdot \cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\\
\end{array}
\end{array}
if (pow.f64 a 2) < 2e-116Initial program 54.7%
unpow254.7%
unpow254.7%
difference-of-squares54.7%
Applied egg-rr54.7%
add-cbrt-cube53.2%
pow353.2%
Applied egg-rr56.4%
if 2e-116 < (pow.f64 a 2) Initial program 48.7%
unpow248.7%
unpow248.7%
difference-of-squares53.4%
Applied egg-rr53.4%
add-sqr-sqrt57.1%
pow257.1%
Applied egg-rr57.1%
Taylor expanded in angle around inf 57.7%
Final simplification57.2%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (cos (* PI (/ angle 180.0)))) (t_1 (* 2.0 (* (- b a) (+ a b)))))
(if (<= (pow a 2.0) 1e+65)
(* (* t_1 (sin (* (/ angle 180.0) (cbrt (pow PI 3.0))))) t_0)
(* (* t_1 (sin (* (pow (sqrt PI) 2.0) (/ angle 180.0)))) t_0))))
double code(double a, double b, double angle) {
double t_0 = cos((((double) M_PI) * (angle / 180.0)));
double t_1 = 2.0 * ((b - a) * (a + b));
double tmp;
if (pow(a, 2.0) <= 1e+65) {
tmp = (t_1 * sin(((angle / 180.0) * cbrt(pow(((double) M_PI), 3.0))))) * t_0;
} else {
tmp = (t_1 * sin((pow(sqrt(((double) M_PI)), 2.0) * (angle / 180.0)))) * t_0;
}
return tmp;
}
public static double code(double a, double b, double angle) {
double t_0 = Math.cos((Math.PI * (angle / 180.0)));
double t_1 = 2.0 * ((b - a) * (a + b));
double tmp;
if (Math.pow(a, 2.0) <= 1e+65) {
tmp = (t_1 * Math.sin(((angle / 180.0) * Math.cbrt(Math.pow(Math.PI, 3.0))))) * t_0;
} else {
tmp = (t_1 * Math.sin((Math.pow(Math.sqrt(Math.PI), 2.0) * (angle / 180.0)))) * t_0;
}
return tmp;
}
function code(a, b, angle) t_0 = cos(Float64(pi * Float64(angle / 180.0))) t_1 = Float64(2.0 * Float64(Float64(b - a) * Float64(a + b))) tmp = 0.0 if ((a ^ 2.0) <= 1e+65) tmp = Float64(Float64(t_1 * sin(Float64(Float64(angle / 180.0) * cbrt((pi ^ 3.0))))) * t_0); else tmp = Float64(Float64(t_1 * sin(Float64((sqrt(pi) ^ 2.0) * Float64(angle / 180.0)))) * t_0); end return tmp end
code[a_, b_, angle_] := Block[{t$95$0 = N[Cos[N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(2.0 * N[(N[(b - a), $MachinePrecision] * N[(a + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[a, 2.0], $MachinePrecision], 1e+65], N[(N[(t$95$1 * N[Sin[N[(N[(angle / 180.0), $MachinePrecision] * N[Power[N[Power[Pi, 3.0], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[(t$95$1 * N[Sin[N[(N[Power[N[Sqrt[Pi], $MachinePrecision], 2.0], $MachinePrecision] * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\pi \cdot \frac{angle}{180}\right)\\
t_1 := 2 \cdot \left(\left(b - a\right) \cdot \left(a + b\right)\right)\\
\mathbf{if}\;{a}^{2} \leq 10^{+65}:\\
\;\;\;\;\left(t\_1 \cdot \sin \left(\frac{angle}{180} \cdot \sqrt[3]{{\pi}^{3}}\right)\right) \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;\left(t\_1 \cdot \sin \left({\left(\sqrt{\pi}\right)}^{2} \cdot \frac{angle}{180}\right)\right) \cdot t\_0\\
\end{array}
\end{array}
if (pow.f64 a 2) < 9.9999999999999999e64Initial program 52.7%
unpow252.7%
unpow252.7%
difference-of-squares52.7%
Applied egg-rr52.7%
add-cbrt-cube52.9%
pow352.9%
Applied egg-rr55.2%
if 9.9999999999999999e64 < (pow.f64 a 2) Initial program 49.2%
unpow249.2%
unpow249.2%
difference-of-squares55.4%
Applied egg-rr55.4%
add-sqr-sqrt60.2%
pow260.2%
Applied egg-rr60.2%
Final simplification57.4%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* angle (/ PI -180.0))) (t_1 (* (sin t_0) (* (+ a b) (- a b)))))
(if (<= (- (pow b 2.0) (pow a 2.0)) -4e+302)
(* 2.0 t_1)
(* 2.0 (* (cos t_0) t_1)))))
double code(double a, double b, double angle) {
double t_0 = angle * (((double) M_PI) / -180.0);
double t_1 = sin(t_0) * ((a + b) * (a - b));
double tmp;
if ((pow(b, 2.0) - pow(a, 2.0)) <= -4e+302) {
tmp = 2.0 * t_1;
} else {
tmp = 2.0 * (cos(t_0) * t_1);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double t_0 = angle * (Math.PI / -180.0);
double t_1 = Math.sin(t_0) * ((a + b) * (a - b));
double tmp;
if ((Math.pow(b, 2.0) - Math.pow(a, 2.0)) <= -4e+302) {
tmp = 2.0 * t_1;
} else {
tmp = 2.0 * (Math.cos(t_0) * t_1);
}
return tmp;
}
def code(a, b, angle): t_0 = angle * (math.pi / -180.0) t_1 = math.sin(t_0) * ((a + b) * (a - b)) tmp = 0 if (math.pow(b, 2.0) - math.pow(a, 2.0)) <= -4e+302: tmp = 2.0 * t_1 else: tmp = 2.0 * (math.cos(t_0) * t_1) return tmp
function code(a, b, angle) t_0 = Float64(angle * Float64(pi / -180.0)) t_1 = Float64(sin(t_0) * Float64(Float64(a + b) * Float64(a - b))) tmp = 0.0 if (Float64((b ^ 2.0) - (a ^ 2.0)) <= -4e+302) tmp = Float64(2.0 * t_1); else tmp = Float64(2.0 * Float64(cos(t_0) * t_1)); end return tmp end
function tmp_2 = code(a, b, angle) t_0 = angle * (pi / -180.0); t_1 = sin(t_0) * ((a + b) * (a - b)); tmp = 0.0; if (((b ^ 2.0) - (a ^ 2.0)) <= -4e+302) tmp = 2.0 * t_1; else tmp = 2.0 * (cos(t_0) * t_1); end tmp_2 = tmp; end
code[a_, b_, angle_] := Block[{t$95$0 = N[(angle * N[(Pi / -180.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sin[t$95$0], $MachinePrecision] * N[(N[(a + b), $MachinePrecision] * N[(a - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision], -4e+302], N[(2.0 * t$95$1), $MachinePrecision], N[(2.0 * N[(N[Cos[t$95$0], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := angle \cdot \frac{\pi}{-180}\\
t_1 := \sin t\_0 \cdot \left(\left(a + b\right) \cdot \left(a - b\right)\right)\\
\mathbf{if}\;{b}^{2} - {a}^{2} \leq -4 \cdot 10^{+302}:\\
\;\;\;\;2 \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\cos t\_0 \cdot t\_1\right)\\
\end{array}
\end{array}
if (-.f64 (pow.f64 b 2) (pow.f64 a 2)) < -4.0000000000000003e302Initial program 52.9%
Simplified47.8%
Taylor expanded in angle around 0 54.9%
unpow254.9%
unpow254.9%
difference-of-squares54.9%
Applied egg-rr54.9%
if -4.0000000000000003e302 < (-.f64 (pow.f64 b 2) (pow.f64 a 2)) Initial program 50.6%
Simplified50.6%
unpow248.2%
unpow248.2%
difference-of-squares51.4%
Applied egg-rr54.8%
Final simplification54.8%
(FPCore (a b angle)
:precision binary64
(if (<= (- (pow b 2.0) (pow a 2.0)) -1e+267)
(* 2.0 (* (sin (* angle (/ PI -180.0))) (* (+ a b) (- a b))))
(*
(cos (* PI (/ angle 180.0)))
(*
2.0
(* (* (- b a) (+ a b)) (sin (* angle (* PI 0.005555555555555556))))))))
double code(double a, double b, double angle) {
double tmp;
if ((pow(b, 2.0) - pow(a, 2.0)) <= -1e+267) {
tmp = 2.0 * (sin((angle * (((double) M_PI) / -180.0))) * ((a + b) * (a - b)));
} else {
tmp = cos((((double) M_PI) * (angle / 180.0))) * (2.0 * (((b - a) * (a + b)) * sin((angle * (((double) M_PI) * 0.005555555555555556)))));
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if ((Math.pow(b, 2.0) - Math.pow(a, 2.0)) <= -1e+267) {
tmp = 2.0 * (Math.sin((angle * (Math.PI / -180.0))) * ((a + b) * (a - b)));
} else {
tmp = Math.cos((Math.PI * (angle / 180.0))) * (2.0 * (((b - a) * (a + b)) * Math.sin((angle * (Math.PI * 0.005555555555555556)))));
}
return tmp;
}
def code(a, b, angle): tmp = 0 if (math.pow(b, 2.0) - math.pow(a, 2.0)) <= -1e+267: tmp = 2.0 * (math.sin((angle * (math.pi / -180.0))) * ((a + b) * (a - b))) else: tmp = math.cos((math.pi * (angle / 180.0))) * (2.0 * (((b - a) * (a + b)) * math.sin((angle * (math.pi * 0.005555555555555556))))) return tmp
function code(a, b, angle) tmp = 0.0 if (Float64((b ^ 2.0) - (a ^ 2.0)) <= -1e+267) tmp = Float64(2.0 * Float64(sin(Float64(angle * Float64(pi / -180.0))) * Float64(Float64(a + b) * Float64(a - b)))); else tmp = Float64(cos(Float64(pi * Float64(angle / 180.0))) * Float64(2.0 * Float64(Float64(Float64(b - a) * Float64(a + b)) * sin(Float64(angle * Float64(pi * 0.005555555555555556)))))); end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (((b ^ 2.0) - (a ^ 2.0)) <= -1e+267) tmp = 2.0 * (sin((angle * (pi / -180.0))) * ((a + b) * (a - b))); else tmp = cos((pi * (angle / 180.0))) * (2.0 * (((b - a) * (a + b)) * sin((angle * (pi * 0.005555555555555556))))); end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision], -1e+267], N[(2.0 * N[(N[Sin[N[(angle * N[(Pi / -180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(a + b), $MachinePrecision] * N[(a - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Cos[N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(2.0 * N[(N[(N[(b - a), $MachinePrecision] * N[(a + b), $MachinePrecision]), $MachinePrecision] * N[Sin[N[(angle * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{b}^{2} - {a}^{2} \leq -1 \cdot 10^{+267}:\\
\;\;\;\;2 \cdot \left(\sin \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\left(a + b\right) \cdot \left(a - b\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\cos \left(\pi \cdot \frac{angle}{180}\right) \cdot \left(2 \cdot \left(\left(\left(b - a\right) \cdot \left(a + b\right)\right) \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)\right)\\
\end{array}
\end{array}
if (-.f64 (pow.f64 b 2) (pow.f64 a 2)) < -9.9999999999999997e266Initial program 51.3%
Simplified47.5%
Taylor expanded in angle around 0 53.5%
unpow253.5%
unpow253.5%
difference-of-squares53.5%
Applied egg-rr53.5%
if -9.9999999999999997e266 < (-.f64 (pow.f64 b 2) (pow.f64 a 2)) Initial program 51.1%
unpow251.1%
unpow251.1%
difference-of-squares54.9%
Applied egg-rr54.9%
add-sqr-sqrt56.7%
pow256.7%
Applied egg-rr56.7%
*-commutative56.7%
distribute-lft-in52.4%
Applied egg-rr52.4%
Taylor expanded in angle around inf 53.5%
associate-*r*53.2%
*-commutative53.2%
associate-*l*54.0%
distribute-rgt-out56.1%
Simplified56.1%
Final simplification55.5%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* (- b a) (+ a b))))
(if (<= (pow b 2.0) 5e+166)
(*
2.0
(* t_0 (* (sin (* PI (/ angle 180.0))) (cos (/ (* angle PI) -180.0)))))
(* 2.0 (* 0.005555555555555556 (* angle (* PI t_0)))))))
double code(double a, double b, double angle) {
double t_0 = (b - a) * (a + b);
double tmp;
if (pow(b, 2.0) <= 5e+166) {
tmp = 2.0 * (t_0 * (sin((((double) M_PI) * (angle / 180.0))) * cos(((angle * ((double) M_PI)) / -180.0))));
} else {
tmp = 2.0 * (0.005555555555555556 * (angle * (((double) M_PI) * t_0)));
}
return tmp;
}
public static double code(double a, double b, double angle) {
double t_0 = (b - a) * (a + b);
double tmp;
if (Math.pow(b, 2.0) <= 5e+166) {
tmp = 2.0 * (t_0 * (Math.sin((Math.PI * (angle / 180.0))) * Math.cos(((angle * Math.PI) / -180.0))));
} else {
tmp = 2.0 * (0.005555555555555556 * (angle * (Math.PI * t_0)));
}
return tmp;
}
def code(a, b, angle): t_0 = (b - a) * (a + b) tmp = 0 if math.pow(b, 2.0) <= 5e+166: tmp = 2.0 * (t_0 * (math.sin((math.pi * (angle / 180.0))) * math.cos(((angle * math.pi) / -180.0)))) else: tmp = 2.0 * (0.005555555555555556 * (angle * (math.pi * t_0))) return tmp
function code(a, b, angle) t_0 = Float64(Float64(b - a) * Float64(a + b)) tmp = 0.0 if ((b ^ 2.0) <= 5e+166) tmp = Float64(2.0 * Float64(t_0 * Float64(sin(Float64(pi * Float64(angle / 180.0))) * cos(Float64(Float64(angle * pi) / -180.0))))); else tmp = Float64(2.0 * Float64(0.005555555555555556 * Float64(angle * Float64(pi * t_0)))); end return tmp end
function tmp_2 = code(a, b, angle) t_0 = (b - a) * (a + b); tmp = 0.0; if ((b ^ 2.0) <= 5e+166) tmp = 2.0 * (t_0 * (sin((pi * (angle / 180.0))) * cos(((angle * pi) / -180.0)))); else tmp = 2.0 * (0.005555555555555556 * (angle * (pi * t_0))); end tmp_2 = tmp; end
code[a_, b_, angle_] := Block[{t$95$0 = N[(N[(b - a), $MachinePrecision] * N[(a + b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[b, 2.0], $MachinePrecision], 5e+166], N[(2.0 * N[(t$95$0 * N[(N[Sin[N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(N[(angle * Pi), $MachinePrecision] / -180.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(0.005555555555555556 * N[(angle * N[(Pi * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(b - a\right) \cdot \left(a + b\right)\\
\mathbf{if}\;{b}^{2} \leq 5 \cdot 10^{+166}:\\
\;\;\;\;2 \cdot \left(t\_0 \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \cos \left(\frac{angle \cdot \pi}{-180}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(0.005555555555555556 \cdot \left(angle \cdot \left(\pi \cdot t\_0\right)\right)\right)\\
\end{array}
\end{array}
if (pow.f64 b 2) < 5.0000000000000002e166Initial program 56.8%
Simplified57.3%
unpow256.8%
unpow256.8%
difference-of-squares56.8%
Applied egg-rr57.3%
if 5.0000000000000002e166 < (pow.f64 b 2) Initial program 40.0%
Simplified36.6%
Taylor expanded in angle around 0 41.5%
unpow240.0%
unpow240.0%
difference-of-squares48.4%
Applied egg-rr51.0%
Final simplification55.2%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* PI (/ angle 180.0))) (t_1 (* 2.0 (* (- b a) (+ a b)))))
(if (<= (pow b 2.0) 1e+47)
(* (* t_1 (sin t_0)) (cos (* angle (* PI 0.005555555555555556))))
(* (cos t_0) (* (sin (* 0.005555555555555556 (* angle PI))) t_1)))))
double code(double a, double b, double angle) {
double t_0 = ((double) M_PI) * (angle / 180.0);
double t_1 = 2.0 * ((b - a) * (a + b));
double tmp;
if (pow(b, 2.0) <= 1e+47) {
tmp = (t_1 * sin(t_0)) * cos((angle * (((double) M_PI) * 0.005555555555555556)));
} else {
tmp = cos(t_0) * (sin((0.005555555555555556 * (angle * ((double) M_PI)))) * t_1);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double t_0 = Math.PI * (angle / 180.0);
double t_1 = 2.0 * ((b - a) * (a + b));
double tmp;
if (Math.pow(b, 2.0) <= 1e+47) {
tmp = (t_1 * Math.sin(t_0)) * Math.cos((angle * (Math.PI * 0.005555555555555556)));
} else {
tmp = Math.cos(t_0) * (Math.sin((0.005555555555555556 * (angle * Math.PI))) * t_1);
}
return tmp;
}
def code(a, b, angle): t_0 = math.pi * (angle / 180.0) t_1 = 2.0 * ((b - a) * (a + b)) tmp = 0 if math.pow(b, 2.0) <= 1e+47: tmp = (t_1 * math.sin(t_0)) * math.cos((angle * (math.pi * 0.005555555555555556))) else: tmp = math.cos(t_0) * (math.sin((0.005555555555555556 * (angle * math.pi))) * t_1) return tmp
function code(a, b, angle) t_0 = Float64(pi * Float64(angle / 180.0)) t_1 = Float64(2.0 * Float64(Float64(b - a) * Float64(a + b))) tmp = 0.0 if ((b ^ 2.0) <= 1e+47) tmp = Float64(Float64(t_1 * sin(t_0)) * cos(Float64(angle * Float64(pi * 0.005555555555555556)))); else tmp = Float64(cos(t_0) * Float64(sin(Float64(0.005555555555555556 * Float64(angle * pi))) * t_1)); end return tmp end
function tmp_2 = code(a, b, angle) t_0 = pi * (angle / 180.0); t_1 = 2.0 * ((b - a) * (a + b)); tmp = 0.0; if ((b ^ 2.0) <= 1e+47) tmp = (t_1 * sin(t_0)) * cos((angle * (pi * 0.005555555555555556))); else tmp = cos(t_0) * (sin((0.005555555555555556 * (angle * pi))) * t_1); end tmp_2 = tmp; end
code[a_, b_, angle_] := Block[{t$95$0 = N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(2.0 * N[(N[(b - a), $MachinePrecision] * N[(a + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[b, 2.0], $MachinePrecision], 1e+47], N[(N[(t$95$1 * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(angle * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[t$95$0], $MachinePrecision] * N[(N[Sin[N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \pi \cdot \frac{angle}{180}\\
t_1 := 2 \cdot \left(\left(b - a\right) \cdot \left(a + b\right)\right)\\
\mathbf{if}\;{b}^{2} \leq 10^{+47}:\\
\;\;\;\;\left(t\_1 \cdot \sin t\_0\right) \cdot \cos \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\cos t\_0 \cdot \left(\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right) \cdot t\_1\right)\\
\end{array}
\end{array}
if (pow.f64 b 2) < 1e47Initial program 55.4%
unpow255.4%
unpow255.4%
difference-of-squares55.4%
Applied egg-rr55.4%
Taylor expanded in angle around inf 56.0%
*-commutative56.0%
associate-*l*56.4%
Simplified56.4%
if 1e47 < (pow.f64 b 2) Initial program 45.5%
unpow245.5%
unpow245.5%
difference-of-squares52.1%
Applied egg-rr52.1%
Taylor expanded in angle around inf 55.7%
Final simplification56.1%
(FPCore (a b angle) :precision binary64 (* (cos (* PI (/ angle 180.0))) (* (sin (* 0.005555555555555556 (* angle PI))) (* 2.0 (* (- b a) (+ a b))))))
double code(double a, double b, double angle) {
return cos((((double) M_PI) * (angle / 180.0))) * (sin((0.005555555555555556 * (angle * ((double) M_PI)))) * (2.0 * ((b - a) * (a + b))));
}
public static double code(double a, double b, double angle) {
return Math.cos((Math.PI * (angle / 180.0))) * (Math.sin((0.005555555555555556 * (angle * Math.PI))) * (2.0 * ((b - a) * (a + b))));
}
def code(a, b, angle): return math.cos((math.pi * (angle / 180.0))) * (math.sin((0.005555555555555556 * (angle * math.pi))) * (2.0 * ((b - a) * (a + b))))
function code(a, b, angle) return Float64(cos(Float64(pi * Float64(angle / 180.0))) * Float64(sin(Float64(0.005555555555555556 * Float64(angle * pi))) * Float64(2.0 * Float64(Float64(b - a) * Float64(a + b))))) end
function tmp = code(a, b, angle) tmp = cos((pi * (angle / 180.0))) * (sin((0.005555555555555556 * (angle * pi))) * (2.0 * ((b - a) * (a + b)))); end
code[a_, b_, angle_] := N[(N[Cos[N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sin[N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(2.0 * N[(N[(b - a), $MachinePrecision] * N[(a + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos \left(\pi \cdot \frac{angle}{180}\right) \cdot \left(\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right) \cdot \left(2 \cdot \left(\left(b - a\right) \cdot \left(a + b\right)\right)\right)\right)
\end{array}
Initial program 51.1%
unpow251.1%
unpow251.1%
difference-of-squares53.9%
Applied egg-rr53.9%
Taylor expanded in angle around inf 54.5%
Final simplification54.5%
(FPCore (a b angle) :precision binary64 (* 2.0 (* (sin (* angle (/ PI -180.0))) (* (+ a b) (- a b)))))
double code(double a, double b, double angle) {
return 2.0 * (sin((angle * (((double) M_PI) / -180.0))) * ((a + b) * (a - b)));
}
public static double code(double a, double b, double angle) {
return 2.0 * (Math.sin((angle * (Math.PI / -180.0))) * ((a + b) * (a - b)));
}
def code(a, b, angle): return 2.0 * (math.sin((angle * (math.pi / -180.0))) * ((a + b) * (a - b)))
function code(a, b, angle) return Float64(2.0 * Float64(sin(Float64(angle * Float64(pi / -180.0))) * Float64(Float64(a + b) * Float64(a - b)))) end
function tmp = code(a, b, angle) tmp = 2.0 * (sin((angle * (pi / -180.0))) * ((a + b) * (a - b))); end
code[a_, b_, angle_] := N[(2.0 * N[(N[Sin[N[(angle * N[(Pi / -180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(a + b), $MachinePrecision] * N[(a - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 \cdot \left(\sin \left(angle \cdot \frac{\pi}{-180}\right) \cdot \left(\left(a + b\right) \cdot \left(a - b\right)\right)\right)
\end{array}
Initial program 51.1%
Simplified50.0%
Taylor expanded in angle around 0 49.8%
unpow249.8%
unpow249.8%
difference-of-squares52.2%
Applied egg-rr52.2%
Final simplification52.2%
(FPCore (a b angle) :precision binary64 (* 2.0 (* 0.005555555555555556 (* angle (* PI (* (- b a) (+ a b)))))))
double code(double a, double b, double angle) {
return 2.0 * (0.005555555555555556 * (angle * (((double) M_PI) * ((b - a) * (a + b)))));
}
public static double code(double a, double b, double angle) {
return 2.0 * (0.005555555555555556 * (angle * (Math.PI * ((b - a) * (a + b)))));
}
def code(a, b, angle): return 2.0 * (0.005555555555555556 * (angle * (math.pi * ((b - a) * (a + b)))))
function code(a, b, angle) return Float64(2.0 * Float64(0.005555555555555556 * Float64(angle * Float64(pi * Float64(Float64(b - a) * Float64(a + b)))))) end
function tmp = code(a, b, angle) tmp = 2.0 * (0.005555555555555556 * (angle * (pi * ((b - a) * (a + b))))); end
code[a_, b_, angle_] := N[(2.0 * N[(0.005555555555555556 * N[(angle * N[(Pi * N[(N[(b - a), $MachinePrecision] * N[(a + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 \cdot \left(0.005555555555555556 \cdot \left(angle \cdot \left(\pi \cdot \left(\left(b - a\right) \cdot \left(a + b\right)\right)\right)\right)\right)
\end{array}
Initial program 51.1%
Simplified50.3%
Taylor expanded in angle around 0 48.0%
unpow251.1%
unpow251.1%
difference-of-squares53.9%
Applied egg-rr51.3%
Final simplification51.3%
herbie shell --seed 2024040
(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)))))