
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* (/ angle 180.0) PI))) (+ (pow (* a (sin t_0)) 2.0) (pow (* b (cos t_0)) 2.0))))
double code(double a, double b, double angle) {
double t_0 = (angle / 180.0) * ((double) M_PI);
return pow((a * sin(t_0)), 2.0) + pow((b * cos(t_0)), 2.0);
}
public static double code(double a, double b, double angle) {
double t_0 = (angle / 180.0) * Math.PI;
return Math.pow((a * Math.sin(t_0)), 2.0) + Math.pow((b * Math.cos(t_0)), 2.0);
}
def code(a, b, angle): t_0 = (angle / 180.0) * math.pi return math.pow((a * math.sin(t_0)), 2.0) + math.pow((b * math.cos(t_0)), 2.0)
function code(a, b, angle) t_0 = Float64(Float64(angle / 180.0) * pi) return Float64((Float64(a * sin(t_0)) ^ 2.0) + (Float64(b * cos(t_0)) ^ 2.0)) end
function tmp = code(a, b, angle) t_0 = (angle / 180.0) * pi; tmp = ((a * sin(t_0)) ^ 2.0) + ((b * cos(t_0)) ^ 2.0); end
code[a_, b_, angle_] := Block[{t$95$0 = N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]}, N[(N[Power[N[(a * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{angle}{180} \cdot \pi\\
{\left(a \cdot \sin t\_0\right)}^{2} + {\left(b \cdot \cos t\_0\right)}^{2}
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* (/ angle 180.0) PI))) (+ (pow (* a (sin t_0)) 2.0) (pow (* b (cos t_0)) 2.0))))
double code(double a, double b, double angle) {
double t_0 = (angle / 180.0) * ((double) M_PI);
return pow((a * sin(t_0)), 2.0) + pow((b * cos(t_0)), 2.0);
}
public static double code(double a, double b, double angle) {
double t_0 = (angle / 180.0) * Math.PI;
return Math.pow((a * Math.sin(t_0)), 2.0) + Math.pow((b * Math.cos(t_0)), 2.0);
}
def code(a, b, angle): t_0 = (angle / 180.0) * math.pi return math.pow((a * math.sin(t_0)), 2.0) + math.pow((b * math.cos(t_0)), 2.0)
function code(a, b, angle) t_0 = Float64(Float64(angle / 180.0) * pi) return Float64((Float64(a * sin(t_0)) ^ 2.0) + (Float64(b * cos(t_0)) ^ 2.0)) end
function tmp = code(a, b, angle) t_0 = (angle / 180.0) * pi; tmp = ((a * sin(t_0)) ^ 2.0) + ((b * cos(t_0)) ^ 2.0); end
code[a_, b_, angle_] := Block[{t$95$0 = N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]}, N[(N[Power[N[(a * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{angle}{180} \cdot \pi\\
{\left(a \cdot \sin t\_0\right)}^{2} + {\left(b \cdot \cos t\_0\right)}^{2}
\end{array}
\end{array}
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* (/ angle 180.0) PI))) (+ (pow (* a (sin t_0)) 2.0) (pow (* b (cos t_0)) 2.0))))
double code(double a, double b, double angle) {
double t_0 = (angle / 180.0) * ((double) M_PI);
return pow((a * sin(t_0)), 2.0) + pow((b * cos(t_0)), 2.0);
}
public static double code(double a, double b, double angle) {
double t_0 = (angle / 180.0) * Math.PI;
return Math.pow((a * Math.sin(t_0)), 2.0) + Math.pow((b * Math.cos(t_0)), 2.0);
}
def code(a, b, angle): t_0 = (angle / 180.0) * math.pi return math.pow((a * math.sin(t_0)), 2.0) + math.pow((b * math.cos(t_0)), 2.0)
function code(a, b, angle) t_0 = Float64(Float64(angle / 180.0) * pi) return Float64((Float64(a * sin(t_0)) ^ 2.0) + (Float64(b * cos(t_0)) ^ 2.0)) end
function tmp = code(a, b, angle) t_0 = (angle / 180.0) * pi; tmp = ((a * sin(t_0)) ^ 2.0) + ((b * cos(t_0)) ^ 2.0); end
code[a_, b_, angle_] := Block[{t$95$0 = N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]}, N[(N[Power[N[(a * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{angle}{180} \cdot \pi\\
{\left(a \cdot \sin t\_0\right)}^{2} + {\left(b \cdot \cos t\_0\right)}^{2}
\end{array}
\end{array}
Initial program 80.6%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (* (/ angle 180.0) PI))) 2.0) (pow (* b (cos (* (* 0.005555555555555556 angle) PI))) 2.0)))
double code(double a, double b, double angle) {
return pow((a * sin(((angle / 180.0) * ((double) M_PI)))), 2.0) + pow((b * cos(((0.005555555555555556 * angle) * ((double) M_PI)))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.sin(((angle / 180.0) * Math.PI))), 2.0) + Math.pow((b * Math.cos(((0.005555555555555556 * angle) * Math.PI))), 2.0);
}
def code(a, b, angle): return math.pow((a * math.sin(((angle / 180.0) * math.pi))), 2.0) + math.pow((b * math.cos(((0.005555555555555556 * angle) * math.pi))), 2.0)
function code(a, b, angle) return Float64((Float64(a * sin(Float64(Float64(angle / 180.0) * pi))) ^ 2.0) + (Float64(b * cos(Float64(Float64(0.005555555555555556 * angle) * pi))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((a * sin(((angle / 180.0) * pi))) ^ 2.0) + ((b * cos(((0.005555555555555556 * angle) * pi))) ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Sin[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[N[(N[(0.005555555555555556 * angle), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\left(0.005555555555555556 \cdot angle\right) \cdot \pi\right)\right)}^{2}
\end{array}
Initial program 80.6%
Taylor expanded in angle around 0
lower-*.f6480.6
Applied rewrites80.6%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* (* PI angle) 0.005555555555555556)))
(+
(pow (* a (sin (* (/ angle 180.0) PI))) 2.0)
(pow
(*
(*
(pow (/ -1.0 b) -1.0)
(fma
(sin (* 0.5 PI))
(cos t_0)
(* (sin (fma 0.5 PI (/ PI 2.0))) (sin t_0))))
-1.0)
2.0))))
double code(double a, double b, double angle) {
double t_0 = (((double) M_PI) * angle) * 0.005555555555555556;
return pow((a * sin(((angle / 180.0) * ((double) M_PI)))), 2.0) + pow(((pow((-1.0 / b), -1.0) * fma(sin((0.5 * ((double) M_PI))), cos(t_0), (sin(fma(0.5, ((double) M_PI), (((double) M_PI) / 2.0))) * sin(t_0)))) * -1.0), 2.0);
}
function code(a, b, angle) t_0 = Float64(Float64(pi * angle) * 0.005555555555555556) return Float64((Float64(a * sin(Float64(Float64(angle / 180.0) * pi))) ^ 2.0) + (Float64(Float64((Float64(-1.0 / b) ^ -1.0) * fma(sin(Float64(0.5 * pi)), cos(t_0), Float64(sin(fma(0.5, pi, Float64(pi / 2.0))) * sin(t_0)))) * -1.0) ^ 2.0)) end
code[a_, b_, angle_] := Block[{t$95$0 = N[(N[(Pi * angle), $MachinePrecision] * 0.005555555555555556), $MachinePrecision]}, N[(N[Power[N[(a * N[Sin[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(N[(N[Power[N[(-1.0 / b), $MachinePrecision], -1.0], $MachinePrecision] * N[(N[Sin[N[(0.5 * Pi), $MachinePrecision]], $MachinePrecision] * N[Cos[t$95$0], $MachinePrecision] + N[(N[Sin[N[(0.5 * Pi + N[(Pi / 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -1.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\pi \cdot angle\right) \cdot 0.005555555555555556\\
{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(\left({\left(\frac{-1}{b}\right)}^{-1} \cdot \mathsf{fma}\left(\sin \left(0.5 \cdot \pi\right), \cos t\_0, \sin \left(\mathsf{fma}\left(0.5, \pi, \frac{\pi}{2}\right)\right) \cdot \sin t\_0\right)\right) \cdot -1\right)}^{2}
\end{array}
\end{array}
Initial program 80.6%
lift-pow.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow-to-expN/A
exp-prodN/A
lower-pow.f64N/A
Applied rewrites30.4%
Taylor expanded in b around -inf
+-commutativeN/A
exp-sumN/A
rem-exp-logN/A
rem-exp-logN/A
lift-/.f64N/A
sin-+PI/2N/A
*-commutativeN/A
lift-/.f64N/A
Applied rewrites80.3%
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
lower-*.f64N/A
Applied rewrites80.5%
(FPCore (a b angle) :precision binary64 (let* ((t_0 (sin (fma 0.5 PI (* -0.005555555555555556 (* angle PI)))))) (+ (pow (* a (sin (* (/ angle 180.0) PI))) 2.0) (* (* b b) (* t_0 t_0)))))
double code(double a, double b, double angle) {
double t_0 = sin(fma(0.5, ((double) M_PI), (-0.005555555555555556 * (angle * ((double) M_PI)))));
return pow((a * sin(((angle / 180.0) * ((double) M_PI)))), 2.0) + ((b * b) * (t_0 * t_0));
}
function code(a, b, angle) t_0 = sin(fma(0.5, pi, Float64(-0.005555555555555556 * Float64(angle * pi)))) return Float64((Float64(a * sin(Float64(Float64(angle / 180.0) * pi))) ^ 2.0) + Float64(Float64(b * b) * Float64(t_0 * t_0))) end
code[a_, b_, angle_] := Block[{t$95$0 = N[Sin[N[(0.5 * Pi + N[(-0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[(N[Power[N[(a * N[Sin[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(\mathsf{fma}\left(0.5, \pi, -0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)\\
{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + \left(b \cdot b\right) \cdot \left(t\_0 \cdot t\_0\right)
\end{array}
\end{array}
Initial program 80.6%
lift-cos.f64N/A
cos-neg-revN/A
sin-+PI/2-revN/A
lower-sin.f64N/A
lower-+.f64N/A
lower-neg.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-PI.f64N/A
lower-/.f64N/A
lift-PI.f6480.5
Applied rewrites80.5%
Taylor expanded in b around 0
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
unpow2N/A
lower-*.f64N/A
Applied rewrites80.4%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (* (/ angle 180.0) PI))) 2.0) (* (pow (sin (fma 0.5 PI (* (* PI angle) 0.005555555555555556))) 2.0) (* b b))))
double code(double a, double b, double angle) {
return pow((a * sin(((angle / 180.0) * ((double) M_PI)))), 2.0) + (pow(sin(fma(0.5, ((double) M_PI), ((((double) M_PI) * angle) * 0.005555555555555556))), 2.0) * (b * b));
}
function code(a, b, angle) return Float64((Float64(a * sin(Float64(Float64(angle / 180.0) * pi))) ^ 2.0) + Float64((sin(fma(0.5, pi, Float64(Float64(pi * angle) * 0.005555555555555556))) ^ 2.0) * Float64(b * b))) end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Sin[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(N[Power[N[Sin[N[(0.5 * Pi + N[(N[(Pi * angle), $MachinePrecision] * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\sin \left(\mathsf{fma}\left(0.5, \pi, \left(\pi \cdot angle\right) \cdot 0.005555555555555556\right)\right)}^{2} \cdot \left(b \cdot b\right)
\end{array}
Initial program 80.6%
lift-pow.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow-to-expN/A
exp-prodN/A
lower-pow.f64N/A
Applied rewrites30.4%
Taylor expanded in b around 0
Applied rewrites80.4%
Final simplification80.4%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (sin (fma 0.005555555555555556 (* angle PI) (* 0.5 PI))))
(t_1 (sin (* 0.005555555555555556 (* angle PI))))
(t_2 (fma (* a a) (* t_1 t_1) (* (* b b) (* t_0 t_0)))))
(if (<= angle 1.6e+37)
(+
(pow (* (* (* PI angle) a) 0.005555555555555556) 2.0)
(pow (* b (cos (* (/ angle 180.0) PI))) 2.0))
(+ t_2 t_2))))
double code(double a, double b, double angle) {
double t_0 = sin(fma(0.005555555555555556, (angle * ((double) M_PI)), (0.5 * ((double) M_PI))));
double t_1 = sin((0.005555555555555556 * (angle * ((double) M_PI))));
double t_2 = fma((a * a), (t_1 * t_1), ((b * b) * (t_0 * t_0)));
double tmp;
if (angle <= 1.6e+37) {
tmp = pow((((((double) M_PI) * angle) * a) * 0.005555555555555556), 2.0) + pow((b * cos(((angle / 180.0) * ((double) M_PI)))), 2.0);
} else {
tmp = t_2 + t_2;
}
return tmp;
}
function code(a, b, angle) t_0 = sin(fma(0.005555555555555556, Float64(angle * pi), Float64(0.5 * pi))) t_1 = sin(Float64(0.005555555555555556 * Float64(angle * pi))) t_2 = fma(Float64(a * a), Float64(t_1 * t_1), Float64(Float64(b * b) * Float64(t_0 * t_0))) tmp = 0.0 if (angle <= 1.6e+37) tmp = Float64((Float64(Float64(Float64(pi * angle) * a) * 0.005555555555555556) ^ 2.0) + (Float64(b * cos(Float64(Float64(angle / 180.0) * pi))) ^ 2.0)); else tmp = Float64(t_2 + t_2); end return tmp end
code[a_, b_, angle_] := Block[{t$95$0 = N[Sin[N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision] + N[(0.5 * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sin[N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(a * a), $MachinePrecision] * N[(t$95$1 * t$95$1), $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[angle, 1.6e+37], N[(N[Power[N[(N[(N[(Pi * angle), $MachinePrecision] * a), $MachinePrecision] * 0.005555555555555556), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], N[(t$95$2 + t$95$2), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(\mathsf{fma}\left(0.005555555555555556, angle \cdot \pi, 0.5 \cdot \pi\right)\right)\\
t_1 := \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\\
t_2 := \mathsf{fma}\left(a \cdot a, t\_1 \cdot t\_1, \left(b \cdot b\right) \cdot \left(t\_0 \cdot t\_0\right)\right)\\
\mathbf{if}\;angle \leq 1.6 \cdot 10^{+37}:\\
\;\;\;\;{\left(\left(\left(\pi \cdot angle\right) \cdot a\right) \cdot 0.005555555555555556\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;t\_2 + t\_2\\
\end{array}
\end{array}
if angle < 1.60000000000000007e37Initial program 86.9%
Taylor expanded in angle around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-PI.f6482.8
Applied rewrites82.8%
if 1.60000000000000007e37 < angle Initial program 61.0%
Applied rewrites4.0%
Taylor expanded in a around 0
lower-fma.f64N/A
Applied rewrites4.8%
Taylor expanded in b around 0
lower-fma.f64N/A
Applied rewrites60.4%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (sin (fma 0.5 PI (/ PI 2.0))))
(t_1 (sin (* 0.5 PI)))
(t_2 (* t_1 t_1)))
(if (<= b 8e+81)
(fma
angle
(fma
(* -0.011111111111111112 (* b b))
(* (* PI t_0) t_1)
(*
angle
(fma
(* 3.08641975308642e-5 (* a a))
(* PI PI)
(fma
(* angle (* b b))
(* (* (* (* (* PI PI) PI) t_0) t_1) 2.2862368541380886e-7)
(*
(* b b)
(fma
(* -3.08641975308642e-5 (* PI PI))
t_2
(* (* 3.08641975308642e-5 (* PI PI)) (* t_0 t_0))))))))
(* (* b b) t_2))
(* b b))))
double code(double a, double b, double angle) {
double t_0 = sin(fma(0.5, ((double) M_PI), (((double) M_PI) / 2.0)));
double t_1 = sin((0.5 * ((double) M_PI)));
double t_2 = t_1 * t_1;
double tmp;
if (b <= 8e+81) {
tmp = fma(angle, fma((-0.011111111111111112 * (b * b)), ((((double) M_PI) * t_0) * t_1), (angle * fma((3.08641975308642e-5 * (a * a)), (((double) M_PI) * ((double) M_PI)), fma((angle * (b * b)), (((((((double) M_PI) * ((double) M_PI)) * ((double) M_PI)) * t_0) * t_1) * 2.2862368541380886e-7), ((b * b) * fma((-3.08641975308642e-5 * (((double) M_PI) * ((double) M_PI))), t_2, ((3.08641975308642e-5 * (((double) M_PI) * ((double) M_PI))) * (t_0 * t_0)))))))), ((b * b) * t_2));
} else {
tmp = b * b;
}
return tmp;
}
function code(a, b, angle) t_0 = sin(fma(0.5, pi, Float64(pi / 2.0))) t_1 = sin(Float64(0.5 * pi)) t_2 = Float64(t_1 * t_1) tmp = 0.0 if (b <= 8e+81) tmp = fma(angle, fma(Float64(-0.011111111111111112 * Float64(b * b)), Float64(Float64(pi * t_0) * t_1), Float64(angle * fma(Float64(3.08641975308642e-5 * Float64(a * a)), Float64(pi * pi), fma(Float64(angle * Float64(b * b)), Float64(Float64(Float64(Float64(Float64(pi * pi) * pi) * t_0) * t_1) * 2.2862368541380886e-7), Float64(Float64(b * b) * fma(Float64(-3.08641975308642e-5 * Float64(pi * pi)), t_2, Float64(Float64(3.08641975308642e-5 * Float64(pi * pi)) * Float64(t_0 * t_0)))))))), Float64(Float64(b * b) * t_2)); else tmp = Float64(b * b); end return tmp end
code[a_, b_, angle_] := Block[{t$95$0 = N[Sin[N[(0.5 * Pi + N[(Pi / 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sin[N[(0.5 * Pi), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * t$95$1), $MachinePrecision]}, If[LessEqual[b, 8e+81], N[(angle * N[(N[(-0.011111111111111112 * N[(b * b), $MachinePrecision]), $MachinePrecision] * N[(N[(Pi * t$95$0), $MachinePrecision] * t$95$1), $MachinePrecision] + N[(angle * N[(N[(3.08641975308642e-5 * N[(a * a), $MachinePrecision]), $MachinePrecision] * N[(Pi * Pi), $MachinePrecision] + N[(N[(angle * N[(b * b), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(N[(Pi * Pi), $MachinePrecision] * Pi), $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$1), $MachinePrecision] * 2.2862368541380886e-7), $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * N[(N[(-3.08641975308642e-5 * N[(Pi * Pi), $MachinePrecision]), $MachinePrecision] * t$95$2 + N[(N[(3.08641975308642e-5 * N[(Pi * Pi), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision], N[(b * b), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(\mathsf{fma}\left(0.5, \pi, \frac{\pi}{2}\right)\right)\\
t_1 := \sin \left(0.5 \cdot \pi\right)\\
t_2 := t\_1 \cdot t\_1\\
\mathbf{if}\;b \leq 8 \cdot 10^{+81}:\\
\;\;\;\;\mathsf{fma}\left(angle, \mathsf{fma}\left(-0.011111111111111112 \cdot \left(b \cdot b\right), \left(\pi \cdot t\_0\right) \cdot t\_1, angle \cdot \mathsf{fma}\left(3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot a\right), \pi \cdot \pi, \mathsf{fma}\left(angle \cdot \left(b \cdot b\right), \left(\left(\left(\left(\pi \cdot \pi\right) \cdot \pi\right) \cdot t\_0\right) \cdot t\_1\right) \cdot 2.2862368541380886 \cdot 10^{-7}, \left(b \cdot b\right) \cdot \mathsf{fma}\left(-3.08641975308642 \cdot 10^{-5} \cdot \left(\pi \cdot \pi\right), t\_2, \left(3.08641975308642 \cdot 10^{-5} \cdot \left(\pi \cdot \pi\right)\right) \cdot \left(t\_0 \cdot t\_0\right)\right)\right)\right)\right), \left(b \cdot b\right) \cdot t\_2\right)\\
\mathbf{else}:\\
\;\;\;\;b \cdot b\\
\end{array}
\end{array}
if b < 7.99999999999999937e81Initial program 78.4%
lift-cos.f64N/A
cos-neg-revN/A
sin-+PI/2-revN/A
lower-sin.f64N/A
lower-+.f64N/A
lower-neg.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-PI.f64N/A
lower-/.f64N/A
lift-PI.f6478.4
Applied rewrites78.4%
Taylor expanded in angle around 0
Applied rewrites45.3%
if 7.99999999999999937e81 < b Initial program 89.1%
Taylor expanded in angle around 0
unpow2N/A
lower-*.f6485.1
Applied rewrites85.1%
Final simplification53.2%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (sin (fma 0.5 PI PI)))
(t_1 (* t_0 t_0))
(t_2 (sin (* 0.5 PI)))
(t_3 (* t_2 b))
(t_4 (* t_3 t_3))
(t_5 (sin (fma 0.5 PI (/ PI 2.0))))
(t_6 (* t_5 t_3))
(t_7 (* t_5 PI))
(t_8 (/ (* t_7 t_7) t_1)))
(if (<= b 8e+81)
(fma
(fma
(fma
(* 3.08641975308642e-5 (* a a))
(* PI PI)
(fma
(* 2.0 t_4)
(fma
(fma t_8 -3.08641975308642e-5 (* (* PI PI) -3.08641975308642e-5))
0.5
(* t_8 1.54320987654321e-5))
(* (* (* PI PI) (/ (* t_6 t_6) t_1)) 3.08641975308642e-5)))
angle
(* (/ (* t_7 t_4) t_2) 0.011111111111111112))
angle
t_4)
(* b b))))
double code(double a, double b, double angle) {
double t_0 = sin(fma(0.5, ((double) M_PI), ((double) M_PI)));
double t_1 = t_0 * t_0;
double t_2 = sin((0.5 * ((double) M_PI)));
double t_3 = t_2 * b;
double t_4 = t_3 * t_3;
double t_5 = sin(fma(0.5, ((double) M_PI), (((double) M_PI) / 2.0)));
double t_6 = t_5 * t_3;
double t_7 = t_5 * ((double) M_PI);
double t_8 = (t_7 * t_7) / t_1;
double tmp;
if (b <= 8e+81) {
tmp = fma(fma(fma((3.08641975308642e-5 * (a * a)), (((double) M_PI) * ((double) M_PI)), fma((2.0 * t_4), fma(fma(t_8, -3.08641975308642e-5, ((((double) M_PI) * ((double) M_PI)) * -3.08641975308642e-5)), 0.5, (t_8 * 1.54320987654321e-5)), (((((double) M_PI) * ((double) M_PI)) * ((t_6 * t_6) / t_1)) * 3.08641975308642e-5))), angle, (((t_7 * t_4) / t_2) * 0.011111111111111112)), angle, t_4);
} else {
tmp = b * b;
}
return tmp;
}
function code(a, b, angle) t_0 = sin(fma(0.5, pi, pi)) t_1 = Float64(t_0 * t_0) t_2 = sin(Float64(0.5 * pi)) t_3 = Float64(t_2 * b) t_4 = Float64(t_3 * t_3) t_5 = sin(fma(0.5, pi, Float64(pi / 2.0))) t_6 = Float64(t_5 * t_3) t_7 = Float64(t_5 * pi) t_8 = Float64(Float64(t_7 * t_7) / t_1) tmp = 0.0 if (b <= 8e+81) tmp = fma(fma(fma(Float64(3.08641975308642e-5 * Float64(a * a)), Float64(pi * pi), fma(Float64(2.0 * t_4), fma(fma(t_8, -3.08641975308642e-5, Float64(Float64(pi * pi) * -3.08641975308642e-5)), 0.5, Float64(t_8 * 1.54320987654321e-5)), Float64(Float64(Float64(pi * pi) * Float64(Float64(t_6 * t_6) / t_1)) * 3.08641975308642e-5))), angle, Float64(Float64(Float64(t_7 * t_4) / t_2) * 0.011111111111111112)), angle, t_4); else tmp = Float64(b * b); end return tmp end
code[a_, b_, angle_] := Block[{t$95$0 = N[Sin[N[(0.5 * Pi + Pi), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[Sin[N[(0.5 * Pi), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 * b), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$3 * t$95$3), $MachinePrecision]}, Block[{t$95$5 = N[Sin[N[(0.5 * Pi + N[(Pi / 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$6 = N[(t$95$5 * t$95$3), $MachinePrecision]}, Block[{t$95$7 = N[(t$95$5 * Pi), $MachinePrecision]}, Block[{t$95$8 = N[(N[(t$95$7 * t$95$7), $MachinePrecision] / t$95$1), $MachinePrecision]}, If[LessEqual[b, 8e+81], N[(N[(N[(N[(3.08641975308642e-5 * N[(a * a), $MachinePrecision]), $MachinePrecision] * N[(Pi * Pi), $MachinePrecision] + N[(N[(2.0 * t$95$4), $MachinePrecision] * N[(N[(t$95$8 * -3.08641975308642e-5 + N[(N[(Pi * Pi), $MachinePrecision] * -3.08641975308642e-5), $MachinePrecision]), $MachinePrecision] * 0.5 + N[(t$95$8 * 1.54320987654321e-5), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(Pi * Pi), $MachinePrecision] * N[(N[(t$95$6 * t$95$6), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision] * 3.08641975308642e-5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * angle + N[(N[(N[(t$95$7 * t$95$4), $MachinePrecision] / t$95$2), $MachinePrecision] * 0.011111111111111112), $MachinePrecision]), $MachinePrecision] * angle + t$95$4), $MachinePrecision], N[(b * b), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(\mathsf{fma}\left(0.5, \pi, \pi\right)\right)\\
t_1 := t\_0 \cdot t\_0\\
t_2 := \sin \left(0.5 \cdot \pi\right)\\
t_3 := t\_2 \cdot b\\
t_4 := t\_3 \cdot t\_3\\
t_5 := \sin \left(\mathsf{fma}\left(0.5, \pi, \frac{\pi}{2}\right)\right)\\
t_6 := t\_5 \cdot t\_3\\
t_7 := t\_5 \cdot \pi\\
t_8 := \frac{t\_7 \cdot t\_7}{t\_1}\\
\mathbf{if}\;b \leq 8 \cdot 10^{+81}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot a\right), \pi \cdot \pi, \mathsf{fma}\left(2 \cdot t\_4, \mathsf{fma}\left(\mathsf{fma}\left(t\_8, -3.08641975308642 \cdot 10^{-5}, \left(\pi \cdot \pi\right) \cdot -3.08641975308642 \cdot 10^{-5}\right), 0.5, t\_8 \cdot 1.54320987654321 \cdot 10^{-5}\right), \left(\left(\pi \cdot \pi\right) \cdot \frac{t\_6 \cdot t\_6}{t\_1}\right) \cdot 3.08641975308642 \cdot 10^{-5}\right)\right), angle, \frac{t\_7 \cdot t\_4}{t\_2} \cdot 0.011111111111111112\right), angle, t\_4\right)\\
\mathbf{else}:\\
\;\;\;\;b \cdot b\\
\end{array}
\end{array}
if b < 7.99999999999999937e81Initial program 78.4%
lift-pow.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow-to-expN/A
exp-prodN/A
lower-pow.f64N/A
Applied rewrites21.8%
Taylor expanded in angle around 0
Applied rewrites45.7%
if 7.99999999999999937e81 < b Initial program 89.1%
Taylor expanded in angle around 0
unpow2N/A
lower-*.f6485.1
Applied rewrites85.1%
Final simplification53.5%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (sin (fma (* 0.005555555555555556 angle) PI (/ PI 2.0))))
(t_1 (* (sin (* (* PI angle) 0.005555555555555556)) a)))
(if (or (<= a 2.2e-116) (not (<= a 1.35e+154)))
(* b b)
(fma (* (* b b) (/ (* t_0 t_0) (* a a))) (* a a) (* t_1 t_1)))))
double code(double a, double b, double angle) {
double t_0 = sin(fma((0.005555555555555556 * angle), ((double) M_PI), (((double) M_PI) / 2.0)));
double t_1 = sin(((((double) M_PI) * angle) * 0.005555555555555556)) * a;
double tmp;
if ((a <= 2.2e-116) || !(a <= 1.35e+154)) {
tmp = b * b;
} else {
tmp = fma(((b * b) * ((t_0 * t_0) / (a * a))), (a * a), (t_1 * t_1));
}
return tmp;
}
function code(a, b, angle) t_0 = sin(fma(Float64(0.005555555555555556 * angle), pi, Float64(pi / 2.0))) t_1 = Float64(sin(Float64(Float64(pi * angle) * 0.005555555555555556)) * a) tmp = 0.0 if ((a <= 2.2e-116) || !(a <= 1.35e+154)) tmp = Float64(b * b); else tmp = fma(Float64(Float64(b * b) * Float64(Float64(t_0 * t_0) / Float64(a * a))), Float64(a * a), Float64(t_1 * t_1)); end return tmp end
code[a_, b_, angle_] := Block[{t$95$0 = N[Sin[N[(N[(0.005555555555555556 * angle), $MachinePrecision] * Pi + N[(Pi / 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Sin[N[(N[(Pi * angle), $MachinePrecision] * 0.005555555555555556), $MachinePrecision]], $MachinePrecision] * a), $MachinePrecision]}, If[Or[LessEqual[a, 2.2e-116], N[Not[LessEqual[a, 1.35e+154]], $MachinePrecision]], N[(b * b), $MachinePrecision], N[(N[(N[(b * b), $MachinePrecision] * N[(N[(t$95$0 * t$95$0), $MachinePrecision] / N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(a * a), $MachinePrecision] + N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(\mathsf{fma}\left(0.005555555555555556 \cdot angle, \pi, \frac{\pi}{2}\right)\right)\\
t_1 := \sin \left(\left(\pi \cdot angle\right) \cdot 0.005555555555555556\right) \cdot a\\
\mathbf{if}\;a \leq 2.2 \cdot 10^{-116} \lor \neg \left(a \leq 1.35 \cdot 10^{+154}\right):\\
\;\;\;\;b \cdot b\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(b \cdot b\right) \cdot \frac{t\_0 \cdot t\_0}{a \cdot a}, a \cdot a, t\_1 \cdot t\_1\right)\\
\end{array}
\end{array}
if a < 2.2000000000000001e-116 or 1.35000000000000003e154 < a Initial program 82.3%
Taylor expanded in angle around 0
unpow2N/A
lower-*.f6460.2
Applied rewrites60.2%
if 2.2000000000000001e-116 < a < 1.35000000000000003e154Initial program 74.5%
Taylor expanded in angle around 0
lower-*.f6474.5
Applied rewrites74.5%
Taylor expanded in a around inf
distribute-rgt-inN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites72.0%
Final simplification62.8%
(FPCore (a b angle) :precision binary64 (* b b))
double code(double a, double b, double angle) {
return b * b;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(a, b, angle)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle
code = b * b
end function
public static double code(double a, double b, double angle) {
return b * b;
}
def code(a, b, angle): return b * b
function code(a, b, angle) return Float64(b * b) end
function tmp = code(a, b, angle) tmp = b * b; end
code[a_, b_, angle_] := N[(b * b), $MachinePrecision]
\begin{array}{l}
\\
b \cdot b
\end{array}
Initial program 80.6%
Taylor expanded in angle around 0
unpow2N/A
lower-*.f6459.6
Applied rewrites59.6%
Final simplification59.6%
(FPCore (a b angle) :precision binary64 (exp (* (log b) 2.0)))
double code(double a, double b, double angle) {
return exp((log(b) * 2.0));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(a, b, angle)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle
code = exp((log(b) * 2.0d0))
end function
public static double code(double a, double b, double angle) {
return Math.exp((Math.log(b) * 2.0));
}
def code(a, b, angle): return math.exp((math.log(b) * 2.0))
function code(a, b, angle) return exp(Float64(log(b) * 2.0)) end
function tmp = code(a, b, angle) tmp = exp((log(b) * 2.0)); end
code[a_, b_, angle_] := N[Exp[N[(N[Log[b], $MachinePrecision] * 2.0), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
e^{\log b \cdot 2}
\end{array}
Initial program 80.6%
Taylor expanded in angle around 0
unpow2N/A
lower-*.f6459.6
Applied rewrites59.6%
lift-*.f64N/A
pow2N/A
pow-to-expN/A
lower-exp.f64N/A
lower-*.f64N/A
lift-log.f6426.1
Applied rewrites26.1%
Final simplification26.1%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (sin (fma 0.005555555555555556 (* angle PI) (* 0.5 PI))))
(t_1 (sin (* 0.005555555555555556 (* angle PI)))))
(/
(fma (pow a 6.0) (pow t_1 6.0) (* (pow b 6.0) (pow t_0 6.0)))
(-
(fma (pow a 4.0) (pow t_1 4.0) (* (pow b 4.0) (pow t_0 4.0)))
(* (* (* a a) (* b b)) (* (* t_1 t_1) (* t_0 t_0)))))))
double code(double a, double b, double angle) {
double t_0 = sin(fma(0.005555555555555556, (angle * ((double) M_PI)), (0.5 * ((double) M_PI))));
double t_1 = sin((0.005555555555555556 * (angle * ((double) M_PI))));
return fma(pow(a, 6.0), pow(t_1, 6.0), (pow(b, 6.0) * pow(t_0, 6.0))) / (fma(pow(a, 4.0), pow(t_1, 4.0), (pow(b, 4.0) * pow(t_0, 4.0))) - (((a * a) * (b * b)) * ((t_1 * t_1) * (t_0 * t_0))));
}
function code(a, b, angle) t_0 = sin(fma(0.005555555555555556, Float64(angle * pi), Float64(0.5 * pi))) t_1 = sin(Float64(0.005555555555555556 * Float64(angle * pi))) return Float64(fma((a ^ 6.0), (t_1 ^ 6.0), Float64((b ^ 6.0) * (t_0 ^ 6.0))) / Float64(fma((a ^ 4.0), (t_1 ^ 4.0), Float64((b ^ 4.0) * (t_0 ^ 4.0))) - Float64(Float64(Float64(a * a) * Float64(b * b)) * Float64(Float64(t_1 * t_1) * Float64(t_0 * t_0))))) end
code[a_, b_, angle_] := Block[{t$95$0 = N[Sin[N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision] + N[(0.5 * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sin[N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[(N[(N[Power[a, 6.0], $MachinePrecision] * N[Power[t$95$1, 6.0], $MachinePrecision] + N[(N[Power[b, 6.0], $MachinePrecision] * N[Power[t$95$0, 6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(N[Power[a, 4.0], $MachinePrecision] * N[Power[t$95$1, 4.0], $MachinePrecision] + N[(N[Power[b, 4.0], $MachinePrecision] * N[Power[t$95$0, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(a * a), $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$1 * t$95$1), $MachinePrecision] * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(\mathsf{fma}\left(0.005555555555555556, angle \cdot \pi, 0.5 \cdot \pi\right)\right)\\
t_1 := \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\\
\frac{\mathsf{fma}\left({a}^{6}, {t\_1}^{6}, {b}^{6} \cdot {t\_0}^{6}\right)}{\mathsf{fma}\left({a}^{4}, {t\_1}^{4}, {b}^{4} \cdot {t\_0}^{4}\right) - \left(\left(a \cdot a\right) \cdot \left(b \cdot b\right)\right) \cdot \left(\left(t\_1 \cdot t\_1\right) \cdot \left(t\_0 \cdot t\_0\right)\right)}
\end{array}
\end{array}
Initial program 80.6%
Applied rewrites11.1%
Taylor expanded in angle around inf
Applied rewrites8.3%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (sin (fma 0.005555555555555556 (* angle PI) (* 0.5 PI))))
(t_1 (sin (* 0.005555555555555556 (* angle PI)))))
(/
(fma (exp (* (log a) 6.0)) (pow t_1 6.0) (* (pow b 6.0) (pow t_0 6.0)))
(-
(fma (pow a 4.0) (pow t_1 4.0) (* (pow b 4.0) (pow t_0 4.0)))
(* (* (* a a) (* b b)) (* (* t_1 t_1) (* t_0 t_0)))))))
double code(double a, double b, double angle) {
double t_0 = sin(fma(0.005555555555555556, (angle * ((double) M_PI)), (0.5 * ((double) M_PI))));
double t_1 = sin((0.005555555555555556 * (angle * ((double) M_PI))));
return fma(exp((log(a) * 6.0)), pow(t_1, 6.0), (pow(b, 6.0) * pow(t_0, 6.0))) / (fma(pow(a, 4.0), pow(t_1, 4.0), (pow(b, 4.0) * pow(t_0, 4.0))) - (((a * a) * (b * b)) * ((t_1 * t_1) * (t_0 * t_0))));
}
function code(a, b, angle) t_0 = sin(fma(0.005555555555555556, Float64(angle * pi), Float64(0.5 * pi))) t_1 = sin(Float64(0.005555555555555556 * Float64(angle * pi))) return Float64(fma(exp(Float64(log(a) * 6.0)), (t_1 ^ 6.0), Float64((b ^ 6.0) * (t_0 ^ 6.0))) / Float64(fma((a ^ 4.0), (t_1 ^ 4.0), Float64((b ^ 4.0) * (t_0 ^ 4.0))) - Float64(Float64(Float64(a * a) * Float64(b * b)) * Float64(Float64(t_1 * t_1) * Float64(t_0 * t_0))))) end
code[a_, b_, angle_] := Block[{t$95$0 = N[Sin[N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision] + N[(0.5 * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sin[N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[(N[(N[Exp[N[(N[Log[a], $MachinePrecision] * 6.0), $MachinePrecision]], $MachinePrecision] * N[Power[t$95$1, 6.0], $MachinePrecision] + N[(N[Power[b, 6.0], $MachinePrecision] * N[Power[t$95$0, 6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(N[Power[a, 4.0], $MachinePrecision] * N[Power[t$95$1, 4.0], $MachinePrecision] + N[(N[Power[b, 4.0], $MachinePrecision] * N[Power[t$95$0, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(a * a), $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$1 * t$95$1), $MachinePrecision] * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(\mathsf{fma}\left(0.005555555555555556, angle \cdot \pi, 0.5 \cdot \pi\right)\right)\\
t_1 := \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\\
\frac{\mathsf{fma}\left(e^{\log a \cdot 6}, {t\_1}^{6}, {b}^{6} \cdot {t\_0}^{6}\right)}{\mathsf{fma}\left({a}^{4}, {t\_1}^{4}, {b}^{4} \cdot {t\_0}^{4}\right) - \left(\left(a \cdot a\right) \cdot \left(b \cdot b\right)\right) \cdot \left(\left(t\_1 \cdot t\_1\right) \cdot \left(t\_0 \cdot t\_0\right)\right)}
\end{array}
\end{array}
Initial program 80.6%
Applied rewrites11.1%
Taylor expanded in angle around inf
Applied rewrites8.3%
lift-pow.f64N/A
pow-to-expN/A
lower-exp.f64N/A
lower-*.f64N/A
lower-log.f644.8
Applied rewrites4.8%
herbie shell --seed 2025065
(FPCore (a b angle)
:name "ab-angle->ABCF A"
:precision binary64
(+ (pow (* a (sin (* (/ angle 180.0) PI))) 2.0) (pow (* b (cos (* (/ angle 180.0) PI))) 2.0)))