
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* PI (/ angle 180.0)))) (* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) (sin t_0)) (cos t_0))))
double code(double a, double b, double angle) {
double t_0 = ((double) M_PI) * (angle / 180.0);
return ((2.0 * (pow(b, 2.0) - pow(a, 2.0))) * sin(t_0)) * cos(t_0);
}
public static double code(double a, double b, double angle) {
double t_0 = Math.PI * (angle / 180.0);
return ((2.0 * (Math.pow(b, 2.0) - Math.pow(a, 2.0))) * Math.sin(t_0)) * Math.cos(t_0);
}
def code(a, b, angle): t_0 = math.pi * (angle / 180.0) return ((2.0 * (math.pow(b, 2.0) - math.pow(a, 2.0))) * math.sin(t_0)) * math.cos(t_0)
function code(a, b, angle) t_0 = Float64(pi * Float64(angle / 180.0)) return Float64(Float64(Float64(2.0 * Float64((b ^ 2.0) - (a ^ 2.0))) * sin(t_0)) * cos(t_0)) end
function tmp = code(a, b, angle) t_0 = pi * (angle / 180.0); tmp = ((2.0 * ((b ^ 2.0) - (a ^ 2.0))) * sin(t_0)) * cos(t_0); end
code[a_, b_, angle_] := Block[{t$95$0 = N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(2.0 * N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \pi \cdot \frac{angle}{180}\\
\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin t\_0\right) \cdot \cos t\_0
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* PI (/ angle 180.0)))) (* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) (sin t_0)) (cos t_0))))
double code(double a, double b, double angle) {
double t_0 = ((double) M_PI) * (angle / 180.0);
return ((2.0 * (pow(b, 2.0) - pow(a, 2.0))) * sin(t_0)) * cos(t_0);
}
public static double code(double a, double b, double angle) {
double t_0 = Math.PI * (angle / 180.0);
return ((2.0 * (Math.pow(b, 2.0) - Math.pow(a, 2.0))) * Math.sin(t_0)) * Math.cos(t_0);
}
def code(a, b, angle): t_0 = math.pi * (angle / 180.0) return ((2.0 * (math.pow(b, 2.0) - math.pow(a, 2.0))) * math.sin(t_0)) * math.cos(t_0)
function code(a, b, angle) t_0 = Float64(pi * Float64(angle / 180.0)) return Float64(Float64(Float64(2.0 * Float64((b ^ 2.0) - (a ^ 2.0))) * sin(t_0)) * cos(t_0)) end
function tmp = code(a, b, angle) t_0 = pi * (angle / 180.0); tmp = ((2.0 * ((b ^ 2.0) - (a ^ 2.0))) * sin(t_0)) * cos(t_0); end
code[a_, b_, angle_] := Block[{t$95$0 = N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(2.0 * N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \pi \cdot \frac{angle}{180}\\
\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin t\_0\right) \cdot \cos t\_0
\end{array}
\end{array}
b_m = (fabs.f64 b)
angle\_m = (fabs.f64 angle)
angle\_s = (copysign.f64 #s(literal 1 binary64) angle)
(FPCore (angle_s a b_m angle_m)
:precision binary64
(let* ((t_0 (sin (* -0.005555555555555556 (* PI angle_m))))
(t_1 (cos (exp (log (* PI (* angle_m 0.005555555555555556)))))))
(*
angle_s
(if (<= b_m 2.2e+140)
(* t_1 (* 2.0 (- (* a (* a t_0)) (* t_0 (pow b_m 2.0)))))
(if (<= b_m 2.5e+248)
(* t_1 (* 2.0 (fma b_m (* b_m (- t_0)) (* (pow a 2.0) t_0))))
(*
t_1
(*
2.0
(*
(sin (* angle_m (/ (cbrt (pow PI 3.0)) -180.0)))
(* (+ a b_m) (- a b_m))))))))))b_m = fabs(b);
angle\_m = fabs(angle);
angle\_s = copysign(1.0, angle);
double code(double angle_s, double a, double b_m, double angle_m) {
double t_0 = sin((-0.005555555555555556 * (((double) M_PI) * angle_m)));
double t_1 = cos(exp(log((((double) M_PI) * (angle_m * 0.005555555555555556)))));
double tmp;
if (b_m <= 2.2e+140) {
tmp = t_1 * (2.0 * ((a * (a * t_0)) - (t_0 * pow(b_m, 2.0))));
} else if (b_m <= 2.5e+248) {
tmp = t_1 * (2.0 * fma(b_m, (b_m * -t_0), (pow(a, 2.0) * t_0)));
} else {
tmp = t_1 * (2.0 * (sin((angle_m * (cbrt(pow(((double) M_PI), 3.0)) / -180.0))) * ((a + b_m) * (a - b_m))));
}
return angle_s * tmp;
}
b_m = abs(b) angle\_m = abs(angle) angle\_s = copysign(1.0, angle) function code(angle_s, a, b_m, angle_m) t_0 = sin(Float64(-0.005555555555555556 * Float64(pi * angle_m))) t_1 = cos(exp(log(Float64(pi * Float64(angle_m * 0.005555555555555556))))) tmp = 0.0 if (b_m <= 2.2e+140) tmp = Float64(t_1 * Float64(2.0 * Float64(Float64(a * Float64(a * t_0)) - Float64(t_0 * (b_m ^ 2.0))))); elseif (b_m <= 2.5e+248) tmp = Float64(t_1 * Float64(2.0 * fma(b_m, Float64(b_m * Float64(-t_0)), Float64((a ^ 2.0) * t_0)))); else tmp = Float64(t_1 * Float64(2.0 * Float64(sin(Float64(angle_m * Float64(cbrt((pi ^ 3.0)) / -180.0))) * Float64(Float64(a + b_m) * Float64(a - b_m))))); end return Float64(angle_s * tmp) end
b_m = N[Abs[b], $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_, b$95$m_, angle$95$m_] := Block[{t$95$0 = N[Sin[N[(-0.005555555555555556 * N[(Pi * angle$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[Exp[N[Log[N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, N[(angle$95$s * If[LessEqual[b$95$m, 2.2e+140], N[(t$95$1 * N[(2.0 * N[(N[(a * N[(a * t$95$0), $MachinePrecision]), $MachinePrecision] - N[(t$95$0 * N[Power[b$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b$95$m, 2.5e+248], N[(t$95$1 * N[(2.0 * N[(b$95$m * N[(b$95$m * (-t$95$0)), $MachinePrecision] + N[(N[Power[a, 2.0], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(2.0 * N[(N[Sin[N[(angle$95$m * N[(N[Power[N[Power[Pi, 3.0], $MachinePrecision], 1/3], $MachinePrecision] / -180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(a + b$95$m), $MachinePrecision] * N[(a - b$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]]
\begin{array}{l}
b_m = \left|b\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(\pi \cdot angle\_m\right)\right)\\
t_1 := \cos \left(e^{\log \left(\pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)\right)}\right)\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;b\_m \leq 2.2 \cdot 10^{+140}:\\
\;\;\;\;t\_1 \cdot \left(2 \cdot \left(a \cdot \left(a \cdot t\_0\right) - t\_0 \cdot {b\_m}^{2}\right)\right)\\
\mathbf{elif}\;b\_m \leq 2.5 \cdot 10^{+248}:\\
\;\;\;\;t\_1 \cdot \left(2 \cdot \mathsf{fma}\left(b\_m, b\_m \cdot \left(-t\_0\right), {a}^{2} \cdot t\_0\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(2 \cdot \left(\sin \left(angle\_m \cdot \frac{\sqrt[3]{{\pi}^{3}}}{-180}\right) \cdot \left(\left(a + b\_m\right) \cdot \left(a - b\_m\right)\right)\right)\right)\\
\end{array}
\end{array}
\end{array}
if b < 2.1999999999999998e140Initial program 62.8%
Simplified62.8%
add-exp-log33.1%
add-sqr-sqrt33.1%
sqrt-unprod56.0%
associate-*r/56.0%
associate-*r/56.0%
frac-times55.6%
*-commutative55.6%
*-commutative55.6%
metadata-eval55.6%
metadata-eval55.6%
frac-times56.0%
associate-*r/56.0%
associate-*r/56.0%
sqrt-unprod31.2%
add-sqr-sqrt31.2%
div-inv31.2%
metadata-eval31.2%
Applied egg-rr31.2%
unpow231.2%
unpow231.2%
difference-of-squares32.1%
Applied egg-rr32.1%
Taylor expanded in a around 0 34.5%
+-commutative34.5%
mul-1-neg34.5%
unsub-neg34.5%
Simplified34.5%
if 2.1999999999999998e140 < b < 2.4999999999999998e248Initial program 33.9%
Simplified38.4%
add-exp-log23.0%
add-sqr-sqrt23.0%
sqrt-unprod37.6%
associate-*r/37.6%
associate-*r/37.6%
frac-times37.6%
*-commutative37.6%
*-commutative37.6%
metadata-eval37.6%
metadata-eval37.6%
frac-times37.6%
associate-*r/37.6%
associate-*r/37.6%
sqrt-unprod24.8%
add-sqr-sqrt24.8%
div-inv24.8%
metadata-eval24.8%
Applied egg-rr24.8%
unpow224.8%
unpow224.8%
difference-of-squares24.8%
Applied egg-rr24.8%
Taylor expanded in b around 0 45.0%
fma-define49.6%
Simplified49.6%
if 2.4999999999999998e248 < b Initial program 50.0%
Simplified50.0%
add-exp-log50.0%
add-sqr-sqrt50.0%
sqrt-unprod50.0%
associate-*r/50.0%
associate-*r/50.0%
frac-times50.0%
*-commutative50.0%
*-commutative50.0%
metadata-eval50.0%
metadata-eval50.0%
frac-times50.0%
associate-*r/50.0%
associate-*r/50.0%
sqrt-unprod8.3%
add-sqr-sqrt8.3%
div-inv8.3%
metadata-eval8.3%
Applied egg-rr8.3%
unpow28.3%
unpow28.3%
difference-of-squares16.7%
Applied egg-rr16.7%
add-cbrt-cube33.3%
pow333.3%
Applied egg-rr33.3%
Final simplification35.7%
b_m = (fabs.f64 b)
angle\_m = (fabs.f64 angle)
angle\_s = (copysign.f64 #s(literal 1 binary64) angle)
(FPCore (angle_s a b_m angle_m)
:precision binary64
(let* ((t_0 (sin (* angle_m (* PI -0.005555555555555556)))))
(*
angle_s
(if (<= (pow a 2.0) INFINITY)
(*
(cos (exp (log (* PI (* angle_m 0.005555555555555556)))))
(*
2.0
(fma
b_m
(fma -1.0 (* b_m t_0) (* t_0 (* a 0.0)))
(* (pow a 2.0) t_0))))
(* -0.011111111111111112 (pow (* a (sqrt (* PI angle_m))) 2.0))))))b_m = fabs(b);
angle\_m = fabs(angle);
angle\_s = copysign(1.0, angle);
double code(double angle_s, double a, double b_m, double angle_m) {
double t_0 = sin((angle_m * (((double) M_PI) * -0.005555555555555556)));
double tmp;
if (pow(a, 2.0) <= ((double) INFINITY)) {
tmp = cos(exp(log((((double) M_PI) * (angle_m * 0.005555555555555556))))) * (2.0 * fma(b_m, fma(-1.0, (b_m * t_0), (t_0 * (a * 0.0))), (pow(a, 2.0) * t_0)));
} else {
tmp = -0.011111111111111112 * pow((a * sqrt((((double) M_PI) * angle_m))), 2.0);
}
return angle_s * tmp;
}
b_m = abs(b) angle\_m = abs(angle) angle\_s = copysign(1.0, angle) function code(angle_s, a, b_m, angle_m) t_0 = sin(Float64(angle_m * Float64(pi * -0.005555555555555556))) tmp = 0.0 if ((a ^ 2.0) <= Inf) tmp = Float64(cos(exp(log(Float64(pi * Float64(angle_m * 0.005555555555555556))))) * Float64(2.0 * fma(b_m, fma(-1.0, Float64(b_m * t_0), Float64(t_0 * Float64(a * 0.0))), Float64((a ^ 2.0) * t_0)))); else tmp = Float64(-0.011111111111111112 * (Float64(a * sqrt(Float64(pi * angle_m))) ^ 2.0)); end return Float64(angle_s * tmp) end
b_m = N[Abs[b], $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_, b$95$m_, angle$95$m_] := Block[{t$95$0 = N[Sin[N[(angle$95$m * N[(Pi * -0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[(angle$95$s * If[LessEqual[N[Power[a, 2.0], $MachinePrecision], Infinity], N[(N[Cos[N[Exp[N[Log[N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(2.0 * N[(b$95$m * N[(-1.0 * N[(b$95$m * t$95$0), $MachinePrecision] + N[(t$95$0 * N[(a * 0.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Power[a, 2.0], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.011111111111111112 * N[Power[N[(a * N[Sqrt[N[(Pi * angle$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
b_m = \left|b\right|
\\
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
\begin{array}{l}
t_0 := \sin \left(angle\_m \cdot \left(\pi \cdot -0.005555555555555556\right)\right)\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;{a}^{2} \leq \infty:\\
\;\;\;\;\cos \left(e^{\log \left(\pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)\right)}\right) \cdot \left(2 \cdot \mathsf{fma}\left(b\_m, \mathsf{fma}\left(-1, b\_m \cdot t\_0, t\_0 \cdot \left(a \cdot 0\right)\right), {a}^{2} \cdot t\_0\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-0.011111111111111112 \cdot {\left(a \cdot \sqrt{\pi \cdot angle\_m}\right)}^{2}\\
\end{array}
\end{array}
\end{array}
if (pow.f64 a #s(literal 2 binary64)) < +inf.0Initial program 59.7%
Simplified60.1%
add-exp-log33.0%
add-sqr-sqrt33.0%
sqrt-unprod54.1%
associate-*r/54.1%
associate-*r/54.1%
frac-times53.8%
*-commutative53.8%
*-commutative53.8%
metadata-eval53.8%
metadata-eval53.8%
frac-times54.1%
associate-*r/54.1%
associate-*r/54.1%
sqrt-unprod29.5%
add-sqr-sqrt29.5%
div-inv29.5%
metadata-eval29.5%
Applied egg-rr29.5%
unpow229.5%
unpow229.5%
difference-of-squares30.7%
Applied egg-rr30.7%
Taylor expanded in b around 0 32.0%
fma-define33.2%
Simplified32.9%
if +inf.0 < (pow.f64 a #s(literal 2 binary64)) Initial program 59.7%
associate-*l*59.7%
associate-*l*59.7%
Simplified59.7%
Taylor expanded in angle around 0 57.8%
Taylor expanded in b around 0 37.5%
add-sqr-sqrt27.5%
pow227.5%
sqrt-prod20.0%
sqrt-pow121.0%
metadata-eval21.0%
pow121.0%
*-commutative21.0%
Applied egg-rr21.0%
Final simplification32.9%
b_m = (fabs.f64 b)
angle\_m = (fabs.f64 angle)
angle\_s = (copysign.f64 #s(literal 1 binary64) angle)
(FPCore (angle_s a b_m angle_m)
:precision binary64
(let* ((t_0 (sin (* angle_m (* PI -0.005555555555555556))))
(t_1 (sin (* -0.005555555555555556 (* PI angle_m))))
(t_2 (* PI (* angle_m 0.005555555555555556))))
(*
angle_s
(if (<= b_m 1.25e+135)
(*
(cos (exp (log t_2)))
(* 2.0 (- (* a (* a t_1)) (* t_1 (pow b_m 2.0)))))
(if (<= b_m 1.4e+202)
(* (* 2.0 (cos t_2)) (fma b_m (* b_m (- t_0)) (* (pow a 2.0) t_0)))
(*
(cos (exp (- (log (* PI angle_m)) (log 180.0))))
(*
2.0
(* (* (+ a b_m) (- a b_m)) (sin (* angle_m (/ PI -180.0)))))))))))b_m = fabs(b);
angle\_m = fabs(angle);
angle\_s = copysign(1.0, angle);
double code(double angle_s, double a, double b_m, double angle_m) {
double t_0 = sin((angle_m * (((double) M_PI) * -0.005555555555555556)));
double t_1 = sin((-0.005555555555555556 * (((double) M_PI) * angle_m)));
double t_2 = ((double) M_PI) * (angle_m * 0.005555555555555556);
double tmp;
if (b_m <= 1.25e+135) {
tmp = cos(exp(log(t_2))) * (2.0 * ((a * (a * t_1)) - (t_1 * pow(b_m, 2.0))));
} else if (b_m <= 1.4e+202) {
tmp = (2.0 * cos(t_2)) * fma(b_m, (b_m * -t_0), (pow(a, 2.0) * t_0));
} else {
tmp = cos(exp((log((((double) M_PI) * angle_m)) - log(180.0)))) * (2.0 * (((a + b_m) * (a - b_m)) * sin((angle_m * (((double) M_PI) / -180.0)))));
}
return angle_s * tmp;
}
b_m = abs(b) angle\_m = abs(angle) angle\_s = copysign(1.0, angle) function code(angle_s, a, b_m, angle_m) t_0 = sin(Float64(angle_m * Float64(pi * -0.005555555555555556))) t_1 = sin(Float64(-0.005555555555555556 * Float64(pi * angle_m))) t_2 = Float64(pi * Float64(angle_m * 0.005555555555555556)) tmp = 0.0 if (b_m <= 1.25e+135) tmp = Float64(cos(exp(log(t_2))) * Float64(2.0 * Float64(Float64(a * Float64(a * t_1)) - Float64(t_1 * (b_m ^ 2.0))))); elseif (b_m <= 1.4e+202) tmp = Float64(Float64(2.0 * cos(t_2)) * fma(b_m, Float64(b_m * Float64(-t_0)), Float64((a ^ 2.0) * t_0))); else tmp = Float64(cos(exp(Float64(log(Float64(pi * angle_m)) - log(180.0)))) * Float64(2.0 * Float64(Float64(Float64(a + b_m) * Float64(a - b_m)) * sin(Float64(angle_m * Float64(pi / -180.0)))))); end return Float64(angle_s * tmp) end
b_m = N[Abs[b], $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_, b$95$m_, angle$95$m_] := Block[{t$95$0 = N[Sin[N[(angle$95$m * N[(Pi * -0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sin[N[(-0.005555555555555556 * N[(Pi * angle$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]}, N[(angle$95$s * If[LessEqual[b$95$m, 1.25e+135], N[(N[Cos[N[Exp[N[Log[t$95$2], $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(2.0 * N[(N[(a * N[(a * t$95$1), $MachinePrecision]), $MachinePrecision] - N[(t$95$1 * N[Power[b$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b$95$m, 1.4e+202], N[(N[(2.0 * N[Cos[t$95$2], $MachinePrecision]), $MachinePrecision] * N[(b$95$m * N[(b$95$m * (-t$95$0)), $MachinePrecision] + N[(N[Power[a, 2.0], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Cos[N[Exp[N[(N[Log[N[(Pi * angle$95$m), $MachinePrecision]], $MachinePrecision] - N[Log[180.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(2.0 * N[(N[(N[(a + b$95$m), $MachinePrecision] * N[(a - b$95$m), $MachinePrecision]), $MachinePrecision] * N[Sin[N[(angle$95$m * N[(Pi / -180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]]]
\begin{array}{l}
b_m = \left|b\right|
\\
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
\begin{array}{l}
t_0 := \sin \left(angle\_m \cdot \left(\pi \cdot -0.005555555555555556\right)\right)\\
t_1 := \sin \left(-0.005555555555555556 \cdot \left(\pi \cdot angle\_m\right)\right)\\
t_2 := \pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;b\_m \leq 1.25 \cdot 10^{+135}:\\
\;\;\;\;\cos \left(e^{\log t\_2}\right) \cdot \left(2 \cdot \left(a \cdot \left(a \cdot t\_1\right) - t\_1 \cdot {b\_m}^{2}\right)\right)\\
\mathbf{elif}\;b\_m \leq 1.4 \cdot 10^{+202}:\\
\;\;\;\;\left(2 \cdot \cos t\_2\right) \cdot \mathsf{fma}\left(b\_m, b\_m \cdot \left(-t\_0\right), {a}^{2} \cdot t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;\cos \left(e^{\log \left(\pi \cdot angle\_m\right) - \log 180}\right) \cdot \left(2 \cdot \left(\left(\left(a + b\_m\right) \cdot \left(a - b\_m\right)\right) \cdot \sin \left(angle\_m \cdot \frac{\pi}{-180}\right)\right)\right)\\
\end{array}
\end{array}
\end{array}
if b < 1.25000000000000007e135Initial program 63.1%
Simplified63.1%
add-exp-log33.2%
add-sqr-sqrt33.2%
sqrt-unprod56.3%
associate-*r/56.3%
associate-*r/56.3%
frac-times55.8%
*-commutative55.8%
*-commutative55.8%
metadata-eval55.8%
metadata-eval55.8%
frac-times56.3%
associate-*r/56.3%
associate-*r/56.3%
sqrt-unprod31.3%
add-sqr-sqrt31.3%
div-inv31.3%
metadata-eval31.3%
Applied egg-rr31.3%
unpow231.3%
unpow231.3%
difference-of-squares32.2%
Applied egg-rr32.2%
Taylor expanded in a around 0 34.6%
+-commutative34.6%
mul-1-neg34.6%
unsub-neg34.6%
Simplified34.6%
if 1.25000000000000007e135 < b < 1.40000000000000008e202Initial program 34.2%
Simplified40.3%
add-exp-log19.1%
add-sqr-sqrt19.1%
sqrt-unprod33.0%
associate-*r/33.0%
associate-*r/33.0%
frac-times33.0%
*-commutative33.0%
*-commutative33.0%
metadata-eval33.0%
metadata-eval33.0%
frac-times33.0%
associate-*r/33.0%
associate-*r/33.0%
sqrt-unprod21.6%
add-sqr-sqrt21.6%
div-inv21.6%
metadata-eval21.6%
Applied egg-rr21.6%
unpow221.6%
unpow221.6%
difference-of-squares21.6%
Applied egg-rr21.6%
Taylor expanded in b around 0 49.4%
fma-define49.4%
Simplified51.0%
pow151.0%
Applied egg-rr75.5%
unpow175.5%
*-commutative75.5%
Simplified75.5%
if 1.40000000000000008e202 < b Initial program 42.1%
Simplified42.1%
add-exp-log42.1%
add-sqr-sqrt42.1%
sqrt-unprod47.4%
associate-*r/47.4%
associate-*r/47.4%
frac-times47.4%
*-commutative47.4%
*-commutative47.4%
metadata-eval47.4%
metadata-eval47.4%
frac-times47.4%
associate-*r/47.4%
associate-*r/47.4%
sqrt-unprod15.8%
add-sqr-sqrt15.8%
div-inv15.8%
metadata-eval15.8%
Applied egg-rr15.8%
unpow215.8%
unpow215.8%
difference-of-squares21.1%
Applied egg-rr21.1%
log-prod21.1%
metadata-eval21.1%
div-inv21.1%
sum-log21.1%
associate-*r/21.1%
*-commutative21.1%
log-div15.8%
*-commutative15.8%
Applied egg-rr15.8%
Final simplification35.8%
b_m = (fabs.f64 b)
angle\_m = (fabs.f64 angle)
angle\_s = (copysign.f64 #s(literal 1 binary64) angle)
(FPCore (angle_s a b_m angle_m)
:precision binary64
(let* ((t_0 (sin (* angle_m (* PI -0.005555555555555556)))))
(*
angle_s
(if (<= (pow a 2.0) INFINITY)
(*
(* 2.0 (cos (* PI (* angle_m 0.005555555555555556))))
(fma b_m (* b_m (- t_0)) (* (pow a 2.0) t_0)))
(* -0.011111111111111112 (pow (* a (sqrt (* PI angle_m))) 2.0))))))b_m = fabs(b);
angle\_m = fabs(angle);
angle\_s = copysign(1.0, angle);
double code(double angle_s, double a, double b_m, double angle_m) {
double t_0 = sin((angle_m * (((double) M_PI) * -0.005555555555555556)));
double tmp;
if (pow(a, 2.0) <= ((double) INFINITY)) {
tmp = (2.0 * cos((((double) M_PI) * (angle_m * 0.005555555555555556)))) * fma(b_m, (b_m * -t_0), (pow(a, 2.0) * t_0));
} else {
tmp = -0.011111111111111112 * pow((a * sqrt((((double) M_PI) * angle_m))), 2.0);
}
return angle_s * tmp;
}
b_m = abs(b) angle\_m = abs(angle) angle\_s = copysign(1.0, angle) function code(angle_s, a, b_m, angle_m) t_0 = sin(Float64(angle_m * Float64(pi * -0.005555555555555556))) tmp = 0.0 if ((a ^ 2.0) <= Inf) tmp = Float64(Float64(2.0 * cos(Float64(pi * Float64(angle_m * 0.005555555555555556)))) * fma(b_m, Float64(b_m * Float64(-t_0)), Float64((a ^ 2.0) * t_0))); else tmp = Float64(-0.011111111111111112 * (Float64(a * sqrt(Float64(pi * angle_m))) ^ 2.0)); end return Float64(angle_s * tmp) end
b_m = N[Abs[b], $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_, b$95$m_, angle$95$m_] := Block[{t$95$0 = N[Sin[N[(angle$95$m * N[(Pi * -0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[(angle$95$s * If[LessEqual[N[Power[a, 2.0], $MachinePrecision], Infinity], N[(N[(2.0 * N[Cos[N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(b$95$m * N[(b$95$m * (-t$95$0)), $MachinePrecision] + N[(N[Power[a, 2.0], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.011111111111111112 * N[Power[N[(a * N[Sqrt[N[(Pi * angle$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
b_m = \left|b\right|
\\
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
\begin{array}{l}
t_0 := \sin \left(angle\_m \cdot \left(\pi \cdot -0.005555555555555556\right)\right)\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;{a}^{2} \leq \infty:\\
\;\;\;\;\left(2 \cdot \cos \left(\pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)\right)\right) \cdot \mathsf{fma}\left(b\_m, b\_m \cdot \left(-t\_0\right), {a}^{2} \cdot t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;-0.011111111111111112 \cdot {\left(a \cdot \sqrt{\pi \cdot angle\_m}\right)}^{2}\\
\end{array}
\end{array}
\end{array}
if (pow.f64 a #s(literal 2 binary64)) < +inf.0Initial program 59.7%
Simplified60.1%
add-exp-log33.0%
add-sqr-sqrt33.0%
sqrt-unprod54.1%
associate-*r/54.1%
associate-*r/54.1%
frac-times53.8%
*-commutative53.8%
*-commutative53.8%
metadata-eval53.8%
metadata-eval53.8%
frac-times54.1%
associate-*r/54.1%
associate-*r/54.1%
sqrt-unprod29.5%
add-sqr-sqrt29.5%
div-inv29.5%
metadata-eval29.5%
Applied egg-rr29.5%
unpow229.5%
unpow229.5%
difference-of-squares30.7%
Applied egg-rr30.7%
Taylor expanded in b around 0 32.0%
fma-define33.2%
Simplified32.9%
pow132.9%
Applied egg-rr64.8%
unpow164.8%
*-commutative64.8%
Simplified64.8%
if +inf.0 < (pow.f64 a #s(literal 2 binary64)) Initial program 59.7%
associate-*l*59.7%
associate-*l*59.7%
Simplified59.7%
Taylor expanded in angle around 0 57.8%
Taylor expanded in b around 0 37.5%
add-sqr-sqrt27.5%
pow227.5%
sqrt-prod20.0%
sqrt-pow121.0%
metadata-eval21.0%
pow121.0%
*-commutative21.0%
Applied egg-rr21.0%
Final simplification64.8%
b_m = (fabs.f64 b)
angle\_m = (fabs.f64 angle)
angle\_s = (copysign.f64 #s(literal 1 binary64) angle)
(FPCore (angle_s a b_m angle_m)
:precision binary64
(*
angle_s
(if (<= a 2.1e+185)
(*
(cos (exp (- (log (* PI angle_m)) (log 180.0))))
(* 2.0 (* (* (+ a b_m) (- a b_m)) (sin (* angle_m (/ PI -180.0))))))
(* -0.011111111111111112 (pow (* a (sqrt (* PI angle_m))) 2.0)))))b_m = fabs(b);
angle\_m = fabs(angle);
angle\_s = copysign(1.0, angle);
double code(double angle_s, double a, double b_m, double angle_m) {
double tmp;
if (a <= 2.1e+185) {
tmp = cos(exp((log((((double) M_PI) * angle_m)) - log(180.0)))) * (2.0 * (((a + b_m) * (a - b_m)) * sin((angle_m * (((double) M_PI) / -180.0)))));
} else {
tmp = -0.011111111111111112 * pow((a * sqrt((((double) M_PI) * angle_m))), 2.0);
}
return angle_s * tmp;
}
b_m = Math.abs(b);
angle\_m = Math.abs(angle);
angle\_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a, double b_m, double angle_m) {
double tmp;
if (a <= 2.1e+185) {
tmp = Math.cos(Math.exp((Math.log((Math.PI * angle_m)) - Math.log(180.0)))) * (2.0 * (((a + b_m) * (a - b_m)) * Math.sin((angle_m * (Math.PI / -180.0)))));
} else {
tmp = -0.011111111111111112 * Math.pow((a * Math.sqrt((Math.PI * angle_m))), 2.0);
}
return angle_s * tmp;
}
b_m = math.fabs(b) angle\_m = math.fabs(angle) angle\_s = math.copysign(1.0, angle) def code(angle_s, a, b_m, angle_m): tmp = 0 if a <= 2.1e+185: tmp = math.cos(math.exp((math.log((math.pi * angle_m)) - math.log(180.0)))) * (2.0 * (((a + b_m) * (a - b_m)) * math.sin((angle_m * (math.pi / -180.0))))) else: tmp = -0.011111111111111112 * math.pow((a * math.sqrt((math.pi * angle_m))), 2.0) return angle_s * tmp
b_m = abs(b) angle\_m = abs(angle) angle\_s = copysign(1.0, angle) function code(angle_s, a, b_m, angle_m) tmp = 0.0 if (a <= 2.1e+185) tmp = Float64(cos(exp(Float64(log(Float64(pi * angle_m)) - log(180.0)))) * Float64(2.0 * Float64(Float64(Float64(a + b_m) * Float64(a - b_m)) * sin(Float64(angle_m * Float64(pi / -180.0)))))); else tmp = Float64(-0.011111111111111112 * (Float64(a * sqrt(Float64(pi * angle_m))) ^ 2.0)); end return Float64(angle_s * tmp) end
b_m = abs(b); angle\_m = abs(angle); angle\_s = sign(angle) * abs(1.0); function tmp_2 = code(angle_s, a, b_m, angle_m) tmp = 0.0; if (a <= 2.1e+185) tmp = cos(exp((log((pi * angle_m)) - log(180.0)))) * (2.0 * (((a + b_m) * (a - b_m)) * sin((angle_m * (pi / -180.0))))); else tmp = -0.011111111111111112 * ((a * sqrt((pi * angle_m))) ^ 2.0); end tmp_2 = angle_s * tmp; end
b_m = N[Abs[b], $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_, b$95$m_, angle$95$m_] := N[(angle$95$s * If[LessEqual[a, 2.1e+185], N[(N[Cos[N[Exp[N[(N[Log[N[(Pi * angle$95$m), $MachinePrecision]], $MachinePrecision] - N[Log[180.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(2.0 * N[(N[(N[(a + b$95$m), $MachinePrecision] * N[(a - b$95$m), $MachinePrecision]), $MachinePrecision] * N[Sin[N[(angle$95$m * N[(Pi / -180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.011111111111111112 * N[Power[N[(a * N[Sqrt[N[(Pi * angle$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
b_m = \left|b\right|
\\
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;a \leq 2.1 \cdot 10^{+185}:\\
\;\;\;\;\cos \left(e^{\log \left(\pi \cdot angle\_m\right) - \log 180}\right) \cdot \left(2 \cdot \left(\left(\left(a + b\_m\right) \cdot \left(a - b\_m\right)\right) \cdot \sin \left(angle\_m \cdot \frac{\pi}{-180}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-0.011111111111111112 \cdot {\left(a \cdot \sqrt{\pi \cdot angle\_m}\right)}^{2}\\
\end{array}
\end{array}
if a < 2.1e185Initial program 60.6%
Simplified60.6%
add-exp-log33.1%
add-sqr-sqrt33.1%
sqrt-unprod55.4%
associate-*r/55.4%
associate-*r/55.4%
frac-times55.0%
*-commutative55.0%
*-commutative55.0%
metadata-eval55.0%
metadata-eval55.0%
frac-times55.4%
associate-*r/55.4%
associate-*r/55.4%
sqrt-unprod30.6%
add-sqr-sqrt30.6%
div-inv30.6%
metadata-eval30.6%
Applied egg-rr30.6%
unpow230.6%
unpow230.6%
difference-of-squares31.4%
Applied egg-rr31.4%
log-prod30.9%
metadata-eval30.9%
div-inv30.9%
sum-log31.4%
associate-*r/31.4%
*-commutative31.4%
log-div30.3%
*-commutative30.3%
Applied egg-rr30.3%
if 2.1e185 < a Initial program 48.4%
associate-*l*48.4%
associate-*l*48.4%
Simplified48.4%
Taylor expanded in angle around 0 48.4%
Taylor expanded in b around 0 64.2%
add-sqr-sqrt27.0%
pow227.0%
sqrt-prod27.0%
sqrt-pow136.6%
metadata-eval36.6%
pow136.6%
*-commutative36.6%
Applied egg-rr36.6%
Final simplification30.8%
b_m = (fabs.f64 b)
angle\_m = (fabs.f64 angle)
angle\_s = (copysign.f64 #s(literal 1 binary64) angle)
(FPCore (angle_s a b_m angle_m)
:precision binary64
(*
angle_s
(if (<= a 1.95e+185)
(*
(cos (exp (log (* PI (* angle_m 0.005555555555555556)))))
(* 2.0 (* (* (+ a b_m) (- a b_m)) (sin (* angle_m (/ PI -180.0))))))
(* -0.011111111111111112 (pow (* a (sqrt (* PI angle_m))) 2.0)))))b_m = fabs(b);
angle\_m = fabs(angle);
angle\_s = copysign(1.0, angle);
double code(double angle_s, double a, double b_m, double angle_m) {
double tmp;
if (a <= 1.95e+185) {
tmp = cos(exp(log((((double) M_PI) * (angle_m * 0.005555555555555556))))) * (2.0 * (((a + b_m) * (a - b_m)) * sin((angle_m * (((double) M_PI) / -180.0)))));
} else {
tmp = -0.011111111111111112 * pow((a * sqrt((((double) M_PI) * angle_m))), 2.0);
}
return angle_s * tmp;
}
b_m = Math.abs(b);
angle\_m = Math.abs(angle);
angle\_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a, double b_m, double angle_m) {
double tmp;
if (a <= 1.95e+185) {
tmp = Math.cos(Math.exp(Math.log((Math.PI * (angle_m * 0.005555555555555556))))) * (2.0 * (((a + b_m) * (a - b_m)) * Math.sin((angle_m * (Math.PI / -180.0)))));
} else {
tmp = -0.011111111111111112 * Math.pow((a * Math.sqrt((Math.PI * angle_m))), 2.0);
}
return angle_s * tmp;
}
b_m = math.fabs(b) angle\_m = math.fabs(angle) angle\_s = math.copysign(1.0, angle) def code(angle_s, a, b_m, angle_m): tmp = 0 if a <= 1.95e+185: tmp = math.cos(math.exp(math.log((math.pi * (angle_m * 0.005555555555555556))))) * (2.0 * (((a + b_m) * (a - b_m)) * math.sin((angle_m * (math.pi / -180.0))))) else: tmp = -0.011111111111111112 * math.pow((a * math.sqrt((math.pi * angle_m))), 2.0) return angle_s * tmp
b_m = abs(b) angle\_m = abs(angle) angle\_s = copysign(1.0, angle) function code(angle_s, a, b_m, angle_m) tmp = 0.0 if (a <= 1.95e+185) tmp = Float64(cos(exp(log(Float64(pi * Float64(angle_m * 0.005555555555555556))))) * Float64(2.0 * Float64(Float64(Float64(a + b_m) * Float64(a - b_m)) * sin(Float64(angle_m * Float64(pi / -180.0)))))); else tmp = Float64(-0.011111111111111112 * (Float64(a * sqrt(Float64(pi * angle_m))) ^ 2.0)); end return Float64(angle_s * tmp) end
b_m = abs(b); angle\_m = abs(angle); angle\_s = sign(angle) * abs(1.0); function tmp_2 = code(angle_s, a, b_m, angle_m) tmp = 0.0; if (a <= 1.95e+185) tmp = cos(exp(log((pi * (angle_m * 0.005555555555555556))))) * (2.0 * (((a + b_m) * (a - b_m)) * sin((angle_m * (pi / -180.0))))); else tmp = -0.011111111111111112 * ((a * sqrt((pi * angle_m))) ^ 2.0); end tmp_2 = angle_s * tmp; end
b_m = N[Abs[b], $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_, b$95$m_, angle$95$m_] := N[(angle$95$s * If[LessEqual[a, 1.95e+185], N[(N[Cos[N[Exp[N[Log[N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(2.0 * N[(N[(N[(a + b$95$m), $MachinePrecision] * N[(a - b$95$m), $MachinePrecision]), $MachinePrecision] * N[Sin[N[(angle$95$m * N[(Pi / -180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.011111111111111112 * N[Power[N[(a * N[Sqrt[N[(Pi * angle$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
b_m = \left|b\right|
\\
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;a \leq 1.95 \cdot 10^{+185}:\\
\;\;\;\;\cos \left(e^{\log \left(\pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)\right)}\right) \cdot \left(2 \cdot \left(\left(\left(a + b\_m\right) \cdot \left(a - b\_m\right)\right) \cdot \sin \left(angle\_m \cdot \frac{\pi}{-180}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-0.011111111111111112 \cdot {\left(a \cdot \sqrt{\pi \cdot angle\_m}\right)}^{2}\\
\end{array}
\end{array}
if a < 1.9499999999999999e185Initial program 60.6%
Simplified60.6%
add-exp-log33.1%
add-sqr-sqrt33.1%
sqrt-unprod55.4%
associate-*r/55.4%
associate-*r/55.4%
frac-times55.0%
*-commutative55.0%
*-commutative55.0%
metadata-eval55.0%
metadata-eval55.0%
frac-times55.4%
associate-*r/55.4%
associate-*r/55.4%
sqrt-unprod30.6%
add-sqr-sqrt30.6%
div-inv30.6%
metadata-eval30.6%
Applied egg-rr30.6%
unpow230.6%
unpow230.6%
difference-of-squares31.4%
Applied egg-rr31.4%
if 1.9499999999999999e185 < a Initial program 48.4%
associate-*l*48.4%
associate-*l*48.4%
Simplified48.4%
Taylor expanded in angle around 0 48.4%
Taylor expanded in b around 0 64.2%
add-sqr-sqrt27.0%
pow227.0%
sqrt-prod27.0%
sqrt-pow136.6%
metadata-eval36.6%
pow136.6%
*-commutative36.6%
Applied egg-rr36.6%
Final simplification31.8%
b_m = (fabs.f64 b)
angle\_m = (fabs.f64 angle)
angle\_s = (copysign.f64 #s(literal 1 binary64) angle)
(FPCore (angle_s a b_m angle_m)
:precision binary64
(*
angle_s
(if (<= a 1.4e+154)
(*
(- (pow b_m 2.0) (pow a 2.0))
(sin (* 2.0 (* PI (* angle_m 0.005555555555555556)))))
(* -0.011111111111111112 (pow (* a (sqrt (* PI angle_m))) 2.0)))))b_m = fabs(b);
angle\_m = fabs(angle);
angle\_s = copysign(1.0, angle);
double code(double angle_s, double a, double b_m, double angle_m) {
double tmp;
if (a <= 1.4e+154) {
tmp = (pow(b_m, 2.0) - pow(a, 2.0)) * sin((2.0 * (((double) M_PI) * (angle_m * 0.005555555555555556))));
} else {
tmp = -0.011111111111111112 * pow((a * sqrt((((double) M_PI) * angle_m))), 2.0);
}
return angle_s * tmp;
}
b_m = Math.abs(b);
angle\_m = Math.abs(angle);
angle\_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a, double b_m, double angle_m) {
double tmp;
if (a <= 1.4e+154) {
tmp = (Math.pow(b_m, 2.0) - Math.pow(a, 2.0)) * Math.sin((2.0 * (Math.PI * (angle_m * 0.005555555555555556))));
} else {
tmp = -0.011111111111111112 * Math.pow((a * Math.sqrt((Math.PI * angle_m))), 2.0);
}
return angle_s * tmp;
}
b_m = math.fabs(b) angle\_m = math.fabs(angle) angle\_s = math.copysign(1.0, angle) def code(angle_s, a, b_m, angle_m): tmp = 0 if a <= 1.4e+154: tmp = (math.pow(b_m, 2.0) - math.pow(a, 2.0)) * math.sin((2.0 * (math.pi * (angle_m * 0.005555555555555556)))) else: tmp = -0.011111111111111112 * math.pow((a * math.sqrt((math.pi * angle_m))), 2.0) return angle_s * tmp
b_m = abs(b) angle\_m = abs(angle) angle\_s = copysign(1.0, angle) function code(angle_s, a, b_m, angle_m) tmp = 0.0 if (a <= 1.4e+154) tmp = Float64(Float64((b_m ^ 2.0) - (a ^ 2.0)) * sin(Float64(2.0 * Float64(pi * Float64(angle_m * 0.005555555555555556))))); else tmp = Float64(-0.011111111111111112 * (Float64(a * sqrt(Float64(pi * angle_m))) ^ 2.0)); end return Float64(angle_s * tmp) end
b_m = abs(b); angle\_m = abs(angle); angle\_s = sign(angle) * abs(1.0); function tmp_2 = code(angle_s, a, b_m, angle_m) tmp = 0.0; if (a <= 1.4e+154) tmp = ((b_m ^ 2.0) - (a ^ 2.0)) * sin((2.0 * (pi * (angle_m * 0.005555555555555556)))); else tmp = -0.011111111111111112 * ((a * sqrt((pi * angle_m))) ^ 2.0); end tmp_2 = angle_s * tmp; end
b_m = N[Abs[b], $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_, b$95$m_, angle$95$m_] := N[(angle$95$s * If[LessEqual[a, 1.4e+154], N[(N[(N[Power[b$95$m, 2.0], $MachinePrecision] - N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision] * N[Sin[N[(2.0 * N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(-0.011111111111111112 * N[Power[N[(a * N[Sqrt[N[(Pi * angle$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
b_m = \left|b\right|
\\
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;a \leq 1.4 \cdot 10^{+154}:\\
\;\;\;\;\left({b\_m}^{2} - {a}^{2}\right) \cdot \sin \left(2 \cdot \left(\pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-0.011111111111111112 \cdot {\left(a \cdot \sqrt{\pi \cdot angle\_m}\right)}^{2}\\
\end{array}
\end{array}
if a < 1.4e154Initial program 61.6%
associate-*l*61.6%
associate-*l*61.6%
Simplified61.6%
associate-*l*61.6%
associate-*r*61.6%
*-commutative61.6%
add-exp-log31.1%
associate-*r*31.1%
2-sin31.1%
Applied egg-rr32.1%
rem-exp-log62.7%
*-commutative62.7%
Applied egg-rr62.7%
if 1.4e154 < a Initial program 40.8%
associate-*l*40.8%
associate-*l*40.8%
Simplified40.8%
Taylor expanded in angle around 0 40.8%
Taylor expanded in b around 0 53.8%
add-sqr-sqrt23.1%
pow223.1%
sqrt-prod23.1%
sqrt-pow138.9%
metadata-eval38.9%
pow138.9%
*-commutative38.9%
Applied egg-rr38.9%
Final simplification60.6%
b_m = (fabs.f64 b)
angle\_m = (fabs.f64 angle)
angle\_s = (copysign.f64 #s(literal 1 binary64) angle)
(FPCore (angle_s a b_m angle_m)
:precision binary64
(*
angle_s
(if (<= a 1.4e+154)
(* 2.0 (* (* (+ a b_m) (- a b_m)) (sin (* angle_m (/ PI -180.0)))))
(* -0.011111111111111112 (pow (* a (sqrt (* PI angle_m))) 2.0)))))b_m = fabs(b);
angle\_m = fabs(angle);
angle\_s = copysign(1.0, angle);
double code(double angle_s, double a, double b_m, double angle_m) {
double tmp;
if (a <= 1.4e+154) {
tmp = 2.0 * (((a + b_m) * (a - b_m)) * sin((angle_m * (((double) M_PI) / -180.0))));
} else {
tmp = -0.011111111111111112 * pow((a * sqrt((((double) M_PI) * angle_m))), 2.0);
}
return angle_s * tmp;
}
b_m = Math.abs(b);
angle\_m = Math.abs(angle);
angle\_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a, double b_m, double angle_m) {
double tmp;
if (a <= 1.4e+154) {
tmp = 2.0 * (((a + b_m) * (a - b_m)) * Math.sin((angle_m * (Math.PI / -180.0))));
} else {
tmp = -0.011111111111111112 * Math.pow((a * Math.sqrt((Math.PI * angle_m))), 2.0);
}
return angle_s * tmp;
}
b_m = math.fabs(b) angle\_m = math.fabs(angle) angle\_s = math.copysign(1.0, angle) def code(angle_s, a, b_m, angle_m): tmp = 0 if a <= 1.4e+154: tmp = 2.0 * (((a + b_m) * (a - b_m)) * math.sin((angle_m * (math.pi / -180.0)))) else: tmp = -0.011111111111111112 * math.pow((a * math.sqrt((math.pi * angle_m))), 2.0) return angle_s * tmp
b_m = abs(b) angle\_m = abs(angle) angle\_s = copysign(1.0, angle) function code(angle_s, a, b_m, angle_m) tmp = 0.0 if (a <= 1.4e+154) tmp = Float64(2.0 * Float64(Float64(Float64(a + b_m) * Float64(a - b_m)) * sin(Float64(angle_m * Float64(pi / -180.0))))); else tmp = Float64(-0.011111111111111112 * (Float64(a * sqrt(Float64(pi * angle_m))) ^ 2.0)); end return Float64(angle_s * tmp) end
b_m = abs(b); angle\_m = abs(angle); angle\_s = sign(angle) * abs(1.0); function tmp_2 = code(angle_s, a, b_m, angle_m) tmp = 0.0; if (a <= 1.4e+154) tmp = 2.0 * (((a + b_m) * (a - b_m)) * sin((angle_m * (pi / -180.0)))); else tmp = -0.011111111111111112 * ((a * sqrt((pi * angle_m))) ^ 2.0); end tmp_2 = angle_s * tmp; end
b_m = N[Abs[b], $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_, b$95$m_, angle$95$m_] := N[(angle$95$s * If[LessEqual[a, 1.4e+154], N[(2.0 * N[(N[(N[(a + b$95$m), $MachinePrecision] * N[(a - b$95$m), $MachinePrecision]), $MachinePrecision] * N[Sin[N[(angle$95$m * N[(Pi / -180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.011111111111111112 * N[Power[N[(a * N[Sqrt[N[(Pi * angle$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
b_m = \left|b\right|
\\
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;a \leq 1.4 \cdot 10^{+154}:\\
\;\;\;\;2 \cdot \left(\left(\left(a + b\_m\right) \cdot \left(a - b\_m\right)\right) \cdot \sin \left(angle\_m \cdot \frac{\pi}{-180}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-0.011111111111111112 \cdot {\left(a \cdot \sqrt{\pi \cdot angle\_m}\right)}^{2}\\
\end{array}
\end{array}
if a < 1.4e154Initial program 61.6%
Simplified61.6%
add-exp-log33.7%
add-sqr-sqrt33.7%
sqrt-unprod55.9%
associate-*r/55.9%
associate-*r/55.9%
frac-times55.5%
*-commutative55.5%
*-commutative55.5%
metadata-eval55.5%
metadata-eval55.5%
frac-times55.9%
associate-*r/55.9%
associate-*r/55.9%
sqrt-unprod30.6%
add-sqr-sqrt30.6%
div-inv30.6%
metadata-eval30.6%
Applied egg-rr30.6%
unpow230.6%
unpow230.6%
difference-of-squares31.5%
Applied egg-rr31.5%
Taylor expanded in angle around 0 61.7%
if 1.4e154 < a Initial program 40.8%
associate-*l*40.8%
associate-*l*40.8%
Simplified40.8%
Taylor expanded in angle around 0 40.8%
Taylor expanded in b around 0 53.8%
add-sqr-sqrt23.1%
pow223.1%
sqrt-prod23.1%
sqrt-pow138.9%
metadata-eval38.9%
pow138.9%
*-commutative38.9%
Applied egg-rr38.9%
Final simplification59.6%
b_m = (fabs.f64 b)
angle\_m = (fabs.f64 angle)
angle\_s = (copysign.f64 #s(literal 1 binary64) angle)
(FPCore (angle_s a b_m angle_m)
:precision binary64
(*
angle_s
(if (<= a 5e+187)
(* 2.0 (* (* (+ a b_m) (- a b_m)) (sin (* angle_m (/ PI -180.0)))))
(* -0.011111111111111112 (* (* PI angle_m) (* a a))))))b_m = fabs(b);
angle\_m = fabs(angle);
angle\_s = copysign(1.0, angle);
double code(double angle_s, double a, double b_m, double angle_m) {
double tmp;
if (a <= 5e+187) {
tmp = 2.0 * (((a + b_m) * (a - b_m)) * sin((angle_m * (((double) M_PI) / -180.0))));
} else {
tmp = -0.011111111111111112 * ((((double) M_PI) * angle_m) * (a * a));
}
return angle_s * tmp;
}
b_m = Math.abs(b);
angle\_m = Math.abs(angle);
angle\_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a, double b_m, double angle_m) {
double tmp;
if (a <= 5e+187) {
tmp = 2.0 * (((a + b_m) * (a - b_m)) * Math.sin((angle_m * (Math.PI / -180.0))));
} else {
tmp = -0.011111111111111112 * ((Math.PI * angle_m) * (a * a));
}
return angle_s * tmp;
}
b_m = math.fabs(b) angle\_m = math.fabs(angle) angle\_s = math.copysign(1.0, angle) def code(angle_s, a, b_m, angle_m): tmp = 0 if a <= 5e+187: tmp = 2.0 * (((a + b_m) * (a - b_m)) * math.sin((angle_m * (math.pi / -180.0)))) else: tmp = -0.011111111111111112 * ((math.pi * angle_m) * (a * a)) return angle_s * tmp
b_m = abs(b) angle\_m = abs(angle) angle\_s = copysign(1.0, angle) function code(angle_s, a, b_m, angle_m) tmp = 0.0 if (a <= 5e+187) tmp = Float64(2.0 * Float64(Float64(Float64(a + b_m) * Float64(a - b_m)) * sin(Float64(angle_m * Float64(pi / -180.0))))); else tmp = Float64(-0.011111111111111112 * Float64(Float64(pi * angle_m) * Float64(a * a))); end return Float64(angle_s * tmp) end
b_m = abs(b); angle\_m = abs(angle); angle\_s = sign(angle) * abs(1.0); function tmp_2 = code(angle_s, a, b_m, angle_m) tmp = 0.0; if (a <= 5e+187) tmp = 2.0 * (((a + b_m) * (a - b_m)) * sin((angle_m * (pi / -180.0)))); else tmp = -0.011111111111111112 * ((pi * angle_m) * (a * a)); end tmp_2 = angle_s * tmp; end
b_m = N[Abs[b], $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_, b$95$m_, angle$95$m_] := N[(angle$95$s * If[LessEqual[a, 5e+187], N[(2.0 * N[(N[(N[(a + b$95$m), $MachinePrecision] * N[(a - b$95$m), $MachinePrecision]), $MachinePrecision] * N[Sin[N[(angle$95$m * N[(Pi / -180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.011111111111111112 * N[(N[(Pi * angle$95$m), $MachinePrecision] * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
b_m = \left|b\right|
\\
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;a \leq 5 \cdot 10^{+187}:\\
\;\;\;\;2 \cdot \left(\left(\left(a + b\_m\right) \cdot \left(a - b\_m\right)\right) \cdot \sin \left(angle\_m \cdot \frac{\pi}{-180}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-0.011111111111111112 \cdot \left(\left(\pi \cdot angle\_m\right) \cdot \left(a \cdot a\right)\right)\\
\end{array}
\end{array}
if a < 5.0000000000000001e187Initial program 60.1%
Simplified60.1%
add-exp-log32.8%
add-sqr-sqrt32.8%
sqrt-unprod55.0%
associate-*r/55.0%
associate-*r/55.0%
frac-times54.6%
*-commutative54.6%
*-commutative54.6%
metadata-eval54.6%
metadata-eval54.6%
frac-times55.0%
associate-*r/55.0%
associate-*r/55.0%
sqrt-unprod30.4%
add-sqr-sqrt30.4%
div-inv30.4%
metadata-eval30.4%
Applied egg-rr30.4%
unpow230.4%
unpow230.4%
difference-of-squares31.2%
Applied egg-rr31.2%
Taylor expanded in angle around 0 60.7%
if 5.0000000000000001e187 < a Initial program 53.7%
associate-*l*53.7%
associate-*l*53.7%
Simplified53.7%
Taylor expanded in angle around 0 53.7%
Taylor expanded in b around 0 71.3%
unpow271.3%
Applied egg-rr71.3%
Final simplification61.4%
b_m = (fabs.f64 b) angle\_m = (fabs.f64 angle) angle\_s = (copysign.f64 #s(literal 1 binary64) angle) (FPCore (angle_s a b_m angle_m) :precision binary64 (* angle_s (* -0.011111111111111112 (* angle_m (* PI (* (+ a b_m) (- a b_m)))))))
b_m = fabs(b);
angle\_m = fabs(angle);
angle\_s = copysign(1.0, angle);
double code(double angle_s, double a, double b_m, double angle_m) {
return angle_s * (-0.011111111111111112 * (angle_m * (((double) M_PI) * ((a + b_m) * (a - b_m)))));
}
b_m = Math.abs(b);
angle\_m = Math.abs(angle);
angle\_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a, double b_m, double angle_m) {
return angle_s * (-0.011111111111111112 * (angle_m * (Math.PI * ((a + b_m) * (a - b_m)))));
}
b_m = math.fabs(b) angle\_m = math.fabs(angle) angle\_s = math.copysign(1.0, angle) def code(angle_s, a, b_m, angle_m): return angle_s * (-0.011111111111111112 * (angle_m * (math.pi * ((a + b_m) * (a - b_m)))))
b_m = abs(b) angle\_m = abs(angle) angle\_s = copysign(1.0, angle) function code(angle_s, a, b_m, angle_m) return Float64(angle_s * Float64(-0.011111111111111112 * Float64(angle_m * Float64(pi * Float64(Float64(a + b_m) * Float64(a - b_m)))))) end
b_m = abs(b); angle\_m = abs(angle); angle\_s = sign(angle) * abs(1.0); function tmp = code(angle_s, a, b_m, angle_m) tmp = angle_s * (-0.011111111111111112 * (angle_m * (pi * ((a + b_m) * (a - b_m))))); end
b_m = N[Abs[b], $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_, b$95$m_, angle$95$m_] := N[(angle$95$s * N[(-0.011111111111111112 * N[(angle$95$m * N[(Pi * N[(N[(a + b$95$m), $MachinePrecision] * N[(a - b$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
b_m = \left|b\right|
\\
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
angle\_s \cdot \left(-0.011111111111111112 \cdot \left(angle\_m \cdot \left(\pi \cdot \left(\left(a + b\_m\right) \cdot \left(a - b\_m\right)\right)\right)\right)\right)
\end{array}
Initial program 59.7%
Simplified60.1%
add-exp-log33.0%
add-sqr-sqrt33.0%
sqrt-unprod54.1%
associate-*r/54.1%
associate-*r/54.1%
frac-times53.8%
*-commutative53.8%
*-commutative53.8%
metadata-eval53.8%
metadata-eval53.8%
frac-times54.1%
associate-*r/54.1%
associate-*r/54.1%
sqrt-unprod29.5%
add-sqr-sqrt29.5%
div-inv29.5%
metadata-eval29.5%
Applied egg-rr29.5%
unpow229.5%
unpow229.5%
difference-of-squares30.7%
Applied egg-rr30.7%
Taylor expanded in angle around 0 60.1%
b_m = (fabs.f64 b) angle\_m = (fabs.f64 angle) angle\_s = (copysign.f64 #s(literal 1 binary64) angle) (FPCore (angle_s a b_m angle_m) :precision binary64 (* angle_s (* -0.011111111111111112 (* (* PI angle_m) (* a a)))))
b_m = fabs(b);
angle\_m = fabs(angle);
angle\_s = copysign(1.0, angle);
double code(double angle_s, double a, double b_m, double angle_m) {
return angle_s * (-0.011111111111111112 * ((((double) M_PI) * angle_m) * (a * a)));
}
b_m = Math.abs(b);
angle\_m = Math.abs(angle);
angle\_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a, double b_m, double angle_m) {
return angle_s * (-0.011111111111111112 * ((Math.PI * angle_m) * (a * a)));
}
b_m = math.fabs(b) angle\_m = math.fabs(angle) angle\_s = math.copysign(1.0, angle) def code(angle_s, a, b_m, angle_m): return angle_s * (-0.011111111111111112 * ((math.pi * angle_m) * (a * a)))
b_m = abs(b) angle\_m = abs(angle) angle\_s = copysign(1.0, angle) function code(angle_s, a, b_m, angle_m) return Float64(angle_s * Float64(-0.011111111111111112 * Float64(Float64(pi * angle_m) * Float64(a * a)))) end
b_m = abs(b); angle\_m = abs(angle); angle\_s = sign(angle) * abs(1.0); function tmp = code(angle_s, a, b_m, angle_m) tmp = angle_s * (-0.011111111111111112 * ((pi * angle_m) * (a * a))); end
b_m = N[Abs[b], $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_, b$95$m_, angle$95$m_] := N[(angle$95$s * N[(-0.011111111111111112 * N[(N[(Pi * angle$95$m), $MachinePrecision] * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
b_m = \left|b\right|
\\
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
angle\_s \cdot \left(-0.011111111111111112 \cdot \left(\left(\pi \cdot angle\_m\right) \cdot \left(a \cdot a\right)\right)\right)
\end{array}
Initial program 59.7%
associate-*l*59.7%
associate-*l*59.7%
Simplified59.7%
Taylor expanded in angle around 0 57.8%
Taylor expanded in b around 0 37.5%
unpow237.5%
Applied egg-rr37.5%
Final simplification37.5%
herbie shell --seed 2024188
(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)))))