
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* PI (/ angle 180.0)))) (+ (pow (* a (cos t_0)) 2.0) (pow (* b (sin t_0)) 2.0))))
double code(double a, double b, double angle) {
double t_0 = ((double) M_PI) * (angle / 180.0);
return pow((a * cos(t_0)), 2.0) + pow((b * sin(t_0)), 2.0);
}
public static double code(double a, double b, double angle) {
double t_0 = Math.PI * (angle / 180.0);
return Math.pow((a * Math.cos(t_0)), 2.0) + Math.pow((b * Math.sin(t_0)), 2.0);
}
def code(a, b, angle): t_0 = math.pi * (angle / 180.0) return math.pow((a * math.cos(t_0)), 2.0) + math.pow((b * math.sin(t_0)), 2.0)
function code(a, b, angle) t_0 = Float64(pi * Float64(angle / 180.0)) return Float64((Float64(a * cos(t_0)) ^ 2.0) + (Float64(b * sin(t_0)) ^ 2.0)) end
function tmp = code(a, b, angle) t_0 = pi * (angle / 180.0); tmp = ((a * cos(t_0)) ^ 2.0) + ((b * sin(t_0)) ^ 2.0); end
code[a_, b_, angle_] := Block[{t$95$0 = N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]}, N[(N[Power[N[(a * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
t_0 := \pi \cdot \frac{angle}{180}\\
{\left(a \cdot \cos t\_0\right)}^{2} + {\left(b \cdot \sin t\_0\right)}^{2}
\end{array}
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* PI (/ angle 180.0)))) (+ (pow (* a (cos t_0)) 2.0) (pow (* b (sin t_0)) 2.0))))
double code(double a, double b, double angle) {
double t_0 = ((double) M_PI) * (angle / 180.0);
return pow((a * cos(t_0)), 2.0) + pow((b * sin(t_0)), 2.0);
}
public static double code(double a, double b, double angle) {
double t_0 = Math.PI * (angle / 180.0);
return Math.pow((a * Math.cos(t_0)), 2.0) + Math.pow((b * Math.sin(t_0)), 2.0);
}
def code(a, b, angle): t_0 = math.pi * (angle / 180.0) return math.pow((a * math.cos(t_0)), 2.0) + math.pow((b * math.sin(t_0)), 2.0)
function code(a, b, angle) t_0 = Float64(pi * Float64(angle / 180.0)) return Float64((Float64(a * cos(t_0)) ^ 2.0) + (Float64(b * sin(t_0)) ^ 2.0)) end
function tmp = code(a, b, angle) t_0 = pi * (angle / 180.0); tmp = ((a * cos(t_0)) ^ 2.0) + ((b * sin(t_0)) ^ 2.0); end
code[a_, b_, angle_] := Block[{t$95$0 = N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]}, N[(N[Power[N[(a * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
t_0 := \pi \cdot \frac{angle}{180}\\
{\left(a \cdot \cos t\_0\right)}^{2} + {\left(b \cdot \sin t\_0\right)}^{2}
\end{array}
(FPCore (a b angle) :precision binary64 (+ (* (pow a 2.0) (pow (sin (* PI (- 0.5 (* -0.005555555555555556 angle)))) 2.0)) (pow (* b (sin (* (* angle PI) 0.005555555555555556))) 2.0)))
double code(double a, double b, double angle) {
return (pow(a, 2.0) * pow(sin((((double) M_PI) * (0.5 - (-0.005555555555555556 * angle)))), 2.0)) + pow((b * sin(((angle * ((double) M_PI)) * 0.005555555555555556))), 2.0);
}
public static double code(double a, double b, double angle) {
return (Math.pow(a, 2.0) * Math.pow(Math.sin((Math.PI * (0.5 - (-0.005555555555555556 * angle)))), 2.0)) + Math.pow((b * Math.sin(((angle * Math.PI) * 0.005555555555555556))), 2.0);
}
def code(a, b, angle): return (math.pow(a, 2.0) * math.pow(math.sin((math.pi * (0.5 - (-0.005555555555555556 * angle)))), 2.0)) + math.pow((b * math.sin(((angle * math.pi) * 0.005555555555555556))), 2.0)
function code(a, b, angle) return Float64(Float64((a ^ 2.0) * (sin(Float64(pi * Float64(0.5 - Float64(-0.005555555555555556 * angle)))) ^ 2.0)) + (Float64(b * sin(Float64(Float64(angle * pi) * 0.005555555555555556))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((a ^ 2.0) * (sin((pi * (0.5 - (-0.005555555555555556 * angle)))) ^ 2.0)) + ((b * sin(((angle * pi) * 0.005555555555555556))) ^ 2.0); end
code[a_, b_, angle_] := N[(N[(N[Power[a, 2.0], $MachinePrecision] * N[Power[N[Sin[N[(Pi * N[(0.5 - N[(-0.005555555555555556 * angle), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + N[Power[N[(b * N[Sin[N[(N[(angle * Pi), $MachinePrecision] * 0.005555555555555556), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
{a}^{2} \cdot {\sin \left(\pi \cdot \left(0.5 - -0.005555555555555556 \cdot angle\right)\right)}^{2} + {\left(b \cdot \sin \left(\left(angle \cdot \pi\right) \cdot 0.005555555555555556\right)\right)}^{2}
Initial program 79.5%
lift-cos.f64N/A
sin-+PI/2-revN/A
lower-sin.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
mult-flipN/A
distribute-lft-outN/A
lower-*.f64N/A
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-fma.f64N/A
metadata-evalN/A
metadata-eval79.4%
Applied rewrites79.4%
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
metadata-evalN/A
associate-*l*N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f6479.4%
Applied rewrites79.4%
Taylor expanded in angle around -inf
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-PI.f64N/A
lower--.f64N/A
lower-*.f6479.4%
Applied rewrites79.4%
(FPCore (a b angle) :precision binary64 (+ (* (* (* 1.0 a) 1.0) a) (/ 1.0 (pow (* (sin (* (* angle PI) 0.005555555555555556)) b) -2.0))))
double code(double a, double b, double angle) {
return (((1.0 * a) * 1.0) * a) + (1.0 / pow((sin(((angle * ((double) M_PI)) * 0.005555555555555556)) * b), -2.0));
}
public static double code(double a, double b, double angle) {
return (((1.0 * a) * 1.0) * a) + (1.0 / Math.pow((Math.sin(((angle * Math.PI) * 0.005555555555555556)) * b), -2.0));
}
def code(a, b, angle): return (((1.0 * a) * 1.0) * a) + (1.0 / math.pow((math.sin(((angle * math.pi) * 0.005555555555555556)) * b), -2.0))
function code(a, b, angle) return Float64(Float64(Float64(Float64(1.0 * a) * 1.0) * a) + Float64(1.0 / (Float64(sin(Float64(Float64(angle * pi) * 0.005555555555555556)) * b) ^ -2.0))) end
function tmp = code(a, b, angle) tmp = (((1.0 * a) * 1.0) * a) + (1.0 / ((sin(((angle * pi) * 0.005555555555555556)) * b) ^ -2.0)); end
code[a_, b_, angle_] := N[(N[(N[(N[(1.0 * a), $MachinePrecision] * 1.0), $MachinePrecision] * a), $MachinePrecision] + N[(1.0 / N[Power[N[(N[Sin[N[(N[(angle * Pi), $MachinePrecision] * 0.005555555555555556), $MachinePrecision]], $MachinePrecision] * b), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(\left(1 \cdot a\right) \cdot 1\right) \cdot a + \frac{1}{{\left(\sin \left(\left(angle \cdot \pi\right) \cdot 0.005555555555555556\right) \cdot b\right)}^{-2}}
Initial program 79.5%
lift-pow.f64N/A
metadata-evalN/A
pow-subN/A
lower-unsound-/.f64N/A
lower-unsound-pow.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
lower-unsound-pow.f6478.1%
Applied rewrites79.5%
lift-/.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-divN/A
sub-negate-revN/A
metadata-evalN/A
metadata-evalN/A
pow-negN/A
lower-unsound-/.f64N/A
lower-unsound-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-eval79.4%
Applied rewrites79.4%
Taylor expanded in angle around 0
Applied rewrites79.3%
lift-pow.f64N/A
unpow2N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6479.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6479.3%
Applied rewrites79.3%
(FPCore (a b angle)
:precision binary64
(if (<= (fabs angle) 9.5e-11)
(+
(pow (* a 1.0) 2.0)
(/ 1.0 (pow (* 0.005555555555555556 (* (fabs angle) (* b PI))) -2.0)))
(fma
(*
(- 0.5 (* 0.5 (cos (* 2.0 (* (* 0.005555555555555556 (fabs angle)) PI)))))
b)
b
(* (* (* 1.0 a) a) 1.0))))double code(double a, double b, double angle) {
double tmp;
if (fabs(angle) <= 9.5e-11) {
tmp = pow((a * 1.0), 2.0) + (1.0 / pow((0.005555555555555556 * (fabs(angle) * (b * ((double) M_PI)))), -2.0));
} else {
tmp = fma(((0.5 - (0.5 * cos((2.0 * ((0.005555555555555556 * fabs(angle)) * ((double) M_PI)))))) * b), b, (((1.0 * a) * a) * 1.0));
}
return tmp;
}
function code(a, b, angle) tmp = 0.0 if (abs(angle) <= 9.5e-11) tmp = Float64((Float64(a * 1.0) ^ 2.0) + Float64(1.0 / (Float64(0.005555555555555556 * Float64(abs(angle) * Float64(b * pi))) ^ -2.0))); else tmp = fma(Float64(Float64(0.5 - Float64(0.5 * cos(Float64(2.0 * Float64(Float64(0.005555555555555556 * abs(angle)) * pi))))) * b), b, Float64(Float64(Float64(1.0 * a) * a) * 1.0)); end return tmp end
code[a_, b_, angle_] := If[LessEqual[N[Abs[angle], $MachinePrecision], 9.5e-11], N[(N[Power[N[(a * 1.0), $MachinePrecision], 2.0], $MachinePrecision] + N[(1.0 / N[Power[N[(0.005555555555555556 * N[(N[Abs[angle], $MachinePrecision] * N[(b * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(0.5 - N[(0.5 * N[Cos[N[(2.0 * N[(N[(0.005555555555555556 * N[Abs[angle], $MachinePrecision]), $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision] * b + N[(N[(N[(1.0 * a), $MachinePrecision] * a), $MachinePrecision] * 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\left|angle\right| \leq 9.5 \cdot 10^{-11}:\\
\;\;\;\;{\left(a \cdot 1\right)}^{2} + \frac{1}{{\left(0.005555555555555556 \cdot \left(\left|angle\right| \cdot \left(b \cdot \pi\right)\right)\right)}^{-2}}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(0.5 - 0.5 \cdot \cos \left(2 \cdot \left(\left(0.005555555555555556 \cdot \left|angle\right|\right) \cdot \pi\right)\right)\right) \cdot b, b, \left(\left(1 \cdot a\right) \cdot a\right) \cdot 1\right)\\
\end{array}
if angle < 9.4999999999999995e-11Initial program 79.5%
lift-pow.f64N/A
metadata-evalN/A
pow-subN/A
lower-unsound-/.f64N/A
lower-unsound-pow.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
lower-unsound-pow.f6478.1%
Applied rewrites79.5%
lift-/.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-divN/A
sub-negate-revN/A
metadata-evalN/A
metadata-evalN/A
pow-negN/A
lower-unsound-/.f64N/A
lower-unsound-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-eval79.4%
Applied rewrites79.4%
Taylor expanded in angle around 0
Applied rewrites79.3%
Taylor expanded in angle around 0
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f6474.4%
Applied rewrites74.4%
if 9.4999999999999995e-11 < angle Initial program 79.5%
lift-pow.f64N/A
metadata-evalN/A
pow-subN/A
lower-unsound-/.f64N/A
lower-unsound-pow.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
lower-unsound-pow.f6478.1%
Applied rewrites79.5%
lift-/.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-divN/A
sub-negate-revN/A
metadata-evalN/A
metadata-evalN/A
pow-negN/A
lower-unsound-/.f64N/A
lower-unsound-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-eval79.4%
Applied rewrites79.4%
Taylor expanded in angle around 0
Applied rewrites79.3%
Applied rewrites67.8%
(FPCore (a b angle) :precision binary64 (+ (pow (* a 1.0) 2.0) (/ 1.0 (pow (* 0.005555555555555556 (* angle (* b PI))) -2.0))))
double code(double a, double b, double angle) {
return pow((a * 1.0), 2.0) + (1.0 / pow((0.005555555555555556 * (angle * (b * ((double) M_PI)))), -2.0));
}
public static double code(double a, double b, double angle) {
return Math.pow((a * 1.0), 2.0) + (1.0 / Math.pow((0.005555555555555556 * (angle * (b * Math.PI))), -2.0));
}
def code(a, b, angle): return math.pow((a * 1.0), 2.0) + (1.0 / math.pow((0.005555555555555556 * (angle * (b * math.pi))), -2.0))
function code(a, b, angle) return Float64((Float64(a * 1.0) ^ 2.0) + Float64(1.0 / (Float64(0.005555555555555556 * Float64(angle * Float64(b * pi))) ^ -2.0))) end
function tmp = code(a, b, angle) tmp = ((a * 1.0) ^ 2.0) + (1.0 / ((0.005555555555555556 * (angle * (b * pi))) ^ -2.0)); end
code[a_, b_, angle_] := N[(N[Power[N[(a * 1.0), $MachinePrecision], 2.0], $MachinePrecision] + N[(1.0 / N[Power[N[(0.005555555555555556 * N[(angle * N[(b * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
{\left(a \cdot 1\right)}^{2} + \frac{1}{{\left(0.005555555555555556 \cdot \left(angle \cdot \left(b \cdot \pi\right)\right)\right)}^{-2}}
Initial program 79.5%
lift-pow.f64N/A
metadata-evalN/A
pow-subN/A
lower-unsound-/.f64N/A
lower-unsound-pow.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
lower-unsound-pow.f6478.1%
Applied rewrites79.5%
lift-/.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-divN/A
sub-negate-revN/A
metadata-evalN/A
metadata-evalN/A
pow-negN/A
lower-unsound-/.f64N/A
lower-unsound-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-eval79.4%
Applied rewrites79.4%
Taylor expanded in angle around 0
Applied rewrites79.3%
Taylor expanded in angle around 0
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f6474.4%
Applied rewrites74.4%
(FPCore (a b angle)
:precision binary64
(if (<= (fabs angle) 2.7e-158)
(* (pow a 2.0) (+ 1.0 (* -0.00030461741978670857 (pow (fabs angle) 2.0))))
(fma
a
a
(*
(* (* PI PI) (* 3.08641975308642e-5 (pow b 2.0)))
(* (fabs angle) (fabs angle))))))double code(double a, double b, double angle) {
double tmp;
if (fabs(angle) <= 2.7e-158) {
tmp = pow(a, 2.0) * (1.0 + (-0.00030461741978670857 * pow(fabs(angle), 2.0)));
} else {
tmp = fma(a, a, (((((double) M_PI) * ((double) M_PI)) * (3.08641975308642e-5 * pow(b, 2.0))) * (fabs(angle) * fabs(angle))));
}
return tmp;
}
function code(a, b, angle) tmp = 0.0 if (abs(angle) <= 2.7e-158) tmp = Float64((a ^ 2.0) * Float64(1.0 + Float64(-0.00030461741978670857 * (abs(angle) ^ 2.0)))); else tmp = fma(a, a, Float64(Float64(Float64(pi * pi) * Float64(3.08641975308642e-5 * (b ^ 2.0))) * Float64(abs(angle) * abs(angle)))); end return tmp end
code[a_, b_, angle_] := If[LessEqual[N[Abs[angle], $MachinePrecision], 2.7e-158], N[(N[Power[a, 2.0], $MachinePrecision] * N[(1.0 + N[(-0.00030461741978670857 * N[Power[N[Abs[angle], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * a + N[(N[(N[(Pi * Pi), $MachinePrecision] * N[(3.08641975308642e-5 * N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Abs[angle], $MachinePrecision] * N[Abs[angle], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\left|angle\right| \leq 2.7 \cdot 10^{-158}:\\
\;\;\;\;{a}^{2} \cdot \left(1 + -0.00030461741978670857 \cdot {\left(\left|angle\right|\right)}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, a, \left(\left(\pi \cdot \pi\right) \cdot \left(3.08641975308642 \cdot 10^{-5} \cdot {b}^{2}\right)\right) \cdot \left(\left|angle\right| \cdot \left|angle\right|\right)\right)\\
\end{array}
if angle < 2.6999999999999998e-158Initial program 79.5%
Taylor expanded in angle around 0
lower-fma.f64N/A
Applied rewrites40.9%
lift-fma.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6440.9%
Applied rewrites40.9%
Evaluated real constant40.9%
Taylor expanded in a around inf
lower-*.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6439.3%
Applied rewrites39.3%
if 2.6999999999999998e-158 < angle Initial program 79.5%
Taylor expanded in angle around 0
lower-fma.f64N/A
Applied rewrites40.9%
lift-fma.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6440.9%
Applied rewrites40.9%
Taylor expanded in a around 0
lower-*.f64N/A
lower-pow.f6463.8%
Applied rewrites63.8%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* PI (/ angle 180.0))))
(if (<= (+ (pow (* a (cos t_0)) 2.0) (pow (* b (sin t_0)) 2.0)) 4e+149)
(fma
(* (* (* -3.08641975308642e-5 (- (* a a) (* b b))) (* PI PI)) (- angle))
(- angle)
(* a a))
(fma
a
a
(* (* (* PI PI) (* 3.08641975308642e-5 (pow b 2.0))) (* angle angle))))))double code(double a, double b, double angle) {
double t_0 = ((double) M_PI) * (angle / 180.0);
double tmp;
if ((pow((a * cos(t_0)), 2.0) + pow((b * sin(t_0)), 2.0)) <= 4e+149) {
tmp = fma((((-3.08641975308642e-5 * ((a * a) - (b * b))) * (((double) M_PI) * ((double) M_PI))) * -angle), -angle, (a * a));
} else {
tmp = fma(a, a, (((((double) M_PI) * ((double) M_PI)) * (3.08641975308642e-5 * pow(b, 2.0))) * (angle * angle)));
}
return tmp;
}
function code(a, b, angle) t_0 = Float64(pi * Float64(angle / 180.0)) tmp = 0.0 if (Float64((Float64(a * cos(t_0)) ^ 2.0) + (Float64(b * sin(t_0)) ^ 2.0)) <= 4e+149) tmp = fma(Float64(Float64(Float64(-3.08641975308642e-5 * Float64(Float64(a * a) - Float64(b * b))) * Float64(pi * pi)) * Float64(-angle)), Float64(-angle), Float64(a * a)); else tmp = fma(a, a, Float64(Float64(Float64(pi * pi) * Float64(3.08641975308642e-5 * (b ^ 2.0))) * Float64(angle * angle))); end return tmp end
code[a_, b_, angle_] := Block[{t$95$0 = N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[Power[N[(a * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], 4e+149], N[(N[(N[(N[(-3.08641975308642e-5 * N[(N[(a * a), $MachinePrecision] - N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(Pi * Pi), $MachinePrecision]), $MachinePrecision] * (-angle)), $MachinePrecision] * (-angle) + N[(a * a), $MachinePrecision]), $MachinePrecision], N[(a * a + N[(N[(N[(Pi * Pi), $MachinePrecision] * N[(3.08641975308642e-5 * N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(angle * angle), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \pi \cdot \frac{angle}{180}\\
\mathbf{if}\;{\left(a \cdot \cos t\_0\right)}^{2} + {\left(b \cdot \sin t\_0\right)}^{2} \leq 4 \cdot 10^{+149}:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(-3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot a - b \cdot b\right)\right) \cdot \left(\pi \cdot \pi\right)\right) \cdot \left(-angle\right), -angle, a \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, a, \left(\left(\pi \cdot \pi\right) \cdot \left(3.08641975308642 \cdot 10^{-5} \cdot {b}^{2}\right)\right) \cdot \left(angle \cdot angle\right)\right)\\
\end{array}
if (+.f64 (pow.f64 (*.f64 a (cos.f64 (*.f64 (PI.f64) (/.f64 angle #s(literal 180 binary64))))) #s(literal 2 binary64)) (pow.f64 (*.f64 b (sin.f64 (*.f64 (PI.f64) (/.f64 angle #s(literal 180 binary64))))) #s(literal 2 binary64))) < 4.0000000000000002e149Initial program 79.5%
Taylor expanded in angle around 0
lower-fma.f64N/A
Applied rewrites40.9%
lift-fma.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6440.9%
Applied rewrites40.9%
lift-fma.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
sqr-neg-revN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites43.3%
if 4.0000000000000002e149 < (+.f64 (pow.f64 (*.f64 a (cos.f64 (*.f64 (PI.f64) (/.f64 angle #s(literal 180 binary64))))) #s(literal 2 binary64)) (pow.f64 (*.f64 b (sin.f64 (*.f64 (PI.f64) (/.f64 angle #s(literal 180 binary64))))) #s(literal 2 binary64))) Initial program 79.5%
Taylor expanded in angle around 0
lower-fma.f64N/A
Applied rewrites40.9%
lift-fma.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6440.9%
Applied rewrites40.9%
Taylor expanded in a around 0
lower-*.f64N/A
lower-pow.f6463.8%
Applied rewrites63.8%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* PI (/ angle 180.0))))
(if (<= (+ (pow (* a (cos t_0)) 2.0) (pow (* b (sin t_0)) 2.0)) 4e+149)
(fma
(* (* (* -3.08641975308642e-5 (- (* a a) (* b b))) (* PI PI)) (- angle))
(- angle)
(* a a))
(fma a a (* (* 0.00030461741978670857 (pow b 2.0)) (* angle angle))))))double code(double a, double b, double angle) {
double t_0 = ((double) M_PI) * (angle / 180.0);
double tmp;
if ((pow((a * cos(t_0)), 2.0) + pow((b * sin(t_0)), 2.0)) <= 4e+149) {
tmp = fma((((-3.08641975308642e-5 * ((a * a) - (b * b))) * (((double) M_PI) * ((double) M_PI))) * -angle), -angle, (a * a));
} else {
tmp = fma(a, a, ((0.00030461741978670857 * pow(b, 2.0)) * (angle * angle)));
}
return tmp;
}
function code(a, b, angle) t_0 = Float64(pi * Float64(angle / 180.0)) tmp = 0.0 if (Float64((Float64(a * cos(t_0)) ^ 2.0) + (Float64(b * sin(t_0)) ^ 2.0)) <= 4e+149) tmp = fma(Float64(Float64(Float64(-3.08641975308642e-5 * Float64(Float64(a * a) - Float64(b * b))) * Float64(pi * pi)) * Float64(-angle)), Float64(-angle), Float64(a * a)); else tmp = fma(a, a, Float64(Float64(0.00030461741978670857 * (b ^ 2.0)) * Float64(angle * angle))); end return tmp end
code[a_, b_, angle_] := Block[{t$95$0 = N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[Power[N[(a * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], 4e+149], N[(N[(N[(N[(-3.08641975308642e-5 * N[(N[(a * a), $MachinePrecision] - N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(Pi * Pi), $MachinePrecision]), $MachinePrecision] * (-angle)), $MachinePrecision] * (-angle) + N[(a * a), $MachinePrecision]), $MachinePrecision], N[(a * a + N[(N[(0.00030461741978670857 * N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision] * N[(angle * angle), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \pi \cdot \frac{angle}{180}\\
\mathbf{if}\;{\left(a \cdot \cos t\_0\right)}^{2} + {\left(b \cdot \sin t\_0\right)}^{2} \leq 4 \cdot 10^{+149}:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(-3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot a - b \cdot b\right)\right) \cdot \left(\pi \cdot \pi\right)\right) \cdot \left(-angle\right), -angle, a \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, a, \left(0.00030461741978670857 \cdot {b}^{2}\right) \cdot \left(angle \cdot angle\right)\right)\\
\end{array}
if (+.f64 (pow.f64 (*.f64 a (cos.f64 (*.f64 (PI.f64) (/.f64 angle #s(literal 180 binary64))))) #s(literal 2 binary64)) (pow.f64 (*.f64 b (sin.f64 (*.f64 (PI.f64) (/.f64 angle #s(literal 180 binary64))))) #s(literal 2 binary64))) < 4.0000000000000002e149Initial program 79.5%
Taylor expanded in angle around 0
lower-fma.f64N/A
Applied rewrites40.9%
lift-fma.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6440.9%
Applied rewrites40.9%
lift-fma.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
sqr-neg-revN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites43.3%
if 4.0000000000000002e149 < (+.f64 (pow.f64 (*.f64 a (cos.f64 (*.f64 (PI.f64) (/.f64 angle #s(literal 180 binary64))))) #s(literal 2 binary64)) (pow.f64 (*.f64 b (sin.f64 (*.f64 (PI.f64) (/.f64 angle #s(literal 180 binary64))))) #s(literal 2 binary64))) Initial program 79.5%
Taylor expanded in angle around 0
lower-fma.f64N/A
Applied rewrites40.9%
lift-fma.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6440.9%
Applied rewrites40.9%
Evaluated real constant40.9%
Taylor expanded in a around 0
lower-*.f64N/A
lower-pow.f6463.8%
Applied rewrites63.8%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* (fabs angle) (fabs angle))))
(if (<= (fabs angle) 2.7e-158)
(fma a a (* (* -0.00030461741978670857 (pow a 2.0)) t_0))
(fma
a
a
(*
(fma
(* 9.869604401089358 a)
(* -3.08641975308642e-5 a)
(* 0.00030461741978670857 (* b b)))
t_0)))))double code(double a, double b, double angle) {
double t_0 = fabs(angle) * fabs(angle);
double tmp;
if (fabs(angle) <= 2.7e-158) {
tmp = fma(a, a, ((-0.00030461741978670857 * pow(a, 2.0)) * t_0));
} else {
tmp = fma(a, a, (fma((9.869604401089358 * a), (-3.08641975308642e-5 * a), (0.00030461741978670857 * (b * b))) * t_0));
}
return tmp;
}
function code(a, b, angle) t_0 = Float64(abs(angle) * abs(angle)) tmp = 0.0 if (abs(angle) <= 2.7e-158) tmp = fma(a, a, Float64(Float64(-0.00030461741978670857 * (a ^ 2.0)) * t_0)); else tmp = fma(a, a, Float64(fma(Float64(9.869604401089358 * a), Float64(-3.08641975308642e-5 * a), Float64(0.00030461741978670857 * Float64(b * b))) * t_0)); end return tmp end
code[a_, b_, angle_] := Block[{t$95$0 = N[(N[Abs[angle], $MachinePrecision] * N[Abs[angle], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[angle], $MachinePrecision], 2.7e-158], N[(a * a + N[(N[(-0.00030461741978670857 * N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], N[(a * a + N[(N[(N[(9.869604401089358 * a), $MachinePrecision] * N[(-3.08641975308642e-5 * a), $MachinePrecision] + N[(0.00030461741978670857 * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \left|angle\right| \cdot \left|angle\right|\\
\mathbf{if}\;\left|angle\right| \leq 2.7 \cdot 10^{-158}:\\
\;\;\;\;\mathsf{fma}\left(a, a, \left(-0.00030461741978670857 \cdot {a}^{2}\right) \cdot t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, a, \mathsf{fma}\left(9.869604401089358 \cdot a, -3.08641975308642 \cdot 10^{-5} \cdot a, 0.00030461741978670857 \cdot \left(b \cdot b\right)\right) \cdot t\_0\right)\\
\end{array}
if angle < 2.6999999999999998e-158Initial program 79.5%
Taylor expanded in angle around 0
lower-fma.f64N/A
Applied rewrites40.9%
lift-fma.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6440.9%
Applied rewrites40.9%
Evaluated real constant40.9%
Taylor expanded in a around inf
lower-*.f64N/A
lower-pow.f6427.1%
Applied rewrites27.1%
if 2.6999999999999998e-158 < angle Initial program 79.5%
Taylor expanded in angle around 0
lower-fma.f64N/A
Applied rewrites40.9%
lift-fma.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6440.9%
Applied rewrites40.9%
Evaluated real constant40.9%
lift-*.f64N/A
lift-fma.f64N/A
distribute-rgt-inN/A
*-commutativeN/A
lift-*.f64N/A
associate-*l*N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
metadata-eval45.8%
Applied rewrites45.8%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* (fabs a) (fabs a))))
(if (<= (fabs a) 5e+152)
(fma
(* (* (* -3.08641975308642e-5 (- t_0 (* b b))) (* PI PI)) (- angle))
(- angle)
t_0)
(fma
(fabs a)
(fabs a)
(*
(fma
(* 9.869604401089358 (fabs a))
(* -3.08641975308642e-5 (fabs a))
(* 0.00030461741978670857 (* b b)))
(* angle angle))))))double code(double a, double b, double angle) {
double t_0 = fabs(a) * fabs(a);
double tmp;
if (fabs(a) <= 5e+152) {
tmp = fma((((-3.08641975308642e-5 * (t_0 - (b * b))) * (((double) M_PI) * ((double) M_PI))) * -angle), -angle, t_0);
} else {
tmp = fma(fabs(a), fabs(a), (fma((9.869604401089358 * fabs(a)), (-3.08641975308642e-5 * fabs(a)), (0.00030461741978670857 * (b * b))) * (angle * angle)));
}
return tmp;
}
function code(a, b, angle) t_0 = Float64(abs(a) * abs(a)) tmp = 0.0 if (abs(a) <= 5e+152) tmp = fma(Float64(Float64(Float64(-3.08641975308642e-5 * Float64(t_0 - Float64(b * b))) * Float64(pi * pi)) * Float64(-angle)), Float64(-angle), t_0); else tmp = fma(abs(a), abs(a), Float64(fma(Float64(9.869604401089358 * abs(a)), Float64(-3.08641975308642e-5 * abs(a)), Float64(0.00030461741978670857 * Float64(b * b))) * Float64(angle * angle))); end return tmp end
code[a_, b_, angle_] := Block[{t$95$0 = N[(N[Abs[a], $MachinePrecision] * N[Abs[a], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[a], $MachinePrecision], 5e+152], N[(N[(N[(N[(-3.08641975308642e-5 * N[(t$95$0 - N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(Pi * Pi), $MachinePrecision]), $MachinePrecision] * (-angle)), $MachinePrecision] * (-angle) + t$95$0), $MachinePrecision], N[(N[Abs[a], $MachinePrecision] * N[Abs[a], $MachinePrecision] + N[(N[(N[(9.869604401089358 * N[Abs[a], $MachinePrecision]), $MachinePrecision] * N[(-3.08641975308642e-5 * N[Abs[a], $MachinePrecision]), $MachinePrecision] + N[(0.00030461741978670857 * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(angle * angle), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \left|a\right| \cdot \left|a\right|\\
\mathbf{if}\;\left|a\right| \leq 5 \cdot 10^{+152}:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(-3.08641975308642 \cdot 10^{-5} \cdot \left(t\_0 - b \cdot b\right)\right) \cdot \left(\pi \cdot \pi\right)\right) \cdot \left(-angle\right), -angle, t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left|a\right|, \left|a\right|, \mathsf{fma}\left(9.869604401089358 \cdot \left|a\right|, -3.08641975308642 \cdot 10^{-5} \cdot \left|a\right|, 0.00030461741978670857 \cdot \left(b \cdot b\right)\right) \cdot \left(angle \cdot angle\right)\right)\\
\end{array}
if a < 5e152Initial program 79.5%
Taylor expanded in angle around 0
lower-fma.f64N/A
Applied rewrites40.9%
lift-fma.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6440.9%
Applied rewrites40.9%
lift-fma.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
sqr-neg-revN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites43.3%
if 5e152 < a Initial program 79.5%
Taylor expanded in angle around 0
lower-fma.f64N/A
Applied rewrites40.9%
lift-fma.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6440.9%
Applied rewrites40.9%
Evaluated real constant40.9%
lift-*.f64N/A
lift-fma.f64N/A
distribute-rgt-inN/A
*-commutativeN/A
lift-*.f64N/A
associate-*l*N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
metadata-eval45.8%
Applied rewrites45.8%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* PI (/ angle 180.0))) (t_1 (* 0.00030461741978670857 (* b b))))
(if (<= (+ (pow (* a (cos t_0)) 2.0) (pow (* b (sin t_0)) 2.0)) 4e+305)
(fma (* (fma -0.00030461741978670857 (* a a) t_1) angle) angle (* a a))
(fma
a
a
(*
(fma (* 9.869604401089358 a) (* -3.08641975308642e-5 a) t_1)
(* angle angle))))))double code(double a, double b, double angle) {
double t_0 = ((double) M_PI) * (angle / 180.0);
double t_1 = 0.00030461741978670857 * (b * b);
double tmp;
if ((pow((a * cos(t_0)), 2.0) + pow((b * sin(t_0)), 2.0)) <= 4e+305) {
tmp = fma((fma(-0.00030461741978670857, (a * a), t_1) * angle), angle, (a * a));
} else {
tmp = fma(a, a, (fma((9.869604401089358 * a), (-3.08641975308642e-5 * a), t_1) * (angle * angle)));
}
return tmp;
}
function code(a, b, angle) t_0 = Float64(pi * Float64(angle / 180.0)) t_1 = Float64(0.00030461741978670857 * Float64(b * b)) tmp = 0.0 if (Float64((Float64(a * cos(t_0)) ^ 2.0) + (Float64(b * sin(t_0)) ^ 2.0)) <= 4e+305) tmp = fma(Float64(fma(-0.00030461741978670857, Float64(a * a), t_1) * angle), angle, Float64(a * a)); else tmp = fma(a, a, Float64(fma(Float64(9.869604401089358 * a), Float64(-3.08641975308642e-5 * a), t_1) * Float64(angle * angle))); end return tmp end
code[a_, b_, angle_] := Block[{t$95$0 = N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.00030461741978670857 * N[(b * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[Power[N[(a * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], 4e+305], N[(N[(N[(-0.00030461741978670857 * N[(a * a), $MachinePrecision] + t$95$1), $MachinePrecision] * angle), $MachinePrecision] * angle + N[(a * a), $MachinePrecision]), $MachinePrecision], N[(a * a + N[(N[(N[(9.869604401089358 * a), $MachinePrecision] * N[(-3.08641975308642e-5 * a), $MachinePrecision] + t$95$1), $MachinePrecision] * N[(angle * angle), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \pi \cdot \frac{angle}{180}\\
t_1 := 0.00030461741978670857 \cdot \left(b \cdot b\right)\\
\mathbf{if}\;{\left(a \cdot \cos t\_0\right)}^{2} + {\left(b \cdot \sin t\_0\right)}^{2} \leq 4 \cdot 10^{+305}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-0.00030461741978670857, a \cdot a, t\_1\right) \cdot angle, angle, a \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, a, \mathsf{fma}\left(9.869604401089358 \cdot a, -3.08641975308642 \cdot 10^{-5} \cdot a, t\_1\right) \cdot \left(angle \cdot angle\right)\right)\\
\end{array}
if (+.f64 (pow.f64 (*.f64 a (cos.f64 (*.f64 (PI.f64) (/.f64 angle #s(literal 180 binary64))))) #s(literal 2 binary64)) (pow.f64 (*.f64 b (sin.f64 (*.f64 (PI.f64) (/.f64 angle #s(literal 180 binary64))))) #s(literal 2 binary64))) < 3.9999999999999998e305Initial program 79.5%
Taylor expanded in angle around 0
lower-fma.f64N/A
Applied rewrites40.9%
lift-fma.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6440.9%
Applied rewrites40.9%
Evaluated real constant40.9%
lift-fma.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites43.3%
if 3.9999999999999998e305 < (+.f64 (pow.f64 (*.f64 a (cos.f64 (*.f64 (PI.f64) (/.f64 angle #s(literal 180 binary64))))) #s(literal 2 binary64)) (pow.f64 (*.f64 b (sin.f64 (*.f64 (PI.f64) (/.f64 angle #s(literal 180 binary64))))) #s(literal 2 binary64))) Initial program 79.5%
Taylor expanded in angle around 0
lower-fma.f64N/A
Applied rewrites40.9%
lift-fma.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6440.9%
Applied rewrites40.9%
Evaluated real constant40.9%
lift-*.f64N/A
lift-fma.f64N/A
distribute-rgt-inN/A
*-commutativeN/A
lift-*.f64N/A
associate-*l*N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
metadata-eval45.8%
Applied rewrites45.8%
(FPCore (a b angle) :precision binary64 (fma (* (fma -0.00030461741978670857 (* a a) (* 0.00030461741978670857 (* b b))) angle) angle (* a a)))
double code(double a, double b, double angle) {
return fma((fma(-0.00030461741978670857, (a * a), (0.00030461741978670857 * (b * b))) * angle), angle, (a * a));
}
function code(a, b, angle) return fma(Float64(fma(-0.00030461741978670857, Float64(a * a), Float64(0.00030461741978670857 * Float64(b * b))) * angle), angle, Float64(a * a)) end
code[a_, b_, angle_] := N[(N[(N[(-0.00030461741978670857 * N[(a * a), $MachinePrecision] + N[(0.00030461741978670857 * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * angle), $MachinePrecision] * angle + N[(a * a), $MachinePrecision]), $MachinePrecision]
\mathsf{fma}\left(\mathsf{fma}\left(-0.00030461741978670857, a \cdot a, 0.00030461741978670857 \cdot \left(b \cdot b\right)\right) \cdot angle, angle, a \cdot a\right)
Initial program 79.5%
Taylor expanded in angle around 0
lower-fma.f64N/A
Applied rewrites40.9%
lift-fma.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6440.9%
Applied rewrites40.9%
Evaluated real constant40.9%
lift-fma.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites43.3%
(FPCore (a b angle)
:precision binary64
(fma
a
a
(*
(*
(fma -0.00030461741978670857 (* a a) (* 0.00030461741978670857 (* b b)))
angle)
angle)))double code(double a, double b, double angle) {
return fma(a, a, ((fma(-0.00030461741978670857, (a * a), (0.00030461741978670857 * (b * b))) * angle) * angle));
}
function code(a, b, angle) return fma(a, a, Float64(Float64(fma(-0.00030461741978670857, Float64(a * a), Float64(0.00030461741978670857 * Float64(b * b))) * angle) * angle)) end
code[a_, b_, angle_] := N[(a * a + N[(N[(N[(-0.00030461741978670857 * N[(a * a), $MachinePrecision] + N[(0.00030461741978670857 * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * angle), $MachinePrecision] * angle), $MachinePrecision]), $MachinePrecision]
\mathsf{fma}\left(a, a, \left(\mathsf{fma}\left(-0.00030461741978670857, a \cdot a, 0.00030461741978670857 \cdot \left(b \cdot b\right)\right) \cdot angle\right) \cdot angle\right)
Initial program 79.5%
Taylor expanded in angle around 0
lower-fma.f64N/A
Applied rewrites40.9%
lift-fma.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6440.9%
Applied rewrites40.9%
Evaluated real constant40.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites43.3%
herbie shell --seed 2025207
(FPCore (a b angle)
:name "ab-angle->ABCF C"
:precision binary64
(+ (pow (* a (cos (* PI (/ angle 180.0)))) 2.0) (pow (* b (sin (* PI (/ angle 180.0)))) 2.0)))