
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* PI (/ angle 180.0)))) (* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) (sin t_0)) (cos t_0))))
double code(double a, double b, double angle) {
double t_0 = ((double) M_PI) * (angle / 180.0);
return ((2.0 * (pow(b, 2.0) - pow(a, 2.0))) * sin(t_0)) * cos(t_0);
}
public static double code(double a, double b, double angle) {
double t_0 = Math.PI * (angle / 180.0);
return ((2.0 * (Math.pow(b, 2.0) - Math.pow(a, 2.0))) * Math.sin(t_0)) * Math.cos(t_0);
}
def code(a, b, angle): t_0 = math.pi * (angle / 180.0) return ((2.0 * (math.pow(b, 2.0) - math.pow(a, 2.0))) * math.sin(t_0)) * math.cos(t_0)
function code(a, b, angle) t_0 = Float64(pi * Float64(angle / 180.0)) return Float64(Float64(Float64(2.0 * Float64((b ^ 2.0) - (a ^ 2.0))) * sin(t_0)) * cos(t_0)) end
function tmp = code(a, b, angle) t_0 = pi * (angle / 180.0); tmp = ((2.0 * ((b ^ 2.0) - (a ^ 2.0))) * sin(t_0)) * cos(t_0); end
code[a_, b_, angle_] := Block[{t$95$0 = N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(2.0 * N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \pi \cdot \frac{angle}{180}\\
\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin t\_0\right) \cdot \cos t\_0
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* PI (/ angle 180.0)))) (* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) (sin t_0)) (cos t_0))))
double code(double a, double b, double angle) {
double t_0 = ((double) M_PI) * (angle / 180.0);
return ((2.0 * (pow(b, 2.0) - pow(a, 2.0))) * sin(t_0)) * cos(t_0);
}
public static double code(double a, double b, double angle) {
double t_0 = Math.PI * (angle / 180.0);
return ((2.0 * (Math.pow(b, 2.0) - Math.pow(a, 2.0))) * Math.sin(t_0)) * Math.cos(t_0);
}
def code(a, b, angle): t_0 = math.pi * (angle / 180.0) return ((2.0 * (math.pow(b, 2.0) - math.pow(a, 2.0))) * math.sin(t_0)) * math.cos(t_0)
function code(a, b, angle) t_0 = Float64(pi * Float64(angle / 180.0)) return Float64(Float64(Float64(2.0 * Float64((b ^ 2.0) - (a ^ 2.0))) * sin(t_0)) * cos(t_0)) end
function tmp = code(a, b, angle) t_0 = pi * (angle / 180.0); tmp = ((2.0 * ((b ^ 2.0) - (a ^ 2.0))) * sin(t_0)) * cos(t_0); end
code[a_, b_, angle_] := Block[{t$95$0 = N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(2.0 * N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \pi \cdot \frac{angle}{180}\\
\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin t\_0\right) \cdot \cos t\_0
\end{array}
\end{array}
b_m = (fabs.f64 b)
angle\_m = (fabs.f64 angle)
angle\_s = (copysign.f64 #s(literal 1 binary64) angle)
(FPCore (angle_s a b_m angle_m)
:precision binary64
(let* ((t_0 (* (* 0.005555555555555556 angle_m) PI))
(t_1 (sin (* PI (/ angle_m 180.0))))
(t_2 (* (* PI angle_m) 0.005555555555555556)))
(*
angle_s
(if (<= angle_m 6.6e+23)
(fma
(* (* (sin t_2) (+ a b_m)) (- b_m a))
(cos t_0)
(*
(* (* (sin t_0) (+ a b_m)) (- b_m a))
(sin (fma (* 0.005555555555555556 angle_m) PI (/ PI 2.0)))))
(if (<= angle_m 5.7e+84)
(*
(* (* 2.0 (- (exp (* (log b_m) 2.0)) (pow a 2.0))) t_1)
(sin (+ (* -1.0 t_2) (/ PI 2.0))))
(*
(fma (+ b_m a) b_m (* a (- b_m a)))
(* t_1 (sin (fma PI (/ angle_m 180.0) (/ PI 2.0))))))))))b_m = fabs(b);
angle\_m = fabs(angle);
angle\_s = copysign(1.0, angle);
double code(double angle_s, double a, double b_m, double angle_m) {
double t_0 = (0.005555555555555556 * angle_m) * ((double) M_PI);
double t_1 = sin((((double) M_PI) * (angle_m / 180.0)));
double t_2 = (((double) M_PI) * angle_m) * 0.005555555555555556;
double tmp;
if (angle_m <= 6.6e+23) {
tmp = fma(((sin(t_2) * (a + b_m)) * (b_m - a)), cos(t_0), (((sin(t_0) * (a + b_m)) * (b_m - a)) * sin(fma((0.005555555555555556 * angle_m), ((double) M_PI), (((double) M_PI) / 2.0)))));
} else if (angle_m <= 5.7e+84) {
tmp = ((2.0 * (exp((log(b_m) * 2.0)) - pow(a, 2.0))) * t_1) * sin(((-1.0 * t_2) + (((double) M_PI) / 2.0)));
} else {
tmp = fma((b_m + a), b_m, (a * (b_m - a))) * (t_1 * sin(fma(((double) M_PI), (angle_m / 180.0), (((double) M_PI) / 2.0))));
}
return angle_s * tmp;
}
b_m = abs(b) angle\_m = abs(angle) angle\_s = copysign(1.0, angle) function code(angle_s, a, b_m, angle_m) t_0 = Float64(Float64(0.005555555555555556 * angle_m) * pi) t_1 = sin(Float64(pi * Float64(angle_m / 180.0))) t_2 = Float64(Float64(pi * angle_m) * 0.005555555555555556) tmp = 0.0 if (angle_m <= 6.6e+23) tmp = fma(Float64(Float64(sin(t_2) * Float64(a + b_m)) * Float64(b_m - a)), cos(t_0), Float64(Float64(Float64(sin(t_0) * Float64(a + b_m)) * Float64(b_m - a)) * sin(fma(Float64(0.005555555555555556 * angle_m), pi, Float64(pi / 2.0))))); elseif (angle_m <= 5.7e+84) tmp = Float64(Float64(Float64(2.0 * Float64(exp(Float64(log(b_m) * 2.0)) - (a ^ 2.0))) * t_1) * sin(Float64(Float64(-1.0 * t_2) + Float64(pi / 2.0)))); else tmp = Float64(fma(Float64(b_m + a), b_m, Float64(a * Float64(b_m - a))) * Float64(t_1 * sin(fma(pi, Float64(angle_m / 180.0), Float64(pi / 2.0))))); end return Float64(angle_s * tmp) end
b_m = N[Abs[b], $MachinePrecision]
angle\_m = N[Abs[angle], $MachinePrecision]
angle\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[angle]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[angle$95$s_, a_, b$95$m_, angle$95$m_] := Block[{t$95$0 = N[(N[(0.005555555555555556 * angle$95$m), $MachinePrecision] * Pi), $MachinePrecision]}, Block[{t$95$1 = N[Sin[N[(Pi * N[(angle$95$m / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(Pi * angle$95$m), $MachinePrecision] * 0.005555555555555556), $MachinePrecision]}, N[(angle$95$s * If[LessEqual[angle$95$m, 6.6e+23], N[(N[(N[(N[Sin[t$95$2], $MachinePrecision] * N[(a + b$95$m), $MachinePrecision]), $MachinePrecision] * N[(b$95$m - a), $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$0], $MachinePrecision] + N[(N[(N[(N[Sin[t$95$0], $MachinePrecision] * N[(a + b$95$m), $MachinePrecision]), $MachinePrecision] * N[(b$95$m - 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, 5.7e+84], N[(N[(N[(2.0 * N[(N[Exp[N[(N[Log[b$95$m], $MachinePrecision] * 2.0), $MachinePrecision]], $MachinePrecision] - N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] * N[Sin[N[(N[(-1.0 * t$95$2), $MachinePrecision] + N[(Pi / 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(b$95$m + a), $MachinePrecision] * b$95$m + N[(a * N[(b$95$m - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(t$95$1 * N[Sin[N[(Pi * N[(angle$95$m / 180.0), $MachinePrecision] + N[(Pi / 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]]]
\begin{array}{l}
b_m = \left|b\right|
\\
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
\begin{array}{l}
t_0 := \left(0.005555555555555556 \cdot angle\_m\right) \cdot \pi\\
t_1 := \sin \left(\pi \cdot \frac{angle\_m}{180}\right)\\
t_2 := \left(\pi \cdot angle\_m\right) \cdot 0.005555555555555556\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;angle\_m \leq 6.6 \cdot 10^{+23}:\\
\;\;\;\;\mathsf{fma}\left(\left(\sin t\_2 \cdot \left(a + b\_m\right)\right) \cdot \left(b\_m - a\right), \cos t\_0, \left(\left(\sin t\_0 \cdot \left(a + b\_m\right)\right) \cdot \left(b\_m - 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 5.7 \cdot 10^{+84}:\\
\;\;\;\;\left(\left(2 \cdot \left(e^{\log b\_m \cdot 2} - {a}^{2}\right)\right) \cdot t\_1\right) \cdot \sin \left(-1 \cdot t\_2 + \frac{\pi}{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(b\_m + a, b\_m, a \cdot \left(b\_m - a\right)\right) \cdot \left(t\_1 \cdot \sin \left(\mathsf{fma}\left(\pi, \frac{angle\_m}{180}, \frac{\pi}{2}\right)\right)\right)\\
\end{array}
\end{array}
\end{array}
if angle < 6.60000000000000059e23Initial program 61.3%
Taylor expanded in a around inf
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-PI.f64N/A
sin-+PI/2-revN/A
lower-sin.f64N/A
Applied rewrites34.1%
Taylor expanded in angle around inf
Applied rewrites74.3%
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lift-*.f64N/A
lift-PI.f6473.5
Applied rewrites73.5%
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
lower-cos.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-PI.f6472.9
Applied rewrites72.9%
if 6.60000000000000059e23 < angle < 5.6999999999999997e84Initial program 51.0%
Taylor expanded in angle around inf
sin-+PI/2-revN/A
lower-sin.f64N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lift-PI.f64N/A
lower-/.f64N/A
lift-PI.f6423.0
Applied rewrites23.0%
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
cos-neg-revN/A
sin-+PI/2-revN/A
lower-sin.f64N/A
lift-/.f64N/A
lift-PI.f64N/A
lower-+.f64N/A
Applied rewrites72.9%
lift-pow.f64N/A
pow-to-expN/A
lower-exp.f64N/A
lower-*.f64N/A
lower-log.f6431.2
Applied rewrites31.2%
if 5.6999999999999997e84 < angle Initial program 25.1%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
lift-/.f64N/A
Applied rewrites40.4%
Taylor expanded in a around inf
Applied rewrites42.8%
Taylor expanded in a around 0
Applied rewrites42.7%
Final simplification65.0%
b_m = (fabs.f64 b)
angle\_m = (fabs.f64 angle)
angle\_s = (copysign.f64 #s(literal 1 binary64) angle)
(FPCore (angle_s a b_m angle_m)
:precision binary64
(let* ((t_0 (* PI (/ angle_m 180.0)))
(t_1 (sin (fma (* 0.005555555555555556 angle_m) PI (/ PI 2.0)))))
(*
angle_s
(if (<=
(* (* (* 2.0 (- (pow b_m 2.0) (pow a 2.0))) (sin t_0)) (cos t_0))
(- INFINITY))
(* (* (* 0.011111111111111112 angle_m) (* (+ a b_m) PI)) (- b_m a))
(fma
(*
(* (sin (* (* PI angle_m) 0.005555555555555556)) (+ a b_m))
(- b_m a))
t_1
(*
(*
(* (sin (* (* 0.005555555555555556 angle_m) PI)) (+ a b_m))
(- b_m a))
t_1))))))b_m = fabs(b);
angle\_m = fabs(angle);
angle\_s = copysign(1.0, angle);
double code(double angle_s, double a, double b_m, double angle_m) {
double t_0 = ((double) M_PI) * (angle_m / 180.0);
double t_1 = sin(fma((0.005555555555555556 * angle_m), ((double) M_PI), (((double) M_PI) / 2.0)));
double tmp;
if ((((2.0 * (pow(b_m, 2.0) - pow(a, 2.0))) * sin(t_0)) * cos(t_0)) <= -((double) INFINITY)) {
tmp = ((0.011111111111111112 * angle_m) * ((a + b_m) * ((double) M_PI))) * (b_m - a);
} else {
tmp = fma(((sin(((((double) M_PI) * angle_m) * 0.005555555555555556)) * (a + b_m)) * (b_m - a)), t_1, (((sin(((0.005555555555555556 * angle_m) * ((double) M_PI))) * (a + b_m)) * (b_m - a)) * t_1));
}
return angle_s * tmp;
}
b_m = abs(b) angle\_m = abs(angle) angle\_s = copysign(1.0, angle) function code(angle_s, a, b_m, angle_m) t_0 = Float64(pi * Float64(angle_m / 180.0)) t_1 = sin(fma(Float64(0.005555555555555556 * angle_m), pi, Float64(pi / 2.0))) tmp = 0.0 if (Float64(Float64(Float64(2.0 * Float64((b_m ^ 2.0) - (a ^ 2.0))) * sin(t_0)) * cos(t_0)) <= Float64(-Inf)) tmp = Float64(Float64(Float64(0.011111111111111112 * angle_m) * Float64(Float64(a + b_m) * pi)) * Float64(b_m - a)); else tmp = fma(Float64(Float64(sin(Float64(Float64(pi * angle_m) * 0.005555555555555556)) * Float64(a + b_m)) * Float64(b_m - a)), t_1, Float64(Float64(Float64(sin(Float64(Float64(0.005555555555555556 * angle_m) * pi)) * Float64(a + b_m)) * Float64(b_m - a)) * t_1)); end return Float64(angle_s * tmp) end
b_m = N[Abs[b], $MachinePrecision]
angle\_m = N[Abs[angle], $MachinePrecision]
angle\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[angle]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[angle$95$s_, a_, b$95$m_, angle$95$m_] := Block[{t$95$0 = N[(Pi * N[(angle$95$m / 180.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sin[N[(N[(0.005555555555555556 * angle$95$m), $MachinePrecision] * Pi + N[(Pi / 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[(angle$95$s * If[LessEqual[N[(N[(N[(2.0 * N[(N[Power[b$95$m, 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], (-Infinity)], N[(N[(N[(0.011111111111111112 * angle$95$m), $MachinePrecision] * N[(N[(a + b$95$m), $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision] * N[(b$95$m - a), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Sin[N[(N[(Pi * angle$95$m), $MachinePrecision] * 0.005555555555555556), $MachinePrecision]], $MachinePrecision] * N[(a + b$95$m), $MachinePrecision]), $MachinePrecision] * N[(b$95$m - a), $MachinePrecision]), $MachinePrecision] * t$95$1 + N[(N[(N[(N[Sin[N[(N[(0.005555555555555556 * angle$95$m), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision] * N[(a + b$95$m), $MachinePrecision]), $MachinePrecision] * N[(b$95$m - a), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]]
\begin{array}{l}
b_m = \left|b\right|
\\
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
\begin{array}{l}
t_0 := \pi \cdot \frac{angle\_m}{180}\\
t_1 := \sin \left(\mathsf{fma}\left(0.005555555555555556 \cdot angle\_m, \pi, \frac{\pi}{2}\right)\right)\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;\left(\left(2 \cdot \left({b\_m}^{2} - {a}^{2}\right)\right) \cdot \sin t\_0\right) \cdot \cos t\_0 \leq -\infty:\\
\;\;\;\;\left(\left(0.011111111111111112 \cdot angle\_m\right) \cdot \left(\left(a + b\_m\right) \cdot \pi\right)\right) \cdot \left(b\_m - a\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(\sin \left(\left(\pi \cdot angle\_m\right) \cdot 0.005555555555555556\right) \cdot \left(a + b\_m\right)\right) \cdot \left(b\_m - a\right), t\_1, \left(\left(\sin \left(\left(0.005555555555555556 \cdot angle\_m\right) \cdot \pi\right) \cdot \left(a + b\_m\right)\right) \cdot \left(b\_m - a\right)\right) \cdot t\_1\right)\\
\end{array}
\end{array}
\end{array}
if (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64)))) (sin.f64 (*.f64 (PI.f64) (/.f64 angle #s(literal 180 binary64))))) (cos.f64 (*.f64 (PI.f64) (/.f64 angle #s(literal 180 binary64))))) < -inf.0Initial program 48.0%
Taylor expanded in a around inf
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-PI.f64N/A
sin-+PI/2-revN/A
lower-sin.f64N/A
Applied rewrites9.6%
Taylor expanded in angle around 0
associate-*l*N/A
metadata-evalN/A
pow-flipN/A
associate-*l*N/A
associate-*r*N/A
unpow2N/A
pow2N/A
difference-of-squares-revN/A
+-commutativeN/A
Applied rewrites53.6%
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
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
lift-PI.f64N/A
lift--.f6477.7
Applied rewrites77.7%
if -inf.0 < (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64)))) (sin.f64 (*.f64 (PI.f64) (/.f64 angle #s(literal 180 binary64))))) (cos.f64 (*.f64 (PI.f64) (/.f64 angle #s(literal 180 binary64))))) Initial program 55.5%
Taylor expanded in a around inf
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-PI.f64N/A
sin-+PI/2-revN/A
lower-sin.f64N/A
Applied rewrites39.1%
Taylor expanded in angle around inf
Applied rewrites63.8%
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lift-*.f64N/A
lift-PI.f6462.9
Applied rewrites62.9%
b_m = (fabs.f64 b)
angle\_m = (fabs.f64 angle)
angle\_s = (copysign.f64 #s(literal 1 binary64) angle)
(FPCore (angle_s a b_m angle_m)
:precision binary64
(let* ((t_0 (* PI (/ angle_m 180.0)))
(t_1 (sin (* 0.005555555555555556 (* angle_m PI))))
(t_2 (sin (fma (* 0.005555555555555556 angle_m) PI (/ PI 2.0)))))
(*
angle_s
(if (<=
(* (* (* 2.0 (- (pow b_m 2.0) (pow a 2.0))) (sin t_0)) (cos t_0))
(- INFINITY))
(* (* (* 0.011111111111111112 angle_m) (* (+ a b_m) PI)) (- b_m a))
(fma
(* (* a (+ t_1 (/ (* b_m t_1) a))) (- b_m a))
t_2
(*
(*
(* (sin (* (* 0.005555555555555556 angle_m) PI)) (+ a b_m))
(- b_m a))
t_2))))))b_m = fabs(b);
angle\_m = fabs(angle);
angle\_s = copysign(1.0, angle);
double code(double angle_s, double a, double b_m, double angle_m) {
double t_0 = ((double) M_PI) * (angle_m / 180.0);
double t_1 = sin((0.005555555555555556 * (angle_m * ((double) M_PI))));
double t_2 = sin(fma((0.005555555555555556 * angle_m), ((double) M_PI), (((double) M_PI) / 2.0)));
double tmp;
if ((((2.0 * (pow(b_m, 2.0) - pow(a, 2.0))) * sin(t_0)) * cos(t_0)) <= -((double) INFINITY)) {
tmp = ((0.011111111111111112 * angle_m) * ((a + b_m) * ((double) M_PI))) * (b_m - a);
} else {
tmp = fma(((a * (t_1 + ((b_m * t_1) / a))) * (b_m - a)), t_2, (((sin(((0.005555555555555556 * angle_m) * ((double) M_PI))) * (a + b_m)) * (b_m - a)) * t_2));
}
return angle_s * tmp;
}
b_m = abs(b) angle\_m = abs(angle) angle\_s = copysign(1.0, angle) function code(angle_s, a, b_m, angle_m) t_0 = Float64(pi * Float64(angle_m / 180.0)) t_1 = sin(Float64(0.005555555555555556 * Float64(angle_m * pi))) t_2 = sin(fma(Float64(0.005555555555555556 * angle_m), pi, Float64(pi / 2.0))) tmp = 0.0 if (Float64(Float64(Float64(2.0 * Float64((b_m ^ 2.0) - (a ^ 2.0))) * sin(t_0)) * cos(t_0)) <= Float64(-Inf)) tmp = Float64(Float64(Float64(0.011111111111111112 * angle_m) * Float64(Float64(a + b_m) * pi)) * Float64(b_m - a)); else tmp = fma(Float64(Float64(a * Float64(t_1 + Float64(Float64(b_m * t_1) / a))) * Float64(b_m - a)), t_2, Float64(Float64(Float64(sin(Float64(Float64(0.005555555555555556 * angle_m) * pi)) * Float64(a + b_m)) * Float64(b_m - a)) * t_2)); end return Float64(angle_s * tmp) end
b_m = N[Abs[b], $MachinePrecision]
angle\_m = N[Abs[angle], $MachinePrecision]
angle\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[angle]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[angle$95$s_, a_, b$95$m_, angle$95$m_] := Block[{t$95$0 = N[(Pi * N[(angle$95$m / 180.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sin[N[(0.005555555555555556 * N[(angle$95$m * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sin[N[(N[(0.005555555555555556 * angle$95$m), $MachinePrecision] * Pi + N[(Pi / 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[(angle$95$s * If[LessEqual[N[(N[(N[(2.0 * N[(N[Power[b$95$m, 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], (-Infinity)], N[(N[(N[(0.011111111111111112 * angle$95$m), $MachinePrecision] * N[(N[(a + b$95$m), $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision] * N[(b$95$m - a), $MachinePrecision]), $MachinePrecision], N[(N[(N[(a * N[(t$95$1 + N[(N[(b$95$m * t$95$1), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(b$95$m - a), $MachinePrecision]), $MachinePrecision] * t$95$2 + N[(N[(N[(N[Sin[N[(N[(0.005555555555555556 * angle$95$m), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision] * N[(a + b$95$m), $MachinePrecision]), $MachinePrecision] * N[(b$95$m - a), $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]]]
\begin{array}{l}
b_m = \left|b\right|
\\
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
\begin{array}{l}
t_0 := \pi \cdot \frac{angle\_m}{180}\\
t_1 := \sin \left(0.005555555555555556 \cdot \left(angle\_m \cdot \pi\right)\right)\\
t_2 := \sin \left(\mathsf{fma}\left(0.005555555555555556 \cdot angle\_m, \pi, \frac{\pi}{2}\right)\right)\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;\left(\left(2 \cdot \left({b\_m}^{2} - {a}^{2}\right)\right) \cdot \sin t\_0\right) \cdot \cos t\_0 \leq -\infty:\\
\;\;\;\;\left(\left(0.011111111111111112 \cdot angle\_m\right) \cdot \left(\left(a + b\_m\right) \cdot \pi\right)\right) \cdot \left(b\_m - a\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(a \cdot \left(t\_1 + \frac{b\_m \cdot t\_1}{a}\right)\right) \cdot \left(b\_m - a\right), t\_2, \left(\left(\sin \left(\left(0.005555555555555556 \cdot angle\_m\right) \cdot \pi\right) \cdot \left(a + b\_m\right)\right) \cdot \left(b\_m - a\right)\right) \cdot t\_2\right)\\
\end{array}
\end{array}
\end{array}
if (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64)))) (sin.f64 (*.f64 (PI.f64) (/.f64 angle #s(literal 180 binary64))))) (cos.f64 (*.f64 (PI.f64) (/.f64 angle #s(literal 180 binary64))))) < -inf.0Initial program 48.0%
Taylor expanded in a around inf
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-PI.f64N/A
sin-+PI/2-revN/A
lower-sin.f64N/A
Applied rewrites9.6%
Taylor expanded in angle around 0
associate-*l*N/A
metadata-evalN/A
pow-flipN/A
associate-*l*N/A
associate-*r*N/A
unpow2N/A
pow2N/A
difference-of-squares-revN/A
+-commutativeN/A
Applied rewrites53.6%
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
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
lift-PI.f64N/A
lift--.f6477.7
Applied rewrites77.7%
if -inf.0 < (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64)))) (sin.f64 (*.f64 (PI.f64) (/.f64 angle #s(literal 180 binary64))))) (cos.f64 (*.f64 (PI.f64) (/.f64 angle #s(literal 180 binary64))))) Initial program 55.5%
Taylor expanded in a around inf
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-PI.f64N/A
sin-+PI/2-revN/A
lower-sin.f64N/A
Applied rewrites39.1%
Taylor expanded in angle around inf
Applied rewrites63.8%
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lift-*.f64N/A
lift-PI.f6462.9
Applied rewrites62.9%
Taylor expanded in a around inf
lower-*.f64N/A
lower-+.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-*.f64N/A
lift-PI.f6462.4
Applied rewrites62.4%
b_m = (fabs.f64 b)
angle\_m = (fabs.f64 angle)
angle\_s = (copysign.f64 #s(literal 1 binary64) angle)
(FPCore (angle_s a b_m angle_m)
:precision binary64
(let* ((t_0 (sin (fma (* 0.005555555555555556 angle_m) PI (/ PI 2.0))))
(t_1
(*
(* (sin (* (* PI angle_m) 0.005555555555555556)) (+ a b_m))
(- b_m a))))
(* angle_s (fma t_1 t_0 (* t_1 t_0)))))b_m = fabs(b);
angle\_m = fabs(angle);
angle\_s = copysign(1.0, angle);
double code(double angle_s, double a, double b_m, double angle_m) {
double t_0 = sin(fma((0.005555555555555556 * angle_m), ((double) M_PI), (((double) M_PI) / 2.0)));
double t_1 = (sin(((((double) M_PI) * angle_m) * 0.005555555555555556)) * (a + b_m)) * (b_m - a);
return angle_s * fma(t_1, t_0, (t_1 * t_0));
}
b_m = abs(b) angle\_m = abs(angle) angle\_s = copysign(1.0, angle) function code(angle_s, a, b_m, angle_m) t_0 = sin(fma(Float64(0.005555555555555556 * angle_m), pi, Float64(pi / 2.0))) t_1 = Float64(Float64(sin(Float64(Float64(pi * angle_m) * 0.005555555555555556)) * Float64(a + b_m)) * Float64(b_m - a)) return Float64(angle_s * fma(t_1, t_0, Float64(t_1 * t_0))) end
b_m = N[Abs[b], $MachinePrecision]
angle\_m = N[Abs[angle], $MachinePrecision]
angle\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[angle]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[angle$95$s_, a_, b$95$m_, angle$95$m_] := Block[{t$95$0 = N[Sin[N[(N[(0.005555555555555556 * angle$95$m), $MachinePrecision] * Pi + N[(Pi / 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Sin[N[(N[(Pi * angle$95$m), $MachinePrecision] * 0.005555555555555556), $MachinePrecision]], $MachinePrecision] * N[(a + b$95$m), $MachinePrecision]), $MachinePrecision] * N[(b$95$m - a), $MachinePrecision]), $MachinePrecision]}, N[(angle$95$s * N[(t$95$1 * t$95$0 + N[(t$95$1 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
b_m = \left|b\right|
\\
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
\begin{array}{l}
t_0 := \sin \left(\mathsf{fma}\left(0.005555555555555556 \cdot angle\_m, \pi, \frac{\pi}{2}\right)\right)\\
t_1 := \left(\sin \left(\left(\pi \cdot angle\_m\right) \cdot 0.005555555555555556\right) \cdot \left(a + b\_m\right)\right) \cdot \left(b\_m - a\right)\\
angle\_s \cdot \mathsf{fma}\left(t\_1, t\_0, t\_1 \cdot t\_0\right)
\end{array}
\end{array}
Initial program 53.9%
Taylor expanded in a around inf
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-PI.f64N/A
sin-+PI/2-revN/A
lower-sin.f64N/A
Applied rewrites32.9%
Taylor expanded in angle around inf
Applied rewrites64.0%
b_m = (fabs.f64 b)
angle\_m = (fabs.f64 angle)
angle\_s = (copysign.f64 #s(literal 1 binary64) angle)
(FPCore (angle_s a b_m angle_m)
:precision binary64
(let* ((t_0
(* (* 0.011111111111111112 angle_m) (* (* PI (+ a b_m)) (- b_m a))))
(t_1 (* 2.0 (- (pow b_m 2.0) (pow a 2.0)))))
(*
angle_s
(if (<= t_1 (- INFINITY))
(fma
(fma
(* (* angle_m PI) a)
-0.011111111111111112
(* (* (* (* 0.0 b_m) PI) angle_m) 0.011111111111111112))
a
(* (* (* (* b_m b_m) PI) angle_m) 0.011111111111111112))
(if (<= t_1 20000000000000.0)
t_0
(if (<= t_1 INFINITY)
(fma
(* -0.011111111111111112 (* a a))
(* angle_m PI)
(*
(fma
(* (* (* 0.0 a) PI) angle_m)
0.011111111111111112
(* (* (* PI b_m) angle_m) 0.011111111111111112))
b_m))
t_0))))))b_m = fabs(b);
angle\_m = fabs(angle);
angle\_s = copysign(1.0, angle);
double code(double angle_s, double a, double b_m, double angle_m) {
double t_0 = (0.011111111111111112 * angle_m) * ((((double) M_PI) * (a + b_m)) * (b_m - a));
double t_1 = 2.0 * (pow(b_m, 2.0) - pow(a, 2.0));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = fma(fma(((angle_m * ((double) M_PI)) * a), -0.011111111111111112, ((((0.0 * b_m) * ((double) M_PI)) * angle_m) * 0.011111111111111112)), a, ((((b_m * b_m) * ((double) M_PI)) * angle_m) * 0.011111111111111112));
} else if (t_1 <= 20000000000000.0) {
tmp = t_0;
} else if (t_1 <= ((double) INFINITY)) {
tmp = fma((-0.011111111111111112 * (a * a)), (angle_m * ((double) M_PI)), (fma((((0.0 * a) * ((double) M_PI)) * angle_m), 0.011111111111111112, (((((double) M_PI) * b_m) * angle_m) * 0.011111111111111112)) * b_m));
} else {
tmp = t_0;
}
return angle_s * tmp;
}
b_m = abs(b) angle\_m = abs(angle) angle\_s = copysign(1.0, angle) function code(angle_s, a, b_m, angle_m) t_0 = Float64(Float64(0.011111111111111112 * angle_m) * Float64(Float64(pi * Float64(a + b_m)) * Float64(b_m - a))) t_1 = Float64(2.0 * Float64((b_m ^ 2.0) - (a ^ 2.0))) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = fma(fma(Float64(Float64(angle_m * pi) * a), -0.011111111111111112, Float64(Float64(Float64(Float64(0.0 * b_m) * pi) * angle_m) * 0.011111111111111112)), a, Float64(Float64(Float64(Float64(b_m * b_m) * pi) * angle_m) * 0.011111111111111112)); elseif (t_1 <= 20000000000000.0) tmp = t_0; elseif (t_1 <= Inf) tmp = fma(Float64(-0.011111111111111112 * Float64(a * a)), Float64(angle_m * pi), Float64(fma(Float64(Float64(Float64(0.0 * a) * pi) * angle_m), 0.011111111111111112, Float64(Float64(Float64(pi * b_m) * angle_m) * 0.011111111111111112)) * b_m)); else tmp = t_0; end return Float64(angle_s * tmp) end
b_m = N[Abs[b], $MachinePrecision]
angle\_m = N[Abs[angle], $MachinePrecision]
angle\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[angle]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[angle$95$s_, a_, b$95$m_, angle$95$m_] := Block[{t$95$0 = N[(N[(0.011111111111111112 * angle$95$m), $MachinePrecision] * N[(N[(Pi * N[(a + b$95$m), $MachinePrecision]), $MachinePrecision] * N[(b$95$m - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(2.0 * N[(N[Power[b$95$m, 2.0], $MachinePrecision] - N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(angle$95$s * If[LessEqual[t$95$1, (-Infinity)], N[(N[(N[(N[(angle$95$m * Pi), $MachinePrecision] * a), $MachinePrecision] * -0.011111111111111112 + N[(N[(N[(N[(0.0 * b$95$m), $MachinePrecision] * Pi), $MachinePrecision] * angle$95$m), $MachinePrecision] * 0.011111111111111112), $MachinePrecision]), $MachinePrecision] * a + N[(N[(N[(N[(b$95$m * b$95$m), $MachinePrecision] * Pi), $MachinePrecision] * angle$95$m), $MachinePrecision] * 0.011111111111111112), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 20000000000000.0], t$95$0, If[LessEqual[t$95$1, Infinity], N[(N[(-0.011111111111111112 * N[(a * a), $MachinePrecision]), $MachinePrecision] * N[(angle$95$m * Pi), $MachinePrecision] + N[(N[(N[(N[(N[(0.0 * a), $MachinePrecision] * Pi), $MachinePrecision] * angle$95$m), $MachinePrecision] * 0.011111111111111112 + N[(N[(N[(Pi * b$95$m), $MachinePrecision] * angle$95$m), $MachinePrecision] * 0.011111111111111112), $MachinePrecision]), $MachinePrecision] * b$95$m), $MachinePrecision]), $MachinePrecision], t$95$0]]]), $MachinePrecision]]]
\begin{array}{l}
b_m = \left|b\right|
\\
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
\begin{array}{l}
t_0 := \left(0.011111111111111112 \cdot angle\_m\right) \cdot \left(\left(\pi \cdot \left(a + b\_m\right)\right) \cdot \left(b\_m - a\right)\right)\\
t_1 := 2 \cdot \left({b\_m}^{2} - {a}^{2}\right)\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\left(angle\_m \cdot \pi\right) \cdot a, -0.011111111111111112, \left(\left(\left(0 \cdot b\_m\right) \cdot \pi\right) \cdot angle\_m\right) \cdot 0.011111111111111112\right), a, \left(\left(\left(b\_m \cdot b\_m\right) \cdot \pi\right) \cdot angle\_m\right) \cdot 0.011111111111111112\right)\\
\mathbf{elif}\;t\_1 \leq 20000000000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(-0.011111111111111112 \cdot \left(a \cdot a\right), angle\_m \cdot \pi, \mathsf{fma}\left(\left(\left(0 \cdot a\right) \cdot \pi\right) \cdot angle\_m, 0.011111111111111112, \left(\left(\pi \cdot b\_m\right) \cdot angle\_m\right) \cdot 0.011111111111111112\right) \cdot b\_m\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\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)))) < -inf.0Initial program 45.3%
Taylor expanded in a around inf
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-PI.f64N/A
sin-+PI/2-revN/A
lower-sin.f64N/A
Applied rewrites33.1%
Taylor expanded in angle around 0
associate-*l*N/A
metadata-evalN/A
pow-flipN/A
associate-*l*N/A
associate-*r*N/A
unpow2N/A
pow2N/A
difference-of-squares-revN/A
+-commutativeN/A
Applied rewrites49.4%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites81.4%
if -inf.0 < (*.f64 #s(literal 2 binary64) (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64)))) < 2e13 or +inf.0 < (*.f64 #s(literal 2 binary64) (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64)))) Initial program 55.0%
Taylor expanded in a around inf
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-PI.f64N/A
sin-+PI/2-revN/A
lower-sin.f64N/A
Applied rewrites55.1%
Taylor expanded in angle around 0
associate-*l*N/A
metadata-evalN/A
pow-flipN/A
associate-*l*N/A
associate-*r*N/A
unpow2N/A
pow2N/A
difference-of-squares-revN/A
+-commutativeN/A
Applied rewrites58.3%
if 2e13 < (*.f64 #s(literal 2 binary64) (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64)))) < +inf.0Initial program 57.3%
Taylor expanded in a around inf
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-PI.f64N/A
sin-+PI/2-revN/A
lower-sin.f64N/A
Applied rewrites2.6%
Taylor expanded in angle around 0
associate-*l*N/A
metadata-evalN/A
pow-flipN/A
associate-*l*N/A
associate-*r*N/A
unpow2N/A
pow2N/A
difference-of-squares-revN/A
+-commutativeN/A
Applied rewrites59.8%
Taylor expanded in b around 0
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
lift-PI.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites71.4%
b_m = (fabs.f64 b)
angle\_m = (fabs.f64 angle)
angle\_s = (copysign.f64 #s(literal 1 binary64) angle)
(FPCore (angle_s a b_m angle_m)
:precision binary64
(*
angle_s
(if (<= angle_m 1.25e-14)
(* (* (* 0.011111111111111112 angle_m) (* (+ a b_m) PI)) (- b_m a))
(* (* 0.011111111111111112 angle_m) (* (* PI (+ a b_m)) (- b_m a))))))b_m = fabs(b);
angle\_m = fabs(angle);
angle\_s = copysign(1.0, angle);
double code(double angle_s, double a, double b_m, double angle_m) {
double tmp;
if (angle_m <= 1.25e-14) {
tmp = ((0.011111111111111112 * angle_m) * ((a + b_m) * ((double) M_PI))) * (b_m - a);
} else {
tmp = (0.011111111111111112 * angle_m) * ((((double) M_PI) * (a + b_m)) * (b_m - a));
}
return angle_s * tmp;
}
b_m = Math.abs(b);
angle\_m = Math.abs(angle);
angle\_s = Math.copySign(1.0, angle);
public static double code(double angle_s, double a, double b_m, double angle_m) {
double tmp;
if (angle_m <= 1.25e-14) {
tmp = ((0.011111111111111112 * angle_m) * ((a + b_m) * Math.PI)) * (b_m - a);
} else {
tmp = (0.011111111111111112 * angle_m) * ((Math.PI * (a + b_m)) * (b_m - a));
}
return angle_s * tmp;
}
b_m = math.fabs(b) angle\_m = math.fabs(angle) angle\_s = math.copysign(1.0, angle) def code(angle_s, a, b_m, angle_m): tmp = 0 if angle_m <= 1.25e-14: tmp = ((0.011111111111111112 * angle_m) * ((a + b_m) * math.pi)) * (b_m - a) else: tmp = (0.011111111111111112 * angle_m) * ((math.pi * (a + b_m)) * (b_m - a)) return angle_s * tmp
b_m = abs(b) angle\_m = abs(angle) angle\_s = copysign(1.0, angle) function code(angle_s, a, b_m, angle_m) tmp = 0.0 if (angle_m <= 1.25e-14) tmp = Float64(Float64(Float64(0.011111111111111112 * angle_m) * Float64(Float64(a + b_m) * pi)) * Float64(b_m - a)); else tmp = Float64(Float64(0.011111111111111112 * angle_m) * Float64(Float64(pi * Float64(a + b_m)) * Float64(b_m - a))); end return Float64(angle_s * tmp) end
b_m = abs(b); angle\_m = abs(angle); angle\_s = sign(angle) * abs(1.0); function tmp_2 = code(angle_s, a, b_m, angle_m) tmp = 0.0; if (angle_m <= 1.25e-14) tmp = ((0.011111111111111112 * angle_m) * ((a + b_m) * pi)) * (b_m - a); else tmp = (0.011111111111111112 * angle_m) * ((pi * (a + b_m)) * (b_m - a)); end tmp_2 = angle_s * tmp; end
b_m = N[Abs[b], $MachinePrecision]
angle\_m = N[Abs[angle], $MachinePrecision]
angle\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[angle]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[angle$95$s_, a_, b$95$m_, angle$95$m_] := N[(angle$95$s * If[LessEqual[angle$95$m, 1.25e-14], N[(N[(N[(0.011111111111111112 * angle$95$m), $MachinePrecision] * N[(N[(a + b$95$m), $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision] * N[(b$95$m - a), $MachinePrecision]), $MachinePrecision], N[(N[(0.011111111111111112 * angle$95$m), $MachinePrecision] * N[(N[(Pi * N[(a + b$95$m), $MachinePrecision]), $MachinePrecision] * N[(b$95$m - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
b_m = \left|b\right|
\\
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;angle\_m \leq 1.25 \cdot 10^{-14}:\\
\;\;\;\;\left(\left(0.011111111111111112 \cdot angle\_m\right) \cdot \left(\left(a + b\_m\right) \cdot \pi\right)\right) \cdot \left(b\_m - a\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.011111111111111112 \cdot angle\_m\right) \cdot \left(\left(\pi \cdot \left(a + b\_m\right)\right) \cdot \left(b\_m - a\right)\right)\\
\end{array}
\end{array}
if angle < 1.25e-14Initial program 61.5%
Taylor expanded in a around inf
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-PI.f64N/A
sin-+PI/2-revN/A
lower-sin.f64N/A
Applied rewrites34.2%
Taylor expanded in angle around 0
associate-*l*N/A
metadata-evalN/A
pow-flipN/A
associate-*l*N/A
associate-*r*N/A
unpow2N/A
pow2N/A
difference-of-squares-revN/A
+-commutativeN/A
Applied rewrites65.6%
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
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
lift-PI.f64N/A
lift--.f6476.8
Applied rewrites76.8%
if 1.25e-14 < angle Initial program 32.1%
Taylor expanded in a around inf
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-PI.f64N/A
sin-+PI/2-revN/A
lower-sin.f64N/A
Applied rewrites28.9%
Taylor expanded in angle around 0
associate-*l*N/A
metadata-evalN/A
pow-flipN/A
associate-*l*N/A
associate-*r*N/A
unpow2N/A
pow2N/A
difference-of-squares-revN/A
+-commutativeN/A
Applied rewrites32.6%
b_m = (fabs.f64 b)
angle\_m = (fabs.f64 angle)
angle\_s = (copysign.f64 #s(literal 1 binary64) angle)
(FPCore (angle_s a b_m angle_m)
:precision binary64
(*
angle_s
(if (<= a 1.16e+154)
(fma
(* -0.011111111111111112 (* a a))
(* angle_m PI)
(*
(fma
(* (* (* 0.0 a) PI) angle_m)
0.011111111111111112
(* (* (* PI b_m) angle_m) 0.011111111111111112))
b_m))
(fma
(fma
(* (* angle_m PI) a)
-0.011111111111111112
(* (* (* (* 0.0 b_m) PI) angle_m) 0.011111111111111112))
a
(* (* (* (* b_m b_m) PI) angle_m) 0.011111111111111112)))))b_m = fabs(b);
angle\_m = fabs(angle);
angle\_s = copysign(1.0, angle);
double code(double angle_s, double a, double b_m, double angle_m) {
double tmp;
if (a <= 1.16e+154) {
tmp = fma((-0.011111111111111112 * (a * a)), (angle_m * ((double) M_PI)), (fma((((0.0 * a) * ((double) M_PI)) * angle_m), 0.011111111111111112, (((((double) M_PI) * b_m) * angle_m) * 0.011111111111111112)) * b_m));
} else {
tmp = fma(fma(((angle_m * ((double) M_PI)) * a), -0.011111111111111112, ((((0.0 * b_m) * ((double) M_PI)) * angle_m) * 0.011111111111111112)), a, ((((b_m * b_m) * ((double) M_PI)) * angle_m) * 0.011111111111111112));
}
return angle_s * tmp;
}
b_m = abs(b) angle\_m = abs(angle) angle\_s = copysign(1.0, angle) function code(angle_s, a, b_m, angle_m) tmp = 0.0 if (a <= 1.16e+154) tmp = fma(Float64(-0.011111111111111112 * Float64(a * a)), Float64(angle_m * pi), Float64(fma(Float64(Float64(Float64(0.0 * a) * pi) * angle_m), 0.011111111111111112, Float64(Float64(Float64(pi * b_m) * angle_m) * 0.011111111111111112)) * b_m)); else tmp = fma(fma(Float64(Float64(angle_m * pi) * a), -0.011111111111111112, Float64(Float64(Float64(Float64(0.0 * b_m) * pi) * angle_m) * 0.011111111111111112)), a, Float64(Float64(Float64(Float64(b_m * b_m) * pi) * angle_m) * 0.011111111111111112)); end return Float64(angle_s * tmp) end
b_m = N[Abs[b], $MachinePrecision]
angle\_m = N[Abs[angle], $MachinePrecision]
angle\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[angle]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[angle$95$s_, a_, b$95$m_, angle$95$m_] := N[(angle$95$s * If[LessEqual[a, 1.16e+154], N[(N[(-0.011111111111111112 * N[(a * a), $MachinePrecision]), $MachinePrecision] * N[(angle$95$m * Pi), $MachinePrecision] + N[(N[(N[(N[(N[(0.0 * a), $MachinePrecision] * Pi), $MachinePrecision] * angle$95$m), $MachinePrecision] * 0.011111111111111112 + N[(N[(N[(Pi * b$95$m), $MachinePrecision] * angle$95$m), $MachinePrecision] * 0.011111111111111112), $MachinePrecision]), $MachinePrecision] * b$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(angle$95$m * Pi), $MachinePrecision] * a), $MachinePrecision] * -0.011111111111111112 + N[(N[(N[(N[(0.0 * b$95$m), $MachinePrecision] * Pi), $MachinePrecision] * angle$95$m), $MachinePrecision] * 0.011111111111111112), $MachinePrecision]), $MachinePrecision] * a + N[(N[(N[(N[(b$95$m * b$95$m), $MachinePrecision] * Pi), $MachinePrecision] * angle$95$m), $MachinePrecision] * 0.011111111111111112), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
b_m = \left|b\right|
\\
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
angle\_s \cdot \begin{array}{l}
\mathbf{if}\;a \leq 1.16 \cdot 10^{+154}:\\
\;\;\;\;\mathsf{fma}\left(-0.011111111111111112 \cdot \left(a \cdot a\right), angle\_m \cdot \pi, \mathsf{fma}\left(\left(\left(0 \cdot a\right) \cdot \pi\right) \cdot angle\_m, 0.011111111111111112, \left(\left(\pi \cdot b\_m\right) \cdot angle\_m\right) \cdot 0.011111111111111112\right) \cdot b\_m\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\left(angle\_m \cdot \pi\right) \cdot a, -0.011111111111111112, \left(\left(\left(0 \cdot b\_m\right) \cdot \pi\right) \cdot angle\_m\right) \cdot 0.011111111111111112\right), a, \left(\left(\left(b\_m \cdot b\_m\right) \cdot \pi\right) \cdot angle\_m\right) \cdot 0.011111111111111112\right)\\
\end{array}
\end{array}
if a < 1.16000000000000001e154Initial program 56.7%
Taylor expanded in a around inf
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-PI.f64N/A
sin-+PI/2-revN/A
lower-sin.f64N/A
Applied rewrites32.5%
Taylor expanded in angle around 0
associate-*l*N/A
metadata-evalN/A
pow-flipN/A
associate-*l*N/A
associate-*r*N/A
unpow2N/A
pow2N/A
difference-of-squares-revN/A
+-commutativeN/A
Applied rewrites58.0%
Taylor expanded in b around 0
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
lift-PI.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites57.4%
if 1.16000000000000001e154 < a Initial program 35.5%
Taylor expanded in a around inf
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-PI.f64N/A
sin-+PI/2-revN/A
lower-sin.f64N/A
Applied rewrites35.5%
Taylor expanded in angle around 0
associate-*l*N/A
metadata-evalN/A
pow-flipN/A
associate-*l*N/A
associate-*r*N/A
unpow2N/A
pow2N/A
difference-of-squares-revN/A
+-commutativeN/A
Applied rewrites50.6%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites66.5%
b_m = (fabs.f64 b)
angle\_m = (fabs.f64 angle)
angle\_s = (copysign.f64 #s(literal 1 binary64) angle)
(FPCore (angle_s a b_m angle_m)
:precision binary64
(*
angle_s
(fma
(* -0.011111111111111112 (* a a))
(* angle_m PI)
(*
(fma
(* (* (* 0.0 a) PI) angle_m)
0.011111111111111112
(* (* (* PI b_m) angle_m) 0.011111111111111112))
b_m))))b_m = fabs(b);
angle\_m = fabs(angle);
angle\_s = copysign(1.0, angle);
double code(double angle_s, double a, double b_m, double angle_m) {
return angle_s * fma((-0.011111111111111112 * (a * a)), (angle_m * ((double) M_PI)), (fma((((0.0 * a) * ((double) M_PI)) * angle_m), 0.011111111111111112, (((((double) M_PI) * b_m) * angle_m) * 0.011111111111111112)) * b_m));
}
b_m = abs(b) angle\_m = abs(angle) angle\_s = copysign(1.0, angle) function code(angle_s, a, b_m, angle_m) return Float64(angle_s * fma(Float64(-0.011111111111111112 * Float64(a * a)), Float64(angle_m * pi), Float64(fma(Float64(Float64(Float64(0.0 * a) * pi) * angle_m), 0.011111111111111112, Float64(Float64(Float64(pi * b_m) * angle_m) * 0.011111111111111112)) * b_m))) end
b_m = N[Abs[b], $MachinePrecision]
angle\_m = N[Abs[angle], $MachinePrecision]
angle\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[angle]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[angle$95$s_, a_, b$95$m_, angle$95$m_] := N[(angle$95$s * N[(N[(-0.011111111111111112 * N[(a * a), $MachinePrecision]), $MachinePrecision] * N[(angle$95$m * Pi), $MachinePrecision] + N[(N[(N[(N[(N[(0.0 * a), $MachinePrecision] * Pi), $MachinePrecision] * angle$95$m), $MachinePrecision] * 0.011111111111111112 + N[(N[(N[(Pi * b$95$m), $MachinePrecision] * angle$95$m), $MachinePrecision] * 0.011111111111111112), $MachinePrecision]), $MachinePrecision] * b$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
b_m = \left|b\right|
\\
angle\_m = \left|angle\right|
\\
angle\_s = \mathsf{copysign}\left(1, angle\right)
\\
angle\_s \cdot \mathsf{fma}\left(-0.011111111111111112 \cdot \left(a \cdot a\right), angle\_m \cdot \pi, \mathsf{fma}\left(\left(\left(0 \cdot a\right) \cdot \pi\right) \cdot angle\_m, 0.011111111111111112, \left(\left(\pi \cdot b\_m\right) \cdot angle\_m\right) \cdot 0.011111111111111112\right) \cdot b\_m\right)
\end{array}
Initial program 53.9%
Taylor expanded in a around inf
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-PI.f64N/A
sin-+PI/2-revN/A
lower-sin.f64N/A
Applied rewrites32.9%
Taylor expanded in angle around 0
associate-*l*N/A
metadata-evalN/A
pow-flipN/A
associate-*l*N/A
associate-*r*N/A
unpow2N/A
pow2N/A
difference-of-squares-revN/A
+-commutativeN/A
Applied rewrites57.1%
Taylor expanded in b around 0
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
lift-PI.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites55.0%
herbie shell --seed 2025064
(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)))))