
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* (/ angle 180) PI))) (+ (pow (* a (sin t_0)) 2) (pow (* b (cos t_0)) 2))))
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), $MachinePrecision] * Pi), $MachinePrecision]}, N[(N[Power[N[(a * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2], $MachinePrecision] + N[Power[N[(b * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2], $MachinePrecision]), $MachinePrecision]]
\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}
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* (/ angle 180) PI))) (+ (pow (* a (sin t_0)) 2) (pow (* b (cos t_0)) 2))))
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), $MachinePrecision] * Pi), $MachinePrecision]}, N[(N[Power[N[(a * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2], $MachinePrecision] + N[Power[N[(b * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2], $MachinePrecision]), $MachinePrecision]]
\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}
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (* (/ angle 180) PI))) 2) (pow (* b (sin (* (pow PI 2/3) (* (cbrt PI) (- 1/2 (* 1/180 angle)))))) 2)))
double code(double a, double b, double angle) {
return pow((a * sin(((angle / 180.0) * ((double) M_PI)))), 2.0) + pow((b * sin((pow(((double) M_PI), 0.6666666666666666) * (cbrt(((double) M_PI)) * (0.5 - (0.005555555555555556 * 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.sin((Math.pow(Math.PI, 0.6666666666666666) * (Math.cbrt(Math.PI) * (0.5 - (0.005555555555555556 * angle)))))), 2.0);
}
function code(a, b, angle) return Float64((Float64(a * sin(Float64(Float64(angle / 180.0) * pi))) ^ 2.0) + (Float64(b * sin(Float64((pi ^ 0.6666666666666666) * Float64(cbrt(pi) * Float64(0.5 - Float64(0.005555555555555556 * angle)))))) ^ 2.0)) end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Sin[N[(N[(angle / 180), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2], $MachinePrecision] + N[Power[N[(b * N[Sin[N[(N[Power[Pi, 2/3], $MachinePrecision] * N[(N[Power[Pi, 1/3], $MachinePrecision] * N[(1/2 - N[(1/180 * angle), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2], $MachinePrecision]), $MachinePrecision]
{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \sin \left({\pi}^{\frac{2}{3}} \cdot \left(\sqrt[3]{\pi} \cdot \left(\frac{1}{2} - \frac{1}{180} \cdot angle\right)\right)\right)\right)}^{2}
Initial program 80.3%
lift-cos.f64N/A
cos-neg-revN/A
sin-+PI/2-revN/A
lower-sin.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lift-/.f64N/A
distribute-neg-fracN/A
lift-PI.f64N/A
mult-flipN/A
distribute-lft-outN/A
lower-*.f64N/A
lower-+.f64N/A
distribute-neg-fracN/A
mult-flipN/A
*-commutativeN/A
distribute-lft-neg-inN/A
distribute-frac-neg2N/A
lower-*.f64N/A
metadata-evalN/A
metadata-evalN/A
Applied rewrites80.3%
lift-*.f64N/A
lift-PI.f64N/A
add-cube-cbrtN/A
associate-*l*N/A
lower-*.f64N/A
lift-PI.f64N/A
pow1/3N/A
lift-PI.f64N/A
pow1/3N/A
pow-prod-upN/A
lower-pow.f64N/A
metadata-evalN/A
lower-*.f64N/A
lift-PI.f64N/A
lower-cbrt.f6480.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
lift-*.f64N/A
lower--.f6480.2%
Applied rewrites80.2%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (/ PI (/ 180 (fabs angle))))) 2) (* (+ 1/2 (* 1/2 (sin (* PI (- 1/2 (* 1/90 (fabs angle))))))) (* b b))))
double code(double a, double b, double angle) {
return pow((a * sin((((double) M_PI) / (180.0 / fabs(angle))))), 2.0) + ((0.5 + (0.5 * sin((((double) M_PI) * (0.5 - (0.011111111111111112 * fabs(angle))))))) * (b * b));
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.sin((Math.PI / (180.0 / Math.abs(angle))))), 2.0) + ((0.5 + (0.5 * Math.sin((Math.PI * (0.5 - (0.011111111111111112 * Math.abs(angle))))))) * (b * b));
}
def code(a, b, angle): return math.pow((a * math.sin((math.pi / (180.0 / math.fabs(angle))))), 2.0) + ((0.5 + (0.5 * math.sin((math.pi * (0.5 - (0.011111111111111112 * math.fabs(angle))))))) * (b * b))
function code(a, b, angle) return Float64((Float64(a * sin(Float64(pi / Float64(180.0 / abs(angle))))) ^ 2.0) + Float64(Float64(0.5 + Float64(0.5 * sin(Float64(pi * Float64(0.5 - Float64(0.011111111111111112 * abs(angle))))))) * Float64(b * b))) end
function tmp = code(a, b, angle) tmp = ((a * sin((pi / (180.0 / abs(angle))))) ^ 2.0) + ((0.5 + (0.5 * sin((pi * (0.5 - (0.011111111111111112 * abs(angle))))))) * (b * b)); end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Sin[N[(Pi / N[(180 / N[Abs[angle], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2], $MachinePrecision] + N[(N[(1/2 + N[(1/2 * N[Sin[N[(Pi * N[(1/2 - N[(1/90 * N[Abs[angle], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
{\left(a \cdot \sin \left(\frac{\pi}{\frac{180}{\left|angle\right|}}\right)\right)}^{2} + \left(\frac{1}{2} + \frac{1}{2} \cdot \sin \left(\pi \cdot \left(\frac{1}{2} - \frac{1}{90} \cdot \left|angle\right|\right)\right)\right) \cdot \left(b \cdot b\right)
Initial program 80.3%
lift-pow.f64N/A
unpow2N/A
lift-*.f64N/A
lift-*.f64N/A
swap-sqrN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites80.2%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
div-flip-revN/A
lift-/.f64N/A
mult-flip-revN/A
lower-/.f6480.2%
Applied rewrites80.2%
lift-cos.f64N/A
cos-neg-revN/A
sin-+PI/2-revN/A
lift-*.f64N/A
distribute-rgt-neg-inN/A
metadata-evalN/A
*-commutativeN/A
lift-*.f64N/A
lift-PI.f64N/A
mult-flipN/A
metadata-evalN/A
*-commutativeN/A
lift-*.f64N/A
+-commutativeN/A
lift-+.f64N/A
lift-sin.f6480.2%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
Applied rewrites80.2%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (* (/ angle 180) PI))) 2) (* (+ 1/2 (* 1/2 (cos (* (* 1/90 PI) angle)))) (* b b))))
double code(double a, double b, double angle) {
return pow((a * sin(((angle / 180.0) * ((double) M_PI)))), 2.0) + ((0.5 + (0.5 * cos(((0.011111111111111112 * ((double) M_PI)) * angle)))) * (b * b));
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.sin(((angle / 180.0) * Math.PI))), 2.0) + ((0.5 + (0.5 * Math.cos(((0.011111111111111112 * Math.PI) * angle)))) * (b * b));
}
def code(a, b, angle): return math.pow((a * math.sin(((angle / 180.0) * math.pi))), 2.0) + ((0.5 + (0.5 * math.cos(((0.011111111111111112 * math.pi) * angle)))) * (b * b))
function code(a, b, angle) return Float64((Float64(a * sin(Float64(Float64(angle / 180.0) * pi))) ^ 2.0) + Float64(Float64(0.5 + Float64(0.5 * cos(Float64(Float64(0.011111111111111112 * pi) * angle)))) * Float64(b * b))) end
function tmp = code(a, b, angle) tmp = ((a * sin(((angle / 180.0) * pi))) ^ 2.0) + ((0.5 + (0.5 * cos(((0.011111111111111112 * pi) * angle)))) * (b * b)); end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Sin[N[(N[(angle / 180), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2], $MachinePrecision] + N[(N[(1/2 + N[(1/2 * N[Cos[N[(N[(1/90 * Pi), $MachinePrecision] * angle), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + \left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(\left(\frac{1}{90} \cdot \pi\right) \cdot angle\right)\right) \cdot \left(b \cdot b\right)
Initial program 80.3%
lift-pow.f64N/A
unpow2N/A
lift-*.f64N/A
lift-*.f64N/A
swap-sqrN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites80.2%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6480.3%
Applied rewrites80.3%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (* (* PI angle) 1/180))) 2) (* (+ 1/2 (* 1/2 (cos (* (* PI angle) 1/90)))) (* b b))))
double code(double a, double b, double angle) {
return pow((a * sin(((((double) M_PI) * angle) * 0.005555555555555556))), 2.0) + ((0.5 + (0.5 * cos(((((double) M_PI) * angle) * 0.011111111111111112)))) * (b * b));
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.sin(((Math.PI * angle) * 0.005555555555555556))), 2.0) + ((0.5 + (0.5 * Math.cos(((Math.PI * angle) * 0.011111111111111112)))) * (b * b));
}
def code(a, b, angle): return math.pow((a * math.sin(((math.pi * angle) * 0.005555555555555556))), 2.0) + ((0.5 + (0.5 * math.cos(((math.pi * angle) * 0.011111111111111112)))) * (b * b))
function code(a, b, angle) return Float64((Float64(a * sin(Float64(Float64(pi * angle) * 0.005555555555555556))) ^ 2.0) + Float64(Float64(0.5 + Float64(0.5 * cos(Float64(Float64(pi * angle) * 0.011111111111111112)))) * Float64(b * b))) end
function tmp = code(a, b, angle) tmp = ((a * sin(((pi * angle) * 0.005555555555555556))) ^ 2.0) + ((0.5 + (0.5 * cos(((pi * angle) * 0.011111111111111112)))) * (b * b)); end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Sin[N[(N[(Pi * angle), $MachinePrecision] * 1/180), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2], $MachinePrecision] + N[(N[(1/2 + N[(1/2 * N[Cos[N[(N[(Pi * angle), $MachinePrecision] * 1/90), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
{\left(a \cdot \sin \left(\left(\pi \cdot angle\right) \cdot \frac{1}{180}\right)\right)}^{2} + \left(\frac{1}{2} + \frac{1}{2} \cdot \cos \left(\left(\pi \cdot angle\right) \cdot \frac{1}{90}\right)\right) \cdot \left(b \cdot b\right)
Initial program 80.3%
lift-pow.f64N/A
unpow2N/A
lift-*.f64N/A
lift-*.f64N/A
swap-sqrN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites80.2%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-commutativeN/A
lift-*.f64N/A
mult-flipN/A
metadata-evalN/A
lower-*.f6480.3%
Applied rewrites80.3%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (/ PI (/ 180 angle)))) 2) (* (+ 1/2 1/2) (* b b))))
double code(double a, double b, double angle) {
return pow((a * sin((((double) M_PI) / (180.0 / angle)))), 2.0) + ((0.5 + 0.5) * (b * b));
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.sin((Math.PI / (180.0 / angle)))), 2.0) + ((0.5 + 0.5) * (b * b));
}
def code(a, b, angle): return math.pow((a * math.sin((math.pi / (180.0 / angle)))), 2.0) + ((0.5 + 0.5) * (b * b))
function code(a, b, angle) return Float64((Float64(a * sin(Float64(pi / Float64(180.0 / angle)))) ^ 2.0) + Float64(Float64(0.5 + 0.5) * Float64(b * b))) end
function tmp = code(a, b, angle) tmp = ((a * sin((pi / (180.0 / angle)))) ^ 2.0) + ((0.5 + 0.5) * (b * b)); end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Sin[N[(Pi / N[(180 / angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2], $MachinePrecision] + N[(N[(1/2 + 1/2), $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
{\left(a \cdot \sin \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2} + \left(\frac{1}{2} + \frac{1}{2}\right) \cdot \left(b \cdot b\right)
Initial program 80.3%
lift-pow.f64N/A
unpow2N/A
lift-*.f64N/A
lift-*.f64N/A
swap-sqrN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites80.2%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
div-flip-revN/A
lift-/.f64N/A
mult-flip-revN/A
lower-/.f6480.2%
Applied rewrites80.2%
Taylor expanded in angle around 0
Applied rewrites80.1%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (* (/ angle 180) PI))) 2) (* (+ 1/2 1/2) (* b b))))
double code(double a, double b, double angle) {
return pow((a * sin(((angle / 180.0) * ((double) M_PI)))), 2.0) + ((0.5 + 0.5) * (b * b));
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.sin(((angle / 180.0) * Math.PI))), 2.0) + ((0.5 + 0.5) * (b * b));
}
def code(a, b, angle): return math.pow((a * math.sin(((angle / 180.0) * math.pi))), 2.0) + ((0.5 + 0.5) * (b * b))
function code(a, b, angle) return Float64((Float64(a * sin(Float64(Float64(angle / 180.0) * pi))) ^ 2.0) + Float64(Float64(0.5 + 0.5) * Float64(b * b))) end
function tmp = code(a, b, angle) tmp = ((a * sin(((angle / 180.0) * pi))) ^ 2.0) + ((0.5 + 0.5) * (b * b)); end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Sin[N[(N[(angle / 180), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2], $MachinePrecision] + N[(N[(1/2 + 1/2), $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + \left(\frac{1}{2} + \frac{1}{2}\right) \cdot \left(b \cdot b\right)
Initial program 80.3%
lift-pow.f64N/A
unpow2N/A
lift-*.f64N/A
lift-*.f64N/A
swap-sqrN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites80.2%
Taylor expanded in angle around 0
Applied rewrites80.1%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* (* (+ 1/2 1/2) b) b)))
(if (<= (fabs angle) 5224175567749775/18014398509481984)
(+
(* (* 1/32400 (* a (* (pow (fabs angle) 2) (pow PI 2)))) a)
t_0)
(+
(* (* a (- 1/2 (* 1/2 (cos (* 1/90 (* (fabs angle) PI)))))) a)
t_0))))double code(double a, double b, double angle) {
double t_0 = ((0.5 + 0.5) * b) * b;
double tmp;
if (fabs(angle) <= 0.29) {
tmp = ((3.08641975308642e-5 * (a * (pow(fabs(angle), 2.0) * pow(((double) M_PI), 2.0)))) * a) + t_0;
} else {
tmp = ((a * (0.5 - (0.5 * cos((0.011111111111111112 * (fabs(angle) * ((double) M_PI))))))) * a) + t_0;
}
return tmp;
}
public static double code(double a, double b, double angle) {
double t_0 = ((0.5 + 0.5) * b) * b;
double tmp;
if (Math.abs(angle) <= 0.29) {
tmp = ((3.08641975308642e-5 * (a * (Math.pow(Math.abs(angle), 2.0) * Math.pow(Math.PI, 2.0)))) * a) + t_0;
} else {
tmp = ((a * (0.5 - (0.5 * Math.cos((0.011111111111111112 * (Math.abs(angle) * Math.PI)))))) * a) + t_0;
}
return tmp;
}
def code(a, b, angle): t_0 = ((0.5 + 0.5) * b) * b tmp = 0 if math.fabs(angle) <= 0.29: tmp = ((3.08641975308642e-5 * (a * (math.pow(math.fabs(angle), 2.0) * math.pow(math.pi, 2.0)))) * a) + t_0 else: tmp = ((a * (0.5 - (0.5 * math.cos((0.011111111111111112 * (math.fabs(angle) * math.pi)))))) * a) + t_0 return tmp
function code(a, b, angle) t_0 = Float64(Float64(Float64(0.5 + 0.5) * b) * b) tmp = 0.0 if (abs(angle) <= 0.29) tmp = Float64(Float64(Float64(3.08641975308642e-5 * Float64(a * Float64((abs(angle) ^ 2.0) * (pi ^ 2.0)))) * a) + t_0); else tmp = Float64(Float64(Float64(a * Float64(0.5 - Float64(0.5 * cos(Float64(0.011111111111111112 * Float64(abs(angle) * pi)))))) * a) + t_0); end return tmp end
function tmp_2 = code(a, b, angle) t_0 = ((0.5 + 0.5) * b) * b; tmp = 0.0; if (abs(angle) <= 0.29) tmp = ((3.08641975308642e-5 * (a * ((abs(angle) ^ 2.0) * (pi ^ 2.0)))) * a) + t_0; else tmp = ((a * (0.5 - (0.5 * cos((0.011111111111111112 * (abs(angle) * pi)))))) * a) + t_0; end tmp_2 = tmp; end
code[a_, b_, angle_] := Block[{t$95$0 = N[(N[(N[(1/2 + 1/2), $MachinePrecision] * b), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[N[Abs[angle], $MachinePrecision], 5224175567749775/18014398509481984], N[(N[(N[(1/32400 * N[(a * N[(N[Power[N[Abs[angle], $MachinePrecision], 2], $MachinePrecision] * N[Power[Pi, 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision] + t$95$0), $MachinePrecision], N[(N[(N[(a * N[(1/2 - N[(1/2 * N[Cos[N[(1/90 * N[(N[Abs[angle], $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision] + t$95$0), $MachinePrecision]]]
\begin{array}{l}
t_0 := \left(\left(\frac{1}{2} + \frac{1}{2}\right) \cdot b\right) \cdot b\\
\mathbf{if}\;\left|angle\right| \leq \frac{5224175567749775}{18014398509481984}:\\
\;\;\;\;\left(\frac{1}{32400} \cdot \left(a \cdot \left({\left(\left|angle\right|\right)}^{2} \cdot {\pi}^{2}\right)\right)\right) \cdot a + t\_0\\
\mathbf{else}:\\
\;\;\;\;\left(a \cdot \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(\left|angle\right| \cdot \pi\right)\right)\right)\right) \cdot a + t\_0\\
\end{array}
if angle < 0.28999999999999998Initial program 80.3%
Applied rewrites68.5%
Taylor expanded in angle around 0
Applied rewrites57.6%
Taylor expanded in angle around 0
Applied rewrites57.7%
Taylor expanded in angle around 0
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f64N/A
lower-PI.f6471.0%
Applied rewrites71.0%
if 0.28999999999999998 < angle Initial program 80.3%
Applied rewrites68.5%
Taylor expanded in angle around 0
Applied rewrites57.6%
Taylor expanded in angle around 0
Applied rewrites57.7%
Taylor expanded in a around 0
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f6468.4%
Applied rewrites68.4%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* (fabs b) (fabs b))))
(if (<=
(fabs b)
7642277889662869/463168356949264781694283940034751631413079938662562256157830336031652518559744)
(+
(*
(*
(- (* t_0 -1/32400) (* (* a a) -1/32400))
(* (* PI PI) angle))
angle)
t_0)
(+
(* (* a (- 1/2 (* 1/2 (cos (* 1/90 (* angle PI)))))) a)
(* (* (+ 1/2 1/2) (fabs b)) (fabs b))))))double code(double a, double b, double angle) {
double t_0 = fabs(b) * fabs(b);
double tmp;
if (fabs(b) <= 1.65e-62) {
tmp = ((((t_0 * -3.08641975308642e-5) - ((a * a) * -3.08641975308642e-5)) * ((((double) M_PI) * ((double) M_PI)) * angle)) * angle) + t_0;
} else {
tmp = ((a * (0.5 - (0.5 * cos((0.011111111111111112 * (angle * ((double) M_PI))))))) * a) + (((0.5 + 0.5) * fabs(b)) * fabs(b));
}
return tmp;
}
public static double code(double a, double b, double angle) {
double t_0 = Math.abs(b) * Math.abs(b);
double tmp;
if (Math.abs(b) <= 1.65e-62) {
tmp = ((((t_0 * -3.08641975308642e-5) - ((a * a) * -3.08641975308642e-5)) * ((Math.PI * Math.PI) * angle)) * angle) + t_0;
} else {
tmp = ((a * (0.5 - (0.5 * Math.cos((0.011111111111111112 * (angle * Math.PI)))))) * a) + (((0.5 + 0.5) * Math.abs(b)) * Math.abs(b));
}
return tmp;
}
def code(a, b, angle): t_0 = math.fabs(b) * math.fabs(b) tmp = 0 if math.fabs(b) <= 1.65e-62: tmp = ((((t_0 * -3.08641975308642e-5) - ((a * a) * -3.08641975308642e-5)) * ((math.pi * math.pi) * angle)) * angle) + t_0 else: tmp = ((a * (0.5 - (0.5 * math.cos((0.011111111111111112 * (angle * math.pi)))))) * a) + (((0.5 + 0.5) * math.fabs(b)) * math.fabs(b)) return tmp
function code(a, b, angle) t_0 = Float64(abs(b) * abs(b)) tmp = 0.0 if (abs(b) <= 1.65e-62) tmp = Float64(Float64(Float64(Float64(Float64(t_0 * -3.08641975308642e-5) - Float64(Float64(a * a) * -3.08641975308642e-5)) * Float64(Float64(pi * pi) * angle)) * angle) + t_0); else tmp = Float64(Float64(Float64(a * Float64(0.5 - Float64(0.5 * cos(Float64(0.011111111111111112 * Float64(angle * pi)))))) * a) + Float64(Float64(Float64(0.5 + 0.5) * abs(b)) * abs(b))); end return tmp end
function tmp_2 = code(a, b, angle) t_0 = abs(b) * abs(b); tmp = 0.0; if (abs(b) <= 1.65e-62) tmp = ((((t_0 * -3.08641975308642e-5) - ((a * a) * -3.08641975308642e-5)) * ((pi * pi) * angle)) * angle) + t_0; else tmp = ((a * (0.5 - (0.5 * cos((0.011111111111111112 * (angle * pi)))))) * a) + (((0.5 + 0.5) * abs(b)) * abs(b)); end tmp_2 = tmp; end
code[a_, b_, angle_] := Block[{t$95$0 = N[(N[Abs[b], $MachinePrecision] * N[Abs[b], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[b], $MachinePrecision], 7642277889662869/463168356949264781694283940034751631413079938662562256157830336031652518559744], N[(N[(N[(N[(N[(t$95$0 * -1/32400), $MachinePrecision] - N[(N[(a * a), $MachinePrecision] * -1/32400), $MachinePrecision]), $MachinePrecision] * N[(N[(Pi * Pi), $MachinePrecision] * angle), $MachinePrecision]), $MachinePrecision] * angle), $MachinePrecision] + t$95$0), $MachinePrecision], N[(N[(N[(a * N[(1/2 - N[(1/2 * N[Cos[N[(1/90 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision] + N[(N[(N[(1/2 + 1/2), $MachinePrecision] * N[Abs[b], $MachinePrecision]), $MachinePrecision] * N[Abs[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \left|b\right| \cdot \left|b\right|\\
\mathbf{if}\;\left|b\right| \leq \frac{7642277889662869}{463168356949264781694283940034751631413079938662562256157830336031652518559744}:\\
\;\;\;\;\left(\left(t\_0 \cdot \frac{-1}{32400} - \left(a \cdot a\right) \cdot \frac{-1}{32400}\right) \cdot \left(\left(\pi \cdot \pi\right) \cdot angle\right)\right) \cdot angle + t\_0\\
\mathbf{else}:\\
\;\;\;\;\left(a \cdot \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \pi\right)\right)\right)\right) \cdot a + \left(\left(\frac{1}{2} + \frac{1}{2}\right) \cdot \left|b\right|\right) \cdot \left|b\right|\\
\end{array}
if b < 1.65e-62Initial program 80.3%
Taylor expanded in angle around 0
lower-+.f64N/A
Applied rewrites40.7%
Applied rewrites40.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites43.1%
if 1.65e-62 < b Initial program 80.3%
Applied rewrites68.5%
Taylor expanded in angle around 0
Applied rewrites57.6%
Taylor expanded in angle around 0
Applied rewrites57.7%
Taylor expanded in a around 0
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f6468.4%
Applied rewrites68.4%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* (fabs b) (fabs b))))
(if (<=
(fabs b)
2950000000000000059304930393302603223489185923540163102230528049495911188363352314194466435490646428401669785291287477296199626375736899804365586432)
(+
(*
(*
(- (* t_0 -1/32400) (* (* a a) -1/32400))
(* (* PI PI) angle))
angle)
t_0)
(+
(* (* (- 1/2 1/2) a) a)
(* (* (+ 1/2 1/2) (fabs b)) (fabs b))))))double code(double a, double b, double angle) {
double t_0 = fabs(b) * fabs(b);
double tmp;
if (fabs(b) <= 2.95e+147) {
tmp = ((((t_0 * -3.08641975308642e-5) - ((a * a) * -3.08641975308642e-5)) * ((((double) M_PI) * ((double) M_PI)) * angle)) * angle) + t_0;
} else {
tmp = (((0.5 - 0.5) * a) * a) + (((0.5 + 0.5) * fabs(b)) * fabs(b));
}
return tmp;
}
public static double code(double a, double b, double angle) {
double t_0 = Math.abs(b) * Math.abs(b);
double tmp;
if (Math.abs(b) <= 2.95e+147) {
tmp = ((((t_0 * -3.08641975308642e-5) - ((a * a) * -3.08641975308642e-5)) * ((Math.PI * Math.PI) * angle)) * angle) + t_0;
} else {
tmp = (((0.5 - 0.5) * a) * a) + (((0.5 + 0.5) * Math.abs(b)) * Math.abs(b));
}
return tmp;
}
def code(a, b, angle): t_0 = math.fabs(b) * math.fabs(b) tmp = 0 if math.fabs(b) <= 2.95e+147: tmp = ((((t_0 * -3.08641975308642e-5) - ((a * a) * -3.08641975308642e-5)) * ((math.pi * math.pi) * angle)) * angle) + t_0 else: tmp = (((0.5 - 0.5) * a) * a) + (((0.5 + 0.5) * math.fabs(b)) * math.fabs(b)) return tmp
function code(a, b, angle) t_0 = Float64(abs(b) * abs(b)) tmp = 0.0 if (abs(b) <= 2.95e+147) tmp = Float64(Float64(Float64(Float64(Float64(t_0 * -3.08641975308642e-5) - Float64(Float64(a * a) * -3.08641975308642e-5)) * Float64(Float64(pi * pi) * angle)) * angle) + t_0); else tmp = Float64(Float64(Float64(Float64(0.5 - 0.5) * a) * a) + Float64(Float64(Float64(0.5 + 0.5) * abs(b)) * abs(b))); end return tmp end
function tmp_2 = code(a, b, angle) t_0 = abs(b) * abs(b); tmp = 0.0; if (abs(b) <= 2.95e+147) tmp = ((((t_0 * -3.08641975308642e-5) - ((a * a) * -3.08641975308642e-5)) * ((pi * pi) * angle)) * angle) + t_0; else tmp = (((0.5 - 0.5) * a) * a) + (((0.5 + 0.5) * abs(b)) * abs(b)); end tmp_2 = tmp; end
code[a_, b_, angle_] := Block[{t$95$0 = N[(N[Abs[b], $MachinePrecision] * N[Abs[b], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[b], $MachinePrecision], 2950000000000000059304930393302603223489185923540163102230528049495911188363352314194466435490646428401669785291287477296199626375736899804365586432], N[(N[(N[(N[(N[(t$95$0 * -1/32400), $MachinePrecision] - N[(N[(a * a), $MachinePrecision] * -1/32400), $MachinePrecision]), $MachinePrecision] * N[(N[(Pi * Pi), $MachinePrecision] * angle), $MachinePrecision]), $MachinePrecision] * angle), $MachinePrecision] + t$95$0), $MachinePrecision], N[(N[(N[(N[(1/2 - 1/2), $MachinePrecision] * a), $MachinePrecision] * a), $MachinePrecision] + N[(N[(N[(1/2 + 1/2), $MachinePrecision] * N[Abs[b], $MachinePrecision]), $MachinePrecision] * N[Abs[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \left|b\right| \cdot \left|b\right|\\
\mathbf{if}\;\left|b\right| \leq 2950000000000000059304930393302603223489185923540163102230528049495911188363352314194466435490646428401669785291287477296199626375736899804365586432:\\
\;\;\;\;\left(\left(t\_0 \cdot \frac{-1}{32400} - \left(a \cdot a\right) \cdot \frac{-1}{32400}\right) \cdot \left(\left(\pi \cdot \pi\right) \cdot angle\right)\right) \cdot angle + t\_0\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\frac{1}{2} - \frac{1}{2}\right) \cdot a\right) \cdot a + \left(\left(\frac{1}{2} + \frac{1}{2}\right) \cdot \left|b\right|\right) \cdot \left|b\right|\\
\end{array}
if b < 2.9500000000000001e147Initial program 80.3%
Taylor expanded in angle around 0
lower-+.f64N/A
Applied rewrites40.7%
Applied rewrites40.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites43.1%
if 2.9500000000000001e147 < b Initial program 80.3%
Applied rewrites68.5%
Taylor expanded in angle around 0
Applied rewrites57.6%
Taylor expanded in angle around 0
Applied rewrites57.7%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* (fabs b) (fabs b))))
(if (<=
(fabs b)
2950000000000000059304930393302603223489185923540163102230528049495911188363352314194466435490646428401669785291287477296199626375736899804365586432)
(+
(*
(* (* PI PI) (+ (* -1/32400 t_0) (* (* 1/32400 a) a)))
(* angle angle))
t_0)
(+
(* (* (- 1/2 1/2) a) a)
(* (* (+ 1/2 1/2) (fabs b)) (fabs b))))))double code(double a, double b, double angle) {
double t_0 = fabs(b) * fabs(b);
double tmp;
if (fabs(b) <= 2.95e+147) {
tmp = (((((double) M_PI) * ((double) M_PI)) * ((-3.08641975308642e-5 * t_0) + ((3.08641975308642e-5 * a) * a))) * (angle * angle)) + t_0;
} else {
tmp = (((0.5 - 0.5) * a) * a) + (((0.5 + 0.5) * fabs(b)) * fabs(b));
}
return tmp;
}
public static double code(double a, double b, double angle) {
double t_0 = Math.abs(b) * Math.abs(b);
double tmp;
if (Math.abs(b) <= 2.95e+147) {
tmp = (((Math.PI * Math.PI) * ((-3.08641975308642e-5 * t_0) + ((3.08641975308642e-5 * a) * a))) * (angle * angle)) + t_0;
} else {
tmp = (((0.5 - 0.5) * a) * a) + (((0.5 + 0.5) * Math.abs(b)) * Math.abs(b));
}
return tmp;
}
def code(a, b, angle): t_0 = math.fabs(b) * math.fabs(b) tmp = 0 if math.fabs(b) <= 2.95e+147: tmp = (((math.pi * math.pi) * ((-3.08641975308642e-5 * t_0) + ((3.08641975308642e-5 * a) * a))) * (angle * angle)) + t_0 else: tmp = (((0.5 - 0.5) * a) * a) + (((0.5 + 0.5) * math.fabs(b)) * math.fabs(b)) return tmp
function code(a, b, angle) t_0 = Float64(abs(b) * abs(b)) tmp = 0.0 if (abs(b) <= 2.95e+147) tmp = Float64(Float64(Float64(Float64(pi * pi) * Float64(Float64(-3.08641975308642e-5 * t_0) + Float64(Float64(3.08641975308642e-5 * a) * a))) * Float64(angle * angle)) + t_0); else tmp = Float64(Float64(Float64(Float64(0.5 - 0.5) * a) * a) + Float64(Float64(Float64(0.5 + 0.5) * abs(b)) * abs(b))); end return tmp end
function tmp_2 = code(a, b, angle) t_0 = abs(b) * abs(b); tmp = 0.0; if (abs(b) <= 2.95e+147) tmp = (((pi * pi) * ((-3.08641975308642e-5 * t_0) + ((3.08641975308642e-5 * a) * a))) * (angle * angle)) + t_0; else tmp = (((0.5 - 0.5) * a) * a) + (((0.5 + 0.5) * abs(b)) * abs(b)); end tmp_2 = tmp; end
code[a_, b_, angle_] := Block[{t$95$0 = N[(N[Abs[b], $MachinePrecision] * N[Abs[b], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[b], $MachinePrecision], 2950000000000000059304930393302603223489185923540163102230528049495911188363352314194466435490646428401669785291287477296199626375736899804365586432], N[(N[(N[(N[(Pi * Pi), $MachinePrecision] * N[(N[(-1/32400 * t$95$0), $MachinePrecision] + N[(N[(1/32400 * a), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(angle * angle), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision], N[(N[(N[(N[(1/2 - 1/2), $MachinePrecision] * a), $MachinePrecision] * a), $MachinePrecision] + N[(N[(N[(1/2 + 1/2), $MachinePrecision] * N[Abs[b], $MachinePrecision]), $MachinePrecision] * N[Abs[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \left|b\right| \cdot \left|b\right|\\
\mathbf{if}\;\left|b\right| \leq 2950000000000000059304930393302603223489185923540163102230528049495911188363352314194466435490646428401669785291287477296199626375736899804365586432:\\
\;\;\;\;\left(\left(\pi \cdot \pi\right) \cdot \left(\frac{-1}{32400} \cdot t\_0 + \left(\frac{1}{32400} \cdot a\right) \cdot a\right)\right) \cdot \left(angle \cdot angle\right) + t\_0\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\frac{1}{2} - \frac{1}{2}\right) \cdot a\right) \cdot a + \left(\left(\frac{1}{2} + \frac{1}{2}\right) \cdot \left|b\right|\right) \cdot \left|b\right|\\
\end{array}
if b < 2.9500000000000001e147Initial program 80.3%
Taylor expanded in angle around 0
lower-+.f64N/A
Applied rewrites40.7%
Applied rewrites40.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6440.9%
Applied rewrites40.9%
if 2.9500000000000001e147 < b Initial program 80.3%
Applied rewrites68.5%
Taylor expanded in angle around 0
Applied rewrites57.6%
Taylor expanded in angle around 0
Applied rewrites57.7%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* (fabs b) (fabs b))))
(if (<=
(fabs b)
2950000000000000059304930393302603223489185923540163102230528049495911188363352314194466435490646428401669785291287477296199626375736899804365586432)
(+
(*
(* (* angle angle) PI)
(* (- (* t_0 -1/32400) (* (* a a) -1/32400)) PI))
t_0)
(+
(* (* (- 1/2 1/2) a) a)
(* (* (+ 1/2 1/2) (fabs b)) (fabs b))))))double code(double a, double b, double angle) {
double t_0 = fabs(b) * fabs(b);
double tmp;
if (fabs(b) <= 2.95e+147) {
tmp = (((angle * angle) * ((double) M_PI)) * (((t_0 * -3.08641975308642e-5) - ((a * a) * -3.08641975308642e-5)) * ((double) M_PI))) + t_0;
} else {
tmp = (((0.5 - 0.5) * a) * a) + (((0.5 + 0.5) * fabs(b)) * fabs(b));
}
return tmp;
}
public static double code(double a, double b, double angle) {
double t_0 = Math.abs(b) * Math.abs(b);
double tmp;
if (Math.abs(b) <= 2.95e+147) {
tmp = (((angle * angle) * Math.PI) * (((t_0 * -3.08641975308642e-5) - ((a * a) * -3.08641975308642e-5)) * Math.PI)) + t_0;
} else {
tmp = (((0.5 - 0.5) * a) * a) + (((0.5 + 0.5) * Math.abs(b)) * Math.abs(b));
}
return tmp;
}
def code(a, b, angle): t_0 = math.fabs(b) * math.fabs(b) tmp = 0 if math.fabs(b) <= 2.95e+147: tmp = (((angle * angle) * math.pi) * (((t_0 * -3.08641975308642e-5) - ((a * a) * -3.08641975308642e-5)) * math.pi)) + t_0 else: tmp = (((0.5 - 0.5) * a) * a) + (((0.5 + 0.5) * math.fabs(b)) * math.fabs(b)) return tmp
function code(a, b, angle) t_0 = Float64(abs(b) * abs(b)) tmp = 0.0 if (abs(b) <= 2.95e+147) tmp = Float64(Float64(Float64(Float64(angle * angle) * pi) * Float64(Float64(Float64(t_0 * -3.08641975308642e-5) - Float64(Float64(a * a) * -3.08641975308642e-5)) * pi)) + t_0); else tmp = Float64(Float64(Float64(Float64(0.5 - 0.5) * a) * a) + Float64(Float64(Float64(0.5 + 0.5) * abs(b)) * abs(b))); end return tmp end
function tmp_2 = code(a, b, angle) t_0 = abs(b) * abs(b); tmp = 0.0; if (abs(b) <= 2.95e+147) tmp = (((angle * angle) * pi) * (((t_0 * -3.08641975308642e-5) - ((a * a) * -3.08641975308642e-5)) * pi)) + t_0; else tmp = (((0.5 - 0.5) * a) * a) + (((0.5 + 0.5) * abs(b)) * abs(b)); end tmp_2 = tmp; end
code[a_, b_, angle_] := Block[{t$95$0 = N[(N[Abs[b], $MachinePrecision] * N[Abs[b], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[b], $MachinePrecision], 2950000000000000059304930393302603223489185923540163102230528049495911188363352314194466435490646428401669785291287477296199626375736899804365586432], N[(N[(N[(N[(angle * angle), $MachinePrecision] * Pi), $MachinePrecision] * N[(N[(N[(t$95$0 * -1/32400), $MachinePrecision] - N[(N[(a * a), $MachinePrecision] * -1/32400), $MachinePrecision]), $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision], N[(N[(N[(N[(1/2 - 1/2), $MachinePrecision] * a), $MachinePrecision] * a), $MachinePrecision] + N[(N[(N[(1/2 + 1/2), $MachinePrecision] * N[Abs[b], $MachinePrecision]), $MachinePrecision] * N[Abs[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \left|b\right| \cdot \left|b\right|\\
\mathbf{if}\;\left|b\right| \leq 2950000000000000059304930393302603223489185923540163102230528049495911188363352314194466435490646428401669785291287477296199626375736899804365586432:\\
\;\;\;\;\left(\left(angle \cdot angle\right) \cdot \pi\right) \cdot \left(\left(t\_0 \cdot \frac{-1}{32400} - \left(a \cdot a\right) \cdot \frac{-1}{32400}\right) \cdot \pi\right) + t\_0\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\frac{1}{2} - \frac{1}{2}\right) \cdot a\right) \cdot a + \left(\left(\frac{1}{2} + \frac{1}{2}\right) \cdot \left|b\right|\right) \cdot \left|b\right|\\
\end{array}
if b < 2.9500000000000001e147Initial program 80.3%
Taylor expanded in angle around 0
lower-+.f64N/A
Applied rewrites40.7%
Applied rewrites40.8%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6440.8%
Applied rewrites40.8%
if 2.9500000000000001e147 < b Initial program 80.3%
Applied rewrites68.5%
Taylor expanded in angle around 0
Applied rewrites57.6%
Taylor expanded in angle around 0
Applied rewrites57.7%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* (fabs b) (fabs b))))
(if (<=
(fabs b)
2950000000000000059304930393302603223489185923540163102230528049495911188363352314194466435490646428401669785291287477296199626375736899804365586432)
(+
(*
PI
(*
PI
(* (- (* t_0 -1/32400) (* (* a a) -1/32400)) (* angle angle))))
t_0)
(+
(* (* (- 1/2 1/2) a) a)
(* (* (+ 1/2 1/2) (fabs b)) (fabs b))))))double code(double a, double b, double angle) {
double t_0 = fabs(b) * fabs(b);
double tmp;
if (fabs(b) <= 2.95e+147) {
tmp = (((double) M_PI) * (((double) M_PI) * (((t_0 * -3.08641975308642e-5) - ((a * a) * -3.08641975308642e-5)) * (angle * angle)))) + t_0;
} else {
tmp = (((0.5 - 0.5) * a) * a) + (((0.5 + 0.5) * fabs(b)) * fabs(b));
}
return tmp;
}
public static double code(double a, double b, double angle) {
double t_0 = Math.abs(b) * Math.abs(b);
double tmp;
if (Math.abs(b) <= 2.95e+147) {
tmp = (Math.PI * (Math.PI * (((t_0 * -3.08641975308642e-5) - ((a * a) * -3.08641975308642e-5)) * (angle * angle)))) + t_0;
} else {
tmp = (((0.5 - 0.5) * a) * a) + (((0.5 + 0.5) * Math.abs(b)) * Math.abs(b));
}
return tmp;
}
def code(a, b, angle): t_0 = math.fabs(b) * math.fabs(b) tmp = 0 if math.fabs(b) <= 2.95e+147: tmp = (math.pi * (math.pi * (((t_0 * -3.08641975308642e-5) - ((a * a) * -3.08641975308642e-5)) * (angle * angle)))) + t_0 else: tmp = (((0.5 - 0.5) * a) * a) + (((0.5 + 0.5) * math.fabs(b)) * math.fabs(b)) return tmp
function code(a, b, angle) t_0 = Float64(abs(b) * abs(b)) tmp = 0.0 if (abs(b) <= 2.95e+147) tmp = Float64(Float64(pi * Float64(pi * Float64(Float64(Float64(t_0 * -3.08641975308642e-5) - Float64(Float64(a * a) * -3.08641975308642e-5)) * Float64(angle * angle)))) + t_0); else tmp = Float64(Float64(Float64(Float64(0.5 - 0.5) * a) * a) + Float64(Float64(Float64(0.5 + 0.5) * abs(b)) * abs(b))); end return tmp end
function tmp_2 = code(a, b, angle) t_0 = abs(b) * abs(b); tmp = 0.0; if (abs(b) <= 2.95e+147) tmp = (pi * (pi * (((t_0 * -3.08641975308642e-5) - ((a * a) * -3.08641975308642e-5)) * (angle * angle)))) + t_0; else tmp = (((0.5 - 0.5) * a) * a) + (((0.5 + 0.5) * abs(b)) * abs(b)); end tmp_2 = tmp; end
code[a_, b_, angle_] := Block[{t$95$0 = N[(N[Abs[b], $MachinePrecision] * N[Abs[b], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[b], $MachinePrecision], 2950000000000000059304930393302603223489185923540163102230528049495911188363352314194466435490646428401669785291287477296199626375736899804365586432], N[(N[(Pi * N[(Pi * N[(N[(N[(t$95$0 * -1/32400), $MachinePrecision] - N[(N[(a * a), $MachinePrecision] * -1/32400), $MachinePrecision]), $MachinePrecision] * N[(angle * angle), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision], N[(N[(N[(N[(1/2 - 1/2), $MachinePrecision] * a), $MachinePrecision] * a), $MachinePrecision] + N[(N[(N[(1/2 + 1/2), $MachinePrecision] * N[Abs[b], $MachinePrecision]), $MachinePrecision] * N[Abs[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \left|b\right| \cdot \left|b\right|\\
\mathbf{if}\;\left|b\right| \leq 2950000000000000059304930393302603223489185923540163102230528049495911188363352314194466435490646428401669785291287477296199626375736899804365586432:\\
\;\;\;\;\pi \cdot \left(\pi \cdot \left(\left(t\_0 \cdot \frac{-1}{32400} - \left(a \cdot a\right) \cdot \frac{-1}{32400}\right) \cdot \left(angle \cdot angle\right)\right)\right) + t\_0\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\frac{1}{2} - \frac{1}{2}\right) \cdot a\right) \cdot a + \left(\left(\frac{1}{2} + \frac{1}{2}\right) \cdot \left|b\right|\right) \cdot \left|b\right|\\
\end{array}
if b < 2.9500000000000001e147Initial program 80.3%
Taylor expanded in angle around 0
lower-+.f64N/A
Applied rewrites40.7%
Applied rewrites40.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6440.8%
Applied rewrites40.8%
if 2.9500000000000001e147 < b Initial program 80.3%
Applied rewrites68.5%
Taylor expanded in angle around 0
Applied rewrites57.6%
Taylor expanded in angle around 0
Applied rewrites57.7%
(FPCore (a b angle) :precision binary64 (+ (* (* (- 1/2 1/2) a) a) (* (* (+ 1/2 1/2) b) b)))
double code(double a, double b, double angle) {
return (((0.5 - 0.5) * a) * a) + (((0.5 + 0.5) * 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 = (((0.5d0 - 0.5d0) * a) * a) + (((0.5d0 + 0.5d0) * b) * b)
end function
public static double code(double a, double b, double angle) {
return (((0.5 - 0.5) * a) * a) + (((0.5 + 0.5) * b) * b);
}
def code(a, b, angle): return (((0.5 - 0.5) * a) * a) + (((0.5 + 0.5) * b) * b)
function code(a, b, angle) return Float64(Float64(Float64(Float64(0.5 - 0.5) * a) * a) + Float64(Float64(Float64(0.5 + 0.5) * b) * b)) end
function tmp = code(a, b, angle) tmp = (((0.5 - 0.5) * a) * a) + (((0.5 + 0.5) * b) * b); end
code[a_, b_, angle_] := N[(N[(N[(N[(1/2 - 1/2), $MachinePrecision] * a), $MachinePrecision] * a), $MachinePrecision] + N[(N[(N[(1/2 + 1/2), $MachinePrecision] * b), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\left(\left(\frac{1}{2} - \frac{1}{2}\right) \cdot a\right) \cdot a + \left(\left(\frac{1}{2} + \frac{1}{2}\right) \cdot b\right) \cdot b
Initial program 80.3%
Applied rewrites68.5%
Taylor expanded in angle around 0
Applied rewrites57.6%
Taylor expanded in angle around 0
Applied rewrites57.7%
herbie shell --seed 2025285 -o generate:evaluate
(FPCore (a b angle)
:name "ab-angle->ABCF A"
:precision binary64
(+ (pow (* a (sin (* (/ angle 180) PI))) 2) (pow (* b (cos (* (/ angle 180) PI))) 2)))