
(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 14 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 1 angle)
(FPCore (angle_s a_m b angle_m)
:precision binary64
(let* ((t_0 (* angle_m (* PI (+ b a_m))))
(t_1 (* PI (* 0.005555555555555556 angle_m)))
(t_2 (* (+ b a_m) (- b a_m))))
(*
angle_s
(if (<= (/ angle_m 180.0) 1e-134)
(* 0.011111111111111112 (- (* b t_0) (* a_m t_0)))
(if (<= (/ angle_m 180.0) 2e+168)
(*
t_2
(* 2.0 (* (sin (expm1 (log1p t_1))) (cos (/ (* angle_m PI) 180.0)))))
(if (<= (/ angle_m 180.0) 1e+268)
(* t_2 (sin (* 2.0 (* 0.005555555555555556 (* angle_m PI)))))
(if (<= (/ angle_m 180.0) 1e+288)
(* 2.0 (* t_2 (sin (* PI (/ angle_m 180.0)))))
(*
2.0
(*
(* t_2 (sin t_1))
(cos (* (/ angle_m 180.0) (pow (sqrt PI) 2.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 = angle_m * (((double) M_PI) * (b + a_m));
double t_1 = ((double) M_PI) * (0.005555555555555556 * angle_m);
double t_2 = (b + a_m) * (b - a_m);
double tmp;
if ((angle_m / 180.0) <= 1e-134) {
tmp = 0.011111111111111112 * ((b * t_0) - (a_m * t_0));
} else if ((angle_m / 180.0) <= 2e+168) {
tmp = t_2 * (2.0 * (sin(expm1(log1p(t_1))) * cos(((angle_m * ((double) M_PI)) / 180.0))));
} else if ((angle_m / 180.0) <= 1e+268) {
tmp = t_2 * sin((2.0 * (0.005555555555555556 * (angle_m * ((double) M_PI)))));
} else if ((angle_m / 180.0) <= 1e+288) {
tmp = 2.0 * (t_2 * sin((((double) M_PI) * (angle_m / 180.0))));
} else {
tmp = 2.0 * ((t_2 * sin(t_1)) * cos(((angle_m / 180.0) * pow(sqrt(((double) M_PI)), 2.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 = angle_m * (Math.PI * (b + a_m));
double t_1 = Math.PI * (0.005555555555555556 * angle_m);
double t_2 = (b + a_m) * (b - a_m);
double tmp;
if ((angle_m / 180.0) <= 1e-134) {
tmp = 0.011111111111111112 * ((b * t_0) - (a_m * t_0));
} else if ((angle_m / 180.0) <= 2e+168) {
tmp = t_2 * (2.0 * (Math.sin(Math.expm1(Math.log1p(t_1))) * Math.cos(((angle_m * Math.PI) / 180.0))));
} else if ((angle_m / 180.0) <= 1e+268) {
tmp = t_2 * Math.sin((2.0 * (0.005555555555555556 * (angle_m * Math.PI))));
} else if ((angle_m / 180.0) <= 1e+288) {
tmp = 2.0 * (t_2 * Math.sin((Math.PI * (angle_m / 180.0))));
} else {
tmp = 2.0 * ((t_2 * Math.sin(t_1)) * Math.cos(((angle_m / 180.0) * Math.pow(Math.sqrt(Math.PI), 2.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 = angle_m * (math.pi * (b + a_m)) t_1 = math.pi * (0.005555555555555556 * angle_m) t_2 = (b + a_m) * (b - a_m) tmp = 0 if (angle_m / 180.0) <= 1e-134: tmp = 0.011111111111111112 * ((b * t_0) - (a_m * t_0)) elif (angle_m / 180.0) <= 2e+168: tmp = t_2 * (2.0 * (math.sin(math.expm1(math.log1p(t_1))) * math.cos(((angle_m * math.pi) / 180.0)))) elif (angle_m / 180.0) <= 1e+268: tmp = t_2 * math.sin((2.0 * (0.005555555555555556 * (angle_m * math.pi)))) elif (angle_m / 180.0) <= 1e+288: tmp = 2.0 * (t_2 * math.sin((math.pi * (angle_m / 180.0)))) else: tmp = 2.0 * ((t_2 * math.sin(t_1)) * math.cos(((angle_m / 180.0) * math.pow(math.sqrt(math.pi), 2.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(angle_m * Float64(pi * Float64(b + a_m))) t_1 = Float64(pi * Float64(0.005555555555555556 * angle_m)) t_2 = Float64(Float64(b + a_m) * Float64(b - a_m)) tmp = 0.0 if (Float64(angle_m / 180.0) <= 1e-134) tmp = Float64(0.011111111111111112 * Float64(Float64(b * t_0) - Float64(a_m * t_0))); elseif (Float64(angle_m / 180.0) <= 2e+168) tmp = Float64(t_2 * Float64(2.0 * Float64(sin(expm1(log1p(t_1))) * cos(Float64(Float64(angle_m * pi) / 180.0))))); elseif (Float64(angle_m / 180.0) <= 1e+268) tmp = Float64(t_2 * sin(Float64(2.0 * Float64(0.005555555555555556 * Float64(angle_m * pi))))); elseif (Float64(angle_m / 180.0) <= 1e+288) tmp = Float64(2.0 * Float64(t_2 * sin(Float64(pi * Float64(angle_m / 180.0))))); else tmp = Float64(2.0 * Float64(Float64(t_2 * sin(t_1)) * cos(Float64(Float64(angle_m / 180.0) * (sqrt(pi) ^ 2.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[(angle$95$m * N[(Pi * N[(b + a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(Pi * N[(0.005555555555555556 * angle$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(b + a$95$m), $MachinePrecision] * N[(b - a$95$m), $MachinePrecision]), $MachinePrecision]}, N[(angle$95$s * If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 1e-134], N[(0.011111111111111112 * N[(N[(b * t$95$0), $MachinePrecision] - N[(a$95$m * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 2e+168], N[(t$95$2 * N[(2.0 * N[(N[Sin[N[(Exp[N[Log[1 + t$95$1], $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(N[(angle$95$m * Pi), $MachinePrecision] / 180.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 1e+268], N[(t$95$2 * N[Sin[N[(2.0 * N[(0.005555555555555556 * N[(angle$95$m * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 1e+288], N[(2.0 * N[(t$95$2 * N[Sin[N[(Pi * N[(angle$95$m / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(t$95$2 * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(N[(angle$95$m / 180.0), $MachinePrecision] * N[Power[N[Sqrt[Pi], $MachinePrecision], 2.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 := angle\_m \cdot \left(\pi \cdot \left(b + a\_m\right)\right)\\
t_1 := \pi \cdot \left(0.005555555555555556 \cdot angle\_m\right)\\
t_2 := \left(b + a\_m\right) \cdot \left(b - a\_m\right)\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{angle\_m}{180} \leq 10^{-134}:\\
\;\;\;\;0.011111111111111112 \cdot \left(b \cdot t\_0 - a\_m \cdot t\_0\right)\\
\mathbf{elif}\;\frac{angle\_m}{180} \leq 2 \cdot 10^{+168}:\\
\;\;\;\;t\_2 \cdot \left(2 \cdot \left(\sin \left(\mathsf{expm1}\left(\mathsf{log1p}\left(t\_1\right)\right)\right) \cdot \cos \left(\frac{angle\_m \cdot \pi}{180}\right)\right)\right)\\
\mathbf{elif}\;\frac{angle\_m}{180} \leq 10^{+268}:\\
\;\;\;\;t\_2 \cdot \sin \left(2 \cdot \left(0.005555555555555556 \cdot \left(angle\_m \cdot \pi\right)\right)\right)\\
\mathbf{elif}\;\frac{angle\_m}{180} \leq 10^{+288}:\\
\;\;\;\;2 \cdot \left(t\_2 \cdot \sin \left(\pi \cdot \frac{angle\_m}{180}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\left(t\_2 \cdot \sin t\_1\right) \cdot \cos \left(\frac{angle\_m}{180} \cdot {\left(\sqrt{\pi}\right)}^{2}\right)\right)\\
\end{array}
\end{array}
\end{array}
if (/.f64 angle 180) < 1.00000000000000004e-134Initial program 47.8%
associate-*l*47.8%
*-commutative47.8%
associate-*l*47.8%
Simplified47.8%
Taylor expanded in angle around 0 48.0%
unpow248.0%
unpow248.0%
difference-of-squares50.1%
Applied egg-rr50.1%
Taylor expanded in angle around 0 50.1%
associate-*r*50.1%
+-commutative50.1%
Simplified50.1%
associate-*r*65.4%
sub-neg65.4%
distribute-lft-in60.4%
associate-*l*60.3%
associate-*l*60.4%
Applied egg-rr60.4%
if 1.00000000000000004e-134 < (/.f64 angle 180) < 1.9999999999999999e168Initial program 70.4%
associate-*l*70.4%
*-commutative70.4%
associate-*l*70.4%
Simplified70.4%
unpow261.7%
unpow261.7%
difference-of-squares63.2%
Applied egg-rr71.9%
associate-*r/70.7%
*-commutative70.7%
Applied egg-rr70.7%
expm1-log1p-u73.4%
div-inv73.5%
metadata-eval73.5%
Applied egg-rr73.5%
if 1.9999999999999999e168 < (/.f64 angle 180) < 9.9999999999999997e267Initial program 41.7%
associate-*l*41.7%
*-commutative41.7%
associate-*l*41.7%
Simplified41.7%
unpow227.4%
unpow227.4%
difference-of-squares31.7%
Applied egg-rr46.0%
pow146.0%
2-sin46.0%
div-inv45.5%
metadata-eval45.5%
Applied egg-rr45.5%
unpow145.5%
*-commutative45.5%
*-commutative45.5%
associate-*r*54.0%
Simplified54.0%
if 9.9999999999999997e267 < (/.f64 angle 180) < 1e288Initial program 20.0%
associate-*l*20.0%
associate-*l*20.0%
Simplified20.0%
unpow221.5%
unpow221.5%
difference-of-squares41.5%
Applied egg-rr20.0%
Taylor expanded in angle around 0 84.1%
if 1e288 < (/.f64 angle 180) Initial program 7.4%
associate-*l*7.4%
associate-*l*7.4%
Simplified7.4%
unpow235.5%
unpow235.5%
difference-of-squares35.5%
Applied egg-rr7.4%
add-sqr-sqrt73.2%
pow273.2%
Applied egg-rr73.2%
Taylor expanded in angle around inf 39.9%
associate-*r*73.2%
*-commutative73.2%
*-commutative73.2%
*-commutative73.2%
Simplified73.2%
Final simplification63.8%
a_m = (fabs.f64 a)
angle\_m = (fabs.f64 angle)
angle\_s = (copysign.f64 1 angle)
(FPCore (angle_s a_m b angle_m)
:precision binary64
(let* ((t_0 (* 0.005555555555555556 (* angle_m PI)))
(t_1 (sin t_0))
(t_2 (cos t_0)))
(*
angle_s
(if (<= (- (pow b 2.0) (pow a_m 2.0)) -2e-250)
(fma
2.0
(* (pow b 2.0) (* t_1 t_2))
(* a_m (fma -2.0 (* t_1 (* a_m t_2)) (* (* 2.0 t_2) (* t_1 0.0)))))
(*
(hypot b a_m)
(*
(hypot b a_m)
(sin (* 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 t_0 = 0.005555555555555556 * (angle_m * ((double) M_PI));
double t_1 = sin(t_0);
double t_2 = cos(t_0);
double tmp;
if ((pow(b, 2.0) - pow(a_m, 2.0)) <= -2e-250) {
tmp = fma(2.0, (pow(b, 2.0) * (t_1 * t_2)), (a_m * fma(-2.0, (t_1 * (a_m * t_2)), ((2.0 * t_2) * (t_1 * 0.0)))));
} else {
tmp = hypot(b, a_m) * (hypot(b, a_m) * sin((2.0 * (angle_m * (0.005555555555555556 * ((double) M_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) t_0 = Float64(0.005555555555555556 * Float64(angle_m * pi)) t_1 = sin(t_0) t_2 = cos(t_0) tmp = 0.0 if (Float64((b ^ 2.0) - (a_m ^ 2.0)) <= -2e-250) tmp = fma(2.0, Float64((b ^ 2.0) * Float64(t_1 * t_2)), Float64(a_m * fma(-2.0, Float64(t_1 * Float64(a_m * t_2)), Float64(Float64(2.0 * t_2) * Float64(t_1 * 0.0))))); else tmp = Float64(hypot(b, a_m) * Float64(hypot(b, a_m) * sin(Float64(2.0 * Float64(angle_m * Float64(0.005555555555555556 * pi)))))); 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[(0.005555555555555556 * N[(angle$95$m * Pi), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sin[t$95$0], $MachinePrecision]}, Block[{t$95$2 = N[Cos[t$95$0], $MachinePrecision]}, N[(angle$95$s * If[LessEqual[N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a$95$m, 2.0], $MachinePrecision]), $MachinePrecision], -2e-250], N[(2.0 * N[(N[Power[b, 2.0], $MachinePrecision] * N[(t$95$1 * t$95$2), $MachinePrecision]), $MachinePrecision] + N[(a$95$m * N[(-2.0 * N[(t$95$1 * N[(a$95$m * t$95$2), $MachinePrecision]), $MachinePrecision] + N[(N[(2.0 * t$95$2), $MachinePrecision] * N[(t$95$1 * 0.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[b ^ 2 + a$95$m ^ 2], $MachinePrecision] * N[(N[Sqrt[b ^ 2 + a$95$m ^ 2], $MachinePrecision] * N[Sin[N[(2.0 * N[(angle$95$m * N[(0.005555555555555556 * Pi), $MachinePrecision]), $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 := 0.005555555555555556 \cdot \left(angle\_m \cdot \pi\right)\\
t_1 := \sin t\_0\\
t_2 := \cos t\_0\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;{b}^{2} - {a\_m}^{2} \leq -2 \cdot 10^{-250}:\\
\;\;\;\;\mathsf{fma}\left(2, {b}^{2} \cdot \left(t\_1 \cdot t\_2\right), a\_m \cdot \mathsf{fma}\left(-2, t\_1 \cdot \left(a\_m \cdot t\_2\right), \left(2 \cdot t\_2\right) \cdot \left(t\_1 \cdot 0\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{hypot}\left(b, a\_m\right) \cdot \left(\mathsf{hypot}\left(b, a\_m\right) \cdot \sin \left(2 \cdot \left(angle\_m \cdot \left(0.005555555555555556 \cdot \pi\right)\right)\right)\right)\\
\end{array}
\end{array}
\end{array}
if (-.f64 (pow.f64 b 2) (pow.f64 a 2)) < -2.0000000000000001e-250Initial program 50.5%
associate-*l*50.5%
*-commutative50.5%
associate-*l*50.5%
Simplified50.5%
unpow247.8%
unpow247.8%
difference-of-squares47.8%
Applied egg-rr50.5%
Taylor expanded in a around 0 62.3%
fma-define62.3%
*-commutative62.3%
fma-define62.3%
Simplified62.3%
if -2.0000000000000001e-250 < (-.f64 (pow.f64 b 2) (pow.f64 a 2)) Initial program 53.3%
associate-*l*53.3%
*-commutative53.3%
associate-*l*53.3%
Simplified53.3%
add-cbrt-cube41.0%
pow1/330.8%
Applied egg-rr30.8%
unpow1/341.7%
rem-cbrt-cube54.3%
add-sqr-sqrt54.2%
associate-*l*54.2%
Applied egg-rr72.1%
Final simplification67.8%
a_m = (fabs.f64 a)
angle\_m = (fabs.f64 angle)
angle\_s = (copysign.f64 1 angle)
(FPCore (angle_s a_m b angle_m)
:precision binary64
(let* ((t_0 (sin (* 0.005555555555555556 (* angle_m PI)))))
(*
angle_s
(if (<= (- (pow b 2.0) (pow a_m 2.0)) -1e-250)
(*
2.0
(*
(+ (* a_m (- (* t_0 (- b b)) (* a_m t_0))) (* (pow b 2.0) t_0))
(cos (* PI (/ angle_m 180.0)))))
(*
(hypot b a_m)
(*
(hypot b a_m)
(sin (* 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 t_0 = sin((0.005555555555555556 * (angle_m * ((double) M_PI))));
double tmp;
if ((pow(b, 2.0) - pow(a_m, 2.0)) <= -1e-250) {
tmp = 2.0 * (((a_m * ((t_0 * (b - b)) - (a_m * t_0))) + (pow(b, 2.0) * t_0)) * cos((((double) M_PI) * (angle_m / 180.0))));
} else {
tmp = hypot(b, a_m) * (hypot(b, a_m) * sin((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 t_0 = Math.sin((0.005555555555555556 * (angle_m * Math.PI)));
double tmp;
if ((Math.pow(b, 2.0) - Math.pow(a_m, 2.0)) <= -1e-250) {
tmp = 2.0 * (((a_m * ((t_0 * (b - b)) - (a_m * t_0))) + (Math.pow(b, 2.0) * t_0)) * Math.cos((Math.PI * (angle_m / 180.0))));
} else {
tmp = Math.hypot(b, a_m) * (Math.hypot(b, a_m) * Math.sin((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): t_0 = math.sin((0.005555555555555556 * (angle_m * math.pi))) tmp = 0 if (math.pow(b, 2.0) - math.pow(a_m, 2.0)) <= -1e-250: tmp = 2.0 * (((a_m * ((t_0 * (b - b)) - (a_m * t_0))) + (math.pow(b, 2.0) * t_0)) * math.cos((math.pi * (angle_m / 180.0)))) else: tmp = math.hypot(b, a_m) * (math.hypot(b, a_m) * math.sin((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) t_0 = sin(Float64(0.005555555555555556 * Float64(angle_m * pi))) tmp = 0.0 if (Float64((b ^ 2.0) - (a_m ^ 2.0)) <= -1e-250) tmp = Float64(2.0 * Float64(Float64(Float64(a_m * Float64(Float64(t_0 * Float64(b - b)) - Float64(a_m * t_0))) + Float64((b ^ 2.0) * t_0)) * cos(Float64(pi * Float64(angle_m / 180.0))))); else tmp = Float64(hypot(b, a_m) * Float64(hypot(b, a_m) * sin(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) t_0 = sin((0.005555555555555556 * (angle_m * pi))); tmp = 0.0; if (((b ^ 2.0) - (a_m ^ 2.0)) <= -1e-250) tmp = 2.0 * (((a_m * ((t_0 * (b - b)) - (a_m * t_0))) + ((b ^ 2.0) * t_0)) * cos((pi * (angle_m / 180.0)))); else tmp = hypot(b, a_m) * (hypot(b, a_m) * sin((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_] := Block[{t$95$0 = N[Sin[N[(0.005555555555555556 * N[(angle$95$m * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[(angle$95$s * If[LessEqual[N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a$95$m, 2.0], $MachinePrecision]), $MachinePrecision], -1e-250], N[(2.0 * N[(N[(N[(a$95$m * N[(N[(t$95$0 * N[(b - b), $MachinePrecision]), $MachinePrecision] - N[(a$95$m * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Power[b, 2.0], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(Pi * N[(angle$95$m / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[b ^ 2 + a$95$m ^ 2], $MachinePrecision] * N[(N[Sqrt[b ^ 2 + a$95$m ^ 2], $MachinePrecision] * N[Sin[N[(2.0 * N[(angle$95$m * N[(0.005555555555555556 * Pi), $MachinePrecision]), $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 := \sin \left(0.005555555555555556 \cdot \left(angle\_m \cdot \pi\right)\right)\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;{b}^{2} - {a\_m}^{2} \leq -1 \cdot 10^{-250}:\\
\;\;\;\;2 \cdot \left(\left(a\_m \cdot \left(t\_0 \cdot \left(b - b\right) - a\_m \cdot t\_0\right) + {b}^{2} \cdot t\_0\right) \cdot \cos \left(\pi \cdot \frac{angle\_m}{180}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{hypot}\left(b, a\_m\right) \cdot \left(\mathsf{hypot}\left(b, a\_m\right) \cdot \sin \left(2 \cdot \left(angle\_m \cdot \left(0.005555555555555556 \cdot \pi\right)\right)\right)\right)\\
\end{array}
\end{array}
\end{array}
if (-.f64 (pow.f64 b 2) (pow.f64 a 2)) < -1.0000000000000001e-250Initial program 50.1%
associate-*l*50.1%
associate-*l*50.1%
Simplified50.1%
unpow247.5%
unpow247.5%
difference-of-squares47.5%
Applied egg-rr50.1%
Taylor expanded in a around 0 61.3%
if -1.0000000000000001e-250 < (-.f64 (pow.f64 b 2) (pow.f64 a 2)) Initial program 53.7%
associate-*l*53.7%
*-commutative53.7%
associate-*l*53.7%
Simplified53.7%
add-cbrt-cube40.5%
pow1/330.3%
Applied egg-rr30.3%
unpow1/341.3%
rem-cbrt-cube54.7%
add-sqr-sqrt54.6%
associate-*l*54.6%
Applied egg-rr72.5%
Final simplification67.6%
a_m = (fabs.f64 a)
angle\_m = (fabs.f64 angle)
angle\_s = (copysign.f64 1 angle)
(FPCore (angle_s a_m b angle_m)
:precision binary64
(let* ((t_0 (* angle_m (* PI (+ b a_m))))
(t_1 (* (+ b a_m) (- b a_m)))
(t_2 (* t_1 (sin (* PI (/ angle_m 180.0))))))
(*
angle_s
(if (<= (/ angle_m 180.0) 1e-116)
(* 0.011111111111111112 (- (* b t_0) (* a_m t_0)))
(if (<= (/ angle_m 180.0) 4e+174)
(* 2.0 (* t_2 (cos (* (/ angle_m 180.0) (cbrt (pow PI 3.0))))))
(if (<= (/ angle_m 180.0) 5e+299)
(* t_1 (sin (* 2.0 (* 0.005555555555555556 (* angle_m PI)))))
(*
2.0
(*
t_2
(sqrt
(pow (cos (* PI (* 0.005555555555555556 angle_m))) 2.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 = angle_m * (((double) M_PI) * (b + a_m));
double t_1 = (b + a_m) * (b - a_m);
double t_2 = t_1 * sin((((double) M_PI) * (angle_m / 180.0)));
double tmp;
if ((angle_m / 180.0) <= 1e-116) {
tmp = 0.011111111111111112 * ((b * t_0) - (a_m * t_0));
} else if ((angle_m / 180.0) <= 4e+174) {
tmp = 2.0 * (t_2 * cos(((angle_m / 180.0) * cbrt(pow(((double) M_PI), 3.0)))));
} else if ((angle_m / 180.0) <= 5e+299) {
tmp = t_1 * sin((2.0 * (0.005555555555555556 * (angle_m * ((double) M_PI)))));
} else {
tmp = 2.0 * (t_2 * sqrt(pow(cos((((double) M_PI) * (0.005555555555555556 * angle_m))), 2.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 = angle_m * (Math.PI * (b + a_m));
double t_1 = (b + a_m) * (b - a_m);
double t_2 = t_1 * Math.sin((Math.PI * (angle_m / 180.0)));
double tmp;
if ((angle_m / 180.0) <= 1e-116) {
tmp = 0.011111111111111112 * ((b * t_0) - (a_m * t_0));
} else if ((angle_m / 180.0) <= 4e+174) {
tmp = 2.0 * (t_2 * Math.cos(((angle_m / 180.0) * Math.cbrt(Math.pow(Math.PI, 3.0)))));
} else if ((angle_m / 180.0) <= 5e+299) {
tmp = t_1 * Math.sin((2.0 * (0.005555555555555556 * (angle_m * Math.PI))));
} else {
tmp = 2.0 * (t_2 * Math.sqrt(Math.pow(Math.cos((Math.PI * (0.005555555555555556 * angle_m))), 2.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(angle_m * Float64(pi * Float64(b + a_m))) t_1 = Float64(Float64(b + a_m) * Float64(b - a_m)) t_2 = Float64(t_1 * sin(Float64(pi * Float64(angle_m / 180.0)))) tmp = 0.0 if (Float64(angle_m / 180.0) <= 1e-116) tmp = Float64(0.011111111111111112 * Float64(Float64(b * t_0) - Float64(a_m * t_0))); elseif (Float64(angle_m / 180.0) <= 4e+174) tmp = Float64(2.0 * Float64(t_2 * cos(Float64(Float64(angle_m / 180.0) * cbrt((pi ^ 3.0)))))); elseif (Float64(angle_m / 180.0) <= 5e+299) tmp = Float64(t_1 * sin(Float64(2.0 * Float64(0.005555555555555556 * Float64(angle_m * pi))))); else tmp = Float64(2.0 * Float64(t_2 * sqrt((cos(Float64(pi * Float64(0.005555555555555556 * angle_m))) ^ 2.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[(angle$95$m * N[(Pi * N[(b + a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(b + a$95$m), $MachinePrecision] * N[(b - a$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * N[Sin[N[(Pi * N[(angle$95$m / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, N[(angle$95$s * If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 1e-116], N[(0.011111111111111112 * N[(N[(b * t$95$0), $MachinePrecision] - N[(a$95$m * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 4e+174], N[(2.0 * N[(t$95$2 * N[Cos[N[(N[(angle$95$m / 180.0), $MachinePrecision] * N[Power[N[Power[Pi, 3.0], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 5e+299], N[(t$95$1 * N[Sin[N[(2.0 * N[(0.005555555555555556 * N[(angle$95$m * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(t$95$2 * N[Sqrt[N[Power[N[Cos[N[(Pi * N[(0.005555555555555556 * angle$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.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 := angle\_m \cdot \left(\pi \cdot \left(b + a\_m\right)\right)\\
t_1 := \left(b + a\_m\right) \cdot \left(b - a\_m\right)\\
t_2 := t\_1 \cdot \sin \left(\pi \cdot \frac{angle\_m}{180}\right)\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{angle\_m}{180} \leq 10^{-116}:\\
\;\;\;\;0.011111111111111112 \cdot \left(b \cdot t\_0 - a\_m \cdot t\_0\right)\\
\mathbf{elif}\;\frac{angle\_m}{180} \leq 4 \cdot 10^{+174}:\\
\;\;\;\;2 \cdot \left(t\_2 \cdot \cos \left(\frac{angle\_m}{180} \cdot \sqrt[3]{{\pi}^{3}}\right)\right)\\
\mathbf{elif}\;\frac{angle\_m}{180} \leq 5 \cdot 10^{+299}:\\
\;\;\;\;t\_1 \cdot \sin \left(2 \cdot \left(0.005555555555555556 \cdot \left(angle\_m \cdot \pi\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(t\_2 \cdot \sqrt{{\cos \left(\pi \cdot \left(0.005555555555555556 \cdot angle\_m\right)\right)}^{2}}\right)\\
\end{array}
\end{array}
\end{array}
if (/.f64 angle 180) < 9.9999999999999999e-117Initial program 48.1%
associate-*l*48.1%
*-commutative48.1%
associate-*l*48.1%
Simplified48.1%
Taylor expanded in angle around 0 48.3%
unpow248.3%
unpow248.3%
difference-of-squares50.4%
Applied egg-rr50.4%
Taylor expanded in angle around 0 50.4%
associate-*r*50.4%
+-commutative50.4%
Simplified50.4%
associate-*r*65.6%
sub-neg65.6%
distribute-lft-in60.6%
associate-*l*60.6%
associate-*l*60.6%
Applied egg-rr60.6%
if 9.9999999999999999e-117 < (/.f64 angle 180) < 4.00000000000000028e174Initial program 69.3%
associate-*l*69.3%
associate-*l*69.3%
Simplified69.3%
unpow260.2%
unpow260.2%
difference-of-squares61.8%
Applied egg-rr70.9%
add-cbrt-cube70.7%
pow370.7%
Applied egg-rr70.7%
if 4.00000000000000028e174 < (/.f64 angle 180) < 5.0000000000000003e299Initial program 35.1%
associate-*l*35.1%
*-commutative35.1%
associate-*l*35.1%
Simplified35.1%
unpow228.1%
unpow228.1%
difference-of-squares34.8%
Applied egg-rr38.4%
pow138.4%
2-sin38.4%
div-inv38.6%
metadata-eval38.6%
Applied egg-rr38.6%
unpow138.6%
*-commutative38.6%
*-commutative38.6%
associate-*r*51.6%
Simplified51.6%
if 5.0000000000000003e299 < (/.f64 angle 180) Initial program 52.1%
associate-*l*52.1%
associate-*l*52.1%
Simplified52.1%
unpow249.0%
unpow249.0%
difference-of-squares51.5%
Applied egg-rr54.6%
add-sqr-sqrt44.7%
sqrt-unprod54.7%
pow254.7%
div-inv54.7%
metadata-eval54.7%
Applied egg-rr54.7%
Final simplification62.1%
a_m = (fabs.f64 a)
angle\_m = (fabs.f64 angle)
angle\_s = (copysign.f64 1 angle)
(FPCore (angle_s a_m b angle_m)
:precision binary64
(let* ((t_0 (* angle_m (* PI (+ b a_m)))))
(*
angle_s
(if (<= (/ angle_m 180.0) 1e-116)
(* 0.011111111111111112 (- (* b t_0) (* a_m t_0)))
(if (<= (/ angle_m 180.0) 4e+174)
(*
2.0
(*
(* (* (+ b a_m) (- b a_m)) (sin (* PI (/ angle_m 180.0))))
(cos (* (/ angle_m 180.0) (cbrt (pow PI 3.0))))))
(*
(sin (* 2.0 (* PI (* 0.005555555555555556 angle_m))))
(+ (pow b 2.0) (pow a_m 2.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 = angle_m * (((double) M_PI) * (b + a_m));
double tmp;
if ((angle_m / 180.0) <= 1e-116) {
tmp = 0.011111111111111112 * ((b * t_0) - (a_m * t_0));
} else if ((angle_m / 180.0) <= 4e+174) {
tmp = 2.0 * ((((b + a_m) * (b - a_m)) * sin((((double) M_PI) * (angle_m / 180.0)))) * cos(((angle_m / 180.0) * cbrt(pow(((double) M_PI), 3.0)))));
} else {
tmp = sin((2.0 * (((double) M_PI) * (0.005555555555555556 * angle_m)))) * (pow(b, 2.0) + pow(a_m, 2.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 = angle_m * (Math.PI * (b + a_m));
double tmp;
if ((angle_m / 180.0) <= 1e-116) {
tmp = 0.011111111111111112 * ((b * t_0) - (a_m * t_0));
} else if ((angle_m / 180.0) <= 4e+174) {
tmp = 2.0 * ((((b + a_m) * (b - a_m)) * Math.sin((Math.PI * (angle_m / 180.0)))) * Math.cos(((angle_m / 180.0) * Math.cbrt(Math.pow(Math.PI, 3.0)))));
} else {
tmp = Math.sin((2.0 * (Math.PI * (0.005555555555555556 * angle_m)))) * (Math.pow(b, 2.0) + Math.pow(a_m, 2.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(angle_m * Float64(pi * Float64(b + a_m))) tmp = 0.0 if (Float64(angle_m / 180.0) <= 1e-116) tmp = Float64(0.011111111111111112 * Float64(Float64(b * t_0) - Float64(a_m * t_0))); elseif (Float64(angle_m / 180.0) <= 4e+174) tmp = Float64(2.0 * Float64(Float64(Float64(Float64(b + a_m) * Float64(b - a_m)) * sin(Float64(pi * Float64(angle_m / 180.0)))) * cos(Float64(Float64(angle_m / 180.0) * cbrt((pi ^ 3.0)))))); else tmp = Float64(sin(Float64(2.0 * Float64(pi * Float64(0.005555555555555556 * angle_m)))) * Float64((b ^ 2.0) + (a_m ^ 2.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[(angle$95$m * N[(Pi * N[(b + a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(angle$95$s * If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 1e-116], N[(0.011111111111111112 * N[(N[(b * t$95$0), $MachinePrecision] - N[(a$95$m * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 4e+174], N[(2.0 * N[(N[(N[(N[(b + a$95$m), $MachinePrecision] * N[(b - a$95$m), $MachinePrecision]), $MachinePrecision] * N[Sin[N[(Pi * N[(angle$95$m / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(N[(angle$95$m / 180.0), $MachinePrecision] * N[Power[N[Power[Pi, 3.0], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[N[(2.0 * N[(Pi * N[(0.005555555555555556 * angle$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Power[b, 2.0], $MachinePrecision] + N[Power[a$95$m, 2.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 := angle\_m \cdot \left(\pi \cdot \left(b + a\_m\right)\right)\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{angle\_m}{180} \leq 10^{-116}:\\
\;\;\;\;0.011111111111111112 \cdot \left(b \cdot t\_0 - a\_m \cdot t\_0\right)\\
\mathbf{elif}\;\frac{angle\_m}{180} \leq 4 \cdot 10^{+174}:\\
\;\;\;\;2 \cdot \left(\left(\left(\left(b + a\_m\right) \cdot \left(b - a\_m\right)\right) \cdot \sin \left(\pi \cdot \frac{angle\_m}{180}\right)\right) \cdot \cos \left(\frac{angle\_m}{180} \cdot \sqrt[3]{{\pi}^{3}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sin \left(2 \cdot \left(\pi \cdot \left(0.005555555555555556 \cdot angle\_m\right)\right)\right) \cdot \left({b}^{2} + {a\_m}^{2}\right)\\
\end{array}
\end{array}
\end{array}
if (/.f64 angle 180) < 9.9999999999999999e-117Initial program 48.1%
associate-*l*48.1%
*-commutative48.1%
associate-*l*48.1%
Simplified48.1%
Taylor expanded in angle around 0 48.3%
unpow248.3%
unpow248.3%
difference-of-squares50.4%
Applied egg-rr50.4%
Taylor expanded in angle around 0 50.4%
associate-*r*50.4%
+-commutative50.4%
Simplified50.4%
associate-*r*65.6%
sub-neg65.6%
distribute-lft-in60.6%
associate-*l*60.6%
associate-*l*60.6%
Applied egg-rr60.6%
if 9.9999999999999999e-117 < (/.f64 angle 180) < 4.00000000000000028e174Initial program 69.3%
associate-*l*69.3%
associate-*l*69.3%
Simplified69.3%
unpow260.2%
unpow260.2%
difference-of-squares61.8%
Applied egg-rr70.9%
add-cbrt-cube70.7%
pow370.7%
Applied egg-rr70.7%
if 4.00000000000000028e174 < (/.f64 angle 180) Initial program 35.1%
associate-*l*35.1%
*-commutative35.1%
associate-*l*35.1%
Simplified35.1%
add-cbrt-cube35.7%
pow1/332.2%
Applied egg-rr32.2%
unpow1/335.9%
rem-cbrt-cube35.3%
*-commutative35.3%
sub-neg35.3%
distribute-lft-in35.3%
associate-*l*35.3%
*-commutative35.3%
associate-*l*38.6%
associate-*l*38.6%
*-commutative38.6%
associate-*l*41.8%
add-sqr-sqrt17.9%
sqrt-unprod45.4%
Applied egg-rr42.3%
distribute-lft-out42.3%
associate-*r*45.9%
Simplified45.9%
Final simplification61.5%
a_m = (fabs.f64 a)
angle\_m = (fabs.f64 angle)
angle\_s = (copysign.f64 1 angle)
(FPCore (angle_s a_m b angle_m)
:precision binary64
(let* ((t_0 (* angle_m (* PI (+ b a_m))))
(t_1 (* PI (* 0.005555555555555556 angle_m)))
(t_2 (sin (expm1 (log1p t_1))))
(t_3 (* (+ b a_m) (- b a_m))))
(*
angle_s
(if (<= (/ angle_m 180.0) 1e-134)
(* 0.011111111111111112 (- (* b t_0) (* a_m t_0)))
(if (<= (/ angle_m 180.0) 2e+168)
(* t_3 (* 2.0 (* t_2 (cos (/ (* angle_m PI) 180.0)))))
(if (<= (/ angle_m 180.0) 5e+268)
(* t_3 (sin (* 2.0 (* 0.005555555555555556 (* angle_m PI)))))
(if (<= (/ angle_m 180.0) 2e+291)
(* 2.0 (* t_3 t_2))
(* (sin (* 2.0 t_1)) (+ (pow b 2.0) (pow a_m 2.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 = angle_m * (((double) M_PI) * (b + a_m));
double t_1 = ((double) M_PI) * (0.005555555555555556 * angle_m);
double t_2 = sin(expm1(log1p(t_1)));
double t_3 = (b + a_m) * (b - a_m);
double tmp;
if ((angle_m / 180.0) <= 1e-134) {
tmp = 0.011111111111111112 * ((b * t_0) - (a_m * t_0));
} else if ((angle_m / 180.0) <= 2e+168) {
tmp = t_3 * (2.0 * (t_2 * cos(((angle_m * ((double) M_PI)) / 180.0))));
} else if ((angle_m / 180.0) <= 5e+268) {
tmp = t_3 * sin((2.0 * (0.005555555555555556 * (angle_m * ((double) M_PI)))));
} else if ((angle_m / 180.0) <= 2e+291) {
tmp = 2.0 * (t_3 * t_2);
} else {
tmp = sin((2.0 * t_1)) * (pow(b, 2.0) + pow(a_m, 2.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 = angle_m * (Math.PI * (b + a_m));
double t_1 = Math.PI * (0.005555555555555556 * angle_m);
double t_2 = Math.sin(Math.expm1(Math.log1p(t_1)));
double t_3 = (b + a_m) * (b - a_m);
double tmp;
if ((angle_m / 180.0) <= 1e-134) {
tmp = 0.011111111111111112 * ((b * t_0) - (a_m * t_0));
} else if ((angle_m / 180.0) <= 2e+168) {
tmp = t_3 * (2.0 * (t_2 * Math.cos(((angle_m * Math.PI) / 180.0))));
} else if ((angle_m / 180.0) <= 5e+268) {
tmp = t_3 * Math.sin((2.0 * (0.005555555555555556 * (angle_m * Math.PI))));
} else if ((angle_m / 180.0) <= 2e+291) {
tmp = 2.0 * (t_3 * t_2);
} else {
tmp = Math.sin((2.0 * t_1)) * (Math.pow(b, 2.0) + Math.pow(a_m, 2.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 = angle_m * (math.pi * (b + a_m)) t_1 = math.pi * (0.005555555555555556 * angle_m) t_2 = math.sin(math.expm1(math.log1p(t_1))) t_3 = (b + a_m) * (b - a_m) tmp = 0 if (angle_m / 180.0) <= 1e-134: tmp = 0.011111111111111112 * ((b * t_0) - (a_m * t_0)) elif (angle_m / 180.0) <= 2e+168: tmp = t_3 * (2.0 * (t_2 * math.cos(((angle_m * math.pi) / 180.0)))) elif (angle_m / 180.0) <= 5e+268: tmp = t_3 * math.sin((2.0 * (0.005555555555555556 * (angle_m * math.pi)))) elif (angle_m / 180.0) <= 2e+291: tmp = 2.0 * (t_3 * t_2) else: tmp = math.sin((2.0 * t_1)) * (math.pow(b, 2.0) + math.pow(a_m, 2.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(angle_m * Float64(pi * Float64(b + a_m))) t_1 = Float64(pi * Float64(0.005555555555555556 * angle_m)) t_2 = sin(expm1(log1p(t_1))) t_3 = Float64(Float64(b + a_m) * Float64(b - a_m)) tmp = 0.0 if (Float64(angle_m / 180.0) <= 1e-134) tmp = Float64(0.011111111111111112 * Float64(Float64(b * t_0) - Float64(a_m * t_0))); elseif (Float64(angle_m / 180.0) <= 2e+168) tmp = Float64(t_3 * Float64(2.0 * Float64(t_2 * cos(Float64(Float64(angle_m * pi) / 180.0))))); elseif (Float64(angle_m / 180.0) <= 5e+268) tmp = Float64(t_3 * sin(Float64(2.0 * Float64(0.005555555555555556 * Float64(angle_m * pi))))); elseif (Float64(angle_m / 180.0) <= 2e+291) tmp = Float64(2.0 * Float64(t_3 * t_2)); else tmp = Float64(sin(Float64(2.0 * t_1)) * Float64((b ^ 2.0) + (a_m ^ 2.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[(angle$95$m * N[(Pi * N[(b + a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(Pi * N[(0.005555555555555556 * angle$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sin[N[(Exp[N[Log[1 + t$95$1], $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[(b + a$95$m), $MachinePrecision] * N[(b - a$95$m), $MachinePrecision]), $MachinePrecision]}, N[(angle$95$s * If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 1e-134], N[(0.011111111111111112 * N[(N[(b * t$95$0), $MachinePrecision] - N[(a$95$m * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 2e+168], N[(t$95$3 * N[(2.0 * N[(t$95$2 * N[Cos[N[(N[(angle$95$m * Pi), $MachinePrecision] / 180.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 5e+268], N[(t$95$3 * N[Sin[N[(2.0 * N[(0.005555555555555556 * N[(angle$95$m * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 2e+291], N[(2.0 * N[(t$95$3 * t$95$2), $MachinePrecision]), $MachinePrecision], N[(N[Sin[N[(2.0 * t$95$1), $MachinePrecision]], $MachinePrecision] * N[(N[Power[b, 2.0], $MachinePrecision] + N[Power[a$95$m, 2.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 := angle\_m \cdot \left(\pi \cdot \left(b + a\_m\right)\right)\\
t_1 := \pi \cdot \left(0.005555555555555556 \cdot angle\_m\right)\\
t_2 := \sin \left(\mathsf{expm1}\left(\mathsf{log1p}\left(t\_1\right)\right)\right)\\
t_3 := \left(b + a\_m\right) \cdot \left(b - a\_m\right)\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{angle\_m}{180} \leq 10^{-134}:\\
\;\;\;\;0.011111111111111112 \cdot \left(b \cdot t\_0 - a\_m \cdot t\_0\right)\\
\mathbf{elif}\;\frac{angle\_m}{180} \leq 2 \cdot 10^{+168}:\\
\;\;\;\;t\_3 \cdot \left(2 \cdot \left(t\_2 \cdot \cos \left(\frac{angle\_m \cdot \pi}{180}\right)\right)\right)\\
\mathbf{elif}\;\frac{angle\_m}{180} \leq 5 \cdot 10^{+268}:\\
\;\;\;\;t\_3 \cdot \sin \left(2 \cdot \left(0.005555555555555556 \cdot \left(angle\_m \cdot \pi\right)\right)\right)\\
\mathbf{elif}\;\frac{angle\_m}{180} \leq 2 \cdot 10^{+291}:\\
\;\;\;\;2 \cdot \left(t\_3 \cdot t\_2\right)\\
\mathbf{else}:\\
\;\;\;\;\sin \left(2 \cdot t\_1\right) \cdot \left({b}^{2} + {a\_m}^{2}\right)\\
\end{array}
\end{array}
\end{array}
if (/.f64 angle 180) < 1.00000000000000004e-134Initial program 47.8%
associate-*l*47.8%
*-commutative47.8%
associate-*l*47.8%
Simplified47.8%
Taylor expanded in angle around 0 48.0%
unpow248.0%
unpow248.0%
difference-of-squares50.1%
Applied egg-rr50.1%
Taylor expanded in angle around 0 50.1%
associate-*r*50.1%
+-commutative50.1%
Simplified50.1%
associate-*r*65.4%
sub-neg65.4%
distribute-lft-in60.4%
associate-*l*60.3%
associate-*l*60.4%
Applied egg-rr60.4%
if 1.00000000000000004e-134 < (/.f64 angle 180) < 1.9999999999999999e168Initial program 70.4%
associate-*l*70.4%
*-commutative70.4%
associate-*l*70.4%
Simplified70.4%
unpow261.7%
unpow261.7%
difference-of-squares63.2%
Applied egg-rr71.9%
associate-*r/70.7%
*-commutative70.7%
Applied egg-rr70.7%
expm1-log1p-u73.4%
div-inv73.5%
metadata-eval73.5%
Applied egg-rr73.5%
if 1.9999999999999999e168 < (/.f64 angle 180) < 5.0000000000000002e268Initial program 44.1%
associate-*l*44.1%
*-commutative44.1%
associate-*l*44.1%
Simplified44.1%
unpow226.2%
unpow226.2%
difference-of-squares30.4%
Applied egg-rr48.3%
pow148.3%
2-sin48.3%
div-inv47.8%
metadata-eval47.8%
Applied egg-rr47.8%
unpow147.8%
*-commutative47.8%
*-commutative47.8%
associate-*r*55.9%
Simplified55.9%
if 5.0000000000000002e268 < (/.f64 angle 180) < 1.9999999999999999e291Initial program 0.0%
associate-*l*0.0%
associate-*l*0.0%
Simplified0.0%
unpow226.8%
unpow226.8%
difference-of-squares51.8%
Applied egg-rr0.0%
add-sqr-sqrt25.0%
pow225.0%
Applied egg-rr25.0%
expm1-log1p-u4.9%
div-inv4.9%
metadata-eval4.9%
Applied egg-rr28.7%
Taylor expanded in angle around 0 75.0%
if 1.9999999999999999e291 < (/.f64 angle 180) Initial program 7.4%
associate-*l*7.4%
*-commutative7.4%
associate-*l*7.4%
Simplified7.4%
add-cbrt-cube2.2%
pow1/335.5%
Applied egg-rr35.5%
unpow1/32.2%
rem-cbrt-cube7.4%
*-commutative7.4%
sub-neg7.4%
distribute-lft-in7.4%
associate-*l*7.4%
*-commutative7.4%
associate-*l*7.4%
associate-*l*7.4%
*-commutative7.4%
associate-*l*40.7%
add-sqr-sqrt0.0%
sqrt-unprod40.7%
Applied egg-rr40.7%
distribute-lft-out40.7%
associate-*r*74.1%
Simplified74.1%
Final simplification63.7%
a_m = (fabs.f64 a)
angle\_m = (fabs.f64 angle)
angle\_s = (copysign.f64 1 angle)
(FPCore (angle_s a_m b angle_m)
:precision binary64
(let* ((t_0 (* angle_m (* PI (+ b a_m))))
(t_1 (* PI (* 0.005555555555555556 angle_m))))
(*
angle_s
(if (<= (/ angle_m 180.0) 1e-134)
(* 0.011111111111111112 (- (* b t_0) (* a_m t_0)))
(if (<= (/ angle_m 180.0) 4e+174)
(*
2.0
(*
(cos (* PI (/ angle_m 180.0)))
(* (* (+ b a_m) (- b a_m)) (sin t_1))))
(* (sin (* 2.0 t_1)) (+ (pow b 2.0) (pow a_m 2.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 = angle_m * (((double) M_PI) * (b + a_m));
double t_1 = ((double) M_PI) * (0.005555555555555556 * angle_m);
double tmp;
if ((angle_m / 180.0) <= 1e-134) {
tmp = 0.011111111111111112 * ((b * t_0) - (a_m * t_0));
} else if ((angle_m / 180.0) <= 4e+174) {
tmp = 2.0 * (cos((((double) M_PI) * (angle_m / 180.0))) * (((b + a_m) * (b - a_m)) * sin(t_1)));
} else {
tmp = sin((2.0 * t_1)) * (pow(b, 2.0) + pow(a_m, 2.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 = angle_m * (Math.PI * (b + a_m));
double t_1 = Math.PI * (0.005555555555555556 * angle_m);
double tmp;
if ((angle_m / 180.0) <= 1e-134) {
tmp = 0.011111111111111112 * ((b * t_0) - (a_m * t_0));
} else if ((angle_m / 180.0) <= 4e+174) {
tmp = 2.0 * (Math.cos((Math.PI * (angle_m / 180.0))) * (((b + a_m) * (b - a_m)) * Math.sin(t_1)));
} else {
tmp = Math.sin((2.0 * t_1)) * (Math.pow(b, 2.0) + Math.pow(a_m, 2.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 = angle_m * (math.pi * (b + a_m)) t_1 = math.pi * (0.005555555555555556 * angle_m) tmp = 0 if (angle_m / 180.0) <= 1e-134: tmp = 0.011111111111111112 * ((b * t_0) - (a_m * t_0)) elif (angle_m / 180.0) <= 4e+174: tmp = 2.0 * (math.cos((math.pi * (angle_m / 180.0))) * (((b + a_m) * (b - a_m)) * math.sin(t_1))) else: tmp = math.sin((2.0 * t_1)) * (math.pow(b, 2.0) + math.pow(a_m, 2.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(angle_m * Float64(pi * Float64(b + a_m))) t_1 = Float64(pi * Float64(0.005555555555555556 * angle_m)) tmp = 0.0 if (Float64(angle_m / 180.0) <= 1e-134) tmp = Float64(0.011111111111111112 * Float64(Float64(b * t_0) - Float64(a_m * t_0))); elseif (Float64(angle_m / 180.0) <= 4e+174) tmp = Float64(2.0 * Float64(cos(Float64(pi * Float64(angle_m / 180.0))) * Float64(Float64(Float64(b + a_m) * Float64(b - a_m)) * sin(t_1)))); else tmp = Float64(sin(Float64(2.0 * t_1)) * Float64((b ^ 2.0) + (a_m ^ 2.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 = angle_m * (pi * (b + a_m)); t_1 = pi * (0.005555555555555556 * angle_m); tmp = 0.0; if ((angle_m / 180.0) <= 1e-134) tmp = 0.011111111111111112 * ((b * t_0) - (a_m * t_0)); elseif ((angle_m / 180.0) <= 4e+174) tmp = 2.0 * (cos((pi * (angle_m / 180.0))) * (((b + a_m) * (b - a_m)) * sin(t_1))); else tmp = sin((2.0 * t_1)) * ((b ^ 2.0) + (a_m ^ 2.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[(angle$95$m * N[(Pi * N[(b + a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(Pi * N[(0.005555555555555556 * angle$95$m), $MachinePrecision]), $MachinePrecision]}, N[(angle$95$s * If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 1e-134], N[(0.011111111111111112 * N[(N[(b * t$95$0), $MachinePrecision] - N[(a$95$m * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 4e+174], N[(2.0 * N[(N[Cos[N[(Pi * N[(angle$95$m / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(N[(b + a$95$m), $MachinePrecision] * N[(b - a$95$m), $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[N[(2.0 * t$95$1), $MachinePrecision]], $MachinePrecision] * N[(N[Power[b, 2.0], $MachinePrecision] + N[Power[a$95$m, 2.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 := angle\_m \cdot \left(\pi \cdot \left(b + a\_m\right)\right)\\
t_1 := \pi \cdot \left(0.005555555555555556 \cdot angle\_m\right)\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{angle\_m}{180} \leq 10^{-134}:\\
\;\;\;\;0.011111111111111112 \cdot \left(b \cdot t\_0 - a\_m \cdot t\_0\right)\\
\mathbf{elif}\;\frac{angle\_m}{180} \leq 4 \cdot 10^{+174}:\\
\;\;\;\;2 \cdot \left(\cos \left(\pi \cdot \frac{angle\_m}{180}\right) \cdot \left(\left(\left(b + a\_m\right) \cdot \left(b - a\_m\right)\right) \cdot \sin t\_1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sin \left(2 \cdot t\_1\right) \cdot \left({b}^{2} + {a\_m}^{2}\right)\\
\end{array}
\end{array}
\end{array}
if (/.f64 angle 180) < 1.00000000000000004e-134Initial program 47.8%
associate-*l*47.8%
*-commutative47.8%
associate-*l*47.8%
Simplified47.8%
Taylor expanded in angle around 0 48.0%
unpow248.0%
unpow248.0%
difference-of-squares50.1%
Applied egg-rr50.1%
Taylor expanded in angle around 0 50.1%
associate-*r*50.1%
+-commutative50.1%
Simplified50.1%
associate-*r*65.4%
sub-neg65.4%
distribute-lft-in60.4%
associate-*l*60.3%
associate-*l*60.4%
Applied egg-rr60.4%
if 1.00000000000000004e-134 < (/.f64 angle 180) < 4.00000000000000028e174Initial program 69.8%
associate-*l*69.8%
associate-*l*69.8%
Simplified69.8%
unpow260.8%
unpow260.8%
difference-of-squares62.3%
Applied egg-rr71.3%
Taylor expanded in angle around inf 67.4%
associate-*r*65.3%
*-commutative65.3%
*-commutative65.3%
*-commutative65.3%
Simplified72.8%
if 4.00000000000000028e174 < (/.f64 angle 180) Initial program 35.1%
associate-*l*35.1%
*-commutative35.1%
associate-*l*35.1%
Simplified35.1%
add-cbrt-cube35.7%
pow1/332.2%
Applied egg-rr32.2%
unpow1/335.9%
rem-cbrt-cube35.3%
*-commutative35.3%
sub-neg35.3%
distribute-lft-in35.3%
associate-*l*35.3%
*-commutative35.3%
associate-*l*38.6%
associate-*l*38.6%
*-commutative38.6%
associate-*l*41.8%
add-sqr-sqrt17.9%
sqrt-unprod45.4%
Applied egg-rr42.3%
distribute-lft-out42.3%
associate-*r*45.9%
Simplified45.9%
Final simplification61.9%
a_m = (fabs.f64 a)
angle\_m = (fabs.f64 angle)
angle\_s = (copysign.f64 1 angle)
(FPCore (angle_s a_m b angle_m)
:precision binary64
(let* ((t_0 (* (+ b a_m) (- b a_m))) (t_1 (* angle_m (* PI (+ b a_m)))))
(*
angle_s
(if (<= (/ angle_m 180.0) 1e-134)
(* 0.011111111111111112 (- (* b t_1) (* a_m t_1)))
(if (<= (/ angle_m 180.0) 4e+174)
(*
2.0
(*
(cos (* PI (/ angle_m 180.0)))
(* t_0 (sin (* PI (* 0.005555555555555556 angle_m))))))
(* t_0 (sin (* 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 t_0 = (b + a_m) * (b - a_m);
double t_1 = angle_m * (((double) M_PI) * (b + a_m));
double tmp;
if ((angle_m / 180.0) <= 1e-134) {
tmp = 0.011111111111111112 * ((b * t_1) - (a_m * t_1));
} else if ((angle_m / 180.0) <= 4e+174) {
tmp = 2.0 * (cos((((double) M_PI) * (angle_m / 180.0))) * (t_0 * sin((((double) M_PI) * (0.005555555555555556 * angle_m)))));
} else {
tmp = t_0 * sin((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 t_0 = (b + a_m) * (b - a_m);
double t_1 = angle_m * (Math.PI * (b + a_m));
double tmp;
if ((angle_m / 180.0) <= 1e-134) {
tmp = 0.011111111111111112 * ((b * t_1) - (a_m * t_1));
} else if ((angle_m / 180.0) <= 4e+174) {
tmp = 2.0 * (Math.cos((Math.PI * (angle_m / 180.0))) * (t_0 * Math.sin((Math.PI * (0.005555555555555556 * angle_m)))));
} else {
tmp = t_0 * Math.sin((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): t_0 = (b + a_m) * (b - a_m) t_1 = angle_m * (math.pi * (b + a_m)) tmp = 0 if (angle_m / 180.0) <= 1e-134: tmp = 0.011111111111111112 * ((b * t_1) - (a_m * t_1)) elif (angle_m / 180.0) <= 4e+174: tmp = 2.0 * (math.cos((math.pi * (angle_m / 180.0))) * (t_0 * math.sin((math.pi * (0.005555555555555556 * angle_m))))) else: tmp = t_0 * math.sin((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) t_0 = Float64(Float64(b + a_m) * Float64(b - a_m)) t_1 = Float64(angle_m * Float64(pi * Float64(b + a_m))) tmp = 0.0 if (Float64(angle_m / 180.0) <= 1e-134) tmp = Float64(0.011111111111111112 * Float64(Float64(b * t_1) - Float64(a_m * t_1))); elseif (Float64(angle_m / 180.0) <= 4e+174) tmp = Float64(2.0 * Float64(cos(Float64(pi * Float64(angle_m / 180.0))) * Float64(t_0 * sin(Float64(pi * Float64(0.005555555555555556 * angle_m)))))); else tmp = Float64(t_0 * sin(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) t_0 = (b + a_m) * (b - a_m); t_1 = angle_m * (pi * (b + a_m)); tmp = 0.0; if ((angle_m / 180.0) <= 1e-134) tmp = 0.011111111111111112 * ((b * t_1) - (a_m * t_1)); elseif ((angle_m / 180.0) <= 4e+174) tmp = 2.0 * (cos((pi * (angle_m / 180.0))) * (t_0 * sin((pi * (0.005555555555555556 * angle_m))))); else tmp = t_0 * sin((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_] := Block[{t$95$0 = N[(N[(b + a$95$m), $MachinePrecision] * N[(b - a$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(angle$95$m * N[(Pi * N[(b + a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(angle$95$s * If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 1e-134], N[(0.011111111111111112 * N[(N[(b * t$95$1), $MachinePrecision] - N[(a$95$m * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 4e+174], N[(2.0 * N[(N[Cos[N[(Pi * N[(angle$95$m / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 * N[Sin[N[(Pi * N[(0.005555555555555556 * angle$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[Sin[N[(2.0 * N[(0.005555555555555556 * N[(angle$95$m * Pi), $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(b + a\_m\right) \cdot \left(b - a\_m\right)\\
t_1 := angle\_m \cdot \left(\pi \cdot \left(b + a\_m\right)\right)\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{angle\_m}{180} \leq 10^{-134}:\\
\;\;\;\;0.011111111111111112 \cdot \left(b \cdot t\_1 - a\_m \cdot t\_1\right)\\
\mathbf{elif}\;\frac{angle\_m}{180} \leq 4 \cdot 10^{+174}:\\
\;\;\;\;2 \cdot \left(\cos \left(\pi \cdot \frac{angle\_m}{180}\right) \cdot \left(t\_0 \cdot \sin \left(\pi \cdot \left(0.005555555555555556 \cdot angle\_m\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \sin \left(2 \cdot \left(0.005555555555555556 \cdot \left(angle\_m \cdot \pi\right)\right)\right)\\
\end{array}
\end{array}
\end{array}
if (/.f64 angle 180) < 1.00000000000000004e-134Initial program 47.8%
associate-*l*47.8%
*-commutative47.8%
associate-*l*47.8%
Simplified47.8%
Taylor expanded in angle around 0 48.0%
unpow248.0%
unpow248.0%
difference-of-squares50.1%
Applied egg-rr50.1%
Taylor expanded in angle around 0 50.1%
associate-*r*50.1%
+-commutative50.1%
Simplified50.1%
associate-*r*65.4%
sub-neg65.4%
distribute-lft-in60.4%
associate-*l*60.3%
associate-*l*60.4%
Applied egg-rr60.4%
if 1.00000000000000004e-134 < (/.f64 angle 180) < 4.00000000000000028e174Initial program 69.8%
associate-*l*69.8%
associate-*l*69.8%
Simplified69.8%
unpow260.8%
unpow260.8%
difference-of-squares62.3%
Applied egg-rr71.3%
Taylor expanded in angle around inf 67.4%
associate-*r*65.3%
*-commutative65.3%
*-commutative65.3%
*-commutative65.3%
Simplified72.8%
if 4.00000000000000028e174 < (/.f64 angle 180) Initial program 35.1%
associate-*l*35.1%
*-commutative35.1%
associate-*l*35.1%
Simplified35.1%
unpow228.1%
unpow228.1%
difference-of-squares34.8%
Applied egg-rr38.4%
pow138.4%
2-sin38.4%
div-inv38.6%
metadata-eval38.6%
Applied egg-rr38.6%
unpow138.6%
*-commutative38.6%
*-commutative38.6%
associate-*r*51.6%
Simplified51.6%
Final simplification62.6%
a_m = (fabs.f64 a)
angle\_m = (fabs.f64 angle)
angle\_s = (copysign.f64 1 angle)
(FPCore (angle_s a_m b angle_m)
:precision binary64
(let* ((t_0 (* angle_m (* PI (+ b a_m))))
(t_1 (* 0.005555555555555556 (* angle_m PI))))
(*
angle_s
(if (<= (/ angle_m 180.0) 1e-116)
(* 0.011111111111111112 (- (* b t_0) (* a_m t_0)))
(* 2.0 (* (cos t_1) (* (sin t_1) (* (+ b a_m) (- 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 t_0 = angle_m * (((double) M_PI) * (b + a_m));
double t_1 = 0.005555555555555556 * (angle_m * ((double) M_PI));
double tmp;
if ((angle_m / 180.0) <= 1e-116) {
tmp = 0.011111111111111112 * ((b * t_0) - (a_m * t_0));
} else {
tmp = 2.0 * (cos(t_1) * (sin(t_1) * ((b + a_m) * (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 t_0 = angle_m * (Math.PI * (b + a_m));
double t_1 = 0.005555555555555556 * (angle_m * Math.PI);
double tmp;
if ((angle_m / 180.0) <= 1e-116) {
tmp = 0.011111111111111112 * ((b * t_0) - (a_m * t_0));
} else {
tmp = 2.0 * (Math.cos(t_1) * (Math.sin(t_1) * ((b + a_m) * (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): t_0 = angle_m * (math.pi * (b + a_m)) t_1 = 0.005555555555555556 * (angle_m * math.pi) tmp = 0 if (angle_m / 180.0) <= 1e-116: tmp = 0.011111111111111112 * ((b * t_0) - (a_m * t_0)) else: tmp = 2.0 * (math.cos(t_1) * (math.sin(t_1) * ((b + a_m) * (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) t_0 = Float64(angle_m * Float64(pi * Float64(b + a_m))) t_1 = Float64(0.005555555555555556 * Float64(angle_m * pi)) tmp = 0.0 if (Float64(angle_m / 180.0) <= 1e-116) tmp = Float64(0.011111111111111112 * Float64(Float64(b * t_0) - Float64(a_m * t_0))); else tmp = Float64(2.0 * Float64(cos(t_1) * Float64(sin(t_1) * Float64(Float64(b + a_m) * 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) t_0 = angle_m * (pi * (b + a_m)); t_1 = 0.005555555555555556 * (angle_m * pi); tmp = 0.0; if ((angle_m / 180.0) <= 1e-116) tmp = 0.011111111111111112 * ((b * t_0) - (a_m * t_0)); else tmp = 2.0 * (cos(t_1) * (sin(t_1) * ((b + a_m) * (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_] := Block[{t$95$0 = N[(angle$95$m * N[(Pi * N[(b + a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.005555555555555556 * N[(angle$95$m * Pi), $MachinePrecision]), $MachinePrecision]}, N[(angle$95$s * If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 1e-116], N[(0.011111111111111112 * N[(N[(b * t$95$0), $MachinePrecision] - N[(a$95$m * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[Cos[t$95$1], $MachinePrecision] * N[(N[Sin[t$95$1], $MachinePrecision] * N[(N[(b + a$95$m), $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)
\\
\begin{array}{l}
t_0 := angle\_m \cdot \left(\pi \cdot \left(b + a\_m\right)\right)\\
t_1 := 0.005555555555555556 \cdot \left(angle\_m \cdot \pi\right)\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{angle\_m}{180} \leq 10^{-116}:\\
\;\;\;\;0.011111111111111112 \cdot \left(b \cdot t\_0 - a\_m \cdot t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\cos t\_1 \cdot \left(\sin t\_1 \cdot \left(\left(b + a\_m\right) \cdot \left(b - a\_m\right)\right)\right)\right)\\
\end{array}
\end{array}
\end{array}
if (/.f64 angle 180) < 9.9999999999999999e-117Initial program 48.1%
associate-*l*48.1%
*-commutative48.1%
associate-*l*48.1%
Simplified48.1%
Taylor expanded in angle around 0 48.3%
unpow248.3%
unpow248.3%
difference-of-squares50.4%
Applied egg-rr50.4%
Taylor expanded in angle around 0 50.4%
associate-*r*50.4%
+-commutative50.4%
Simplified50.4%
associate-*r*65.6%
sub-neg65.6%
distribute-lft-in60.6%
associate-*l*60.6%
associate-*l*60.6%
Applied egg-rr60.6%
if 9.9999999999999999e-117 < (/.f64 angle 180) Initial program 58.6%
associate-*l*58.6%
*-commutative58.6%
associate-*l*58.6%
Simplified58.6%
unpow250.2%
unpow250.2%
difference-of-squares53.3%
Applied egg-rr60.7%
Taylor expanded in angle around inf 64.6%
Final simplification62.1%
a_m = (fabs.f64 a)
angle\_m = (fabs.f64 angle)
angle\_s = (copysign.f64 1 angle)
(FPCore (angle_s a_m b angle_m)
:precision binary64
(let* ((t_0 (* angle_m (* PI (+ b a_m)))))
(*
angle_s
(if (<= (/ angle_m 180.0) 1e-116)
(* 0.011111111111111112 (- (* b t_0) (* a_m t_0)))
(*
(* (+ b a_m) (- b a_m))
(sin (* 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 t_0 = angle_m * (((double) M_PI) * (b + a_m));
double tmp;
if ((angle_m / 180.0) <= 1e-116) {
tmp = 0.011111111111111112 * ((b * t_0) - (a_m * t_0));
} else {
tmp = ((b + a_m) * (b - a_m)) * sin((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 t_0 = angle_m * (Math.PI * (b + a_m));
double tmp;
if ((angle_m / 180.0) <= 1e-116) {
tmp = 0.011111111111111112 * ((b * t_0) - (a_m * t_0));
} else {
tmp = ((b + a_m) * (b - a_m)) * Math.sin((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): t_0 = angle_m * (math.pi * (b + a_m)) tmp = 0 if (angle_m / 180.0) <= 1e-116: tmp = 0.011111111111111112 * ((b * t_0) - (a_m * t_0)) else: tmp = ((b + a_m) * (b - a_m)) * math.sin((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) t_0 = Float64(angle_m * Float64(pi * Float64(b + a_m))) tmp = 0.0 if (Float64(angle_m / 180.0) <= 1e-116) tmp = Float64(0.011111111111111112 * Float64(Float64(b * t_0) - Float64(a_m * t_0))); else tmp = Float64(Float64(Float64(b + a_m) * Float64(b - a_m)) * sin(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) t_0 = angle_m * (pi * (b + a_m)); tmp = 0.0; if ((angle_m / 180.0) <= 1e-116) tmp = 0.011111111111111112 * ((b * t_0) - (a_m * t_0)); else tmp = ((b + a_m) * (b - a_m)) * sin((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_] := Block[{t$95$0 = N[(angle$95$m * N[(Pi * N[(b + a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(angle$95$s * If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 1e-116], N[(0.011111111111111112 * N[(N[(b * t$95$0), $MachinePrecision] - N[(a$95$m * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(b + a$95$m), $MachinePrecision] * N[(b - a$95$m), $MachinePrecision]), $MachinePrecision] * N[Sin[N[(2.0 * N[(0.005555555555555556 * N[(angle$95$m * Pi), $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 := angle\_m \cdot \left(\pi \cdot \left(b + a\_m\right)\right)\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{angle\_m}{180} \leq 10^{-116}:\\
\;\;\;\;0.011111111111111112 \cdot \left(b \cdot t\_0 - a\_m \cdot t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(b + a\_m\right) \cdot \left(b - a\_m\right)\right) \cdot \sin \left(2 \cdot \left(0.005555555555555556 \cdot \left(angle\_m \cdot \pi\right)\right)\right)\\
\end{array}
\end{array}
\end{array}
if (/.f64 angle 180) < 9.9999999999999999e-117Initial program 48.1%
associate-*l*48.1%
*-commutative48.1%
associate-*l*48.1%
Simplified48.1%
Taylor expanded in angle around 0 48.3%
unpow248.3%
unpow248.3%
difference-of-squares50.4%
Applied egg-rr50.4%
Taylor expanded in angle around 0 50.4%
associate-*r*50.4%
+-commutative50.4%
Simplified50.4%
associate-*r*65.6%
sub-neg65.6%
distribute-lft-in60.6%
associate-*l*60.6%
associate-*l*60.6%
Applied egg-rr60.6%
if 9.9999999999999999e-117 < (/.f64 angle 180) Initial program 58.6%
associate-*l*58.6%
*-commutative58.6%
associate-*l*58.6%
Simplified58.6%
unpow250.2%
unpow250.2%
difference-of-squares53.3%
Applied egg-rr60.7%
pow160.7%
2-sin60.7%
div-inv61.9%
metadata-eval61.9%
Applied egg-rr61.9%
unpow161.9%
*-commutative61.9%
*-commutative61.9%
associate-*r*64.6%
Simplified64.6%
Final simplification62.1%
a_m = (fabs.f64 a)
angle\_m = (fabs.f64 angle)
angle\_s = (copysign.f64 1 angle)
(FPCore (angle_s a_m b angle_m)
:precision binary64
(let* ((t_0 (* angle_m (* PI (+ b a_m)))))
(*
angle_s
(if (<= angle_m 1.75e-131)
(* 0.011111111111111112 (- (* b t_0) (* a_m t_0)))
(* angle_m (* (* (+ b a_m) (- b a_m)) (* PI 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 t_0 = angle_m * (((double) M_PI) * (b + a_m));
double tmp;
if (angle_m <= 1.75e-131) {
tmp = 0.011111111111111112 * ((b * t_0) - (a_m * t_0));
} else {
tmp = angle_m * (((b + a_m) * (b - a_m)) * (((double) M_PI) * 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 t_0 = angle_m * (Math.PI * (b + a_m));
double tmp;
if (angle_m <= 1.75e-131) {
tmp = 0.011111111111111112 * ((b * t_0) - (a_m * t_0));
} else {
tmp = angle_m * (((b + a_m) * (b - a_m)) * (Math.PI * 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): t_0 = angle_m * (math.pi * (b + a_m)) tmp = 0 if angle_m <= 1.75e-131: tmp = 0.011111111111111112 * ((b * t_0) - (a_m * t_0)) else: tmp = angle_m * (((b + a_m) * (b - a_m)) * (math.pi * 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) t_0 = Float64(angle_m * Float64(pi * Float64(b + a_m))) tmp = 0.0 if (angle_m <= 1.75e-131) tmp = Float64(0.011111111111111112 * Float64(Float64(b * t_0) - Float64(a_m * t_0))); else tmp = Float64(angle_m * Float64(Float64(Float64(b + a_m) * Float64(b - a_m)) * Float64(pi * 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) t_0 = angle_m * (pi * (b + a_m)); tmp = 0.0; if (angle_m <= 1.75e-131) tmp = 0.011111111111111112 * ((b * t_0) - (a_m * t_0)); else tmp = angle_m * (((b + a_m) * (b - a_m)) * (pi * 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_] := Block[{t$95$0 = N[(angle$95$m * N[(Pi * N[(b + a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(angle$95$s * If[LessEqual[angle$95$m, 1.75e-131], N[(0.011111111111111112 * N[(N[(b * t$95$0), $MachinePrecision] - N[(a$95$m * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(angle$95$m * N[(N[(N[(b + a$95$m), $MachinePrecision] * N[(b - a$95$m), $MachinePrecision]), $MachinePrecision] * N[(Pi * 0.011111111111111112), $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 := angle\_m \cdot \left(\pi \cdot \left(b + a\_m\right)\right)\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;angle\_m \leq 1.75 \cdot 10^{-131}:\\
\;\;\;\;0.011111111111111112 \cdot \left(b \cdot t\_0 - a\_m \cdot t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;angle\_m \cdot \left(\left(\left(b + a\_m\right) \cdot \left(b - a\_m\right)\right) \cdot \left(\pi \cdot 0.011111111111111112\right)\right)\\
\end{array}
\end{array}
\end{array}
if angle < 1.7500000000000001e-131Initial program 47.8%
associate-*l*47.8%
*-commutative47.8%
associate-*l*47.8%
Simplified47.8%
Taylor expanded in angle around 0 48.0%
unpow248.0%
unpow248.0%
difference-of-squares50.1%
Applied egg-rr50.1%
Taylor expanded in angle around 0 50.1%
associate-*r*50.1%
+-commutative50.1%
Simplified50.1%
associate-*r*65.4%
sub-neg65.4%
distribute-lft-in60.4%
associate-*l*60.3%
associate-*l*60.4%
Applied egg-rr60.4%
if 1.7500000000000001e-131 < angle Initial program 59.1%
associate-*l*59.1%
*-commutative59.1%
associate-*l*59.1%
Simplified59.1%
Taylor expanded in angle around 0 50.7%
unpow250.7%
unpow250.7%
difference-of-squares53.8%
Applied egg-rr53.8%
Taylor expanded in angle around 0 53.8%
*-commutative53.8%
+-commutative53.8%
associate-*l*53.8%
+-commutative53.8%
*-commutative53.8%
associate-*r*53.9%
+-commutative53.9%
Simplified53.9%
Final simplification57.9%
a_m = (fabs.f64 a) angle\_m = (fabs.f64 angle) angle\_s = (copysign.f64 1 angle) (FPCore (angle_s a_m b angle_m) :precision binary64 (* angle_s (* 0.011111111111111112 (* angle_m (* PI (* (+ b a_m) (- 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) * ((b + a_m) * (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 * ((b + a_m) * (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 * ((b + a_m) * (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(b + a_m) * 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 * ((b + a_m) * (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[(b + a$95$m), $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(b + a\_m\right) \cdot \left(b - a\_m\right)\right)\right)\right)\right)
\end{array}
Initial program 52.1%
associate-*l*52.1%
*-commutative52.1%
associate-*l*52.1%
Simplified52.1%
Taylor expanded in angle around 0 49.0%
unpow249.0%
unpow249.0%
difference-of-squares51.5%
Applied egg-rr51.5%
Final simplification51.5%
a_m = (fabs.f64 a) angle\_m = (fabs.f64 angle) angle\_s = (copysign.f64 1 angle) (FPCore (angle_s a_m b angle_m) :precision binary64 (* angle_s (* 0.011111111111111112 (* (* angle_m PI) (* (+ b a_m) (- 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)) * ((b + a_m) * (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) * ((b + a_m) * (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) * ((b + a_m) * (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(b + a_m) * 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) * ((b + a_m) * (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[(b + a$95$m), $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(b + a\_m\right) \cdot \left(b - a\_m\right)\right)\right)\right)
\end{array}
Initial program 52.1%
associate-*l*52.1%
*-commutative52.1%
associate-*l*52.1%
Simplified52.1%
Taylor expanded in angle around 0 49.0%
unpow249.0%
unpow249.0%
difference-of-squares51.5%
Applied egg-rr51.5%
Taylor expanded in angle around 0 51.5%
associate-*r*51.5%
+-commutative51.5%
Simplified51.5%
Final simplification51.5%
a_m = (fabs.f64 a) angle\_m = (fabs.f64 angle) angle\_s = (copysign.f64 1 angle) (FPCore (angle_s a_m b angle_m) :precision binary64 (* angle_s (* angle_m (* (* (+ b a_m) (- b a_m)) (* PI 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) {
return angle_s * (angle_m * (((b + a_m) * (b - a_m)) * (((double) M_PI) * 0.011111111111111112)));
}
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 * (angle_m * (((b + a_m) * (b - a_m)) * (Math.PI * 0.011111111111111112)));
}
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 * (angle_m * (((b + a_m) * (b - a_m)) * (math.pi * 0.011111111111111112)))
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(angle_m * Float64(Float64(Float64(b + a_m) * Float64(b - a_m)) * Float64(pi * 0.011111111111111112)))) 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 * (angle_m * (((b + a_m) * (b - a_m)) * (pi * 0.011111111111111112))); 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[(angle$95$m * N[(N[(N[(b + a$95$m), $MachinePrecision] * N[(b - a$95$m), $MachinePrecision]), $MachinePrecision] * N[(Pi * 0.011111111111111112), $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(angle\_m \cdot \left(\left(\left(b + a\_m\right) \cdot \left(b - a\_m\right)\right) \cdot \left(\pi \cdot 0.011111111111111112\right)\right)\right)
\end{array}
Initial program 52.1%
associate-*l*52.1%
*-commutative52.1%
associate-*l*52.1%
Simplified52.1%
Taylor expanded in angle around 0 49.0%
unpow249.0%
unpow249.0%
difference-of-squares51.5%
Applied egg-rr51.5%
Taylor expanded in angle around 0 51.5%
*-commutative51.5%
+-commutative51.5%
associate-*l*51.5%
+-commutative51.5%
*-commutative51.5%
associate-*r*51.6%
+-commutative51.6%
Simplified51.6%
Final simplification51.6%
herbie shell --seed 2024096
(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)))))