
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* (/ angle 180.0) PI))) (+ (pow (* a (sin t_0)) 2.0) (pow (* b (cos t_0)) 2.0))))
double code(double a, double b, double angle) {
double t_0 = (angle / 180.0) * ((double) M_PI);
return pow((a * sin(t_0)), 2.0) + pow((b * cos(t_0)), 2.0);
}
public static double code(double a, double b, double angle) {
double t_0 = (angle / 180.0) * Math.PI;
return Math.pow((a * Math.sin(t_0)), 2.0) + Math.pow((b * Math.cos(t_0)), 2.0);
}
def code(a, b, angle): t_0 = (angle / 180.0) * math.pi return math.pow((a * math.sin(t_0)), 2.0) + math.pow((b * math.cos(t_0)), 2.0)
function code(a, b, angle) t_0 = Float64(Float64(angle / 180.0) * pi) return Float64((Float64(a * sin(t_0)) ^ 2.0) + (Float64(b * cos(t_0)) ^ 2.0)) end
function tmp = code(a, b, angle) t_0 = (angle / 180.0) * pi; tmp = ((a * sin(t_0)) ^ 2.0) + ((b * cos(t_0)) ^ 2.0); end
code[a_, b_, angle_] := Block[{t$95$0 = N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]}, N[(N[Power[N[(a * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{angle}{180} \cdot \pi\\
{\left(a \cdot \sin t\_0\right)}^{2} + {\left(b \cdot \cos t\_0\right)}^{2}
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 7 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* (/ angle 180.0) PI))) (+ (pow (* a (sin t_0)) 2.0) (pow (* b (cos t_0)) 2.0))))
double code(double a, double b, double angle) {
double t_0 = (angle / 180.0) * ((double) M_PI);
return pow((a * sin(t_0)), 2.0) + pow((b * cos(t_0)), 2.0);
}
public static double code(double a, double b, double angle) {
double t_0 = (angle / 180.0) * Math.PI;
return Math.pow((a * Math.sin(t_0)), 2.0) + Math.pow((b * Math.cos(t_0)), 2.0);
}
def code(a, b, angle): t_0 = (angle / 180.0) * math.pi return math.pow((a * math.sin(t_0)), 2.0) + math.pow((b * math.cos(t_0)), 2.0)
function code(a, b, angle) t_0 = Float64(Float64(angle / 180.0) * pi) return Float64((Float64(a * sin(t_0)) ^ 2.0) + (Float64(b * cos(t_0)) ^ 2.0)) end
function tmp = code(a, b, angle) t_0 = (angle / 180.0) * pi; tmp = ((a * sin(t_0)) ^ 2.0) + ((b * cos(t_0)) ^ 2.0); end
code[a_, b_, angle_] := Block[{t$95$0 = N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]}, N[(N[Power[N[(a * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{angle}{180} \cdot \pi\\
{\left(a \cdot \sin t\_0\right)}^{2} + {\left(b \cdot \cos t\_0\right)}^{2}
\end{array}
\end{array}
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
:precision binary64
(if (<= (/ angle_m 180.0) 2e-13)
(+
(pow b 2.0)
(* (* a angle_m) (* angle_m (* 3.08641975308642e-5 (* a (* PI PI))))))
(+
(pow b 2.0)
(*
(- 0.5 (* 0.5 (cos (* 2.0 (* PI (* angle_m 0.005555555555555556))))))
(* a a)))))angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if ((angle_m / 180.0) <= 2e-13) {
tmp = pow(b, 2.0) + ((a * angle_m) * (angle_m * (3.08641975308642e-5 * (a * (((double) M_PI) * ((double) M_PI))))));
} else {
tmp = pow(b, 2.0) + ((0.5 - (0.5 * cos((2.0 * (((double) M_PI) * (angle_m * 0.005555555555555556)))))) * (a * a));
}
return tmp;
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double tmp;
if ((angle_m / 180.0) <= 2e-13) {
tmp = Math.pow(b, 2.0) + ((a * angle_m) * (angle_m * (3.08641975308642e-5 * (a * (Math.PI * Math.PI)))));
} else {
tmp = Math.pow(b, 2.0) + ((0.5 - (0.5 * Math.cos((2.0 * (Math.PI * (angle_m * 0.005555555555555556)))))) * (a * a));
}
return tmp;
}
angle_m = math.fabs(angle) def code(a, b, angle_m): tmp = 0 if (angle_m / 180.0) <= 2e-13: tmp = math.pow(b, 2.0) + ((a * angle_m) * (angle_m * (3.08641975308642e-5 * (a * (math.pi * math.pi))))) else: tmp = math.pow(b, 2.0) + ((0.5 - (0.5 * math.cos((2.0 * (math.pi * (angle_m * 0.005555555555555556)))))) * (a * a)) return tmp
angle_m = abs(angle) function code(a, b, angle_m) tmp = 0.0 if (Float64(angle_m / 180.0) <= 2e-13) tmp = Float64((b ^ 2.0) + Float64(Float64(a * angle_m) * Float64(angle_m * Float64(3.08641975308642e-5 * Float64(a * Float64(pi * pi)))))); else tmp = Float64((b ^ 2.0) + Float64(Float64(0.5 - Float64(0.5 * cos(Float64(2.0 * Float64(pi * Float64(angle_m * 0.005555555555555556)))))) * Float64(a * a))); end return tmp end
angle_m = abs(angle); function tmp_2 = code(a, b, angle_m) tmp = 0.0; if ((angle_m / 180.0) <= 2e-13) tmp = (b ^ 2.0) + ((a * angle_m) * (angle_m * (3.08641975308642e-5 * (a * (pi * pi))))); else tmp = (b ^ 2.0) + ((0.5 - (0.5 * cos((2.0 * (pi * (angle_m * 0.005555555555555556)))))) * (a * a)); end tmp_2 = tmp; end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 2e-13], N[(N[Power[b, 2.0], $MachinePrecision] + N[(N[(a * angle$95$m), $MachinePrecision] * N[(angle$95$m * N[(3.08641975308642e-5 * N[(a * N[(Pi * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[b, 2.0], $MachinePrecision] + N[(N[(0.5 - N[(0.5 * N[Cos[N[(2.0 * N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
\mathbf{if}\;\frac{angle\_m}{180} \leq 2 \cdot 10^{-13}:\\
\;\;\;\;{b}^{2} + \left(a \cdot angle\_m\right) \cdot \left(angle\_m \cdot \left(3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot \left(\pi \cdot \pi\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;{b}^{2} + \left(0.5 - 0.5 \cdot \cos \left(2 \cdot \left(\pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)\right)\right)\right) \cdot \left(a \cdot a\right)\\
\end{array}
\end{array}
if (/.f64 angle #s(literal 180 binary64)) < 2.0000000000000001e-13Initial program 87.0%
Taylor expanded in angle around 0
Simplified87.0%
Taylor expanded in angle around 0
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-PI.f64N/A
lower-PI.f6469.8
Simplified69.8%
lift-*.f64N/A
lift-PI.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
Applied egg-rr83.8%
Taylor expanded in a around 0
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-PI.f64N/A
lower-PI.f6483.9
Simplified83.9%
if 2.0000000000000001e-13 < (/.f64 angle #s(literal 180 binary64)) Initial program 59.1%
Taylor expanded in angle around 0
Simplified59.1%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-sin.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f6459.2
Simplified59.2%
Applied egg-rr59.3%
Final simplification76.8%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow (* a (sin (/ 1.0 (/ 180.0 (* angle_m PI))))) 2.0) (pow b 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow((a * sin((1.0 / (180.0 / (angle_m * ((double) M_PI)))))), 2.0) + pow(b, 2.0);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return Math.pow((a * Math.sin((1.0 / (180.0 / (angle_m * Math.PI))))), 2.0) + Math.pow(b, 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow((a * math.sin((1.0 / (180.0 / (angle_m * math.pi))))), 2.0) + math.pow(b, 2.0)
angle_m = abs(angle) function code(a, b, angle_m) return Float64((Float64(a * sin(Float64(1.0 / Float64(180.0 / Float64(angle_m * pi))))) ^ 2.0) + (b ^ 2.0)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = ((a * sin((1.0 / (180.0 / (angle_m * pi))))) ^ 2.0) + (b ^ 2.0); end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(N[Power[N[(a * N[Sin[N[(1.0 / N[(180.0 / N[(angle$95$m * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{\left(a \cdot \sin \left(\frac{1}{\frac{180}{angle\_m \cdot \pi}}\right)\right)}^{2} + {b}^{2}
\end{array}
Initial program 78.9%
Taylor expanded in angle around 0
Simplified78.9%
lift-PI.f64N/A
associate-*l/N/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f6479.0
Applied egg-rr79.0%
Final simplification79.0%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow b 2.0) (pow (* a (sin (* PI (* angle_m 0.005555555555555556)))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow(b, 2.0) + pow((a * sin((((double) M_PI) * (angle_m * 0.005555555555555556)))), 2.0);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return Math.pow(b, 2.0) + Math.pow((a * Math.sin((Math.PI * (angle_m * 0.005555555555555556)))), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow(b, 2.0) + math.pow((a * math.sin((math.pi * (angle_m * 0.005555555555555556)))), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) return Float64((b ^ 2.0) + (Float64(a * sin(Float64(pi * Float64(angle_m * 0.005555555555555556)))) ^ 2.0)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = (b ^ 2.0) + ((a * sin((pi * (angle_m * 0.005555555555555556)))) ^ 2.0); end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(N[Power[b, 2.0], $MachinePrecision] + N[Power[N[(a * N[Sin[N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{b}^{2} + {\left(a \cdot \sin \left(\pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)\right)\right)}^{2}
\end{array}
Initial program 78.9%
Taylor expanded in angle around 0
Simplified78.9%
lift-/.f64N/A
lift-PI.f64N/A
lift-*.f6478.9
lift-/.f64N/A
div-invN/A
metadata-evalN/A
lower-*.f6479.0
Applied egg-rr79.0%
Final simplification79.0%
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
:precision binary64
(if (<= (/ angle_m 180.0) 5e-20)
(+
(pow b 2.0)
(* (* a angle_m) (* angle_m (* 3.08641975308642e-5 (* a (* PI PI))))))
(+
(pow b 2.0)
(*
a
(*
a
(-
0.5
(* 0.5 (cos (* 2.0 (* PI (* angle_m 0.005555555555555556)))))))))))angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if ((angle_m / 180.0) <= 5e-20) {
tmp = pow(b, 2.0) + ((a * angle_m) * (angle_m * (3.08641975308642e-5 * (a * (((double) M_PI) * ((double) M_PI))))));
} else {
tmp = pow(b, 2.0) + (a * (a * (0.5 - (0.5 * cos((2.0 * (((double) M_PI) * (angle_m * 0.005555555555555556))))))));
}
return tmp;
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double tmp;
if ((angle_m / 180.0) <= 5e-20) {
tmp = Math.pow(b, 2.0) + ((a * angle_m) * (angle_m * (3.08641975308642e-5 * (a * (Math.PI * Math.PI)))));
} else {
tmp = Math.pow(b, 2.0) + (a * (a * (0.5 - (0.5 * Math.cos((2.0 * (Math.PI * (angle_m * 0.005555555555555556))))))));
}
return tmp;
}
angle_m = math.fabs(angle) def code(a, b, angle_m): tmp = 0 if (angle_m / 180.0) <= 5e-20: tmp = math.pow(b, 2.0) + ((a * angle_m) * (angle_m * (3.08641975308642e-5 * (a * (math.pi * math.pi))))) else: tmp = math.pow(b, 2.0) + (a * (a * (0.5 - (0.5 * math.cos((2.0 * (math.pi * (angle_m * 0.005555555555555556)))))))) return tmp
angle_m = abs(angle) function code(a, b, angle_m) tmp = 0.0 if (Float64(angle_m / 180.0) <= 5e-20) tmp = Float64((b ^ 2.0) + Float64(Float64(a * angle_m) * Float64(angle_m * Float64(3.08641975308642e-5 * Float64(a * Float64(pi * pi)))))); else tmp = Float64((b ^ 2.0) + Float64(a * Float64(a * Float64(0.5 - Float64(0.5 * cos(Float64(2.0 * Float64(pi * Float64(angle_m * 0.005555555555555556))))))))); end return tmp end
angle_m = abs(angle); function tmp_2 = code(a, b, angle_m) tmp = 0.0; if ((angle_m / 180.0) <= 5e-20) tmp = (b ^ 2.0) + ((a * angle_m) * (angle_m * (3.08641975308642e-5 * (a * (pi * pi))))); else tmp = (b ^ 2.0) + (a * (a * (0.5 - (0.5 * cos((2.0 * (pi * (angle_m * 0.005555555555555556)))))))); end tmp_2 = tmp; end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := If[LessEqual[N[(angle$95$m / 180.0), $MachinePrecision], 5e-20], N[(N[Power[b, 2.0], $MachinePrecision] + N[(N[(a * angle$95$m), $MachinePrecision] * N[(angle$95$m * N[(3.08641975308642e-5 * N[(a * N[(Pi * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[b, 2.0], $MachinePrecision] + N[(a * N[(a * N[(0.5 - N[(0.5 * N[Cos[N[(2.0 * N[(Pi * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
\mathbf{if}\;\frac{angle\_m}{180} \leq 5 \cdot 10^{-20}:\\
\;\;\;\;{b}^{2} + \left(a \cdot angle\_m\right) \cdot \left(angle\_m \cdot \left(3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot \left(\pi \cdot \pi\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;{b}^{2} + a \cdot \left(a \cdot \left(0.5 - 0.5 \cdot \cos \left(2 \cdot \left(\pi \cdot \left(angle\_m \cdot 0.005555555555555556\right)\right)\right)\right)\right)\\
\end{array}
\end{array}
if (/.f64 angle #s(literal 180 binary64)) < 4.9999999999999999e-20Initial program 86.9%
Taylor expanded in angle around 0
Simplified87.0%
Taylor expanded in angle around 0
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-PI.f64N/A
lower-PI.f6469.6
Simplified69.6%
lift-*.f64N/A
lift-PI.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
Applied egg-rr83.7%
Taylor expanded in a around 0
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-PI.f64N/A
lower-PI.f6483.8
Simplified83.8%
if 4.9999999999999999e-20 < (/.f64 angle #s(literal 180 binary64)) Initial program 59.6%
Taylor expanded in angle around 0
Simplified59.6%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-sin.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f6459.8
Simplified59.8%
Applied egg-rr59.9%
Final simplification76.8%
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
:precision binary64
(if (<= a 2e+120)
(+
(pow b 2.0)
(* (* 3.08641975308642e-5 (* angle_m (* a a))) (* angle_m (* PI PI))))
(+
(pow b 2.0)
(* (* a angle_m) (* angle_m (* 3.08641975308642e-5 (* a (* PI PI))))))))angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if (a <= 2e+120) {
tmp = pow(b, 2.0) + ((3.08641975308642e-5 * (angle_m * (a * a))) * (angle_m * (((double) M_PI) * ((double) M_PI))));
} else {
tmp = pow(b, 2.0) + ((a * angle_m) * (angle_m * (3.08641975308642e-5 * (a * (((double) M_PI) * ((double) M_PI))))));
}
return tmp;
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double tmp;
if (a <= 2e+120) {
tmp = Math.pow(b, 2.0) + ((3.08641975308642e-5 * (angle_m * (a * a))) * (angle_m * (Math.PI * Math.PI)));
} else {
tmp = Math.pow(b, 2.0) + ((a * angle_m) * (angle_m * (3.08641975308642e-5 * (a * (Math.PI * Math.PI)))));
}
return tmp;
}
angle_m = math.fabs(angle) def code(a, b, angle_m): tmp = 0 if a <= 2e+120: tmp = math.pow(b, 2.0) + ((3.08641975308642e-5 * (angle_m * (a * a))) * (angle_m * (math.pi * math.pi))) else: tmp = math.pow(b, 2.0) + ((a * angle_m) * (angle_m * (3.08641975308642e-5 * (a * (math.pi * math.pi))))) return tmp
angle_m = abs(angle) function code(a, b, angle_m) tmp = 0.0 if (a <= 2e+120) tmp = Float64((b ^ 2.0) + Float64(Float64(3.08641975308642e-5 * Float64(angle_m * Float64(a * a))) * Float64(angle_m * Float64(pi * pi)))); else tmp = Float64((b ^ 2.0) + Float64(Float64(a * angle_m) * Float64(angle_m * Float64(3.08641975308642e-5 * Float64(a * Float64(pi * pi)))))); end return tmp end
angle_m = abs(angle); function tmp_2 = code(a, b, angle_m) tmp = 0.0; if (a <= 2e+120) tmp = (b ^ 2.0) + ((3.08641975308642e-5 * (angle_m * (a * a))) * (angle_m * (pi * pi))); else tmp = (b ^ 2.0) + ((a * angle_m) * (angle_m * (3.08641975308642e-5 * (a * (pi * pi))))); end tmp_2 = tmp; end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := If[LessEqual[a, 2e+120], N[(N[Power[b, 2.0], $MachinePrecision] + N[(N[(3.08641975308642e-5 * N[(angle$95$m * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(angle$95$m * N[(Pi * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[b, 2.0], $MachinePrecision] + N[(N[(a * angle$95$m), $MachinePrecision] * N[(angle$95$m * N[(3.08641975308642e-5 * N[(a * N[(Pi * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
\mathbf{if}\;a \leq 2 \cdot 10^{+120}:\\
\;\;\;\;{b}^{2} + \left(3.08641975308642 \cdot 10^{-5} \cdot \left(angle\_m \cdot \left(a \cdot a\right)\right)\right) \cdot \left(angle\_m \cdot \left(\pi \cdot \pi\right)\right)\\
\mathbf{else}:\\
\;\;\;\;{b}^{2} + \left(a \cdot angle\_m\right) \cdot \left(angle\_m \cdot \left(3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot \left(\pi \cdot \pi\right)\right)\right)\right)\\
\end{array}
\end{array}
if a < 2e120Initial program 75.3%
Taylor expanded in angle around 0
Simplified75.3%
Taylor expanded in angle around 0
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-PI.f64N/A
lower-PI.f6462.0
Simplified62.0%
lift-*.f64N/A
lift-PI.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
Applied egg-rr68.3%
if 2e120 < a Initial program 96.1%
Taylor expanded in angle around 0
Simplified96.1%
Taylor expanded in angle around 0
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-PI.f64N/A
lower-PI.f6470.4
Simplified70.4%
lift-*.f64N/A
lift-PI.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
Applied egg-rr95.7%
Taylor expanded in a around 0
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-PI.f64N/A
lower-PI.f6495.8
Simplified95.8%
Final simplification73.1%
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
:precision binary64
(if (<= a 1.85e-187)
(+
(pow b 2.0)
(* angle_m (* angle_m (* PI (* a (* a (* PI 3.08641975308642e-5)))))))
(+
(pow b 2.0)
(* (* a angle_m) (* angle_m (* 3.08641975308642e-5 (* a (* PI PI))))))))angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if (a <= 1.85e-187) {
tmp = pow(b, 2.0) + (angle_m * (angle_m * (((double) M_PI) * (a * (a * (((double) M_PI) * 3.08641975308642e-5))))));
} else {
tmp = pow(b, 2.0) + ((a * angle_m) * (angle_m * (3.08641975308642e-5 * (a * (((double) M_PI) * ((double) M_PI))))));
}
return tmp;
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double tmp;
if (a <= 1.85e-187) {
tmp = Math.pow(b, 2.0) + (angle_m * (angle_m * (Math.PI * (a * (a * (Math.PI * 3.08641975308642e-5))))));
} else {
tmp = Math.pow(b, 2.0) + ((a * angle_m) * (angle_m * (3.08641975308642e-5 * (a * (Math.PI * Math.PI)))));
}
return tmp;
}
angle_m = math.fabs(angle) def code(a, b, angle_m): tmp = 0 if a <= 1.85e-187: tmp = math.pow(b, 2.0) + (angle_m * (angle_m * (math.pi * (a * (a * (math.pi * 3.08641975308642e-5)))))) else: tmp = math.pow(b, 2.0) + ((a * angle_m) * (angle_m * (3.08641975308642e-5 * (a * (math.pi * math.pi))))) return tmp
angle_m = abs(angle) function code(a, b, angle_m) tmp = 0.0 if (a <= 1.85e-187) tmp = Float64((b ^ 2.0) + Float64(angle_m * Float64(angle_m * Float64(pi * Float64(a * Float64(a * Float64(pi * 3.08641975308642e-5))))))); else tmp = Float64((b ^ 2.0) + Float64(Float64(a * angle_m) * Float64(angle_m * Float64(3.08641975308642e-5 * Float64(a * Float64(pi * pi)))))); end return tmp end
angle_m = abs(angle); function tmp_2 = code(a, b, angle_m) tmp = 0.0; if (a <= 1.85e-187) tmp = (b ^ 2.0) + (angle_m * (angle_m * (pi * (a * (a * (pi * 3.08641975308642e-5)))))); else tmp = (b ^ 2.0) + ((a * angle_m) * (angle_m * (3.08641975308642e-5 * (a * (pi * pi))))); end tmp_2 = tmp; end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := If[LessEqual[a, 1.85e-187], N[(N[Power[b, 2.0], $MachinePrecision] + N[(angle$95$m * N[(angle$95$m * N[(Pi * N[(a * N[(a * N[(Pi * 3.08641975308642e-5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[b, 2.0], $MachinePrecision] + N[(N[(a * angle$95$m), $MachinePrecision] * N[(angle$95$m * N[(3.08641975308642e-5 * N[(a * N[(Pi * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
\mathbf{if}\;a \leq 1.85 \cdot 10^{-187}:\\
\;\;\;\;{b}^{2} + angle\_m \cdot \left(angle\_m \cdot \left(\pi \cdot \left(a \cdot \left(a \cdot \left(\pi \cdot 3.08641975308642 \cdot 10^{-5}\right)\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;{b}^{2} + \left(a \cdot angle\_m\right) \cdot \left(angle\_m \cdot \left(3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot \left(\pi \cdot \pi\right)\right)\right)\right)\\
\end{array}
\end{array}
if a < 1.85000000000000005e-187Initial program 78.6%
Taylor expanded in angle around 0
Simplified78.7%
Taylor expanded in angle around 0
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-PI.f64N/A
lower-PI.f6463.4
Simplified63.4%
lift-*.f64N/A
lift-PI.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied egg-rr70.5%
if 1.85000000000000005e-187 < a Initial program 79.4%
Taylor expanded in angle around 0
Simplified79.3%
Taylor expanded in angle around 0
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-PI.f64N/A
lower-PI.f6463.6
Simplified63.6%
lift-*.f64N/A
lift-PI.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
Applied egg-rr76.3%
Taylor expanded in a around 0
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-PI.f64N/A
lower-PI.f6476.3
Simplified76.3%
Final simplification73.1%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow b 2.0) (* (* a angle_m) (* angle_m (* 3.08641975308642e-5 (* a (* PI PI)))))))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow(b, 2.0) + ((a * angle_m) * (angle_m * (3.08641975308642e-5 * (a * (((double) M_PI) * ((double) M_PI))))));
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return Math.pow(b, 2.0) + ((a * angle_m) * (angle_m * (3.08641975308642e-5 * (a * (Math.PI * Math.PI)))));
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow(b, 2.0) + ((a * angle_m) * (angle_m * (3.08641975308642e-5 * (a * (math.pi * math.pi)))))
angle_m = abs(angle) function code(a, b, angle_m) return Float64((b ^ 2.0) + Float64(Float64(a * angle_m) * Float64(angle_m * Float64(3.08641975308642e-5 * Float64(a * Float64(pi * pi)))))) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = (b ^ 2.0) + ((a * angle_m) * (angle_m * (3.08641975308642e-5 * (a * (pi * pi))))); end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(N[Power[b, 2.0], $MachinePrecision] + N[(N[(a * angle$95$m), $MachinePrecision] * N[(angle$95$m * N[(3.08641975308642e-5 * N[(a * N[(Pi * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{b}^{2} + \left(a \cdot angle\_m\right) \cdot \left(angle\_m \cdot \left(3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot \left(\pi \cdot \pi\right)\right)\right)\right)
\end{array}
Initial program 78.9%
Taylor expanded in angle around 0
Simplified78.9%
Taylor expanded in angle around 0
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-PI.f64N/A
lower-PI.f6463.5
Simplified63.5%
lift-*.f64N/A
lift-PI.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
Applied egg-rr74.4%
Taylor expanded in a around 0
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-PI.f64N/A
lower-PI.f6474.5
Simplified74.5%
Final simplification74.5%
herbie shell --seed 2024215
(FPCore (a b angle)
:name "ab-angle->ABCF A"
:precision binary64
(+ (pow (* a (sin (* (/ angle 180.0) PI))) 2.0) (pow (* b (cos (* (/ angle 180.0) PI))) 2.0)))