
(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 7 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 1 angle)
(FPCore (angle_s a b_m angle_m)
:precision binary64
(let* ((t_0 (- (pow b_m 2.0) (pow a 2.0)))
(t_1 (* PI (* angle_m -0.005555555555555556)))
(t_2 (sin t_1))
(t_3 (* PI (* angle_m (- b_m a))))
(t_4 (* (- a b_m) (+ b_m a))))
(*
angle_s
(if (<= (/ angle_m 180.0) 2e-33)
(* 2.0 (* (+ (* b_m t_3) (* a t_3)) 0.005555555555555556))
(if (<= (/ angle_m 180.0) 3e+123)
(* 2.0 (* t_2 t_4))
(if (<= (/ angle_m 180.0) 2e+173)
(*
2.0
(*
t_4
(sin (pow (sqrt (* PI (* angle_m 0.005555555555555556))) 2.0))))
(if (<= (/ angle_m 180.0) 1e+215)
(*
(* t_2 (* 2.0 t_0))
(cos (* (/ angle_m 180.0) (* (cbrt PI) (pow (cbrt PI) 2.0)))))
(if (<= (/ angle_m 180.0) 5e+271)
(*
2.0
(*
(expm1 (log1p (cos t_1)))
(*
t_4
(sin
(pow (cbrt (* angle_m (* PI 0.005555555555555556))) 3.0)))))
(*
2.0
(*
(cos (* -0.005555555555555556 (* angle_m PI)))
(* t_0 (sin (* 0.005555555555555556 (* angle_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) {
double t_0 = pow(b_m, 2.0) - pow(a, 2.0);
double t_1 = ((double) M_PI) * (angle_m * -0.005555555555555556);
double t_2 = sin(t_1);
double t_3 = ((double) M_PI) * (angle_m * (b_m - a));
double t_4 = (a - b_m) * (b_m + a);
double tmp;
if ((angle_m / 180.0) <= 2e-33) {
tmp = 2.0 * (((b_m * t_3) + (a * t_3)) * 0.005555555555555556);
} else if ((angle_m / 180.0) <= 3e+123) {
tmp = 2.0 * (t_2 * t_4);
} else if ((angle_m / 180.0) <= 2e+173) {
tmp = 2.0 * (t_4 * sin(pow(sqrt((((double) M_PI) * (angle_m * 0.005555555555555556))), 2.0)));
} else if ((angle_m / 180.0) <= 1e+215) {
tmp = (t_2 * (2.0 * t_0)) * cos(((angle_m / 180.0) * (cbrt(((double) M_PI)) * pow(cbrt(((double) M_PI)), 2.0))));
} else if ((angle_m / 180.0) <= 5e+271) {
tmp = 2.0 * (expm1(log1p(cos(t_1))) * (t_4 * sin(pow(cbrt((angle_m * (((double) M_PI) * 0.005555555555555556))), 3.0))));
} else {
tmp = 2.0 * (cos((-0.005555555555555556 * (angle_m * ((double) M_PI)))) * (t_0 * sin((0.005555555555555556 * (angle_m * ((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 t_0 = Math.pow(b_m, 2.0) - Math.pow(a, 2.0);
double t_1 = Math.PI * (angle_m * -0.005555555555555556);
double t_2 = Math.sin(t_1);
double t_3 = Math.PI * (angle_m * (b_m - a));
double t_4 = (a - b_m) * (b_m + a);
double tmp;
if ((angle_m / 180.0) <= 2e-33) {
tmp = 2.0 * (((b_m * t_3) + (a * t_3)) * 0.005555555555555556);
} else if ((angle_m / 180.0) <= 3e+123) {
tmp = 2.0 * (t_2 * t_4);
} else if ((angle_m / 180.0) <= 2e+173) {
tmp = 2.0 * (t_4 * Math.sin(Math.pow(Math.sqrt((Math.PI * (angle_m * 0.005555555555555556))), 2.0)));
} else if ((angle_m / 180.0) <= 1e+215) {
tmp = (t_2 * (2.0 * t_0)) * Math.cos(((angle_m / 180.0) * (Math.cbrt(Math.PI) * Math.pow(Math.cbrt(Math.PI), 2.0))));
} else if ((angle_m / 180.0) <= 5e+271) {
tmp = 2.0 * (Math.expm1(Math.log1p(Math.cos(t_1))) * (t_4 * Math.sin(Math.pow(Math.cbrt((angle_m * (Math.PI * 0.005555555555555556))), 3.0))));
} else {
tmp = 2.0 * (Math.cos((-0.005555555555555556 * (angle_m * Math.PI))) * (t_0 * Math.sin((0.005555555555555556 * (angle_m * 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) t_0 = Float64((b_m ^ 2.0) - (a ^ 2.0)) t_1 = Float64(pi * Float64(angle_m * -0.005555555555555556)) t_2 = sin(t_1) t_3 = Float64(pi * Float64(angle_m * Float64(b_m - a))) t_4 = Float64(Float64(a - b_m) * Float64(b_m + a)) tmp = 0.0 if (Float64(angle_m / 180.0) <= 2e-33) tmp = Float64(2.0 * Float64(Float64(Float64(b_m * t_3) + Float64(a * t_3)) * 0.005555555555555556)); elseif (Float64(angle_m / 180.0) <= 3e+123) tmp = Float64(2.0 * Float64(t_2 * t_4)); elseif (Float64(angle_m / 180.0) <= 2e+173) tmp = Float64(2.0 * Float64(t_4 * sin((sqrt(Float64(pi * Float64(angle_m * 0.005555555555555556))) ^ 2.0)))); elseif (Float64(angle_m / 180.0) <= 1e+215) tmp = Float64(Float64(t_2 * Float64(2.0 * t_0)) * cos(Float64(Float64(angle_m / 180.0) * Float64(cbrt(pi) * (cbrt(pi) ^ 2.0))))); elseif (Float64(angle_m / 180.0) <= 5e+271) tmp = Float64(2.0 * Float64(expm1(log1p(cos(t_1))) * Float64(t_4 * sin((cbrt(Float64(angle_m * Float64(pi * 0.005555555555555556))) ^ 3.0))))); else tmp = Float64(2.0 * Float64(cos(Float64(-0.005555555555555556 * Float64(angle_m * pi))) * Float64(t_0 * sin(Float64(0.005555555555555556 * Float64(angle_m * pi)))))); 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[(N[Power[b$95$m, 2.0], $MachinePrecision] - N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(Pi * N[(angle$95$m * -0.005555555555555556), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sin[t$95$1], $MachinePrecision]}, Block[{t$95$3 = N[(Pi * N[(angle$95$m * N[(b$95$m - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[(a - b$95$m), $MachinePrecision] * N[(b$95$m + a), $MachinePrecision]), $MachinePrecision]}, N[(angle$95$s * If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 2e-33], N[(2.0 * N[(N[(N[(b$95$m * t$95$3), $MachinePrecision] + N[(a * t$95$3), $MachinePrecision]), $MachinePrecision] * 0.005555555555555556), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 3e+123], N[(2.0 * N[(t$95$2 * t$95$4), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 2e+173], N[(2.0 * N[(t$95$4 * N[Sin[N[Power[N[Sqrt[N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 1e+215], N[(N[(t$95$2 * N[(2.0 * t$95$0), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(N[(angle$95$m / 180.0), $MachinePrecision] * N[(N[Power[Pi, 1/3], $MachinePrecision] * N[Power[N[Power[Pi, 1/3], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 5e+271], N[(2.0 * N[(N[(Exp[N[Log[1 + N[Cos[t$95$1], $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision] * N[(t$95$4 * N[Sin[N[Power[N[Power[N[(angle$95$m * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[Cos[N[(-0.005555555555555556 * N[(angle$95$m * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 * N[Sin[N[(0.005555555555555556 * N[(angle$95$m * Pi), $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 := {b\_m}^{2} - {a}^{2}\\
t_1 := \pi \cdot \left(angle\_m \cdot -0.005555555555555556\right)\\
t_2 := \sin t\_1\\
t_3 := \pi \cdot \left(angle\_m \cdot \left(b\_m - a\right)\right)\\
t_4 := \left(a - b\_m\right) \cdot \left(b\_m + a\right)\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{angle\_m}{180} \leq 2 \cdot 10^{-33}:\\
\;\;\;\;2 \cdot \left(\left(b\_m \cdot t\_3 + a \cdot t\_3\right) \cdot 0.005555555555555556\right)\\
\mathbf{elif}\;\frac{angle\_m}{180} \leq 3 \cdot 10^{+123}:\\
\;\;\;\;2 \cdot \left(t\_2 \cdot t\_4\right)\\
\mathbf{elif}\;\frac{angle\_m}{180} \leq 2 \cdot 10^{+173}:\\
\;\;\;\;2 \cdot \left(t\_4 \cdot \sin \left({\left(\sqrt{\pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)}\right)}^{2}\right)\right)\\
\mathbf{elif}\;\frac{angle\_m}{180} \leq 10^{+215}:\\
\;\;\;\;\left(t\_2 \cdot \left(2 \cdot t\_0\right)\right) \cdot \cos \left(\frac{angle\_m}{180} \cdot \left(\sqrt[3]{\pi} \cdot {\left(\sqrt[3]{\pi}\right)}^{2}\right)\right)\\
\mathbf{elif}\;\frac{angle\_m}{180} \leq 5 \cdot 10^{+271}:\\
\;\;\;\;2 \cdot \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\cos t\_1\right)\right) \cdot \left(t\_4 \cdot \sin \left({\left(\sqrt[3]{angle\_m \cdot \left(\pi \cdot 0.005555555555555556\right)}\right)}^{3}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\cos \left(-0.005555555555555556 \cdot \left(angle\_m \cdot \pi\right)\right) \cdot \left(t\_0 \cdot \sin \left(0.005555555555555556 \cdot \left(angle\_m \cdot \pi\right)\right)\right)\right)\\
\end{array}
\end{array}
\end{array}
if (/.f64 angle 180) < 2.0000000000000001e-33Initial program 59.8%
Simplified61.5%
Taylor expanded in angle around 0 58.3%
unpow258.3%
unpow258.3%
difference-of-squares60.8%
Applied egg-rr60.8%
Taylor expanded in angle around 0 60.8%
*-commutative60.8%
associate-*r*60.8%
+-commutative60.8%
*-commutative60.8%
+-commutative60.8%
Simplified60.8%
associate-*r*75.4%
+-commutative75.4%
distribute-lft-in71.5%
*-commutative71.5%
associate-*l*71.4%
*-commutative71.4%
associate-*l*71.4%
Applied egg-rr71.4%
if 2.0000000000000001e-33 < (/.f64 angle 180) < 3.00000000000000008e123Initial program 45.2%
Simplified47.0%
unpow247.0%
unpow247.0%
difference-of-squares47.0%
Applied egg-rr47.0%
Taylor expanded in angle around 0 54.7%
Taylor expanded in angle around inf 58.6%
*-commutative58.6%
*-commutative58.6%
associate-*l*59.3%
Simplified59.3%
if 3.00000000000000008e123 < (/.f64 angle 180) < 2e173Initial program 51.2%
Simplified51.2%
unpow251.2%
unpow251.2%
difference-of-squares51.2%
Applied egg-rr51.2%
Taylor expanded in angle around 0 45.9%
Taylor expanded in angle around inf 15.0%
*-commutative15.0%
*-commutative15.0%
associate-*l*38.4%
Simplified38.4%
add-sqr-sqrt0.0%
pow20.0%
Applied egg-rr69.6%
if 2e173 < (/.f64 angle 180) < 9.99999999999999907e214Initial program 31.8%
pow131.8%
Applied egg-rr26.3%
unpow126.3%
*-commutative26.3%
associate-*l*26.3%
associate-*r*35.1%
*-commutative35.1%
associate-*l*34.3%
*-commutative34.3%
Simplified34.3%
add-cube-cbrt44.3%
pow244.3%
Applied egg-rr44.3%
if 9.99999999999999907e214 < (/.f64 angle 180) < 5.0000000000000003e271Initial program 21.5%
Simplified30.5%
unpow230.5%
unpow230.5%
difference-of-squares30.5%
Applied egg-rr30.5%
associate-*r/36.3%
*-commutative36.3%
add-sqr-sqrt0.0%
sqrt-unprod0.0%
frac-times0.0%
metadata-eval0.0%
metadata-eval0.0%
frac-times0.0%
associate-*r/0.0%
associate-*r/0.0%
sqrt-unprod35.7%
add-sqr-sqrt32.5%
expm1-log1p-u32.5%
expm1-undefine32.5%
Applied egg-rr30.5%
expm1-define30.5%
associate-*r*34.9%
*-commutative34.9%
associate-*l*30.6%
Simplified30.6%
add-sqr-sqrt0.0%
sqrt-unprod35.8%
div-inv35.8%
metadata-eval35.8%
div-inv35.8%
metadata-eval35.8%
swap-sqr35.8%
metadata-eval35.8%
metadata-eval35.8%
swap-sqr35.8%
sqrt-unprod31.1%
add-sqr-sqrt35.8%
add-cube-cbrt47.2%
pow347.2%
Applied egg-rr47.2%
if 5.0000000000000003e271 < (/.f64 angle 180) Initial program 17.4%
Simplified17.4%
Taylor expanded in angle around inf 18.2%
Final simplification66.4%
b_m = (fabs.f64 b)
angle_m = (fabs.f64 angle)
angle_s = (copysign.f64 1 angle)
(FPCore (angle_s a b_m angle_m)
:precision binary64
(let* ((t_0 (* PI (* angle_m -0.005555555555555556)))
(t_1 (cos t_0))
(t_2 (sin t_0))
(t_3 (* PI (* angle_m (- b_m a))))
(t_4 (* (- a b_m) (+ b_m a)))
(t_5 (* 2.0 (* t_2 t_4))))
(*
angle_s
(if (<= (/ angle_m 180.0) 2e-33)
(* 2.0 (* (+ (* b_m t_3) (* a t_3)) 0.005555555555555556))
(if (<= (/ angle_m 180.0) 3e+123)
t_5
(if (<= (/ angle_m 180.0) 2e+173)
(*
2.0
(*
t_4
(sin (pow (sqrt (* PI (* angle_m 0.005555555555555556))) 2.0))))
(if (<= (/ angle_m 180.0) 1e+248)
(* 2.0 (* t_2 (* (- (pow b_m 2.0) (pow a 2.0)) t_1)))
(if (<= (/ angle_m 180.0) 5e+259)
(*
2.0
(*
(sin (* angle_m (* PI 0.005555555555555556)))
(* (pow b_m 2.0) t_1)))
t_5))))))))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 t_1 = cos(t_0);
double t_2 = sin(t_0);
double t_3 = ((double) M_PI) * (angle_m * (b_m - a));
double t_4 = (a - b_m) * (b_m + a);
double t_5 = 2.0 * (t_2 * t_4);
double tmp;
if ((angle_m / 180.0) <= 2e-33) {
tmp = 2.0 * (((b_m * t_3) + (a * t_3)) * 0.005555555555555556);
} else if ((angle_m / 180.0) <= 3e+123) {
tmp = t_5;
} else if ((angle_m / 180.0) <= 2e+173) {
tmp = 2.0 * (t_4 * sin(pow(sqrt((((double) M_PI) * (angle_m * 0.005555555555555556))), 2.0)));
} else if ((angle_m / 180.0) <= 1e+248) {
tmp = 2.0 * (t_2 * ((pow(b_m, 2.0) - pow(a, 2.0)) * t_1));
} else if ((angle_m / 180.0) <= 5e+259) {
tmp = 2.0 * (sin((angle_m * (((double) M_PI) * 0.005555555555555556))) * (pow(b_m, 2.0) * t_1));
} else {
tmp = t_5;
}
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 t_1 = Math.cos(t_0);
double t_2 = Math.sin(t_0);
double t_3 = Math.PI * (angle_m * (b_m - a));
double t_4 = (a - b_m) * (b_m + a);
double t_5 = 2.0 * (t_2 * t_4);
double tmp;
if ((angle_m / 180.0) <= 2e-33) {
tmp = 2.0 * (((b_m * t_3) + (a * t_3)) * 0.005555555555555556);
} else if ((angle_m / 180.0) <= 3e+123) {
tmp = t_5;
} else if ((angle_m / 180.0) <= 2e+173) {
tmp = 2.0 * (t_4 * Math.sin(Math.pow(Math.sqrt((Math.PI * (angle_m * 0.005555555555555556))), 2.0)));
} else if ((angle_m / 180.0) <= 1e+248) {
tmp = 2.0 * (t_2 * ((Math.pow(b_m, 2.0) - Math.pow(a, 2.0)) * t_1));
} else if ((angle_m / 180.0) <= 5e+259) {
tmp = 2.0 * (Math.sin((angle_m * (Math.PI * 0.005555555555555556))) * (Math.pow(b_m, 2.0) * t_1));
} else {
tmp = t_5;
}
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) t_1 = math.cos(t_0) t_2 = math.sin(t_0) t_3 = math.pi * (angle_m * (b_m - a)) t_4 = (a - b_m) * (b_m + a) t_5 = 2.0 * (t_2 * t_4) tmp = 0 if (angle_m / 180.0) <= 2e-33: tmp = 2.0 * (((b_m * t_3) + (a * t_3)) * 0.005555555555555556) elif (angle_m / 180.0) <= 3e+123: tmp = t_5 elif (angle_m / 180.0) <= 2e+173: tmp = 2.0 * (t_4 * math.sin(math.pow(math.sqrt((math.pi * (angle_m * 0.005555555555555556))), 2.0))) elif (angle_m / 180.0) <= 1e+248: tmp = 2.0 * (t_2 * ((math.pow(b_m, 2.0) - math.pow(a, 2.0)) * t_1)) elif (angle_m / 180.0) <= 5e+259: tmp = 2.0 * (math.sin((angle_m * (math.pi * 0.005555555555555556))) * (math.pow(b_m, 2.0) * t_1)) else: tmp = t_5 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)) t_1 = cos(t_0) t_2 = sin(t_0) t_3 = Float64(pi * Float64(angle_m * Float64(b_m - a))) t_4 = Float64(Float64(a - b_m) * Float64(b_m + a)) t_5 = Float64(2.0 * Float64(t_2 * t_4)) tmp = 0.0 if (Float64(angle_m / 180.0) <= 2e-33) tmp = Float64(2.0 * Float64(Float64(Float64(b_m * t_3) + Float64(a * t_3)) * 0.005555555555555556)); elseif (Float64(angle_m / 180.0) <= 3e+123) tmp = t_5; elseif (Float64(angle_m / 180.0) <= 2e+173) tmp = Float64(2.0 * Float64(t_4 * sin((sqrt(Float64(pi * Float64(angle_m * 0.005555555555555556))) ^ 2.0)))); elseif (Float64(angle_m / 180.0) <= 1e+248) tmp = Float64(2.0 * Float64(t_2 * Float64(Float64((b_m ^ 2.0) - (a ^ 2.0)) * t_1))); elseif (Float64(angle_m / 180.0) <= 5e+259) tmp = Float64(2.0 * Float64(sin(Float64(angle_m * Float64(pi * 0.005555555555555556))) * Float64((b_m ^ 2.0) * t_1))); else tmp = t_5; 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 = pi * (angle_m * -0.005555555555555556); t_1 = cos(t_0); t_2 = sin(t_0); t_3 = pi * (angle_m * (b_m - a)); t_4 = (a - b_m) * (b_m + a); t_5 = 2.0 * (t_2 * t_4); tmp = 0.0; if ((angle_m / 180.0) <= 2e-33) tmp = 2.0 * (((b_m * t_3) + (a * t_3)) * 0.005555555555555556); elseif ((angle_m / 180.0) <= 3e+123) tmp = t_5; elseif ((angle_m / 180.0) <= 2e+173) tmp = 2.0 * (t_4 * sin((sqrt((pi * (angle_m * 0.005555555555555556))) ^ 2.0))); elseif ((angle_m / 180.0) <= 1e+248) tmp = 2.0 * (t_2 * (((b_m ^ 2.0) - (a ^ 2.0)) * t_1)); elseif ((angle_m / 180.0) <= 5e+259) tmp = 2.0 * (sin((angle_m * (pi * 0.005555555555555556))) * ((b_m ^ 2.0) * t_1)); else tmp = t_5; 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[(Pi * N[(angle$95$m * -0.005555555555555556), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Cos[t$95$0], $MachinePrecision]}, Block[{t$95$2 = N[Sin[t$95$0], $MachinePrecision]}, Block[{t$95$3 = N[(Pi * N[(angle$95$m * N[(b$95$m - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[(a - b$95$m), $MachinePrecision] * N[(b$95$m + a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(2.0 * N[(t$95$2 * t$95$4), $MachinePrecision]), $MachinePrecision]}, N[(angle$95$s * If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 2e-33], N[(2.0 * N[(N[(N[(b$95$m * t$95$3), $MachinePrecision] + N[(a * t$95$3), $MachinePrecision]), $MachinePrecision] * 0.005555555555555556), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 3e+123], t$95$5, If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 2e+173], N[(2.0 * N[(t$95$4 * N[Sin[N[Power[N[Sqrt[N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 1e+248], N[(2.0 * N[(t$95$2 * N[(N[(N[Power[b$95$m, 2.0], $MachinePrecision] - N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 5e+259], N[(2.0 * N[(N[Sin[N[(angle$95$m * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Power[b$95$m, 2.0], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$5]]]]]), $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)\\
t_1 := \cos t\_0\\
t_2 := \sin t\_0\\
t_3 := \pi \cdot \left(angle\_m \cdot \left(b\_m - a\right)\right)\\
t_4 := \left(a - b\_m\right) \cdot \left(b\_m + a\right)\\
t_5 := 2 \cdot \left(t\_2 \cdot t\_4\right)\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{angle\_m}{180} \leq 2 \cdot 10^{-33}:\\
\;\;\;\;2 \cdot \left(\left(b\_m \cdot t\_3 + a \cdot t\_3\right) \cdot 0.005555555555555556\right)\\
\mathbf{elif}\;\frac{angle\_m}{180} \leq 3 \cdot 10^{+123}:\\
\;\;\;\;t\_5\\
\mathbf{elif}\;\frac{angle\_m}{180} \leq 2 \cdot 10^{+173}:\\
\;\;\;\;2 \cdot \left(t\_4 \cdot \sin \left({\left(\sqrt{\pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)}\right)}^{2}\right)\right)\\
\mathbf{elif}\;\frac{angle\_m}{180} \leq 10^{+248}:\\
\;\;\;\;2 \cdot \left(t\_2 \cdot \left(\left({b\_m}^{2} - {a}^{2}\right) \cdot t\_1\right)\right)\\
\mathbf{elif}\;\frac{angle\_m}{180} \leq 5 \cdot 10^{+259}:\\
\;\;\;\;2 \cdot \left(\sin \left(angle\_m \cdot \left(\pi \cdot 0.005555555555555556\right)\right) \cdot \left({b\_m}^{2} \cdot t\_1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_5\\
\end{array}
\end{array}
\end{array}
if (/.f64 angle 180) < 2.0000000000000001e-33Initial program 59.8%
Simplified61.5%
Taylor expanded in angle around 0 58.3%
unpow258.3%
unpow258.3%
difference-of-squares60.8%
Applied egg-rr60.8%
Taylor expanded in angle around 0 60.8%
*-commutative60.8%
associate-*r*60.8%
+-commutative60.8%
*-commutative60.8%
+-commutative60.8%
Simplified60.8%
associate-*r*75.4%
+-commutative75.4%
distribute-lft-in71.5%
*-commutative71.5%
associate-*l*71.4%
*-commutative71.4%
associate-*l*71.4%
Applied egg-rr71.4%
if 2.0000000000000001e-33 < (/.f64 angle 180) < 3.00000000000000008e123 or 5.00000000000000033e259 < (/.f64 angle 180) Initial program 39.6%
Simplified44.3%
unpow244.3%
unpow244.3%
difference-of-squares44.3%
Applied egg-rr44.3%
Taylor expanded in angle around 0 50.3%
Taylor expanded in angle around inf 56.2%
*-commutative56.2%
*-commutative56.2%
associate-*l*57.4%
Simplified57.4%
if 3.00000000000000008e123 < (/.f64 angle 180) < 2e173Initial program 51.2%
Simplified51.2%
unpow251.2%
unpow251.2%
difference-of-squares51.2%
Applied egg-rr51.2%
Taylor expanded in angle around 0 45.9%
Taylor expanded in angle around inf 15.0%
*-commutative15.0%
*-commutative15.0%
associate-*l*38.4%
Simplified38.4%
add-sqr-sqrt0.0%
pow20.0%
Applied egg-rr69.6%
if 2e173 < (/.f64 angle 180) < 1.00000000000000005e248Initial program 27.9%
Simplified28.8%
*-commutative28.8%
sub-neg28.8%
distribute-lft-in28.8%
Applied egg-rr37.3%
distribute-lft-out37.3%
sub-neg37.3%
associate-*r*37.3%
*-commutative37.3%
associate-*l*37.3%
associate-*r*34.2%
*-commutative34.2%
associate-*l*38.1%
associate-*r*42.8%
*-commutative42.8%
associate-*l*47.3%
Simplified47.3%
if 1.00000000000000005e248 < (/.f64 angle 180) < 5.00000000000000033e259Initial program 24.7%
Simplified17.6%
Taylor expanded in b around inf 51.2%
associate-*r*51.2%
*-commutative51.2%
associate-*r*34.5%
*-commutative34.5%
*-commutative34.5%
associate-*l*51.2%
associate-*r*34.5%
*-commutative34.5%
associate-*l*51.2%
Simplified51.2%
Final simplification67.0%
b_m = (fabs.f64 b)
angle_m = (fabs.f64 angle)
angle_s = (copysign.f64 1 angle)
(FPCore (angle_s a b_m angle_m)
:precision binary64
(let* ((t_0 (* PI (* angle_m (- b_m a)))))
(*
angle_s
(if (<= (pow b_m 2.0) 2e+105)
(* 2.0 (* (* (- a b_m) (+ b_m a)) (sin (* angle_m (/ PI -180.0)))))
(* 2.0 (* (+ (* b_m t_0) (* a t_0)) 0.005555555555555556))))))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 * (b_m - a));
double tmp;
if (pow(b_m, 2.0) <= 2e+105) {
tmp = 2.0 * (((a - b_m) * (b_m + a)) * sin((angle_m * (((double) M_PI) / -180.0))));
} else {
tmp = 2.0 * (((b_m * t_0) + (a * t_0)) * 0.005555555555555556);
}
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 * (b_m - a));
double tmp;
if (Math.pow(b_m, 2.0) <= 2e+105) {
tmp = 2.0 * (((a - b_m) * (b_m + a)) * Math.sin((angle_m * (Math.PI / -180.0))));
} else {
tmp = 2.0 * (((b_m * t_0) + (a * t_0)) * 0.005555555555555556);
}
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 * (b_m - a)) tmp = 0 if math.pow(b_m, 2.0) <= 2e+105: tmp = 2.0 * (((a - b_m) * (b_m + a)) * math.sin((angle_m * (math.pi / -180.0)))) else: tmp = 2.0 * (((b_m * t_0) + (a * t_0)) * 0.005555555555555556) 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 * Float64(b_m - a))) tmp = 0.0 if ((b_m ^ 2.0) <= 2e+105) tmp = Float64(2.0 * Float64(Float64(Float64(a - b_m) * Float64(b_m + a)) * sin(Float64(angle_m * Float64(pi / -180.0))))); else tmp = Float64(2.0 * Float64(Float64(Float64(b_m * t_0) + Float64(a * t_0)) * 0.005555555555555556)); 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 = pi * (angle_m * (b_m - a)); tmp = 0.0; if ((b_m ^ 2.0) <= 2e+105) tmp = 2.0 * (((a - b_m) * (b_m + a)) * sin((angle_m * (pi / -180.0)))); else tmp = 2.0 * (((b_m * t_0) + (a * t_0)) * 0.005555555555555556); 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[(Pi * N[(angle$95$m * N[(b$95$m - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(angle$95$s * If[LessEqual[N[Power[b$95$m, 2.0], $MachinePrecision], 2e+105], N[(2.0 * N[(N[(N[(a - b$95$m), $MachinePrecision] * N[(b$95$m + a), $MachinePrecision]), $MachinePrecision] * N[Sin[N[(angle$95$m * N[(Pi / -180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(N[(b$95$m * t$95$0), $MachinePrecision] + N[(a * t$95$0), $MachinePrecision]), $MachinePrecision] * 0.005555555555555556), $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 \left(b\_m - a\right)\right)\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;{b\_m}^{2} \leq 2 \cdot 10^{+105}:\\
\;\;\;\;2 \cdot \left(\left(\left(a - b\_m\right) \cdot \left(b\_m + a\right)\right) \cdot \sin \left(angle\_m \cdot \frac{\pi}{-180}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\left(b\_m \cdot t\_0 + a \cdot t\_0\right) \cdot 0.005555555555555556\right)\\
\end{array}
\end{array}
\end{array}
if (pow.f64 b 2) < 1.9999999999999999e105Initial program 55.5%
Simplified57.1%
unpow257.1%
unpow257.1%
difference-of-squares57.1%
Applied egg-rr57.1%
Taylor expanded in angle around 0 58.5%
if 1.9999999999999999e105 < (pow.f64 b 2) Initial program 50.2%
Simplified53.2%
Taylor expanded in angle around 0 51.6%
unpow251.6%
unpow251.6%
difference-of-squares57.9%
Applied egg-rr57.9%
Taylor expanded in angle around 0 57.9%
*-commutative57.9%
associate-*r*57.9%
+-commutative57.9%
*-commutative57.9%
+-commutative57.9%
Simplified57.9%
associate-*r*77.4%
+-commutative77.4%
distribute-lft-in64.8%
*-commutative64.8%
associate-*l*64.8%
*-commutative64.8%
associate-*l*64.8%
Applied egg-rr64.8%
Final simplification61.0%
b_m = (fabs.f64 b)
angle_m = (fabs.f64 angle)
angle_s = (copysign.f64 1 angle)
(FPCore (angle_s a b_m angle_m)
:precision binary64
(let* ((t_0 (* PI (* angle_m (- b_m a)))))
(*
angle_s
(if (<= (pow b_m 2.0) 2e+105)
(*
2.0
(*
(sin (* PI (* angle_m -0.005555555555555556)))
(* (- a b_m) (+ b_m a))))
(* 2.0 (* (+ (* b_m t_0) (* a t_0)) 0.005555555555555556))))))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 * (b_m - a));
double tmp;
if (pow(b_m, 2.0) <= 2e+105) {
tmp = 2.0 * (sin((((double) M_PI) * (angle_m * -0.005555555555555556))) * ((a - b_m) * (b_m + a)));
} else {
tmp = 2.0 * (((b_m * t_0) + (a * t_0)) * 0.005555555555555556);
}
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 * (b_m - a));
double tmp;
if (Math.pow(b_m, 2.0) <= 2e+105) {
tmp = 2.0 * (Math.sin((Math.PI * (angle_m * -0.005555555555555556))) * ((a - b_m) * (b_m + a)));
} else {
tmp = 2.0 * (((b_m * t_0) + (a * t_0)) * 0.005555555555555556);
}
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 * (b_m - a)) tmp = 0 if math.pow(b_m, 2.0) <= 2e+105: tmp = 2.0 * (math.sin((math.pi * (angle_m * -0.005555555555555556))) * ((a - b_m) * (b_m + a))) else: tmp = 2.0 * (((b_m * t_0) + (a * t_0)) * 0.005555555555555556) 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 * Float64(b_m - a))) tmp = 0.0 if ((b_m ^ 2.0) <= 2e+105) tmp = Float64(2.0 * Float64(sin(Float64(pi * Float64(angle_m * -0.005555555555555556))) * Float64(Float64(a - b_m) * Float64(b_m + a)))); else tmp = Float64(2.0 * Float64(Float64(Float64(b_m * t_0) + Float64(a * t_0)) * 0.005555555555555556)); 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 = pi * (angle_m * (b_m - a)); tmp = 0.0; if ((b_m ^ 2.0) <= 2e+105) tmp = 2.0 * (sin((pi * (angle_m * -0.005555555555555556))) * ((a - b_m) * (b_m + a))); else tmp = 2.0 * (((b_m * t_0) + (a * t_0)) * 0.005555555555555556); 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[(Pi * N[(angle$95$m * N[(b$95$m - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(angle$95$s * If[LessEqual[N[Power[b$95$m, 2.0], $MachinePrecision], 2e+105], N[(2.0 * N[(N[Sin[N[(Pi * N[(angle$95$m * -0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(a - b$95$m), $MachinePrecision] * N[(b$95$m + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(N[(b$95$m * t$95$0), $MachinePrecision] + N[(a * t$95$0), $MachinePrecision]), $MachinePrecision] * 0.005555555555555556), $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 \left(b\_m - a\right)\right)\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;{b\_m}^{2} \leq 2 \cdot 10^{+105}:\\
\;\;\;\;2 \cdot \left(\sin \left(\pi \cdot \left(angle\_m \cdot -0.005555555555555556\right)\right) \cdot \left(\left(a - b\_m\right) \cdot \left(b\_m + a\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\left(b\_m \cdot t\_0 + a \cdot t\_0\right) \cdot 0.005555555555555556\right)\\
\end{array}
\end{array}
\end{array}
if (pow.f64 b 2) < 1.9999999999999999e105Initial program 55.5%
Simplified57.1%
unpow257.1%
unpow257.1%
difference-of-squares57.1%
Applied egg-rr57.1%
Taylor expanded in angle around 0 58.5%
Taylor expanded in angle around inf 57.3%
*-commutative57.3%
*-commutative57.3%
associate-*l*59.1%
Simplified59.1%
if 1.9999999999999999e105 < (pow.f64 b 2) Initial program 50.2%
Simplified53.2%
Taylor expanded in angle around 0 51.6%
unpow251.6%
unpow251.6%
difference-of-squares57.9%
Applied egg-rr57.9%
Taylor expanded in angle around 0 57.9%
*-commutative57.9%
associate-*r*57.9%
+-commutative57.9%
*-commutative57.9%
+-commutative57.9%
Simplified57.9%
associate-*r*77.4%
+-commutative77.4%
distribute-lft-in64.8%
*-commutative64.8%
associate-*l*64.8%
*-commutative64.8%
associate-*l*64.8%
Applied egg-rr64.8%
Final simplification61.4%
b_m = (fabs.f64 b) angle_m = (fabs.f64 angle) angle_s = (copysign.f64 1 angle) (FPCore (angle_s a b_m angle_m) :precision binary64 (let* ((t_0 (* PI (* angle_m (- b_m a))))) (* angle_s (* 2.0 (* (+ (* b_m t_0) (* a t_0)) 0.005555555555555556)))))
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 * (b_m - a));
return angle_s * (2.0 * (((b_m * t_0) + (a * t_0)) * 0.005555555555555556));
}
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 * (b_m - a));
return angle_s * (2.0 * (((b_m * t_0) + (a * t_0)) * 0.005555555555555556));
}
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 * (b_m - a)) return angle_s * (2.0 * (((b_m * t_0) + (a * t_0)) * 0.005555555555555556))
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 * Float64(b_m - a))) return Float64(angle_s * Float64(2.0 * Float64(Float64(Float64(b_m * t_0) + Float64(a * t_0)) * 0.005555555555555556))) 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) t_0 = pi * (angle_m * (b_m - a)); tmp = angle_s * (2.0 * (((b_m * t_0) + (a * t_0)) * 0.005555555555555556)); 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 * N[(b$95$m - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(angle$95$s * N[(2.0 * N[(N[(N[(b$95$m * t$95$0), $MachinePrecision] + N[(a * t$95$0), $MachinePrecision]), $MachinePrecision] * 0.005555555555555556), $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 \left(b\_m - a\right)\right)\\
angle\_s \cdot \left(2 \cdot \left(\left(b\_m \cdot t\_0 + a \cdot t\_0\right) \cdot 0.005555555555555556\right)\right)
\end{array}
\end{array}
Initial program 53.3%
Simplified53.7%
Taylor expanded in angle around 0 50.8%
unpow250.8%
unpow250.8%
difference-of-squares53.3%
Applied egg-rr53.3%
Taylor expanded in angle around 0 53.3%
*-commutative53.3%
associate-*r*53.3%
+-commutative53.3%
*-commutative53.3%
+-commutative53.3%
Simplified53.3%
associate-*r*62.5%
+-commutative62.5%
distribute-lft-in56.2%
*-commutative56.2%
associate-*l*56.1%
*-commutative56.1%
associate-*l*56.1%
Applied egg-rr56.1%
Final simplification56.1%
b_m = (fabs.f64 b) angle_m = (fabs.f64 angle) angle_s = (copysign.f64 1 angle) (FPCore (angle_s a b_m angle_m) :precision binary64 (* angle_s (* 2.0 (* 0.005555555555555556 (* 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 * (2.0 * (0.005555555555555556 * (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 * (2.0 * (0.005555555555555556 * (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 * (2.0 * (0.005555555555555556 * (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(2.0 * Float64(0.005555555555555556 * 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 * (2.0 * (0.005555555555555556 * (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[(2.0 * N[(0.005555555555555556 * N[(angle$95$m * N[(Pi * N[(N[(b$95$m - a), $MachinePrecision] * N[(b$95$m + a), $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)
\\
angle\_s \cdot \left(2 \cdot \left(0.005555555555555556 \cdot \left(angle\_m \cdot \left(\pi \cdot \left(\left(b\_m - a\right) \cdot \left(b\_m + a\right)\right)\right)\right)\right)\right)
\end{array}
Initial program 53.3%
Simplified53.7%
Taylor expanded in angle around 0 50.8%
unpow250.8%
unpow250.8%
difference-of-squares53.3%
Applied egg-rr53.3%
Final simplification53.3%
b_m = (fabs.f64 b) angle_m = (fabs.f64 angle) angle_s = (copysign.f64 1 angle) (FPCore (angle_s a b_m angle_m) :precision binary64 (* angle_s (* 2.0 (* (* (- a b_m) (+ b_m a)) (* -0.005555555555555556 (* angle_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 * (2.0 * (((a - b_m) * (b_m + a)) * (-0.005555555555555556 * (angle_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 * (2.0 * (((a - b_m) * (b_m + a)) * (-0.005555555555555556 * (angle_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 * (2.0 * (((a - b_m) * (b_m + a)) * (-0.005555555555555556 * (angle_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(2.0 * Float64(Float64(Float64(a - b_m) * Float64(b_m + a)) * Float64(-0.005555555555555556 * Float64(angle_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 * (2.0 * (((a - b_m) * (b_m + a)) * (-0.005555555555555556 * (angle_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[(2.0 * N[(N[(N[(a - b$95$m), $MachinePrecision] * N[(b$95$m + a), $MachinePrecision]), $MachinePrecision] * N[(-0.005555555555555556 * N[(angle$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(2 \cdot \left(\left(\left(a - b\_m\right) \cdot \left(b\_m + a\right)\right) \cdot \left(-0.005555555555555556 \cdot \left(angle\_m \cdot \pi\right)\right)\right)\right)
\end{array}
Initial program 53.3%
Simplified54.7%
unpow254.7%
unpow254.7%
difference-of-squares57.3%
Applied egg-rr57.3%
Taylor expanded in angle around 0 57.8%
Taylor expanded in angle around 0 53.4%
Final simplification53.4%
herbie shell --seed 2024043
(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)))))