
(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}
angle_m = (fabs.f64 angle)
angle_s = (copysign.f64 1 angle)
(FPCore (angle_s a b angle_m)
:precision binary64
(let* ((t_0 (* (+ b a) (- b a)))
(t_1 (* PI (* angle_m 0.005555555555555556)))
(t_2 (* (/ angle_m 180.0) PI))
(t_3 (cos t_2)))
(*
angle_s
(if (<= (/ angle_m 180.0) 1e-241)
(* 2.0 (* (pow (* b (sqrt (sin t_1))) 2.0) t_3))
(if (<= (/ angle_m 180.0) 5e+65)
(* 2.0 (* t_3 (* t_0 (sin t_2))))
(if (<= (/ angle_m 180.0) 2e+78)
(*
2.0
(*
t_3
(*
t_0
(sin
(pow
(pow (* 0.005555555555555556 (* angle_m PI)) 3.0)
0.3333333333333333)))))
(if (<= (/ angle_m 180.0) 2e+91)
(*
2.0
(*
(*
t_0
(expm1 (log1p (sin (pow (pow t_1 3.0) 0.3333333333333333)))))
(cos (expm1 (log1p (* angle_m (* PI 0.005555555555555556)))))))
(*
2.0
(*
t_0
(+
(exp (log1p (sin (/ 1.0 (/ 180.0 (* angle_m PI))))))
-1.0))))))))))angle_m = fabs(angle);
angle_s = copysign(1.0, angle);
double code(double angle_s, double a, double b, double angle_m) {
double t_0 = (b + a) * (b - a);
double t_1 = ((double) M_PI) * (angle_m * 0.005555555555555556);
double t_2 = (angle_m / 180.0) * ((double) M_PI);
double t_3 = cos(t_2);
double tmp;
if ((angle_m / 180.0) <= 1e-241) {
tmp = 2.0 * (pow((b * sqrt(sin(t_1))), 2.0) * t_3);
} else if ((angle_m / 180.0) <= 5e+65) {
tmp = 2.0 * (t_3 * (t_0 * sin(t_2)));
} else if ((angle_m / 180.0) <= 2e+78) {
tmp = 2.0 * (t_3 * (t_0 * sin(pow(pow((0.005555555555555556 * (angle_m * ((double) M_PI))), 3.0), 0.3333333333333333))));
} else if ((angle_m / 180.0) <= 2e+91) {
tmp = 2.0 * ((t_0 * expm1(log1p(sin(pow(pow(t_1, 3.0), 0.3333333333333333))))) * cos(expm1(log1p((angle_m * (((double) M_PI) * 0.005555555555555556))))));
} else {
tmp = 2.0 * (t_0 * (exp(log1p(sin((1.0 / (180.0 / (angle_m * ((double) M_PI))))))) + -1.0));
}
return angle_s * tmp;
}
angle_m = Math.abs(angle);
angle_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a, double b, double angle_m) {
double t_0 = (b + a) * (b - a);
double t_1 = Math.PI * (angle_m * 0.005555555555555556);
double t_2 = (angle_m / 180.0) * Math.PI;
double t_3 = Math.cos(t_2);
double tmp;
if ((angle_m / 180.0) <= 1e-241) {
tmp = 2.0 * (Math.pow((b * Math.sqrt(Math.sin(t_1))), 2.0) * t_3);
} else if ((angle_m / 180.0) <= 5e+65) {
tmp = 2.0 * (t_3 * (t_0 * Math.sin(t_2)));
} else if ((angle_m / 180.0) <= 2e+78) {
tmp = 2.0 * (t_3 * (t_0 * Math.sin(Math.pow(Math.pow((0.005555555555555556 * (angle_m * Math.PI)), 3.0), 0.3333333333333333))));
} else if ((angle_m / 180.0) <= 2e+91) {
tmp = 2.0 * ((t_0 * Math.expm1(Math.log1p(Math.sin(Math.pow(Math.pow(t_1, 3.0), 0.3333333333333333))))) * Math.cos(Math.expm1(Math.log1p((angle_m * (Math.PI * 0.005555555555555556))))));
} else {
tmp = 2.0 * (t_0 * (Math.exp(Math.log1p(Math.sin((1.0 / (180.0 / (angle_m * Math.PI)))))) + -1.0));
}
return angle_s * tmp;
}
angle_m = math.fabs(angle) angle_s = math.copysign(1.0, angle) def code(angle_s, a, b, angle_m): t_0 = (b + a) * (b - a) t_1 = math.pi * (angle_m * 0.005555555555555556) t_2 = (angle_m / 180.0) * math.pi t_3 = math.cos(t_2) tmp = 0 if (angle_m / 180.0) <= 1e-241: tmp = 2.0 * (math.pow((b * math.sqrt(math.sin(t_1))), 2.0) * t_3) elif (angle_m / 180.0) <= 5e+65: tmp = 2.0 * (t_3 * (t_0 * math.sin(t_2))) elif (angle_m / 180.0) <= 2e+78: tmp = 2.0 * (t_3 * (t_0 * math.sin(math.pow(math.pow((0.005555555555555556 * (angle_m * math.pi)), 3.0), 0.3333333333333333)))) elif (angle_m / 180.0) <= 2e+91: tmp = 2.0 * ((t_0 * math.expm1(math.log1p(math.sin(math.pow(math.pow(t_1, 3.0), 0.3333333333333333))))) * math.cos(math.expm1(math.log1p((angle_m * (math.pi * 0.005555555555555556)))))) else: tmp = 2.0 * (t_0 * (math.exp(math.log1p(math.sin((1.0 / (180.0 / (angle_m * math.pi)))))) + -1.0)) return angle_s * tmp
angle_m = abs(angle) angle_s = copysign(1.0, angle) function code(angle_s, a, b, angle_m) t_0 = Float64(Float64(b + a) * Float64(b - a)) t_1 = Float64(pi * Float64(angle_m * 0.005555555555555556)) t_2 = Float64(Float64(angle_m / 180.0) * pi) t_3 = cos(t_2) tmp = 0.0 if (Float64(angle_m / 180.0) <= 1e-241) tmp = Float64(2.0 * Float64((Float64(b * sqrt(sin(t_1))) ^ 2.0) * t_3)); elseif (Float64(angle_m / 180.0) <= 5e+65) tmp = Float64(2.0 * Float64(t_3 * Float64(t_0 * sin(t_2)))); elseif (Float64(angle_m / 180.0) <= 2e+78) tmp = Float64(2.0 * Float64(t_3 * Float64(t_0 * sin(((Float64(0.005555555555555556 * Float64(angle_m * pi)) ^ 3.0) ^ 0.3333333333333333))))); elseif (Float64(angle_m / 180.0) <= 2e+91) tmp = Float64(2.0 * Float64(Float64(t_0 * expm1(log1p(sin(((t_1 ^ 3.0) ^ 0.3333333333333333))))) * cos(expm1(log1p(Float64(angle_m * Float64(pi * 0.005555555555555556))))))); else tmp = Float64(2.0 * Float64(t_0 * Float64(exp(log1p(sin(Float64(1.0 / Float64(180.0 / Float64(angle_m * pi)))))) + -1.0))); end return Float64(angle_s * tmp) end
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_, b_, angle$95$m_] := Block[{t$95$0 = N[(N[(b + a), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(angle$95$m / 180.0), $MachinePrecision] * Pi), $MachinePrecision]}, Block[{t$95$3 = N[Cos[t$95$2], $MachinePrecision]}, N[(angle$95$s * If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 1e-241], N[(2.0 * N[(N[Power[N[(b * N[Sqrt[N[Sin[t$95$1], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * t$95$3), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 5e+65], N[(2.0 * N[(t$95$3 * N[(t$95$0 * N[Sin[t$95$2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 2e+78], N[(2.0 * N[(t$95$3 * N[(t$95$0 * N[Sin[N[Power[N[Power[N[(0.005555555555555556 * N[(angle$95$m * Pi), $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision], 0.3333333333333333], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 2e+91], N[(2.0 * N[(N[(t$95$0 * N[(Exp[N[Log[1 + N[Sin[N[Power[N[Power[t$95$1, 3.0], $MachinePrecision], 0.3333333333333333], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(Exp[N[Log[1 + N[(angle$95$m * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(t$95$0 * N[(N[Exp[N[Log[1 + N[Sin[N[(1.0 / N[(180.0 / N[(angle$95$m * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]), $MachinePrecision]]]]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
angle_s = \mathsf{copysign}\left(1, angle\right)
\\
\begin{array}{l}
t_0 := \left(b + a\right) \cdot \left(b - a\right)\\
t_1 := \pi \cdot \left(angle_m \cdot 0.005555555555555556\right)\\
t_2 := \frac{angle_m}{180} \cdot \pi\\
t_3 := \cos t_2\\
angle_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{angle_m}{180} \leq 10^{-241}:\\
\;\;\;\;2 \cdot \left({\left(b \cdot \sqrt{\sin t_1}\right)}^{2} \cdot t_3\right)\\
\mathbf{elif}\;\frac{angle_m}{180} \leq 5 \cdot 10^{+65}:\\
\;\;\;\;2 \cdot \left(t_3 \cdot \left(t_0 \cdot \sin t_2\right)\right)\\
\mathbf{elif}\;\frac{angle_m}{180} \leq 2 \cdot 10^{+78}:\\
\;\;\;\;2 \cdot \left(t_3 \cdot \left(t_0 \cdot \sin \left({\left({\left(0.005555555555555556 \cdot \left(angle_m \cdot \pi\right)\right)}^{3}\right)}^{0.3333333333333333}\right)\right)\right)\\
\mathbf{elif}\;\frac{angle_m}{180} \leq 2 \cdot 10^{+91}:\\
\;\;\;\;2 \cdot \left(\left(t_0 \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(\sin \left({\left({t_1}^{3}\right)}^{0.3333333333333333}\right)\right)\right)\right) \cdot \cos \left(\mathsf{expm1}\left(\mathsf{log1p}\left(angle_m \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(t_0 \cdot \left(e^{\mathsf{log1p}\left(\sin \left(\frac{1}{\frac{180}{angle_m \cdot \pi}}\right)\right)} + -1\right)\right)\\
\end{array}
\end{array}
\end{array}
if (/.f64 angle 180) < 9.9999999999999997e-242Initial program 48.9%
associate-*l*48.9%
associate-*l*48.9%
Simplified48.9%
Taylor expanded in b around inf 37.0%
add-sqr-sqrt20.1%
pow220.1%
div-inv20.2%
metadata-eval20.2%
sqrt-prod11.2%
unpow211.2%
sqrt-prod7.5%
add-sqr-sqrt14.3%
Applied egg-rr14.3%
if 9.9999999999999997e-242 < (/.f64 angle 180) < 4.99999999999999973e65Initial program 67.6%
associate-*l*67.6%
associate-*l*67.6%
Simplified67.6%
unpow267.6%
unpow267.6%
difference-of-squares77.1%
Applied egg-rr77.1%
if 4.99999999999999973e65 < (/.f64 angle 180) < 2.00000000000000002e78Initial program 4.9%
associate-*l*4.9%
associate-*l*4.9%
Simplified4.9%
unpow24.9%
unpow24.9%
difference-of-squares29.9%
Applied egg-rr29.9%
expm1-log1p-u29.9%
div-inv29.9%
metadata-eval29.9%
Applied egg-rr29.9%
add-cbrt-cube8.9%
pow1/354.9%
pow354.5%
Applied egg-rr54.5%
Taylor expanded in angle around inf 59.2%
if 2.00000000000000002e78 < (/.f64 angle 180) < 2.00000000000000016e91Initial program 10.8%
associate-*l*10.8%
associate-*l*10.8%
Simplified10.8%
unpow210.8%
unpow210.8%
difference-of-squares10.8%
Applied egg-rr10.8%
expm1-log1p-u10.8%
div-inv10.8%
metadata-eval10.8%
Applied egg-rr10.8%
add-cbrt-cube0.7%
pow1/350.7%
pow350.7%
Applied egg-rr50.7%
div-inv50.7%
metadata-eval50.7%
expm1-log1p-u58.9%
*-commutative58.9%
*-commutative58.9%
associate-*r*58.9%
*-commutative58.9%
associate-*l*58.9%
Applied egg-rr58.9%
if 2.00000000000000016e91 < (/.f64 angle 180) Initial program 21.9%
associate-*l*21.9%
associate-*l*21.9%
Simplified21.9%
unpow221.9%
unpow221.9%
difference-of-squares21.9%
Applied egg-rr21.9%
Taylor expanded in angle around 0 37.2%
expm1-log1p-u37.2%
expm1-udef37.2%
div-inv36.3%
metadata-eval36.3%
Applied egg-rr36.3%
metadata-eval36.3%
div-inv37.2%
associate-*r/40.8%
clear-num43.7%
Applied egg-rr43.7%
Final simplification35.1%
angle_m = (fabs.f64 angle)
angle_s = (copysign.f64 1 angle)
(FPCore (angle_s a b angle_m)
:precision binary64
(let* ((t_0 (* (+ b a) (- b a)))
(t_1 (* (/ angle_m 180.0) PI))
(t_2 (cos t_1)))
(*
angle_s
(if (<= (/ angle_m 180.0) 1e-241)
(*
2.0
(*
(pow (* b (sqrt (sin (* PI (* angle_m 0.005555555555555556))))) 2.0)
t_2))
(if (<= (/ angle_m 180.0) 4e+72)
(* 2.0 (* t_2 (* t_0 (sin t_1))))
(*
2.0
(*
t_0
(+ (exp (log1p (sin (/ 1.0 (/ 180.0 (* angle_m PI)))))) -1.0))))))))angle_m = fabs(angle);
angle_s = copysign(1.0, angle);
double code(double angle_s, double a, double b, double angle_m) {
double t_0 = (b + a) * (b - a);
double t_1 = (angle_m / 180.0) * ((double) M_PI);
double t_2 = cos(t_1);
double tmp;
if ((angle_m / 180.0) <= 1e-241) {
tmp = 2.0 * (pow((b * sqrt(sin((((double) M_PI) * (angle_m * 0.005555555555555556))))), 2.0) * t_2);
} else if ((angle_m / 180.0) <= 4e+72) {
tmp = 2.0 * (t_2 * (t_0 * sin(t_1)));
} else {
tmp = 2.0 * (t_0 * (exp(log1p(sin((1.0 / (180.0 / (angle_m * ((double) M_PI))))))) + -1.0));
}
return angle_s * tmp;
}
angle_m = Math.abs(angle);
angle_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a, double b, double angle_m) {
double t_0 = (b + a) * (b - a);
double t_1 = (angle_m / 180.0) * Math.PI;
double t_2 = Math.cos(t_1);
double tmp;
if ((angle_m / 180.0) <= 1e-241) {
tmp = 2.0 * (Math.pow((b * Math.sqrt(Math.sin((Math.PI * (angle_m * 0.005555555555555556))))), 2.0) * t_2);
} else if ((angle_m / 180.0) <= 4e+72) {
tmp = 2.0 * (t_2 * (t_0 * Math.sin(t_1)));
} else {
tmp = 2.0 * (t_0 * (Math.exp(Math.log1p(Math.sin((1.0 / (180.0 / (angle_m * Math.PI)))))) + -1.0));
}
return angle_s * tmp;
}
angle_m = math.fabs(angle) angle_s = math.copysign(1.0, angle) def code(angle_s, a, b, angle_m): t_0 = (b + a) * (b - a) t_1 = (angle_m / 180.0) * math.pi t_2 = math.cos(t_1) tmp = 0 if (angle_m / 180.0) <= 1e-241: tmp = 2.0 * (math.pow((b * math.sqrt(math.sin((math.pi * (angle_m * 0.005555555555555556))))), 2.0) * t_2) elif (angle_m / 180.0) <= 4e+72: tmp = 2.0 * (t_2 * (t_0 * math.sin(t_1))) else: tmp = 2.0 * (t_0 * (math.exp(math.log1p(math.sin((1.0 / (180.0 / (angle_m * math.pi)))))) + -1.0)) return angle_s * tmp
angle_m = abs(angle) angle_s = copysign(1.0, angle) function code(angle_s, a, b, angle_m) t_0 = Float64(Float64(b + a) * Float64(b - a)) t_1 = Float64(Float64(angle_m / 180.0) * pi) t_2 = cos(t_1) tmp = 0.0 if (Float64(angle_m / 180.0) <= 1e-241) tmp = Float64(2.0 * Float64((Float64(b * sqrt(sin(Float64(pi * Float64(angle_m * 0.005555555555555556))))) ^ 2.0) * t_2)); elseif (Float64(angle_m / 180.0) <= 4e+72) tmp = Float64(2.0 * Float64(t_2 * Float64(t_0 * sin(t_1)))); else tmp = Float64(2.0 * Float64(t_0 * Float64(exp(log1p(sin(Float64(1.0 / Float64(180.0 / Float64(angle_m * pi)))))) + -1.0))); end return Float64(angle_s * tmp) end
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_, b_, angle$95$m_] := Block[{t$95$0 = N[(N[(b + a), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(angle$95$m / 180.0), $MachinePrecision] * Pi), $MachinePrecision]}, Block[{t$95$2 = N[Cos[t$95$1], $MachinePrecision]}, N[(angle$95$s * If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 1e-241], N[(2.0 * N[(N[Power[N[(b * N[Sqrt[N[Sin[N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 4e+72], N[(2.0 * N[(t$95$2 * N[(t$95$0 * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(t$95$0 * N[(N[Exp[N[Log[1 + N[Sin[N[(1.0 / N[(180.0 / N[(angle$95$m * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
angle_s = \mathsf{copysign}\left(1, angle\right)
\\
\begin{array}{l}
t_0 := \left(b + a\right) \cdot \left(b - a\right)\\
t_1 := \frac{angle_m}{180} \cdot \pi\\
t_2 := \cos t_1\\
angle_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{angle_m}{180} \leq 10^{-241}:\\
\;\;\;\;2 \cdot \left({\left(b \cdot \sqrt{\sin \left(\pi \cdot \left(angle_m \cdot 0.005555555555555556\right)\right)}\right)}^{2} \cdot t_2\right)\\
\mathbf{elif}\;\frac{angle_m}{180} \leq 4 \cdot 10^{+72}:\\
\;\;\;\;2 \cdot \left(t_2 \cdot \left(t_0 \cdot \sin t_1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(t_0 \cdot \left(e^{\mathsf{log1p}\left(\sin \left(\frac{1}{\frac{180}{angle_m \cdot \pi}}\right)\right)} + -1\right)\right)\\
\end{array}
\end{array}
\end{array}
if (/.f64 angle 180) < 9.9999999999999997e-242Initial program 48.9%
associate-*l*48.9%
associate-*l*48.9%
Simplified48.9%
Taylor expanded in b around inf 37.0%
add-sqr-sqrt20.1%
pow220.1%
div-inv20.2%
metadata-eval20.2%
sqrt-prod11.2%
unpow211.2%
sqrt-prod7.5%
add-sqr-sqrt14.3%
Applied egg-rr14.3%
if 9.9999999999999997e-242 < (/.f64 angle 180) < 3.99999999999999978e72Initial program 65.5%
associate-*l*65.5%
associate-*l*65.5%
Simplified65.5%
unpow265.5%
unpow265.5%
difference-of-squares76.3%
Applied egg-rr76.3%
if 3.99999999999999978e72 < (/.f64 angle 180) Initial program 20.7%
associate-*l*20.7%
associate-*l*20.7%
Simplified20.7%
unpow220.7%
unpow220.7%
difference-of-squares20.8%
Applied egg-rr20.8%
Taylor expanded in angle around 0 36.9%
expm1-log1p-u36.9%
expm1-udef36.9%
div-inv36.0%
metadata-eval36.0%
Applied egg-rr36.0%
metadata-eval36.0%
div-inv36.9%
associate-*r/39.7%
clear-num42.0%
Applied egg-rr42.0%
Final simplification34.5%
angle_m = (fabs.f64 angle)
angle_s = (copysign.f64 1 angle)
(FPCore (angle_s a b angle_m)
:precision binary64
(let* ((t_0
(*
(* (+ b a) (- b a))
(sin (* 0.005555555555555556 (* angle_m PI))))))
(*
angle_s
(if (<= (/ angle_m 180.0) 1e+44)
(* 2.0 (* (cos (* (/ angle_m 180.0) PI)) t_0))
(* 2.0 t_0)))))angle_m = fabs(angle);
angle_s = copysign(1.0, angle);
double code(double angle_s, double a, double b, double angle_m) {
double t_0 = ((b + a) * (b - a)) * sin((0.005555555555555556 * (angle_m * ((double) M_PI))));
double tmp;
if ((angle_m / 180.0) <= 1e+44) {
tmp = 2.0 * (cos(((angle_m / 180.0) * ((double) M_PI))) * t_0);
} else {
tmp = 2.0 * t_0;
}
return angle_s * tmp;
}
angle_m = Math.abs(angle);
angle_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a, double b, double angle_m) {
double t_0 = ((b + a) * (b - a)) * Math.sin((0.005555555555555556 * (angle_m * Math.PI)));
double tmp;
if ((angle_m / 180.0) <= 1e+44) {
tmp = 2.0 * (Math.cos(((angle_m / 180.0) * Math.PI)) * t_0);
} else {
tmp = 2.0 * t_0;
}
return angle_s * tmp;
}
angle_m = math.fabs(angle) angle_s = math.copysign(1.0, angle) def code(angle_s, a, b, angle_m): t_0 = ((b + a) * (b - a)) * math.sin((0.005555555555555556 * (angle_m * math.pi))) tmp = 0 if (angle_m / 180.0) <= 1e+44: tmp = 2.0 * (math.cos(((angle_m / 180.0) * math.pi)) * t_0) else: tmp = 2.0 * t_0 return angle_s * tmp
angle_m = abs(angle) angle_s = copysign(1.0, angle) function code(angle_s, a, b, angle_m) t_0 = Float64(Float64(Float64(b + a) * Float64(b - a)) * sin(Float64(0.005555555555555556 * Float64(angle_m * pi)))) tmp = 0.0 if (Float64(angle_m / 180.0) <= 1e+44) tmp = Float64(2.0 * Float64(cos(Float64(Float64(angle_m / 180.0) * pi)) * t_0)); else tmp = Float64(2.0 * t_0); end return Float64(angle_s * tmp) end
angle_m = abs(angle); angle_s = sign(angle) * abs(1.0); function tmp_2 = code(angle_s, a, b, angle_m) t_0 = ((b + a) * (b - a)) * sin((0.005555555555555556 * (angle_m * pi))); tmp = 0.0; if ((angle_m / 180.0) <= 1e+44) tmp = 2.0 * (cos(((angle_m / 180.0) * pi)) * t_0); else tmp = 2.0 * t_0; end tmp_2 = angle_s * tmp; end
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_, b_, angle$95$m_] := Block[{t$95$0 = N[(N[(N[(b + a), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision] * N[Sin[N[(0.005555555555555556 * N[(angle$95$m * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, N[(angle$95$s * If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 1e+44], N[(2.0 * N[(N[Cos[N[(N[(angle$95$m / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], N[(2.0 * t$95$0), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
angle_s = \mathsf{copysign}\left(1, angle\right)
\\
\begin{array}{l}
t_0 := \left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \sin \left(0.005555555555555556 \cdot \left(angle_m \cdot \pi\right)\right)\\
angle_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{angle_m}{180} \leq 10^{+44}:\\
\;\;\;\;2 \cdot \left(\cos \left(\frac{angle_m}{180} \cdot \pi\right) \cdot t_0\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot t_0\\
\end{array}
\end{array}
\end{array}
if (/.f64 angle 180) < 1.0000000000000001e44Initial program 54.7%
associate-*l*54.7%
associate-*l*54.7%
Simplified54.7%
unpow254.7%
unpow254.7%
difference-of-squares61.9%
Applied egg-rr61.9%
Taylor expanded in angle around inf 63.7%
if 1.0000000000000001e44 < (/.f64 angle 180) Initial program 22.3%
associate-*l*22.3%
associate-*l*22.3%
Simplified22.3%
unpow222.3%
unpow222.3%
difference-of-squares26.5%
Applied egg-rr26.5%
Taylor expanded in angle around 0 38.2%
Taylor expanded in angle around inf 40.8%
Final simplification59.4%
angle_m = (fabs.f64 angle)
angle_s = (copysign.f64 1 angle)
(FPCore (angle_s a b angle_m)
:precision binary64
(let* ((t_0 (* (+ b a) (- b a))))
(*
angle_s
(if (<= (/ angle_m 180.0) 4e+72)
(*
2.0
(*
(cos (* (/ angle_m 180.0) PI))
(* t_0 (sin (* angle_m (* PI 0.005555555555555556))))))
(* 2.0 (* t_0 (sin (* 0.005555555555555556 (* angle_m PI)))))))))angle_m = fabs(angle);
angle_s = copysign(1.0, angle);
double code(double angle_s, double a, double b, double angle_m) {
double t_0 = (b + a) * (b - a);
double tmp;
if ((angle_m / 180.0) <= 4e+72) {
tmp = 2.0 * (cos(((angle_m / 180.0) * ((double) M_PI))) * (t_0 * sin((angle_m * (((double) M_PI) * 0.005555555555555556)))));
} else {
tmp = 2.0 * (t_0 * sin((0.005555555555555556 * (angle_m * ((double) M_PI)))));
}
return angle_s * tmp;
}
angle_m = Math.abs(angle);
angle_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a, double b, double angle_m) {
double t_0 = (b + a) * (b - a);
double tmp;
if ((angle_m / 180.0) <= 4e+72) {
tmp = 2.0 * (Math.cos(((angle_m / 180.0) * Math.PI)) * (t_0 * Math.sin((angle_m * (Math.PI * 0.005555555555555556)))));
} else {
tmp = 2.0 * (t_0 * Math.sin((0.005555555555555556 * (angle_m * Math.PI))));
}
return angle_s * tmp;
}
angle_m = math.fabs(angle) angle_s = math.copysign(1.0, angle) def code(angle_s, a, b, angle_m): t_0 = (b + a) * (b - a) tmp = 0 if (angle_m / 180.0) <= 4e+72: tmp = 2.0 * (math.cos(((angle_m / 180.0) * math.pi)) * (t_0 * math.sin((angle_m * (math.pi * 0.005555555555555556))))) else: tmp = 2.0 * (t_0 * math.sin((0.005555555555555556 * (angle_m * math.pi)))) return angle_s * tmp
angle_m = abs(angle) angle_s = copysign(1.0, angle) function code(angle_s, a, b, angle_m) t_0 = Float64(Float64(b + a) * Float64(b - a)) tmp = 0.0 if (Float64(angle_m / 180.0) <= 4e+72) tmp = Float64(2.0 * Float64(cos(Float64(Float64(angle_m / 180.0) * pi)) * Float64(t_0 * sin(Float64(angle_m * Float64(pi * 0.005555555555555556)))))); else tmp = Float64(2.0 * Float64(t_0 * sin(Float64(0.005555555555555556 * Float64(angle_m * pi))))); end return Float64(angle_s * tmp) end
angle_m = abs(angle); angle_s = sign(angle) * abs(1.0); function tmp_2 = code(angle_s, a, b, angle_m) t_0 = (b + a) * (b - a); tmp = 0.0; if ((angle_m / 180.0) <= 4e+72) tmp = 2.0 * (cos(((angle_m / 180.0) * pi)) * (t_0 * sin((angle_m * (pi * 0.005555555555555556))))); else tmp = 2.0 * (t_0 * sin((0.005555555555555556 * (angle_m * pi)))); end tmp_2 = angle_s * tmp; end
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_, b_, angle$95$m_] := Block[{t$95$0 = N[(N[(b + a), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision]}, N[(angle$95$s * If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 4e+72], N[(2.0 * N[(N[Cos[N[(N[(angle$95$m / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 * N[Sin[N[(angle$95$m * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(t$95$0 * N[Sin[N[(0.005555555555555556 * N[(angle$95$m * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
angle_s = \mathsf{copysign}\left(1, angle\right)
\\
\begin{array}{l}
t_0 := \left(b + a\right) \cdot \left(b - a\right)\\
angle_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{angle_m}{180} \leq 4 \cdot 10^{+72}:\\
\;\;\;\;2 \cdot \left(\cos \left(\frac{angle_m}{180} \cdot \pi\right) \cdot \left(t_0 \cdot \sin \left(angle_m \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(t_0 \cdot \sin \left(0.005555555555555556 \cdot \left(angle_m \cdot \pi\right)\right)\right)\\
\end{array}
\end{array}
\end{array}
if (/.f64 angle 180) < 3.99999999999999978e72Initial program 53.9%
associate-*l*53.9%
associate-*l*53.9%
Simplified53.9%
unpow253.9%
unpow253.9%
difference-of-squares61.9%
Applied egg-rr61.9%
Taylor expanded in angle around inf 62.2%
*-commutative62.2%
associate-*l*63.3%
Simplified63.3%
if 3.99999999999999978e72 < (/.f64 angle 180) Initial program 20.7%
associate-*l*20.7%
associate-*l*20.7%
Simplified20.7%
unpow220.7%
unpow220.7%
difference-of-squares20.8%
Applied egg-rr20.8%
Taylor expanded in angle around 0 36.9%
Taylor expanded in angle around inf 42.3%
Final simplification59.9%
angle_m = (fabs.f64 angle)
angle_s = (copysign.f64 1 angle)
(FPCore (angle_s a b angle_m)
:precision binary64
(let* ((t_0 (* (+ b a) (- b a))))
(*
angle_s
(if (<= (/ angle_m 180.0) 4e+72)
(*
2.0
(*
(cos (* (/ angle_m 180.0) PI))
(* (sin (* PI (* angle_m 0.005555555555555556))) t_0)))
(* 2.0 (* t_0 (sin (* 0.005555555555555556 (* angle_m PI)))))))))angle_m = fabs(angle);
angle_s = copysign(1.0, angle);
double code(double angle_s, double a, double b, double angle_m) {
double t_0 = (b + a) * (b - a);
double tmp;
if ((angle_m / 180.0) <= 4e+72) {
tmp = 2.0 * (cos(((angle_m / 180.0) * ((double) M_PI))) * (sin((((double) M_PI) * (angle_m * 0.005555555555555556))) * t_0));
} else {
tmp = 2.0 * (t_0 * sin((0.005555555555555556 * (angle_m * ((double) M_PI)))));
}
return angle_s * tmp;
}
angle_m = Math.abs(angle);
angle_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a, double b, double angle_m) {
double t_0 = (b + a) * (b - a);
double tmp;
if ((angle_m / 180.0) <= 4e+72) {
tmp = 2.0 * (Math.cos(((angle_m / 180.0) * Math.PI)) * (Math.sin((Math.PI * (angle_m * 0.005555555555555556))) * t_0));
} else {
tmp = 2.0 * (t_0 * Math.sin((0.005555555555555556 * (angle_m * Math.PI))));
}
return angle_s * tmp;
}
angle_m = math.fabs(angle) angle_s = math.copysign(1.0, angle) def code(angle_s, a, b, angle_m): t_0 = (b + a) * (b - a) tmp = 0 if (angle_m / 180.0) <= 4e+72: tmp = 2.0 * (math.cos(((angle_m / 180.0) * math.pi)) * (math.sin((math.pi * (angle_m * 0.005555555555555556))) * t_0)) else: tmp = 2.0 * (t_0 * math.sin((0.005555555555555556 * (angle_m * math.pi)))) return angle_s * tmp
angle_m = abs(angle) angle_s = copysign(1.0, angle) function code(angle_s, a, b, angle_m) t_0 = Float64(Float64(b + a) * Float64(b - a)) tmp = 0.0 if (Float64(angle_m / 180.0) <= 4e+72) tmp = Float64(2.0 * Float64(cos(Float64(Float64(angle_m / 180.0) * pi)) * Float64(sin(Float64(pi * Float64(angle_m * 0.005555555555555556))) * t_0))); else tmp = Float64(2.0 * Float64(t_0 * sin(Float64(0.005555555555555556 * Float64(angle_m * pi))))); end return Float64(angle_s * tmp) end
angle_m = abs(angle); angle_s = sign(angle) * abs(1.0); function tmp_2 = code(angle_s, a, b, angle_m) t_0 = (b + a) * (b - a); tmp = 0.0; if ((angle_m / 180.0) <= 4e+72) tmp = 2.0 * (cos(((angle_m / 180.0) * pi)) * (sin((pi * (angle_m * 0.005555555555555556))) * t_0)); else tmp = 2.0 * (t_0 * sin((0.005555555555555556 * (angle_m * pi)))); end tmp_2 = angle_s * tmp; end
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_, b_, angle$95$m_] := Block[{t$95$0 = N[(N[(b + a), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision]}, N[(angle$95$s * If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 4e+72], N[(2.0 * N[(N[Cos[N[(N[(angle$95$m / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision] * N[(N[Sin[N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(t$95$0 * N[Sin[N[(0.005555555555555556 * N[(angle$95$m * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
angle_s = \mathsf{copysign}\left(1, angle\right)
\\
\begin{array}{l}
t_0 := \left(b + a\right) \cdot \left(b - a\right)\\
angle_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{angle_m}{180} \leq 4 \cdot 10^{+72}:\\
\;\;\;\;2 \cdot \left(\cos \left(\frac{angle_m}{180} \cdot \pi\right) \cdot \left(\sin \left(\pi \cdot \left(angle_m \cdot 0.005555555555555556\right)\right) \cdot t_0\right)\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(t_0 \cdot \sin \left(0.005555555555555556 \cdot \left(angle_m \cdot \pi\right)\right)\right)\\
\end{array}
\end{array}
\end{array}
if (/.f64 angle 180) < 3.99999999999999978e72Initial program 53.9%
associate-*l*53.9%
associate-*l*53.9%
Simplified53.9%
unpow253.9%
unpow253.9%
difference-of-squares61.9%
Applied egg-rr61.9%
Taylor expanded in angle around inf 62.2%
*-commutative62.2%
*-commutative62.2%
associate-*r*61.9%
Simplified61.9%
if 3.99999999999999978e72 < (/.f64 angle 180) Initial program 20.7%
associate-*l*20.7%
associate-*l*20.7%
Simplified20.7%
unpow220.7%
unpow220.7%
difference-of-squares20.8%
Applied egg-rr20.8%
Taylor expanded in angle around 0 36.9%
Taylor expanded in angle around inf 42.3%
Final simplification58.7%
angle_m = (fabs.f64 angle)
angle_s = (copysign.f64 1 angle)
(FPCore (angle_s a b angle_m)
:precision binary64
(let* ((t_0 (* (/ angle_m 180.0) PI)) (t_1 (* (+ b a) (- b a))))
(*
angle_s
(if (<= (/ angle_m 180.0) 4e+72)
(* 2.0 (* (cos t_0) (* t_1 (sin t_0))))
(* 2.0 (* t_1 (sin (* 0.005555555555555556 (* angle_m PI)))))))))angle_m = fabs(angle);
angle_s = copysign(1.0, angle);
double code(double angle_s, double a, double b, double angle_m) {
double t_0 = (angle_m / 180.0) * ((double) M_PI);
double t_1 = (b + a) * (b - a);
double tmp;
if ((angle_m / 180.0) <= 4e+72) {
tmp = 2.0 * (cos(t_0) * (t_1 * sin(t_0)));
} else {
tmp = 2.0 * (t_1 * sin((0.005555555555555556 * (angle_m * ((double) M_PI)))));
}
return angle_s * tmp;
}
angle_m = Math.abs(angle);
angle_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a, double b, double angle_m) {
double t_0 = (angle_m / 180.0) * Math.PI;
double t_1 = (b + a) * (b - a);
double tmp;
if ((angle_m / 180.0) <= 4e+72) {
tmp = 2.0 * (Math.cos(t_0) * (t_1 * Math.sin(t_0)));
} else {
tmp = 2.0 * (t_1 * Math.sin((0.005555555555555556 * (angle_m * Math.PI))));
}
return angle_s * tmp;
}
angle_m = math.fabs(angle) angle_s = math.copysign(1.0, angle) def code(angle_s, a, b, angle_m): t_0 = (angle_m / 180.0) * math.pi t_1 = (b + a) * (b - a) tmp = 0 if (angle_m / 180.0) <= 4e+72: tmp = 2.0 * (math.cos(t_0) * (t_1 * math.sin(t_0))) else: tmp = 2.0 * (t_1 * math.sin((0.005555555555555556 * (angle_m * math.pi)))) return angle_s * tmp
angle_m = abs(angle) angle_s = copysign(1.0, angle) function code(angle_s, a, b, angle_m) t_0 = Float64(Float64(angle_m / 180.0) * pi) t_1 = Float64(Float64(b + a) * Float64(b - a)) tmp = 0.0 if (Float64(angle_m / 180.0) <= 4e+72) tmp = Float64(2.0 * Float64(cos(t_0) * Float64(t_1 * sin(t_0)))); else tmp = Float64(2.0 * Float64(t_1 * sin(Float64(0.005555555555555556 * Float64(angle_m * pi))))); end return Float64(angle_s * tmp) end
angle_m = abs(angle); angle_s = sign(angle) * abs(1.0); function tmp_2 = code(angle_s, a, b, angle_m) t_0 = (angle_m / 180.0) * pi; t_1 = (b + a) * (b - a); tmp = 0.0; if ((angle_m / 180.0) <= 4e+72) tmp = 2.0 * (cos(t_0) * (t_1 * sin(t_0))); else tmp = 2.0 * (t_1 * sin((0.005555555555555556 * (angle_m * pi)))); end tmp_2 = angle_s * tmp; end
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_, b_, angle$95$m_] := Block[{t$95$0 = N[(N[(angle$95$m / 180.0), $MachinePrecision] * Pi), $MachinePrecision]}, Block[{t$95$1 = N[(N[(b + a), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision]}, N[(angle$95$s * If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 4e+72], N[(2.0 * N[(N[Cos[t$95$0], $MachinePrecision] * N[(t$95$1 * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(t$95$1 * N[Sin[N[(0.005555555555555556 * N[(angle$95$m * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
angle_s = \mathsf{copysign}\left(1, angle\right)
\\
\begin{array}{l}
t_0 := \frac{angle_m}{180} \cdot \pi\\
t_1 := \left(b + a\right) \cdot \left(b - a\right)\\
angle_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{angle_m}{180} \leq 4 \cdot 10^{+72}:\\
\;\;\;\;2 \cdot \left(\cos t_0 \cdot \left(t_1 \cdot \sin t_0\right)\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(t_1 \cdot \sin \left(0.005555555555555556 \cdot \left(angle_m \cdot \pi\right)\right)\right)\\
\end{array}
\end{array}
\end{array}
if (/.f64 angle 180) < 3.99999999999999978e72Initial program 53.9%
associate-*l*53.9%
associate-*l*53.9%
Simplified53.9%
unpow253.9%
unpow253.9%
difference-of-squares61.9%
Applied egg-rr61.9%
if 3.99999999999999978e72 < (/.f64 angle 180) Initial program 20.7%
associate-*l*20.7%
associate-*l*20.7%
Simplified20.7%
unpow220.7%
unpow220.7%
difference-of-squares20.8%
Applied egg-rr20.8%
Taylor expanded in angle around 0 36.9%
Taylor expanded in angle around inf 42.3%
Final simplification58.7%
angle_m = (fabs.f64 angle)
angle_s = (copysign.f64 1 angle)
(FPCore (angle_s a b angle_m)
:precision binary64
(let* ((t_0 (* (/ angle_m 180.0) PI)) (t_1 (* (+ b a) (- b a))))
(*
angle_s
(if (<= (/ angle_m 180.0) 4e+72)
(* 2.0 (* (cos t_0) (* t_1 (sin t_0))))
(*
2.0
(*
t_1
(+ (exp (log1p (sin (/ 1.0 (/ 180.0 (* angle_m PI)))))) -1.0)))))))angle_m = fabs(angle);
angle_s = copysign(1.0, angle);
double code(double angle_s, double a, double b, double angle_m) {
double t_0 = (angle_m / 180.0) * ((double) M_PI);
double t_1 = (b + a) * (b - a);
double tmp;
if ((angle_m / 180.0) <= 4e+72) {
tmp = 2.0 * (cos(t_0) * (t_1 * sin(t_0)));
} else {
tmp = 2.0 * (t_1 * (exp(log1p(sin((1.0 / (180.0 / (angle_m * ((double) M_PI))))))) + -1.0));
}
return angle_s * tmp;
}
angle_m = Math.abs(angle);
angle_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a, double b, double angle_m) {
double t_0 = (angle_m / 180.0) * Math.PI;
double t_1 = (b + a) * (b - a);
double tmp;
if ((angle_m / 180.0) <= 4e+72) {
tmp = 2.0 * (Math.cos(t_0) * (t_1 * Math.sin(t_0)));
} else {
tmp = 2.0 * (t_1 * (Math.exp(Math.log1p(Math.sin((1.0 / (180.0 / (angle_m * Math.PI)))))) + -1.0));
}
return angle_s * tmp;
}
angle_m = math.fabs(angle) angle_s = math.copysign(1.0, angle) def code(angle_s, a, b, angle_m): t_0 = (angle_m / 180.0) * math.pi t_1 = (b + a) * (b - a) tmp = 0 if (angle_m / 180.0) <= 4e+72: tmp = 2.0 * (math.cos(t_0) * (t_1 * math.sin(t_0))) else: tmp = 2.0 * (t_1 * (math.exp(math.log1p(math.sin((1.0 / (180.0 / (angle_m * math.pi)))))) + -1.0)) return angle_s * tmp
angle_m = abs(angle) angle_s = copysign(1.0, angle) function code(angle_s, a, b, angle_m) t_0 = Float64(Float64(angle_m / 180.0) * pi) t_1 = Float64(Float64(b + a) * Float64(b - a)) tmp = 0.0 if (Float64(angle_m / 180.0) <= 4e+72) tmp = Float64(2.0 * Float64(cos(t_0) * Float64(t_1 * sin(t_0)))); else tmp = Float64(2.0 * Float64(t_1 * Float64(exp(log1p(sin(Float64(1.0 / Float64(180.0 / Float64(angle_m * pi)))))) + -1.0))); end return Float64(angle_s * tmp) end
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_, b_, angle$95$m_] := Block[{t$95$0 = N[(N[(angle$95$m / 180.0), $MachinePrecision] * Pi), $MachinePrecision]}, Block[{t$95$1 = N[(N[(b + a), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision]}, N[(angle$95$s * If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 4e+72], N[(2.0 * N[(N[Cos[t$95$0], $MachinePrecision] * N[(t$95$1 * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(t$95$1 * N[(N[Exp[N[Log[1 + N[Sin[N[(1.0 / N[(180.0 / N[(angle$95$m * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
angle_s = \mathsf{copysign}\left(1, angle\right)
\\
\begin{array}{l}
t_0 := \frac{angle_m}{180} \cdot \pi\\
t_1 := \left(b + a\right) \cdot \left(b - a\right)\\
angle_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{angle_m}{180} \leq 4 \cdot 10^{+72}:\\
\;\;\;\;2 \cdot \left(\cos t_0 \cdot \left(t_1 \cdot \sin t_0\right)\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(t_1 \cdot \left(e^{\mathsf{log1p}\left(\sin \left(\frac{1}{\frac{180}{angle_m \cdot \pi}}\right)\right)} + -1\right)\right)\\
\end{array}
\end{array}
\end{array}
if (/.f64 angle 180) < 3.99999999999999978e72Initial program 53.9%
associate-*l*53.9%
associate-*l*53.9%
Simplified53.9%
unpow253.9%
unpow253.9%
difference-of-squares61.9%
Applied egg-rr61.9%
if 3.99999999999999978e72 < (/.f64 angle 180) Initial program 20.7%
associate-*l*20.7%
associate-*l*20.7%
Simplified20.7%
unpow220.7%
unpow220.7%
difference-of-squares20.8%
Applied egg-rr20.8%
Taylor expanded in angle around 0 36.9%
expm1-log1p-u36.9%
expm1-udef36.9%
div-inv36.0%
metadata-eval36.0%
Applied egg-rr36.0%
metadata-eval36.0%
div-inv36.9%
associate-*r/39.7%
clear-num42.0%
Applied egg-rr42.0%
Final simplification58.7%
angle_m = (fabs.f64 angle) angle_s = (copysign.f64 1 angle) (FPCore (angle_s a b angle_m) :precision binary64 (* angle_s (* 2.0 (* (* (+ b a) (- b a)) (sin (* 0.005555555555555556 (* angle_m PI)))))))
angle_m = fabs(angle);
angle_s = copysign(1.0, angle);
double code(double angle_s, double a, double b, double angle_m) {
return angle_s * (2.0 * (((b + a) * (b - a)) * sin((0.005555555555555556 * (angle_m * ((double) M_PI))))));
}
angle_m = Math.abs(angle);
angle_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a, double b, double angle_m) {
return angle_s * (2.0 * (((b + a) * (b - a)) * Math.sin((0.005555555555555556 * (angle_m * Math.PI)))));
}
angle_m = math.fabs(angle) angle_s = math.copysign(1.0, angle) def code(angle_s, a, b, angle_m): return angle_s * (2.0 * (((b + a) * (b - a)) * math.sin((0.005555555555555556 * (angle_m * math.pi)))))
angle_m = abs(angle) angle_s = copysign(1.0, angle) function code(angle_s, a, b, angle_m) return Float64(angle_s * Float64(2.0 * Float64(Float64(Float64(b + a) * Float64(b - a)) * sin(Float64(0.005555555555555556 * Float64(angle_m * pi)))))) end
angle_m = abs(angle); angle_s = sign(angle) * abs(1.0); function tmp = code(angle_s, a, b, angle_m) tmp = angle_s * (2.0 * (((b + a) * (b - a)) * sin((0.005555555555555556 * (angle_m * pi))))); end
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_, b_, angle$95$m_] := N[(angle$95$s * N[(2.0 * N[(N[(N[(b + a), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision] * N[Sin[N[(0.005555555555555556 * N[(angle$95$m * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
angle_s = \mathsf{copysign}\left(1, angle\right)
\\
angle_s \cdot \left(2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \sin \left(0.005555555555555556 \cdot \left(angle_m \cdot \pi\right)\right)\right)\right)
\end{array}
Initial program 48.6%
associate-*l*48.6%
associate-*l*48.6%
Simplified48.6%
unpow248.6%
unpow248.6%
difference-of-squares55.3%
Applied egg-rr55.3%
Taylor expanded in angle around 0 56.9%
Taylor expanded in angle around inf 59.0%
Final simplification59.0%
angle_m = (fabs.f64 angle) angle_s = (copysign.f64 1 angle) (FPCore (angle_s a b angle_m) :precision binary64 (* angle_s (* 2.0 (* (* (+ b a) (- b a)) (* 0.005555555555555556 (* angle_m PI))))))
angle_m = fabs(angle);
angle_s = copysign(1.0, angle);
double code(double angle_s, double a, double b, double angle_m) {
return angle_s * (2.0 * (((b + a) * (b - a)) * (0.005555555555555556 * (angle_m * ((double) M_PI)))));
}
angle_m = Math.abs(angle);
angle_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a, double b, double angle_m) {
return angle_s * (2.0 * (((b + a) * (b - a)) * (0.005555555555555556 * (angle_m * Math.PI))));
}
angle_m = math.fabs(angle) angle_s = math.copysign(1.0, angle) def code(angle_s, a, b, angle_m): return angle_s * (2.0 * (((b + a) * (b - a)) * (0.005555555555555556 * (angle_m * math.pi))))
angle_m = abs(angle) angle_s = copysign(1.0, angle) function code(angle_s, a, b, angle_m) return Float64(angle_s * Float64(2.0 * Float64(Float64(Float64(b + a) * Float64(b - a)) * Float64(0.005555555555555556 * Float64(angle_m * pi))))) end
angle_m = abs(angle); angle_s = sign(angle) * abs(1.0); function tmp = code(angle_s, a, b, angle_m) tmp = angle_s * (2.0 * (((b + a) * (b - a)) * (0.005555555555555556 * (angle_m * pi)))); end
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_, b_, angle$95$m_] := N[(angle$95$s * N[(2.0 * N[(N[(N[(b + a), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision] * N[(0.005555555555555556 * N[(angle$95$m * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
angle_s = \mathsf{copysign}\left(1, angle\right)
\\
angle_s \cdot \left(2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(0.005555555555555556 \cdot \left(angle_m \cdot \pi\right)\right)\right)\right)
\end{array}
Initial program 48.6%
associate-*l*48.6%
associate-*l*48.6%
Simplified48.6%
unpow248.6%
unpow248.6%
difference-of-squares55.3%
Applied egg-rr55.3%
Taylor expanded in angle around 0 56.9%
Taylor expanded in angle around 0 52.2%
Final simplification52.2%
angle_m = (fabs.f64 angle) angle_s = (copysign.f64 1 angle) (FPCore (angle_s a b angle_m) :precision binary64 (* angle_s (* 2.0 (* (* (+ b a) (- b a)) (* angle_m (* PI 0.005555555555555556))))))
angle_m = fabs(angle);
angle_s = copysign(1.0, angle);
double code(double angle_s, double a, double b, double angle_m) {
return angle_s * (2.0 * (((b + a) * (b - a)) * (angle_m * (((double) M_PI) * 0.005555555555555556))));
}
angle_m = Math.abs(angle);
angle_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a, double b, double angle_m) {
return angle_s * (2.0 * (((b + a) * (b - a)) * (angle_m * (Math.PI * 0.005555555555555556))));
}
angle_m = math.fabs(angle) angle_s = math.copysign(1.0, angle) def code(angle_s, a, b, angle_m): return angle_s * (2.0 * (((b + a) * (b - a)) * (angle_m * (math.pi * 0.005555555555555556))))
angle_m = abs(angle) angle_s = copysign(1.0, angle) function code(angle_s, a, b, angle_m) return Float64(angle_s * Float64(2.0 * Float64(Float64(Float64(b + a) * Float64(b - a)) * Float64(angle_m * Float64(pi * 0.005555555555555556))))) end
angle_m = abs(angle); angle_s = sign(angle) * abs(1.0); function tmp = code(angle_s, a, b, angle_m) tmp = angle_s * (2.0 * (((b + a) * (b - a)) * (angle_m * (pi * 0.005555555555555556)))); end
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_, b_, angle$95$m_] := N[(angle$95$s * N[(2.0 * N[(N[(N[(b + a), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision] * N[(angle$95$m * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
angle_s = \mathsf{copysign}\left(1, angle\right)
\\
angle_s \cdot \left(2 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(angle_m \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)\right)
\end{array}
Initial program 48.6%
associate-*l*48.6%
associate-*l*48.6%
Simplified48.6%
unpow248.6%
unpow248.6%
difference-of-squares55.3%
Applied egg-rr55.3%
Taylor expanded in angle around 0 56.9%
Taylor expanded in angle around 0 52.2%
*-commutative52.2%
associate-*l*52.2%
Simplified52.2%
Final simplification52.2%
angle_m = (fabs.f64 angle) angle_s = (copysign.f64 1 angle) (FPCore (angle_s a b angle_m) :precision binary64 (* angle_s (* 0.011111111111111112 (* angle_m (* PI (* (+ b a) (- b a)))))))
angle_m = fabs(angle);
angle_s = copysign(1.0, angle);
double code(double angle_s, double a, double b, double angle_m) {
return angle_s * (0.011111111111111112 * (angle_m * (((double) M_PI) * ((b + a) * (b - a)))));
}
angle_m = Math.abs(angle);
angle_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a, double b, double angle_m) {
return angle_s * (0.011111111111111112 * (angle_m * (Math.PI * ((b + a) * (b - a)))));
}
angle_m = math.fabs(angle) angle_s = math.copysign(1.0, angle) def code(angle_s, a, b, angle_m): return angle_s * (0.011111111111111112 * (angle_m * (math.pi * ((b + a) * (b - a)))))
angle_m = abs(angle) angle_s = copysign(1.0, angle) function code(angle_s, a, b, angle_m) return Float64(angle_s * Float64(0.011111111111111112 * Float64(angle_m * Float64(pi * Float64(Float64(b + a) * Float64(b - a)))))) end
angle_m = abs(angle); angle_s = sign(angle) * abs(1.0); function tmp = code(angle_s, a, b, angle_m) tmp = angle_s * (0.011111111111111112 * (angle_m * (pi * ((b + a) * (b - a))))); end
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_, b_, angle$95$m_] := N[(angle$95$s * N[(0.011111111111111112 * N[(angle$95$m * N[(Pi * N[(N[(b + a), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
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(b + a\right) \cdot \left(b - a\right)\right)\right)\right)\right)
\end{array}
Initial program 48.6%
associate-*l*48.6%
associate-*l*48.6%
Simplified48.6%
unpow248.6%
unpow248.6%
difference-of-squares55.3%
Applied egg-rr55.3%
Taylor expanded in angle around 0 56.9%
Taylor expanded in angle around 0 52.1%
Final simplification52.1%
angle_m = (fabs.f64 angle) angle_s = (copysign.f64 1 angle) (FPCore (angle_s a b angle_m) :precision binary64 (* angle_s (* 0.011111111111111112 (* (* (+ b a) (- b a)) (* angle_m PI)))))
angle_m = fabs(angle);
angle_s = copysign(1.0, angle);
double code(double angle_s, double a, double b, double angle_m) {
return angle_s * (0.011111111111111112 * (((b + a) * (b - a)) * (angle_m * ((double) M_PI))));
}
angle_m = Math.abs(angle);
angle_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a, double b, double angle_m) {
return angle_s * (0.011111111111111112 * (((b + a) * (b - a)) * (angle_m * Math.PI)));
}
angle_m = math.fabs(angle) angle_s = math.copysign(1.0, angle) def code(angle_s, a, b, angle_m): return angle_s * (0.011111111111111112 * (((b + a) * (b - a)) * (angle_m * math.pi)))
angle_m = abs(angle) angle_s = copysign(1.0, angle) function code(angle_s, a, b, angle_m) return Float64(angle_s * Float64(0.011111111111111112 * Float64(Float64(Float64(b + a) * Float64(b - a)) * Float64(angle_m * pi)))) end
angle_m = abs(angle); angle_s = sign(angle) * abs(1.0); function tmp = code(angle_s, a, b, angle_m) tmp = angle_s * (0.011111111111111112 * (((b + a) * (b - a)) * (angle_m * pi))); end
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_, b_, angle$95$m_] := N[(angle$95$s * N[(0.011111111111111112 * N[(N[(N[(b + a), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision] * N[(angle$95$m * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
angle_s = \mathsf{copysign}\left(1, angle\right)
\\
angle_s \cdot \left(0.011111111111111112 \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(angle_m \cdot \pi\right)\right)\right)
\end{array}
Initial program 48.6%
associate-*l*48.6%
associate-*l*48.6%
Simplified48.6%
unpow248.6%
unpow248.6%
difference-of-squares55.3%
Applied egg-rr55.3%
Taylor expanded in angle around 0 56.9%
Taylor expanded in angle around 0 52.1%
associate-*r*52.1%
Simplified52.1%
Final simplification52.1%
herbie shell --seed 2023333
(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)))))