
(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 19 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 (+ (pow (* a (sin (* (/ angle 180.0) PI))) 2.0) (pow (* b (cos (* (* angle (sqrt PI)) (* (sqrt PI) 0.005555555555555556)))) 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(((angle * sqrt(((double) M_PI))) * (sqrt(((double) M_PI)) * 0.005555555555555556)))), 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(((angle * Math.sqrt(Math.PI)) * (Math.sqrt(Math.PI) * 0.005555555555555556)))), 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(((angle * math.sqrt(math.pi)) * (math.sqrt(math.pi) * 0.005555555555555556)))), 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(angle * sqrt(pi)) * Float64(sqrt(pi) * 0.005555555555555556)))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((a * sin(((angle / 180.0) * pi))) ^ 2.0) + ((b * cos(((angle * sqrt(pi)) * (sqrt(pi) * 0.005555555555555556)))) ^ 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[(angle * N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[Pi], $MachinePrecision] * 0.005555555555555556), $MachinePrecision]), $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(angle \cdot \sqrt{\pi}\right) \cdot \left(\sqrt{\pi} \cdot 0.005555555555555556\right)\right)\right)}^{2}
\end{array}
Initial program 78.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
div-invN/A
lift-PI.f64N/A
add-sqr-sqrtN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-PI.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lift-PI.f64N/A
lower-sqrt.f64N/A
metadata-eval78.8
Applied rewrites78.8%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (* (/ angle 180.0) PI))) 2.0) (pow (* b (cos (/ PI (/ 180.0 angle)))) 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((((double) M_PI) / (180.0 / angle)))), 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((Math.PI / (180.0 / angle)))), 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((math.pi / (180.0 / angle)))), 2.0)
function code(a, b, angle) return Float64((Float64(a * sin(Float64(Float64(angle / 180.0) * pi))) ^ 2.0) + (Float64(b * cos(Float64(pi / Float64(180.0 / angle)))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((a * sin(((angle / 180.0) * pi))) ^ 2.0) + ((b * cos((pi / (180.0 / angle)))) ^ 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[(Pi / N[(180.0 / angle), $MachinePrecision]), $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(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2}
\end{array}
Initial program 78.6%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6478.7
Applied rewrites78.7%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (* (/ angle 180.0) PI))) 2.0) (pow (* b (cos (/ (* angle PI) 180.0))) 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(((angle * ((double) M_PI)) / 180.0))), 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(((angle * Math.PI) / 180.0))), 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(((angle * math.pi) / 180.0))), 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(angle * pi) / 180.0))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((a * sin(((angle / 180.0) * pi))) ^ 2.0) + ((b * cos(((angle * pi) / 180.0))) ^ 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[(angle * Pi), $MachinePrecision] / 180.0), $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(\frac{angle \cdot \pi}{180}\right)\right)}^{2}
\end{array}
Initial program 78.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6478.7
Applied rewrites78.7%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (* (/ angle 180.0) PI))) 2.0) (pow (* b (cos (* angle (* PI 0.005555555555555556)))) 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((angle * (((double) M_PI) * 0.005555555555555556)))), 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((angle * (Math.PI * 0.005555555555555556)))), 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((angle * (math.pi * 0.005555555555555556)))), 2.0)
function code(a, b, angle) return Float64((Float64(a * sin(Float64(Float64(angle / 180.0) * pi))) ^ 2.0) + (Float64(b * cos(Float64(angle * Float64(pi * 0.005555555555555556)))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((a * sin(((angle / 180.0) * pi))) ^ 2.0) + ((b * cos((angle * (pi * 0.005555555555555556)))) ^ 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[(angle * N[(Pi * 0.005555555555555556), $MachinePrecision]), $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(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)}^{2}
\end{array}
Initial program 78.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
div-invN/A
lower-*.f64N/A
metadata-eval78.7
Applied rewrites78.7%
Final simplification78.7%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (* angle (* PI 0.005555555555555556)))) 2.0) (pow (* b (cos (* (/ angle 180.0) PI))) 2.0)))
double code(double a, double b, double angle) {
return pow((a * sin((angle * (((double) M_PI) * 0.005555555555555556)))), 2.0) + pow((b * cos(((angle / 180.0) * ((double) M_PI)))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.sin((angle * (Math.PI * 0.005555555555555556)))), 2.0) + Math.pow((b * Math.cos(((angle / 180.0) * Math.PI))), 2.0);
}
def code(a, b, angle): return math.pow((a * math.sin((angle * (math.pi * 0.005555555555555556)))), 2.0) + math.pow((b * math.cos(((angle / 180.0) * math.pi))), 2.0)
function code(a, b, angle) return Float64((Float64(a * sin(Float64(angle * Float64(pi * 0.005555555555555556)))) ^ 2.0) + (Float64(b * cos(Float64(Float64(angle / 180.0) * pi))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((a * sin((angle * (pi * 0.005555555555555556)))) ^ 2.0) + ((b * cos(((angle / 180.0) * pi))) ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Sin[N[(angle * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}
\end{array}
Initial program 78.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
div-invN/A
lower-*.f64N/A
metadata-eval78.7
Applied rewrites78.7%
Final simplification78.7%
(FPCore (a b angle) :precision binary64 (+ (pow (* b (cos (* (/ angle 180.0) PI))) 2.0) (pow (* a (sin (* 0.005555555555555556 (* angle PI)))) 2.0)))
double code(double a, double b, double angle) {
return pow((b * cos(((angle / 180.0) * ((double) M_PI)))), 2.0) + pow((a * sin((0.005555555555555556 * (angle * ((double) M_PI))))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((b * Math.cos(((angle / 180.0) * Math.PI))), 2.0) + Math.pow((a * Math.sin((0.005555555555555556 * (angle * Math.PI)))), 2.0);
}
def code(a, b, angle): return math.pow((b * math.cos(((angle / 180.0) * math.pi))), 2.0) + math.pow((a * math.sin((0.005555555555555556 * (angle * math.pi)))), 2.0)
function code(a, b, angle) return Float64((Float64(b * cos(Float64(Float64(angle / 180.0) * pi))) ^ 2.0) + (Float64(a * sin(Float64(0.005555555555555556 * Float64(angle * pi)))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((b * cos(((angle / 180.0) * pi))) ^ 2.0) + ((a * sin((0.005555555555555556 * (angle * pi)))) ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(b * N[Cos[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(a * N[Sin[N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(a \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2}
\end{array}
Initial program 78.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
div-invN/A
lower-*.f64N/A
lower-*.f64N/A
metadata-eval78.6
Applied rewrites78.6%
Final simplification78.6%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (* (/ angle 180.0) PI))) 2.0) (pow (* b 1.0) 2.0)))
double code(double a, double b, double angle) {
return pow((a * sin(((angle / 180.0) * ((double) M_PI)))), 2.0) + pow((b * 1.0), 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 * 1.0), 2.0);
}
def code(a, b, angle): return math.pow((a * math.sin(((angle / 180.0) * math.pi))), 2.0) + math.pow((b * 1.0), 2.0)
function code(a, b, angle) return Float64((Float64(a * sin(Float64(Float64(angle / 180.0) * pi))) ^ 2.0) + (Float64(b * 1.0) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((a * sin(((angle / 180.0) * pi))) ^ 2.0) + ((b * 1.0) ^ 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 * 1.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot 1\right)}^{2}
\end{array}
Initial program 78.6%
Taylor expanded in angle around 0
Applied rewrites78.4%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* a (* 0.005555555555555556 (* angle PI)))))
(if (<= (/ angle 180.0) 1e-9)
(fma
t_0
t_0
(* (* b b) (fma 0.5 (cos (* (* angle PI) 0.011111111111111112)) 0.5)))
(fma
(* a (fma (cos (* angle (* PI 0.011111111111111112))) -0.5 0.5))
a
(*
(* b b)
(+ 0.5 (* 0.5 (cos (* 2.0 (* PI (* angle 0.005555555555555556)))))))))))
double code(double a, double b, double angle) {
double t_0 = a * (0.005555555555555556 * (angle * ((double) M_PI)));
double tmp;
if ((angle / 180.0) <= 1e-9) {
tmp = fma(t_0, t_0, ((b * b) * fma(0.5, cos(((angle * ((double) M_PI)) * 0.011111111111111112)), 0.5)));
} else {
tmp = fma((a * fma(cos((angle * (((double) M_PI) * 0.011111111111111112))), -0.5, 0.5)), a, ((b * b) * (0.5 + (0.5 * cos((2.0 * (((double) M_PI) * (angle * 0.005555555555555556))))))));
}
return tmp;
}
function code(a, b, angle) t_0 = Float64(a * Float64(0.005555555555555556 * Float64(angle * pi))) tmp = 0.0 if (Float64(angle / 180.0) <= 1e-9) tmp = fma(t_0, t_0, Float64(Float64(b * b) * fma(0.5, cos(Float64(Float64(angle * pi) * 0.011111111111111112)), 0.5))); else tmp = fma(Float64(a * fma(cos(Float64(angle * Float64(pi * 0.011111111111111112))), -0.5, 0.5)), a, Float64(Float64(b * b) * Float64(0.5 + Float64(0.5 * cos(Float64(2.0 * Float64(pi * Float64(angle * 0.005555555555555556)))))))); end return tmp end
code[a_, b_, angle_] := Block[{t$95$0 = N[(a * N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(angle / 180.0), $MachinePrecision], 1e-9], N[(t$95$0 * t$95$0 + N[(N[(b * b), $MachinePrecision] * N[(0.5 * N[Cos[N[(N[(angle * Pi), $MachinePrecision] * 0.011111111111111112), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a * N[(N[Cos[N[(angle * N[(Pi * 0.011111111111111112), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * -0.5 + 0.5), $MachinePrecision]), $MachinePrecision] * a + N[(N[(b * b), $MachinePrecision] * N[(0.5 + N[(0.5 * N[Cos[N[(2.0 * N[(Pi * N[(angle * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\\
\mathbf{if}\;\frac{angle}{180} \leq 10^{-9}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, t\_0, \left(b \cdot b\right) \cdot \mathsf{fma}\left(0.5, \cos \left(\left(angle \cdot \pi\right) \cdot 0.011111111111111112\right), 0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a \cdot \mathsf{fma}\left(\cos \left(angle \cdot \left(\pi \cdot 0.011111111111111112\right)\right), -0.5, 0.5\right), a, \left(b \cdot b\right) \cdot \left(0.5 + 0.5 \cdot \cos \left(2 \cdot \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)\right)\right)\\
\end{array}
\end{array}
if (/.f64 angle #s(literal 180 binary64)) < 1.00000000000000006e-9Initial program 88.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
div-invN/A
lift-PI.f64N/A
add-sqr-sqrtN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-PI.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lift-PI.f64N/A
lower-sqrt.f64N/A
metadata-eval88.7
Applied rewrites88.7%
Taylor expanded in angle around 0
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f6484.8
Applied rewrites84.8%
lift-pow.f64N/A
unpow2N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites83.2%
Applied rewrites84.8%
if 1.00000000000000006e-9 < (/.f64 angle #s(literal 180 binary64)) Initial program 52.0%
Applied rewrites28.0%
lift-*.f64N/A
lift-*.f64N/A
metadata-evalN/A
div-invN/A
lift-/.f64N/A
lift-*.f64N/A
associate-*r*N/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-/.f64N/A
div-invN/A
metadata-evalN/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
metadata-eval27.6
Applied rewrites27.6%
Taylor expanded in a around 0
lower-*.f64N/A
sub-negN/A
+-commutativeN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lower-cos.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f64N/A
metadata-eval52.2
Applied rewrites52.2%
Final simplification75.9%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* a (* 0.005555555555555556 (* angle PI))))
(t_1 (cos (* angle (* PI 0.011111111111111112)))))
(if (<= (/ angle 180.0) 1e-9)
(fma
t_0
t_0
(* (* b b) (fma 0.5 (cos (* (* angle PI) 0.011111111111111112)) 0.5)))
(fma b (* b (fma 0.5 t_1 0.5)) (* (fma t_1 -0.5 0.5) (* a a))))))
double code(double a, double b, double angle) {
double t_0 = a * (0.005555555555555556 * (angle * ((double) M_PI)));
double t_1 = cos((angle * (((double) M_PI) * 0.011111111111111112)));
double tmp;
if ((angle / 180.0) <= 1e-9) {
tmp = fma(t_0, t_0, ((b * b) * fma(0.5, cos(((angle * ((double) M_PI)) * 0.011111111111111112)), 0.5)));
} else {
tmp = fma(b, (b * fma(0.5, t_1, 0.5)), (fma(t_1, -0.5, 0.5) * (a * a)));
}
return tmp;
}
function code(a, b, angle) t_0 = Float64(a * Float64(0.005555555555555556 * Float64(angle * pi))) t_1 = cos(Float64(angle * Float64(pi * 0.011111111111111112))) tmp = 0.0 if (Float64(angle / 180.0) <= 1e-9) tmp = fma(t_0, t_0, Float64(Float64(b * b) * fma(0.5, cos(Float64(Float64(angle * pi) * 0.011111111111111112)), 0.5))); else tmp = fma(b, Float64(b * fma(0.5, t_1, 0.5)), Float64(fma(t_1, -0.5, 0.5) * Float64(a * a))); end return tmp end
code[a_, b_, angle_] := Block[{t$95$0 = N[(a * N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(angle * N[(Pi * 0.011111111111111112), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(angle / 180.0), $MachinePrecision], 1e-9], N[(t$95$0 * t$95$0 + N[(N[(b * b), $MachinePrecision] * N[(0.5 * N[Cos[N[(N[(angle * Pi), $MachinePrecision] * 0.011111111111111112), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(b * N[(b * N[(0.5 * t$95$1 + 0.5), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$1 * -0.5 + 0.5), $MachinePrecision] * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\\
t_1 := \cos \left(angle \cdot \left(\pi \cdot 0.011111111111111112\right)\right)\\
\mathbf{if}\;\frac{angle}{180} \leq 10^{-9}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, t\_0, \left(b \cdot b\right) \cdot \mathsf{fma}\left(0.5, \cos \left(\left(angle \cdot \pi\right) \cdot 0.011111111111111112\right), 0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(b, b \cdot \mathsf{fma}\left(0.5, t\_1, 0.5\right), \mathsf{fma}\left(t\_1, -0.5, 0.5\right) \cdot \left(a \cdot a\right)\right)\\
\end{array}
\end{array}
if (/.f64 angle #s(literal 180 binary64)) < 1.00000000000000006e-9Initial program 88.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
div-invN/A
lift-PI.f64N/A
add-sqr-sqrtN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-PI.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lift-PI.f64N/A
lower-sqrt.f64N/A
metadata-eval88.7
Applied rewrites88.7%
Taylor expanded in angle around 0
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f6484.8
Applied rewrites84.8%
lift-pow.f64N/A
unpow2N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites83.2%
Applied rewrites84.8%
if 1.00000000000000006e-9 < (/.f64 angle #s(literal 180 binary64)) Initial program 52.0%
Applied rewrites28.0%
rem-square-sqrtN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
lower-*.f6427.5
Applied rewrites27.5%
Taylor expanded in a around 0
+-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites52.3%
Final simplification76.0%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* 0.005555555555555556 (* angle PI))))
(if (<= a 9e-21)
(* (* b b) (pow (cos t_0) 2.0))
(+ (pow (* a t_0) 2.0) (pow (* b 1.0) 2.0)))))
double code(double a, double b, double angle) {
double t_0 = 0.005555555555555556 * (angle * ((double) M_PI));
double tmp;
if (a <= 9e-21) {
tmp = (b * b) * pow(cos(t_0), 2.0);
} else {
tmp = pow((a * t_0), 2.0) + pow((b * 1.0), 2.0);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double t_0 = 0.005555555555555556 * (angle * Math.PI);
double tmp;
if (a <= 9e-21) {
tmp = (b * b) * Math.pow(Math.cos(t_0), 2.0);
} else {
tmp = Math.pow((a * t_0), 2.0) + Math.pow((b * 1.0), 2.0);
}
return tmp;
}
def code(a, b, angle): t_0 = 0.005555555555555556 * (angle * math.pi) tmp = 0 if a <= 9e-21: tmp = (b * b) * math.pow(math.cos(t_0), 2.0) else: tmp = math.pow((a * t_0), 2.0) + math.pow((b * 1.0), 2.0) return tmp
function code(a, b, angle) t_0 = Float64(0.005555555555555556 * Float64(angle * pi)) tmp = 0.0 if (a <= 9e-21) tmp = Float64(Float64(b * b) * (cos(t_0) ^ 2.0)); else tmp = Float64((Float64(a * t_0) ^ 2.0) + (Float64(b * 1.0) ^ 2.0)); end return tmp end
function tmp_2 = code(a, b, angle) t_0 = 0.005555555555555556 * (angle * pi); tmp = 0.0; if (a <= 9e-21) tmp = (b * b) * (cos(t_0) ^ 2.0); else tmp = ((a * t_0) ^ 2.0) + ((b * 1.0) ^ 2.0); end tmp_2 = tmp; end
code[a_, b_, angle_] := Block[{t$95$0 = N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, 9e-21], N[(N[(b * b), $MachinePrecision] * N[Power[N[Cos[t$95$0], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], N[(N[Power[N[(a * t$95$0), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * 1.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.005555555555555556 \cdot \left(angle \cdot \pi\right)\\
\mathbf{if}\;a \leq 9 \cdot 10^{-21}:\\
\;\;\;\;\left(b \cdot b\right) \cdot {\cos t\_0}^{2}\\
\mathbf{else}:\\
\;\;\;\;{\left(a \cdot t\_0\right)}^{2} + {\left(b \cdot 1\right)}^{2}\\
\end{array}
\end{array}
if a < 8.99999999999999936e-21Initial program 76.9%
Taylor expanded in a around 0
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-pow.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-cos.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f6463.4
Applied rewrites63.4%
if 8.99999999999999936e-21 < a Initial program 83.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
div-invN/A
lift-PI.f64N/A
add-sqr-sqrtN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-PI.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lift-PI.f64N/A
lower-sqrt.f64N/A
metadata-eval83.8
Applied rewrites83.8%
Taylor expanded in angle around 0
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f6480.7
Applied rewrites80.7%
Taylor expanded in angle around 0
Applied rewrites80.7%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* 0.005555555555555556 (* angle PI))) (t_1 (* a t_0)))
(if (<= a 9e-21)
(* (* b b) (pow (cos t_0) 2.0))
(fma
t_1
t_1
(* (* b b) (fma 0.5 (cos (* (* angle PI) 0.011111111111111112)) 0.5))))))
double code(double a, double b, double angle) {
double t_0 = 0.005555555555555556 * (angle * ((double) M_PI));
double t_1 = a * t_0;
double tmp;
if (a <= 9e-21) {
tmp = (b * b) * pow(cos(t_0), 2.0);
} else {
tmp = fma(t_1, t_1, ((b * b) * fma(0.5, cos(((angle * ((double) M_PI)) * 0.011111111111111112)), 0.5)));
}
return tmp;
}
function code(a, b, angle) t_0 = Float64(0.005555555555555556 * Float64(angle * pi)) t_1 = Float64(a * t_0) tmp = 0.0 if (a <= 9e-21) tmp = Float64(Float64(b * b) * (cos(t_0) ^ 2.0)); else tmp = fma(t_1, t_1, Float64(Float64(b * b) * fma(0.5, cos(Float64(Float64(angle * pi) * 0.011111111111111112)), 0.5))); end return tmp end
code[a_, b_, angle_] := Block[{t$95$0 = N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(a * t$95$0), $MachinePrecision]}, If[LessEqual[a, 9e-21], N[(N[(b * b), $MachinePrecision] * N[Power[N[Cos[t$95$0], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], N[(t$95$1 * t$95$1 + N[(N[(b * b), $MachinePrecision] * N[(0.5 * N[Cos[N[(N[(angle * Pi), $MachinePrecision] * 0.011111111111111112), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.005555555555555556 \cdot \left(angle \cdot \pi\right)\\
t_1 := a \cdot t\_0\\
\mathbf{if}\;a \leq 9 \cdot 10^{-21}:\\
\;\;\;\;\left(b \cdot b\right) \cdot {\cos t\_0}^{2}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, t\_1, \left(b \cdot b\right) \cdot \mathsf{fma}\left(0.5, \cos \left(\left(angle \cdot \pi\right) \cdot 0.011111111111111112\right), 0.5\right)\right)\\
\end{array}
\end{array}
if a < 8.99999999999999936e-21Initial program 76.9%
Taylor expanded in a around 0
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-pow.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-cos.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f6463.4
Applied rewrites63.4%
if 8.99999999999999936e-21 < a Initial program 83.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
div-invN/A
lift-PI.f64N/A
add-sqr-sqrtN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-PI.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lift-PI.f64N/A
lower-sqrt.f64N/A
metadata-eval83.8
Applied rewrites83.8%
Taylor expanded in angle around 0
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f6480.7
Applied rewrites80.7%
lift-pow.f64N/A
unpow2N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites77.5%
Applied rewrites80.7%
Final simplification67.8%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* a (* 0.005555555555555556 (* angle PI)))))
(if (<= a 9e-21)
(* (* b b) (fma 0.5 (cos (* PI (* angle 0.011111111111111112))) 0.5))
(fma
t_0
t_0
(* (* b b) (fma 0.5 (cos (* (* angle PI) 0.011111111111111112)) 0.5))))))
double code(double a, double b, double angle) {
double t_0 = a * (0.005555555555555556 * (angle * ((double) M_PI)));
double tmp;
if (a <= 9e-21) {
tmp = (b * b) * fma(0.5, cos((((double) M_PI) * (angle * 0.011111111111111112))), 0.5);
} else {
tmp = fma(t_0, t_0, ((b * b) * fma(0.5, cos(((angle * ((double) M_PI)) * 0.011111111111111112)), 0.5)));
}
return tmp;
}
function code(a, b, angle) t_0 = Float64(a * Float64(0.005555555555555556 * Float64(angle * pi))) tmp = 0.0 if (a <= 9e-21) tmp = Float64(Float64(b * b) * fma(0.5, cos(Float64(pi * Float64(angle * 0.011111111111111112))), 0.5)); else tmp = fma(t_0, t_0, Float64(Float64(b * b) * fma(0.5, cos(Float64(Float64(angle * pi) * 0.011111111111111112)), 0.5))); end return tmp end
code[a_, b_, angle_] := Block[{t$95$0 = N[(a * N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, 9e-21], N[(N[(b * b), $MachinePrecision] * N[(0.5 * N[Cos[N[(Pi * N[(angle * 0.011111111111111112), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * t$95$0 + N[(N[(b * b), $MachinePrecision] * N[(0.5 * N[Cos[N[(N[(angle * Pi), $MachinePrecision] * 0.011111111111111112), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\\
\mathbf{if}\;a \leq 9 \cdot 10^{-21}:\\
\;\;\;\;\left(b \cdot b\right) \cdot \mathsf{fma}\left(0.5, \cos \left(\pi \cdot \left(angle \cdot 0.011111111111111112\right)\right), 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, t\_0, \left(b \cdot b\right) \cdot \mathsf{fma}\left(0.5, \cos \left(\left(angle \cdot \pi\right) \cdot 0.011111111111111112\right), 0.5\right)\right)\\
\end{array}
\end{array}
if a < 8.99999999999999936e-21Initial program 76.9%
Applied rewrites51.7%
Taylor expanded in a around 0
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f64N/A
*-commutativeN/A
lower-*.f6463.4
Applied rewrites63.4%
if 8.99999999999999936e-21 < a Initial program 83.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
div-invN/A
lift-PI.f64N/A
add-sqr-sqrtN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-PI.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lift-PI.f64N/A
lower-sqrt.f64N/A
metadata-eval83.8
Applied rewrites83.8%
Taylor expanded in angle around 0
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f6480.7
Applied rewrites80.7%
lift-pow.f64N/A
unpow2N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites77.5%
Applied rewrites80.7%
Final simplification67.7%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* PI (* angle 0.005555555555555556))))
(if (<= a 9e-21)
(* (* b b) (fma 0.5 (cos (* PI (* angle 0.011111111111111112))) 0.5))
(+ (pow (* b 1.0) 2.0) (* a (* t_0 (* a t_0)))))))
double code(double a, double b, double angle) {
double t_0 = ((double) M_PI) * (angle * 0.005555555555555556);
double tmp;
if (a <= 9e-21) {
tmp = (b * b) * fma(0.5, cos((((double) M_PI) * (angle * 0.011111111111111112))), 0.5);
} else {
tmp = pow((b * 1.0), 2.0) + (a * (t_0 * (a * t_0)));
}
return tmp;
}
function code(a, b, angle) t_0 = Float64(pi * Float64(angle * 0.005555555555555556)) tmp = 0.0 if (a <= 9e-21) tmp = Float64(Float64(b * b) * fma(0.5, cos(Float64(pi * Float64(angle * 0.011111111111111112))), 0.5)); else tmp = Float64((Float64(b * 1.0) ^ 2.0) + Float64(a * Float64(t_0 * Float64(a * t_0)))); end return tmp end
code[a_, b_, angle_] := Block[{t$95$0 = N[(Pi * N[(angle * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, 9e-21], N[(N[(b * b), $MachinePrecision] * N[(0.5 * N[Cos[N[(Pi * N[(angle * 0.011111111111111112), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision], N[(N[Power[N[(b * 1.0), $MachinePrecision], 2.0], $MachinePrecision] + N[(a * N[(t$95$0 * N[(a * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \pi \cdot \left(angle \cdot 0.005555555555555556\right)\\
\mathbf{if}\;a \leq 9 \cdot 10^{-21}:\\
\;\;\;\;\left(b \cdot b\right) \cdot \mathsf{fma}\left(0.5, \cos \left(\pi \cdot \left(angle \cdot 0.011111111111111112\right)\right), 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;{\left(b \cdot 1\right)}^{2} + a \cdot \left(t\_0 \cdot \left(a \cdot t\_0\right)\right)\\
\end{array}
\end{array}
if a < 8.99999999999999936e-21Initial program 76.9%
Applied rewrites51.7%
Taylor expanded in a around 0
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f64N/A
*-commutativeN/A
lower-*.f6463.4
Applied rewrites63.4%
if 8.99999999999999936e-21 < a Initial program 83.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
div-invN/A
lift-PI.f64N/A
add-sqr-sqrtN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-PI.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lift-PI.f64N/A
lower-sqrt.f64N/A
metadata-eval83.8
Applied rewrites83.8%
Taylor expanded in angle around 0
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f6480.7
Applied rewrites80.7%
lift-pow.f64N/A
unpow2N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites77.5%
Taylor expanded in angle around 0
Applied rewrites77.5%
Final simplification66.9%
(FPCore (a b angle)
:precision binary64
(if (<= a 9e-21)
(* (* b b) (fma 0.5 (cos (* PI (* angle 0.011111111111111112))) 0.5))
(if (<= a 5.2e+157)
(fma
(* angle angle)
(* (* PI PI) (* (* a a) 3.08641975308642e-5))
(* b b))
(* (* a (* angle (* PI (* angle PI)))) (* a 3.08641975308642e-5)))))
double code(double a, double b, double angle) {
double tmp;
if (a <= 9e-21) {
tmp = (b * b) * fma(0.5, cos((((double) M_PI) * (angle * 0.011111111111111112))), 0.5);
} else if (a <= 5.2e+157) {
tmp = fma((angle * angle), ((((double) M_PI) * ((double) M_PI)) * ((a * a) * 3.08641975308642e-5)), (b * b));
} else {
tmp = (a * (angle * (((double) M_PI) * (angle * ((double) M_PI))))) * (a * 3.08641975308642e-5);
}
return tmp;
}
function code(a, b, angle) tmp = 0.0 if (a <= 9e-21) tmp = Float64(Float64(b * b) * fma(0.5, cos(Float64(pi * Float64(angle * 0.011111111111111112))), 0.5)); elseif (a <= 5.2e+157) tmp = fma(Float64(angle * angle), Float64(Float64(pi * pi) * Float64(Float64(a * a) * 3.08641975308642e-5)), Float64(b * b)); else tmp = Float64(Float64(a * Float64(angle * Float64(pi * Float64(angle * pi)))) * Float64(a * 3.08641975308642e-5)); end return tmp end
code[a_, b_, angle_] := If[LessEqual[a, 9e-21], N[(N[(b * b), $MachinePrecision] * N[(0.5 * N[Cos[N[(Pi * N[(angle * 0.011111111111111112), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 5.2e+157], N[(N[(angle * angle), $MachinePrecision] * N[(N[(Pi * Pi), $MachinePrecision] * N[(N[(a * a), $MachinePrecision] * 3.08641975308642e-5), $MachinePrecision]), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision], N[(N[(a * N[(angle * N[(Pi * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(a * 3.08641975308642e-5), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 9 \cdot 10^{-21}:\\
\;\;\;\;\left(b \cdot b\right) \cdot \mathsf{fma}\left(0.5, \cos \left(\pi \cdot \left(angle \cdot 0.011111111111111112\right)\right), 0.5\right)\\
\mathbf{elif}\;a \leq 5.2 \cdot 10^{+157}:\\
\;\;\;\;\mathsf{fma}\left(angle \cdot angle, \left(\pi \cdot \pi\right) \cdot \left(\left(a \cdot a\right) \cdot 3.08641975308642 \cdot 10^{-5}\right), b \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;\left(a \cdot \left(angle \cdot \left(\pi \cdot \left(angle \cdot \pi\right)\right)\right)\right) \cdot \left(a \cdot 3.08641975308642 \cdot 10^{-5}\right)\\
\end{array}
\end{array}
if a < 8.99999999999999936e-21Initial program 76.9%
Applied rewrites51.7%
Taylor expanded in a around 0
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f64N/A
*-commutativeN/A
lower-*.f6463.4
Applied rewrites63.4%
if 8.99999999999999936e-21 < a < 5.20000000000000022e157Initial program 72.1%
Taylor expanded in angle around 0
unpow2N/A
lower-*.f6455.5
Applied rewrites55.5%
Taylor expanded in angle around 0
lower-fma.f64N/A
Applied rewrites26.7%
Taylor expanded in b around 0
Applied rewrites61.8%
if 5.20000000000000022e157 < a Initial program 99.8%
Taylor expanded in angle around 0
unpow2N/A
lower-*.f6428.0
Applied rewrites28.0%
Taylor expanded in angle around 0
lower-fma.f64N/A
Applied rewrites59.5%
Taylor expanded in b around 0
Applied rewrites74.3%
Applied rewrites73.1%
Final simplification64.2%
(FPCore (a b angle)
:precision binary64
(if (<= a 9e-21)
(* (* b b) (fma 0.5 (cos (* angle (* PI 0.011111111111111112))) 0.5))
(if (<= a 5.2e+157)
(fma
(* angle angle)
(* (* PI PI) (* (* a a) 3.08641975308642e-5))
(* b b))
(* (* a (* angle (* PI (* angle PI)))) (* a 3.08641975308642e-5)))))
double code(double a, double b, double angle) {
double tmp;
if (a <= 9e-21) {
tmp = (b * b) * fma(0.5, cos((angle * (((double) M_PI) * 0.011111111111111112))), 0.5);
} else if (a <= 5.2e+157) {
tmp = fma((angle * angle), ((((double) M_PI) * ((double) M_PI)) * ((a * a) * 3.08641975308642e-5)), (b * b));
} else {
tmp = (a * (angle * (((double) M_PI) * (angle * ((double) M_PI))))) * (a * 3.08641975308642e-5);
}
return tmp;
}
function code(a, b, angle) tmp = 0.0 if (a <= 9e-21) tmp = Float64(Float64(b * b) * fma(0.5, cos(Float64(angle * Float64(pi * 0.011111111111111112))), 0.5)); elseif (a <= 5.2e+157) tmp = fma(Float64(angle * angle), Float64(Float64(pi * pi) * Float64(Float64(a * a) * 3.08641975308642e-5)), Float64(b * b)); else tmp = Float64(Float64(a * Float64(angle * Float64(pi * Float64(angle * pi)))) * Float64(a * 3.08641975308642e-5)); end return tmp end
code[a_, b_, angle_] := If[LessEqual[a, 9e-21], N[(N[(b * b), $MachinePrecision] * N[(0.5 * N[Cos[N[(angle * N[(Pi * 0.011111111111111112), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 5.2e+157], N[(N[(angle * angle), $MachinePrecision] * N[(N[(Pi * Pi), $MachinePrecision] * N[(N[(a * a), $MachinePrecision] * 3.08641975308642e-5), $MachinePrecision]), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision], N[(N[(a * N[(angle * N[(Pi * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(a * 3.08641975308642e-5), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 9 \cdot 10^{-21}:\\
\;\;\;\;\left(b \cdot b\right) \cdot \mathsf{fma}\left(0.5, \cos \left(angle \cdot \left(\pi \cdot 0.011111111111111112\right)\right), 0.5\right)\\
\mathbf{elif}\;a \leq 5.2 \cdot 10^{+157}:\\
\;\;\;\;\mathsf{fma}\left(angle \cdot angle, \left(\pi \cdot \pi\right) \cdot \left(\left(a \cdot a\right) \cdot 3.08641975308642 \cdot 10^{-5}\right), b \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;\left(a \cdot \left(angle \cdot \left(\pi \cdot \left(angle \cdot \pi\right)\right)\right)\right) \cdot \left(a \cdot 3.08641975308642 \cdot 10^{-5}\right)\\
\end{array}
\end{array}
if a < 8.99999999999999936e-21Initial program 76.9%
Applied rewrites51.9%
rem-square-sqrtN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
lower-*.f6451.9
Applied rewrites51.9%
Taylor expanded in a around 0
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f6463.4
Applied rewrites63.4%
if 8.99999999999999936e-21 < a < 5.20000000000000022e157Initial program 72.1%
Taylor expanded in angle around 0
unpow2N/A
lower-*.f6455.5
Applied rewrites55.5%
Taylor expanded in angle around 0
lower-fma.f64N/A
Applied rewrites26.7%
Taylor expanded in b around 0
Applied rewrites61.8%
if 5.20000000000000022e157 < a Initial program 99.8%
Taylor expanded in angle around 0
unpow2N/A
lower-*.f6428.0
Applied rewrites28.0%
Taylor expanded in angle around 0
lower-fma.f64N/A
Applied rewrites59.5%
Taylor expanded in b around 0
Applied rewrites74.3%
Applied rewrites73.1%
Final simplification64.2%
(FPCore (a b angle)
:precision binary64
(if (<= a 9e-21)
(* b b)
(if (<= a 5.2e+157)
(fma
(* angle angle)
(* (* PI PI) (* (* a a) 3.08641975308642e-5))
(* b b))
(* (* a (* angle (* PI (* angle PI)))) (* a 3.08641975308642e-5)))))
double code(double a, double b, double angle) {
double tmp;
if (a <= 9e-21) {
tmp = b * b;
} else if (a <= 5.2e+157) {
tmp = fma((angle * angle), ((((double) M_PI) * ((double) M_PI)) * ((a * a) * 3.08641975308642e-5)), (b * b));
} else {
tmp = (a * (angle * (((double) M_PI) * (angle * ((double) M_PI))))) * (a * 3.08641975308642e-5);
}
return tmp;
}
function code(a, b, angle) tmp = 0.0 if (a <= 9e-21) tmp = Float64(b * b); elseif (a <= 5.2e+157) tmp = fma(Float64(angle * angle), Float64(Float64(pi * pi) * Float64(Float64(a * a) * 3.08641975308642e-5)), Float64(b * b)); else tmp = Float64(Float64(a * Float64(angle * Float64(pi * Float64(angle * pi)))) * Float64(a * 3.08641975308642e-5)); end return tmp end
code[a_, b_, angle_] := If[LessEqual[a, 9e-21], N[(b * b), $MachinePrecision], If[LessEqual[a, 5.2e+157], N[(N[(angle * angle), $MachinePrecision] * N[(N[(Pi * Pi), $MachinePrecision] * N[(N[(a * a), $MachinePrecision] * 3.08641975308642e-5), $MachinePrecision]), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision], N[(N[(a * N[(angle * N[(Pi * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(a * 3.08641975308642e-5), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 9 \cdot 10^{-21}:\\
\;\;\;\;b \cdot b\\
\mathbf{elif}\;a \leq 5.2 \cdot 10^{+157}:\\
\;\;\;\;\mathsf{fma}\left(angle \cdot angle, \left(\pi \cdot \pi\right) \cdot \left(\left(a \cdot a\right) \cdot 3.08641975308642 \cdot 10^{-5}\right), b \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;\left(a \cdot \left(angle \cdot \left(\pi \cdot \left(angle \cdot \pi\right)\right)\right)\right) \cdot \left(a \cdot 3.08641975308642 \cdot 10^{-5}\right)\\
\end{array}
\end{array}
if a < 8.99999999999999936e-21Initial program 76.9%
Taylor expanded in angle around 0
unpow2N/A
lower-*.f6463.0
Applied rewrites63.0%
if 8.99999999999999936e-21 < a < 5.20000000000000022e157Initial program 72.1%
Taylor expanded in angle around 0
unpow2N/A
lower-*.f6455.5
Applied rewrites55.5%
Taylor expanded in angle around 0
lower-fma.f64N/A
Applied rewrites26.7%
Taylor expanded in b around 0
Applied rewrites61.8%
if 5.20000000000000022e157 < a Initial program 99.8%
Taylor expanded in angle around 0
unpow2N/A
lower-*.f6428.0
Applied rewrites28.0%
Taylor expanded in angle around 0
lower-fma.f64N/A
Applied rewrites59.5%
Taylor expanded in b around 0
Applied rewrites74.3%
Applied rewrites73.1%
Final simplification63.9%
(FPCore (a b angle) :precision binary64 (if (<= a 8.5e+152) (* b b) (* (* a (* angle (* PI (* angle PI)))) (* a 3.08641975308642e-5))))
double code(double a, double b, double angle) {
double tmp;
if (a <= 8.5e+152) {
tmp = b * b;
} else {
tmp = (a * (angle * (((double) M_PI) * (angle * ((double) M_PI))))) * (a * 3.08641975308642e-5);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (a <= 8.5e+152) {
tmp = b * b;
} else {
tmp = (a * (angle * (Math.PI * (angle * Math.PI)))) * (a * 3.08641975308642e-5);
}
return tmp;
}
def code(a, b, angle): tmp = 0 if a <= 8.5e+152: tmp = b * b else: tmp = (a * (angle * (math.pi * (angle * math.pi)))) * (a * 3.08641975308642e-5) return tmp
function code(a, b, angle) tmp = 0.0 if (a <= 8.5e+152) tmp = Float64(b * b); else tmp = Float64(Float64(a * Float64(angle * Float64(pi * Float64(angle * pi)))) * Float64(a * 3.08641975308642e-5)); end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (a <= 8.5e+152) tmp = b * b; else tmp = (a * (angle * (pi * (angle * pi)))) * (a * 3.08641975308642e-5); end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[a, 8.5e+152], N[(b * b), $MachinePrecision], N[(N[(a * N[(angle * N[(Pi * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(a * 3.08641975308642e-5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 8.5 \cdot 10^{+152}:\\
\;\;\;\;b \cdot b\\
\mathbf{else}:\\
\;\;\;\;\left(a \cdot \left(angle \cdot \left(\pi \cdot \left(angle \cdot \pi\right)\right)\right)\right) \cdot \left(a \cdot 3.08641975308642 \cdot 10^{-5}\right)\\
\end{array}
\end{array}
if a < 8.4999999999999993e152Initial program 76.0%
Taylor expanded in angle around 0
unpow2N/A
lower-*.f6461.6
Applied rewrites61.6%
if 8.4999999999999993e152 < a Initial program 99.8%
Taylor expanded in angle around 0
unpow2N/A
lower-*.f6430.6
Applied rewrites30.6%
Taylor expanded in angle around 0
lower-fma.f64N/A
Applied rewrites57.4%
Taylor expanded in b around 0
Applied rewrites75.2%
Applied rewrites74.0%
Final simplification63.0%
(FPCore (a b angle) :precision binary64 (if (<= a 8.5e+152) (* b b) (* a (* (* angle (* PI (* angle PI))) (* a 3.08641975308642e-5)))))
double code(double a, double b, double angle) {
double tmp;
if (a <= 8.5e+152) {
tmp = b * b;
} else {
tmp = a * ((angle * (((double) M_PI) * (angle * ((double) M_PI)))) * (a * 3.08641975308642e-5));
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (a <= 8.5e+152) {
tmp = b * b;
} else {
tmp = a * ((angle * (Math.PI * (angle * Math.PI))) * (a * 3.08641975308642e-5));
}
return tmp;
}
def code(a, b, angle): tmp = 0 if a <= 8.5e+152: tmp = b * b else: tmp = a * ((angle * (math.pi * (angle * math.pi))) * (a * 3.08641975308642e-5)) return tmp
function code(a, b, angle) tmp = 0.0 if (a <= 8.5e+152) tmp = Float64(b * b); else tmp = Float64(a * Float64(Float64(angle * Float64(pi * Float64(angle * pi))) * Float64(a * 3.08641975308642e-5))); end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (a <= 8.5e+152) tmp = b * b; else tmp = a * ((angle * (pi * (angle * pi))) * (a * 3.08641975308642e-5)); end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[a, 8.5e+152], N[(b * b), $MachinePrecision], N[(a * N[(N[(angle * N[(Pi * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(a * 3.08641975308642e-5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 8.5 \cdot 10^{+152}:\\
\;\;\;\;b \cdot b\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(\left(angle \cdot \left(\pi \cdot \left(angle \cdot \pi\right)\right)\right) \cdot \left(a \cdot 3.08641975308642 \cdot 10^{-5}\right)\right)\\
\end{array}
\end{array}
if a < 8.4999999999999993e152Initial program 76.0%
Taylor expanded in angle around 0
unpow2N/A
lower-*.f6461.6
Applied rewrites61.6%
if 8.4999999999999993e152 < a Initial program 99.8%
Taylor expanded in angle around 0
unpow2N/A
lower-*.f6430.6
Applied rewrites30.6%
Taylor expanded in angle around 0
lower-fma.f64N/A
Applied rewrites57.4%
Taylor expanded in b around 0
Applied rewrites75.2%
Applied rewrites74.0%
Final simplification63.0%
(FPCore (a b angle) :precision binary64 (* b b))
double code(double a, double b, double angle) {
return b * b;
}
real(8) function code(a, b, angle)
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 78.6%
Taylor expanded in angle around 0
unpow2N/A
lower-*.f6458.2
Applied rewrites58.2%
herbie shell --seed 2024237
(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)))