
(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 11 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
(+
(*
(-
1.0
(-
0.5
(*
0.5
(*
(+
(cos (* (* angle_m PI) -0.005555555555555556))
(sin (* (* 0.005555555555555556 angle_m) PI)))
(*
2.0
(*
(cos (/ (fma PI 0.5 (* 0.011111111111111112 (* PI angle_m))) 2.0))
(cos (/ (fma PI 0.5 0.0) 2.0))))))))
(* a a))
(pow (* b (sin (* PI (/ angle_m 180.0)))) 2.0)))angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return ((1.0 - (0.5 - (0.5 * ((cos(((angle_m * ((double) M_PI)) * -0.005555555555555556)) + sin(((0.005555555555555556 * angle_m) * ((double) M_PI)))) * (2.0 * (cos((fma(((double) M_PI), 0.5, (0.011111111111111112 * (((double) M_PI) * angle_m))) / 2.0)) * cos((fma(((double) M_PI), 0.5, 0.0) / 2.0)))))))) * (a * a)) + pow((b * sin((((double) M_PI) * (angle_m / 180.0)))), 2.0);
}
angle_m = abs(angle) function code(a, b, angle_m) return Float64(Float64(Float64(1.0 - Float64(0.5 - Float64(0.5 * Float64(Float64(cos(Float64(Float64(angle_m * pi) * -0.005555555555555556)) + sin(Float64(Float64(0.005555555555555556 * angle_m) * pi))) * Float64(2.0 * Float64(cos(Float64(fma(pi, 0.5, Float64(0.011111111111111112 * Float64(pi * angle_m))) / 2.0)) * cos(Float64(fma(pi, 0.5, 0.0) / 2.0)))))))) * Float64(a * a)) + (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_] := N[(N[(N[(1.0 - N[(0.5 - N[(0.5 * N[(N[(N[Cos[N[(N[(angle$95$m * Pi), $MachinePrecision] * -0.005555555555555556), $MachinePrecision]], $MachinePrecision] + N[Sin[N[(N[(0.005555555555555556 * angle$95$m), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[(N[Cos[N[(N[(Pi * 0.5 + N[(0.011111111111111112 * N[(Pi * angle$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(N[(Pi * 0.5 + 0.0), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(a * a), $MachinePrecision]), $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(1 - \left(0.5 - 0.5 \cdot \left(\left(\cos \left(\left(angle\_m \cdot \pi\right) \cdot -0.005555555555555556\right) + \sin \left(\left(0.005555555555555556 \cdot angle\_m\right) \cdot \pi\right)\right) \cdot \left(2 \cdot \left(\cos \left(\frac{\mathsf{fma}\left(\pi, 0.5, 0.011111111111111112 \cdot \left(\pi \cdot angle\_m\right)\right)}{2}\right) \cdot \cos \left(\frac{\mathsf{fma}\left(\pi, 0.5, 0\right)}{2}\right)\right)\right)\right)\right)\right) \cdot \left(a \cdot a\right) + {\left(b \cdot \sin \left(\pi \cdot \frac{angle\_m}{180}\right)\right)}^{2}
\end{array}
Initial program 79.8%
lift-pow.f64N/A
unpow2N/A
sqr-neg-revN/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
unpow-prod-downN/A
lower-unsound-pow.f32N/A
lower-pow.f32N/A
pow2N/A
lower-unsound-*.f64N/A
Applied rewrites79.8%
lift-pow.f64N/A
unpow2N/A
lift-neg.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
metadata-evalN/A
mult-flipN/A
lift-/.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
metadata-evalN/A
mult-flipN/A
lift-/.f64N/A
Applied rewrites79.8%
Applied rewrites79.8%
Applied rewrites79.8%
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
:precision binary64
(let* ((t_0 (sin (* (/ angle_m 180.0) PI)))
(t_1 (cos (* (* angle_m PI) -0.005555555555555556))))
(+
(* (- 1.0 (- 0.5 (* 0.5 (* (+ t_1 t_0) (- t_1 t_0))))) (* a a))
(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 = sin(((angle_m / 180.0) * ((double) M_PI)));
double t_1 = cos(((angle_m * ((double) M_PI)) * -0.005555555555555556));
return ((1.0 - (0.5 - (0.5 * ((t_1 + t_0) * (t_1 - t_0))))) * (a * a)) + 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) {
double t_0 = Math.sin(((angle_m / 180.0) * Math.PI));
double t_1 = Math.cos(((angle_m * Math.PI) * -0.005555555555555556));
return ((1.0 - (0.5 - (0.5 * ((t_1 + t_0) * (t_1 - t_0))))) * (a * a)) + Math.pow((b * Math.sin((Math.PI * (angle_m / 180.0)))), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): t_0 = math.sin(((angle_m / 180.0) * math.pi)) t_1 = math.cos(((angle_m * math.pi) * -0.005555555555555556)) return ((1.0 - (0.5 - (0.5 * ((t_1 + t_0) * (t_1 - t_0))))) * (a * a)) + math.pow((b * math.sin((math.pi * (angle_m / 180.0)))), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) t_0 = sin(Float64(Float64(angle_m / 180.0) * pi)) t_1 = cos(Float64(Float64(angle_m * pi) * -0.005555555555555556)) return Float64(Float64(Float64(1.0 - Float64(0.5 - Float64(0.5 * Float64(Float64(t_1 + t_0) * Float64(t_1 - t_0))))) * Float64(a * a)) + (Float64(b * sin(Float64(pi * Float64(angle_m / 180.0)))) ^ 2.0)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) t_0 = sin(((angle_m / 180.0) * pi)); t_1 = cos(((angle_m * pi) * -0.005555555555555556)); tmp = ((1.0 - (0.5 - (0.5 * ((t_1 + t_0) * (t_1 - t_0))))) * (a * a)) + ((b * sin((pi * (angle_m / 180.0)))) ^ 2.0); end
angle_m = N[Abs[angle], $MachinePrecision]
code[a_, b_, angle$95$m_] := Block[{t$95$0 = N[Sin[N[(N[(angle$95$m / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(N[(angle$95$m * Pi), $MachinePrecision] * -0.005555555555555556), $MachinePrecision]], $MachinePrecision]}, N[(N[(N[(1.0 - N[(0.5 - N[(0.5 * N[(N[(t$95$1 + t$95$0), $MachinePrecision] * N[(t$95$1 - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(a * a), $MachinePrecision]), $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 := \sin \left(\frac{angle\_m}{180} \cdot \pi\right)\\
t_1 := \cos \left(\left(angle\_m \cdot \pi\right) \cdot -0.005555555555555556\right)\\
\left(1 - \left(0.5 - 0.5 \cdot \left(\left(t\_1 + t\_0\right) \cdot \left(t\_1 - t\_0\right)\right)\right)\right) \cdot \left(a \cdot a\right) + {\left(b \cdot \sin \left(\pi \cdot \frac{angle\_m}{180}\right)\right)}^{2}
\end{array}
\end{array}
Initial program 79.8%
lift-pow.f64N/A
unpow2N/A
sqr-neg-revN/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
unpow-prod-downN/A
lower-unsound-pow.f32N/A
lower-pow.f32N/A
pow2N/A
lower-unsound-*.f64N/A
Applied rewrites79.8%
lift-pow.f64N/A
unpow2N/A
lift-neg.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
metadata-evalN/A
mult-flipN/A
lift-/.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
metadata-evalN/A
mult-flipN/A
lift-/.f64N/A
Applied rewrites79.8%
Applied rewrites79.8%
lift-*.f64N/A
*-commutativeN/A
metadata-evalN/A
mult-flipN/A
lift-/.f6479.8
Applied rewrites79.8%
lift-*.f64N/A
*-commutativeN/A
metadata-evalN/A
mult-flipN/A
lift-/.f6479.8
Applied rewrites79.8%
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
:precision binary64
(let* ((t_0 (sin (* (* 0.005555555555555556 angle_m) PI)))
(t_1 (cos (* (* angle_m PI) -0.005555555555555556))))
(+
(* (- 1.0 (- 0.5 (* 0.5 (* (+ t_1 t_0) (- t_1 t_0))))) (* a a))
(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 = sin(((0.005555555555555556 * angle_m) * ((double) M_PI)));
double t_1 = cos(((angle_m * ((double) M_PI)) * -0.005555555555555556));
return ((1.0 - (0.5 - (0.5 * ((t_1 + t_0) * (t_1 - t_0))))) * (a * a)) + 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) {
double t_0 = Math.sin(((0.005555555555555556 * angle_m) * Math.PI));
double t_1 = Math.cos(((angle_m * Math.PI) * -0.005555555555555556));
return ((1.0 - (0.5 - (0.5 * ((t_1 + t_0) * (t_1 - t_0))))) * (a * a)) + Math.pow((b * Math.sin((Math.PI * (angle_m / 180.0)))), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): t_0 = math.sin(((0.005555555555555556 * angle_m) * math.pi)) t_1 = math.cos(((angle_m * math.pi) * -0.005555555555555556)) return ((1.0 - (0.5 - (0.5 * ((t_1 + t_0) * (t_1 - t_0))))) * (a * a)) + math.pow((b * math.sin((math.pi * (angle_m / 180.0)))), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) t_0 = sin(Float64(Float64(0.005555555555555556 * angle_m) * pi)) t_1 = cos(Float64(Float64(angle_m * pi) * -0.005555555555555556)) return Float64(Float64(Float64(1.0 - Float64(0.5 - Float64(0.5 * Float64(Float64(t_1 + t_0) * Float64(t_1 - t_0))))) * Float64(a * a)) + (Float64(b * sin(Float64(pi * Float64(angle_m / 180.0)))) ^ 2.0)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) t_0 = sin(((0.005555555555555556 * angle_m) * pi)); t_1 = cos(((angle_m * pi) * -0.005555555555555556)); tmp = ((1.0 - (0.5 - (0.5 * ((t_1 + t_0) * (t_1 - t_0))))) * (a * a)) + ((b * sin((pi * (angle_m / 180.0)))) ^ 2.0); end
angle_m = N[Abs[angle], $MachinePrecision]
code[a_, b_, angle$95$m_] := Block[{t$95$0 = N[Sin[N[(N[(0.005555555555555556 * angle$95$m), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(N[(angle$95$m * Pi), $MachinePrecision] * -0.005555555555555556), $MachinePrecision]], $MachinePrecision]}, N[(N[(N[(1.0 - N[(0.5 - N[(0.5 * N[(N[(t$95$1 + t$95$0), $MachinePrecision] * N[(t$95$1 - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(a * a), $MachinePrecision]), $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 := \sin \left(\left(0.005555555555555556 \cdot angle\_m\right) \cdot \pi\right)\\
t_1 := \cos \left(\left(angle\_m \cdot \pi\right) \cdot -0.005555555555555556\right)\\
\left(1 - \left(0.5 - 0.5 \cdot \left(\left(t\_1 + t\_0\right) \cdot \left(t\_1 - t\_0\right)\right)\right)\right) \cdot \left(a \cdot a\right) + {\left(b \cdot \sin \left(\pi \cdot \frac{angle\_m}{180}\right)\right)}^{2}
\end{array}
\end{array}
Initial program 79.8%
lift-pow.f64N/A
unpow2N/A
sqr-neg-revN/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
unpow-prod-downN/A
lower-unsound-pow.f32N/A
lower-pow.f32N/A
pow2N/A
lower-unsound-*.f64N/A
Applied rewrites79.8%
lift-pow.f64N/A
unpow2N/A
lift-neg.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
metadata-evalN/A
mult-flipN/A
lift-/.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
metadata-evalN/A
mult-flipN/A
lift-/.f64N/A
Applied rewrites79.8%
Applied rewrites79.8%
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
:precision binary64
(+
(*
(-
1.0
(-
0.5
(*
0.5
(cos
(*
2.0
(*
(cbrt (* PI PI))
(* (cbrt PI) (* 0.005555555555555556 angle_m))))))))
(* a a))
(pow (* b (sin (* PI (/ angle_m 180.0)))) 2.0)))angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return ((1.0 - (0.5 - (0.5 * cos((2.0 * (cbrt((((double) M_PI) * ((double) M_PI))) * (cbrt(((double) M_PI)) * (0.005555555555555556 * angle_m)))))))) * (a * a)) + 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 ((1.0 - (0.5 - (0.5 * Math.cos((2.0 * (Math.cbrt((Math.PI * Math.PI)) * (Math.cbrt(Math.PI) * (0.005555555555555556 * angle_m)))))))) * (a * a)) + 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(Float64(1.0 - Float64(0.5 - Float64(0.5 * cos(Float64(2.0 * Float64(cbrt(Float64(pi * pi)) * Float64(cbrt(pi) * Float64(0.005555555555555556 * angle_m)))))))) * Float64(a * a)) + (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_] := N[(N[(N[(1.0 - N[(0.5 - N[(0.5 * N[Cos[N[(2.0 * N[(N[Power[N[(Pi * Pi), $MachinePrecision], 1/3], $MachinePrecision] * N[(N[Power[Pi, 1/3], $MachinePrecision] * N[(0.005555555555555556 * angle$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(a * a), $MachinePrecision]), $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(1 - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot \left(\sqrt[3]{\pi \cdot \pi} \cdot \left(\sqrt[3]{\pi} \cdot \left(0.005555555555555556 \cdot angle\_m\right)\right)\right)\right)\right)\right) \cdot \left(a \cdot a\right) + {\left(b \cdot \sin \left(\pi \cdot \frac{angle\_m}{180}\right)\right)}^{2}
\end{array}
Initial program 79.8%
lift-pow.f64N/A
unpow2N/A
sqr-neg-revN/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
unpow-prod-downN/A
lower-unsound-pow.f32N/A
lower-pow.f32N/A
pow2N/A
lower-unsound-*.f64N/A
Applied rewrites79.8%
lift-pow.f64N/A
unpow2N/A
lift-neg.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
metadata-evalN/A
mult-flipN/A
lift-/.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
metadata-evalN/A
mult-flipN/A
lift-/.f64N/A
Applied rewrites79.8%
lift-*.f64N/A
lift-PI.f64N/A
add-cube-cbrtN/A
lift-*.f64N/A
metadata-evalN/A
mult-flipN/A
lift-/.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-PI.f64N/A
lift-PI.f64N/A
cbrt-unprodN/A
lift-PI.f64N/A
lift-PI.f64N/A
lower-cbrt.f64N/A
lift-PI.f64N/A
lift-PI.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lift-PI.f64N/A
lower-cbrt.f6479.8
lift-/.f64N/A
mult-flipN/A
metadata-evalN/A
*-commutativeN/A
Applied rewrites79.8%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (* (pow (- (cos (* (* 0.005555555555555556 angle_m) PI))) 2.0) (* a a)) (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(-cos(((0.005555555555555556 * angle_m) * ((double) M_PI))), 2.0) * (a * a)) + 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(-Math.cos(((0.005555555555555556 * angle_m) * Math.PI)), 2.0) * (a * a)) + 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(-math.cos(((0.005555555555555556 * angle_m) * math.pi)), 2.0) * (a * a)) + 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((Float64(-cos(Float64(Float64(0.005555555555555556 * angle_m) * pi))) ^ 2.0) * Float64(a * a)) + (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 = ((-cos(((0.005555555555555556 * angle_m) * pi)) ^ 2.0) * (a * a)) + ((b * sin((pi * (angle_m / 180.0)))) ^ 2.0); end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(N[(N[Power[(-N[Cos[N[(N[(0.005555555555555556 * angle$95$m), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), 2.0], $MachinePrecision] * N[(a * a), $MachinePrecision]), $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(-\cos \left(\left(0.005555555555555556 \cdot angle\_m\right) \cdot \pi\right)\right)}^{2} \cdot \left(a \cdot a\right) + {\left(b \cdot \sin \left(\pi \cdot \frac{angle\_m}{180}\right)\right)}^{2}
\end{array}
Initial program 79.8%
lift-pow.f64N/A
unpow2N/A
sqr-neg-revN/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
unpow-prod-downN/A
lower-unsound-pow.f32N/A
lower-pow.f32N/A
pow2N/A
lower-unsound-*.f64N/A
Applied rewrites79.8%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (* (- 1.0 (- 0.5 (* 0.5 (cos (* (* (+ PI PI) 0.005555555555555556) angle_m))))) (* a a)) (pow (* b (sin (* PI (/ angle_m 180.0)))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return ((1.0 - (0.5 - (0.5 * cos((((((double) M_PI) + ((double) M_PI)) * 0.005555555555555556) * angle_m))))) * (a * a)) + 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 ((1.0 - (0.5 - (0.5 * Math.cos((((Math.PI + Math.PI) * 0.005555555555555556) * angle_m))))) * (a * a)) + 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 ((1.0 - (0.5 - (0.5 * math.cos((((math.pi + math.pi) * 0.005555555555555556) * angle_m))))) * (a * a)) + 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(Float64(1.0 - Float64(0.5 - Float64(0.5 * cos(Float64(Float64(Float64(pi + pi) * 0.005555555555555556) * angle_m))))) * Float64(a * a)) + (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 = ((1.0 - (0.5 - (0.5 * cos((((pi + pi) * 0.005555555555555556) * angle_m))))) * (a * a)) + ((b * sin((pi * (angle_m / 180.0)))) ^ 2.0); end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(N[(N[(1.0 - N[(0.5 - N[(0.5 * N[Cos[N[(N[(N[(Pi + Pi), $MachinePrecision] * 0.005555555555555556), $MachinePrecision] * angle$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(a * a), $MachinePrecision]), $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(1 - \left(0.5 - 0.5 \cdot \cos \left(\left(\left(\pi + \pi\right) \cdot 0.005555555555555556\right) \cdot angle\_m\right)\right)\right) \cdot \left(a \cdot a\right) + {\left(b \cdot \sin \left(\pi \cdot \frac{angle\_m}{180}\right)\right)}^{2}
\end{array}
Initial program 79.8%
lift-pow.f64N/A
unpow2N/A
sqr-neg-revN/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
unpow-prod-downN/A
lower-unsound-pow.f32N/A
lower-pow.f32N/A
pow2N/A
lower-unsound-*.f64N/A
Applied rewrites79.8%
lift-pow.f64N/A
unpow2N/A
lift-neg.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
metadata-evalN/A
mult-flipN/A
lift-/.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
metadata-evalN/A
mult-flipN/A
lift-/.f64N/A
Applied rewrites79.8%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
metadata-evalN/A
mult-flipN/A
lift-/.f64N/A
associate-*r*N/A
lift-/.f64N/A
mult-flipN/A
metadata-evalN/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
count-2-revN/A
lower-+.f6479.8
Applied rewrites79.8%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (* (+ 0.5 (* 0.5 (cos (* 2.0 (fma PI (* angle_m 0.005555555555555556) PI))))) (* a a)) (pow (* b (sin (* PI (/ angle_m 180.0)))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return ((0.5 + (0.5 * cos((2.0 * fma(((double) M_PI), (angle_m * 0.005555555555555556), ((double) M_PI)))))) * (a * a)) + pow((b * sin((((double) M_PI) * (angle_m / 180.0)))), 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 * fma(pi, Float64(angle_m * 0.005555555555555556), pi))))) * Float64(a * a)) + (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_] := N[(N[(N[(0.5 + N[(0.5 * N[Cos[N[(2.0 * N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision] + Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(a * a), $MachinePrecision]), $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(0.5 + 0.5 \cdot \cos \left(2 \cdot \mathsf{fma}\left(\pi, angle\_m \cdot 0.005555555555555556, \pi\right)\right)\right) \cdot \left(a \cdot a\right) + {\left(b \cdot \sin \left(\pi \cdot \frac{angle\_m}{180}\right)\right)}^{2}
\end{array}
Initial program 79.8%
lift-pow.f64N/A
unpow2N/A
sqr-neg-revN/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
unpow-prod-downN/A
lower-unsound-pow.f32N/A
lower-pow.f32N/A
pow2N/A
lower-unsound-*.f64N/A
Applied rewrites79.8%
lift-pow.f64N/A
unpow2N/A
lift-neg.f64N/A
lift-cos.f64N/A
cos-+PI-revN/A
lift-neg.f64N/A
lift-cos.f64N/A
cos-+PI-revN/A
sqr-cos-aN/A
lower-+.f64N/A
cos-2N/A
cos-sumN/A
lower-*.f64N/A
Applied rewrites79.8%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (* 1.0 (* a a)) (pow (* b (sin (* PI (/ angle_m 180.0)))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return (1.0 * (a * a)) + 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 (1.0 * (a * a)) + 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 (1.0 * (a * a)) + 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(1.0 * Float64(a * a)) + (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 = (1.0 * (a * a)) + ((b * sin((pi * (angle_m / 180.0)))) ^ 2.0); end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(N[(1.0 * N[(a * a), $MachinePrecision]), $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|
\\
1 \cdot \left(a \cdot a\right) + {\left(b \cdot \sin \left(\pi \cdot \frac{angle\_m}{180}\right)\right)}^{2}
\end{array}
Initial program 79.8%
lift-pow.f64N/A
unpow2N/A
sqr-neg-revN/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
unpow-prod-downN/A
lower-unsound-pow.f32N/A
lower-pow.f32N/A
pow2N/A
lower-unsound-*.f64N/A
Applied rewrites79.8%
Taylor expanded in angle around 0
Applied rewrites79.7%
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
:precision binary64
(if (<= b 1.55e-5)
(* a a)
(+
(exp
(* 2.0 (+ (log angle_m) (+ (log b) (log (* 0.005555555555555556 PI))))))
(pow a 2.0))))angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if (b <= 1.55e-5) {
tmp = a * a;
} else {
tmp = exp((2.0 * (log(angle_m) + (log(b) + log((0.005555555555555556 * ((double) M_PI))))))) + pow(a, 2.0);
}
return tmp;
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double tmp;
if (b <= 1.55e-5) {
tmp = a * a;
} else {
tmp = Math.exp((2.0 * (Math.log(angle_m) + (Math.log(b) + Math.log((0.005555555555555556 * Math.PI)))))) + Math.pow(a, 2.0);
}
return tmp;
}
angle_m = math.fabs(angle) def code(a, b, angle_m): tmp = 0 if b <= 1.55e-5: tmp = a * a else: tmp = math.exp((2.0 * (math.log(angle_m) + (math.log(b) + math.log((0.005555555555555556 * math.pi)))))) + math.pow(a, 2.0) return tmp
angle_m = abs(angle) function code(a, b, angle_m) tmp = 0.0 if (b <= 1.55e-5) tmp = Float64(a * a); else tmp = Float64(exp(Float64(2.0 * Float64(log(angle_m) + Float64(log(b) + log(Float64(0.005555555555555556 * pi)))))) + (a ^ 2.0)); end return tmp end
angle_m = abs(angle); function tmp_2 = code(a, b, angle_m) tmp = 0.0; if (b <= 1.55e-5) tmp = a * a; else tmp = exp((2.0 * (log(angle_m) + (log(b) + log((0.005555555555555556 * pi)))))) + (a ^ 2.0); end tmp_2 = tmp; end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := If[LessEqual[b, 1.55e-5], N[(a * a), $MachinePrecision], N[(N[Exp[N[(2.0 * N[(N[Log[angle$95$m], $MachinePrecision] + N[(N[Log[b], $MachinePrecision] + N[Log[N[(0.005555555555555556 * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.55 \cdot 10^{-5}:\\
\;\;\;\;a \cdot a\\
\mathbf{else}:\\
\;\;\;\;e^{2 \cdot \left(\log angle\_m + \left(\log b + \log \left(0.005555555555555556 \cdot \pi\right)\right)\right)} + {a}^{2}\\
\end{array}
\end{array}
if b < 1.55000000000000007e-5Initial program 79.8%
Taylor expanded in angle around 0
lower-pow.f6457.1
Applied rewrites57.1%
lift-pow.f64N/A
pow2N/A
lift-*.f6457.1
Applied rewrites57.1%
if 1.55000000000000007e-5 < b Initial program 79.8%
lift-pow.f64N/A
pow-to-expN/A
lower-unsound-exp.f64N/A
lower-unsound-*.f64N/A
lower-unsound-log.f6445.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6445.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6445.0
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
metadata-eval44.8
Applied rewrites44.8%
lift-log.f64N/A
lift-*.f64N/A
log-prodN/A
lower-unsound-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
metadata-evalN/A
mult-flipN/A
lift-/.f64N/A
lower-unsound-log.f64N/A
lift-/.f64N/A
mult-flipN/A
metadata-evalN/A
lower-*.f64N/A
lower-unsound-log.f6432.0
Applied rewrites32.0%
Taylor expanded in angle around 0
lower-+.f64N/A
Applied rewrites37.1%
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
:precision binary64
(if (<= a 7.5e+107)
(fma
a
a
(*
(*
(*
(* PI PI)
(fma -3.08641975308642e-5 (* a a) (* (* b b) 3.08641975308642e-5)))
angle_m)
angle_m))
(* a a)))angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if (a <= 7.5e+107) {
tmp = fma(a, a, ((((((double) M_PI) * ((double) M_PI)) * fma(-3.08641975308642e-5, (a * a), ((b * b) * 3.08641975308642e-5))) * angle_m) * angle_m));
} else {
tmp = a * a;
}
return tmp;
}
angle_m = abs(angle) function code(a, b, angle_m) tmp = 0.0 if (a <= 7.5e+107) tmp = fma(a, a, Float64(Float64(Float64(Float64(pi * pi) * fma(-3.08641975308642e-5, Float64(a * a), Float64(Float64(b * b) * 3.08641975308642e-5))) * angle_m) * angle_m)); else tmp = Float64(a * a); end return tmp end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := If[LessEqual[a, 7.5e+107], N[(a * a + N[(N[(N[(N[(Pi * Pi), $MachinePrecision] * N[(-3.08641975308642e-5 * N[(a * a), $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * 3.08641975308642e-5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * angle$95$m), $MachinePrecision] * angle$95$m), $MachinePrecision]), $MachinePrecision], N[(a * a), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
\mathbf{if}\;a \leq 7.5 \cdot 10^{+107}:\\
\;\;\;\;\mathsf{fma}\left(a, a, \left(\left(\left(\pi \cdot \pi\right) \cdot \mathsf{fma}\left(-3.08641975308642 \cdot 10^{-5}, a \cdot a, \left(b \cdot b\right) \cdot 3.08641975308642 \cdot 10^{-5}\right)\right) \cdot angle\_m\right) \cdot angle\_m\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot a\\
\end{array}
\end{array}
if a < 7.4999999999999996e107Initial program 79.8%
Taylor expanded in angle around 0
lower-fma.f64N/A
Applied rewrites41.2%
lift-fma.f64N/A
+-commutativeN/A
lift-pow.f64N/A
pow2N/A
lower-fma.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites44.0%
if 7.4999999999999996e107 < a Initial program 79.8%
Taylor expanded in angle around 0
lower-pow.f6457.1
Applied rewrites57.1%
lift-pow.f64N/A
pow2N/A
lift-*.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
lower-pow.f6457.1
Applied rewrites57.1%
lift-pow.f64N/A
pow2N/A
lift-*.f6457.1
Applied rewrites57.1%
herbie shell --seed 2025154
(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)))