
(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}
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* PI (/ angle 180.0)))) (* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) (sin t_0)) (cos t_0))))
double code(double a, double b, double angle) {
double t_0 = ((double) M_PI) * (angle / 180.0);
return ((2.0 * (pow(b, 2.0) - pow(a, 2.0))) * sin(t_0)) * cos(t_0);
}
public static double code(double a, double b, double angle) {
double t_0 = Math.PI * (angle / 180.0);
return ((2.0 * (Math.pow(b, 2.0) - Math.pow(a, 2.0))) * Math.sin(t_0)) * Math.cos(t_0);
}
def code(a, b, angle): t_0 = math.pi * (angle / 180.0) return ((2.0 * (math.pow(b, 2.0) - math.pow(a, 2.0))) * math.sin(t_0)) * math.cos(t_0)
function code(a, b, angle) t_0 = Float64(pi * Float64(angle / 180.0)) return Float64(Float64(Float64(2.0 * Float64((b ^ 2.0) - (a ^ 2.0))) * sin(t_0)) * cos(t_0)) end
function tmp = code(a, b, angle) t_0 = pi * (angle / 180.0); tmp = ((2.0 * ((b ^ 2.0) - (a ^ 2.0))) * sin(t_0)) * cos(t_0); end
code[a_, b_, angle_] := Block[{t$95$0 = N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(2.0 * N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \pi \cdot \frac{angle}{180}\\
\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin t\_0\right) \cdot \cos t\_0
\end{array}
\end{array}
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
(*
(* (sin (* (* angle_m PI) 0.005555555555555556)) (+ a b))
(- b a))))
(*
angle_s
(if (<= (* 2.0 (- (pow b 2.0) (pow a 2.0))) 1e-181)
(*
(* t_0 (sin (+ (- (* (* 0.005555555555555556 angle_m) PI)) (/ PI 2.0))))
2.0)
(*
(* t_0 (sin (fma (* 0.005555555555555556 angle_m) PI (/ PI 2.0))))
2.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 = (sin(((angle_m * ((double) M_PI)) * 0.005555555555555556)) * (a + b)) * (b - a);
double tmp;
if ((2.0 * (pow(b, 2.0) - pow(a, 2.0))) <= 1e-181) {
tmp = (t_0 * sin((-((0.005555555555555556 * angle_m) * ((double) M_PI)) + (((double) M_PI) / 2.0)))) * 2.0;
} else {
tmp = (t_0 * sin(fma((0.005555555555555556 * angle_m), ((double) M_PI), (((double) M_PI) / 2.0)))) * 2.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(sin(Float64(Float64(angle_m * pi) * 0.005555555555555556)) * Float64(a + b)) * Float64(b - a)) tmp = 0.0 if (Float64(2.0 * Float64((b ^ 2.0) - (a ^ 2.0))) <= 1e-181) tmp = Float64(Float64(t_0 * sin(Float64(Float64(-Float64(Float64(0.005555555555555556 * angle_m) * pi)) + Float64(pi / 2.0)))) * 2.0); else tmp = Float64(Float64(t_0 * sin(fma(Float64(0.005555555555555556 * angle_m), pi, Float64(pi / 2.0)))) * 2.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[(N[Sin[N[(N[(angle$95$m * Pi), $MachinePrecision] * 0.005555555555555556), $MachinePrecision]], $MachinePrecision] * N[(a + b), $MachinePrecision]), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision]}, N[(angle$95$s * If[LessEqual[N[(2.0 * N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1e-181], N[(N[(t$95$0 * N[Sin[N[((-N[(N[(0.005555555555555556 * angle$95$m), $MachinePrecision] * Pi), $MachinePrecision]) + N[(Pi / 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision], N[(N[(t$95$0 * N[Sin[N[(N[(0.005555555555555556 * angle$95$m), $MachinePrecision] * Pi + N[(Pi / 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
\begin{array}{l}
t_0 := \left(\sin \left(\left(angle\_m \cdot \pi\right) \cdot 0.005555555555555556\right) \cdot \left(a + b\right)\right) \cdot \left(b - a\right)\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;2 \cdot \left({b}^{2} - {a}^{2}\right) \leq 10^{-181}:\\
\;\;\;\;\left(t\_0 \cdot \sin \left(\left(-\left(0.005555555555555556 \cdot angle\_m\right) \cdot \pi\right) + \frac{\pi}{2}\right)\right) \cdot 2\\
\mathbf{else}:\\
\;\;\;\;\left(t\_0 \cdot \sin \left(\mathsf{fma}\left(0.005555555555555556 \cdot angle\_m, \pi, \frac{\pi}{2}\right)\right)\right) \cdot 2\\
\end{array}
\end{array}
\end{array}
if (*.f64 #s(literal 2 binary64) (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64)))) < 1.00000000000000005e-181Initial program 60.2%
Taylor expanded in angle around inf
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-PI.f64N/A
lower-*.f64N/A
Applied rewrites60.2%
Applied rewrites68.9%
lift-cos.f64N/A
cos-neg-revN/A
sin-+PI/2-revN/A
lower-sin.f64N/A
lower-+.f64N/A
lower-neg.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-PI.f64N/A
lower-/.f64N/A
lift-PI.f6468.7
Applied rewrites68.7%
if 1.00000000000000005e-181 < (*.f64 #s(literal 2 binary64) (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64)))) Initial program 47.5%
Taylor expanded in angle around inf
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-PI.f64N/A
lower-*.f64N/A
Applied rewrites55.3%
Applied rewrites66.0%
lift-cos.f64N/A
cos-neg-revN/A
sin-+PI/2-revN/A
lower-sin.f64N/A
lower-+.f64N/A
lower-neg.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-PI.f64N/A
lower-/.f64N/A
lift-PI.f6465.7
Applied rewrites65.7%
lift-sin.f64N/A
lift-+.f64N/A
lift-PI.f64N/A
lift-/.f64N/A
sin-+PI/2N/A
lift-neg.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
*-commutativeN/A
Applied rewrites65.9%
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 PI) 0.005555555555555556)))
(*
angle_s
(if (<= angle_m 4.5e-16)
(*
(*
(* (* (sin (* angle_m (* 0.005555555555555556 PI))) (+ a b)) (- b a))
(cos t_0))
2.0)
(* (sin (* 2.0 t_0)) (* (- b a) (+ a b)))))))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 * ((double) M_PI)) * 0.005555555555555556;
double tmp;
if (angle_m <= 4.5e-16) {
tmp = (((sin((angle_m * (0.005555555555555556 * ((double) M_PI)))) * (a + b)) * (b - a)) * cos(t_0)) * 2.0;
} else {
tmp = sin((2.0 * t_0)) * ((b - a) * (a + b));
}
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 * Math.PI) * 0.005555555555555556;
double tmp;
if (angle_m <= 4.5e-16) {
tmp = (((Math.sin((angle_m * (0.005555555555555556 * Math.PI))) * (a + b)) * (b - a)) * Math.cos(t_0)) * 2.0;
} else {
tmp = Math.sin((2.0 * t_0)) * ((b - a) * (a + b));
}
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 * math.pi) * 0.005555555555555556 tmp = 0 if angle_m <= 4.5e-16: tmp = (((math.sin((angle_m * (0.005555555555555556 * math.pi))) * (a + b)) * (b - a)) * math.cos(t_0)) * 2.0 else: tmp = math.sin((2.0 * t_0)) * ((b - a) * (a + b)) 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 * pi) * 0.005555555555555556) tmp = 0.0 if (angle_m <= 4.5e-16) tmp = Float64(Float64(Float64(Float64(sin(Float64(angle_m * Float64(0.005555555555555556 * pi))) * Float64(a + b)) * Float64(b - a)) * cos(t_0)) * 2.0); else tmp = Float64(sin(Float64(2.0 * t_0)) * Float64(Float64(b - a) * Float64(a + b))); 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) t_0 = (angle_m * pi) * 0.005555555555555556; tmp = 0.0; if (angle_m <= 4.5e-16) tmp = (((sin((angle_m * (0.005555555555555556 * pi))) * (a + b)) * (b - a)) * cos(t_0)) * 2.0; else tmp = sin((2.0 * t_0)) * ((b - a) * (a + b)); 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_] := Block[{t$95$0 = N[(N[(angle$95$m * Pi), $MachinePrecision] * 0.005555555555555556), $MachinePrecision]}, N[(angle$95$s * If[LessEqual[angle$95$m, 4.5e-16], N[(N[(N[(N[(N[Sin[N[(angle$95$m * N[(0.005555555555555556 * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(a + b), $MachinePrecision]), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision], N[(N[Sin[N[(2.0 * t$95$0), $MachinePrecision]], $MachinePrecision] * N[(N[(b - a), $MachinePrecision] * N[(a + b), $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 := \left(angle\_m \cdot \pi\right) \cdot 0.005555555555555556\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;angle\_m \leq 4.5 \cdot 10^{-16}:\\
\;\;\;\;\left(\left(\left(\sin \left(angle\_m \cdot \left(0.005555555555555556 \cdot \pi\right)\right) \cdot \left(a + b\right)\right) \cdot \left(b - a\right)\right) \cdot \cos t\_0\right) \cdot 2\\
\mathbf{else}:\\
\;\;\;\;\sin \left(2 \cdot t\_0\right) \cdot \left(\left(b - a\right) \cdot \left(a + b\right)\right)\\
\end{array}
\end{array}
\end{array}
if angle < 4.5000000000000002e-16Initial program 75.1%
Taylor expanded in angle around inf
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-PI.f64N/A
lower-*.f64N/A
Applied rewrites79.5%
Applied rewrites99.6%
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lift-PI.f6499.6
Applied rewrites99.6%
if 4.5000000000000002e-16 < angle Initial program 35.1%
Taylor expanded in angle around inf
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-PI.f64N/A
lower-*.f64N/A
Applied rewrites38.1%
Applied rewrites38.1%
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 PI) 0.005555555555555556))) (* angle_s (* (* (* (* (sin t_0) (+ a b)) (- b a)) (cos t_0)) 2.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 * ((double) M_PI)) * 0.005555555555555556;
return angle_s * ((((sin(t_0) * (a + b)) * (b - a)) * cos(t_0)) * 2.0);
}
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 * Math.PI) * 0.005555555555555556;
return angle_s * ((((Math.sin(t_0) * (a + b)) * (b - a)) * Math.cos(t_0)) * 2.0);
}
angle\_m = math.fabs(angle) angle\_s = math.copysign(1.0, angle) def code(angle_s, a, b, angle_m): t_0 = (angle_m * math.pi) * 0.005555555555555556 return angle_s * ((((math.sin(t_0) * (a + b)) * (b - a)) * math.cos(t_0)) * 2.0)
angle\_m = abs(angle) angle\_s = copysign(1.0, angle) function code(angle_s, a, b, angle_m) t_0 = Float64(Float64(angle_m * pi) * 0.005555555555555556) return Float64(angle_s * Float64(Float64(Float64(Float64(sin(t_0) * Float64(a + b)) * Float64(b - a)) * cos(t_0)) * 2.0)) end
angle\_m = abs(angle); angle\_s = sign(angle) * abs(1.0); function tmp = code(angle_s, a, b, angle_m) t_0 = (angle_m * pi) * 0.005555555555555556; tmp = angle_s * ((((sin(t_0) * (a + b)) * (b - a)) * cos(t_0)) * 2.0); 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 * Pi), $MachinePrecision] * 0.005555555555555556), $MachinePrecision]}, N[(angle$95$s * N[(N[(N[(N[(N[Sin[t$95$0], $MachinePrecision] * N[(a + b), $MachinePrecision]), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
\begin{array}{l}
t_0 := \left(angle\_m \cdot \pi\right) \cdot 0.005555555555555556\\
angle\_s \cdot \left(\left(\left(\left(\sin t\_0 \cdot \left(a + b\right)\right) \cdot \left(b - a\right)\right) \cdot \cos t\_0\right) \cdot 2\right)
\end{array}
\end{array}
Initial program 54.2%
Taylor expanded in angle around inf
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-PI.f64N/A
lower-*.f64N/A
Applied rewrites57.9%
Applied rewrites67.5%
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 (<= (* 2.0 (- (pow b 2.0) (pow a 2.0))) -5e-259)
(* (* -0.011111111111111112 a) (* (* angle_m PI) a))
(* (* (* PI angle_m) (* b (- b a))) 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 ((2.0 * (pow(b, 2.0) - pow(a, 2.0))) <= -5e-259) {
tmp = (-0.011111111111111112 * a) * ((angle_m * ((double) M_PI)) * a);
} else {
tmp = ((((double) M_PI) * angle_m) * (b * (b - a))) * 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 ((2.0 * (Math.pow(b, 2.0) - Math.pow(a, 2.0))) <= -5e-259) {
tmp = (-0.011111111111111112 * a) * ((angle_m * Math.PI) * a);
} else {
tmp = ((Math.PI * angle_m) * (b * (b - a))) * 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 (2.0 * (math.pow(b, 2.0) - math.pow(a, 2.0))) <= -5e-259: tmp = (-0.011111111111111112 * a) * ((angle_m * math.pi) * a) else: tmp = ((math.pi * angle_m) * (b * (b - a))) * 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 (Float64(2.0 * Float64((b ^ 2.0) - (a ^ 2.0))) <= -5e-259) tmp = Float64(Float64(-0.011111111111111112 * a) * Float64(Float64(angle_m * pi) * a)); else tmp = Float64(Float64(Float64(pi * angle_m) * Float64(b * Float64(b - a))) * 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 ((2.0 * ((b ^ 2.0) - (a ^ 2.0))) <= -5e-259) tmp = (-0.011111111111111112 * a) * ((angle_m * pi) * a); else tmp = ((pi * angle_m) * (b * (b - a))) * 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[(2.0 * N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -5e-259], N[(N[(-0.011111111111111112 * a), $MachinePrecision] * N[(N[(angle$95$m * Pi), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], N[(N[(N[(Pi * angle$95$m), $MachinePrecision] * N[(b * N[(b - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.011111111111111112), $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}\;2 \cdot \left({b}^{2} - {a}^{2}\right) \leq -5 \cdot 10^{-259}:\\
\;\;\;\;\left(-0.011111111111111112 \cdot a\right) \cdot \left(\left(angle\_m \cdot \pi\right) \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\pi \cdot angle\_m\right) \cdot \left(b \cdot \left(b - a\right)\right)\right) \cdot 0.011111111111111112\\
\end{array}
\end{array}
if (*.f64 #s(literal 2 binary64) (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64)))) < -4.99999999999999977e-259Initial program 55.3%
Taylor expanded in angle around 0
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-PI.f64N/A
unpow2N/A
unpow2N/A
difference-of-squaresN/A
lower-*.f64N/A
lower-+.f64N/A
lower--.f6451.7
Applied rewrites51.7%
Taylor expanded in a around inf
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lower-*.f64N/A
lift-PI.f6451.4
Applied rewrites51.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6451.6
Applied rewrites51.6%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
lift-PI.f6462.1
Applied rewrites62.1%
if -4.99999999999999977e-259 < (*.f64 #s(literal 2 binary64) (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64)))) Initial program 53.4%
Taylor expanded in angle around 0
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-PI.f64N/A
unpow2N/A
unpow2N/A
difference-of-squaresN/A
lower-*.f64N/A
lower-+.f64N/A
lower--.f6456.4
Applied rewrites56.4%
Taylor expanded in a around 0
Applied rewrites55.1%
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 (<= (* 2.0 (- (pow b 2.0) (pow a 2.0))) -5e-259)
(* (* -0.011111111111111112 a) (* (* angle_m PI) a))
(* (* (* PI angle_m) (* b b)) 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 ((2.0 * (pow(b, 2.0) - pow(a, 2.0))) <= -5e-259) {
tmp = (-0.011111111111111112 * a) * ((angle_m * ((double) M_PI)) * a);
} else {
tmp = ((((double) M_PI) * angle_m) * (b * b)) * 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 ((2.0 * (Math.pow(b, 2.0) - Math.pow(a, 2.0))) <= -5e-259) {
tmp = (-0.011111111111111112 * a) * ((angle_m * Math.PI) * a);
} else {
tmp = ((Math.PI * angle_m) * (b * b)) * 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 (2.0 * (math.pow(b, 2.0) - math.pow(a, 2.0))) <= -5e-259: tmp = (-0.011111111111111112 * a) * ((angle_m * math.pi) * a) else: tmp = ((math.pi * angle_m) * (b * b)) * 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 (Float64(2.0 * Float64((b ^ 2.0) - (a ^ 2.0))) <= -5e-259) tmp = Float64(Float64(-0.011111111111111112 * a) * Float64(Float64(angle_m * pi) * a)); else tmp = Float64(Float64(Float64(pi * angle_m) * Float64(b * b)) * 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 ((2.0 * ((b ^ 2.0) - (a ^ 2.0))) <= -5e-259) tmp = (-0.011111111111111112 * a) * ((angle_m * pi) * a); else tmp = ((pi * angle_m) * (b * b)) * 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[(2.0 * N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -5e-259], N[(N[(-0.011111111111111112 * a), $MachinePrecision] * N[(N[(angle$95$m * Pi), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], N[(N[(N[(Pi * angle$95$m), $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision] * 0.011111111111111112), $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}\;2 \cdot \left({b}^{2} - {a}^{2}\right) \leq -5 \cdot 10^{-259}:\\
\;\;\;\;\left(-0.011111111111111112 \cdot a\right) \cdot \left(\left(angle\_m \cdot \pi\right) \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\pi \cdot angle\_m\right) \cdot \left(b \cdot b\right)\right) \cdot 0.011111111111111112\\
\end{array}
\end{array}
if (*.f64 #s(literal 2 binary64) (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64)))) < -4.99999999999999977e-259Initial program 55.3%
Taylor expanded in angle around 0
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-PI.f64N/A
unpow2N/A
unpow2N/A
difference-of-squaresN/A
lower-*.f64N/A
lower-+.f64N/A
lower--.f6451.7
Applied rewrites51.7%
Taylor expanded in a around inf
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lower-*.f64N/A
lift-PI.f6451.4
Applied rewrites51.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6451.6
Applied rewrites51.6%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
lift-PI.f6462.1
Applied rewrites62.1%
if -4.99999999999999977e-259 < (*.f64 #s(literal 2 binary64) (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64)))) Initial program 53.4%
Taylor expanded in angle around 0
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-PI.f64N/A
unpow2N/A
unpow2N/A
difference-of-squaresN/A
lower-*.f64N/A
lower-+.f64N/A
lower--.f6456.4
Applied rewrites56.4%
Taylor expanded in a around 0
unpow2N/A
lower-*.f6454.8
Applied rewrites54.8%
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 (<= (* 2.0 (- (pow b 2.0) (pow a 2.0))) -5e-259)
(* (* -0.011111111111111112 a) (* (* angle_m PI) a))
(* (* (* PI (* b b)) 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) {
double tmp;
if ((2.0 * (pow(b, 2.0) - pow(a, 2.0))) <= -5e-259) {
tmp = (-0.011111111111111112 * a) * ((angle_m * ((double) M_PI)) * a);
} else {
tmp = ((((double) M_PI) * (b * b)) * angle_m) * 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 ((2.0 * (Math.pow(b, 2.0) - Math.pow(a, 2.0))) <= -5e-259) {
tmp = (-0.011111111111111112 * a) * ((angle_m * Math.PI) * a);
} else {
tmp = ((Math.PI * (b * b)) * angle_m) * 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 (2.0 * (math.pow(b, 2.0) - math.pow(a, 2.0))) <= -5e-259: tmp = (-0.011111111111111112 * a) * ((angle_m * math.pi) * a) else: tmp = ((math.pi * (b * b)) * angle_m) * 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 (Float64(2.0 * Float64((b ^ 2.0) - (a ^ 2.0))) <= -5e-259) tmp = Float64(Float64(-0.011111111111111112 * a) * Float64(Float64(angle_m * pi) * a)); else tmp = Float64(Float64(Float64(pi * Float64(b * b)) * angle_m) * 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 ((2.0 * ((b ^ 2.0) - (a ^ 2.0))) <= -5e-259) tmp = (-0.011111111111111112 * a) * ((angle_m * pi) * a); else tmp = ((pi * (b * b)) * angle_m) * 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[(2.0 * N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -5e-259], N[(N[(-0.011111111111111112 * a), $MachinePrecision] * N[(N[(angle$95$m * Pi), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], N[(N[(N[(Pi * N[(b * b), $MachinePrecision]), $MachinePrecision] * angle$95$m), $MachinePrecision] * 0.011111111111111112), $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}\;2 \cdot \left({b}^{2} - {a}^{2}\right) \leq -5 \cdot 10^{-259}:\\
\;\;\;\;\left(-0.011111111111111112 \cdot a\right) \cdot \left(\left(angle\_m \cdot \pi\right) \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\pi \cdot \left(b \cdot b\right)\right) \cdot angle\_m\right) \cdot 0.011111111111111112\\
\end{array}
\end{array}
if (*.f64 #s(literal 2 binary64) (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64)))) < -4.99999999999999977e-259Initial program 55.3%
Taylor expanded in angle around 0
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-PI.f64N/A
unpow2N/A
unpow2N/A
difference-of-squaresN/A
lower-*.f64N/A
lower-+.f64N/A
lower--.f6451.7
Applied rewrites51.7%
Taylor expanded in a around inf
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lower-*.f64N/A
lift-PI.f6451.4
Applied rewrites51.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6451.6
Applied rewrites51.6%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
lift-PI.f6462.1
Applied rewrites62.1%
if -4.99999999999999977e-259 < (*.f64 #s(literal 2 binary64) (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64)))) Initial program 53.4%
Taylor expanded in angle around 0
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-PI.f64N/A
unpow2N/A
unpow2N/A
difference-of-squaresN/A
lower-*.f64N/A
lower-+.f64N/A
lower--.f6456.4
Applied rewrites56.4%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-PI.f64N/A
unpow2N/A
lower-*.f6454.7
Applied rewrites54.7%
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 PI) 0.005555555555555556)))
(*
angle_s
(if (<= angle_m 4.5e-16)
(* (* (* (* (sin t_0) (+ a b)) (- b a)) 1.0) 2.0)
(* (sin (* 2.0 t_0)) (* (- b a) (+ a b)))))))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 * ((double) M_PI)) * 0.005555555555555556;
double tmp;
if (angle_m <= 4.5e-16) {
tmp = (((sin(t_0) * (a + b)) * (b - a)) * 1.0) * 2.0;
} else {
tmp = sin((2.0 * t_0)) * ((b - a) * (a + b));
}
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 * Math.PI) * 0.005555555555555556;
double tmp;
if (angle_m <= 4.5e-16) {
tmp = (((Math.sin(t_0) * (a + b)) * (b - a)) * 1.0) * 2.0;
} else {
tmp = Math.sin((2.0 * t_0)) * ((b - a) * (a + b));
}
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 * math.pi) * 0.005555555555555556 tmp = 0 if angle_m <= 4.5e-16: tmp = (((math.sin(t_0) * (a + b)) * (b - a)) * 1.0) * 2.0 else: tmp = math.sin((2.0 * t_0)) * ((b - a) * (a + b)) 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 * pi) * 0.005555555555555556) tmp = 0.0 if (angle_m <= 4.5e-16) tmp = Float64(Float64(Float64(Float64(sin(t_0) * Float64(a + b)) * Float64(b - a)) * 1.0) * 2.0); else tmp = Float64(sin(Float64(2.0 * t_0)) * Float64(Float64(b - a) * Float64(a + b))); 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) t_0 = (angle_m * pi) * 0.005555555555555556; tmp = 0.0; if (angle_m <= 4.5e-16) tmp = (((sin(t_0) * (a + b)) * (b - a)) * 1.0) * 2.0; else tmp = sin((2.0 * t_0)) * ((b - a) * (a + b)); 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_] := Block[{t$95$0 = N[(N[(angle$95$m * Pi), $MachinePrecision] * 0.005555555555555556), $MachinePrecision]}, N[(angle$95$s * If[LessEqual[angle$95$m, 4.5e-16], N[(N[(N[(N[(N[Sin[t$95$0], $MachinePrecision] * N[(a + b), $MachinePrecision]), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision] * 2.0), $MachinePrecision], N[(N[Sin[N[(2.0 * t$95$0), $MachinePrecision]], $MachinePrecision] * N[(N[(b - a), $MachinePrecision] * N[(a + b), $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 := \left(angle\_m \cdot \pi\right) \cdot 0.005555555555555556\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;angle\_m \leq 4.5 \cdot 10^{-16}:\\
\;\;\;\;\left(\left(\left(\sin t\_0 \cdot \left(a + b\right)\right) \cdot \left(b - a\right)\right) \cdot 1\right) \cdot 2\\
\mathbf{else}:\\
\;\;\;\;\sin \left(2 \cdot t\_0\right) \cdot \left(\left(b - a\right) \cdot \left(a + b\right)\right)\\
\end{array}
\end{array}
\end{array}
if angle < 4.5000000000000002e-16Initial program 75.1%
Taylor expanded in angle around inf
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-PI.f64N/A
lower-*.f64N/A
Applied rewrites79.5%
Applied rewrites99.6%
Taylor expanded in angle around 0
Applied rewrites99.6%
if 4.5000000000000002e-16 < angle Initial program 35.1%
Taylor expanded in angle around inf
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-PI.f64N/A
lower-*.f64N/A
Applied rewrites38.1%
Applied rewrites38.1%
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 4.5e-16)
(* (* (* (* (+ a b) PI) angle_m) (- b a)) 0.011111111111111112)
(*
(sin (* 2.0 (* (* angle_m PI) 0.005555555555555556)))
(* (- b a) (+ a b))))))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 <= 4.5e-16) {
tmp = ((((a + b) * ((double) M_PI)) * angle_m) * (b - a)) * 0.011111111111111112;
} else {
tmp = sin((2.0 * ((angle_m * ((double) M_PI)) * 0.005555555555555556))) * ((b - a) * (a + b));
}
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 <= 4.5e-16) {
tmp = ((((a + b) * Math.PI) * angle_m) * (b - a)) * 0.011111111111111112;
} else {
tmp = Math.sin((2.0 * ((angle_m * Math.PI) * 0.005555555555555556))) * ((b - a) * (a + b));
}
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 <= 4.5e-16: tmp = ((((a + b) * math.pi) * angle_m) * (b - a)) * 0.011111111111111112 else: tmp = math.sin((2.0 * ((angle_m * math.pi) * 0.005555555555555556))) * ((b - a) * (a + b)) 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 (angle_m <= 4.5e-16) tmp = Float64(Float64(Float64(Float64(Float64(a + b) * pi) * angle_m) * Float64(b - a)) * 0.011111111111111112); else tmp = Float64(sin(Float64(2.0 * Float64(Float64(angle_m * pi) * 0.005555555555555556))) * Float64(Float64(b - a) * Float64(a + b))); 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 <= 4.5e-16) tmp = ((((a + b) * pi) * angle_m) * (b - a)) * 0.011111111111111112; else tmp = sin((2.0 * ((angle_m * pi) * 0.005555555555555556))) * ((b - a) * (a + b)); 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[angle$95$m, 4.5e-16], N[(N[(N[(N[(N[(a + b), $MachinePrecision] * Pi), $MachinePrecision] * angle$95$m), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision] * 0.011111111111111112), $MachinePrecision], N[(N[Sin[N[(2.0 * N[(N[(angle$95$m * Pi), $MachinePrecision] * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(b - a), $MachinePrecision] * N[(a + b), $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}\;angle\_m \leq 4.5 \cdot 10^{-16}:\\
\;\;\;\;\left(\left(\left(\left(a + b\right) \cdot \pi\right) \cdot angle\_m\right) \cdot \left(b - a\right)\right) \cdot 0.011111111111111112\\
\mathbf{else}:\\
\;\;\;\;\sin \left(2 \cdot \left(\left(angle\_m \cdot \pi\right) \cdot 0.005555555555555556\right)\right) \cdot \left(\left(b - a\right) \cdot \left(a + b\right)\right)\\
\end{array}
\end{array}
if angle < 4.5000000000000002e-16Initial program 75.1%
Taylor expanded in angle around 0
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-PI.f64N/A
unpow2N/A
unpow2N/A
difference-of-squaresN/A
lower-*.f64N/A
lower-+.f64N/A
lower--.f6479.5
Applied rewrites79.5%
Taylor expanded in b around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.5%
Taylor expanded in angle around 0
associate-*r*N/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
+-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
lift-PI.f64N/A
lift--.f6499.4
Applied rewrites99.4%
if 4.5000000000000002e-16 < angle Initial program 35.1%
Taylor expanded in angle around inf
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-PI.f64N/A
lower-*.f64N/A
Applied rewrites38.1%
Applied rewrites38.1%
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 100000000.0)
(* (* (* (* (+ a b) PI) angle_m) (- b a)) 0.011111111111111112)
(*
2.0
(* (sin (* (* PI angle_m) 0.005555555555555556)) (* (+ 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) {
double tmp;
if (angle_m <= 100000000.0) {
tmp = ((((a + b) * ((double) M_PI)) * angle_m) * (b - a)) * 0.011111111111111112;
} else {
tmp = 2.0 * (sin(((((double) M_PI) * angle_m) * 0.005555555555555556)) * ((b + a) * (b - a)));
}
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 <= 100000000.0) {
tmp = ((((a + b) * Math.PI) * angle_m) * (b - a)) * 0.011111111111111112;
} else {
tmp = 2.0 * (Math.sin(((Math.PI * angle_m) * 0.005555555555555556)) * ((b + a) * (b - a)));
}
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 <= 100000000.0: tmp = ((((a + b) * math.pi) * angle_m) * (b - a)) * 0.011111111111111112 else: tmp = 2.0 * (math.sin(((math.pi * angle_m) * 0.005555555555555556)) * ((b + a) * (b - a))) 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 (angle_m <= 100000000.0) tmp = Float64(Float64(Float64(Float64(Float64(a + b) * pi) * angle_m) * Float64(b - a)) * 0.011111111111111112); else tmp = Float64(2.0 * Float64(sin(Float64(Float64(pi * angle_m) * 0.005555555555555556)) * Float64(Float64(b + a) * Float64(b - a)))); 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 <= 100000000.0) tmp = ((((a + b) * pi) * angle_m) * (b - a)) * 0.011111111111111112; else tmp = 2.0 * (sin(((pi * angle_m) * 0.005555555555555556)) * ((b + a) * (b - a))); 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[angle$95$m, 100000000.0], N[(N[(N[(N[(N[(a + b), $MachinePrecision] * Pi), $MachinePrecision] * angle$95$m), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision] * 0.011111111111111112), $MachinePrecision], N[(2.0 * N[(N[Sin[N[(N[(Pi * angle$95$m), $MachinePrecision] * 0.005555555555555556), $MachinePrecision]], $MachinePrecision] * N[(N[(b + a), $MachinePrecision] * N[(b - a), $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}\;angle\_m \leq 100000000:\\
\;\;\;\;\left(\left(\left(\left(a + b\right) \cdot \pi\right) \cdot angle\_m\right) \cdot \left(b - a\right)\right) \cdot 0.011111111111111112\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\sin \left(\left(\pi \cdot angle\_m\right) \cdot 0.005555555555555556\right) \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right)\right)\\
\end{array}
\end{array}
if angle < 1e8Initial program 76.4%
Taylor expanded in angle around 0
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-PI.f64N/A
unpow2N/A
unpow2N/A
difference-of-squaresN/A
lower-*.f64N/A
lower-+.f64N/A
lower--.f6479.0
Applied rewrites79.0%
Taylor expanded in b around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites84.5%
Taylor expanded in angle around 0
associate-*r*N/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
+-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
lift-PI.f64N/A
lift--.f6497.4
Applied rewrites97.4%
if 1e8 < angle Initial program 30.4%
Taylor expanded in angle around inf
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-PI.f64N/A
lower-*.f64N/A
Applied rewrites33.2%
Taylor expanded in angle around 0
Applied rewrites32.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 90.0)
(* (* (* (* (+ a b) PI) angle_m) (- b a)) 0.011111111111111112)
(* (* (* PI angle_m) (* (+ b a) b)) 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 (angle_m <= 90.0) {
tmp = ((((a + b) * ((double) M_PI)) * angle_m) * (b - a)) * 0.011111111111111112;
} else {
tmp = ((((double) M_PI) * angle_m) * ((b + a) * b)) * 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 (angle_m <= 90.0) {
tmp = ((((a + b) * Math.PI) * angle_m) * (b - a)) * 0.011111111111111112;
} else {
tmp = ((Math.PI * angle_m) * ((b + a) * b)) * 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 angle_m <= 90.0: tmp = ((((a + b) * math.pi) * angle_m) * (b - a)) * 0.011111111111111112 else: tmp = ((math.pi * angle_m) * ((b + a) * b)) * 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 (angle_m <= 90.0) tmp = Float64(Float64(Float64(Float64(Float64(a + b) * pi) * angle_m) * Float64(b - a)) * 0.011111111111111112); else tmp = Float64(Float64(Float64(pi * angle_m) * Float64(Float64(b + a) * b)) * 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 (angle_m <= 90.0) tmp = ((((a + b) * pi) * angle_m) * (b - a)) * 0.011111111111111112; else tmp = ((pi * angle_m) * ((b + a) * b)) * 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[angle$95$m, 90.0], N[(N[(N[(N[(N[(a + b), $MachinePrecision] * Pi), $MachinePrecision] * angle$95$m), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision] * 0.011111111111111112), $MachinePrecision], N[(N[(N[(Pi * angle$95$m), $MachinePrecision] * N[(N[(b + a), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision] * 0.011111111111111112), $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}\;angle\_m \leq 90:\\
\;\;\;\;\left(\left(\left(\left(a + b\right) \cdot \pi\right) \cdot angle\_m\right) \cdot \left(b - a\right)\right) \cdot 0.011111111111111112\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\pi \cdot angle\_m\right) \cdot \left(\left(b + a\right) \cdot b\right)\right) \cdot 0.011111111111111112\\
\end{array}
\end{array}
if angle < 90Initial program 76.1%
Taylor expanded in angle around 0
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-PI.f64N/A
unpow2N/A
unpow2N/A
difference-of-squaresN/A
lower-*.f64N/A
lower-+.f64N/A
lower--.f6480.1
Applied rewrites80.1%
Taylor expanded in b around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.7%
Taylor expanded in angle around 0
associate-*r*N/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
+-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
lift-PI.f64N/A
lift--.f6498.9
Applied rewrites98.9%
if 90 < angle Initial program 31.7%
Taylor expanded in angle around 0
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-PI.f64N/A
unpow2N/A
unpow2N/A
difference-of-squaresN/A
lower-*.f64N/A
lower-+.f64N/A
lower--.f6428.0
Applied rewrites28.0%
Taylor expanded in a around 0
Applied rewrites24.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 (* (* -0.011111111111111112 a) (* (* angle_m PI) 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 * a) * ((angle_m * ((double) M_PI)) * 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 * a) * ((angle_m * Math.PI) * 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 * a) * ((angle_m * math.pi) * a))
angle\_m = abs(angle) angle\_s = copysign(1.0, angle) function code(angle_s, a, b, angle_m) return Float64(angle_s * Float64(Float64(-0.011111111111111112 * a) * Float64(Float64(angle_m * pi) * 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 * a) * ((angle_m * pi) * 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[(N[(-0.011111111111111112 * a), $MachinePrecision] * N[(N[(angle$95$m * Pi), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
angle\_s \cdot \left(\left(-0.011111111111111112 \cdot a\right) \cdot \left(\left(angle\_m \cdot \pi\right) \cdot a\right)\right)
\end{array}
Initial program 54.2%
Taylor expanded in angle around 0
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-PI.f64N/A
unpow2N/A
unpow2N/A
difference-of-squaresN/A
lower-*.f64N/A
lower-+.f64N/A
lower--.f6454.4
Applied rewrites54.4%
Taylor expanded in a around inf
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lower-*.f64N/A
lift-PI.f6434.7
Applied rewrites34.7%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6434.8
Applied rewrites34.8%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
lift-PI.f6438.4
Applied rewrites38.4%
herbie shell --seed 2025093
(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)))))