
(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 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* PI (/ angle 180.0)))) (* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) (sin t_0)) (cos t_0))))
double code(double a, double b, double angle) {
double t_0 = ((double) M_PI) * (angle / 180.0);
return ((2.0 * (pow(b, 2.0) - pow(a, 2.0))) * sin(t_0)) * cos(t_0);
}
public static double code(double a, double b, double angle) {
double t_0 = Math.PI * (angle / 180.0);
return ((2.0 * (Math.pow(b, 2.0) - Math.pow(a, 2.0))) * Math.sin(t_0)) * Math.cos(t_0);
}
def code(a, b, angle): t_0 = math.pi * (angle / 180.0) return ((2.0 * (math.pow(b, 2.0) - math.pow(a, 2.0))) * math.sin(t_0)) * math.cos(t_0)
function code(a, b, angle) t_0 = Float64(pi * Float64(angle / 180.0)) return Float64(Float64(Float64(2.0 * Float64((b ^ 2.0) - (a ^ 2.0))) * sin(t_0)) * cos(t_0)) end
function tmp = code(a, b, angle) t_0 = pi * (angle / 180.0); tmp = ((2.0 * ((b ^ 2.0) - (a ^ 2.0))) * sin(t_0)) * cos(t_0); end
code[a_, b_, angle_] := Block[{t$95$0 = N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(2.0 * N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \pi \cdot \frac{angle}{180}\\
\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin t\_0\right) \cdot \cos t\_0
\end{array}
\end{array}
angle\_m = (fabs.f64 angle)
angle\_s = (copysign.f64 #s(literal 1 binary64) angle)
(FPCore (angle_s a b angle_m)
:precision binary64
(let* ((t_0 (* (/ angle_m 180.0) PI))
(t_1 (* PI (* angle_m 0.005555555555555556)))
(t_2 (* (+ b a) (- b a))))
(*
angle_s
(if (<= (/ angle_m 180.0) 5e+22)
(* (* (sin (* (* angle_m PI) 0.011111111111111112)) (+ b a)) (- b a))
(if (<= (/ angle_m 180.0) 1e+72)
(*
t_2
(* 2.0 (* (sin t_0) (cos (pow (pow t_1 3.0) 0.3333333333333333)))))
(if (<= (/ angle_m 180.0) 5e+129)
(* t_2 (* 2.0 (sin (* (/ angle_m 180.0) (pow (sqrt PI) 2.0)))))
(if (<= (/ angle_m 180.0) 2.4e+261)
(* t_2 (* 2.0 (sin (expm1 (log1p t_1)))))
(* t_2 (* 2.0 (* (sqrt (pow (sin t_1) 2.0)) (cos t_0)))))))))))angle\_m = fabs(angle);
angle\_s = copysign(1.0, angle);
double code(double angle_s, double a, double b, double angle_m) {
double t_0 = (angle_m / 180.0) * ((double) M_PI);
double t_1 = ((double) M_PI) * (angle_m * 0.005555555555555556);
double t_2 = (b + a) * (b - a);
double tmp;
if ((angle_m / 180.0) <= 5e+22) {
tmp = (sin(((angle_m * ((double) M_PI)) * 0.011111111111111112)) * (b + a)) * (b - a);
} else if ((angle_m / 180.0) <= 1e+72) {
tmp = t_2 * (2.0 * (sin(t_0) * cos(pow(pow(t_1, 3.0), 0.3333333333333333))));
} else if ((angle_m / 180.0) <= 5e+129) {
tmp = t_2 * (2.0 * sin(((angle_m / 180.0) * pow(sqrt(((double) M_PI)), 2.0))));
} else if ((angle_m / 180.0) <= 2.4e+261) {
tmp = t_2 * (2.0 * sin(expm1(log1p(t_1))));
} else {
tmp = t_2 * (2.0 * (sqrt(pow(sin(t_1), 2.0)) * cos(t_0)));
}
return angle_s * tmp;
}
angle\_m = Math.abs(angle);
angle\_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a, double b, double angle_m) {
double t_0 = (angle_m / 180.0) * Math.PI;
double t_1 = Math.PI * (angle_m * 0.005555555555555556);
double t_2 = (b + a) * (b - a);
double tmp;
if ((angle_m / 180.0) <= 5e+22) {
tmp = (Math.sin(((angle_m * Math.PI) * 0.011111111111111112)) * (b + a)) * (b - a);
} else if ((angle_m / 180.0) <= 1e+72) {
tmp = t_2 * (2.0 * (Math.sin(t_0) * Math.cos(Math.pow(Math.pow(t_1, 3.0), 0.3333333333333333))));
} else if ((angle_m / 180.0) <= 5e+129) {
tmp = t_2 * (2.0 * Math.sin(((angle_m / 180.0) * Math.pow(Math.sqrt(Math.PI), 2.0))));
} else if ((angle_m / 180.0) <= 2.4e+261) {
tmp = t_2 * (2.0 * Math.sin(Math.expm1(Math.log1p(t_1))));
} else {
tmp = t_2 * (2.0 * (Math.sqrt(Math.pow(Math.sin(t_1), 2.0)) * Math.cos(t_0)));
}
return angle_s * tmp;
}
angle\_m = math.fabs(angle) angle\_s = math.copysign(1.0, angle) def code(angle_s, a, b, angle_m): t_0 = (angle_m / 180.0) * math.pi t_1 = math.pi * (angle_m * 0.005555555555555556) t_2 = (b + a) * (b - a) tmp = 0 if (angle_m / 180.0) <= 5e+22: tmp = (math.sin(((angle_m * math.pi) * 0.011111111111111112)) * (b + a)) * (b - a) elif (angle_m / 180.0) <= 1e+72: tmp = t_2 * (2.0 * (math.sin(t_0) * math.cos(math.pow(math.pow(t_1, 3.0), 0.3333333333333333)))) elif (angle_m / 180.0) <= 5e+129: tmp = t_2 * (2.0 * math.sin(((angle_m / 180.0) * math.pow(math.sqrt(math.pi), 2.0)))) elif (angle_m / 180.0) <= 2.4e+261: tmp = t_2 * (2.0 * math.sin(math.expm1(math.log1p(t_1)))) else: tmp = t_2 * (2.0 * (math.sqrt(math.pow(math.sin(t_1), 2.0)) * math.cos(t_0))) return angle_s * tmp
angle\_m = abs(angle) angle\_s = copysign(1.0, angle) function code(angle_s, a, b, angle_m) t_0 = Float64(Float64(angle_m / 180.0) * pi) t_1 = Float64(pi * Float64(angle_m * 0.005555555555555556)) t_2 = Float64(Float64(b + a) * Float64(b - a)) tmp = 0.0 if (Float64(angle_m / 180.0) <= 5e+22) tmp = Float64(Float64(sin(Float64(Float64(angle_m * pi) * 0.011111111111111112)) * Float64(b + a)) * Float64(b - a)); elseif (Float64(angle_m / 180.0) <= 1e+72) tmp = Float64(t_2 * Float64(2.0 * Float64(sin(t_0) * cos(((t_1 ^ 3.0) ^ 0.3333333333333333))))); elseif (Float64(angle_m / 180.0) <= 5e+129) tmp = Float64(t_2 * Float64(2.0 * sin(Float64(Float64(angle_m / 180.0) * (sqrt(pi) ^ 2.0))))); elseif (Float64(angle_m / 180.0) <= 2.4e+261) tmp = Float64(t_2 * Float64(2.0 * sin(expm1(log1p(t_1))))); else tmp = Float64(t_2 * Float64(2.0 * Float64(sqrt((sin(t_1) ^ 2.0)) * cos(t_0)))); end return Float64(angle_s * tmp) end
angle\_m = N[Abs[angle], $MachinePrecision]
angle\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[angle]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[angle$95$s_, a_, b_, angle$95$m_] := Block[{t$95$0 = N[(N[(angle$95$m / 180.0), $MachinePrecision] * Pi), $MachinePrecision]}, Block[{t$95$1 = N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(b + a), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision]}, N[(angle$95$s * If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 5e+22], N[(N[(N[Sin[N[(N[(angle$95$m * Pi), $MachinePrecision] * 0.011111111111111112), $MachinePrecision]], $MachinePrecision] * N[(b + a), $MachinePrecision]), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 1e+72], N[(t$95$2 * N[(2.0 * N[(N[Sin[t$95$0], $MachinePrecision] * N[Cos[N[Power[N[Power[t$95$1, 3.0], $MachinePrecision], 0.3333333333333333], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 5e+129], N[(t$95$2 * N[(2.0 * N[Sin[N[(N[(angle$95$m / 180.0), $MachinePrecision] * N[Power[N[Sqrt[Pi], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 2.4e+261], N[(t$95$2 * N[(2.0 * N[Sin[N[(Exp[N[Log[1 + t$95$1], $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$2 * N[(2.0 * N[(N[Sqrt[N[Power[N[Sin[t$95$1], $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision] * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]), $MachinePrecision]]]]
\begin{array}{l}
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
\begin{array}{l}
t_0 := \frac{angle\_m}{180} \cdot \pi\\
t_1 := \pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)\\
t_2 := \left(b + a\right) \cdot \left(b - a\right)\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{angle\_m}{180} \leq 5 \cdot 10^{+22}:\\
\;\;\;\;\left(\sin \left(\left(angle\_m \cdot \pi\right) \cdot 0.011111111111111112\right) \cdot \left(b + a\right)\right) \cdot \left(b - a\right)\\
\mathbf{elif}\;\frac{angle\_m}{180} \leq 10^{+72}:\\
\;\;\;\;t\_2 \cdot \left(2 \cdot \left(\sin t\_0 \cdot \cos \left({\left({t\_1}^{3}\right)}^{0.3333333333333333}\right)\right)\right)\\
\mathbf{elif}\;\frac{angle\_m}{180} \leq 5 \cdot 10^{+129}:\\
\;\;\;\;t\_2 \cdot \left(2 \cdot \sin \left(\frac{angle\_m}{180} \cdot {\left(\sqrt{\pi}\right)}^{2}\right)\right)\\
\mathbf{elif}\;\frac{angle\_m}{180} \leq 2.4 \cdot 10^{+261}:\\
\;\;\;\;t\_2 \cdot \left(2 \cdot \sin \left(\mathsf{expm1}\left(\mathsf{log1p}\left(t\_1\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2 \cdot \left(2 \cdot \left(\sqrt{{\sin t\_1}^{2}} \cdot \cos t\_0\right)\right)\\
\end{array}
\end{array}
\end{array}
if (/.f64 angle #s(literal 180 binary64)) < 4.9999999999999996e22Initial program 57.5%
associate-*l*57.5%
*-commutative57.5%
associate-*l*57.5%
Simplified57.5%
add-sqr-sqrt34.2%
sqrt-unprod30.4%
pow230.4%
2-sin30.4%
associate-*r*30.4%
div-inv30.4%
metadata-eval30.4%
Applied egg-rr30.4%
Applied egg-rr76.4%
if 4.9999999999999996e22 < (/.f64 angle #s(literal 180 binary64)) < 9.99999999999999944e71Initial program 29.3%
associate-*l*29.3%
*-commutative29.3%
associate-*l*29.3%
Simplified29.3%
unpow229.3%
unpow229.3%
difference-of-squares29.3%
Applied egg-rr29.3%
div-inv29.3%
metadata-eval29.3%
add-cbrt-cube29.9%
pow1/329.9%
pow329.9%
Applied egg-rr29.9%
if 9.99999999999999944e71 < (/.f64 angle #s(literal 180 binary64)) < 5.0000000000000003e129Initial program 23.6%
associate-*l*23.6%
*-commutative23.6%
associate-*l*23.6%
Simplified23.6%
unpow223.6%
unpow223.6%
difference-of-squares23.6%
Applied egg-rr23.6%
Taylor expanded in angle around 0 23.7%
add-sqr-sqrt61.1%
pow261.1%
Applied egg-rr61.1%
if 5.0000000000000003e129 < (/.f64 angle #s(literal 180 binary64)) < 2.3999999999999998e261Initial program 14.5%
associate-*l*14.5%
*-commutative14.5%
associate-*l*14.5%
Simplified14.5%
unpow214.5%
unpow214.5%
difference-of-squares14.5%
Applied egg-rr14.5%
Taylor expanded in angle around 0 24.4%
div-inv15.3%
metadata-eval15.3%
expm1-log1p-u17.6%
Applied egg-rr41.4%
if 2.3999999999999998e261 < (/.f64 angle #s(literal 180 binary64)) Initial program 12.8%
associate-*l*12.8%
*-commutative12.8%
associate-*l*12.8%
Simplified12.8%
unpow212.8%
unpow212.8%
difference-of-squares12.8%
Applied egg-rr12.8%
add-sqr-sqrt13.2%
sqrt-unprod35.0%
pow235.0%
div-inv34.7%
metadata-eval34.7%
Applied egg-rr37.2%
Final simplification67.3%
angle\_m = (fabs.f64 angle)
angle\_s = (copysign.f64 #s(literal 1 binary64) angle)
(FPCore (angle_s a b angle_m)
:precision binary64
(let* ((t_0 (* PI (* angle_m 0.005555555555555556)))
(t_1 (* (+ b a) (- b a))))
(*
angle_s
(if (<= (/ angle_m 180.0) 5e+22)
(* (* (sin (* (* angle_m PI) 0.011111111111111112)) (+ b a)) (- b a))
(if (<= (/ angle_m 180.0) 1e+72)
(*
t_1
(*
2.0
(*
(sin (* (/ angle_m 180.0) PI))
(cos (pow (pow t_0 3.0) 0.3333333333333333)))))
(if (<= (/ angle_m 180.0) 6e+113)
(* t_1 (* 2.0 (sin (* (/ angle_m 180.0) (pow (sqrt PI) 2.0)))))
(*
t_1
(*
2.0
(* (sqrt (pow (sin t_0) 2.0)) (cos (expm1 (log1p t_0))))))))))))angle\_m = fabs(angle);
angle\_s = copysign(1.0, angle);
double code(double angle_s, double a, double b, double angle_m) {
double t_0 = ((double) M_PI) * (angle_m * 0.005555555555555556);
double t_1 = (b + a) * (b - a);
double tmp;
if ((angle_m / 180.0) <= 5e+22) {
tmp = (sin(((angle_m * ((double) M_PI)) * 0.011111111111111112)) * (b + a)) * (b - a);
} else if ((angle_m / 180.0) <= 1e+72) {
tmp = t_1 * (2.0 * (sin(((angle_m / 180.0) * ((double) M_PI))) * cos(pow(pow(t_0, 3.0), 0.3333333333333333))));
} else if ((angle_m / 180.0) <= 6e+113) {
tmp = t_1 * (2.0 * sin(((angle_m / 180.0) * pow(sqrt(((double) M_PI)), 2.0))));
} else {
tmp = t_1 * (2.0 * (sqrt(pow(sin(t_0), 2.0)) * cos(expm1(log1p(t_0)))));
}
return angle_s * tmp;
}
angle\_m = Math.abs(angle);
angle\_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a, double b, double angle_m) {
double t_0 = Math.PI * (angle_m * 0.005555555555555556);
double t_1 = (b + a) * (b - a);
double tmp;
if ((angle_m / 180.0) <= 5e+22) {
tmp = (Math.sin(((angle_m * Math.PI) * 0.011111111111111112)) * (b + a)) * (b - a);
} else if ((angle_m / 180.0) <= 1e+72) {
tmp = t_1 * (2.0 * (Math.sin(((angle_m / 180.0) * Math.PI)) * Math.cos(Math.pow(Math.pow(t_0, 3.0), 0.3333333333333333))));
} else if ((angle_m / 180.0) <= 6e+113) {
tmp = t_1 * (2.0 * Math.sin(((angle_m / 180.0) * Math.pow(Math.sqrt(Math.PI), 2.0))));
} else {
tmp = t_1 * (2.0 * (Math.sqrt(Math.pow(Math.sin(t_0), 2.0)) * Math.cos(Math.expm1(Math.log1p(t_0)))));
}
return angle_s * tmp;
}
angle\_m = math.fabs(angle) angle\_s = math.copysign(1.0, angle) def code(angle_s, a, b, angle_m): t_0 = math.pi * (angle_m * 0.005555555555555556) t_1 = (b + a) * (b - a) tmp = 0 if (angle_m / 180.0) <= 5e+22: tmp = (math.sin(((angle_m * math.pi) * 0.011111111111111112)) * (b + a)) * (b - a) elif (angle_m / 180.0) <= 1e+72: tmp = t_1 * (2.0 * (math.sin(((angle_m / 180.0) * math.pi)) * math.cos(math.pow(math.pow(t_0, 3.0), 0.3333333333333333)))) elif (angle_m / 180.0) <= 6e+113: tmp = t_1 * (2.0 * math.sin(((angle_m / 180.0) * math.pow(math.sqrt(math.pi), 2.0)))) else: tmp = t_1 * (2.0 * (math.sqrt(math.pow(math.sin(t_0), 2.0)) * math.cos(math.expm1(math.log1p(t_0))))) return angle_s * tmp
angle\_m = abs(angle) angle\_s = copysign(1.0, angle) function code(angle_s, a, b, angle_m) t_0 = Float64(pi * Float64(angle_m * 0.005555555555555556)) t_1 = Float64(Float64(b + a) * Float64(b - a)) tmp = 0.0 if (Float64(angle_m / 180.0) <= 5e+22) tmp = Float64(Float64(sin(Float64(Float64(angle_m * pi) * 0.011111111111111112)) * Float64(b + a)) * Float64(b - a)); elseif (Float64(angle_m / 180.0) <= 1e+72) tmp = Float64(t_1 * Float64(2.0 * Float64(sin(Float64(Float64(angle_m / 180.0) * pi)) * cos(((t_0 ^ 3.0) ^ 0.3333333333333333))))); elseif (Float64(angle_m / 180.0) <= 6e+113) tmp = Float64(t_1 * Float64(2.0 * sin(Float64(Float64(angle_m / 180.0) * (sqrt(pi) ^ 2.0))))); else tmp = Float64(t_1 * Float64(2.0 * Float64(sqrt((sin(t_0) ^ 2.0)) * cos(expm1(log1p(t_0)))))); end return Float64(angle_s * tmp) end
angle\_m = N[Abs[angle], $MachinePrecision]
angle\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[angle]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[angle$95$s_, a_, b_, angle$95$m_] := Block[{t$95$0 = N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(b + a), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision]}, N[(angle$95$s * If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 5e+22], N[(N[(N[Sin[N[(N[(angle$95$m * Pi), $MachinePrecision] * 0.011111111111111112), $MachinePrecision]], $MachinePrecision] * N[(b + a), $MachinePrecision]), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 1e+72], N[(t$95$1 * N[(2.0 * N[(N[Sin[N[(N[(angle$95$m / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision] * N[Cos[N[Power[N[Power[t$95$0, 3.0], $MachinePrecision], 0.3333333333333333], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 6e+113], N[(t$95$1 * N[(2.0 * N[Sin[N[(N[(angle$95$m / 180.0), $MachinePrecision] * N[Power[N[Sqrt[Pi], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(2.0 * N[(N[Sqrt[N[Power[N[Sin[t$95$0], $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision] * N[Cos[N[(Exp[N[Log[1 + t$95$0], $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]), $MachinePrecision]]]
\begin{array}{l}
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
\begin{array}{l}
t_0 := \pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)\\
t_1 := \left(b + a\right) \cdot \left(b - a\right)\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{angle\_m}{180} \leq 5 \cdot 10^{+22}:\\
\;\;\;\;\left(\sin \left(\left(angle\_m \cdot \pi\right) \cdot 0.011111111111111112\right) \cdot \left(b + a\right)\right) \cdot \left(b - a\right)\\
\mathbf{elif}\;\frac{angle\_m}{180} \leq 10^{+72}:\\
\;\;\;\;t\_1 \cdot \left(2 \cdot \left(\sin \left(\frac{angle\_m}{180} \cdot \pi\right) \cdot \cos \left({\left({t\_0}^{3}\right)}^{0.3333333333333333}\right)\right)\right)\\
\mathbf{elif}\;\frac{angle\_m}{180} \leq 6 \cdot 10^{+113}:\\
\;\;\;\;t\_1 \cdot \left(2 \cdot \sin \left(\frac{angle\_m}{180} \cdot {\left(\sqrt{\pi}\right)}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(2 \cdot \left(\sqrt{{\sin t\_0}^{2}} \cdot \cos \left(\mathsf{expm1}\left(\mathsf{log1p}\left(t\_0\right)\right)\right)\right)\right)\\
\end{array}
\end{array}
\end{array}
if (/.f64 angle #s(literal 180 binary64)) < 4.9999999999999996e22Initial program 57.5%
associate-*l*57.5%
*-commutative57.5%
associate-*l*57.5%
Simplified57.5%
add-sqr-sqrt34.2%
sqrt-unprod30.4%
pow230.4%
2-sin30.4%
associate-*r*30.4%
div-inv30.4%
metadata-eval30.4%
Applied egg-rr30.4%
Applied egg-rr76.4%
if 4.9999999999999996e22 < (/.f64 angle #s(literal 180 binary64)) < 9.99999999999999944e71Initial program 29.3%
associate-*l*29.3%
*-commutative29.3%
associate-*l*29.3%
Simplified29.3%
unpow229.3%
unpow229.3%
difference-of-squares29.3%
Applied egg-rr29.3%
div-inv29.3%
metadata-eval29.3%
add-cbrt-cube29.9%
pow1/329.9%
pow329.9%
Applied egg-rr29.9%
if 9.99999999999999944e71 < (/.f64 angle #s(literal 180 binary64)) < 6e113Initial program 33.6%
associate-*l*33.6%
*-commutative33.6%
associate-*l*33.6%
Simplified33.6%
unpow233.6%
unpow233.6%
difference-of-squares33.6%
Applied egg-rr33.6%
Taylor expanded in angle around 0 31.3%
add-sqr-sqrt74.2%
pow274.2%
Applied egg-rr74.2%
if 6e113 < (/.f64 angle #s(literal 180 binary64)) Initial program 13.3%
associate-*l*13.3%
*-commutative13.3%
associate-*l*13.3%
Simplified13.3%
unpow213.3%
unpow213.3%
difference-of-squares13.3%
Applied egg-rr13.3%
div-inv16.0%
metadata-eval16.0%
expm1-log1p-u18.6%
Applied egg-rr18.6%
add-sqr-sqrt13.8%
sqrt-unprod38.0%
pow238.0%
div-inv38.0%
metadata-eval38.0%
Applied egg-rr38.0%
Final simplification66.9%
angle\_m = (fabs.f64 angle)
angle\_s = (copysign.f64 #s(literal 1 binary64) angle)
(FPCore (angle_s a b angle_m)
:precision binary64
(*
angle_s
(if (<= b 2.95e+193)
(*
(- b a)
(* (+ b a) (sin (expm1 (log1p (* PI (* angle_m 0.011111111111111112)))))))
(*
(- b a)
(*
(+ b a)
(sin (* 0.011111111111111112 (* angle_m (cbrt (pow PI 3.0))))))))))angle\_m = fabs(angle);
angle\_s = copysign(1.0, angle);
double code(double angle_s, double a, double b, double angle_m) {
double tmp;
if (b <= 2.95e+193) {
tmp = (b - a) * ((b + a) * sin(expm1(log1p((((double) M_PI) * (angle_m * 0.011111111111111112))))));
} else {
tmp = (b - a) * ((b + a) * sin((0.011111111111111112 * (angle_m * cbrt(pow(((double) M_PI), 3.0))))));
}
return angle_s * tmp;
}
angle\_m = Math.abs(angle);
angle\_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a, double b, double angle_m) {
double tmp;
if (b <= 2.95e+193) {
tmp = (b - a) * ((b + a) * Math.sin(Math.expm1(Math.log1p((Math.PI * (angle_m * 0.011111111111111112))))));
} else {
tmp = (b - a) * ((b + a) * Math.sin((0.011111111111111112 * (angle_m * Math.cbrt(Math.pow(Math.PI, 3.0))))));
}
return angle_s * tmp;
}
angle\_m = abs(angle) angle\_s = copysign(1.0, angle) function code(angle_s, a, b, angle_m) tmp = 0.0 if (b <= 2.95e+193) tmp = Float64(Float64(b - a) * Float64(Float64(b + a) * sin(expm1(log1p(Float64(pi * Float64(angle_m * 0.011111111111111112))))))); else tmp = Float64(Float64(b - a) * Float64(Float64(b + a) * sin(Float64(0.011111111111111112 * Float64(angle_m * cbrt((pi ^ 3.0))))))); end return Float64(angle_s * tmp) end
angle\_m = N[Abs[angle], $MachinePrecision]
angle\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[angle]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[angle$95$s_, a_, b_, angle$95$m_] := N[(angle$95$s * If[LessEqual[b, 2.95e+193], N[(N[(b - a), $MachinePrecision] * N[(N[(b + a), $MachinePrecision] * N[Sin[N[(Exp[N[Log[1 + N[(Pi * N[(angle$95$m * 0.011111111111111112), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b - a), $MachinePrecision] * N[(N[(b + a), $MachinePrecision] * N[Sin[N[(0.011111111111111112 * N[(angle$95$m * N[Power[N[Power[Pi, 3.0], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;b \leq 2.95 \cdot 10^{+193}:\\
\;\;\;\;\left(b - a\right) \cdot \left(\left(b + a\right) \cdot \sin \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\pi \cdot \left(angle\_m \cdot 0.011111111111111112\right)\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(b - a\right) \cdot \left(\left(b + a\right) \cdot \sin \left(0.011111111111111112 \cdot \left(angle\_m \cdot \sqrt[3]{{\pi}^{3}}\right)\right)\right)\\
\end{array}
\end{array}
if b < 2.9499999999999999e193Initial program 50.3%
associate-*l*50.3%
*-commutative50.3%
associate-*l*50.3%
Simplified50.3%
add-sqr-sqrt29.7%
sqrt-unprod30.0%
pow230.0%
2-sin30.0%
associate-*r*30.0%
div-inv30.0%
metadata-eval30.0%
Applied egg-rr30.0%
Applied egg-rr61.6%
expm1-log1p-u56.7%
associate-*l*56.6%
Applied egg-rr56.6%
if 2.9499999999999999e193 < b Initial program 22.7%
associate-*l*22.7%
*-commutative22.7%
associate-*l*22.7%
Simplified22.7%
add-sqr-sqrt19.3%
sqrt-unprod28.7%
pow228.7%
2-sin28.7%
associate-*r*28.7%
div-inv28.7%
metadata-eval28.7%
Applied egg-rr28.7%
Applied egg-rr68.6%
add-cbrt-cube80.9%
pow380.9%
Applied egg-rr80.9%
Final simplification59.7%
angle\_m = (fabs.f64 angle) angle\_s = (copysign.f64 #s(literal 1 binary64) angle) (FPCore (angle_s a b angle_m) :precision binary64 (* angle_s (* (- b a) (* (+ b a) (sin (expm1 (log1p (* PI (* angle_m 0.011111111111111112)))))))))
angle\_m = fabs(angle);
angle\_s = copysign(1.0, angle);
double code(double angle_s, double a, double b, double angle_m) {
return angle_s * ((b - a) * ((b + a) * sin(expm1(log1p((((double) M_PI) * (angle_m * 0.011111111111111112)))))));
}
angle\_m = Math.abs(angle);
angle\_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a, double b, double angle_m) {
return angle_s * ((b - a) * ((b + a) * Math.sin(Math.expm1(Math.log1p((Math.PI * (angle_m * 0.011111111111111112)))))));
}
angle\_m = math.fabs(angle) angle\_s = math.copysign(1.0, angle) def code(angle_s, a, b, angle_m): return angle_s * ((b - a) * ((b + a) * math.sin(math.expm1(math.log1p((math.pi * (angle_m * 0.011111111111111112)))))))
angle\_m = abs(angle) angle\_s = copysign(1.0, angle) function code(angle_s, a, b, angle_m) return Float64(angle_s * Float64(Float64(b - a) * Float64(Float64(b + a) * sin(expm1(log1p(Float64(pi * Float64(angle_m * 0.011111111111111112)))))))) end
angle\_m = N[Abs[angle], $MachinePrecision]
angle\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[angle]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[angle$95$s_, a_, b_, angle$95$m_] := N[(angle$95$s * N[(N[(b - a), $MachinePrecision] * N[(N[(b + a), $MachinePrecision] * N[Sin[N[(Exp[N[Log[1 + N[(Pi * N[(angle$95$m * 0.011111111111111112), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
angle\_s \cdot \left(\left(b - a\right) \cdot \left(\left(b + a\right) \cdot \sin \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\pi \cdot \left(angle\_m \cdot 0.011111111111111112\right)\right)\right)\right)\right)\right)
\end{array}
Initial program 46.8%
associate-*l*46.8%
*-commutative46.8%
associate-*l*46.8%
Simplified46.8%
add-sqr-sqrt28.4%
sqrt-unprod29.8%
pow229.8%
2-sin29.8%
associate-*r*29.8%
div-inv29.8%
metadata-eval29.8%
Applied egg-rr29.8%
Applied egg-rr62.5%
expm1-log1p-u56.2%
associate-*l*56.2%
Applied egg-rr56.2%
Final simplification56.2%
angle\_m = (fabs.f64 angle)
angle\_s = (copysign.f64 #s(literal 1 binary64) angle)
(FPCore (angle_s a b angle_m)
:precision binary64
(*
angle_s
(if (<= (pow b 2.0) 1e+149)
(*
(+ b a)
(* (- b a) (sin (* 2.0 (* PI (* angle_m 0.005555555555555556))))))
(* (- b a) (* (+ b a) (* (* angle_m PI) 0.011111111111111112))))))angle\_m = fabs(angle);
angle\_s = copysign(1.0, angle);
double code(double angle_s, double a, double b, double angle_m) {
double tmp;
if (pow(b, 2.0) <= 1e+149) {
tmp = (b + a) * ((b - a) * sin((2.0 * (((double) M_PI) * (angle_m * 0.005555555555555556)))));
} else {
tmp = (b - a) * ((b + a) * ((angle_m * ((double) M_PI)) * 0.011111111111111112));
}
return angle_s * tmp;
}
angle\_m = Math.abs(angle);
angle\_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a, double b, double angle_m) {
double tmp;
if (Math.pow(b, 2.0) <= 1e+149) {
tmp = (b + a) * ((b - a) * Math.sin((2.0 * (Math.PI * (angle_m * 0.005555555555555556)))));
} else {
tmp = (b - a) * ((b + a) * ((angle_m * Math.PI) * 0.011111111111111112));
}
return angle_s * tmp;
}
angle\_m = math.fabs(angle) angle\_s = math.copysign(1.0, angle) def code(angle_s, a, b, angle_m): tmp = 0 if math.pow(b, 2.0) <= 1e+149: tmp = (b + a) * ((b - a) * math.sin((2.0 * (math.pi * (angle_m * 0.005555555555555556))))) else: tmp = (b - a) * ((b + a) * ((angle_m * math.pi) * 0.011111111111111112)) return angle_s * tmp
angle\_m = abs(angle) angle\_s = copysign(1.0, angle) function code(angle_s, a, b, angle_m) tmp = 0.0 if ((b ^ 2.0) <= 1e+149) tmp = Float64(Float64(b + a) * Float64(Float64(b - a) * sin(Float64(2.0 * Float64(pi * Float64(angle_m * 0.005555555555555556)))))); else tmp = Float64(Float64(b - a) * Float64(Float64(b + a) * Float64(Float64(angle_m * pi) * 0.011111111111111112))); end return Float64(angle_s * tmp) end
angle\_m = abs(angle); angle\_s = sign(angle) * abs(1.0); function tmp_2 = code(angle_s, a, b, angle_m) tmp = 0.0; if ((b ^ 2.0) <= 1e+149) tmp = (b + a) * ((b - a) * sin((2.0 * (pi * (angle_m * 0.005555555555555556))))); else tmp = (b - a) * ((b + a) * ((angle_m * pi) * 0.011111111111111112)); end tmp_2 = angle_s * tmp; end
angle\_m = N[Abs[angle], $MachinePrecision]
angle\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[angle]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[angle$95$s_, a_, b_, angle$95$m_] := N[(angle$95$s * If[LessEqual[N[Power[b, 2.0], $MachinePrecision], 1e+149], N[(N[(b + a), $MachinePrecision] * N[(N[(b - a), $MachinePrecision] * N[Sin[N[(2.0 * N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b - a), $MachinePrecision] * N[(N[(b + a), $MachinePrecision] * N[(N[(angle$95$m * Pi), $MachinePrecision] * 0.011111111111111112), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;{b}^{2} \leq 10^{+149}:\\
\;\;\;\;\left(b + a\right) \cdot \left(\left(b - a\right) \cdot \sin \left(2 \cdot \left(\pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(b - a\right) \cdot \left(\left(b + a\right) \cdot \left(\left(angle\_m \cdot \pi\right) \cdot 0.011111111111111112\right)\right)\\
\end{array}
\end{array}
if (pow.f64 b #s(literal 2 binary64)) < 1.00000000000000005e149Initial program 54.7%
associate-*l*54.7%
*-commutative54.7%
associate-*l*54.7%
Simplified54.7%
unpow254.7%
unpow254.7%
difference-of-squares54.7%
Applied egg-rr54.7%
expm1-log1p-u54.7%
expm1-undefine54.7%
div-inv54.7%
metadata-eval54.7%
Applied egg-rr54.7%
expm1-define54.7%
Simplified54.7%
pow154.7%
Applied egg-rr59.9%
unpow159.9%
+-commutative59.9%
Simplified59.9%
if 1.00000000000000005e149 < (pow.f64 b #s(literal 2 binary64)) Initial program 35.2%
associate-*l*35.2%
*-commutative35.2%
associate-*l*35.2%
Simplified35.2%
add-sqr-sqrt22.4%
sqrt-unprod25.6%
pow225.6%
2-sin25.6%
associate-*r*25.6%
div-inv25.6%
metadata-eval25.6%
Applied egg-rr25.6%
Applied egg-rr69.3%
Taylor expanded in angle around 0 72.5%
Final simplification65.0%
angle\_m = (fabs.f64 angle)
angle\_s = (copysign.f64 #s(literal 1 binary64) angle)
(FPCore (angle_s a b angle_m)
:precision binary64
(*
angle_s
(if (<= (/ angle_m 180.0) 1e+103)
(* (* (sin (* (* angle_m PI) 0.011111111111111112)) (+ b a)) (- b a))
(* (* (+ b a) (- b a)) (* 2.0 (* PI (* angle_m 0.005555555555555556)))))))angle\_m = fabs(angle);
angle\_s = copysign(1.0, angle);
double code(double angle_s, double a, double b, double angle_m) {
double tmp;
if ((angle_m / 180.0) <= 1e+103) {
tmp = (sin(((angle_m * ((double) M_PI)) * 0.011111111111111112)) * (b + a)) * (b - a);
} else {
tmp = ((b + a) * (b - a)) * (2.0 * (((double) M_PI) * (angle_m * 0.005555555555555556)));
}
return angle_s * tmp;
}
angle\_m = Math.abs(angle);
angle\_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a, double b, double angle_m) {
double tmp;
if ((angle_m / 180.0) <= 1e+103) {
tmp = (Math.sin(((angle_m * Math.PI) * 0.011111111111111112)) * (b + a)) * (b - a);
} else {
tmp = ((b + a) * (b - a)) * (2.0 * (Math.PI * (angle_m * 0.005555555555555556)));
}
return angle_s * tmp;
}
angle\_m = math.fabs(angle) angle\_s = math.copysign(1.0, angle) def code(angle_s, a, b, angle_m): tmp = 0 if (angle_m / 180.0) <= 1e+103: tmp = (math.sin(((angle_m * math.pi) * 0.011111111111111112)) * (b + a)) * (b - a) else: tmp = ((b + a) * (b - a)) * (2.0 * (math.pi * (angle_m * 0.005555555555555556))) return angle_s * tmp
angle\_m = abs(angle) angle\_s = copysign(1.0, angle) function code(angle_s, a, b, angle_m) tmp = 0.0 if (Float64(angle_m / 180.0) <= 1e+103) tmp = Float64(Float64(sin(Float64(Float64(angle_m * pi) * 0.011111111111111112)) * Float64(b + a)) * Float64(b - a)); else tmp = Float64(Float64(Float64(b + a) * Float64(b - a)) * Float64(2.0 * Float64(pi * Float64(angle_m * 0.005555555555555556)))); end return Float64(angle_s * tmp) end
angle\_m = abs(angle); angle\_s = sign(angle) * abs(1.0); function tmp_2 = code(angle_s, a, b, angle_m) tmp = 0.0; if ((angle_m / 180.0) <= 1e+103) tmp = (sin(((angle_m * pi) * 0.011111111111111112)) * (b + a)) * (b - a); else tmp = ((b + a) * (b - a)) * (2.0 * (pi * (angle_m * 0.005555555555555556))); end tmp_2 = angle_s * tmp; end
angle\_m = N[Abs[angle], $MachinePrecision]
angle\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[angle]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[angle$95$s_, a_, b_, angle$95$m_] := N[(angle$95$s * If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 1e+103], N[(N[(N[Sin[N[(N[(angle$95$m * Pi), $MachinePrecision] * 0.011111111111111112), $MachinePrecision]], $MachinePrecision] * N[(b + a), $MachinePrecision]), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision], N[(N[(N[(b + a), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{angle\_m}{180} \leq 10^{+103}:\\
\;\;\;\;\left(\sin \left(\left(angle\_m \cdot \pi\right) \cdot 0.011111111111111112\right) \cdot \left(b + a\right)\right) \cdot \left(b - a\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(2 \cdot \left(\pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)\right)\right)\\
\end{array}
\end{array}
if (/.f64 angle #s(literal 180 binary64)) < 1e103Initial program 55.6%
associate-*l*55.6%
*-commutative55.6%
associate-*l*55.6%
Simplified55.6%
add-sqr-sqrt33.9%
sqrt-unprod30.4%
pow230.4%
2-sin30.4%
associate-*r*30.4%
div-inv30.4%
metadata-eval30.4%
Applied egg-rr30.4%
Applied egg-rr74.0%
if 1e103 < (/.f64 angle #s(literal 180 binary64)) Initial program 13.3%
associate-*l*13.3%
*-commutative13.3%
associate-*l*13.3%
Simplified13.3%
unpow213.3%
unpow213.3%
difference-of-squares13.3%
Applied egg-rr13.3%
Taylor expanded in angle around 0 25.9%
Taylor expanded in angle around 0 28.4%
pow128.4%
associate-*r*28.4%
*-rgt-identity28.4%
*-commutative28.4%
*-commutative28.4%
associate-*r*28.4%
Applied egg-rr28.4%
unpow128.4%
associate-*l*28.4%
+-commutative28.4%
Simplified28.4%
Final simplification64.6%
angle\_m = (fabs.f64 angle) angle\_s = (copysign.f64 #s(literal 1 binary64) angle) (FPCore (angle_s a b angle_m) :precision binary64 (* angle_s (* (- b a) (* (+ b a) (* (* angle_m PI) 0.011111111111111112)))))
angle\_m = fabs(angle);
angle\_s = copysign(1.0, angle);
double code(double angle_s, double a, double b, double angle_m) {
return angle_s * ((b - a) * ((b + a) * ((angle_m * ((double) M_PI)) * 0.011111111111111112)));
}
angle\_m = Math.abs(angle);
angle\_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a, double b, double angle_m) {
return angle_s * ((b - a) * ((b + a) * ((angle_m * Math.PI) * 0.011111111111111112)));
}
angle\_m = math.fabs(angle) angle\_s = math.copysign(1.0, angle) def code(angle_s, a, b, angle_m): return angle_s * ((b - a) * ((b + a) * ((angle_m * math.pi) * 0.011111111111111112)))
angle\_m = abs(angle) angle\_s = copysign(1.0, angle) function code(angle_s, a, b, angle_m) return Float64(angle_s * Float64(Float64(b - a) * Float64(Float64(b + a) * Float64(Float64(angle_m * pi) * 0.011111111111111112)))) end
angle\_m = abs(angle); angle\_s = sign(angle) * abs(1.0); function tmp = code(angle_s, a, b, angle_m) tmp = angle_s * ((b - a) * ((b + a) * ((angle_m * pi) * 0.011111111111111112))); end
angle\_m = N[Abs[angle], $MachinePrecision]
angle\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[angle]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[angle$95$s_, a_, b_, angle$95$m_] := N[(angle$95$s * N[(N[(b - a), $MachinePrecision] * N[(N[(b + a), $MachinePrecision] * N[(N[(angle$95$m * Pi), $MachinePrecision] * 0.011111111111111112), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
angle\_s \cdot \left(\left(b - a\right) \cdot \left(\left(b + a\right) \cdot \left(\left(angle\_m \cdot \pi\right) \cdot 0.011111111111111112\right)\right)\right)
\end{array}
Initial program 46.8%
associate-*l*46.8%
*-commutative46.8%
associate-*l*46.8%
Simplified46.8%
add-sqr-sqrt28.4%
sqrt-unprod29.8%
pow229.8%
2-sin29.8%
associate-*r*29.8%
div-inv29.8%
metadata-eval29.8%
Applied egg-rr29.8%
Applied egg-rr62.5%
Taylor expanded in angle around 0 59.7%
Final simplification59.7%
angle\_m = (fabs.f64 angle) angle\_s = (copysign.f64 #s(literal 1 binary64) angle) (FPCore (angle_s a b angle_m) :precision binary64 (* angle_s (* 0.011111111111111112 (* angle_m (* PI (* (+ b a) (- b a)))))))
angle\_m = fabs(angle);
angle\_s = copysign(1.0, angle);
double code(double angle_s, double a, double b, double angle_m) {
return angle_s * (0.011111111111111112 * (angle_m * (((double) M_PI) * ((b + a) * (b - a)))));
}
angle\_m = Math.abs(angle);
angle\_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a, double b, double angle_m) {
return angle_s * (0.011111111111111112 * (angle_m * (Math.PI * ((b + a) * (b - a)))));
}
angle\_m = math.fabs(angle) angle\_s = math.copysign(1.0, angle) def code(angle_s, a, b, angle_m): return angle_s * (0.011111111111111112 * (angle_m * (math.pi * ((b + a) * (b - a)))))
angle\_m = abs(angle) angle\_s = copysign(1.0, angle) function code(angle_s, a, b, angle_m) return Float64(angle_s * Float64(0.011111111111111112 * Float64(angle_m * Float64(pi * Float64(Float64(b + a) * Float64(b - a)))))) end
angle\_m = abs(angle); angle\_s = sign(angle) * abs(1.0); function tmp = code(angle_s, a, b, angle_m) tmp = angle_s * (0.011111111111111112 * (angle_m * (pi * ((b + a) * (b - a))))); end
angle\_m = N[Abs[angle], $MachinePrecision]
angle\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[angle]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[angle$95$s_, a_, b_, angle$95$m_] := N[(angle$95$s * N[(0.011111111111111112 * N[(angle$95$m * N[(Pi * N[(N[(b + a), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
angle\_s \cdot \left(0.011111111111111112 \cdot \left(angle\_m \cdot \left(\pi \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right)\right)\right)\right)
\end{array}
Initial program 46.8%
associate-*l*46.8%
*-commutative46.8%
associate-*l*46.8%
Simplified46.8%
unpow246.8%
unpow246.8%
difference-of-squares49.7%
Applied egg-rr49.7%
Taylor expanded in angle around 0 51.7%
Taylor expanded in angle around 0 50.2%
Taylor expanded in angle around 0 50.2%
Final simplification50.2%
herbie shell --seed 2024086
(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)))))