
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* PI (/ angle 180.0)))) (* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) (sin t_0)) (cos t_0))))
double code(double a, double b, double angle) {
double t_0 = ((double) M_PI) * (angle / 180.0);
return ((2.0 * (pow(b, 2.0) - pow(a, 2.0))) * sin(t_0)) * cos(t_0);
}
public static double code(double a, double b, double angle) {
double t_0 = Math.PI * (angle / 180.0);
return ((2.0 * (Math.pow(b, 2.0) - Math.pow(a, 2.0))) * Math.sin(t_0)) * Math.cos(t_0);
}
def code(a, b, angle): t_0 = math.pi * (angle / 180.0) return ((2.0 * (math.pow(b, 2.0) - math.pow(a, 2.0))) * math.sin(t_0)) * math.cos(t_0)
function code(a, b, angle) t_0 = Float64(pi * Float64(angle / 180.0)) return Float64(Float64(Float64(2.0 * Float64((b ^ 2.0) - (a ^ 2.0))) * sin(t_0)) * cos(t_0)) end
function tmp = code(a, b, angle) t_0 = pi * (angle / 180.0); tmp = ((2.0 * ((b ^ 2.0) - (a ^ 2.0))) * sin(t_0)) * cos(t_0); end
code[a_, b_, angle_] := Block[{t$95$0 = N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(2.0 * N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \pi \cdot \frac{angle}{180}\\
\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin t\_0\right) \cdot \cos t\_0
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* PI (/ angle 180.0)))) (* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) (sin t_0)) (cos t_0))))
double code(double a, double b, double angle) {
double t_0 = ((double) M_PI) * (angle / 180.0);
return ((2.0 * (pow(b, 2.0) - pow(a, 2.0))) * sin(t_0)) * cos(t_0);
}
public static double code(double a, double b, double angle) {
double t_0 = Math.PI * (angle / 180.0);
return ((2.0 * (Math.pow(b, 2.0) - Math.pow(a, 2.0))) * Math.sin(t_0)) * Math.cos(t_0);
}
def code(a, b, angle): t_0 = math.pi * (angle / 180.0) return ((2.0 * (math.pow(b, 2.0) - math.pow(a, 2.0))) * math.sin(t_0)) * math.cos(t_0)
function code(a, b, angle) t_0 = Float64(pi * Float64(angle / 180.0)) return Float64(Float64(Float64(2.0 * Float64((b ^ 2.0) - (a ^ 2.0))) * sin(t_0)) * cos(t_0)) end
function tmp = code(a, b, angle) t_0 = pi * (angle / 180.0); tmp = ((2.0 * ((b ^ 2.0) - (a ^ 2.0))) * sin(t_0)) * cos(t_0); end
code[a_, b_, angle_] := Block[{t$95$0 = N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(2.0 * N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \pi \cdot \frac{angle}{180}\\
\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin t\_0\right) \cdot \cos t\_0
\end{array}
\end{array}
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 (sin (fma 0.5 PI t_0)))
(t_2 (sin t_0))
(t_3 (* (* t_2 (+ a b)) (- b a))))
(*
angle_s
(if (<= angle_m 1.32e+259)
(fma
t_3
(cos (* 0.005555555555555556 (* angle_m PI)))
(* t_3 (cos (* (* angle_m PI) 0.005555555555555556))))
(fma
(* 2.0 (fma (* t_2 b) t_1 (* (* (* 0.0 a) t_1) t_2)))
b
(* (* -2.0 (* a a)) (* t_1 t_2)))))))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 = sin(fma(0.5, ((double) M_PI), t_0));
double t_2 = sin(t_0);
double t_3 = (t_2 * (a + b)) * (b - a);
double tmp;
if (angle_m <= 1.32e+259) {
tmp = fma(t_3, cos((0.005555555555555556 * (angle_m * ((double) M_PI)))), (t_3 * cos(((angle_m * ((double) M_PI)) * 0.005555555555555556))));
} else {
tmp = fma((2.0 * fma((t_2 * b), t_1, (((0.0 * a) * t_1) * t_2))), b, ((-2.0 * (a * a)) * (t_1 * t_2)));
}
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(pi * angle_m) * 0.005555555555555556) t_1 = sin(fma(0.5, pi, t_0)) t_2 = sin(t_0) t_3 = Float64(Float64(t_2 * Float64(a + b)) * Float64(b - a)) tmp = 0.0 if (angle_m <= 1.32e+259) tmp = fma(t_3, cos(Float64(0.005555555555555556 * Float64(angle_m * pi))), Float64(t_3 * cos(Float64(Float64(angle_m * pi) * 0.005555555555555556)))); else tmp = fma(Float64(2.0 * fma(Float64(t_2 * b), t_1, Float64(Float64(Float64(0.0 * a) * t_1) * t_2))), b, Float64(Float64(-2.0 * Float64(a * a)) * Float64(t_1 * t_2))); 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[(Pi * angle$95$m), $MachinePrecision] * 0.005555555555555556), $MachinePrecision]}, Block[{t$95$1 = N[Sin[N[(0.5 * Pi + t$95$0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sin[t$95$0], $MachinePrecision]}, Block[{t$95$3 = N[(N[(t$95$2 * N[(a + b), $MachinePrecision]), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision]}, N[(angle$95$s * If[LessEqual[angle$95$m, 1.32e+259], N[(t$95$3 * N[Cos[N[(0.005555555555555556 * N[(angle$95$m * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(t$95$3 * N[Cos[N[(N[(angle$95$m * Pi), $MachinePrecision] * 0.005555555555555556), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 * N[(N[(t$95$2 * b), $MachinePrecision] * t$95$1 + N[(N[(N[(0.0 * a), $MachinePrecision] * t$95$1), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * b + N[(N[(-2.0 * N[(a * a), $MachinePrecision]), $MachinePrecision] * N[(t$95$1 * t$95$2), $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(\pi \cdot angle\_m\right) \cdot 0.005555555555555556\\
t_1 := \sin \left(\mathsf{fma}\left(0.5, \pi, t\_0\right)\right)\\
t_2 := \sin t\_0\\
t_3 := \left(t\_2 \cdot \left(a + b\right)\right) \cdot \left(b - a\right)\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;angle\_m \leq 1.32 \cdot 10^{+259}:\\
\;\;\;\;\mathsf{fma}\left(t\_3, \cos \left(0.005555555555555556 \cdot \left(angle\_m \cdot \pi\right)\right), t\_3 \cdot \cos \left(\left(angle\_m \cdot \pi\right) \cdot 0.005555555555555556\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(2 \cdot \mathsf{fma}\left(t\_2 \cdot b, t\_1, \left(\left(0 \cdot a\right) \cdot t\_1\right) \cdot t\_2\right), b, \left(-2 \cdot \left(a \cdot a\right)\right) \cdot \left(t\_1 \cdot t\_2\right)\right)\\
\end{array}
\end{array}
\end{array}
if angle < 1.31999999999999998e259Initial program 55.6%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites50.3%
Taylor expanded in angle around inf
count-2-revN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites70.6%
lift-sin.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-fma.f64N/A
lift-PI.f64N/A
lift-/.f64N/A
sin-+PI/2N/A
associate-*r*N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lift-PI.f6466.8
Applied rewrites66.8%
lift-sin.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-fma.f64N/A
lift-PI.f64N/A
lift-/.f64N/A
sin-+PI/2N/A
associate-*r*N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
lift-PI.f6471.9
Applied rewrites71.9%
if 1.31999999999999998e259 < angle Initial program 20.4%
Applied rewrites44.5%
Taylor expanded in b around 0
Applied rewrites52.8%
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 (sin (fma 0.5 PI t_0)))
(t_2 (sin t_0))
(t_3 (* (* (* 0.0 a) t_1) t_2))
(t_4 (* (* -2.0 (* a a)) (* t_1 t_2)))
(t_5 (* t_2 b)))
(*
angle_s
(if (<= angle_m 2.6e-25)
(* (* (* 0.011111111111111112 angle_m) (* PI (+ a b))) (- b a))
(if (<= angle_m 5.6e+153)
(fma (* 2.0 (fma t_5 (sin (* 0.5 PI)) t_3)) b t_4)
(if (<= angle_m 2.5e+258)
(*
(fma
(/ (* (* (* a a) (cos t_0)) t_2) b)
(/ -2.0 b)
(sin (* 2.0 t_0)))
(* b b))
(fma (* 2.0 (fma t_5 t_1 t_3)) b t_4)))))))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 = sin(fma(0.5, ((double) M_PI), t_0));
double t_2 = sin(t_0);
double t_3 = ((0.0 * a) * t_1) * t_2;
double t_4 = (-2.0 * (a * a)) * (t_1 * t_2);
double t_5 = t_2 * b;
double tmp;
if (angle_m <= 2.6e-25) {
tmp = ((0.011111111111111112 * angle_m) * (((double) M_PI) * (a + b))) * (b - a);
} else if (angle_m <= 5.6e+153) {
tmp = fma((2.0 * fma(t_5, sin((0.5 * ((double) M_PI))), t_3)), b, t_4);
} else if (angle_m <= 2.5e+258) {
tmp = fma(((((a * a) * cos(t_0)) * t_2) / b), (-2.0 / b), sin((2.0 * t_0))) * (b * b);
} else {
tmp = fma((2.0 * fma(t_5, t_1, t_3)), b, t_4);
}
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(pi * angle_m) * 0.005555555555555556) t_1 = sin(fma(0.5, pi, t_0)) t_2 = sin(t_0) t_3 = Float64(Float64(Float64(0.0 * a) * t_1) * t_2) t_4 = Float64(Float64(-2.0 * Float64(a * a)) * Float64(t_1 * t_2)) t_5 = Float64(t_2 * b) tmp = 0.0 if (angle_m <= 2.6e-25) tmp = Float64(Float64(Float64(0.011111111111111112 * angle_m) * Float64(pi * Float64(a + b))) * Float64(b - a)); elseif (angle_m <= 5.6e+153) tmp = fma(Float64(2.0 * fma(t_5, sin(Float64(0.5 * pi)), t_3)), b, t_4); elseif (angle_m <= 2.5e+258) tmp = Float64(fma(Float64(Float64(Float64(Float64(a * a) * cos(t_0)) * t_2) / b), Float64(-2.0 / b), sin(Float64(2.0 * t_0))) * Float64(b * b)); else tmp = fma(Float64(2.0 * fma(t_5, t_1, t_3)), b, t_4); 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[(Pi * angle$95$m), $MachinePrecision] * 0.005555555555555556), $MachinePrecision]}, Block[{t$95$1 = N[Sin[N[(0.5 * Pi + t$95$0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sin[t$95$0], $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(0.0 * a), $MachinePrecision] * t$95$1), $MachinePrecision] * t$95$2), $MachinePrecision]}, Block[{t$95$4 = N[(N[(-2.0 * N[(a * a), $MachinePrecision]), $MachinePrecision] * N[(t$95$1 * t$95$2), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(t$95$2 * b), $MachinePrecision]}, N[(angle$95$s * If[LessEqual[angle$95$m, 2.6e-25], N[(N[(N[(0.011111111111111112 * angle$95$m), $MachinePrecision] * N[(Pi * N[(a + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision], If[LessEqual[angle$95$m, 5.6e+153], N[(N[(2.0 * N[(t$95$5 * N[Sin[N[(0.5 * Pi), $MachinePrecision]], $MachinePrecision] + t$95$3), $MachinePrecision]), $MachinePrecision] * b + t$95$4), $MachinePrecision], If[LessEqual[angle$95$m, 2.5e+258], N[(N[(N[(N[(N[(N[(a * a), $MachinePrecision] * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision] / b), $MachinePrecision] * N[(-2.0 / b), $MachinePrecision] + N[Sin[N[(2.0 * t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 * N[(t$95$5 * t$95$1 + t$95$3), $MachinePrecision]), $MachinePrecision] * b + t$95$4), $MachinePrecision]]]]), $MachinePrecision]]]]]]]
\begin{array}{l}
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
\begin{array}{l}
t_0 := \left(\pi \cdot angle\_m\right) \cdot 0.005555555555555556\\
t_1 := \sin \left(\mathsf{fma}\left(0.5, \pi, t\_0\right)\right)\\
t_2 := \sin t\_0\\
t_3 := \left(\left(0 \cdot a\right) \cdot t\_1\right) \cdot t\_2\\
t_4 := \left(-2 \cdot \left(a \cdot a\right)\right) \cdot \left(t\_1 \cdot t\_2\right)\\
t_5 := t\_2 \cdot b\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;angle\_m \leq 2.6 \cdot 10^{-25}:\\
\;\;\;\;\left(\left(0.011111111111111112 \cdot angle\_m\right) \cdot \left(\pi \cdot \left(a + b\right)\right)\right) \cdot \left(b - a\right)\\
\mathbf{elif}\;angle\_m \leq 5.6 \cdot 10^{+153}:\\
\;\;\;\;\mathsf{fma}\left(2 \cdot \mathsf{fma}\left(t\_5, \sin \left(0.5 \cdot \pi\right), t\_3\right), b, t\_4\right)\\
\mathbf{elif}\;angle\_m \leq 2.5 \cdot 10^{+258}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\left(\left(a \cdot a\right) \cdot \cos t\_0\right) \cdot t\_2}{b}, \frac{-2}{b}, \sin \left(2 \cdot t\_0\right)\right) \cdot \left(b \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(2 \cdot \mathsf{fma}\left(t\_5, t\_1, t\_3\right), b, t\_4\right)\\
\end{array}
\end{array}
\end{array}
if angle < 2.6e-25Initial program 59.6%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites54.3%
Taylor expanded in angle around 0
associate-*r*N/A
pow2N/A
pow2N/A
difference-of-squares-revN/A
+-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
+-commutativeN/A
lower-*.f64N/A
lift-PI.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift--.f6460.1
Applied rewrites60.1%
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-+.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-+.f64N/A
lift--.f6472.9
Applied rewrites72.9%
if 2.6e-25 < angle < 5.5999999999999997e153Initial program 45.7%
Applied rewrites40.7%
Taylor expanded in b around 0
Applied rewrites40.5%
Taylor expanded in angle around 0
lower-*.f64N/A
lift-PI.f6443.2
Applied rewrites43.2%
if 5.5999999999999997e153 < angle < 2.5e258Initial program 39.9%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites27.3%
lift-sin.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-fma.f64N/A
associate-*r*N/A
lift-PI.f64N/A
lift-/.f64N/A
sin-+PI/2-revN/A
lower-cos.f64N/A
*-commutativeN/A
*-commutativeN/A
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f6443.7
Applied rewrites43.7%
if 2.5e258 < angle Initial program 20.4%
Applied rewrites44.5%
Taylor expanded in b around 0
Applied rewrites52.8%
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 (* -2.0 (* a a)))
(t_1 (sin (* 0.5 PI)))
(t_2 (* (* PI angle_m) 0.005555555555555556))
(t_3 (sin (fma 0.5 PI t_2)))
(t_4 (sin t_2))
(t_5 (* t_4 b))
(t_6 (* (* (* 0.0 a) t_3) t_4)))
(*
angle_s
(if (<= angle_m 6.6e+32)
(fma
(* (* (sin (* (* 0.005555555555555556 angle_m) PI)) (+ a b)) (- b a))
(cos (* 0.005555555555555556 (* angle_m PI)))
(*
(* (* t_4 (+ a b)) (- b a))
(sin (fma (* 0.005555555555555556 angle_m) PI (/ PI 2.0)))))
(if (<= angle_m 6e+153)
(fma (* 2.0 (fma t_5 t_1 t_6)) b (* t_0 (* t_3 t_4)))
(fma
(* 2.0 (fma t_5 t_3 t_6))
b
(*
t_0
(*
(fma t_1 (cos t_2) (* (sin (fma 0.5 PI (/ PI 2.0))) t_4))
t_4))))))))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 = -2.0 * (a * a);
double t_1 = sin((0.5 * ((double) M_PI)));
double t_2 = (((double) M_PI) * angle_m) * 0.005555555555555556;
double t_3 = sin(fma(0.5, ((double) M_PI), t_2));
double t_4 = sin(t_2);
double t_5 = t_4 * b;
double t_6 = ((0.0 * a) * t_3) * t_4;
double tmp;
if (angle_m <= 6.6e+32) {
tmp = fma(((sin(((0.005555555555555556 * angle_m) * ((double) M_PI))) * (a + b)) * (b - a)), cos((0.005555555555555556 * (angle_m * ((double) M_PI)))), (((t_4 * (a + b)) * (b - a)) * sin(fma((0.005555555555555556 * angle_m), ((double) M_PI), (((double) M_PI) / 2.0)))));
} else if (angle_m <= 6e+153) {
tmp = fma((2.0 * fma(t_5, t_1, t_6)), b, (t_0 * (t_3 * t_4)));
} else {
tmp = fma((2.0 * fma(t_5, t_3, t_6)), b, (t_0 * (fma(t_1, cos(t_2), (sin(fma(0.5, ((double) M_PI), (((double) M_PI) / 2.0))) * t_4)) * t_4)));
}
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(-2.0 * Float64(a * a)) t_1 = sin(Float64(0.5 * pi)) t_2 = Float64(Float64(pi * angle_m) * 0.005555555555555556) t_3 = sin(fma(0.5, pi, t_2)) t_4 = sin(t_2) t_5 = Float64(t_4 * b) t_6 = Float64(Float64(Float64(0.0 * a) * t_3) * t_4) tmp = 0.0 if (angle_m <= 6.6e+32) tmp = fma(Float64(Float64(sin(Float64(Float64(0.005555555555555556 * angle_m) * pi)) * Float64(a + b)) * Float64(b - a)), cos(Float64(0.005555555555555556 * Float64(angle_m * pi))), Float64(Float64(Float64(t_4 * Float64(a + b)) * Float64(b - a)) * sin(fma(Float64(0.005555555555555556 * angle_m), pi, Float64(pi / 2.0))))); elseif (angle_m <= 6e+153) tmp = fma(Float64(2.0 * fma(t_5, t_1, t_6)), b, Float64(t_0 * Float64(t_3 * t_4))); else tmp = fma(Float64(2.0 * fma(t_5, t_3, t_6)), b, Float64(t_0 * Float64(fma(t_1, cos(t_2), Float64(sin(fma(0.5, pi, Float64(pi / 2.0))) * t_4)) * t_4))); 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[(-2.0 * N[(a * a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sin[N[(0.5 * Pi), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(Pi * angle$95$m), $MachinePrecision] * 0.005555555555555556), $MachinePrecision]}, Block[{t$95$3 = N[Sin[N[(0.5 * Pi + t$95$2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[Sin[t$95$2], $MachinePrecision]}, Block[{t$95$5 = N[(t$95$4 * b), $MachinePrecision]}, Block[{t$95$6 = N[(N[(N[(0.0 * a), $MachinePrecision] * t$95$3), $MachinePrecision] * t$95$4), $MachinePrecision]}, N[(angle$95$s * If[LessEqual[angle$95$m, 6.6e+32], N[(N[(N[(N[Sin[N[(N[(0.005555555555555556 * angle$95$m), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision] * N[(a + b), $MachinePrecision]), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(0.005555555555555556 * N[(angle$95$m * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(N[(N[(t$95$4 * N[(a + b), $MachinePrecision]), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision] * N[Sin[N[(N[(0.005555555555555556 * angle$95$m), $MachinePrecision] * Pi + N[(Pi / 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[angle$95$m, 6e+153], N[(N[(2.0 * N[(t$95$5 * t$95$1 + t$95$6), $MachinePrecision]), $MachinePrecision] * b + N[(t$95$0 * N[(t$95$3 * t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 * N[(t$95$5 * t$95$3 + t$95$6), $MachinePrecision]), $MachinePrecision] * b + N[(t$95$0 * N[(N[(t$95$1 * N[Cos[t$95$2], $MachinePrecision] + N[(N[Sin[N[(0.5 * Pi + N[(Pi / 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$4), $MachinePrecision]), $MachinePrecision] * t$95$4), $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 := -2 \cdot \left(a \cdot a\right)\\
t_1 := \sin \left(0.5 \cdot \pi\right)\\
t_2 := \left(\pi \cdot angle\_m\right) \cdot 0.005555555555555556\\
t_3 := \sin \left(\mathsf{fma}\left(0.5, \pi, t\_2\right)\right)\\
t_4 := \sin t\_2\\
t_5 := t\_4 \cdot b\\
t_6 := \left(\left(0 \cdot a\right) \cdot t\_3\right) \cdot t\_4\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;angle\_m \leq 6.6 \cdot 10^{+32}:\\
\;\;\;\;\mathsf{fma}\left(\left(\sin \left(\left(0.005555555555555556 \cdot angle\_m\right) \cdot \pi\right) \cdot \left(a + b\right)\right) \cdot \left(b - a\right), \cos \left(0.005555555555555556 \cdot \left(angle\_m \cdot \pi\right)\right), \left(\left(t\_4 \cdot \left(a + b\right)\right) \cdot \left(b - a\right)\right) \cdot \sin \left(\mathsf{fma}\left(0.005555555555555556 \cdot angle\_m, \pi, \frac{\pi}{2}\right)\right)\right)\\
\mathbf{elif}\;angle\_m \leq 6 \cdot 10^{+153}:\\
\;\;\;\;\mathsf{fma}\left(2 \cdot \mathsf{fma}\left(t\_5, t\_1, t\_6\right), b, t\_0 \cdot \left(t\_3 \cdot t\_4\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(2 \cdot \mathsf{fma}\left(t\_5, t\_3, t\_6\right), b, t\_0 \cdot \left(\mathsf{fma}\left(t\_1, \cos t\_2, \sin \left(\mathsf{fma}\left(0.5, \pi, \frac{\pi}{2}\right)\right) \cdot t\_4\right) \cdot t\_4\right)\right)\\
\end{array}
\end{array}
\end{array}
if angle < 6.60000000000000039e32Initial program 60.4%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites55.4%
Taylor expanded in angle around inf
count-2-revN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites80.2%
lift-sin.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-fma.f64N/A
lift-PI.f64N/A
lift-/.f64N/A
sin-+PI/2N/A
associate-*r*N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lift-PI.f6476.9
Applied rewrites76.9%
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
lift-PI.f6478.4
Applied rewrites78.4%
if 6.60000000000000039e32 < angle < 6.00000000000000037e153Initial program 35.9%
Applied rewrites28.7%
Taylor expanded in b around 0
Applied rewrites25.7%
Taylor expanded in angle around 0
lower-*.f64N/A
lift-PI.f6432.3
Applied rewrites32.3%
if 6.00000000000000037e153 < angle Initial program 32.1%
Applied rewrites38.4%
Taylor expanded in b around 0
Applied rewrites45.1%
lift-sin.f64N/A
lift-PI.f64N/A
lift-fma.f64N/A
sin-sumN/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-PI.f64N/A
lower-cos.f64N/A
lift-sin.f64N/A
lower-*.f64N/A
Applied rewrites39.0%
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 (* 0.5 PI)))
(t_1 (* -2.0 (* a a)))
(t_2 (* (* PI angle_m) 0.005555555555555556))
(t_3 (sin (fma 0.5 PI t_2)))
(t_4 (sin t_2))
(t_5 (* (* (* 0.0 a) t_3) t_4))
(t_6 (* t_4 b)))
(*
angle_s
(if (<= angle_m 2.6e-25)
(* (* (* 0.011111111111111112 angle_m) (* PI (+ a b))) (- b a))
(if (<= angle_m 6e+153)
(fma (* 2.0 (fma t_6 t_0 t_5)) b (* t_1 (* t_3 t_4)))
(fma
(* 2.0 (fma t_6 t_3 t_5))
b
(*
t_1
(*
(fma t_0 (cos t_2) (* (sin (fma 0.5 PI (/ PI 2.0))) t_4))
t_4))))))))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((0.5 * ((double) M_PI)));
double t_1 = -2.0 * (a * a);
double t_2 = (((double) M_PI) * angle_m) * 0.005555555555555556;
double t_3 = sin(fma(0.5, ((double) M_PI), t_2));
double t_4 = sin(t_2);
double t_5 = ((0.0 * a) * t_3) * t_4;
double t_6 = t_4 * b;
double tmp;
if (angle_m <= 2.6e-25) {
tmp = ((0.011111111111111112 * angle_m) * (((double) M_PI) * (a + b))) * (b - a);
} else if (angle_m <= 6e+153) {
tmp = fma((2.0 * fma(t_6, t_0, t_5)), b, (t_1 * (t_3 * t_4)));
} else {
tmp = fma((2.0 * fma(t_6, t_3, t_5)), b, (t_1 * (fma(t_0, cos(t_2), (sin(fma(0.5, ((double) M_PI), (((double) M_PI) / 2.0))) * t_4)) * t_4)));
}
return angle_s * tmp;
}
angle\_m = abs(angle) angle\_s = copysign(1.0, angle) function code(angle_s, a, b, angle_m) t_0 = sin(Float64(0.5 * pi)) t_1 = Float64(-2.0 * Float64(a * a)) t_2 = Float64(Float64(pi * angle_m) * 0.005555555555555556) t_3 = sin(fma(0.5, pi, t_2)) t_4 = sin(t_2) t_5 = Float64(Float64(Float64(0.0 * a) * t_3) * t_4) t_6 = Float64(t_4 * b) tmp = 0.0 if (angle_m <= 2.6e-25) tmp = Float64(Float64(Float64(0.011111111111111112 * angle_m) * Float64(pi * Float64(a + b))) * Float64(b - a)); elseif (angle_m <= 6e+153) tmp = fma(Float64(2.0 * fma(t_6, t_0, t_5)), b, Float64(t_1 * Float64(t_3 * t_4))); else tmp = fma(Float64(2.0 * fma(t_6, t_3, t_5)), b, Float64(t_1 * Float64(fma(t_0, cos(t_2), Float64(sin(fma(0.5, pi, Float64(pi / 2.0))) * t_4)) * t_4))); 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[Sin[N[(0.5 * Pi), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(-2.0 * N[(a * a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(Pi * angle$95$m), $MachinePrecision] * 0.005555555555555556), $MachinePrecision]}, Block[{t$95$3 = N[Sin[N[(0.5 * Pi + t$95$2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[Sin[t$95$2], $MachinePrecision]}, Block[{t$95$5 = N[(N[(N[(0.0 * a), $MachinePrecision] * t$95$3), $MachinePrecision] * t$95$4), $MachinePrecision]}, Block[{t$95$6 = N[(t$95$4 * b), $MachinePrecision]}, N[(angle$95$s * If[LessEqual[angle$95$m, 2.6e-25], N[(N[(N[(0.011111111111111112 * angle$95$m), $MachinePrecision] * N[(Pi * N[(a + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision], If[LessEqual[angle$95$m, 6e+153], N[(N[(2.0 * N[(t$95$6 * t$95$0 + t$95$5), $MachinePrecision]), $MachinePrecision] * b + N[(t$95$1 * N[(t$95$3 * t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 * N[(t$95$6 * t$95$3 + t$95$5), $MachinePrecision]), $MachinePrecision] * b + N[(t$95$1 * N[(N[(t$95$0 * N[Cos[t$95$2], $MachinePrecision] + N[(N[Sin[N[(0.5 * Pi + N[(Pi / 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$4), $MachinePrecision]), $MachinePrecision] * t$95$4), $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 := \sin \left(0.5 \cdot \pi\right)\\
t_1 := -2 \cdot \left(a \cdot a\right)\\
t_2 := \left(\pi \cdot angle\_m\right) \cdot 0.005555555555555556\\
t_3 := \sin \left(\mathsf{fma}\left(0.5, \pi, t\_2\right)\right)\\
t_4 := \sin t\_2\\
t_5 := \left(\left(0 \cdot a\right) \cdot t\_3\right) \cdot t\_4\\
t_6 := t\_4 \cdot b\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;angle\_m \leq 2.6 \cdot 10^{-25}:\\
\;\;\;\;\left(\left(0.011111111111111112 \cdot angle\_m\right) \cdot \left(\pi \cdot \left(a + b\right)\right)\right) \cdot \left(b - a\right)\\
\mathbf{elif}\;angle\_m \leq 6 \cdot 10^{+153}:\\
\;\;\;\;\mathsf{fma}\left(2 \cdot \mathsf{fma}\left(t\_6, t\_0, t\_5\right), b, t\_1 \cdot \left(t\_3 \cdot t\_4\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(2 \cdot \mathsf{fma}\left(t\_6, t\_3, t\_5\right), b, t\_1 \cdot \left(\mathsf{fma}\left(t\_0, \cos t\_2, \sin \left(\mathsf{fma}\left(0.5, \pi, \frac{\pi}{2}\right)\right) \cdot t\_4\right) \cdot t\_4\right)\right)\\
\end{array}
\end{array}
\end{array}
if angle < 2.6e-25Initial program 59.6%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites54.3%
Taylor expanded in angle around 0
associate-*r*N/A
pow2N/A
pow2N/A
difference-of-squares-revN/A
+-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
+-commutativeN/A
lower-*.f64N/A
lift-PI.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift--.f6460.1
Applied rewrites60.1%
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-+.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-+.f64N/A
lift--.f6472.9
Applied rewrites72.9%
if 2.6e-25 < angle < 6.00000000000000037e153Initial program 45.7%
Applied rewrites40.7%
Taylor expanded in b around 0
Applied rewrites40.5%
Taylor expanded in angle around 0
lower-*.f64N/A
lift-PI.f6443.2
Applied rewrites43.2%
if 6.00000000000000037e153 < angle Initial program 32.1%
Applied rewrites38.4%
Taylor expanded in b around 0
Applied rewrites45.1%
lift-sin.f64N/A
lift-PI.f64N/A
lift-fma.f64N/A
sin-sumN/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-PI.f64N/A
lower-cos.f64N/A
lift-sin.f64N/A
lower-*.f64N/A
Applied rewrites39.0%
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 (+ a b))) (t_1 (* (* PI angle_m) 0.005555555555555556)))
(*
angle_s
(if (<= angle_m 2.5e+63)
(* (* (* 0.011111111111111112 angle_m) t_0) (- b a))
(if (<= angle_m 2.85e+259)
(*
(fma
(/ (* (* (* a a) (cos t_1)) (sin t_1)) b)
(/ -2.0 b)
(sin (* 2.0 t_1)))
(* b b))
(* (* 0.011111111111111112 angle_m) (* t_0 (- 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 t_0 = ((double) M_PI) * (a + b);
double t_1 = (((double) M_PI) * angle_m) * 0.005555555555555556;
double tmp;
if (angle_m <= 2.5e+63) {
tmp = ((0.011111111111111112 * angle_m) * t_0) * (b - a);
} else if (angle_m <= 2.85e+259) {
tmp = fma(((((a * a) * cos(t_1)) * sin(t_1)) / b), (-2.0 / b), sin((2.0 * t_1))) * (b * b);
} else {
tmp = (0.011111111111111112 * angle_m) * (t_0 * (b - a));
}
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(a + b)) t_1 = Float64(Float64(pi * angle_m) * 0.005555555555555556) tmp = 0.0 if (angle_m <= 2.5e+63) tmp = Float64(Float64(Float64(0.011111111111111112 * angle_m) * t_0) * Float64(b - a)); elseif (angle_m <= 2.85e+259) tmp = Float64(fma(Float64(Float64(Float64(Float64(a * a) * cos(t_1)) * sin(t_1)) / b), Float64(-2.0 / b), sin(Float64(2.0 * t_1))) * Float64(b * b)); else tmp = Float64(Float64(0.011111111111111112 * angle_m) * Float64(t_0 * Float64(b - a))); 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[(a + b), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(Pi * angle$95$m), $MachinePrecision] * 0.005555555555555556), $MachinePrecision]}, N[(angle$95$s * If[LessEqual[angle$95$m, 2.5e+63], N[(N[(N[(0.011111111111111112 * angle$95$m), $MachinePrecision] * t$95$0), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision], If[LessEqual[angle$95$m, 2.85e+259], N[(N[(N[(N[(N[(N[(a * a), $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision] * N[(-2.0 / b), $MachinePrecision] + N[Sin[N[(2.0 * t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision], N[(N[(0.011111111111111112 * angle$95$m), $MachinePrecision] * N[(t$95$0 * N[(b - a), $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(a + b\right)\\
t_1 := \left(\pi \cdot angle\_m\right) \cdot 0.005555555555555556\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;angle\_m \leq 2.5 \cdot 10^{+63}:\\
\;\;\;\;\left(\left(0.011111111111111112 \cdot angle\_m\right) \cdot t\_0\right) \cdot \left(b - a\right)\\
\mathbf{elif}\;angle\_m \leq 2.85 \cdot 10^{+259}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\left(\left(a \cdot a\right) \cdot \cos t\_1\right) \cdot \sin t\_1}{b}, \frac{-2}{b}, \sin \left(2 \cdot t\_1\right)\right) \cdot \left(b \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.011111111111111112 \cdot angle\_m\right) \cdot \left(t\_0 \cdot \left(b - a\right)\right)\\
\end{array}
\end{array}
\end{array}
if angle < 2.50000000000000005e63Initial program 59.7%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites54.7%
Taylor expanded in angle around 0
associate-*r*N/A
pow2N/A
pow2N/A
difference-of-squares-revN/A
+-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
+-commutativeN/A
lower-*.f64N/A
lift-PI.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift--.f6459.9
Applied rewrites59.9%
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-+.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-+.f64N/A
lift--.f6472.0
Applied rewrites72.0%
if 2.50000000000000005e63 < angle < 2.85e259Initial program 37.3%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites30.8%
lift-sin.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-fma.f64N/A
associate-*r*N/A
lift-PI.f64N/A
lift-/.f64N/A
sin-+PI/2-revN/A
lower-cos.f64N/A
*-commutativeN/A
*-commutativeN/A
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f6437.3
Applied rewrites37.3%
if 2.85e259 < angle Initial program 20.4%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites45.3%
Taylor expanded in angle around 0
associate-*r*N/A
pow2N/A
pow2N/A
difference-of-squares-revN/A
+-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
+-commutativeN/A
lower-*.f64N/A
lift-PI.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift--.f6442.8
Applied rewrites42.8%
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 (sin (fma 0.5 PI t_0)))
(t_2 (sin t_0)))
(*
angle_s
(if (<= a 1.2e+148)
(fma
(* 2.0 (fma (* t_2 b) (sin (* 0.5 PI)) (* (* (* 0.0 a) t_1) t_2)))
b
(* (* -2.0 (* a a)) (* t_1 t_2)))
(* (* (* 0.011111111111111112 angle_m) (* PI (+ a b))) (- 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 t_0 = (((double) M_PI) * angle_m) * 0.005555555555555556;
double t_1 = sin(fma(0.5, ((double) M_PI), t_0));
double t_2 = sin(t_0);
double tmp;
if (a <= 1.2e+148) {
tmp = fma((2.0 * fma((t_2 * b), sin((0.5 * ((double) M_PI))), (((0.0 * a) * t_1) * t_2))), b, ((-2.0 * (a * a)) * (t_1 * t_2)));
} else {
tmp = ((0.011111111111111112 * angle_m) * (((double) M_PI) * (a + b))) * (b - a);
}
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(pi * angle_m) * 0.005555555555555556) t_1 = sin(fma(0.5, pi, t_0)) t_2 = sin(t_0) tmp = 0.0 if (a <= 1.2e+148) tmp = fma(Float64(2.0 * fma(Float64(t_2 * b), sin(Float64(0.5 * pi)), Float64(Float64(Float64(0.0 * a) * t_1) * t_2))), b, Float64(Float64(-2.0 * Float64(a * a)) * Float64(t_1 * t_2))); else tmp = Float64(Float64(Float64(0.011111111111111112 * angle_m) * Float64(pi * Float64(a + b))) * Float64(b - a)); 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[(Pi * angle$95$m), $MachinePrecision] * 0.005555555555555556), $MachinePrecision]}, Block[{t$95$1 = N[Sin[N[(0.5 * Pi + t$95$0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sin[t$95$0], $MachinePrecision]}, N[(angle$95$s * If[LessEqual[a, 1.2e+148], N[(N[(2.0 * N[(N[(t$95$2 * b), $MachinePrecision] * N[Sin[N[(0.5 * Pi), $MachinePrecision]], $MachinePrecision] + N[(N[(N[(0.0 * a), $MachinePrecision] * t$95$1), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * b + N[(N[(-2.0 * N[(a * a), $MachinePrecision]), $MachinePrecision] * N[(t$95$1 * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(0.011111111111111112 * angle$95$m), $MachinePrecision] * N[(Pi * N[(a + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(b - a), $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(\pi \cdot angle\_m\right) \cdot 0.005555555555555556\\
t_1 := \sin \left(\mathsf{fma}\left(0.5, \pi, t\_0\right)\right)\\
t_2 := \sin t\_0\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;a \leq 1.2 \cdot 10^{+148}:\\
\;\;\;\;\mathsf{fma}\left(2 \cdot \mathsf{fma}\left(t\_2 \cdot b, \sin \left(0.5 \cdot \pi\right), \left(\left(0 \cdot a\right) \cdot t\_1\right) \cdot t\_2\right), b, \left(-2 \cdot \left(a \cdot a\right)\right) \cdot \left(t\_1 \cdot t\_2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(0.011111111111111112 \cdot angle\_m\right) \cdot \left(\pi \cdot \left(a + b\right)\right)\right) \cdot \left(b - a\right)\\
\end{array}
\end{array}
\end{array}
if a < 1.19999999999999997e148Initial program 55.6%
Applied rewrites54.6%
Taylor expanded in b around 0
Applied rewrites62.4%
Taylor expanded in angle around 0
lower-*.f64N/A
lift-PI.f6462.1
Applied rewrites62.1%
if 1.19999999999999997e148 < a Initial program 44.5%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites54.8%
Taylor expanded in angle around 0
associate-*r*N/A
pow2N/A
pow2N/A
difference-of-squares-revN/A
+-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
+-commutativeN/A
lower-*.f64N/A
lift-PI.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift--.f6460.0
Applied rewrites60.0%
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-+.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-+.f64N/A
lift--.f6474.2
Applied rewrites74.2%
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 (fma -0.005555555555555556 (* PI angle_m) (* 0.5 PI))))
(t_1 (sin (* (* PI angle_m) 0.005555555555555556)))
(t_2 (* PI (+ a b))))
(*
angle_s
(if (<= angle_m 4.7e+68)
(* (* (* 0.011111111111111112 angle_m) t_2) (- b a))
(if (<= angle_m 2.15e+154)
(*
(fma (/ (* (* t_1 (* a a)) t_0) (* b b)) -2.0 (* (* t_1 2.0) t_0))
(* b b))
(* (* 0.011111111111111112 angle_m) (* t_2 (- 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 t_0 = sin(fma(-0.005555555555555556, (((double) M_PI) * angle_m), (0.5 * ((double) M_PI))));
double t_1 = sin(((((double) M_PI) * angle_m) * 0.005555555555555556));
double t_2 = ((double) M_PI) * (a + b);
double tmp;
if (angle_m <= 4.7e+68) {
tmp = ((0.011111111111111112 * angle_m) * t_2) * (b - a);
} else if (angle_m <= 2.15e+154) {
tmp = fma((((t_1 * (a * a)) * t_0) / (b * b)), -2.0, ((t_1 * 2.0) * t_0)) * (b * b);
} else {
tmp = (0.011111111111111112 * angle_m) * (t_2 * (b - a));
}
return angle_s * tmp;
}
angle\_m = abs(angle) angle\_s = copysign(1.0, angle) function code(angle_s, a, b, angle_m) t_0 = sin(fma(-0.005555555555555556, Float64(pi * angle_m), Float64(0.5 * pi))) t_1 = sin(Float64(Float64(pi * angle_m) * 0.005555555555555556)) t_2 = Float64(pi * Float64(a + b)) tmp = 0.0 if (angle_m <= 4.7e+68) tmp = Float64(Float64(Float64(0.011111111111111112 * angle_m) * t_2) * Float64(b - a)); elseif (angle_m <= 2.15e+154) tmp = Float64(fma(Float64(Float64(Float64(t_1 * Float64(a * a)) * t_0) / Float64(b * b)), -2.0, Float64(Float64(t_1 * 2.0) * t_0)) * Float64(b * b)); else tmp = Float64(Float64(0.011111111111111112 * angle_m) * Float64(t_2 * Float64(b - a))); 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[Sin[N[(-0.005555555555555556 * N[(Pi * angle$95$m), $MachinePrecision] + N[(0.5 * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sin[N[(N[(Pi * angle$95$m), $MachinePrecision] * 0.005555555555555556), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(Pi * N[(a + b), $MachinePrecision]), $MachinePrecision]}, N[(angle$95$s * If[LessEqual[angle$95$m, 4.7e+68], N[(N[(N[(0.011111111111111112 * angle$95$m), $MachinePrecision] * t$95$2), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision], If[LessEqual[angle$95$m, 2.15e+154], N[(N[(N[(N[(N[(t$95$1 * N[(a * a), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] / N[(b * b), $MachinePrecision]), $MachinePrecision] * -2.0 + N[(N[(t$95$1 * 2.0), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision], N[(N[(0.011111111111111112 * angle$95$m), $MachinePrecision] * N[(t$95$2 * N[(b - a), $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 := \sin \left(\mathsf{fma}\left(-0.005555555555555556, \pi \cdot angle\_m, 0.5 \cdot \pi\right)\right)\\
t_1 := \sin \left(\left(\pi \cdot angle\_m\right) \cdot 0.005555555555555556\right)\\
t_2 := \pi \cdot \left(a + b\right)\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;angle\_m \leq 4.7 \cdot 10^{+68}:\\
\;\;\;\;\left(\left(0.011111111111111112 \cdot angle\_m\right) \cdot t\_2\right) \cdot \left(b - a\right)\\
\mathbf{elif}\;angle\_m \leq 2.15 \cdot 10^{+154}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\left(t\_1 \cdot \left(a \cdot a\right)\right) \cdot t\_0}{b \cdot b}, -2, \left(t\_1 \cdot 2\right) \cdot t\_0\right) \cdot \left(b \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.011111111111111112 \cdot angle\_m\right) \cdot \left(t\_2 \cdot \left(b - a\right)\right)\\
\end{array}
\end{array}
\end{array}
if angle < 4.6999999999999996e68Initial program 59.9%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites54.9%
Taylor expanded in angle around 0
associate-*r*N/A
pow2N/A
pow2N/A
difference-of-squares-revN/A
+-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
+-commutativeN/A
lower-*.f64N/A
lift-PI.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift--.f6460.0
Applied rewrites60.0%
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-+.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-+.f64N/A
lift--.f6472.0
Applied rewrites72.0%
if 4.6999999999999996e68 < angle < 2.1499999999999999e154Initial program 33.2%
lift-cos.f64N/A
cos-neg-revN/A
sin-+PI/2-revN/A
lower-sin.f64N/A
lower-+.f64N/A
lower-neg.f64N/A
lower-/.f64N/A
lift-PI.f6441.5
Applied rewrites41.5%
Taylor expanded in b around inf
Applied rewrites33.3%
if 2.1499999999999999e154 < angle Initial program 29.7%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites35.7%
Taylor expanded in angle around 0
associate-*r*N/A
pow2N/A
pow2N/A
difference-of-squares-revN/A
+-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
+-commutativeN/A
lower-*.f64N/A
lift-PI.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift--.f6436.0
Applied rewrites36.0%
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 (+ a b))))
(*
angle_s
(if (<= angle_m 4.2e-25)
(* (* (* 0.011111111111111112 angle_m) t_0) (- b a))
(* (* 0.011111111111111112 angle_m) (* t_0 (- 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 t_0 = ((double) M_PI) * (a + b);
double tmp;
if (angle_m <= 4.2e-25) {
tmp = ((0.011111111111111112 * angle_m) * t_0) * (b - a);
} else {
tmp = (0.011111111111111112 * angle_m) * (t_0 * (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 t_0 = Math.PI * (a + b);
double tmp;
if (angle_m <= 4.2e-25) {
tmp = ((0.011111111111111112 * angle_m) * t_0) * (b - a);
} else {
tmp = (0.011111111111111112 * angle_m) * (t_0 * (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): t_0 = math.pi * (a + b) tmp = 0 if angle_m <= 4.2e-25: tmp = ((0.011111111111111112 * angle_m) * t_0) * (b - a) else: tmp = (0.011111111111111112 * angle_m) * (t_0 * (b - a)) 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(a + b)) tmp = 0.0 if (angle_m <= 4.2e-25) tmp = Float64(Float64(Float64(0.011111111111111112 * angle_m) * t_0) * Float64(b - a)); else tmp = Float64(Float64(0.011111111111111112 * angle_m) * Float64(t_0 * 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) t_0 = pi * (a + b); tmp = 0.0; if (angle_m <= 4.2e-25) tmp = ((0.011111111111111112 * angle_m) * t_0) * (b - a); else tmp = (0.011111111111111112 * angle_m) * (t_0 * (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_] := Block[{t$95$0 = N[(Pi * N[(a + b), $MachinePrecision]), $MachinePrecision]}, N[(angle$95$s * If[LessEqual[angle$95$m, 4.2e-25], N[(N[(N[(0.011111111111111112 * angle$95$m), $MachinePrecision] * t$95$0), $MachinePrecision] * N[(b - a), $MachinePrecision]), $MachinePrecision], N[(N[(0.011111111111111112 * angle$95$m), $MachinePrecision] * N[(t$95$0 * N[(b - a), $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(a + b\right)\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;angle\_m \leq 4.2 \cdot 10^{-25}:\\
\;\;\;\;\left(\left(0.011111111111111112 \cdot angle\_m\right) \cdot t\_0\right) \cdot \left(b - a\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.011111111111111112 \cdot angle\_m\right) \cdot \left(t\_0 \cdot \left(b - a\right)\right)\\
\end{array}
\end{array}
\end{array}
if angle < 4.20000000000000005e-25Initial program 59.3%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites54.0%
Taylor expanded in angle around 0
associate-*r*N/A
pow2N/A
pow2N/A
difference-of-squares-revN/A
+-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
+-commutativeN/A
lower-*.f64N/A
lift-PI.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift--.f6459.8
Applied rewrites59.8%
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-+.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-+.f64N/A
lift--.f6473.1
Applied rewrites73.1%
if 4.20000000000000005e-25 < angle Initial program 40.7%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites40.4%
Taylor expanded in angle around 0
associate-*r*N/A
pow2N/A
pow2N/A
difference-of-squares-revN/A
+-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
+-commutativeN/A
lower-*.f64N/A
lift-PI.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift--.f6435.4
Applied rewrites35.4%
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 (+ a b)) (- 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) * (a + b)) * (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 * (a + b)) * (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 * (a + b)) * (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(Float64(0.011111111111111112 * angle_m) * Float64(Float64(pi * Float64(a + b)) * 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 * (a + b)) * (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[(N[(0.011111111111111112 * angle$95$m), $MachinePrecision] * N[(N[(Pi * N[(a + b), $MachinePrecision]), $MachinePrecision] * N[(b - a), $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(0.011111111111111112 \cdot angle\_m\right) \cdot \left(\left(\pi \cdot \left(a + b\right)\right) \cdot \left(b - a\right)\right)\right)
\end{array}
Initial program 53.9%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites50.1%
Taylor expanded in angle around 0
associate-*r*N/A
pow2N/A
pow2N/A
difference-of-squares-revN/A
+-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
+-commutativeN/A
lower-*.f64N/A
lift-PI.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift--.f6452.8
Applied rewrites52.8%
herbie shell --seed 2025065
(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)))))