
(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 9 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 (* PI (* angle_m 0.005555555555555556))))
(*
angle_s
(if (<= b_m 2e+217)
(* (* (- b_m a) (sin (* 2.0 t_0))) (+ b_m a))
(if (<= b_m 1.9e+264)
(* 0.011111111111111112 (* (* angle_m (+ b_m a)) (* (- b_m a) PI)))
(*
(* (* 2.0 (* (- b_m a) (+ b_m a))) (sin (expm1 (log1p t_0))))
(cos (* PI (/ angle_m 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 = ((double) M_PI) * (angle_m * 0.005555555555555556);
double tmp;
if (b_m <= 2e+217) {
tmp = ((b_m - a) * sin((2.0 * t_0))) * (b_m + a);
} else if (b_m <= 1.9e+264) {
tmp = 0.011111111111111112 * ((angle_m * (b_m + a)) * ((b_m - a) * ((double) M_PI)));
} else {
tmp = ((2.0 * ((b_m - a) * (b_m + a))) * sin(expm1(log1p(t_0)))) * cos((((double) M_PI) * (angle_m / 180.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 t_0 = Math.PI * (angle_m * 0.005555555555555556);
double tmp;
if (b_m <= 2e+217) {
tmp = ((b_m - a) * Math.sin((2.0 * t_0))) * (b_m + a);
} else if (b_m <= 1.9e+264) {
tmp = 0.011111111111111112 * ((angle_m * (b_m + a)) * ((b_m - a) * Math.PI));
} else {
tmp = ((2.0 * ((b_m - a) * (b_m + a))) * Math.sin(Math.expm1(Math.log1p(t_0)))) * Math.cos((Math.PI * (angle_m / 180.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): t_0 = math.pi * (angle_m * 0.005555555555555556) tmp = 0 if b_m <= 2e+217: tmp = ((b_m - a) * math.sin((2.0 * t_0))) * (b_m + a) elif b_m <= 1.9e+264: tmp = 0.011111111111111112 * ((angle_m * (b_m + a)) * ((b_m - a) * math.pi)) else: tmp = ((2.0 * ((b_m - a) * (b_m + a))) * math.sin(math.expm1(math.log1p(t_0)))) * math.cos((math.pi * (angle_m / 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 = Float64(pi * Float64(angle_m * 0.005555555555555556)) tmp = 0.0 if (b_m <= 2e+217) tmp = Float64(Float64(Float64(b_m - a) * sin(Float64(2.0 * t_0))) * Float64(b_m + a)); elseif (b_m <= 1.9e+264) tmp = Float64(0.011111111111111112 * Float64(Float64(angle_m * Float64(b_m + a)) * Float64(Float64(b_m - a) * pi))); else tmp = Float64(Float64(Float64(2.0 * Float64(Float64(b_m - a) * Float64(b_m + a))) * sin(expm1(log1p(t_0)))) * cos(Float64(pi * Float64(angle_m / 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[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]}, N[(angle$95$s * If[LessEqual[b$95$m, 2e+217], N[(N[(N[(b$95$m - a), $MachinePrecision] * N[Sin[N[(2.0 * t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(b$95$m + a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b$95$m, 1.9e+264], N[(0.011111111111111112 * N[(N[(angle$95$m * N[(b$95$m + a), $MachinePrecision]), $MachinePrecision] * N[(N[(b$95$m - a), $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(2.0 * N[(N[(b$95$m - a), $MachinePrecision] * N[(b$95$m + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[N[(Exp[N[Log[1 + t$95$0], $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(Pi * N[(angle$95$m / 180.0), $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 := \pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;b\_m \leq 2 \cdot 10^{+217}:\\
\;\;\;\;\left(\left(b\_m - a\right) \cdot \sin \left(2 \cdot t\_0\right)\right) \cdot \left(b\_m + a\right)\\
\mathbf{elif}\;b\_m \leq 1.9 \cdot 10^{+264}:\\
\;\;\;\;0.011111111111111112 \cdot \left(\left(angle\_m \cdot \left(b\_m + a\right)\right) \cdot \left(\left(b\_m - a\right) \cdot \pi\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(2 \cdot \left(\left(b\_m - a\right) \cdot \left(b\_m + a\right)\right)\right) \cdot \sin \left(\mathsf{expm1}\left(\mathsf{log1p}\left(t\_0\right)\right)\right)\right) \cdot \cos \left(\pi \cdot \frac{angle\_m}{180}\right)\\
\end{array}
\end{array}
\end{array}
if b < 1.99999999999999992e217Initial program 55.7%
associate-*l*55.7%
*-commutative55.7%
associate-*l*55.7%
Simplified55.7%
unpow255.7%
unpow255.7%
difference-of-squares59.2%
Applied egg-rr59.2%
clear-num58.8%
un-div-inv59.3%
Applied egg-rr59.3%
associate-/r/58.3%
Simplified58.3%
associate-*r*58.3%
associate-*l/57.4%
associate-*r/59.2%
div-inv58.4%
metadata-eval58.4%
rem-exp-log29.2%
associate-*r*29.2%
pow129.2%
Applied egg-rr69.9%
if 1.99999999999999992e217 < b < 1.9000000000000001e264Initial program 12.1%
associate-*l*12.1%
*-commutative12.1%
associate-*l*12.1%
Simplified12.1%
unpow212.1%
unpow212.1%
difference-of-squares34.9%
Applied egg-rr34.9%
Taylor expanded in angle around 0 57.1%
associate-*r*57.1%
sub-neg57.1%
distribute-lft-in45.4%
+-commutative45.4%
+-commutative45.4%
Applied egg-rr45.4%
*-commutative45.4%
associate-*r*45.4%
*-commutative45.4%
associate-*r*45.4%
neg-mul-145.4%
associate-*r*45.4%
distribute-rgt-out57.1%
+-commutative57.1%
associate-*r*57.1%
neg-mul-157.1%
distribute-rgt-in57.1%
sub-neg57.1%
Simplified57.1%
pow157.1%
associate-*r*77.6%
+-commutative77.6%
Applied egg-rr77.6%
if 1.9000000000000001e264 < b Initial program 50.0%
unpow250.0%
unpow250.0%
difference-of-squares62.5%
Applied egg-rr62.5%
div-inv50.0%
metadata-eval50.0%
expm1-log1p-u75.0%
Applied egg-rr75.0%
Final simplification70.3%
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 (<= b_m 2.3e+221)
(*
(* (- b_m a) (sin (* 2.0 (* PI (* angle_m 0.005555555555555556)))))
(+ b_m a))
(pow
(*
(cbrt (+ b_m a))
(cbrt
(*
(- b_m a)
(sin (exp (log (* PI (* angle_m 0.011111111111111112))))))))
3.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 (b_m <= 2.3e+221) {
tmp = ((b_m - a) * sin((2.0 * (((double) M_PI) * (angle_m * 0.005555555555555556))))) * (b_m + a);
} else {
tmp = pow((cbrt((b_m + a)) * cbrt(((b_m - a) * sin(exp(log((((double) M_PI) * (angle_m * 0.011111111111111112)))))))), 3.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 (b_m <= 2.3e+221) {
tmp = ((b_m - a) * Math.sin((2.0 * (Math.PI * (angle_m * 0.005555555555555556))))) * (b_m + a);
} else {
tmp = Math.pow((Math.cbrt((b_m + a)) * Math.cbrt(((b_m - a) * Math.sin(Math.exp(Math.log((Math.PI * (angle_m * 0.011111111111111112)))))))), 3.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 (b_m <= 2.3e+221) tmp = Float64(Float64(Float64(b_m - a) * sin(Float64(2.0 * Float64(pi * Float64(angle_m * 0.005555555555555556))))) * Float64(b_m + a)); else tmp = Float64(cbrt(Float64(b_m + a)) * cbrt(Float64(Float64(b_m - a) * sin(exp(log(Float64(pi * Float64(angle_m * 0.011111111111111112)))))))) ^ 3.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_] := N[(angle$95$s * If[LessEqual[b$95$m, 2.3e+221], N[(N[(N[(b$95$m - a), $MachinePrecision] * N[Sin[N[(2.0 * N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(b$95$m + a), $MachinePrecision]), $MachinePrecision], N[Power[N[(N[Power[N[(b$95$m + a), $MachinePrecision], 1/3], $MachinePrecision] * N[Power[N[(N[(b$95$m - a), $MachinePrecision] * N[Sin[N[Exp[N[Log[N[(Pi * N[(angle$95$m * 0.011111111111111112), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], 3.0], $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}\;b\_m \leq 2.3 \cdot 10^{+221}:\\
\;\;\;\;\left(\left(b\_m - a\right) \cdot \sin \left(2 \cdot \left(\pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)\right)\right)\right) \cdot \left(b\_m + a\right)\\
\mathbf{else}:\\
\;\;\;\;{\left(\sqrt[3]{b\_m + a} \cdot \sqrt[3]{\left(b\_m - a\right) \cdot \sin \left(e^{\log \left(\pi \cdot \left(angle\_m \cdot 0.011111111111111112\right)\right)}\right)}\right)}^{3}\\
\end{array}
\end{array}
if b < 2.29999999999999987e221Initial program 55.7%
associate-*l*55.7%
*-commutative55.7%
associate-*l*55.7%
Simplified55.7%
unpow255.7%
unpow255.7%
difference-of-squares59.2%
Applied egg-rr59.2%
clear-num58.8%
un-div-inv59.3%
Applied egg-rr59.3%
associate-/r/58.3%
Simplified58.3%
associate-*r*58.3%
associate-*l/57.4%
associate-*r/59.2%
div-inv58.4%
metadata-eval58.4%
rem-exp-log29.2%
associate-*r*29.2%
pow129.2%
Applied egg-rr69.9%
if 2.29999999999999987e221 < b Initial program 29.9%
associate-*l*29.9%
*-commutative29.9%
associate-*l*29.9%
Simplified29.9%
add-cube-cbrt29.9%
pow329.9%
2-sin29.9%
associate-*r*29.9%
div-inv24.0%
metadata-eval24.0%
Applied egg-rr24.0%
cbrt-prod24.0%
associate-*l*24.0%
metadata-eval24.0%
div-inv29.9%
2-sin29.9%
unpow229.9%
unpow229.9%
difference-of-squares47.9%
cbrt-prod47.9%
associate-*l*58.6%
Applied egg-rr64.5%
+-commutative64.5%
associate-*l*52.6%
Simplified52.6%
add-exp-log46.3%
Applied egg-rr46.3%
Final simplification68.3%
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 (<= (pow a 2.0) 1e-292)
(*
(* (- b_m a) (+ b_m a))
(sin (* 2.0 (* angle_m (* PI 0.005555555555555556)))))
(* 0.011111111111111112 (* (* angle_m (+ b_m a)) (* (- b_m a) PI))))))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 (pow(a, 2.0) <= 1e-292) {
tmp = ((b_m - a) * (b_m + a)) * sin((2.0 * (angle_m * (((double) M_PI) * 0.005555555555555556))));
} else {
tmp = 0.011111111111111112 * ((angle_m * (b_m + a)) * ((b_m - a) * ((double) M_PI)));
}
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 (Math.pow(a, 2.0) <= 1e-292) {
tmp = ((b_m - a) * (b_m + a)) * Math.sin((2.0 * (angle_m * (Math.PI * 0.005555555555555556))));
} else {
tmp = 0.011111111111111112 * ((angle_m * (b_m + a)) * ((b_m - a) * Math.PI));
}
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 math.pow(a, 2.0) <= 1e-292: tmp = ((b_m - a) * (b_m + a)) * math.sin((2.0 * (angle_m * (math.pi * 0.005555555555555556)))) else: tmp = 0.011111111111111112 * ((angle_m * (b_m + a)) * ((b_m - a) * math.pi)) 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.0) <= 1e-292) tmp = Float64(Float64(Float64(b_m - a) * Float64(b_m + a)) * sin(Float64(2.0 * Float64(angle_m * Float64(pi * 0.005555555555555556))))); else tmp = Float64(0.011111111111111112 * Float64(Float64(angle_m * Float64(b_m + a)) * Float64(Float64(b_m - a) * pi))); 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.0) <= 1e-292) tmp = ((b_m - a) * (b_m + a)) * sin((2.0 * (angle_m * (pi * 0.005555555555555556)))); else tmp = 0.011111111111111112 * ((angle_m * (b_m + a)) * ((b_m - a) * pi)); 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[N[Power[a, 2.0], $MachinePrecision], 1e-292], N[(N[(N[(b$95$m - a), $MachinePrecision] * N[(b$95$m + a), $MachinePrecision]), $MachinePrecision] * N[Sin[N[(2.0 * N[(angle$95$m * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(0.011111111111111112 * N[(N[(angle$95$m * N[(b$95$m + a), $MachinePrecision]), $MachinePrecision] * N[(N[(b$95$m - a), $MachinePrecision] * Pi), $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}^{2} \leq 10^{-292}:\\
\;\;\;\;\left(\left(b\_m - a\right) \cdot \left(b\_m + a\right)\right) \cdot \sin \left(2 \cdot \left(angle\_m \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.011111111111111112 \cdot \left(\left(angle\_m \cdot \left(b\_m + a\right)\right) \cdot \left(\left(b\_m - a\right) \cdot \pi\right)\right)\\
\end{array}
\end{array}
if (pow.f64 a #s(literal 2 binary64)) < 1.0000000000000001e-292Initial program 71.1%
associate-*l*71.1%
*-commutative71.1%
associate-*l*71.1%
Simplified71.1%
unpow271.1%
unpow271.1%
difference-of-squares71.1%
Applied egg-rr71.1%
clear-num72.5%
un-div-inv69.4%
Applied egg-rr69.4%
associate-/r/69.9%
Simplified69.9%
associate-*r*69.9%
associate-*l/68.7%
associate-*r/71.1%
div-inv71.0%
metadata-eval71.0%
rem-exp-log37.0%
associate-*r*37.0%
pow137.0%
Applied egg-rr72.4%
unpow172.4%
associate-*r*71.1%
*-commutative71.1%
+-commutative71.1%
*-commutative71.1%
associate-*l*70.0%
*-commutative70.0%
Simplified70.0%
if 1.0000000000000001e-292 < (pow.f64 a #s(literal 2 binary64)) Initial program 46.3%
associate-*l*46.3%
*-commutative46.3%
associate-*l*46.3%
Simplified46.3%
unpow246.3%
unpow246.3%
difference-of-squares52.7%
Applied egg-rr52.7%
Taylor expanded in angle around 0 50.9%
associate-*r*50.9%
sub-neg50.9%
distribute-lft-in45.5%
+-commutative45.5%
+-commutative45.5%
Applied egg-rr45.5%
*-commutative45.5%
associate-*r*45.5%
*-commutative45.5%
associate-*r*45.5%
neg-mul-145.5%
associate-*r*45.5%
distribute-rgt-out50.9%
+-commutative50.9%
associate-*r*50.9%
neg-mul-150.9%
distribute-rgt-in50.9%
sub-neg50.9%
Simplified50.9%
pow150.9%
associate-*r*65.9%
+-commutative65.9%
Applied egg-rr65.9%
Final simplification67.2%
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 (* (- b_m a) PI)))
(*
angle_s
(if (<= angle_m 3.8e+64)
(* 0.011111111111111112 (* (* angle_m (+ b_m a)) t_0))
(if (<= angle_m 2.2e+270)
(* 0.011111111111111112 (* angle_m (* (+ b_m a) (* a (- PI)))))
(* 0.011111111111111112 (* angle_m (* (+ b_m a) (fabs t_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 = (b_m - a) * ((double) M_PI);
double tmp;
if (angle_m <= 3.8e+64) {
tmp = 0.011111111111111112 * ((angle_m * (b_m + a)) * t_0);
} else if (angle_m <= 2.2e+270) {
tmp = 0.011111111111111112 * (angle_m * ((b_m + a) * (a * -((double) M_PI))));
} else {
tmp = 0.011111111111111112 * (angle_m * ((b_m + a) * fabs(t_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 t_0 = (b_m - a) * Math.PI;
double tmp;
if (angle_m <= 3.8e+64) {
tmp = 0.011111111111111112 * ((angle_m * (b_m + a)) * t_0);
} else if (angle_m <= 2.2e+270) {
tmp = 0.011111111111111112 * (angle_m * ((b_m + a) * (a * -Math.PI)));
} else {
tmp = 0.011111111111111112 * (angle_m * ((b_m + a) * Math.abs(t_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): t_0 = (b_m - a) * math.pi tmp = 0 if angle_m <= 3.8e+64: tmp = 0.011111111111111112 * ((angle_m * (b_m + a)) * t_0) elif angle_m <= 2.2e+270: tmp = 0.011111111111111112 * (angle_m * ((b_m + a) * (a * -math.pi))) else: tmp = 0.011111111111111112 * (angle_m * ((b_m + a) * math.fabs(t_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 = Float64(Float64(b_m - a) * pi) tmp = 0.0 if (angle_m <= 3.8e+64) tmp = Float64(0.011111111111111112 * Float64(Float64(angle_m * Float64(b_m + a)) * t_0)); elseif (angle_m <= 2.2e+270) tmp = Float64(0.011111111111111112 * Float64(angle_m * Float64(Float64(b_m + a) * Float64(a * Float64(-pi))))); else tmp = Float64(0.011111111111111112 * Float64(angle_m * Float64(Float64(b_m + a) * abs(t_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) t_0 = (b_m - a) * pi; tmp = 0.0; if (angle_m <= 3.8e+64) tmp = 0.011111111111111112 * ((angle_m * (b_m + a)) * t_0); elseif (angle_m <= 2.2e+270) tmp = 0.011111111111111112 * (angle_m * ((b_m + a) * (a * -pi))); else tmp = 0.011111111111111112 * (angle_m * ((b_m + a) * abs(t_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_] := Block[{t$95$0 = N[(N[(b$95$m - a), $MachinePrecision] * Pi), $MachinePrecision]}, N[(angle$95$s * If[LessEqual[angle$95$m, 3.8e+64], N[(0.011111111111111112 * N[(N[(angle$95$m * N[(b$95$m + a), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[angle$95$m, 2.2e+270], N[(0.011111111111111112 * N[(angle$95$m * N[(N[(b$95$m + a), $MachinePrecision] * N[(a * (-Pi)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.011111111111111112 * N[(angle$95$m * N[(N[(b$95$m + a), $MachinePrecision] * N[Abs[t$95$0], $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 := \left(b\_m - a\right) \cdot \pi\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;angle\_m \leq 3.8 \cdot 10^{+64}:\\
\;\;\;\;0.011111111111111112 \cdot \left(\left(angle\_m \cdot \left(b\_m + a\right)\right) \cdot t\_0\right)\\
\mathbf{elif}\;angle\_m \leq 2.2 \cdot 10^{+270}:\\
\;\;\;\;0.011111111111111112 \cdot \left(angle\_m \cdot \left(\left(b\_m + a\right) \cdot \left(a \cdot \left(-\pi\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.011111111111111112 \cdot \left(angle\_m \cdot \left(\left(b\_m + a\right) \cdot \left|t\_0\right|\right)\right)\\
\end{array}
\end{array}
\end{array}
if angle < 3.8000000000000001e64Initial program 58.5%
associate-*l*58.5%
*-commutative58.5%
associate-*l*58.5%
Simplified58.5%
unpow258.5%
unpow258.5%
difference-of-squares63.5%
Applied egg-rr63.5%
Taylor expanded in angle around 0 61.4%
associate-*r*61.4%
sub-neg61.4%
distribute-lft-in57.3%
+-commutative57.3%
+-commutative57.3%
Applied egg-rr57.3%
*-commutative57.3%
associate-*r*57.3%
*-commutative57.3%
associate-*r*57.3%
neg-mul-157.3%
associate-*r*57.3%
distribute-rgt-out61.4%
+-commutative61.4%
associate-*r*61.4%
neg-mul-161.4%
distribute-rgt-in61.4%
sub-neg61.4%
Simplified61.4%
pow161.4%
associate-*r*73.7%
+-commutative73.7%
Applied egg-rr73.7%
if 3.8000000000000001e64 < angle < 2.2000000000000001e270Initial program 30.4%
associate-*l*30.4%
*-commutative30.4%
associate-*l*30.4%
Simplified30.4%
unpow230.4%
unpow230.4%
difference-of-squares33.0%
Applied egg-rr33.0%
Taylor expanded in angle around 0 20.4%
associate-*r*20.4%
sub-neg20.4%
distribute-lft-in17.8%
+-commutative17.8%
+-commutative17.8%
Applied egg-rr17.8%
*-commutative17.8%
associate-*r*17.8%
*-commutative17.8%
associate-*r*17.8%
neg-mul-117.8%
associate-*r*17.8%
distribute-rgt-out20.4%
+-commutative20.4%
associate-*r*20.4%
neg-mul-120.4%
distribute-rgt-in20.4%
sub-neg20.4%
Simplified20.4%
Taylor expanded in b around 0 21.3%
associate-*r*21.3%
mul-1-neg21.3%
Simplified21.3%
if 2.2000000000000001e270 < angle Initial program 51.6%
associate-*l*51.6%
*-commutative51.6%
associate-*l*51.6%
Simplified51.6%
unpow251.6%
unpow251.6%
difference-of-squares51.6%
Applied egg-rr51.6%
Taylor expanded in angle around 0 50.3%
associate-*r*50.3%
sub-neg50.3%
distribute-lft-in50.3%
+-commutative50.3%
+-commutative50.3%
Applied egg-rr50.3%
*-commutative50.3%
associate-*r*50.3%
*-commutative50.3%
associate-*r*50.3%
neg-mul-150.3%
associate-*r*50.3%
distribute-rgt-out50.3%
+-commutative50.3%
associate-*r*50.3%
neg-mul-150.3%
distribute-rgt-in50.3%
sub-neg50.3%
Simplified50.3%
add-sqr-sqrt17.0%
sqrt-unprod25.6%
pow225.6%
Applied egg-rr25.6%
unpow225.6%
rem-sqrt-square25.6%
Simplified25.6%
Final simplification63.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
(*
angle_s
(if (<= a 3e-145)
(*
(sin (* 2.0 (* PI (* angle_m 0.005555555555555556))))
(* (- b_m a) (+ b_m a)))
(* 0.011111111111111112 (* (* angle_m (+ b_m a)) (* (- b_m a) PI))))))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 <= 3e-145) {
tmp = sin((2.0 * (((double) M_PI) * (angle_m * 0.005555555555555556)))) * ((b_m - a) * (b_m + a));
} else {
tmp = 0.011111111111111112 * ((angle_m * (b_m + a)) * ((b_m - a) * ((double) M_PI)));
}
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 <= 3e-145) {
tmp = Math.sin((2.0 * (Math.PI * (angle_m * 0.005555555555555556)))) * ((b_m - a) * (b_m + a));
} else {
tmp = 0.011111111111111112 * ((angle_m * (b_m + a)) * ((b_m - a) * Math.PI));
}
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 <= 3e-145: tmp = math.sin((2.0 * (math.pi * (angle_m * 0.005555555555555556)))) * ((b_m - a) * (b_m + a)) else: tmp = 0.011111111111111112 * ((angle_m * (b_m + a)) * ((b_m - a) * math.pi)) 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 <= 3e-145) tmp = Float64(sin(Float64(2.0 * Float64(pi * Float64(angle_m * 0.005555555555555556)))) * Float64(Float64(b_m - a) * Float64(b_m + a))); else tmp = Float64(0.011111111111111112 * Float64(Float64(angle_m * Float64(b_m + a)) * Float64(Float64(b_m - a) * pi))); 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 <= 3e-145) tmp = sin((2.0 * (pi * (angle_m * 0.005555555555555556)))) * ((b_m - a) * (b_m + a)); else tmp = 0.011111111111111112 * ((angle_m * (b_m + a)) * ((b_m - a) * pi)); 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, 3e-145], N[(N[Sin[N[(2.0 * N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(b$95$m - a), $MachinePrecision] * N[(b$95$m + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.011111111111111112 * N[(N[(angle$95$m * N[(b$95$m + a), $MachinePrecision]), $MachinePrecision] * N[(N[(b$95$m - a), $MachinePrecision] * Pi), $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 3 \cdot 10^{-145}:\\
\;\;\;\;\sin \left(2 \cdot \left(\pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)\right)\right) \cdot \left(\left(b\_m - a\right) \cdot \left(b\_m + a\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.011111111111111112 \cdot \left(\left(angle\_m \cdot \left(b\_m + a\right)\right) \cdot \left(\left(b\_m - a\right) \cdot \pi\right)\right)\\
\end{array}
\end{array}
if a < 2.99999999999999992e-145Initial program 56.3%
associate-*l*56.3%
*-commutative56.3%
associate-*l*56.3%
Simplified56.3%
unpow256.3%
unpow256.3%
difference-of-squares59.9%
Applied egg-rr59.9%
clear-num59.9%
un-div-inv59.5%
Applied egg-rr59.5%
associate-/r/60.0%
Simplified60.0%
associate-*r*60.0%
associate-*l/58.7%
associate-*r/59.9%
div-inv59.6%
metadata-eval59.6%
rem-exp-log33.0%
associate-*r*33.0%
pow133.0%
Applied egg-rr70.3%
unpow170.3%
associate-*r*60.6%
*-commutative60.6%
+-commutative60.6%
Simplified60.6%
if 2.99999999999999992e-145 < a Initial program 49.4%
associate-*l*49.4%
*-commutative49.4%
associate-*l*49.4%
Simplified49.4%
unpow249.4%
unpow249.4%
difference-of-squares55.4%
Applied egg-rr55.4%
Taylor expanded in angle around 0 52.0%
associate-*r*52.0%
sub-neg52.0%
distribute-lft-in46.0%
+-commutative46.0%
+-commutative46.0%
Applied egg-rr46.0%
*-commutative46.0%
associate-*r*46.0%
*-commutative46.0%
associate-*r*46.0%
neg-mul-146.0%
associate-*r*46.0%
distribute-rgt-out52.0%
+-commutative52.0%
associate-*r*52.0%
neg-mul-152.0%
distribute-rgt-in52.0%
sub-neg52.0%
Simplified52.0%
pow152.0%
associate-*r*64.9%
+-commutative64.9%
Applied egg-rr64.9%
Final simplification62.0%
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 (<= b_m 2e+217)
(*
(* (- b_m a) (sin (* 2.0 (* PI (* angle_m 0.005555555555555556)))))
(+ b_m a))
(* 0.011111111111111112 (* (* angle_m (+ b_m a)) (* (- b_m a) PI))))))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 (b_m <= 2e+217) {
tmp = ((b_m - a) * sin((2.0 * (((double) M_PI) * (angle_m * 0.005555555555555556))))) * (b_m + a);
} else {
tmp = 0.011111111111111112 * ((angle_m * (b_m + a)) * ((b_m - a) * ((double) M_PI)));
}
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 (b_m <= 2e+217) {
tmp = ((b_m - a) * Math.sin((2.0 * (Math.PI * (angle_m * 0.005555555555555556))))) * (b_m + a);
} else {
tmp = 0.011111111111111112 * ((angle_m * (b_m + a)) * ((b_m - a) * Math.PI));
}
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 b_m <= 2e+217: tmp = ((b_m - a) * math.sin((2.0 * (math.pi * (angle_m * 0.005555555555555556))))) * (b_m + a) else: tmp = 0.011111111111111112 * ((angle_m * (b_m + a)) * ((b_m - a) * math.pi)) 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 (b_m <= 2e+217) tmp = Float64(Float64(Float64(b_m - a) * sin(Float64(2.0 * Float64(pi * Float64(angle_m * 0.005555555555555556))))) * Float64(b_m + a)); else tmp = Float64(0.011111111111111112 * Float64(Float64(angle_m * Float64(b_m + a)) * Float64(Float64(b_m - a) * pi))); 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 (b_m <= 2e+217) tmp = ((b_m - a) * sin((2.0 * (pi * (angle_m * 0.005555555555555556))))) * (b_m + a); else tmp = 0.011111111111111112 * ((angle_m * (b_m + a)) * ((b_m - a) * pi)); 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[b$95$m, 2e+217], N[(N[(N[(b$95$m - a), $MachinePrecision] * N[Sin[N[(2.0 * N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(b$95$m + a), $MachinePrecision]), $MachinePrecision], N[(0.011111111111111112 * N[(N[(angle$95$m * N[(b$95$m + a), $MachinePrecision]), $MachinePrecision] * N[(N[(b$95$m - a), $MachinePrecision] * Pi), $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}\;b\_m \leq 2 \cdot 10^{+217}:\\
\;\;\;\;\left(\left(b\_m - a\right) \cdot \sin \left(2 \cdot \left(\pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)\right)\right)\right) \cdot \left(b\_m + a\right)\\
\mathbf{else}:\\
\;\;\;\;0.011111111111111112 \cdot \left(\left(angle\_m \cdot \left(b\_m + a\right)\right) \cdot \left(\left(b\_m - a\right) \cdot \pi\right)\right)\\
\end{array}
\end{array}
if b < 1.99999999999999992e217Initial program 55.7%
associate-*l*55.7%
*-commutative55.7%
associate-*l*55.7%
Simplified55.7%
unpow255.7%
unpow255.7%
difference-of-squares59.2%
Applied egg-rr59.2%
clear-num58.8%
un-div-inv59.3%
Applied egg-rr59.3%
associate-/r/58.3%
Simplified58.3%
associate-*r*58.3%
associate-*l/57.4%
associate-*r/59.2%
div-inv58.4%
metadata-eval58.4%
rem-exp-log29.2%
associate-*r*29.2%
pow129.2%
Applied egg-rr69.9%
if 1.99999999999999992e217 < b Initial program 29.9%
associate-*l*29.9%
*-commutative29.9%
associate-*l*29.9%
Simplified29.9%
unpow229.9%
unpow229.9%
difference-of-squares47.9%
Applied egg-rr47.9%
Taylor expanded in angle around 0 59.6%
associate-*r*59.6%
sub-neg59.6%
distribute-lft-in47.6%
+-commutative47.6%
+-commutative47.6%
Applied egg-rr47.6%
*-commutative47.6%
associate-*r*47.6%
*-commutative47.6%
associate-*r*47.6%
neg-mul-147.6%
associate-*r*47.6%
distribute-rgt-out59.6%
+-commutative59.6%
associate-*r*59.6%
neg-mul-159.6%
distribute-rgt-in59.6%
sub-neg59.6%
Simplified59.6%
pow159.6%
associate-*r*70.5%
+-commutative70.5%
Applied egg-rr70.5%
Final simplification69.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
(*
angle_s
(if (<= a 7.6e-7)
(* 0.011111111111111112 (* angle_m (* (+ b_m a) (* b_m PI))))
(* 0.011111111111111112 (* angle_m (* (+ b_m a) (* a (- PI))))))))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 <= 7.6e-7) {
tmp = 0.011111111111111112 * (angle_m * ((b_m + a) * (b_m * ((double) M_PI))));
} else {
tmp = 0.011111111111111112 * (angle_m * ((b_m + a) * (a * -((double) M_PI))));
}
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 <= 7.6e-7) {
tmp = 0.011111111111111112 * (angle_m * ((b_m + a) * (b_m * Math.PI)));
} else {
tmp = 0.011111111111111112 * (angle_m * ((b_m + a) * (a * -Math.PI)));
}
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 <= 7.6e-7: tmp = 0.011111111111111112 * (angle_m * ((b_m + a) * (b_m * math.pi))) else: tmp = 0.011111111111111112 * (angle_m * ((b_m + a) * (a * -math.pi))) 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 <= 7.6e-7) tmp = Float64(0.011111111111111112 * Float64(angle_m * Float64(Float64(b_m + a) * Float64(b_m * pi)))); else tmp = Float64(0.011111111111111112 * Float64(angle_m * Float64(Float64(b_m + a) * Float64(a * Float64(-pi))))); 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 <= 7.6e-7) tmp = 0.011111111111111112 * (angle_m * ((b_m + a) * (b_m * pi))); else tmp = 0.011111111111111112 * (angle_m * ((b_m + a) * (a * -pi))); 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, 7.6e-7], N[(0.011111111111111112 * N[(angle$95$m * N[(N[(b$95$m + a), $MachinePrecision] * N[(b$95$m * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.011111111111111112 * N[(angle$95$m * N[(N[(b$95$m + a), $MachinePrecision] * N[(a * (-Pi)), $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 \begin{array}{l}
\mathbf{if}\;a \leq 7.6 \cdot 10^{-7}:\\
\;\;\;\;0.011111111111111112 \cdot \left(angle\_m \cdot \left(\left(b\_m + a\right) \cdot \left(b\_m \cdot \pi\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.011111111111111112 \cdot \left(angle\_m \cdot \left(\left(b\_m + a\right) \cdot \left(a \cdot \left(-\pi\right)\right)\right)\right)\\
\end{array}
\end{array}
if a < 7.60000000000000029e-7Initial program 55.4%
associate-*l*55.4%
*-commutative55.4%
associate-*l*55.4%
Simplified55.4%
unpow255.4%
unpow255.4%
difference-of-squares58.6%
Applied egg-rr58.6%
Taylor expanded in angle around 0 55.6%
associate-*r*55.6%
sub-neg55.6%
distribute-lft-in53.3%
+-commutative53.3%
+-commutative53.3%
Applied egg-rr53.3%
*-commutative53.3%
associate-*r*53.3%
*-commutative53.3%
associate-*r*53.3%
neg-mul-153.3%
associate-*r*53.3%
distribute-rgt-out55.6%
+-commutative55.6%
associate-*r*55.6%
neg-mul-155.6%
distribute-rgt-in55.6%
sub-neg55.6%
Simplified55.6%
Taylor expanded in b around inf 42.8%
*-commutative42.8%
Simplified42.8%
if 7.60000000000000029e-7 < a Initial program 50.0%
associate-*l*50.0%
*-commutative50.0%
associate-*l*50.0%
Simplified50.0%
unpow250.0%
unpow250.0%
difference-of-squares57.9%
Applied egg-rr57.9%
Taylor expanded in angle around 0 52.3%
associate-*r*52.3%
sub-neg52.3%
distribute-lft-in44.4%
+-commutative44.4%
+-commutative44.4%
Applied egg-rr44.4%
*-commutative44.4%
associate-*r*44.4%
*-commutative44.4%
associate-*r*44.4%
neg-mul-144.4%
associate-*r*44.4%
distribute-rgt-out52.3%
+-commutative52.3%
associate-*r*52.3%
neg-mul-152.3%
distribute-rgt-in52.3%
sub-neg52.3%
Simplified52.3%
Taylor expanded in b around 0 48.0%
associate-*r*48.0%
mul-1-neg48.0%
Simplified48.0%
Final simplification44.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 (* angle_m (* PI (* (- b_m a) (+ b_m 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 * (angle_m * (((double) M_PI) * ((b_m - a) * (b_m + 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 * (angle_m * (Math.PI * ((b_m - a) * (b_m + 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 * (angle_m * (math.pi * ((b_m - a) * (b_m + 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(angle_m * Float64(pi * Float64(Float64(b_m - a) * Float64(b_m + 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 * (angle_m * (pi * ((b_m - a) * (b_m + 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[(angle$95$m * N[(Pi * N[(N[(b$95$m - a), $MachinePrecision] * N[(b$95$m + a), $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(b\_m - a\right) \cdot \left(b\_m + a\right)\right)\right)\right)\right)
\end{array}
Initial program 54.0%
associate-*l*54.0%
*-commutative54.0%
associate-*l*54.0%
Simplified54.0%
unpow254.0%
unpow254.0%
difference-of-squares58.4%
Applied egg-rr58.4%
Taylor expanded in angle around 0 54.8%
Final simplification54.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 (* 0.011111111111111112 (* angle_m (* (+ b_m a) (* b_m PI))))))
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 * ((b_m + a) * (b_m * ((double) M_PI)))));
}
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 * ((b_m + a) * (b_m * Math.PI))));
}
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 * ((b_m + a) * (b_m * math.pi))))
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(Float64(b_m + a) * Float64(b_m * pi))))) 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 * ((b_m + a) * (b_m * pi)))); 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[(N[(b$95$m + a), $MachinePrecision] * N[(b$95$m * Pi), $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(\left(b\_m + a\right) \cdot \left(b\_m \cdot \pi\right)\right)\right)\right)
\end{array}
Initial program 54.0%
associate-*l*54.0%
*-commutative54.0%
associate-*l*54.0%
Simplified54.0%
unpow254.0%
unpow254.0%
difference-of-squares58.4%
Applied egg-rr58.4%
Taylor expanded in angle around 0 54.8%
associate-*r*54.8%
sub-neg54.8%
distribute-lft-in51.1%
+-commutative51.1%
+-commutative51.1%
Applied egg-rr51.1%
*-commutative51.1%
associate-*r*51.1%
*-commutative51.1%
associate-*r*51.1%
neg-mul-151.1%
associate-*r*51.1%
distribute-rgt-out54.8%
+-commutative54.8%
associate-*r*54.8%
neg-mul-154.8%
distribute-rgt-in54.8%
sub-neg54.8%
Simplified54.8%
Taylor expanded in b around inf 37.7%
*-commutative37.7%
Simplified37.7%
Final simplification37.7%
herbie shell --seed 2024067
(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)))))