
(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}
a_m = (fabs.f64 a)
angle\_m = (fabs.f64 angle)
angle\_s = (copysign.f64 #s(literal 1 binary64) angle)
(FPCore (angle_s a_m b angle_m)
:precision binary64
(let* ((t_0 (sin (* 0.005555555555555556 (* angle_m PI)))))
(*
angle_s
(if (<= a_m 2.1e-230)
(+
(* -2.0 (* (pow a_m 2.0) t_0))
(* b (+ (* 2.0 (* t_0 b)) (* 2.0 (* t_0 (- a_m a_m))))))
(if (<= a_m 8.5e+250)
(pow
(*
(cbrt (+ a_m b))
(cbrt
(* (- b a_m) (fabs (sin (* (* angle_m PI) 0.011111111111111112))))))
3.0)
(*
(* (+ a_m b) (- b a_m))
(*
2.0
(sin (pow (cbrt (* PI (* 0.005555555555555556 angle_m))) 3.0)))))))))a_m = fabs(a);
angle\_m = fabs(angle);
angle\_s = copysign(1.0, angle);
double code(double angle_s, double a_m, double b, double angle_m) {
double t_0 = sin((0.005555555555555556 * (angle_m * ((double) M_PI))));
double tmp;
if (a_m <= 2.1e-230) {
tmp = (-2.0 * (pow(a_m, 2.0) * t_0)) + (b * ((2.0 * (t_0 * b)) + (2.0 * (t_0 * (a_m - a_m)))));
} else if (a_m <= 8.5e+250) {
tmp = pow((cbrt((a_m + b)) * cbrt(((b - a_m) * fabs(sin(((angle_m * ((double) M_PI)) * 0.011111111111111112)))))), 3.0);
} else {
tmp = ((a_m + b) * (b - a_m)) * (2.0 * sin(pow(cbrt((((double) M_PI) * (0.005555555555555556 * angle_m))), 3.0)));
}
return angle_s * tmp;
}
a_m = Math.abs(a);
angle\_m = Math.abs(angle);
angle\_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a_m, double b, double angle_m) {
double t_0 = Math.sin((0.005555555555555556 * (angle_m * Math.PI)));
double tmp;
if (a_m <= 2.1e-230) {
tmp = (-2.0 * (Math.pow(a_m, 2.0) * t_0)) + (b * ((2.0 * (t_0 * b)) + (2.0 * (t_0 * (a_m - a_m)))));
} else if (a_m <= 8.5e+250) {
tmp = Math.pow((Math.cbrt((a_m + b)) * Math.cbrt(((b - a_m) * Math.abs(Math.sin(((angle_m * Math.PI) * 0.011111111111111112)))))), 3.0);
} else {
tmp = ((a_m + b) * (b - a_m)) * (2.0 * Math.sin(Math.pow(Math.cbrt((Math.PI * (0.005555555555555556 * angle_m))), 3.0)));
}
return angle_s * tmp;
}
a_m = abs(a) angle\_m = abs(angle) angle\_s = copysign(1.0, angle) function code(angle_s, a_m, b, angle_m) t_0 = sin(Float64(0.005555555555555556 * Float64(angle_m * pi))) tmp = 0.0 if (a_m <= 2.1e-230) tmp = Float64(Float64(-2.0 * Float64((a_m ^ 2.0) * t_0)) + Float64(b * Float64(Float64(2.0 * Float64(t_0 * b)) + Float64(2.0 * Float64(t_0 * Float64(a_m - a_m)))))); elseif (a_m <= 8.5e+250) tmp = Float64(cbrt(Float64(a_m + b)) * cbrt(Float64(Float64(b - a_m) * abs(sin(Float64(Float64(angle_m * pi) * 0.011111111111111112)))))) ^ 3.0; else tmp = Float64(Float64(Float64(a_m + b) * Float64(b - a_m)) * Float64(2.0 * sin((cbrt(Float64(pi * Float64(0.005555555555555556 * angle_m))) ^ 3.0)))); end return Float64(angle_s * tmp) end
a_m = N[Abs[a], $MachinePrecision]
angle\_m = N[Abs[angle], $MachinePrecision]
angle\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[angle]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[angle$95$s_, a$95$m_, b_, angle$95$m_] := Block[{t$95$0 = N[Sin[N[(0.005555555555555556 * N[(angle$95$m * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[(angle$95$s * If[LessEqual[a$95$m, 2.1e-230], N[(N[(-2.0 * N[(N[Power[a$95$m, 2.0], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] + N[(b * N[(N[(2.0 * N[(t$95$0 * b), $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[(t$95$0 * N[(a$95$m - a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a$95$m, 8.5e+250], N[Power[N[(N[Power[N[(a$95$m + b), $MachinePrecision], 1/3], $MachinePrecision] * N[Power[N[(N[(b - a$95$m), $MachinePrecision] * N[Abs[N[Sin[N[(N[(angle$95$m * Pi), $MachinePrecision] * 0.011111111111111112), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision], N[(N[(N[(a$95$m + b), $MachinePrecision] * N[(b - a$95$m), $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[Sin[N[Power[N[Power[N[(Pi * N[(0.005555555555555556 * angle$95$m), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]
\begin{array}{l}
a_m = \left|a\right|
\\
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
\begin{array}{l}
t_0 := \sin \left(0.005555555555555556 \cdot \left(angle\_m \cdot \pi\right)\right)\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;a\_m \leq 2.1 \cdot 10^{-230}:\\
\;\;\;\;-2 \cdot \left({a\_m}^{2} \cdot t\_0\right) + b \cdot \left(2 \cdot \left(t\_0 \cdot b\right) + 2 \cdot \left(t\_0 \cdot \left(a\_m - a\_m\right)\right)\right)\\
\mathbf{elif}\;a\_m \leq 8.5 \cdot 10^{+250}:\\
\;\;\;\;{\left(\sqrt[3]{a\_m + b} \cdot \sqrt[3]{\left(b - a\_m\right) \cdot \left|\sin \left(\left(angle\_m \cdot \pi\right) \cdot 0.011111111111111112\right)\right|}\right)}^{3}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(a\_m + b\right) \cdot \left(b - a\_m\right)\right) \cdot \left(2 \cdot \sin \left({\left(\sqrt[3]{\pi \cdot \left(0.005555555555555556 \cdot angle\_m\right)}\right)}^{3}\right)\right)\\
\end{array}
\end{array}
\end{array}
if a < 2.0999999999999998e-230Initial program 50.9%
associate-*l*50.9%
*-commutative50.9%
associate-*l*50.9%
Simplified50.9%
unpow250.9%
unpow250.9%
difference-of-squares55.1%
Applied egg-rr55.1%
Taylor expanded in angle around 0 59.1%
Taylor expanded in b around 0 59.5%
if 2.0999999999999998e-230 < a < 8.50000000000000028e250Initial program 53.3%
associate-*l*53.3%
*-commutative53.3%
associate-*l*53.3%
Simplified53.3%
add-cube-cbrt52.9%
pow353.0%
2-sin53.0%
associate-*r*53.0%
div-inv53.9%
metadata-eval53.9%
Applied egg-rr53.9%
Applied egg-rr66.9%
+-commutative66.9%
associate-*l*67.2%
Simplified67.2%
add-sqr-sqrt30.5%
sqrt-unprod33.6%
pow233.6%
Applied egg-rr33.6%
associate-*r*33.6%
*-commutative33.6%
*-commutative33.6%
unpow233.6%
rem-sqrt-square43.2%
Simplified43.2%
if 8.50000000000000028e250 < a Initial program 53.3%
associate-*l*53.3%
*-commutative53.3%
associate-*l*53.3%
Simplified53.3%
unpow253.3%
unpow253.3%
difference-of-squares80.0%
Applied egg-rr80.0%
Taylor expanded in angle around 0 73.3%
add-cube-cbrt93.3%
pow393.3%
div-inv93.3%
metadata-eval93.3%
Applied egg-rr93.3%
Final simplification55.4%
a_m = (fabs.f64 a)
angle\_m = (fabs.f64 angle)
angle\_s = (copysign.f64 #s(literal 1 binary64) angle)
(FPCore (angle_s a_m b angle_m)
:precision binary64
(let* ((t_0 (sin (* 0.005555555555555556 (* angle_m PI)))))
(*
angle_s
(if (<= a_m 2.9e+34)
(+
(* -2.0 (* (pow a_m 2.0) t_0))
(* b (+ (* 2.0 (* t_0 b)) (* 2.0 (* t_0 (- a_m a_m))))))
(if (<= a_m 6.5e+250)
(* (- b a_m) (* (+ a_m b) (* PI (* angle_m 0.011111111111111112))))
(*
(* (+ a_m b) (- b a_m))
(*
2.0
(sin (pow (cbrt (* PI (* 0.005555555555555556 angle_m))) 3.0)))))))))a_m = fabs(a);
angle\_m = fabs(angle);
angle\_s = copysign(1.0, angle);
double code(double angle_s, double a_m, double b, double angle_m) {
double t_0 = sin((0.005555555555555556 * (angle_m * ((double) M_PI))));
double tmp;
if (a_m <= 2.9e+34) {
tmp = (-2.0 * (pow(a_m, 2.0) * t_0)) + (b * ((2.0 * (t_0 * b)) + (2.0 * (t_0 * (a_m - a_m)))));
} else if (a_m <= 6.5e+250) {
tmp = (b - a_m) * ((a_m + b) * (((double) M_PI) * (angle_m * 0.011111111111111112)));
} else {
tmp = ((a_m + b) * (b - a_m)) * (2.0 * sin(pow(cbrt((((double) M_PI) * (0.005555555555555556 * angle_m))), 3.0)));
}
return angle_s * tmp;
}
a_m = Math.abs(a);
angle\_m = Math.abs(angle);
angle\_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a_m, double b, double angle_m) {
double t_0 = Math.sin((0.005555555555555556 * (angle_m * Math.PI)));
double tmp;
if (a_m <= 2.9e+34) {
tmp = (-2.0 * (Math.pow(a_m, 2.0) * t_0)) + (b * ((2.0 * (t_0 * b)) + (2.0 * (t_0 * (a_m - a_m)))));
} else if (a_m <= 6.5e+250) {
tmp = (b - a_m) * ((a_m + b) * (Math.PI * (angle_m * 0.011111111111111112)));
} else {
tmp = ((a_m + b) * (b - a_m)) * (2.0 * Math.sin(Math.pow(Math.cbrt((Math.PI * (0.005555555555555556 * angle_m))), 3.0)));
}
return angle_s * tmp;
}
a_m = abs(a) angle\_m = abs(angle) angle\_s = copysign(1.0, angle) function code(angle_s, a_m, b, angle_m) t_0 = sin(Float64(0.005555555555555556 * Float64(angle_m * pi))) tmp = 0.0 if (a_m <= 2.9e+34) tmp = Float64(Float64(-2.0 * Float64((a_m ^ 2.0) * t_0)) + Float64(b * Float64(Float64(2.0 * Float64(t_0 * b)) + Float64(2.0 * Float64(t_0 * Float64(a_m - a_m)))))); elseif (a_m <= 6.5e+250) tmp = Float64(Float64(b - a_m) * Float64(Float64(a_m + b) * Float64(pi * Float64(angle_m * 0.011111111111111112)))); else tmp = Float64(Float64(Float64(a_m + b) * Float64(b - a_m)) * Float64(2.0 * sin((cbrt(Float64(pi * Float64(0.005555555555555556 * angle_m))) ^ 3.0)))); end return Float64(angle_s * tmp) end
a_m = N[Abs[a], $MachinePrecision]
angle\_m = N[Abs[angle], $MachinePrecision]
angle\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[angle]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[angle$95$s_, a$95$m_, b_, angle$95$m_] := Block[{t$95$0 = N[Sin[N[(0.005555555555555556 * N[(angle$95$m * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[(angle$95$s * If[LessEqual[a$95$m, 2.9e+34], N[(N[(-2.0 * N[(N[Power[a$95$m, 2.0], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] + N[(b * N[(N[(2.0 * N[(t$95$0 * b), $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[(t$95$0 * N[(a$95$m - a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a$95$m, 6.5e+250], N[(N[(b - a$95$m), $MachinePrecision] * N[(N[(a$95$m + b), $MachinePrecision] * N[(Pi * N[(angle$95$m * 0.011111111111111112), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(a$95$m + b), $MachinePrecision] * N[(b - a$95$m), $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[Sin[N[Power[N[Power[N[(Pi * N[(0.005555555555555556 * angle$95$m), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]
\begin{array}{l}
a_m = \left|a\right|
\\
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
\begin{array}{l}
t_0 := \sin \left(0.005555555555555556 \cdot \left(angle\_m \cdot \pi\right)\right)\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;a\_m \leq 2.9 \cdot 10^{+34}:\\
\;\;\;\;-2 \cdot \left({a\_m}^{2} \cdot t\_0\right) + b \cdot \left(2 \cdot \left(t\_0 \cdot b\right) + 2 \cdot \left(t\_0 \cdot \left(a\_m - a\_m\right)\right)\right)\\
\mathbf{elif}\;a\_m \leq 6.5 \cdot 10^{+250}:\\
\;\;\;\;\left(b - a\_m\right) \cdot \left(\left(a\_m + b\right) \cdot \left(\pi \cdot \left(angle\_m \cdot 0.011111111111111112\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(a\_m + b\right) \cdot \left(b - a\_m\right)\right) \cdot \left(2 \cdot \sin \left({\left(\sqrt[3]{\pi \cdot \left(0.005555555555555556 \cdot angle\_m\right)}\right)}^{3}\right)\right)\\
\end{array}
\end{array}
\end{array}
if a < 2.9000000000000001e34Initial program 53.0%
associate-*l*53.0%
*-commutative53.0%
associate-*l*53.0%
Simplified53.0%
unpow253.0%
unpow253.0%
difference-of-squares56.0%
Applied egg-rr56.0%
Taylor expanded in angle around 0 58.7%
Taylor expanded in b around 0 59.9%
if 2.9000000000000001e34 < a < 6.5000000000000004e250Initial program 45.0%
associate-*l*45.0%
*-commutative45.0%
associate-*l*45.0%
Simplified45.0%
unpow245.0%
unpow245.0%
difference-of-squares51.0%
Applied egg-rr51.0%
Taylor expanded in angle around 0 60.0%
Taylor expanded in angle around 0 56.4%
*-commutative56.4%
*-commutative56.4%
associate-*l*56.4%
*-commutative56.4%
associate-*l*56.3%
*-commutative56.3%
associate-*r*82.8%
associate-*r*82.9%
add-exp-log67.6%
add-exp-log32.3%
prod-exp32.1%
+-commutative32.1%
*-commutative32.1%
*-commutative32.1%
associate-*l*32.1%
Applied egg-rr32.1%
+-commutative32.1%
exp-sum32.3%
rem-exp-log67.6%
rem-exp-log82.9%
associate-*l*82.9%
associate-*r*82.9%
*-commutative82.9%
+-commutative82.9%
Simplified82.9%
if 6.5000000000000004e250 < a Initial program 53.3%
associate-*l*53.3%
*-commutative53.3%
associate-*l*53.3%
Simplified53.3%
unpow253.3%
unpow253.3%
difference-of-squares80.0%
Applied egg-rr80.0%
Taylor expanded in angle around 0 73.3%
add-cube-cbrt93.3%
pow393.3%
div-inv93.3%
metadata-eval93.3%
Applied egg-rr93.3%
Final simplification65.0%
a_m = (fabs.f64 a)
angle\_m = (fabs.f64 angle)
angle\_s = (copysign.f64 #s(literal 1 binary64) angle)
(FPCore (angle_s a_m b angle_m)
:precision binary64
(let* ((t_0 (* PI (* 0.005555555555555556 angle_m)))
(t_1 (* (+ a_m b) (- b a_m)))
(t_2 (* 2.0 t_1))
(t_3 (* PI (/ angle_m 180.0))))
(*
angle_s
(if (<= (/ angle_m 180.0) 1e-16)
(* (- b a_m) (* (+ a_m b) (* PI (* angle_m 0.011111111111111112))))
(if (<= (/ angle_m 180.0) 2e+94)
(* t_1 (* 2.0 (sin (pow (cbrt t_0) 3.0))))
(if (<= (/ angle_m 180.0) 1e+115)
(* (* (sin (* 0.005555555555555556 (* angle_m PI))) t_2) (cos t_3))
(* (* t_2 (sin t_3)) (fabs (cos t_0)))))))))a_m = fabs(a);
angle\_m = fabs(angle);
angle\_s = copysign(1.0, angle);
double code(double angle_s, double a_m, double b, double angle_m) {
double t_0 = ((double) M_PI) * (0.005555555555555556 * angle_m);
double t_1 = (a_m + b) * (b - a_m);
double t_2 = 2.0 * t_1;
double t_3 = ((double) M_PI) * (angle_m / 180.0);
double tmp;
if ((angle_m / 180.0) <= 1e-16) {
tmp = (b - a_m) * ((a_m + b) * (((double) M_PI) * (angle_m * 0.011111111111111112)));
} else if ((angle_m / 180.0) <= 2e+94) {
tmp = t_1 * (2.0 * sin(pow(cbrt(t_0), 3.0)));
} else if ((angle_m / 180.0) <= 1e+115) {
tmp = (sin((0.005555555555555556 * (angle_m * ((double) M_PI)))) * t_2) * cos(t_3);
} else {
tmp = (t_2 * sin(t_3)) * fabs(cos(t_0));
}
return angle_s * tmp;
}
a_m = Math.abs(a);
angle\_m = Math.abs(angle);
angle\_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a_m, double b, double angle_m) {
double t_0 = Math.PI * (0.005555555555555556 * angle_m);
double t_1 = (a_m + b) * (b - a_m);
double t_2 = 2.0 * t_1;
double t_3 = Math.PI * (angle_m / 180.0);
double tmp;
if ((angle_m / 180.0) <= 1e-16) {
tmp = (b - a_m) * ((a_m + b) * (Math.PI * (angle_m * 0.011111111111111112)));
} else if ((angle_m / 180.0) <= 2e+94) {
tmp = t_1 * (2.0 * Math.sin(Math.pow(Math.cbrt(t_0), 3.0)));
} else if ((angle_m / 180.0) <= 1e+115) {
tmp = (Math.sin((0.005555555555555556 * (angle_m * Math.PI))) * t_2) * Math.cos(t_3);
} else {
tmp = (t_2 * Math.sin(t_3)) * Math.abs(Math.cos(t_0));
}
return angle_s * tmp;
}
a_m = abs(a) angle\_m = abs(angle) angle\_s = copysign(1.0, angle) function code(angle_s, a_m, b, angle_m) t_0 = Float64(pi * Float64(0.005555555555555556 * angle_m)) t_1 = Float64(Float64(a_m + b) * Float64(b - a_m)) t_2 = Float64(2.0 * t_1) t_3 = Float64(pi * Float64(angle_m / 180.0)) tmp = 0.0 if (Float64(angle_m / 180.0) <= 1e-16) tmp = Float64(Float64(b - a_m) * Float64(Float64(a_m + b) * Float64(pi * Float64(angle_m * 0.011111111111111112)))); elseif (Float64(angle_m / 180.0) <= 2e+94) tmp = Float64(t_1 * Float64(2.0 * sin((cbrt(t_0) ^ 3.0)))); elseif (Float64(angle_m / 180.0) <= 1e+115) tmp = Float64(Float64(sin(Float64(0.005555555555555556 * Float64(angle_m * pi))) * t_2) * cos(t_3)); else tmp = Float64(Float64(t_2 * sin(t_3)) * abs(cos(t_0))); end return Float64(angle_s * tmp) end
a_m = N[Abs[a], $MachinePrecision]
angle\_m = N[Abs[angle], $MachinePrecision]
angle\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[angle]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[angle$95$s_, a$95$m_, b_, angle$95$m_] := Block[{t$95$0 = N[(Pi * N[(0.005555555555555556 * angle$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(a$95$m + b), $MachinePrecision] * N[(b - a$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(2.0 * t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(Pi * N[(angle$95$m / 180.0), $MachinePrecision]), $MachinePrecision]}, N[(angle$95$s * If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 1e-16], N[(N[(b - a$95$m), $MachinePrecision] * N[(N[(a$95$m + b), $MachinePrecision] * N[(Pi * N[(angle$95$m * 0.011111111111111112), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 2e+94], N[(t$95$1 * N[(2.0 * N[Sin[N[Power[N[Power[t$95$0, 1/3], $MachinePrecision], 3.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 1e+115], N[(N[(N[Sin[N[(0.005555555555555556 * N[(angle$95$m * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$2), $MachinePrecision] * N[Cos[t$95$3], $MachinePrecision]), $MachinePrecision], N[(N[(t$95$2 * N[Sin[t$95$3], $MachinePrecision]), $MachinePrecision] * N[Abs[N[Cos[t$95$0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]), $MachinePrecision]]]]]
\begin{array}{l}
a_m = \left|a\right|
\\
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
\begin{array}{l}
t_0 := \pi \cdot \left(0.005555555555555556 \cdot angle\_m\right)\\
t_1 := \left(a\_m + b\right) \cdot \left(b - a\_m\right)\\
t_2 := 2 \cdot t\_1\\
t_3 := \pi \cdot \frac{angle\_m}{180}\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{angle\_m}{180} \leq 10^{-16}:\\
\;\;\;\;\left(b - a\_m\right) \cdot \left(\left(a\_m + b\right) \cdot \left(\pi \cdot \left(angle\_m \cdot 0.011111111111111112\right)\right)\right)\\
\mathbf{elif}\;\frac{angle\_m}{180} \leq 2 \cdot 10^{+94}:\\
\;\;\;\;t\_1 \cdot \left(2 \cdot \sin \left({\left(\sqrt[3]{t\_0}\right)}^{3}\right)\right)\\
\mathbf{elif}\;\frac{angle\_m}{180} \leq 10^{+115}:\\
\;\;\;\;\left(\sin \left(0.005555555555555556 \cdot \left(angle\_m \cdot \pi\right)\right) \cdot t\_2\right) \cdot \cos t\_3\\
\mathbf{else}:\\
\;\;\;\;\left(t\_2 \cdot \sin t\_3\right) \cdot \left|\cos t\_0\right|\\
\end{array}
\end{array}
\end{array}
if (/.f64 angle #s(literal 180 binary64)) < 9.9999999999999998e-17Initial program 60.6%
associate-*l*60.6%
*-commutative60.6%
associate-*l*60.6%
Simplified60.6%
unpow260.6%
unpow260.6%
difference-of-squares66.0%
Applied egg-rr66.0%
Taylor expanded in angle around 0 69.0%
Taylor expanded in angle around 0 66.6%
*-commutative66.6%
*-commutative66.6%
associate-*l*66.5%
*-commutative66.5%
associate-*l*66.6%
*-commutative66.6%
associate-*r*75.8%
associate-*r*75.8%
add-exp-log40.5%
add-exp-log20.9%
prod-exp20.8%
+-commutative20.8%
*-commutative20.8%
*-commutative20.8%
associate-*l*20.8%
Applied egg-rr20.8%
+-commutative20.8%
exp-sum20.9%
rem-exp-log40.5%
rem-exp-log75.9%
associate-*l*75.9%
associate-*r*75.8%
*-commutative75.8%
+-commutative75.8%
Simplified75.8%
if 9.9999999999999998e-17 < (/.f64 angle #s(literal 180 binary64)) < 2e94Initial program 34.6%
associate-*l*34.6%
*-commutative34.6%
associate-*l*34.6%
Simplified34.6%
unpow234.6%
unpow234.6%
difference-of-squares34.6%
Applied egg-rr34.6%
Taylor expanded in angle around 0 34.9%
add-cube-cbrt37.0%
pow337.7%
div-inv37.7%
metadata-eval37.7%
Applied egg-rr37.7%
if 2e94 < (/.f64 angle #s(literal 180 binary64)) < 1e115Initial program 47.1%
unpow247.1%
unpow247.1%
difference-of-squares47.1%
Applied egg-rr47.1%
Taylor expanded in angle around inf 47.4%
if 1e115 < (/.f64 angle #s(literal 180 binary64)) Initial program 21.0%
unpow221.0%
unpow221.0%
difference-of-squares25.7%
Applied egg-rr25.7%
add-cube-cbrt23.4%
pow223.4%
Applied egg-rr32.3%
add-sqr-sqrt21.6%
sqrt-unprod35.7%
pow235.7%
unpow235.7%
add-cube-cbrt35.8%
div-inv36.0%
metadata-eval36.0%
Applied egg-rr36.0%
unpow236.0%
rem-sqrt-square36.0%
Simplified36.0%
Final simplification65.9%
a_m = (fabs.f64 a)
angle\_m = (fabs.f64 angle)
angle\_s = (copysign.f64 #s(literal 1 binary64) angle)
(FPCore (angle_s a_m b angle_m)
:precision binary64
(let* ((t_0 (* (+ a_m b) (- b a_m))))
(*
angle_s
(if (<= (/ angle_m 180.0) 1e-16)
(* (- b a_m) (* (+ a_m b) (* PI (* angle_m 0.011111111111111112))))
(if (<= (/ angle_m 180.0) 1e+115)
(*
t_0
(*
2.0
(sin (pow (cbrt (* PI (* 0.005555555555555556 angle_m))) 3.0))))
(* t_0 (* 2.0 (sin (* PI (/ angle_m 180.0))))))))))a_m = fabs(a);
angle\_m = fabs(angle);
angle\_s = copysign(1.0, angle);
double code(double angle_s, double a_m, double b, double angle_m) {
double t_0 = (a_m + b) * (b - a_m);
double tmp;
if ((angle_m / 180.0) <= 1e-16) {
tmp = (b - a_m) * ((a_m + b) * (((double) M_PI) * (angle_m * 0.011111111111111112)));
} else if ((angle_m / 180.0) <= 1e+115) {
tmp = t_0 * (2.0 * sin(pow(cbrt((((double) M_PI) * (0.005555555555555556 * angle_m))), 3.0)));
} else {
tmp = t_0 * (2.0 * sin((((double) M_PI) * (angle_m / 180.0))));
}
return angle_s * tmp;
}
a_m = Math.abs(a);
angle\_m = Math.abs(angle);
angle\_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a_m, double b, double angle_m) {
double t_0 = (a_m + b) * (b - a_m);
double tmp;
if ((angle_m / 180.0) <= 1e-16) {
tmp = (b - a_m) * ((a_m + b) * (Math.PI * (angle_m * 0.011111111111111112)));
} else if ((angle_m / 180.0) <= 1e+115) {
tmp = t_0 * (2.0 * Math.sin(Math.pow(Math.cbrt((Math.PI * (0.005555555555555556 * angle_m))), 3.0)));
} else {
tmp = t_0 * (2.0 * Math.sin((Math.PI * (angle_m / 180.0))));
}
return angle_s * tmp;
}
a_m = abs(a) angle\_m = abs(angle) angle\_s = copysign(1.0, angle) function code(angle_s, a_m, b, angle_m) t_0 = Float64(Float64(a_m + b) * Float64(b - a_m)) tmp = 0.0 if (Float64(angle_m / 180.0) <= 1e-16) tmp = Float64(Float64(b - a_m) * Float64(Float64(a_m + b) * Float64(pi * Float64(angle_m * 0.011111111111111112)))); elseif (Float64(angle_m / 180.0) <= 1e+115) tmp = Float64(t_0 * Float64(2.0 * sin((cbrt(Float64(pi * Float64(0.005555555555555556 * angle_m))) ^ 3.0)))); else tmp = Float64(t_0 * Float64(2.0 * sin(Float64(pi * Float64(angle_m / 180.0))))); end return Float64(angle_s * tmp) end
a_m = N[Abs[a], $MachinePrecision]
angle\_m = N[Abs[angle], $MachinePrecision]
angle\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[angle]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[angle$95$s_, a$95$m_, b_, angle$95$m_] := Block[{t$95$0 = N[(N[(a$95$m + b), $MachinePrecision] * N[(b - a$95$m), $MachinePrecision]), $MachinePrecision]}, N[(angle$95$s * If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 1e-16], N[(N[(b - a$95$m), $MachinePrecision] * N[(N[(a$95$m + b), $MachinePrecision] * N[(Pi * N[(angle$95$m * 0.011111111111111112), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 1e+115], N[(t$95$0 * N[(2.0 * N[Sin[N[Power[N[Power[N[(Pi * N[(0.005555555555555556 * angle$95$m), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(2.0 * N[Sin[N[(Pi * N[(angle$95$m / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]
\begin{array}{l}
a_m = \left|a\right|
\\
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
\begin{array}{l}
t_0 := \left(a\_m + b\right) \cdot \left(b - a\_m\right)\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{angle\_m}{180} \leq 10^{-16}:\\
\;\;\;\;\left(b - a\_m\right) \cdot \left(\left(a\_m + b\right) \cdot \left(\pi \cdot \left(angle\_m \cdot 0.011111111111111112\right)\right)\right)\\
\mathbf{elif}\;\frac{angle\_m}{180} \leq 10^{+115}:\\
\;\;\;\;t\_0 \cdot \left(2 \cdot \sin \left({\left(\sqrt[3]{\pi \cdot \left(0.005555555555555556 \cdot angle\_m\right)}\right)}^{3}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \left(2 \cdot \sin \left(\pi \cdot \frac{angle\_m}{180}\right)\right)\\
\end{array}
\end{array}
\end{array}
if (/.f64 angle #s(literal 180 binary64)) < 9.9999999999999998e-17Initial program 60.6%
associate-*l*60.6%
*-commutative60.6%
associate-*l*60.6%
Simplified60.6%
unpow260.6%
unpow260.6%
difference-of-squares66.0%
Applied egg-rr66.0%
Taylor expanded in angle around 0 69.0%
Taylor expanded in angle around 0 66.6%
*-commutative66.6%
*-commutative66.6%
associate-*l*66.5%
*-commutative66.5%
associate-*l*66.6%
*-commutative66.6%
associate-*r*75.8%
associate-*r*75.8%
add-exp-log40.5%
add-exp-log20.9%
prod-exp20.8%
+-commutative20.8%
*-commutative20.8%
*-commutative20.8%
associate-*l*20.8%
Applied egg-rr20.8%
+-commutative20.8%
exp-sum20.9%
rem-exp-log40.5%
rem-exp-log75.9%
associate-*l*75.9%
associate-*r*75.8%
*-commutative75.8%
+-commutative75.8%
Simplified75.8%
if 9.9999999999999998e-17 < (/.f64 angle #s(literal 180 binary64)) < 1e115Initial program 37.2%
associate-*l*37.2%
*-commutative37.2%
associate-*l*37.2%
Simplified37.2%
unpow237.2%
unpow237.2%
difference-of-squares37.2%
Applied egg-rr37.2%
Taylor expanded in angle around 0 28.9%
add-cube-cbrt30.8%
pow331.3%
div-inv35.5%
metadata-eval35.5%
Applied egg-rr35.5%
if 1e115 < (/.f64 angle #s(literal 180 binary64)) Initial program 21.0%
associate-*l*21.0%
*-commutative21.0%
associate-*l*21.0%
Simplified21.0%
unpow221.0%
unpow221.0%
difference-of-squares25.7%
Applied egg-rr25.7%
Taylor expanded in angle around 0 35.7%
Final simplification65.5%
a_m = (fabs.f64 a)
angle\_m = (fabs.f64 angle)
angle\_s = (copysign.f64 #s(literal 1 binary64) angle)
(FPCore (angle_s a_m b angle_m)
:precision binary64
(let* ((t_0 (* (+ a_m b) (- b a_m))))
(*
angle_s
(if (<= (/ angle_m 180.0) 1e-17)
(* (- b a_m) (* (+ a_m b) (* PI (* angle_m 0.011111111111111112))))
(if (<= (/ angle_m 180.0) 5e+66)
(* 2.0 (* (sin (* 0.005555555555555556 (* angle_m PI))) t_0))
(if (<= (/ angle_m 180.0) 1e+113)
(* t_0 (* 2.0 (fabs (sin (* PI (* 0.005555555555555556 angle_m))))))
(* t_0 (* 2.0 (sin (* PI (/ angle_m 180.0)))))))))))a_m = fabs(a);
angle\_m = fabs(angle);
angle\_s = copysign(1.0, angle);
double code(double angle_s, double a_m, double b, double angle_m) {
double t_0 = (a_m + b) * (b - a_m);
double tmp;
if ((angle_m / 180.0) <= 1e-17) {
tmp = (b - a_m) * ((a_m + b) * (((double) M_PI) * (angle_m * 0.011111111111111112)));
} else if ((angle_m / 180.0) <= 5e+66) {
tmp = 2.0 * (sin((0.005555555555555556 * (angle_m * ((double) M_PI)))) * t_0);
} else if ((angle_m / 180.0) <= 1e+113) {
tmp = t_0 * (2.0 * fabs(sin((((double) M_PI) * (0.005555555555555556 * angle_m)))));
} else {
tmp = t_0 * (2.0 * sin((((double) M_PI) * (angle_m / 180.0))));
}
return angle_s * tmp;
}
a_m = Math.abs(a);
angle\_m = Math.abs(angle);
angle\_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a_m, double b, double angle_m) {
double t_0 = (a_m + b) * (b - a_m);
double tmp;
if ((angle_m / 180.0) <= 1e-17) {
tmp = (b - a_m) * ((a_m + b) * (Math.PI * (angle_m * 0.011111111111111112)));
} else if ((angle_m / 180.0) <= 5e+66) {
tmp = 2.0 * (Math.sin((0.005555555555555556 * (angle_m * Math.PI))) * t_0);
} else if ((angle_m / 180.0) <= 1e+113) {
tmp = t_0 * (2.0 * Math.abs(Math.sin((Math.PI * (0.005555555555555556 * angle_m)))));
} else {
tmp = t_0 * (2.0 * Math.sin((Math.PI * (angle_m / 180.0))));
}
return angle_s * tmp;
}
a_m = math.fabs(a) angle\_m = math.fabs(angle) angle\_s = math.copysign(1.0, angle) def code(angle_s, a_m, b, angle_m): t_0 = (a_m + b) * (b - a_m) tmp = 0 if (angle_m / 180.0) <= 1e-17: tmp = (b - a_m) * ((a_m + b) * (math.pi * (angle_m * 0.011111111111111112))) elif (angle_m / 180.0) <= 5e+66: tmp = 2.0 * (math.sin((0.005555555555555556 * (angle_m * math.pi))) * t_0) elif (angle_m / 180.0) <= 1e+113: tmp = t_0 * (2.0 * math.fabs(math.sin((math.pi * (0.005555555555555556 * angle_m))))) else: tmp = t_0 * (2.0 * math.sin((math.pi * (angle_m / 180.0)))) return angle_s * tmp
a_m = abs(a) angle\_m = abs(angle) angle\_s = copysign(1.0, angle) function code(angle_s, a_m, b, angle_m) t_0 = Float64(Float64(a_m + b) * Float64(b - a_m)) tmp = 0.0 if (Float64(angle_m / 180.0) <= 1e-17) tmp = Float64(Float64(b - a_m) * Float64(Float64(a_m + b) * Float64(pi * Float64(angle_m * 0.011111111111111112)))); elseif (Float64(angle_m / 180.0) <= 5e+66) tmp = Float64(2.0 * Float64(sin(Float64(0.005555555555555556 * Float64(angle_m * pi))) * t_0)); elseif (Float64(angle_m / 180.0) <= 1e+113) tmp = Float64(t_0 * Float64(2.0 * abs(sin(Float64(pi * Float64(0.005555555555555556 * angle_m)))))); else tmp = Float64(t_0 * Float64(2.0 * sin(Float64(pi * Float64(angle_m / 180.0))))); end return Float64(angle_s * tmp) end
a_m = abs(a); angle\_m = abs(angle); angle\_s = sign(angle) * abs(1.0); function tmp_2 = code(angle_s, a_m, b, angle_m) t_0 = (a_m + b) * (b - a_m); tmp = 0.0; if ((angle_m / 180.0) <= 1e-17) tmp = (b - a_m) * ((a_m + b) * (pi * (angle_m * 0.011111111111111112))); elseif ((angle_m / 180.0) <= 5e+66) tmp = 2.0 * (sin((0.005555555555555556 * (angle_m * pi))) * t_0); elseif ((angle_m / 180.0) <= 1e+113) tmp = t_0 * (2.0 * abs(sin((pi * (0.005555555555555556 * angle_m))))); else tmp = t_0 * (2.0 * sin((pi * (angle_m / 180.0)))); end tmp_2 = angle_s * tmp; end
a_m = N[Abs[a], $MachinePrecision]
angle\_m = N[Abs[angle], $MachinePrecision]
angle\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[angle]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[angle$95$s_, a$95$m_, b_, angle$95$m_] := Block[{t$95$0 = N[(N[(a$95$m + b), $MachinePrecision] * N[(b - a$95$m), $MachinePrecision]), $MachinePrecision]}, N[(angle$95$s * If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 1e-17], N[(N[(b - a$95$m), $MachinePrecision] * N[(N[(a$95$m + b), $MachinePrecision] * N[(Pi * N[(angle$95$m * 0.011111111111111112), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 5e+66], N[(2.0 * N[(N[Sin[N[(0.005555555555555556 * N[(angle$95$m * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 1e+113], N[(t$95$0 * N[(2.0 * N[Abs[N[Sin[N[(Pi * N[(0.005555555555555556 * angle$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(2.0 * N[Sin[N[(Pi * N[(angle$95$m / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]), $MachinePrecision]]
\begin{array}{l}
a_m = \left|a\right|
\\
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
\begin{array}{l}
t_0 := \left(a\_m + b\right) \cdot \left(b - a\_m\right)\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{angle\_m}{180} \leq 10^{-17}:\\
\;\;\;\;\left(b - a\_m\right) \cdot \left(\left(a\_m + b\right) \cdot \left(\pi \cdot \left(angle\_m \cdot 0.011111111111111112\right)\right)\right)\\
\mathbf{elif}\;\frac{angle\_m}{180} \leq 5 \cdot 10^{+66}:\\
\;\;\;\;2 \cdot \left(\sin \left(0.005555555555555556 \cdot \left(angle\_m \cdot \pi\right)\right) \cdot t\_0\right)\\
\mathbf{elif}\;\frac{angle\_m}{180} \leq 10^{+113}:\\
\;\;\;\;t\_0 \cdot \left(2 \cdot \left|\sin \left(\pi \cdot \left(0.005555555555555556 \cdot angle\_m\right)\right)\right|\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \left(2 \cdot \sin \left(\pi \cdot \frac{angle\_m}{180}\right)\right)\\
\end{array}
\end{array}
\end{array}
if (/.f64 angle #s(literal 180 binary64)) < 1.00000000000000007e-17Initial program 60.4%
associate-*l*60.4%
*-commutative60.4%
associate-*l*60.4%
Simplified60.4%
unpow260.4%
unpow260.4%
difference-of-squares65.8%
Applied egg-rr65.8%
Taylor expanded in angle around 0 68.8%
Taylor expanded in angle around 0 66.4%
*-commutative66.4%
*-commutative66.4%
associate-*l*66.4%
*-commutative66.4%
associate-*l*66.4%
*-commutative66.4%
associate-*r*75.7%
associate-*r*75.7%
add-exp-log40.2%
add-exp-log20.5%
prod-exp20.5%
+-commutative20.5%
*-commutative20.5%
*-commutative20.5%
associate-*l*20.5%
Applied egg-rr20.5%
+-commutative20.5%
exp-sum20.5%
rem-exp-log40.2%
rem-exp-log75.7%
associate-*l*75.7%
associate-*r*75.7%
*-commutative75.7%
+-commutative75.7%
Simplified75.7%
if 1.00000000000000007e-17 < (/.f64 angle #s(literal 180 binary64)) < 4.99999999999999991e66Initial program 44.8%
associate-*l*44.8%
*-commutative44.8%
associate-*l*44.8%
Simplified44.8%
unpow244.8%
unpow244.8%
difference-of-squares44.8%
Applied egg-rr44.8%
Taylor expanded in angle around 0 41.0%
Taylor expanded in angle around inf 52.8%
if 4.99999999999999991e66 < (/.f64 angle #s(literal 180 binary64)) < 1e113Initial program 22.0%
associate-*l*22.0%
*-commutative22.0%
associate-*l*22.0%
Simplified22.0%
unpow222.0%
unpow222.0%
difference-of-squares22.0%
Applied egg-rr22.0%
Taylor expanded in angle around 0 17.0%
add-cube-cbrt5.3%
pow25.3%
Applied egg-rr5.3%
*-rgt-identity5.3%
add-sqr-sqrt4.6%
sqrt-unprod36.6%
pow236.6%
*-rgt-identity36.6%
unpow236.6%
add-cube-cbrt37.3%
div-inv38.1%
metadata-eval38.1%
Applied egg-rr38.1%
associate-*r*37.4%
*-commutative37.4%
*-commutative37.4%
unpow237.4%
rem-sqrt-square37.4%
*-commutative37.4%
*-commutative37.4%
associate-*r*38.1%
Simplified38.1%
if 1e113 < (/.f64 angle #s(literal 180 binary64)) Initial program 22.8%
associate-*l*22.8%
*-commutative22.8%
associate-*l*22.8%
Simplified22.8%
unpow222.8%
unpow222.8%
difference-of-squares27.5%
Applied egg-rr27.5%
Taylor expanded in angle around 0 34.9%
Final simplification66.2%
a_m = (fabs.f64 a)
angle\_m = (fabs.f64 angle)
angle\_s = (copysign.f64 #s(literal 1 binary64) angle)
(FPCore (angle_s a_m b angle_m)
:precision binary64
(*
angle_s
(if (<= a_m 1.25e-114)
(*
2.0
(* (sin (* 0.005555555555555556 (* angle_m PI))) (* (+ a_m b) (- b a_m))))
(* (- b a_m) (* (+ a_m b) (* PI (* angle_m 0.011111111111111112)))))))a_m = fabs(a);
angle\_m = fabs(angle);
angle\_s = copysign(1.0, angle);
double code(double angle_s, double a_m, double b, double angle_m) {
double tmp;
if (a_m <= 1.25e-114) {
tmp = 2.0 * (sin((0.005555555555555556 * (angle_m * ((double) M_PI)))) * ((a_m + b) * (b - a_m)));
} else {
tmp = (b - a_m) * ((a_m + b) * (((double) M_PI) * (angle_m * 0.011111111111111112)));
}
return angle_s * tmp;
}
a_m = Math.abs(a);
angle\_m = Math.abs(angle);
angle\_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a_m, double b, double angle_m) {
double tmp;
if (a_m <= 1.25e-114) {
tmp = 2.0 * (Math.sin((0.005555555555555556 * (angle_m * Math.PI))) * ((a_m + b) * (b - a_m)));
} else {
tmp = (b - a_m) * ((a_m + b) * (Math.PI * (angle_m * 0.011111111111111112)));
}
return angle_s * tmp;
}
a_m = math.fabs(a) angle\_m = math.fabs(angle) angle\_s = math.copysign(1.0, angle) def code(angle_s, a_m, b, angle_m): tmp = 0 if a_m <= 1.25e-114: tmp = 2.0 * (math.sin((0.005555555555555556 * (angle_m * math.pi))) * ((a_m + b) * (b - a_m))) else: tmp = (b - a_m) * ((a_m + b) * (math.pi * (angle_m * 0.011111111111111112))) return angle_s * tmp
a_m = abs(a) angle\_m = abs(angle) angle\_s = copysign(1.0, angle) function code(angle_s, a_m, b, angle_m) tmp = 0.0 if (a_m <= 1.25e-114) tmp = Float64(2.0 * Float64(sin(Float64(0.005555555555555556 * Float64(angle_m * pi))) * Float64(Float64(a_m + b) * Float64(b - a_m)))); else tmp = Float64(Float64(b - a_m) * Float64(Float64(a_m + b) * Float64(pi * Float64(angle_m * 0.011111111111111112)))); end return Float64(angle_s * tmp) end
a_m = abs(a); angle\_m = abs(angle); angle\_s = sign(angle) * abs(1.0); function tmp_2 = code(angle_s, a_m, b, angle_m) tmp = 0.0; if (a_m <= 1.25e-114) tmp = 2.0 * (sin((0.005555555555555556 * (angle_m * pi))) * ((a_m + b) * (b - a_m))); else tmp = (b - a_m) * ((a_m + b) * (pi * (angle_m * 0.011111111111111112))); end tmp_2 = angle_s * tmp; end
a_m = N[Abs[a], $MachinePrecision]
angle\_m = N[Abs[angle], $MachinePrecision]
angle\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[angle]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[angle$95$s_, a$95$m_, b_, angle$95$m_] := N[(angle$95$s * If[LessEqual[a$95$m, 1.25e-114], N[(2.0 * N[(N[Sin[N[(0.005555555555555556 * N[(angle$95$m * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(a$95$m + b), $MachinePrecision] * N[(b - a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b - a$95$m), $MachinePrecision] * N[(N[(a$95$m + b), $MachinePrecision] * N[(Pi * N[(angle$95$m * 0.011111111111111112), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;a\_m \leq 1.25 \cdot 10^{-114}:\\
\;\;\;\;2 \cdot \left(\sin \left(0.005555555555555556 \cdot \left(angle\_m \cdot \pi\right)\right) \cdot \left(\left(a\_m + b\right) \cdot \left(b - a\_m\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(b - a\_m\right) \cdot \left(\left(a\_m + b\right) \cdot \left(\pi \cdot \left(angle\_m \cdot 0.011111111111111112\right)\right)\right)\\
\end{array}
\end{array}
if a < 1.24999999999999997e-114Initial program 51.8%
associate-*l*51.8%
*-commutative51.8%
associate-*l*51.8%
Simplified51.8%
unpow251.8%
unpow251.8%
difference-of-squares55.2%
Applied egg-rr55.2%
Taylor expanded in angle around 0 58.2%
Taylor expanded in angle around inf 58.1%
if 1.24999999999999997e-114 < a Initial program 52.3%
associate-*l*52.3%
*-commutative52.3%
associate-*l*52.3%
Simplified52.3%
unpow252.3%
unpow252.3%
difference-of-squares60.1%
Applied egg-rr60.1%
Taylor expanded in angle around 0 63.3%
Taylor expanded in angle around 0 61.6%
*-commutative61.6%
*-commutative61.6%
associate-*l*61.5%
*-commutative61.5%
associate-*l*61.5%
*-commutative61.5%
associate-*r*74.6%
associate-*r*74.7%
add-exp-log64.5%
add-exp-log33.3%
prod-exp33.2%
+-commutative33.2%
*-commutative33.2%
*-commutative33.2%
associate-*l*33.2%
Applied egg-rr33.2%
+-commutative33.2%
exp-sum33.3%
rem-exp-log64.5%
rem-exp-log74.7%
associate-*l*74.7%
associate-*r*74.7%
*-commutative74.7%
+-commutative74.7%
Simplified74.7%
Final simplification63.2%
a_m = (fabs.f64 a)
angle\_m = (fabs.f64 angle)
angle\_s = (copysign.f64 #s(literal 1 binary64) angle)
(FPCore (angle_s a_m b angle_m)
:precision binary64
(*
angle_s
(if (<= angle_m 9e-15)
(* (- b a_m) (* (+ a_m b) (* PI (* angle_m 0.011111111111111112))))
(*
(* (+ a_m b) (- b a_m))
(* 2.0 (* 0.005555555555555556 (* angle_m PI)))))))a_m = fabs(a);
angle\_m = fabs(angle);
angle\_s = copysign(1.0, angle);
double code(double angle_s, double a_m, double b, double angle_m) {
double tmp;
if (angle_m <= 9e-15) {
tmp = (b - a_m) * ((a_m + b) * (((double) M_PI) * (angle_m * 0.011111111111111112)));
} else {
tmp = ((a_m + b) * (b - a_m)) * (2.0 * (0.005555555555555556 * (angle_m * ((double) M_PI))));
}
return angle_s * tmp;
}
a_m = Math.abs(a);
angle\_m = Math.abs(angle);
angle\_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a_m, double b, double angle_m) {
double tmp;
if (angle_m <= 9e-15) {
tmp = (b - a_m) * ((a_m + b) * (Math.PI * (angle_m * 0.011111111111111112)));
} else {
tmp = ((a_m + b) * (b - a_m)) * (2.0 * (0.005555555555555556 * (angle_m * Math.PI)));
}
return angle_s * tmp;
}
a_m = math.fabs(a) angle\_m = math.fabs(angle) angle\_s = math.copysign(1.0, angle) def code(angle_s, a_m, b, angle_m): tmp = 0 if angle_m <= 9e-15: tmp = (b - a_m) * ((a_m + b) * (math.pi * (angle_m * 0.011111111111111112))) else: tmp = ((a_m + b) * (b - a_m)) * (2.0 * (0.005555555555555556 * (angle_m * math.pi))) return angle_s * tmp
a_m = abs(a) angle\_m = abs(angle) angle\_s = copysign(1.0, angle) function code(angle_s, a_m, b, angle_m) tmp = 0.0 if (angle_m <= 9e-15) tmp = Float64(Float64(b - a_m) * Float64(Float64(a_m + b) * Float64(pi * Float64(angle_m * 0.011111111111111112)))); else tmp = Float64(Float64(Float64(a_m + b) * Float64(b - a_m)) * Float64(2.0 * Float64(0.005555555555555556 * Float64(angle_m * pi)))); end return Float64(angle_s * tmp) end
a_m = abs(a); angle\_m = abs(angle); angle\_s = sign(angle) * abs(1.0); function tmp_2 = code(angle_s, a_m, b, angle_m) tmp = 0.0; if (angle_m <= 9e-15) tmp = (b - a_m) * ((a_m + b) * (pi * (angle_m * 0.011111111111111112))); else tmp = ((a_m + b) * (b - a_m)) * (2.0 * (0.005555555555555556 * (angle_m * pi))); end tmp_2 = angle_s * tmp; end
a_m = N[Abs[a], $MachinePrecision]
angle\_m = N[Abs[angle], $MachinePrecision]
angle\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[angle]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[angle$95$s_, a$95$m_, b_, angle$95$m_] := N[(angle$95$s * If[LessEqual[angle$95$m, 9e-15], N[(N[(b - a$95$m), $MachinePrecision] * N[(N[(a$95$m + b), $MachinePrecision] * N[(Pi * N[(angle$95$m * 0.011111111111111112), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(a$95$m + b), $MachinePrecision] * N[(b - a$95$m), $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[(0.005555555555555556 * N[(angle$95$m * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;angle\_m \leq 9 \cdot 10^{-15}:\\
\;\;\;\;\left(b - a\_m\right) \cdot \left(\left(a\_m + b\right) \cdot \left(\pi \cdot \left(angle\_m \cdot 0.011111111111111112\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(a\_m + b\right) \cdot \left(b - a\_m\right)\right) \cdot \left(2 \cdot \left(0.005555555555555556 \cdot \left(angle\_m \cdot \pi\right)\right)\right)\\
\end{array}
\end{array}
if angle < 8.9999999999999995e-15Initial program 60.4%
associate-*l*60.4%
*-commutative60.4%
associate-*l*60.4%
Simplified60.4%
unpow260.4%
unpow260.4%
difference-of-squares65.8%
Applied egg-rr65.8%
Taylor expanded in angle around 0 68.8%
Taylor expanded in angle around 0 66.4%
*-commutative66.4%
*-commutative66.4%
associate-*l*66.4%
*-commutative66.4%
associate-*l*66.4%
*-commutative66.4%
associate-*r*75.7%
associate-*r*75.7%
add-exp-log40.2%
add-exp-log20.5%
prod-exp20.5%
+-commutative20.5%
*-commutative20.5%
*-commutative20.5%
associate-*l*20.5%
Applied egg-rr20.5%
+-commutative20.5%
exp-sum20.5%
rem-exp-log40.2%
rem-exp-log75.7%
associate-*l*75.7%
associate-*r*75.7%
*-commutative75.7%
+-commutative75.7%
Simplified75.7%
if 8.9999999999999995e-15 < angle Initial program 28.0%
associate-*l*28.0%
*-commutative28.0%
associate-*l*28.0%
Simplified28.0%
unpow228.0%
unpow228.0%
difference-of-squares31.0%
Applied egg-rr31.0%
Taylor expanded in angle around 0 34.2%
Taylor expanded in angle around 0 30.8%
Final simplification64.0%
a_m = (fabs.f64 a)
angle\_m = (fabs.f64 angle)
angle\_s = (copysign.f64 #s(literal 1 binary64) angle)
(FPCore (angle_s a_m b angle_m)
:precision binary64
(*
angle_s
(if (<= angle_m 4e-46)
(* (- b a_m) (* (+ a_m b) (* PI (* angle_m 0.011111111111111112))))
(*
(* (+ a_m b) (- b a_m))
(* 2.0 (* angle_m (* 0.005555555555555556 PI)))))))a_m = fabs(a);
angle\_m = fabs(angle);
angle\_s = copysign(1.0, angle);
double code(double angle_s, double a_m, double b, double angle_m) {
double tmp;
if (angle_m <= 4e-46) {
tmp = (b - a_m) * ((a_m + b) * (((double) M_PI) * (angle_m * 0.011111111111111112)));
} else {
tmp = ((a_m + b) * (b - a_m)) * (2.0 * (angle_m * (0.005555555555555556 * ((double) M_PI))));
}
return angle_s * tmp;
}
a_m = Math.abs(a);
angle\_m = Math.abs(angle);
angle\_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a_m, double b, double angle_m) {
double tmp;
if (angle_m <= 4e-46) {
tmp = (b - a_m) * ((a_m + b) * (Math.PI * (angle_m * 0.011111111111111112)));
} else {
tmp = ((a_m + b) * (b - a_m)) * (2.0 * (angle_m * (0.005555555555555556 * Math.PI)));
}
return angle_s * tmp;
}
a_m = math.fabs(a) angle\_m = math.fabs(angle) angle\_s = math.copysign(1.0, angle) def code(angle_s, a_m, b, angle_m): tmp = 0 if angle_m <= 4e-46: tmp = (b - a_m) * ((a_m + b) * (math.pi * (angle_m * 0.011111111111111112))) else: tmp = ((a_m + b) * (b - a_m)) * (2.0 * (angle_m * (0.005555555555555556 * math.pi))) return angle_s * tmp
a_m = abs(a) angle\_m = abs(angle) angle\_s = copysign(1.0, angle) function code(angle_s, a_m, b, angle_m) tmp = 0.0 if (angle_m <= 4e-46) tmp = Float64(Float64(b - a_m) * Float64(Float64(a_m + b) * Float64(pi * Float64(angle_m * 0.011111111111111112)))); else tmp = Float64(Float64(Float64(a_m + b) * Float64(b - a_m)) * Float64(2.0 * Float64(angle_m * Float64(0.005555555555555556 * pi)))); end return Float64(angle_s * tmp) end
a_m = abs(a); angle\_m = abs(angle); angle\_s = sign(angle) * abs(1.0); function tmp_2 = code(angle_s, a_m, b, angle_m) tmp = 0.0; if (angle_m <= 4e-46) tmp = (b - a_m) * ((a_m + b) * (pi * (angle_m * 0.011111111111111112))); else tmp = ((a_m + b) * (b - a_m)) * (2.0 * (angle_m * (0.005555555555555556 * pi))); end tmp_2 = angle_s * tmp; end
a_m = N[Abs[a], $MachinePrecision]
angle\_m = N[Abs[angle], $MachinePrecision]
angle\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[angle]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[angle$95$s_, a$95$m_, b_, angle$95$m_] := N[(angle$95$s * If[LessEqual[angle$95$m, 4e-46], N[(N[(b - a$95$m), $MachinePrecision] * N[(N[(a$95$m + b), $MachinePrecision] * N[(Pi * N[(angle$95$m * 0.011111111111111112), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(a$95$m + b), $MachinePrecision] * N[(b - a$95$m), $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[(angle$95$m * N[(0.005555555555555556 * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;angle\_m \leq 4 \cdot 10^{-46}:\\
\;\;\;\;\left(b - a\_m\right) \cdot \left(\left(a\_m + b\right) \cdot \left(\pi \cdot \left(angle\_m \cdot 0.011111111111111112\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(a\_m + b\right) \cdot \left(b - a\_m\right)\right) \cdot \left(2 \cdot \left(angle\_m \cdot \left(0.005555555555555556 \cdot \pi\right)\right)\right)\\
\end{array}
\end{array}
if angle < 4.00000000000000009e-46Initial program 59.7%
associate-*l*59.7%
*-commutative59.7%
associate-*l*59.7%
Simplified59.7%
unpow259.7%
unpow259.7%
difference-of-squares64.7%
Applied egg-rr64.7%
Taylor expanded in angle around 0 67.8%
Taylor expanded in angle around 0 65.3%
*-commutative65.3%
*-commutative65.3%
associate-*l*65.3%
*-commutative65.3%
associate-*l*65.3%
*-commutative65.3%
associate-*r*74.9%
associate-*r*74.9%
add-exp-log40.5%
add-exp-log20.6%
prod-exp20.6%
+-commutative20.6%
*-commutative20.6%
*-commutative20.6%
associate-*l*20.6%
Applied egg-rr20.6%
+-commutative20.6%
exp-sum20.6%
rem-exp-log40.5%
rem-exp-log74.9%
associate-*l*74.9%
associate-*r*74.9%
*-commutative74.9%
+-commutative74.9%
Simplified74.9%
if 4.00000000000000009e-46 < angle Initial program 32.5%
associate-*l*32.5%
*-commutative32.5%
associate-*l*32.5%
Simplified32.5%
unpow232.5%
unpow232.5%
difference-of-squares36.6%
Applied egg-rr36.6%
Taylor expanded in angle around 0 39.6%
Taylor expanded in angle around 0 36.5%
*-commutative36.5%
associate-*r*36.5%
Simplified36.5%
Final simplification64.0%
a_m = (fabs.f64 a)
angle\_m = (fabs.f64 angle)
angle\_s = (copysign.f64 #s(literal 1 binary64) angle)
(FPCore (angle_s a_m b angle_m)
:precision binary64
(*
angle_s
(if (<= angle_m 5e-56)
(* (- b a_m) (* (+ a_m b) (* PI (* angle_m 0.011111111111111112))))
(*
(* (+ a_m b) (- b a_m))
(* 2.0 (* PI (* 0.005555555555555556 angle_m)))))))a_m = fabs(a);
angle\_m = fabs(angle);
angle\_s = copysign(1.0, angle);
double code(double angle_s, double a_m, double b, double angle_m) {
double tmp;
if (angle_m <= 5e-56) {
tmp = (b - a_m) * ((a_m + b) * (((double) M_PI) * (angle_m * 0.011111111111111112)));
} else {
tmp = ((a_m + b) * (b - a_m)) * (2.0 * (((double) M_PI) * (0.005555555555555556 * angle_m)));
}
return angle_s * tmp;
}
a_m = Math.abs(a);
angle\_m = Math.abs(angle);
angle\_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a_m, double b, double angle_m) {
double tmp;
if (angle_m <= 5e-56) {
tmp = (b - a_m) * ((a_m + b) * (Math.PI * (angle_m * 0.011111111111111112)));
} else {
tmp = ((a_m + b) * (b - a_m)) * (2.0 * (Math.PI * (0.005555555555555556 * angle_m)));
}
return angle_s * tmp;
}
a_m = math.fabs(a) angle\_m = math.fabs(angle) angle\_s = math.copysign(1.0, angle) def code(angle_s, a_m, b, angle_m): tmp = 0 if angle_m <= 5e-56: tmp = (b - a_m) * ((a_m + b) * (math.pi * (angle_m * 0.011111111111111112))) else: tmp = ((a_m + b) * (b - a_m)) * (2.0 * (math.pi * (0.005555555555555556 * angle_m))) return angle_s * tmp
a_m = abs(a) angle\_m = abs(angle) angle\_s = copysign(1.0, angle) function code(angle_s, a_m, b, angle_m) tmp = 0.0 if (angle_m <= 5e-56) tmp = Float64(Float64(b - a_m) * Float64(Float64(a_m + b) * Float64(pi * Float64(angle_m * 0.011111111111111112)))); else tmp = Float64(Float64(Float64(a_m + b) * Float64(b - a_m)) * Float64(2.0 * Float64(pi * Float64(0.005555555555555556 * angle_m)))); end return Float64(angle_s * tmp) end
a_m = abs(a); angle\_m = abs(angle); angle\_s = sign(angle) * abs(1.0); function tmp_2 = code(angle_s, a_m, b, angle_m) tmp = 0.0; if (angle_m <= 5e-56) tmp = (b - a_m) * ((a_m + b) * (pi * (angle_m * 0.011111111111111112))); else tmp = ((a_m + b) * (b - a_m)) * (2.0 * (pi * (0.005555555555555556 * angle_m))); end tmp_2 = angle_s * tmp; end
a_m = N[Abs[a], $MachinePrecision]
angle\_m = N[Abs[angle], $MachinePrecision]
angle\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[angle]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[angle$95$s_, a$95$m_, b_, angle$95$m_] := N[(angle$95$s * If[LessEqual[angle$95$m, 5e-56], N[(N[(b - a$95$m), $MachinePrecision] * N[(N[(a$95$m + b), $MachinePrecision] * N[(Pi * N[(angle$95$m * 0.011111111111111112), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(a$95$m + b), $MachinePrecision] * N[(b - a$95$m), $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[(Pi * N[(0.005555555555555556 * angle$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;angle\_m \leq 5 \cdot 10^{-56}:\\
\;\;\;\;\left(b - a\_m\right) \cdot \left(\left(a\_m + b\right) \cdot \left(\pi \cdot \left(angle\_m \cdot 0.011111111111111112\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(a\_m + b\right) \cdot \left(b - a\_m\right)\right) \cdot \left(2 \cdot \left(\pi \cdot \left(0.005555555555555556 \cdot angle\_m\right)\right)\right)\\
\end{array}
\end{array}
if angle < 4.99999999999999997e-56Initial program 59.4%
associate-*l*59.4%
*-commutative59.4%
associate-*l*59.4%
Simplified59.4%
unpow259.4%
unpow259.4%
difference-of-squares64.5%
Applied egg-rr64.5%
Taylor expanded in angle around 0 67.6%
Taylor expanded in angle around 0 65.1%
*-commutative65.1%
*-commutative65.1%
associate-*l*65.1%
*-commutative65.1%
associate-*l*65.1%
*-commutative65.1%
associate-*r*74.8%
associate-*r*74.8%
add-exp-log40.2%
add-exp-log20.2%
prod-exp20.2%
+-commutative20.2%
*-commutative20.2%
*-commutative20.2%
associate-*l*20.2%
Applied egg-rr20.2%
+-commutative20.2%
exp-sum20.2%
rem-exp-log40.2%
rem-exp-log74.8%
associate-*l*74.8%
associate-*r*74.8%
*-commutative74.8%
+-commutative74.8%
Simplified74.8%
if 4.99999999999999997e-56 < angle Initial program 33.4%
associate-*l*33.4%
*-commutative33.4%
associate-*l*33.4%
Simplified33.4%
unpow233.4%
unpow233.4%
difference-of-squares37.5%
Applied egg-rr37.5%
Taylor expanded in angle around 0 40.5%
Taylor expanded in angle around 0 37.3%
*-commutative37.3%
*-commutative37.3%
associate-*r*37.3%
Simplified37.3%
Final simplification64.0%
a_m = (fabs.f64 a)
angle\_m = (fabs.f64 angle)
angle\_s = (copysign.f64 #s(literal 1 binary64) angle)
(FPCore (angle_s a_m b angle_m)
:precision binary64
(*
angle_s
(if (<= angle_m 4.1e-15)
(* (- b a_m) (* (+ a_m b) (* PI (* angle_m 0.011111111111111112))))
(* 0.011111111111111112 (* (* angle_m PI) (* (+ a_m b) (- b a_m)))))))a_m = fabs(a);
angle\_m = fabs(angle);
angle\_s = copysign(1.0, angle);
double code(double angle_s, double a_m, double b, double angle_m) {
double tmp;
if (angle_m <= 4.1e-15) {
tmp = (b - a_m) * ((a_m + b) * (((double) M_PI) * (angle_m * 0.011111111111111112)));
} else {
tmp = 0.011111111111111112 * ((angle_m * ((double) M_PI)) * ((a_m + b) * (b - a_m)));
}
return angle_s * tmp;
}
a_m = Math.abs(a);
angle\_m = Math.abs(angle);
angle\_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a_m, double b, double angle_m) {
double tmp;
if (angle_m <= 4.1e-15) {
tmp = (b - a_m) * ((a_m + b) * (Math.PI * (angle_m * 0.011111111111111112)));
} else {
tmp = 0.011111111111111112 * ((angle_m * Math.PI) * ((a_m + b) * (b - a_m)));
}
return angle_s * tmp;
}
a_m = math.fabs(a) angle\_m = math.fabs(angle) angle\_s = math.copysign(1.0, angle) def code(angle_s, a_m, b, angle_m): tmp = 0 if angle_m <= 4.1e-15: tmp = (b - a_m) * ((a_m + b) * (math.pi * (angle_m * 0.011111111111111112))) else: tmp = 0.011111111111111112 * ((angle_m * math.pi) * ((a_m + b) * (b - a_m))) return angle_s * tmp
a_m = abs(a) angle\_m = abs(angle) angle\_s = copysign(1.0, angle) function code(angle_s, a_m, b, angle_m) tmp = 0.0 if (angle_m <= 4.1e-15) tmp = Float64(Float64(b - a_m) * Float64(Float64(a_m + b) * Float64(pi * Float64(angle_m * 0.011111111111111112)))); else tmp = Float64(0.011111111111111112 * Float64(Float64(angle_m * pi) * Float64(Float64(a_m + b) * Float64(b - a_m)))); end return Float64(angle_s * tmp) end
a_m = abs(a); angle\_m = abs(angle); angle\_s = sign(angle) * abs(1.0); function tmp_2 = code(angle_s, a_m, b, angle_m) tmp = 0.0; if (angle_m <= 4.1e-15) tmp = (b - a_m) * ((a_m + b) * (pi * (angle_m * 0.011111111111111112))); else tmp = 0.011111111111111112 * ((angle_m * pi) * ((a_m + b) * (b - a_m))); end tmp_2 = angle_s * tmp; end
a_m = N[Abs[a], $MachinePrecision]
angle\_m = N[Abs[angle], $MachinePrecision]
angle\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[angle]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[angle$95$s_, a$95$m_, b_, angle$95$m_] := N[(angle$95$s * If[LessEqual[angle$95$m, 4.1e-15], N[(N[(b - a$95$m), $MachinePrecision] * N[(N[(a$95$m + b), $MachinePrecision] * N[(Pi * N[(angle$95$m * 0.011111111111111112), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.011111111111111112 * N[(N[(angle$95$m * Pi), $MachinePrecision] * N[(N[(a$95$m + b), $MachinePrecision] * N[(b - a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;angle\_m \leq 4.1 \cdot 10^{-15}:\\
\;\;\;\;\left(b - a\_m\right) \cdot \left(\left(a\_m + b\right) \cdot \left(\pi \cdot \left(angle\_m \cdot 0.011111111111111112\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.011111111111111112 \cdot \left(\left(angle\_m \cdot \pi\right) \cdot \left(\left(a\_m + b\right) \cdot \left(b - a\_m\right)\right)\right)\\
\end{array}
\end{array}
if angle < 4.10000000000000036e-15Initial program 60.4%
associate-*l*60.4%
*-commutative60.4%
associate-*l*60.4%
Simplified60.4%
unpow260.4%
unpow260.4%
difference-of-squares65.8%
Applied egg-rr65.8%
Taylor expanded in angle around 0 68.8%
Taylor expanded in angle around 0 66.4%
*-commutative66.4%
*-commutative66.4%
associate-*l*66.4%
*-commutative66.4%
associate-*l*66.4%
*-commutative66.4%
associate-*r*75.7%
associate-*r*75.7%
add-exp-log40.2%
add-exp-log20.5%
prod-exp20.5%
+-commutative20.5%
*-commutative20.5%
*-commutative20.5%
associate-*l*20.5%
Applied egg-rr20.5%
+-commutative20.5%
exp-sum20.5%
rem-exp-log40.2%
rem-exp-log75.7%
associate-*l*75.7%
associate-*r*75.7%
*-commutative75.7%
+-commutative75.7%
Simplified75.7%
if 4.10000000000000036e-15 < angle Initial program 28.0%
associate-*l*28.0%
*-commutative28.0%
associate-*l*28.0%
Simplified28.0%
unpow228.0%
unpow228.0%
difference-of-squares31.0%
Applied egg-rr31.0%
Taylor expanded in angle around 0 34.2%
Taylor expanded in angle around 0 30.8%
associate-*r*30.8%
+-commutative30.8%
difference-of-squares27.8%
unpow227.8%
unpow227.8%
associate-*r*27.8%
associate-*r*27.8%
unpow227.8%
unpow227.8%
difference-of-squares30.8%
*-commutative30.8%
+-commutative30.8%
Simplified30.8%
Final simplification64.0%
a_m = (fabs.f64 a) angle\_m = (fabs.f64 angle) angle\_s = (copysign.f64 #s(literal 1 binary64) angle) (FPCore (angle_s a_m b angle_m) :precision binary64 (* angle_s (* 0.011111111111111112 (* angle_m (* PI (* (+ a_m b) (- b a_m)))))))
a_m = fabs(a);
angle\_m = fabs(angle);
angle\_s = copysign(1.0, angle);
double code(double angle_s, double a_m, double b, double angle_m) {
return angle_s * (0.011111111111111112 * (angle_m * (((double) M_PI) * ((a_m + b) * (b - a_m)))));
}
a_m = Math.abs(a);
angle\_m = Math.abs(angle);
angle\_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a_m, double b, double angle_m) {
return angle_s * (0.011111111111111112 * (angle_m * (Math.PI * ((a_m + b) * (b - a_m)))));
}
a_m = math.fabs(a) angle\_m = math.fabs(angle) angle\_s = math.copysign(1.0, angle) def code(angle_s, a_m, b, angle_m): return angle_s * (0.011111111111111112 * (angle_m * (math.pi * ((a_m + b) * (b - a_m)))))
a_m = abs(a) angle\_m = abs(angle) angle\_s = copysign(1.0, angle) function code(angle_s, a_m, b, angle_m) return Float64(angle_s * Float64(0.011111111111111112 * Float64(angle_m * Float64(pi * Float64(Float64(a_m + b) * Float64(b - a_m)))))) end
a_m = abs(a); angle\_m = abs(angle); angle\_s = sign(angle) * abs(1.0); function tmp = code(angle_s, a_m, b, angle_m) tmp = angle_s * (0.011111111111111112 * (angle_m * (pi * ((a_m + b) * (b - a_m))))); end
a_m = N[Abs[a], $MachinePrecision]
angle\_m = N[Abs[angle], $MachinePrecision]
angle\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[angle]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[angle$95$s_, a$95$m_, b_, angle$95$m_] := N[(angle$95$s * N[(0.011111111111111112 * N[(angle$95$m * N[(Pi * N[(N[(a$95$m + b), $MachinePrecision] * N[(b - a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
angle\_s \cdot \left(0.011111111111111112 \cdot \left(angle\_m \cdot \left(\pi \cdot \left(\left(a\_m + b\right) \cdot \left(b - a\_m\right)\right)\right)\right)\right)
\end{array}
Initial program 51.9%
associate-*l*51.9%
*-commutative51.9%
associate-*l*51.9%
Simplified51.9%
unpow251.9%
unpow251.9%
difference-of-squares56.7%
Applied egg-rr56.7%
Taylor expanded in angle around 0 59.7%
Taylor expanded in angle around 0 57.1%
Final simplification57.1%
a_m = (fabs.f64 a) angle\_m = (fabs.f64 angle) angle\_s = (copysign.f64 #s(literal 1 binary64) angle) (FPCore (angle_s a_m b angle_m) :precision binary64 (* angle_s (* 0.011111111111111112 (* (* angle_m PI) (* (+ a_m b) (- b a_m))))))
a_m = fabs(a);
angle\_m = fabs(angle);
angle\_s = copysign(1.0, angle);
double code(double angle_s, double a_m, double b, double angle_m) {
return angle_s * (0.011111111111111112 * ((angle_m * ((double) M_PI)) * ((a_m + b) * (b - a_m))));
}
a_m = Math.abs(a);
angle\_m = Math.abs(angle);
angle\_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a_m, double b, double angle_m) {
return angle_s * (0.011111111111111112 * ((angle_m * Math.PI) * ((a_m + b) * (b - a_m))));
}
a_m = math.fabs(a) angle\_m = math.fabs(angle) angle\_s = math.copysign(1.0, angle) def code(angle_s, a_m, b, angle_m): return angle_s * (0.011111111111111112 * ((angle_m * math.pi) * ((a_m + b) * (b - a_m))))
a_m = abs(a) angle\_m = abs(angle) angle\_s = copysign(1.0, angle) function code(angle_s, a_m, b, angle_m) return Float64(angle_s * Float64(0.011111111111111112 * Float64(Float64(angle_m * pi) * Float64(Float64(a_m + b) * Float64(b - a_m))))) end
a_m = abs(a); angle\_m = abs(angle); angle\_s = sign(angle) * abs(1.0); function tmp = code(angle_s, a_m, b, angle_m) tmp = angle_s * (0.011111111111111112 * ((angle_m * pi) * ((a_m + b) * (b - a_m)))); end
a_m = N[Abs[a], $MachinePrecision]
angle\_m = N[Abs[angle], $MachinePrecision]
angle\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[angle]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[angle$95$s_, a$95$m_, b_, angle$95$m_] := N[(angle$95$s * N[(0.011111111111111112 * N[(N[(angle$95$m * Pi), $MachinePrecision] * N[(N[(a$95$m + b), $MachinePrecision] * N[(b - a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
angle\_s \cdot \left(0.011111111111111112 \cdot \left(\left(angle\_m \cdot \pi\right) \cdot \left(\left(a\_m + b\right) \cdot \left(b - a\_m\right)\right)\right)\right)
\end{array}
Initial program 51.9%
associate-*l*51.9%
*-commutative51.9%
associate-*l*51.9%
Simplified51.9%
unpow251.9%
unpow251.9%
difference-of-squares56.7%
Applied egg-rr56.7%
Taylor expanded in angle around 0 59.7%
Taylor expanded in angle around 0 57.1%
associate-*r*57.1%
+-commutative57.1%
difference-of-squares53.1%
unpow253.1%
unpow253.1%
associate-*r*53.1%
associate-*r*53.1%
unpow253.1%
unpow253.1%
difference-of-squares57.1%
*-commutative57.1%
+-commutative57.1%
Simplified57.1%
Final simplification57.1%
herbie shell --seed 2024074
(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)))))