
(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 17 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 (/ PI (/ 180.0 angle)))) 2.0)
(pow
(*
b
(cos
(*
(pow (/ 180.0 (pow PI 0.6666666666666666)) -1.0)
(pow (/ (/ 1.0 angle) (cbrt PI)) -1.0))))
2.0)))
double code(double a, double b, double angle) {
return pow((a * sin((((double) M_PI) / (180.0 / angle)))), 2.0) + pow((b * cos((pow((180.0 / pow(((double) M_PI), 0.6666666666666666)), -1.0) * pow(((1.0 / angle) / cbrt(((double) M_PI))), -1.0)))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.sin((Math.PI / (180.0 / angle)))), 2.0) + Math.pow((b * Math.cos((Math.pow((180.0 / Math.pow(Math.PI, 0.6666666666666666)), -1.0) * Math.pow(((1.0 / angle) / Math.cbrt(Math.PI)), -1.0)))), 2.0);
}
function code(a, b, angle) return Float64((Float64(a * sin(Float64(pi / Float64(180.0 / angle)))) ^ 2.0) + (Float64(b * cos(Float64((Float64(180.0 / (pi ^ 0.6666666666666666)) ^ -1.0) * (Float64(Float64(1.0 / angle) / cbrt(pi)) ^ -1.0)))) ^ 2.0)) end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Sin[N[(Pi / N[(180.0 / angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[N[(N[Power[N[(180.0 / N[Power[Pi, 0.6666666666666666], $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision] * N[Power[N[(N[(1.0 / angle), $MachinePrecision] / N[Power[Pi, 1/3], $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \sin \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2} + {\left(b \cdot \cos \left({\left(\frac{180}{{\pi}^{0.6666666666666666}}\right)}^{-1} \cdot {\left(\frac{\frac{1}{angle}}{\sqrt[3]{\pi}}\right)}^{-1}\right)\right)}^{2}
\end{array}
Initial program 77.4%
lift-PI.f64N/A
associate-*l/N/A
clear-numN/A
associate-/r*N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6477.4
Applied rewrites77.4%
clear-numN/A
lift-/.f64N/A
lift-PI.f64N/A
associate-/r/N/A
inv-powN/A
lift-/.f64N/A
div-invN/A
inv-powN/A
metadata-evalN/A
pow-prod-upN/A
lift-pow.f64N/A
lift-pow.f64N/A
lift-PI.f64N/A
add-cube-cbrtN/A
times-fracN/A
unpow-prod-downN/A
lower-*.f64N/A
Applied rewrites77.5%
(FPCore (a b angle)
:precision binary64
(+
(pow (* a (sin (/ PI (/ 180.0 angle)))) 2.0)
(pow
(*
b
(cos
(*
(/ angle 180.0)
(* (pow (* (* PI PI) (sqrt PI)) 0.3333333333333333) (cbrt (sqrt PI))))))
2.0)))
double code(double a, double b, double angle) {
return pow((a * sin((((double) M_PI) / (180.0 / angle)))), 2.0) + pow((b * cos(((angle / 180.0) * (pow(((((double) M_PI) * ((double) M_PI)) * sqrt(((double) M_PI))), 0.3333333333333333) * cbrt(sqrt(((double) M_PI))))))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.sin((Math.PI / (180.0 / angle)))), 2.0) + Math.pow((b * Math.cos(((angle / 180.0) * (Math.pow(((Math.PI * Math.PI) * Math.sqrt(Math.PI)), 0.3333333333333333) * Math.cbrt(Math.sqrt(Math.PI)))))), 2.0);
}
function code(a, b, angle) return Float64((Float64(a * sin(Float64(pi / Float64(180.0 / angle)))) ^ 2.0) + (Float64(b * cos(Float64(Float64(angle / 180.0) * Float64((Float64(Float64(pi * pi) * sqrt(pi)) ^ 0.3333333333333333) * cbrt(sqrt(pi)))))) ^ 2.0)) end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Sin[N[(Pi / N[(180.0 / angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[N[(N[(angle / 180.0), $MachinePrecision] * N[(N[Power[N[(N[(Pi * Pi), $MachinePrecision] * N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision], 0.3333333333333333], $MachinePrecision] * N[Power[N[Sqrt[Pi], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \sin \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \left({\left(\left(\pi \cdot \pi\right) \cdot \sqrt{\pi}\right)}^{0.3333333333333333} \cdot \sqrt[3]{\sqrt{\pi}}\right)\right)\right)}^{2}
\end{array}
Initial program 77.4%
lift-PI.f64N/A
associate-*l/N/A
clear-numN/A
associate-/r*N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6477.4
Applied rewrites77.4%
add-cbrt-cubeN/A
pow1/3N/A
lift-PI.f64N/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
associate-*r*N/A
unpow-prod-downN/A
pow1/3N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lift-PI.f64N/A
lift-PI.f64N/A
lower-*.f64N/A
lower-cbrt.f6477.5
Applied rewrites77.5%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (/ (* PI 0.005555555555555556) (/ 1.0 angle)))) 2.0) (pow (* b (cos (* PI (/ angle 180.0)))) 2.0)))
double code(double a, double b, double angle) {
return pow((a * sin(((((double) M_PI) * 0.005555555555555556) / (1.0 / angle)))), 2.0) + pow((b * cos((((double) M_PI) * (angle / 180.0)))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.sin(((Math.PI * 0.005555555555555556) / (1.0 / angle)))), 2.0) + Math.pow((b * Math.cos((Math.PI * (angle / 180.0)))), 2.0);
}
def code(a, b, angle): return math.pow((a * math.sin(((math.pi * 0.005555555555555556) / (1.0 / angle)))), 2.0) + math.pow((b * math.cos((math.pi * (angle / 180.0)))), 2.0)
function code(a, b, angle) return Float64((Float64(a * sin(Float64(Float64(pi * 0.005555555555555556) / Float64(1.0 / angle)))) ^ 2.0) + (Float64(b * cos(Float64(pi * Float64(angle / 180.0)))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((a * sin(((pi * 0.005555555555555556) / (1.0 / angle)))) ^ 2.0) + ((b * cos((pi * (angle / 180.0)))) ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Sin[N[(N[(Pi * 0.005555555555555556), $MachinePrecision] / N[(1.0 / angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \sin \left(\frac{\pi \cdot 0.005555555555555556}{\frac{1}{angle}}\right)\right)}^{2} + {\left(b \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2}
\end{array}
Initial program 77.4%
lift-PI.f64N/A
associate-*l/N/A
clear-numN/A
associate-/r*N/A
clear-numN/A
div-invN/A
associate-/r*N/A
lower-/.f64N/A
div-invN/A
lower-*.f64N/A
metadata-evalN/A
lower-/.f6477.5
Applied rewrites77.5%
Final simplification77.5%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (* PI (/ angle 180.0)))) 2.0) (pow (* b (cos (/ (* PI angle) 180.0))) 2.0)))
double code(double a, double b, double angle) {
return pow((a * sin((((double) M_PI) * (angle / 180.0)))), 2.0) + pow((b * cos(((((double) M_PI) * angle) / 180.0))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.sin((Math.PI * (angle / 180.0)))), 2.0) + Math.pow((b * Math.cos(((Math.PI * angle) / 180.0))), 2.0);
}
def code(a, b, angle): return math.pow((a * math.sin((math.pi * (angle / 180.0)))), 2.0) + math.pow((b * math.cos(((math.pi * angle) / 180.0))), 2.0)
function code(a, b, angle) return Float64((Float64(a * sin(Float64(pi * Float64(angle / 180.0)))) ^ 2.0) + (Float64(b * cos(Float64(Float64(pi * angle) / 180.0))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((a * sin((pi * (angle / 180.0)))) ^ 2.0) + ((b * cos(((pi * angle) / 180.0))) ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Sin[N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[N[(N[(Pi * angle), $MachinePrecision] / 180.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{\pi \cdot angle}{180}\right)\right)}^{2}
\end{array}
Initial program 77.4%
lift-PI.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6477.5
Applied rewrites77.5%
Final simplification77.5%
(FPCore (a b angle) :precision binary64 (+ (pow (* b (cos (* PI (/ angle 180.0)))) 2.0) (pow (* a (sin (* angle (* PI 0.005555555555555556)))) 2.0)))
double code(double a, double b, double angle) {
return pow((b * cos((((double) M_PI) * (angle / 180.0)))), 2.0) + pow((a * sin((angle * (((double) M_PI) * 0.005555555555555556)))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((b * Math.cos((Math.PI * (angle / 180.0)))), 2.0) + Math.pow((a * Math.sin((angle * (Math.PI * 0.005555555555555556)))), 2.0);
}
def code(a, b, angle): return math.pow((b * math.cos((math.pi * (angle / 180.0)))), 2.0) + math.pow((a * math.sin((angle * (math.pi * 0.005555555555555556)))), 2.0)
function code(a, b, angle) return Float64((Float64(b * cos(Float64(pi * Float64(angle / 180.0)))) ^ 2.0) + (Float64(a * sin(Float64(angle * Float64(pi * 0.005555555555555556)))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((b * cos((pi * (angle / 180.0)))) ^ 2.0) + ((a * sin((angle * (pi * 0.005555555555555556)))) ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(b * N[Cos[N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(a * N[Sin[N[(angle * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(b \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(a \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)}^{2}
\end{array}
Initial program 77.4%
lift-PI.f64N/A
associate-*l/N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
div-invN/A
lower-*.f64N/A
metadata-eval77.5
Applied rewrites77.5%
Final simplification77.5%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (/ (* PI 0.005555555555555556) (/ 1.0 angle)))) 2.0) (pow b 2.0)))
double code(double a, double b, double angle) {
return pow((a * sin(((((double) M_PI) * 0.005555555555555556) / (1.0 / angle)))), 2.0) + pow(b, 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.sin(((Math.PI * 0.005555555555555556) / (1.0 / angle)))), 2.0) + Math.pow(b, 2.0);
}
def code(a, b, angle): return math.pow((a * math.sin(((math.pi * 0.005555555555555556) / (1.0 / angle)))), 2.0) + math.pow(b, 2.0)
function code(a, b, angle) return Float64((Float64(a * sin(Float64(Float64(pi * 0.005555555555555556) / Float64(1.0 / angle)))) ^ 2.0) + (b ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((a * sin(((pi * 0.005555555555555556) / (1.0 / angle)))) ^ 2.0) + (b ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Sin[N[(N[(Pi * 0.005555555555555556), $MachinePrecision] / N[(1.0 / angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \sin \left(\frac{\pi \cdot 0.005555555555555556}{\frac{1}{angle}}\right)\right)}^{2} + {b}^{2}
\end{array}
Initial program 77.4%
lift-PI.f64N/A
associate-*l/N/A
clear-numN/A
associate-/r*N/A
clear-numN/A
div-invN/A
associate-/r*N/A
lower-/.f64N/A
div-invN/A
lower-*.f64N/A
metadata-evalN/A
lower-/.f6477.5
Applied rewrites77.5%
Taylor expanded in angle around 0
Applied rewrites76.5%
Final simplification76.5%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (* PI (/ angle 180.0)))) 2.0) (pow b 2.0)))
double code(double a, double b, double angle) {
return pow((a * sin((((double) M_PI) * (angle / 180.0)))), 2.0) + pow(b, 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.sin((Math.PI * (angle / 180.0)))), 2.0) + Math.pow(b, 2.0);
}
def code(a, b, angle): return math.pow((a * math.sin((math.pi * (angle / 180.0)))), 2.0) + math.pow(b, 2.0)
function code(a, b, angle) return Float64((Float64(a * sin(Float64(pi * Float64(angle / 180.0)))) ^ 2.0) + (b ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((a * sin((pi * (angle / 180.0)))) ^ 2.0) + (b ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Sin[N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {b}^{2}
\end{array}
Initial program 77.4%
Taylor expanded in angle around 0
Applied rewrites76.4%
Final simplification76.4%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* PI (* angle 0.005555555555555556))) (t_1 (sin t_0)))
(if (<= (/ angle 180.0) 200000000.0)
(fma
(pow (* angle (* a 0.005555555555555556)) 2.0)
(* PI PI)
(* b (* b (+ 0.5 (* 0.5 (cos (* 2.0 t_0)))))))
(fma (* t_1 (* a a)) t_1 (* b b)))))
double code(double a, double b, double angle) {
double t_0 = ((double) M_PI) * (angle * 0.005555555555555556);
double t_1 = sin(t_0);
double tmp;
if ((angle / 180.0) <= 200000000.0) {
tmp = fma(pow((angle * (a * 0.005555555555555556)), 2.0), (((double) M_PI) * ((double) M_PI)), (b * (b * (0.5 + (0.5 * cos((2.0 * t_0)))))));
} else {
tmp = fma((t_1 * (a * a)), t_1, (b * b));
}
return tmp;
}
function code(a, b, angle) t_0 = Float64(pi * Float64(angle * 0.005555555555555556)) t_1 = sin(t_0) tmp = 0.0 if (Float64(angle / 180.0) <= 200000000.0) tmp = fma((Float64(angle * Float64(a * 0.005555555555555556)) ^ 2.0), Float64(pi * pi), Float64(b * Float64(b * Float64(0.5 + Float64(0.5 * cos(Float64(2.0 * t_0))))))); else tmp = fma(Float64(t_1 * Float64(a * a)), t_1, Float64(b * b)); end return tmp end
code[a_, b_, angle_] := Block[{t$95$0 = N[(Pi * N[(angle * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sin[t$95$0], $MachinePrecision]}, If[LessEqual[N[(angle / 180.0), $MachinePrecision], 200000000.0], N[(N[Power[N[(angle * N[(a * 0.005555555555555556), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(Pi * Pi), $MachinePrecision] + N[(b * N[(b * N[(0.5 + N[(0.5 * N[Cos[N[(2.0 * t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 * N[(a * a), $MachinePrecision]), $MachinePrecision] * t$95$1 + N[(b * b), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \pi \cdot \left(angle \cdot 0.005555555555555556\right)\\
t_1 := \sin t\_0\\
\mathbf{if}\;\frac{angle}{180} \leq 200000000:\\
\;\;\;\;\mathsf{fma}\left({\left(angle \cdot \left(a \cdot 0.005555555555555556\right)\right)}^{2}, \pi \cdot \pi, b \cdot \left(b \cdot \left(0.5 + 0.5 \cdot \cos \left(2 \cdot t\_0\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_1 \cdot \left(a \cdot a\right), t\_1, b \cdot b\right)\\
\end{array}
\end{array}
if (/.f64 angle #s(literal 180 binary64)) < 2e8Initial program 87.2%
Taylor expanded in angle around 0
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f6484.0
Applied rewrites84.0%
Applied rewrites84.1%
if 2e8 < (/.f64 angle #s(literal 180 binary64)) Initial program 54.8%
Applied rewrites54.6%
Taylor expanded in angle around 0
Applied rewrites54.9%
Final simplification75.3%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* PI (* angle 0.005555555555555556)))
(t_1 (* 0.005555555555555556 (* a (* PI angle))))
(t_2 (sin t_0)))
(if (<= (/ angle 180.0) 200000000.0)
(fma t_1 t_1 (* b (* b (+ 0.5 (* 0.5 (cos (* 2.0 t_0)))))))
(fma (* t_2 (* a a)) t_2 (* b b)))))
double code(double a, double b, double angle) {
double t_0 = ((double) M_PI) * (angle * 0.005555555555555556);
double t_1 = 0.005555555555555556 * (a * (((double) M_PI) * angle));
double t_2 = sin(t_0);
double tmp;
if ((angle / 180.0) <= 200000000.0) {
tmp = fma(t_1, t_1, (b * (b * (0.5 + (0.5 * cos((2.0 * t_0)))))));
} else {
tmp = fma((t_2 * (a * a)), t_2, (b * b));
}
return tmp;
}
function code(a, b, angle) t_0 = Float64(pi * Float64(angle * 0.005555555555555556)) t_1 = Float64(0.005555555555555556 * Float64(a * Float64(pi * angle))) t_2 = sin(t_0) tmp = 0.0 if (Float64(angle / 180.0) <= 200000000.0) tmp = fma(t_1, t_1, Float64(b * Float64(b * Float64(0.5 + Float64(0.5 * cos(Float64(2.0 * t_0))))))); else tmp = fma(Float64(t_2 * Float64(a * a)), t_2, Float64(b * b)); end return tmp end
code[a_, b_, angle_] := Block[{t$95$0 = N[(Pi * N[(angle * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.005555555555555556 * N[(a * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sin[t$95$0], $MachinePrecision]}, If[LessEqual[N[(angle / 180.0), $MachinePrecision], 200000000.0], N[(t$95$1 * t$95$1 + N[(b * N[(b * N[(0.5 + N[(0.5 * N[Cos[N[(2.0 * t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$2 * N[(a * a), $MachinePrecision]), $MachinePrecision] * t$95$2 + N[(b * b), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \pi \cdot \left(angle \cdot 0.005555555555555556\right)\\
t_1 := 0.005555555555555556 \cdot \left(a \cdot \left(\pi \cdot angle\right)\right)\\
t_2 := \sin t\_0\\
\mathbf{if}\;\frac{angle}{180} \leq 200000000:\\
\;\;\;\;\mathsf{fma}\left(t\_1, t\_1, b \cdot \left(b \cdot \left(0.5 + 0.5 \cdot \cos \left(2 \cdot t\_0\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_2 \cdot \left(a \cdot a\right), t\_2, b \cdot b\right)\\
\end{array}
\end{array}
if (/.f64 angle #s(literal 180 binary64)) < 2e8Initial program 87.2%
Taylor expanded in angle around 0
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f6484.0
Applied rewrites84.0%
Applied rewrites84.0%
if 2e8 < (/.f64 angle #s(literal 180 binary64)) Initial program 54.8%
Applied rewrites54.6%
Taylor expanded in angle around 0
Applied rewrites54.9%
Final simplification75.3%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* 0.005555555555555556 (* a (* PI angle)))))
(if (<= a 3.5e-15)
(* (* b b) (pow (cos (* angle (* PI 0.005555555555555556))) 2.0))
(fma
t_0
t_0
(*
b
(*
b
(+
0.5
(* 0.5 (cos (* 2.0 (* PI (* angle 0.005555555555555556))))))))))))
double code(double a, double b, double angle) {
double t_0 = 0.005555555555555556 * (a * (((double) M_PI) * angle));
double tmp;
if (a <= 3.5e-15) {
tmp = (b * b) * pow(cos((angle * (((double) M_PI) * 0.005555555555555556))), 2.0);
} else {
tmp = fma(t_0, t_0, (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(0.005555555555555556 * Float64(a * Float64(pi * angle))) tmp = 0.0 if (a <= 3.5e-15) tmp = Float64(Float64(b * b) * (cos(Float64(angle * Float64(pi * 0.005555555555555556))) ^ 2.0)); else tmp = fma(t_0, t_0, Float64(b * Float64(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[(0.005555555555555556 * N[(a * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, 3.5e-15], N[(N[(b * b), $MachinePrecision] * N[Power[N[Cos[N[(angle * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], N[(t$95$0 * t$95$0 + N[(b * N[(b * 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]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.005555555555555556 \cdot \left(a \cdot \left(\pi \cdot angle\right)\right)\\
\mathbf{if}\;a \leq 3.5 \cdot 10^{-15}:\\
\;\;\;\;\left(b \cdot b\right) \cdot {\cos \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, t\_0, b \cdot \left(b \cdot \left(0.5 + 0.5 \cdot \cos \left(2 \cdot \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)\right)\right)\right)\\
\end{array}
\end{array}
if a < 3.5000000000000001e-15Initial program 78.8%
lift-PI.f64N/A
associate-*l/N/A
clear-numN/A
associate-/r*N/A
clear-numN/A
div-invN/A
associate-/r*N/A
lower-/.f64N/A
div-invN/A
lower-*.f64N/A
metadata-evalN/A
lower-/.f6478.8
Applied rewrites78.8%
lift-PI.f64N/A
lift-/.f64N/A
lift-*.f64N/A
clear-numN/A
associate-/r/N/A
lift-*.f64N/A
metadata-evalN/A
div-invN/A
frac-2negN/A
metadata-evalN/A
frac-timesN/A
neg-mul-1N/A
lower-/.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lift-/.f64N/A
distribute-neg-fracN/A
metadata-evalN/A
lower-/.f6478.8
Applied rewrites78.8%
Taylor expanded in a around 0
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-pow.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6462.9
Applied rewrites62.9%
if 3.5000000000000001e-15 < a Initial program 74.0%
Taylor expanded in angle around 0
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f6470.4
Applied rewrites70.4%
Applied rewrites70.4%
Final simplification65.0%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* 0.005555555555555556 (* a (* PI angle)))))
(if (<= a 3.5e-15)
(* (* b b) (pow (cos (* 0.005555555555555556 (* PI angle))) 2.0))
(fma
t_0
t_0
(*
b
(*
b
(+
0.5
(* 0.5 (cos (* 2.0 (* PI (* angle 0.005555555555555556))))))))))))
double code(double a, double b, double angle) {
double t_0 = 0.005555555555555556 * (a * (((double) M_PI) * angle));
double tmp;
if (a <= 3.5e-15) {
tmp = (b * b) * pow(cos((0.005555555555555556 * (((double) M_PI) * angle))), 2.0);
} else {
tmp = fma(t_0, t_0, (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(0.005555555555555556 * Float64(a * Float64(pi * angle))) tmp = 0.0 if (a <= 3.5e-15) tmp = Float64(Float64(b * b) * (cos(Float64(0.005555555555555556 * Float64(pi * angle))) ^ 2.0)); else tmp = fma(t_0, t_0, Float64(b * Float64(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[(0.005555555555555556 * N[(a * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, 3.5e-15], N[(N[(b * b), $MachinePrecision] * N[Power[N[Cos[N[(0.005555555555555556 * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], N[(t$95$0 * t$95$0 + N[(b * N[(b * 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]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.005555555555555556 \cdot \left(a \cdot \left(\pi \cdot angle\right)\right)\\
\mathbf{if}\;a \leq 3.5 \cdot 10^{-15}:\\
\;\;\;\;\left(b \cdot b\right) \cdot {\cos \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, t\_0, b \cdot \left(b \cdot \left(0.5 + 0.5 \cdot \cos \left(2 \cdot \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)\right)\right)\right)\\
\end{array}
\end{array}
if a < 3.5000000000000001e-15Initial program 78.8%
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.f6462.9
Applied rewrites62.9%
if 3.5000000000000001e-15 < a Initial program 74.0%
Taylor expanded in angle around 0
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f6470.4
Applied rewrites70.4%
Applied rewrites70.4%
Final simplification65.0%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* 0.005555555555555556 (* a (* PI angle)))))
(if (<= a 3.5e-15)
(* (* b b) (fma 0.5 (cos (* angle (* PI 0.011111111111111112))) 0.5))
(fma
t_0
t_0
(*
b
(*
b
(+
0.5
(* 0.5 (cos (* 2.0 (* PI (* angle 0.005555555555555556))))))))))))
double code(double a, double b, double angle) {
double t_0 = 0.005555555555555556 * (a * (((double) M_PI) * angle));
double tmp;
if (a <= 3.5e-15) {
tmp = (b * b) * fma(0.5, cos((angle * (((double) M_PI) * 0.011111111111111112))), 0.5);
} else {
tmp = fma(t_0, t_0, (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(0.005555555555555556 * Float64(a * Float64(pi * angle))) tmp = 0.0 if (a <= 3.5e-15) tmp = Float64(Float64(b * b) * fma(0.5, cos(Float64(angle * Float64(pi * 0.011111111111111112))), 0.5)); else tmp = fma(t_0, t_0, Float64(b * Float64(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[(0.005555555555555556 * N[(a * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, 3.5e-15], N[(N[(b * b), $MachinePrecision] * N[(0.5 * N[Cos[N[(angle * N[(Pi * 0.011111111111111112), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * t$95$0 + N[(b * N[(b * 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]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.005555555555555556 \cdot \left(a \cdot \left(\pi \cdot angle\right)\right)\\
\mathbf{if}\;a \leq 3.5 \cdot 10^{-15}:\\
\;\;\;\;\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{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, t\_0, b \cdot \left(b \cdot \left(0.5 + 0.5 \cdot \cos \left(2 \cdot \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)\right)\right)\right)\\
\end{array}
\end{array}
if a < 3.5000000000000001e-15Initial program 78.8%
Applied rewrites73.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
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f6462.9
Applied rewrites62.9%
if 3.5000000000000001e-15 < a Initial program 74.0%
Taylor expanded in angle around 0
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f6470.4
Applied rewrites70.4%
Applied rewrites70.4%
Final simplification65.0%
(FPCore (a b angle) :precision binary64 (if (<= a 3.5e-15) (* (* b b) (fma 0.5 (cos (* angle (* PI 0.011111111111111112))) 0.5)) (fma (pow (* angle (* a 0.005555555555555556)) 2.0) (* PI PI) (* b b))))
double code(double a, double b, double angle) {
double tmp;
if (a <= 3.5e-15) {
tmp = (b * b) * fma(0.5, cos((angle * (((double) M_PI) * 0.011111111111111112))), 0.5);
} else {
tmp = fma(pow((angle * (a * 0.005555555555555556)), 2.0), (((double) M_PI) * ((double) M_PI)), (b * b));
}
return tmp;
}
function code(a, b, angle) tmp = 0.0 if (a <= 3.5e-15) tmp = Float64(Float64(b * b) * fma(0.5, cos(Float64(angle * Float64(pi * 0.011111111111111112))), 0.5)); else tmp = fma((Float64(angle * Float64(a * 0.005555555555555556)) ^ 2.0), Float64(pi * pi), Float64(b * b)); end return tmp end
code[a_, b_, angle_] := If[LessEqual[a, 3.5e-15], N[(N[(b * b), $MachinePrecision] * N[(0.5 * N[Cos[N[(angle * N[(Pi * 0.011111111111111112), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision], N[(N[Power[N[(angle * N[(a * 0.005555555555555556), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(Pi * Pi), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 3.5 \cdot 10^{-15}:\\
\;\;\;\;\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{else}:\\
\;\;\;\;\mathsf{fma}\left({\left(angle \cdot \left(a \cdot 0.005555555555555556\right)\right)}^{2}, \pi \cdot \pi, b \cdot b\right)\\
\end{array}
\end{array}
if a < 3.5000000000000001e-15Initial program 78.8%
Applied rewrites73.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
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f6462.9
Applied rewrites62.9%
if 3.5000000000000001e-15 < a Initial program 74.0%
Taylor expanded in angle around 0
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f6470.4
Applied rewrites70.4%
Applied rewrites70.4%
Taylor expanded in angle around 0
Applied rewrites69.9%
Final simplification64.8%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* angle (* a 0.005555555555555556))))
(if (<= a 2.6e+127)
(* (* b b) (fma 0.5 (cos (* angle (* PI 0.011111111111111112))) 0.5))
(* t_0 (* (* PI PI) t_0)))))
double code(double a, double b, double angle) {
double t_0 = angle * (a * 0.005555555555555556);
double tmp;
if (a <= 2.6e+127) {
tmp = (b * b) * fma(0.5, cos((angle * (((double) M_PI) * 0.011111111111111112))), 0.5);
} else {
tmp = t_0 * ((((double) M_PI) * ((double) M_PI)) * t_0);
}
return tmp;
}
function code(a, b, angle) t_0 = Float64(angle * Float64(a * 0.005555555555555556)) tmp = 0.0 if (a <= 2.6e+127) tmp = Float64(Float64(b * b) * fma(0.5, cos(Float64(angle * Float64(pi * 0.011111111111111112))), 0.5)); else tmp = Float64(t_0 * Float64(Float64(pi * pi) * t_0)); end return tmp end
code[a_, b_, angle_] := Block[{t$95$0 = N[(angle * N[(a * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, 2.6e+127], N[(N[(b * b), $MachinePrecision] * N[(0.5 * N[Cos[N[(angle * N[(Pi * 0.011111111111111112), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(N[(Pi * Pi), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := angle \cdot \left(a \cdot 0.005555555555555556\right)\\
\mathbf{if}\;a \leq 2.6 \cdot 10^{+127}:\\
\;\;\;\;\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{else}:\\
\;\;\;\;t\_0 \cdot \left(\left(\pi \cdot \pi\right) \cdot t\_0\right)\\
\end{array}
\end{array}
if a < 2.6000000000000002e127Initial program 75.8%
Applied rewrites71.5%
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.f6460.5
Applied rewrites60.5%
if 2.6000000000000002e127 < a Initial program 87.6%
lift-PI.f64N/A
associate-*l/N/A
clear-numN/A
associate-/r*N/A
clear-numN/A
div-invN/A
associate-/r*N/A
lower-/.f64N/A
div-invN/A
lower-*.f64N/A
metadata-evalN/A
lower-/.f6487.7
Applied rewrites87.7%
Taylor expanded in angle around 0
lower-fma.f64N/A
Applied rewrites44.8%
Taylor expanded in b around 0
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-PI.f64N/A
lower-PI.f6464.8
Applied rewrites64.8%
lift-*.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
Applied rewrites75.1%
Final simplification62.5%
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* angle (* a 0.005555555555555556)))) (if (<= a 2.6e+127) (* b b) (* t_0 (* (* PI PI) t_0)))))
double code(double a, double b, double angle) {
double t_0 = angle * (a * 0.005555555555555556);
double tmp;
if (a <= 2.6e+127) {
tmp = b * b;
} else {
tmp = t_0 * ((((double) M_PI) * ((double) M_PI)) * t_0);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double t_0 = angle * (a * 0.005555555555555556);
double tmp;
if (a <= 2.6e+127) {
tmp = b * b;
} else {
tmp = t_0 * ((Math.PI * Math.PI) * t_0);
}
return tmp;
}
def code(a, b, angle): t_0 = angle * (a * 0.005555555555555556) tmp = 0 if a <= 2.6e+127: tmp = b * b else: tmp = t_0 * ((math.pi * math.pi) * t_0) return tmp
function code(a, b, angle) t_0 = Float64(angle * Float64(a * 0.005555555555555556)) tmp = 0.0 if (a <= 2.6e+127) tmp = Float64(b * b); else tmp = Float64(t_0 * Float64(Float64(pi * pi) * t_0)); end return tmp end
function tmp_2 = code(a, b, angle) t_0 = angle * (a * 0.005555555555555556); tmp = 0.0; if (a <= 2.6e+127) tmp = b * b; else tmp = t_0 * ((pi * pi) * t_0); end tmp_2 = tmp; end
code[a_, b_, angle_] := Block[{t$95$0 = N[(angle * N[(a * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, 2.6e+127], N[(b * b), $MachinePrecision], N[(t$95$0 * N[(N[(Pi * Pi), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := angle \cdot \left(a \cdot 0.005555555555555556\right)\\
\mathbf{if}\;a \leq 2.6 \cdot 10^{+127}:\\
\;\;\;\;b \cdot b\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \left(\left(\pi \cdot \pi\right) \cdot t\_0\right)\\
\end{array}
\end{array}
if a < 2.6000000000000002e127Initial program 75.8%
Taylor expanded in angle around 0
unpow2N/A
lower-*.f6460.2
Applied rewrites60.2%
if 2.6000000000000002e127 < a Initial program 87.6%
lift-PI.f64N/A
associate-*l/N/A
clear-numN/A
associate-/r*N/A
clear-numN/A
div-invN/A
associate-/r*N/A
lower-/.f64N/A
div-invN/A
lower-*.f64N/A
metadata-evalN/A
lower-/.f6487.7
Applied rewrites87.7%
Taylor expanded in angle around 0
lower-fma.f64N/A
Applied rewrites44.8%
Taylor expanded in b around 0
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-PI.f64N/A
lower-PI.f6464.8
Applied rewrites64.8%
lift-*.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
Applied rewrites75.1%
Final simplification62.2%
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* a (* PI angle)))) (if (<= a 3e+127) (* b b) (* 3.08641975308642e-5 (* t_0 t_0)))))
double code(double a, double b, double angle) {
double t_0 = a * (((double) M_PI) * angle);
double tmp;
if (a <= 3e+127) {
tmp = b * b;
} else {
tmp = 3.08641975308642e-5 * (t_0 * t_0);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double t_0 = a * (Math.PI * angle);
double tmp;
if (a <= 3e+127) {
tmp = b * b;
} else {
tmp = 3.08641975308642e-5 * (t_0 * t_0);
}
return tmp;
}
def code(a, b, angle): t_0 = a * (math.pi * angle) tmp = 0 if a <= 3e+127: tmp = b * b else: tmp = 3.08641975308642e-5 * (t_0 * t_0) return tmp
function code(a, b, angle) t_0 = Float64(a * Float64(pi * angle)) tmp = 0.0 if (a <= 3e+127) tmp = Float64(b * b); else tmp = Float64(3.08641975308642e-5 * Float64(t_0 * t_0)); end return tmp end
function tmp_2 = code(a, b, angle) t_0 = a * (pi * angle); tmp = 0.0; if (a <= 3e+127) tmp = b * b; else tmp = 3.08641975308642e-5 * (t_0 * t_0); end tmp_2 = tmp; end
code[a_, b_, angle_] := Block[{t$95$0 = N[(a * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, 3e+127], N[(b * b), $MachinePrecision], N[(3.08641975308642e-5 * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot \left(\pi \cdot angle\right)\\
\mathbf{if}\;a \leq 3 \cdot 10^{+127}:\\
\;\;\;\;b \cdot b\\
\mathbf{else}:\\
\;\;\;\;3.08641975308642 \cdot 10^{-5} \cdot \left(t\_0 \cdot t\_0\right)\\
\end{array}
\end{array}
if a < 3.0000000000000002e127Initial program 75.8%
Taylor expanded in angle around 0
unpow2N/A
lower-*.f6460.2
Applied rewrites60.2%
if 3.0000000000000002e127 < a Initial program 87.6%
lift-PI.f64N/A
associate-*l/N/A
clear-numN/A
associate-/r*N/A
clear-numN/A
div-invN/A
associate-/r*N/A
lower-/.f64N/A
div-invN/A
lower-*.f64N/A
metadata-evalN/A
lower-/.f6487.7
Applied rewrites87.7%
Taylor expanded in angle around 0
lower-fma.f64N/A
Applied rewrites44.8%
Taylor expanded in b around 0
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-PI.f64N/A
lower-PI.f6464.8
Applied rewrites64.8%
Taylor expanded in angle around 0
lower-*.f64N/A
unpow2N/A
unpow2N/A
unpow2N/A
unswap-sqrN/A
unswap-sqrN/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f6475.0
Applied rewrites75.0%
Final simplification62.2%
(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 77.4%
Taylor expanded in angle around 0
unpow2N/A
lower-*.f6456.6
Applied rewrites56.6%
herbie shell --seed 2024216
(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)))