
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* PI (/ angle 180.0)))) (+ (pow (* a (cos t_0)) 2.0) (pow (* b (sin t_0)) 2.0))))
double code(double a, double b, double angle) {
double t_0 = ((double) M_PI) * (angle / 180.0);
return pow((a * cos(t_0)), 2.0) + pow((b * sin(t_0)), 2.0);
}
public static double code(double a, double b, double angle) {
double t_0 = Math.PI * (angle / 180.0);
return Math.pow((a * Math.cos(t_0)), 2.0) + Math.pow((b * Math.sin(t_0)), 2.0);
}
def code(a, b, angle): t_0 = math.pi * (angle / 180.0) return math.pow((a * math.cos(t_0)), 2.0) + math.pow((b * math.sin(t_0)), 2.0)
function code(a, b, angle) t_0 = Float64(pi * Float64(angle / 180.0)) return Float64((Float64(a * cos(t_0)) ^ 2.0) + (Float64(b * sin(t_0)) ^ 2.0)) end
function tmp = code(a, b, angle) t_0 = pi * (angle / 180.0); tmp = ((a * cos(t_0)) ^ 2.0) + ((b * sin(t_0)) ^ 2.0); end
code[a_, b_, angle_] := Block[{t$95$0 = N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]}, N[(N[Power[N[(a * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \pi \cdot \frac{angle}{180}\\
{\left(a \cdot \cos t\_0\right)}^{2} + {\left(b \cdot \sin t\_0\right)}^{2}
\end{array}
\end{array}
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* PI (/ angle 180.0)))) (+ (pow (* a (cos t_0)) 2.0) (pow (* b (sin t_0)) 2.0))))
double code(double a, double b, double angle) {
double t_0 = ((double) M_PI) * (angle / 180.0);
return pow((a * cos(t_0)), 2.0) + pow((b * sin(t_0)), 2.0);
}
public static double code(double a, double b, double angle) {
double t_0 = Math.PI * (angle / 180.0);
return Math.pow((a * Math.cos(t_0)), 2.0) + Math.pow((b * Math.sin(t_0)), 2.0);
}
def code(a, b, angle): t_0 = math.pi * (angle / 180.0) return math.pow((a * math.cos(t_0)), 2.0) + math.pow((b * math.sin(t_0)), 2.0)
function code(a, b, angle) t_0 = Float64(pi * Float64(angle / 180.0)) return Float64((Float64(a * cos(t_0)) ^ 2.0) + (Float64(b * sin(t_0)) ^ 2.0)) end
function tmp = code(a, b, angle) t_0 = pi * (angle / 180.0); tmp = ((a * cos(t_0)) ^ 2.0) + ((b * sin(t_0)) ^ 2.0); end
code[a_, b_, angle_] := Block[{t$95$0 = N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]}, N[(N[Power[N[(a * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \pi \cdot \frac{angle}{180}\\
{\left(a \cdot \cos t\_0\right)}^{2} + {\left(b \cdot \sin t\_0\right)}^{2}
\end{array}
\end{array}
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
:precision binary64
(let* ((t_0 (* (sqrt (/ 0.005555555555555556 angle_m)) angle_m)))
(+
(pow (* a (sin (fma (* t_0 t_0) PI (/ PI 2.0)))) 2.0)
(pow (* b (sin (* PI (/ angle_m 180.0)))) 2.0))))angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double t_0 = sqrt((0.005555555555555556 / angle_m)) * angle_m;
return pow((a * sin(fma((t_0 * t_0), ((double) M_PI), (((double) M_PI) / 2.0)))), 2.0) + pow((b * sin((((double) M_PI) * (angle_m / 180.0)))), 2.0);
}
angle_m = abs(angle) function code(a, b, angle_m) t_0 = Float64(sqrt(Float64(0.005555555555555556 / angle_m)) * angle_m) return Float64((Float64(a * sin(fma(Float64(t_0 * t_0), pi, Float64(pi / 2.0)))) ^ 2.0) + (Float64(b * sin(Float64(pi * Float64(angle_m / 180.0)))) ^ 2.0)) end
angle_m = N[Abs[angle], $MachinePrecision]
code[a_, b_, angle$95$m_] := Block[{t$95$0 = N[(N[Sqrt[N[(0.005555555555555556 / angle$95$m), $MachinePrecision]], $MachinePrecision] * angle$95$m), $MachinePrecision]}, N[(N[Power[N[(a * N[Sin[N[(N[(t$95$0 * t$95$0), $MachinePrecision] * Pi + N[(Pi / 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[N[(Pi * N[(angle$95$m / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
t_0 := \sqrt{\frac{0.005555555555555556}{angle\_m}} \cdot angle\_m\\
{\left(a \cdot \sin \left(\mathsf{fma}\left(t\_0 \cdot t\_0, \pi, \frac{\pi}{2}\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle\_m}{180}\right)\right)}^{2}
\end{array}
\end{array}
Initial program 79.8%
lift-cos.f64N/A
cos-fabs-revN/A
sin-+PI/2-revN/A
lower-sin.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
*-commutativeN/A
fabs-mulN/A
add-exp-logN/A
exp-fabsN/A
add-exp-logN/A
lower-fma.f64N/A
lower-fabs.f64N/A
lift-/.f64N/A
mult-flipN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
lift-PI.f64N/A
lower-/.f64N/A
lift-PI.f6479.8
Applied rewrites79.8%
lift-fabs.f64N/A
rem-sqrt-square-revN/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f6479.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6479.8
Applied rewrites79.8%
Taylor expanded in angle around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6479.8
Applied rewrites79.8%
Taylor expanded in angle around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6479.8
Applied rewrites79.8%
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
:precision binary64
(let* ((t_0 (sqrt (* 0.005555555555555556 angle_m))))
(+
(pow (* a (sin (fma t_0 (* t_0 PI) (* 0.5 PI)))) 2.0)
(pow (* b (sin (* PI (/ angle_m 180.0)))) 2.0))))angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double t_0 = sqrt((0.005555555555555556 * angle_m));
return pow((a * sin(fma(t_0, (t_0 * ((double) M_PI)), (0.5 * ((double) M_PI))))), 2.0) + pow((b * sin((((double) M_PI) * (angle_m / 180.0)))), 2.0);
}
angle_m = abs(angle) function code(a, b, angle_m) t_0 = sqrt(Float64(0.005555555555555556 * angle_m)) return Float64((Float64(a * sin(fma(t_0, Float64(t_0 * pi), Float64(0.5 * pi)))) ^ 2.0) + (Float64(b * sin(Float64(pi * Float64(angle_m / 180.0)))) ^ 2.0)) end
angle_m = N[Abs[angle], $MachinePrecision]
code[a_, b_, angle$95$m_] := Block[{t$95$0 = N[Sqrt[N[(0.005555555555555556 * angle$95$m), $MachinePrecision]], $MachinePrecision]}, N[(N[Power[N[(a * N[Sin[N[(t$95$0 * N[(t$95$0 * Pi), $MachinePrecision] + N[(0.5 * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[N[(Pi * N[(angle$95$m / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
t_0 := \sqrt{0.005555555555555556 \cdot angle\_m}\\
{\left(a \cdot \sin \left(\mathsf{fma}\left(t\_0, t\_0 \cdot \pi, 0.5 \cdot \pi\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle\_m}{180}\right)\right)}^{2}
\end{array}
\end{array}
Initial program 79.8%
lift-cos.f64N/A
cos-fabs-revN/A
sin-+PI/2-revN/A
lower-sin.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
*-commutativeN/A
fabs-mulN/A
add-exp-logN/A
exp-fabsN/A
add-exp-logN/A
lower-fma.f64N/A
lower-fabs.f64N/A
lift-/.f64N/A
mult-flipN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
lift-PI.f64N/A
lower-/.f64N/A
lift-PI.f6479.8
Applied rewrites79.8%
lift-fabs.f64N/A
rem-sqrt-square-revN/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f6479.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6479.8
Applied rewrites79.8%
lift-PI.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
associate-*l*N/A
lift-PI.f64N/A
lift-/.f64N/A
mult-flipN/A
metadata-evalN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites79.8%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow (* a (sin (fma (fabs (* 0.005555555555555556 angle_m)) PI (/ PI 2.0)))) 2.0) (pow (* b (sin (* (* PI 0.005555555555555556) angle_m))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow((a * sin(fma(fabs((0.005555555555555556 * angle_m)), ((double) M_PI), (((double) M_PI) / 2.0)))), 2.0) + pow((b * sin(((((double) M_PI) * 0.005555555555555556) * angle_m))), 2.0);
}
angle_m = abs(angle) function code(a, b, angle_m) return Float64((Float64(a * sin(fma(abs(Float64(0.005555555555555556 * angle_m)), pi, Float64(pi / 2.0)))) ^ 2.0) + (Float64(b * sin(Float64(Float64(pi * 0.005555555555555556) * angle_m))) ^ 2.0)) end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(N[Power[N[(a * N[Sin[N[(N[Abs[N[(0.005555555555555556 * angle$95$m), $MachinePrecision]], $MachinePrecision] * Pi + N[(Pi / 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[N[(N[(Pi * 0.005555555555555556), $MachinePrecision] * angle$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{\left(a \cdot \sin \left(\mathsf{fma}\left(\left|0.005555555555555556 \cdot angle\_m\right|, \pi, \frac{\pi}{2}\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\left(\pi \cdot 0.005555555555555556\right) \cdot angle\_m\right)\right)}^{2}
\end{array}
Initial program 79.8%
lift-cos.f64N/A
cos-fabs-revN/A
sin-+PI/2-revN/A
lower-sin.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
*-commutativeN/A
fabs-mulN/A
add-exp-logN/A
exp-fabsN/A
add-exp-logN/A
lower-fma.f64N/A
lower-fabs.f64N/A
lift-/.f64N/A
mult-flipN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
lift-PI.f64N/A
lower-/.f64N/A
lift-PI.f6479.8
Applied rewrites79.8%
lift-PI.f64N/A
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
metadata-evalN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-PI.f6479.8
Applied rewrites79.8%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (* (+ 0.5 (* 0.5 (cos (* 2.0 (* (* 0.005555555555555556 (fabs angle_m)) PI))))) (* a a)) (pow (* b (sin (* (* PI 0.005555555555555556) angle_m))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return ((0.5 + (0.5 * cos((2.0 * ((0.005555555555555556 * fabs(angle_m)) * ((double) M_PI)))))) * (a * a)) + pow((b * sin(((((double) M_PI) * 0.005555555555555556) * angle_m))), 2.0);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return ((0.5 + (0.5 * Math.cos((2.0 * ((0.005555555555555556 * Math.abs(angle_m)) * Math.PI))))) * (a * a)) + Math.pow((b * Math.sin(((Math.PI * 0.005555555555555556) * angle_m))), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return ((0.5 + (0.5 * math.cos((2.0 * ((0.005555555555555556 * math.fabs(angle_m)) * math.pi))))) * (a * a)) + math.pow((b * math.sin(((math.pi * 0.005555555555555556) * angle_m))), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) return Float64(Float64(Float64(0.5 + Float64(0.5 * cos(Float64(2.0 * Float64(Float64(0.005555555555555556 * abs(angle_m)) * pi))))) * Float64(a * a)) + (Float64(b * sin(Float64(Float64(pi * 0.005555555555555556) * angle_m))) ^ 2.0)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = ((0.5 + (0.5 * cos((2.0 * ((0.005555555555555556 * abs(angle_m)) * pi))))) * (a * a)) + ((b * sin(((pi * 0.005555555555555556) * angle_m))) ^ 2.0); end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(N[(N[(0.5 + N[(0.5 * N[Cos[N[(2.0 * N[(N[(0.005555555555555556 * N[Abs[angle$95$m], $MachinePrecision]), $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(a * a), $MachinePrecision]), $MachinePrecision] + N[Power[N[(b * N[Sin[N[(N[(Pi * 0.005555555555555556), $MachinePrecision] * angle$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\left(0.5 + 0.5 \cdot \cos \left(2 \cdot \left(\left(0.005555555555555556 \cdot \left|angle\_m\right|\right) \cdot \pi\right)\right)\right) \cdot \left(a \cdot a\right) + {\left(b \cdot \sin \left(\left(\pi \cdot 0.005555555555555556\right) \cdot angle\_m\right)\right)}^{2}
\end{array}
Initial program 79.8%
lift-cos.f64N/A
cos-fabs-revN/A
sin-+PI/2-revN/A
lower-sin.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
*-commutativeN/A
fabs-mulN/A
add-exp-logN/A
exp-fabsN/A
add-exp-logN/A
lower-fma.f64N/A
lower-fabs.f64N/A
lift-/.f64N/A
mult-flipN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
lift-PI.f64N/A
lower-/.f64N/A
lift-PI.f6479.8
Applied rewrites79.8%
lift-PI.f64N/A
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
metadata-evalN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-PI.f6479.8
Applied rewrites79.8%
lift-pow.f64N/A
lift-*.f64N/A
*-commutativeN/A
unpow-prod-downN/A
Applied rewrites79.8%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow (* a 1.0) 2.0) (pow (* b (sin (* PI (/ angle_m 180.0)))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow((a * 1.0), 2.0) + pow((b * sin((((double) M_PI) * (angle_m / 180.0)))), 2.0);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return Math.pow((a * 1.0), 2.0) + Math.pow((b * Math.sin((Math.PI * (angle_m / 180.0)))), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow((a * 1.0), 2.0) + math.pow((b * math.sin((math.pi * (angle_m / 180.0)))), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) return Float64((Float64(a * 1.0) ^ 2.0) + (Float64(b * sin(Float64(pi * Float64(angle_m / 180.0)))) ^ 2.0)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = ((a * 1.0) ^ 2.0) + ((b * sin((pi * (angle_m / 180.0)))) ^ 2.0); end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(N[Power[N[(a * 1.0), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[N[(Pi * N[(angle$95$m / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{\left(a \cdot 1\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle\_m}{180}\right)\right)}^{2}
\end{array}
Initial program 79.8%
Taylor expanded in angle around 0
Applied rewrites79.8%
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
:precision binary64
(let* ((t_0 (* PI (/ angle_m 180.0)))
(t_1 (+ (pow (* a (cos t_0)) 2.0) (pow (* b (sin t_0)) 2.0))))
(if (<= t_1 1e-312)
(* a a)
(if (<= t_1 5e+125)
(+
(fma
(* -3.08641975308642e-5 (* a a))
(* (* PI PI) (* angle_m angle_m))
(* a a))
(pow
(*
(fma
(* 0.005555555555555556 b)
PI
(*
(* -2.8577960676726107e-8 (* angle_m angle_m))
(* (* (* PI PI) PI) b)))
angle_m)
2.0))
(fma
(* (* (* 3.08641975308642e-5 angle_m) angle_m) (* PI b))
(* PI b)
(*
(*
(+ 0.5 (* (cos (* (* 2.0 PI) (* 0.005555555555555556 angle_m))) 0.5))
a)
a))))))angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double t_0 = ((double) M_PI) * (angle_m / 180.0);
double t_1 = pow((a * cos(t_0)), 2.0) + pow((b * sin(t_0)), 2.0);
double tmp;
if (t_1 <= 1e-312) {
tmp = a * a;
} else if (t_1 <= 5e+125) {
tmp = fma((-3.08641975308642e-5 * (a * a)), ((((double) M_PI) * ((double) M_PI)) * (angle_m * angle_m)), (a * a)) + pow((fma((0.005555555555555556 * b), ((double) M_PI), ((-2.8577960676726107e-8 * (angle_m * angle_m)) * (((((double) M_PI) * ((double) M_PI)) * ((double) M_PI)) * b))) * angle_m), 2.0);
} else {
tmp = fma((((3.08641975308642e-5 * angle_m) * angle_m) * (((double) M_PI) * b)), (((double) M_PI) * b), (((0.5 + (cos(((2.0 * ((double) M_PI)) * (0.005555555555555556 * angle_m))) * 0.5)) * a) * a));
}
return tmp;
}
angle_m = abs(angle) function code(a, b, angle_m) t_0 = Float64(pi * Float64(angle_m / 180.0)) t_1 = Float64((Float64(a * cos(t_0)) ^ 2.0) + (Float64(b * sin(t_0)) ^ 2.0)) tmp = 0.0 if (t_1 <= 1e-312) tmp = Float64(a * a); elseif (t_1 <= 5e+125) tmp = Float64(fma(Float64(-3.08641975308642e-5 * Float64(a * a)), Float64(Float64(pi * pi) * Float64(angle_m * angle_m)), Float64(a * a)) + (Float64(fma(Float64(0.005555555555555556 * b), pi, Float64(Float64(-2.8577960676726107e-8 * Float64(angle_m * angle_m)) * Float64(Float64(Float64(pi * pi) * pi) * b))) * angle_m) ^ 2.0)); else tmp = fma(Float64(Float64(Float64(3.08641975308642e-5 * angle_m) * angle_m) * Float64(pi * b)), Float64(pi * b), Float64(Float64(Float64(0.5 + Float64(cos(Float64(Float64(2.0 * pi) * Float64(0.005555555555555556 * angle_m))) * 0.5)) * a) * a)); end return tmp end
angle_m = N[Abs[angle], $MachinePrecision]
code[a_, b_, angle$95$m_] := Block[{t$95$0 = N[(Pi * N[(angle$95$m / 180.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[N[(a * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 1e-312], N[(a * a), $MachinePrecision], If[LessEqual[t$95$1, 5e+125], N[(N[(N[(-3.08641975308642e-5 * N[(a * a), $MachinePrecision]), $MachinePrecision] * N[(N[(Pi * Pi), $MachinePrecision] * N[(angle$95$m * angle$95$m), $MachinePrecision]), $MachinePrecision] + N[(a * a), $MachinePrecision]), $MachinePrecision] + N[Power[N[(N[(N[(0.005555555555555556 * b), $MachinePrecision] * Pi + N[(N[(-2.8577960676726107e-8 * N[(angle$95$m * angle$95$m), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(Pi * Pi), $MachinePrecision] * Pi), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * angle$95$m), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(3.08641975308642e-5 * angle$95$m), $MachinePrecision] * angle$95$m), $MachinePrecision] * N[(Pi * b), $MachinePrecision]), $MachinePrecision] * N[(Pi * b), $MachinePrecision] + N[(N[(N[(0.5 + N[(N[Cos[N[(N[(2.0 * Pi), $MachinePrecision] * N[(0.005555555555555556 * angle$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
t_0 := \pi \cdot \frac{angle\_m}{180}\\
t_1 := {\left(a \cdot \cos t\_0\right)}^{2} + {\left(b \cdot \sin t\_0\right)}^{2}\\
\mathbf{if}\;t\_1 \leq 10^{-312}:\\
\;\;\;\;a \cdot a\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+125}:\\
\;\;\;\;\mathsf{fma}\left(-3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot a\right), \left(\pi \cdot \pi\right) \cdot \left(angle\_m \cdot angle\_m\right), a \cdot a\right) + {\left(\mathsf{fma}\left(0.005555555555555556 \cdot b, \pi, \left(-2.8577960676726107 \cdot 10^{-8} \cdot \left(angle\_m \cdot angle\_m\right)\right) \cdot \left(\left(\left(\pi \cdot \pi\right) \cdot \pi\right) \cdot b\right)\right) \cdot angle\_m\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(3.08641975308642 \cdot 10^{-5} \cdot angle\_m\right) \cdot angle\_m\right) \cdot \left(\pi \cdot b\right), \pi \cdot b, \left(\left(0.5 + \cos \left(\left(2 \cdot \pi\right) \cdot \left(0.005555555555555556 \cdot angle\_m\right)\right) \cdot 0.5\right) \cdot a\right) \cdot a\right)\\
\end{array}
\end{array}
if (+.f64 (pow.f64 (*.f64 a (cos.f64 (*.f64 (PI.f64) (/.f64 angle #s(literal 180 binary64))))) #s(literal 2 binary64)) (pow.f64 (*.f64 b (sin.f64 (*.f64 (PI.f64) (/.f64 angle #s(literal 180 binary64))))) #s(literal 2 binary64))) < 9.9999999999847e-313Initial program 79.8%
Taylor expanded in angle around 0
unpow2N/A
lower-*.f6457.1
Applied rewrites57.1%
if 9.9999999999847e-313 < (+.f64 (pow.f64 (*.f64 a (cos.f64 (*.f64 (PI.f64) (/.f64 angle #s(literal 180 binary64))))) #s(literal 2 binary64)) (pow.f64 (*.f64 b (sin.f64 (*.f64 (PI.f64) (/.f64 angle #s(literal 180 binary64))))) #s(literal 2 binary64))) < 4.99999999999999962e125Initial program 79.8%
Taylor expanded in angle around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites73.6%
Taylor expanded in angle around 0
Applied rewrites42.2%
if 4.99999999999999962e125 < (+.f64 (pow.f64 (*.f64 a (cos.f64 (*.f64 (PI.f64) (/.f64 angle #s(literal 180 binary64))))) #s(literal 2 binary64)) (pow.f64 (*.f64 b (sin.f64 (*.f64 (PI.f64) (/.f64 angle #s(literal 180 binary64))))) #s(literal 2 binary64))) Initial program 79.8%
lift-cos.f64N/A
cos-fabs-revN/A
sin-+PI/2-revN/A
lower-sin.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
*-commutativeN/A
fabs-mulN/A
add-exp-logN/A
exp-fabsN/A
add-exp-logN/A
lower-fma.f64N/A
lower-fabs.f64N/A
lift-/.f64N/A
mult-flipN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
lift-PI.f64N/A
lower-/.f64N/A
lift-PI.f6479.8
Applied rewrites79.8%
lift-fabs.f64N/A
rem-sqrt-square-revN/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f6479.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6479.8
Applied rewrites79.8%
Taylor expanded in angle around 0
Applied rewrites70.5%
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
:precision binary64
(let* ((t_0 (* PI (/ angle_m 180.0)))
(t_1 (+ (pow (* a (cos t_0)) 2.0) (pow (* b (sin t_0)) 2.0))))
(if (<= t_1 1e-312)
(* a a)
(if (<= t_1 1e+246)
(+
(fma
(* -3.08641975308642e-5 (* a a))
(* (* PI PI) (* angle_m angle_m))
(* a a))
(pow
(*
(fma
(* 0.005555555555555556 b)
PI
(*
(* -2.8577960676726107e-8 (* angle_m angle_m))
(* (* (* PI PI) PI) b)))
angle_m)
2.0))
(fma
(*
(fma (cos (* (* PI (* angle_m 0.005555555555555556)) 2.0)) 0.5 0.5)
a)
a
(*
(* 3.08641975308642e-5 (* angle_m angle_m))
(* (* PI b) (* PI b))))))))angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double t_0 = ((double) M_PI) * (angle_m / 180.0);
double t_1 = pow((a * cos(t_0)), 2.0) + pow((b * sin(t_0)), 2.0);
double tmp;
if (t_1 <= 1e-312) {
tmp = a * a;
} else if (t_1 <= 1e+246) {
tmp = fma((-3.08641975308642e-5 * (a * a)), ((((double) M_PI) * ((double) M_PI)) * (angle_m * angle_m)), (a * a)) + pow((fma((0.005555555555555556 * b), ((double) M_PI), ((-2.8577960676726107e-8 * (angle_m * angle_m)) * (((((double) M_PI) * ((double) M_PI)) * ((double) M_PI)) * b))) * angle_m), 2.0);
} else {
tmp = fma((fma(cos(((((double) M_PI) * (angle_m * 0.005555555555555556)) * 2.0)), 0.5, 0.5) * a), a, ((3.08641975308642e-5 * (angle_m * angle_m)) * ((((double) M_PI) * b) * (((double) M_PI) * b))));
}
return tmp;
}
angle_m = abs(angle) function code(a, b, angle_m) t_0 = Float64(pi * Float64(angle_m / 180.0)) t_1 = Float64((Float64(a * cos(t_0)) ^ 2.0) + (Float64(b * sin(t_0)) ^ 2.0)) tmp = 0.0 if (t_1 <= 1e-312) tmp = Float64(a * a); elseif (t_1 <= 1e+246) tmp = Float64(fma(Float64(-3.08641975308642e-5 * Float64(a * a)), Float64(Float64(pi * pi) * Float64(angle_m * angle_m)), Float64(a * a)) + (Float64(fma(Float64(0.005555555555555556 * b), pi, Float64(Float64(-2.8577960676726107e-8 * Float64(angle_m * angle_m)) * Float64(Float64(Float64(pi * pi) * pi) * b))) * angle_m) ^ 2.0)); else tmp = fma(Float64(fma(cos(Float64(Float64(pi * Float64(angle_m * 0.005555555555555556)) * 2.0)), 0.5, 0.5) * a), a, Float64(Float64(3.08641975308642e-5 * Float64(angle_m * angle_m)) * Float64(Float64(pi * b) * Float64(pi * b)))); end return tmp end
angle_m = N[Abs[angle], $MachinePrecision]
code[a_, b_, angle$95$m_] := Block[{t$95$0 = N[(Pi * N[(angle$95$m / 180.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[N[(a * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 1e-312], N[(a * a), $MachinePrecision], If[LessEqual[t$95$1, 1e+246], N[(N[(N[(-3.08641975308642e-5 * N[(a * a), $MachinePrecision]), $MachinePrecision] * N[(N[(Pi * Pi), $MachinePrecision] * N[(angle$95$m * angle$95$m), $MachinePrecision]), $MachinePrecision] + N[(a * a), $MachinePrecision]), $MachinePrecision] + N[Power[N[(N[(N[(0.005555555555555556 * b), $MachinePrecision] * Pi + N[(N[(-2.8577960676726107e-8 * N[(angle$95$m * angle$95$m), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(Pi * Pi), $MachinePrecision] * Pi), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * angle$95$m), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Cos[N[(N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]], $MachinePrecision] * 0.5 + 0.5), $MachinePrecision] * a), $MachinePrecision] * a + N[(N[(3.08641975308642e-5 * N[(angle$95$m * angle$95$m), $MachinePrecision]), $MachinePrecision] * N[(N[(Pi * b), $MachinePrecision] * N[(Pi * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
t_0 := \pi \cdot \frac{angle\_m}{180}\\
t_1 := {\left(a \cdot \cos t\_0\right)}^{2} + {\left(b \cdot \sin t\_0\right)}^{2}\\
\mathbf{if}\;t\_1 \leq 10^{-312}:\\
\;\;\;\;a \cdot a\\
\mathbf{elif}\;t\_1 \leq 10^{+246}:\\
\;\;\;\;\mathsf{fma}\left(-3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot a\right), \left(\pi \cdot \pi\right) \cdot \left(angle\_m \cdot angle\_m\right), a \cdot a\right) + {\left(\mathsf{fma}\left(0.005555555555555556 \cdot b, \pi, \left(-2.8577960676726107 \cdot 10^{-8} \cdot \left(angle\_m \cdot angle\_m\right)\right) \cdot \left(\left(\left(\pi \cdot \pi\right) \cdot \pi\right) \cdot b\right)\right) \cdot angle\_m\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\cos \left(\left(\pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)\right) \cdot 2\right), 0.5, 0.5\right) \cdot a, a, \left(3.08641975308642 \cdot 10^{-5} \cdot \left(angle\_m \cdot angle\_m\right)\right) \cdot \left(\left(\pi \cdot b\right) \cdot \left(\pi \cdot b\right)\right)\right)\\
\end{array}
\end{array}
if (+.f64 (pow.f64 (*.f64 a (cos.f64 (*.f64 (PI.f64) (/.f64 angle #s(literal 180 binary64))))) #s(literal 2 binary64)) (pow.f64 (*.f64 b (sin.f64 (*.f64 (PI.f64) (/.f64 angle #s(literal 180 binary64))))) #s(literal 2 binary64))) < 9.9999999999847e-313Initial program 79.8%
Taylor expanded in angle around 0
unpow2N/A
lower-*.f6457.1
Applied rewrites57.1%
if 9.9999999999847e-313 < (+.f64 (pow.f64 (*.f64 a (cos.f64 (*.f64 (PI.f64) (/.f64 angle #s(literal 180 binary64))))) #s(literal 2 binary64)) (pow.f64 (*.f64 b (sin.f64 (*.f64 (PI.f64) (/.f64 angle #s(literal 180 binary64))))) #s(literal 2 binary64))) < 1.00000000000000007e246Initial program 79.8%
Taylor expanded in angle around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites73.6%
Taylor expanded in angle around 0
Applied rewrites42.2%
if 1.00000000000000007e246 < (+.f64 (pow.f64 (*.f64 a (cos.f64 (*.f64 (PI.f64) (/.f64 angle #s(literal 180 binary64))))) #s(literal 2 binary64)) (pow.f64 (*.f64 b (sin.f64 (*.f64 (PI.f64) (/.f64 angle #s(literal 180 binary64))))) #s(literal 2 binary64))) Initial program 79.8%
lift-cos.f64N/A
cos-fabs-revN/A
sin-+PI/2-revN/A
lower-sin.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
*-commutativeN/A
fabs-mulN/A
add-exp-logN/A
exp-fabsN/A
add-exp-logN/A
lower-fma.f64N/A
lower-fabs.f64N/A
lift-/.f64N/A
mult-flipN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
lift-PI.f64N/A
lower-/.f64N/A
lift-PI.f6479.8
Applied rewrites79.8%
Taylor expanded in angle around 0
Applied rewrites64.0%
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
:precision binary64
(if (<= a 1.45e+152)
(fma
(fma
(fma
(* 3.08641975308642e-5 (* b b))
(* PI PI)
(* (fma (* -3.08641975308642e-5 (* PI PI)) 1.0 0.0) (* a a)))
angle_m
(* (* 0.011111111111111112 (* a a)) 0.0))
angle_m
(* (* a a) 1.0))
(* a a)))angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if (a <= 1.45e+152) {
tmp = fma(fma(fma((3.08641975308642e-5 * (b * b)), (((double) M_PI) * ((double) M_PI)), (fma((-3.08641975308642e-5 * (((double) M_PI) * ((double) M_PI))), 1.0, 0.0) * (a * a))), angle_m, ((0.011111111111111112 * (a * a)) * 0.0)), angle_m, ((a * a) * 1.0));
} else {
tmp = a * a;
}
return tmp;
}
angle_m = abs(angle) function code(a, b, angle_m) tmp = 0.0 if (a <= 1.45e+152) tmp = fma(fma(fma(Float64(3.08641975308642e-5 * Float64(b * b)), Float64(pi * pi), Float64(fma(Float64(-3.08641975308642e-5 * Float64(pi * pi)), 1.0, 0.0) * Float64(a * a))), angle_m, Float64(Float64(0.011111111111111112 * Float64(a * a)) * 0.0)), angle_m, Float64(Float64(a * a) * 1.0)); else tmp = Float64(a * a); end return tmp end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := If[LessEqual[a, 1.45e+152], N[(N[(N[(N[(3.08641975308642e-5 * N[(b * b), $MachinePrecision]), $MachinePrecision] * N[(Pi * Pi), $MachinePrecision] + N[(N[(N[(-3.08641975308642e-5 * N[(Pi * Pi), $MachinePrecision]), $MachinePrecision] * 1.0 + 0.0), $MachinePrecision] * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * angle$95$m + N[(N[(0.011111111111111112 * N[(a * a), $MachinePrecision]), $MachinePrecision] * 0.0), $MachinePrecision]), $MachinePrecision] * angle$95$m + N[(N[(a * a), $MachinePrecision] * 1.0), $MachinePrecision]), $MachinePrecision], N[(a * a), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
\mathbf{if}\;a \leq 1.45 \cdot 10^{+152}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(3.08641975308642 \cdot 10^{-5} \cdot \left(b \cdot b\right), \pi \cdot \pi, \mathsf{fma}\left(-3.08641975308642 \cdot 10^{-5} \cdot \left(\pi \cdot \pi\right), 1, 0\right) \cdot \left(a \cdot a\right)\right), angle\_m, \left(0.011111111111111112 \cdot \left(a \cdot a\right)\right) \cdot 0\right), angle\_m, \left(a \cdot a\right) \cdot 1\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot a\\
\end{array}
\end{array}
if a < 1.4499999999999999e152Initial program 79.8%
lift-cos.f64N/A
cos-fabs-revN/A
sin-+PI/2-revN/A
lower-sin.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
*-commutativeN/A
fabs-mulN/A
add-exp-logN/A
exp-fabsN/A
add-exp-logN/A
lower-fma.f64N/A
lower-fabs.f64N/A
lift-/.f64N/A
mult-flipN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
lift-PI.f64N/A
lower-/.f64N/A
lift-PI.f6479.8
Applied rewrites79.8%
Applied rewrites79.8%
Taylor expanded in angle around 0
Applied rewrites43.5%
if 1.4499999999999999e152 < a Initial program 79.8%
Taylor expanded in angle around 0
unpow2N/A
lower-*.f6457.1
Applied rewrites57.1%
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
:precision binary64
(if (<= a 1.45e+152)
(fma
a
a
(*
(* angle_m angle_m)
(fma
(* -3.08641975308642e-5 (* a a))
(* PI PI)
(* (* 3.08641975308642e-5 (* b b)) (* PI PI)))))
(* a a)))angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if (a <= 1.45e+152) {
tmp = fma(a, a, ((angle_m * angle_m) * fma((-3.08641975308642e-5 * (a * a)), (((double) M_PI) * ((double) M_PI)), ((3.08641975308642e-5 * (b * b)) * (((double) M_PI) * ((double) M_PI))))));
} else {
tmp = a * a;
}
return tmp;
}
angle_m = abs(angle) function code(a, b, angle_m) tmp = 0.0 if (a <= 1.45e+152) tmp = fma(a, a, Float64(Float64(angle_m * angle_m) * fma(Float64(-3.08641975308642e-5 * Float64(a * a)), Float64(pi * pi), Float64(Float64(3.08641975308642e-5 * Float64(b * b)) * Float64(pi * pi))))); else tmp = Float64(a * a); end return tmp end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := If[LessEqual[a, 1.45e+152], N[(a * a + N[(N[(angle$95$m * angle$95$m), $MachinePrecision] * N[(N[(-3.08641975308642e-5 * N[(a * a), $MachinePrecision]), $MachinePrecision] * N[(Pi * Pi), $MachinePrecision] + N[(N[(3.08641975308642e-5 * N[(b * b), $MachinePrecision]), $MachinePrecision] * N[(Pi * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * a), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
\mathbf{if}\;a \leq 1.45 \cdot 10^{+152}:\\
\;\;\;\;\mathsf{fma}\left(a, a, \left(angle\_m \cdot angle\_m\right) \cdot \mathsf{fma}\left(-3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot a\right), \pi \cdot \pi, \left(3.08641975308642 \cdot 10^{-5} \cdot \left(b \cdot b\right)\right) \cdot \left(\pi \cdot \pi\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot a\\
\end{array}
\end{array}
if a < 1.4499999999999999e152Initial program 79.8%
Taylor expanded in angle around 0
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites40.9%
if 1.4499999999999999e152 < a Initial program 79.8%
Taylor expanded in angle around 0
unpow2N/A
lower-*.f6457.1
Applied rewrites57.1%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (* a a))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return a * a;
}
angle_m = private
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_m)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle_m
code = a * a
end function
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return a * a;
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return a * a
angle_m = abs(angle) function code(a, b, angle_m) return Float64(a * a) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = a * a; end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(a * a), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
a \cdot a
\end{array}
Initial program 79.8%
Taylor expanded in angle around 0
unpow2N/A
lower-*.f6457.1
Applied rewrites57.1%
herbie shell --seed 2025142
(FPCore (a b angle)
:name "ab-angle->ABCF C"
:precision binary64
(+ (pow (* a (cos (* PI (/ angle 180.0)))) 2.0) (pow (* b (sin (* PI (/ angle 180.0)))) 2.0)))