
(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}
Sampling outcomes in binary64 precision:
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
(+
(pow a 2.0)
(pow
(*
b
(sin (* (sqrt angle_m) (* (* PI -0.005555555555555556) (sqrt angle_m)))))
2.0)))angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow(a, 2.0) + pow((b * sin((sqrt(angle_m) * ((((double) M_PI) * -0.005555555555555556) * sqrt(angle_m))))), 2.0);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return Math.pow(a, 2.0) + Math.pow((b * Math.sin((Math.sqrt(angle_m) * ((Math.PI * -0.005555555555555556) * Math.sqrt(angle_m))))), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow(a, 2.0) + math.pow((b * math.sin((math.sqrt(angle_m) * ((math.pi * -0.005555555555555556) * math.sqrt(angle_m))))), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) return Float64((a ^ 2.0) + (Float64(b * sin(Float64(sqrt(angle_m) * Float64(Float64(pi * -0.005555555555555556) * sqrt(angle_m))))) ^ 2.0)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = (a ^ 2.0) + ((b * sin((sqrt(angle_m) * ((pi * -0.005555555555555556) * sqrt(angle_m))))) ^ 2.0); end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(N[Power[a, 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[N[(N[Sqrt[angle$95$m], $MachinePrecision] * N[(N[(Pi * -0.005555555555555556), $MachinePrecision] * N[Sqrt[angle$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{a}^{2} + {\left(b \cdot \sin \left(\sqrt{angle_m} \cdot \left(\left(\pi \cdot -0.005555555555555556\right) \cdot \sqrt{angle_m}\right)\right)\right)}^{2}
\end{array}
Initial program 79.4%
Simplified79.5%
Taylor expanded in angle around 0 80.0%
div-inv80.0%
metadata-eval80.0%
rem-cube-cbrt80.0%
Applied egg-rr80.0%
rem-cube-cbrt80.0%
metadata-eval80.0%
div-inv80.0%
*-commutative80.0%
add-sqr-sqrt42.1%
associate-*r*42.1%
div-inv42.1%
metadata-eval42.1%
Applied egg-rr42.1%
Final simplification42.1%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow a 2.0) (pow (* b (sin (pow (cbrt (* (* PI -0.005555555555555556) angle_m)) 3.0))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow(a, 2.0) + pow((b * sin(pow(cbrt(((((double) M_PI) * -0.005555555555555556) * angle_m)), 3.0))), 2.0);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return Math.pow(a, 2.0) + Math.pow((b * Math.sin(Math.pow(Math.cbrt(((Math.PI * -0.005555555555555556) * angle_m)), 3.0))), 2.0);
}
angle_m = abs(angle) function code(a, b, angle_m) return Float64((a ^ 2.0) + (Float64(b * sin((cbrt(Float64(Float64(pi * -0.005555555555555556) * angle_m)) ^ 3.0))) ^ 2.0)) end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(N[Power[a, 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[N[Power[N[Power[N[(N[(Pi * -0.005555555555555556), $MachinePrecision] * angle$95$m), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{a}^{2} + {\left(b \cdot \sin \left({\left(\sqrt[3]{\left(\pi \cdot -0.005555555555555556\right) \cdot angle_m}\right)}^{3}\right)\right)}^{2}
\end{array}
Initial program 79.4%
Simplified79.5%
Taylor expanded in angle around 0 80.0%
div-inv80.0%
metadata-eval80.0%
rem-cube-cbrt80.0%
Applied egg-rr80.0%
Final simplification80.0%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow a 2.0) (pow (* b (sin (* angle_m (/ PI -180.0)))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow(a, 2.0) + pow((b * sin((angle_m * (((double) M_PI) / -180.0)))), 2.0);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return Math.pow(a, 2.0) + Math.pow((b * Math.sin((angle_m * (Math.PI / -180.0)))), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow(a, 2.0) + math.pow((b * math.sin((angle_m * (math.pi / -180.0)))), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) return Float64((a ^ 2.0) + (Float64(b * sin(Float64(angle_m * Float64(pi / -180.0)))) ^ 2.0)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = (a ^ 2.0) + ((b * sin((angle_m * (pi / -180.0)))) ^ 2.0); end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(N[Power[a, 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[N[(angle$95$m * N[(Pi / -180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{a}^{2} + {\left(b \cdot \sin \left(angle_m \cdot \frac{\pi}{-180}\right)\right)}^{2}
\end{array}
Initial program 79.4%
Simplified79.5%
Taylor expanded in angle around 0 80.0%
Final simplification80.0%
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
:precision binary64
(let* ((t_0 (* angle_m (* -0.005555555555555556 (* b PI)))))
(if (<= b 1.75e-85)
(pow a 2.0)
(+ (pow (* a (cos (* angle_m (/ PI -180.0)))) 2.0) (* t_0 t_0)))))angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double t_0 = angle_m * (-0.005555555555555556 * (b * ((double) M_PI)));
double tmp;
if (b <= 1.75e-85) {
tmp = pow(a, 2.0);
} else {
tmp = pow((a * cos((angle_m * (((double) M_PI) / -180.0)))), 2.0) + (t_0 * t_0);
}
return tmp;
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double t_0 = angle_m * (-0.005555555555555556 * (b * Math.PI));
double tmp;
if (b <= 1.75e-85) {
tmp = Math.pow(a, 2.0);
} else {
tmp = Math.pow((a * Math.cos((angle_m * (Math.PI / -180.0)))), 2.0) + (t_0 * t_0);
}
return tmp;
}
angle_m = math.fabs(angle) def code(a, b, angle_m): t_0 = angle_m * (-0.005555555555555556 * (b * math.pi)) tmp = 0 if b <= 1.75e-85: tmp = math.pow(a, 2.0) else: tmp = math.pow((a * math.cos((angle_m * (math.pi / -180.0)))), 2.0) + (t_0 * t_0) return tmp
angle_m = abs(angle) function code(a, b, angle_m) t_0 = Float64(angle_m * Float64(-0.005555555555555556 * Float64(b * pi))) tmp = 0.0 if (b <= 1.75e-85) tmp = a ^ 2.0; else tmp = Float64((Float64(a * cos(Float64(angle_m * Float64(pi / -180.0)))) ^ 2.0) + Float64(t_0 * t_0)); end return tmp end
angle_m = abs(angle); function tmp_2 = code(a, b, angle_m) t_0 = angle_m * (-0.005555555555555556 * (b * pi)); tmp = 0.0; if (b <= 1.75e-85) tmp = a ^ 2.0; else tmp = ((a * cos((angle_m * (pi / -180.0)))) ^ 2.0) + (t_0 * t_0); end tmp_2 = tmp; end
angle_m = N[Abs[angle], $MachinePrecision]
code[a_, b_, angle$95$m_] := Block[{t$95$0 = N[(angle$95$m * N[(-0.005555555555555556 * N[(b * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 1.75e-85], N[Power[a, 2.0], $MachinePrecision], N[(N[Power[N[(a * N[Cos[N[(angle$95$m * N[(Pi / -180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
t_0 := angle_m \cdot \left(-0.005555555555555556 \cdot \left(b \cdot \pi\right)\right)\\
\mathbf{if}\;b \leq 1.75 \cdot 10^{-85}:\\
\;\;\;\;{a}^{2}\\
\mathbf{else}:\\
\;\;\;\;{\left(a \cdot \cos \left(angle_m \cdot \frac{\pi}{-180}\right)\right)}^{2} + t_0 \cdot t_0\\
\end{array}
\end{array}
if b < 1.74999999999999989e-85Initial program 77.0%
Simplified77.1%
Taylor expanded in angle around 0 77.9%
div-inv77.9%
metadata-eval77.9%
rem-cube-cbrt77.8%
Applied egg-rr77.8%
Taylor expanded in angle around 0 63.4%
if 1.74999999999999989e-85 < b Initial program 86.0%
Simplified86.2%
Taylor expanded in angle around 0 84.1%
associate-*r*84.2%
Simplified84.2%
unpow284.2%
*-commutative84.2%
*-commutative84.2%
associate-*l*84.2%
associate-*l*84.2%
*-commutative84.2%
associate-*l*84.2%
associate-*l*84.1%
*-commutative84.1%
Applied egg-rr84.1%
Final simplification69.0%
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
:precision binary64
(if (<= b 3.7e-85)
(pow a 2.0)
(+
(pow (* a (cos (* angle_m (/ PI -180.0)))) 2.0)
(*
(* -0.005555555555555556 (* angle_m (* -0.005555555555555556 (* b PI))))
(* angle_m (* b PI))))))angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if (b <= 3.7e-85) {
tmp = pow(a, 2.0);
} else {
tmp = pow((a * cos((angle_m * (((double) M_PI) / -180.0)))), 2.0) + ((-0.005555555555555556 * (angle_m * (-0.005555555555555556 * (b * ((double) M_PI))))) * (angle_m * (b * ((double) M_PI))));
}
return tmp;
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double tmp;
if (b <= 3.7e-85) {
tmp = Math.pow(a, 2.0);
} else {
tmp = Math.pow((a * Math.cos((angle_m * (Math.PI / -180.0)))), 2.0) + ((-0.005555555555555556 * (angle_m * (-0.005555555555555556 * (b * Math.PI)))) * (angle_m * (b * Math.PI)));
}
return tmp;
}
angle_m = math.fabs(angle) def code(a, b, angle_m): tmp = 0 if b <= 3.7e-85: tmp = math.pow(a, 2.0) else: tmp = math.pow((a * math.cos((angle_m * (math.pi / -180.0)))), 2.0) + ((-0.005555555555555556 * (angle_m * (-0.005555555555555556 * (b * math.pi)))) * (angle_m * (b * math.pi))) return tmp
angle_m = abs(angle) function code(a, b, angle_m) tmp = 0.0 if (b <= 3.7e-85) tmp = a ^ 2.0; else tmp = Float64((Float64(a * cos(Float64(angle_m * Float64(pi / -180.0)))) ^ 2.0) + Float64(Float64(-0.005555555555555556 * Float64(angle_m * Float64(-0.005555555555555556 * Float64(b * pi)))) * Float64(angle_m * Float64(b * pi)))); end return tmp end
angle_m = abs(angle); function tmp_2 = code(a, b, angle_m) tmp = 0.0; if (b <= 3.7e-85) tmp = a ^ 2.0; else tmp = ((a * cos((angle_m * (pi / -180.0)))) ^ 2.0) + ((-0.005555555555555556 * (angle_m * (-0.005555555555555556 * (b * pi)))) * (angle_m * (b * pi))); end tmp_2 = tmp; end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := If[LessEqual[b, 3.7e-85], N[Power[a, 2.0], $MachinePrecision], N[(N[Power[N[(a * N[Cos[N[(angle$95$m * N[(Pi / -180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(N[(-0.005555555555555556 * N[(angle$95$m * N[(-0.005555555555555556 * N[(b * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(angle$95$m * N[(b * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
\mathbf{if}\;b \leq 3.7 \cdot 10^{-85}:\\
\;\;\;\;{a}^{2}\\
\mathbf{else}:\\
\;\;\;\;{\left(a \cdot \cos \left(angle_m \cdot \frac{\pi}{-180}\right)\right)}^{2} + \left(-0.005555555555555556 \cdot \left(angle_m \cdot \left(-0.005555555555555556 \cdot \left(b \cdot \pi\right)\right)\right)\right) \cdot \left(angle_m \cdot \left(b \cdot \pi\right)\right)\\
\end{array}
\end{array}
if b < 3.69999999999999983e-85Initial program 77.0%
Simplified77.1%
Taylor expanded in angle around 0 77.9%
div-inv77.9%
metadata-eval77.9%
rem-cube-cbrt77.8%
Applied egg-rr77.8%
Taylor expanded in angle around 0 63.4%
if 3.69999999999999983e-85 < b Initial program 86.0%
Simplified86.2%
Taylor expanded in angle around 0 84.1%
associate-*r*84.2%
Simplified84.2%
unpow284.2%
associate-*r*84.2%
*-commutative84.2%
associate-*l*84.2%
associate-*l*84.3%
*-commutative84.3%
associate-*l*84.2%
*-commutative84.2%
Applied egg-rr84.2%
Final simplification69.0%
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
:precision binary64
(if (<= b 5e+168)
(+
(pow a 2.0)
(*
(* -0.005555555555555556 angle_m)
(* (* b PI) (* b (* -0.005555555555555556 (* PI angle_m))))))
(+
(pow a 2.0)
(*
b
(*
(* PI angle_m)
(*
(* (* PI -0.005555555555555556) angle_m)
(* b -0.005555555555555556)))))))angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if (b <= 5e+168) {
tmp = pow(a, 2.0) + ((-0.005555555555555556 * angle_m) * ((b * ((double) M_PI)) * (b * (-0.005555555555555556 * (((double) M_PI) * angle_m)))));
} else {
tmp = pow(a, 2.0) + (b * ((((double) M_PI) * angle_m) * (((((double) M_PI) * -0.005555555555555556) * angle_m) * (b * -0.005555555555555556))));
}
return tmp;
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double tmp;
if (b <= 5e+168) {
tmp = Math.pow(a, 2.0) + ((-0.005555555555555556 * angle_m) * ((b * Math.PI) * (b * (-0.005555555555555556 * (Math.PI * angle_m)))));
} else {
tmp = Math.pow(a, 2.0) + (b * ((Math.PI * angle_m) * (((Math.PI * -0.005555555555555556) * angle_m) * (b * -0.005555555555555556))));
}
return tmp;
}
angle_m = math.fabs(angle) def code(a, b, angle_m): tmp = 0 if b <= 5e+168: tmp = math.pow(a, 2.0) + ((-0.005555555555555556 * angle_m) * ((b * math.pi) * (b * (-0.005555555555555556 * (math.pi * angle_m))))) else: tmp = math.pow(a, 2.0) + (b * ((math.pi * angle_m) * (((math.pi * -0.005555555555555556) * angle_m) * (b * -0.005555555555555556)))) return tmp
angle_m = abs(angle) function code(a, b, angle_m) tmp = 0.0 if (b <= 5e+168) tmp = Float64((a ^ 2.0) + Float64(Float64(-0.005555555555555556 * angle_m) * Float64(Float64(b * pi) * Float64(b * Float64(-0.005555555555555556 * Float64(pi * angle_m)))))); else tmp = Float64((a ^ 2.0) + Float64(b * Float64(Float64(pi * angle_m) * Float64(Float64(Float64(pi * -0.005555555555555556) * angle_m) * Float64(b * -0.005555555555555556))))); end return tmp end
angle_m = abs(angle); function tmp_2 = code(a, b, angle_m) tmp = 0.0; if (b <= 5e+168) tmp = (a ^ 2.0) + ((-0.005555555555555556 * angle_m) * ((b * pi) * (b * (-0.005555555555555556 * (pi * angle_m))))); else tmp = (a ^ 2.0) + (b * ((pi * angle_m) * (((pi * -0.005555555555555556) * angle_m) * (b * -0.005555555555555556)))); end tmp_2 = tmp; end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := If[LessEqual[b, 5e+168], N[(N[Power[a, 2.0], $MachinePrecision] + N[(N[(-0.005555555555555556 * angle$95$m), $MachinePrecision] * N[(N[(b * Pi), $MachinePrecision] * N[(b * N[(-0.005555555555555556 * N[(Pi * angle$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[a, 2.0], $MachinePrecision] + N[(b * N[(N[(Pi * angle$95$m), $MachinePrecision] * N[(N[(N[(Pi * -0.005555555555555556), $MachinePrecision] * angle$95$m), $MachinePrecision] * N[(b * -0.005555555555555556), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
\mathbf{if}\;b \leq 5 \cdot 10^{+168}:\\
\;\;\;\;{a}^{2} + \left(-0.005555555555555556 \cdot angle_m\right) \cdot \left(\left(b \cdot \pi\right) \cdot \left(b \cdot \left(-0.005555555555555556 \cdot \left(\pi \cdot angle_m\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;{a}^{2} + b \cdot \left(\left(\pi \cdot angle_m\right) \cdot \left(\left(\left(\pi \cdot -0.005555555555555556\right) \cdot angle_m\right) \cdot \left(b \cdot -0.005555555555555556\right)\right)\right)\\
\end{array}
\end{array}
if b < 4.99999999999999967e168Initial program 77.4%
Simplified77.4%
Taylor expanded in angle around 0 78.0%
Taylor expanded in angle around 0 72.8%
unpow272.8%
associate-*r*72.8%
associate-*l*72.0%
*-commutative72.0%
associate-*r*72.0%
*-commutative72.0%
associate-*r*72.0%
associate-*r*72.1%
*-commutative72.1%
associate-*r*72.0%
Applied egg-rr72.0%
*-commutative72.0%
*-commutative72.0%
*-commutative72.0%
associate-*r*72.1%
*-commutative72.1%
Simplified72.1%
if 4.99999999999999967e168 < b Initial program 99.5%
Simplified99.6%
Taylor expanded in angle around 0 99.6%
Taylor expanded in angle around 0 99.5%
unpow299.5%
associate-*l*99.5%
*-commutative99.5%
associate-*l*99.6%
*-commutative99.6%
associate-*r*99.7%
*-commutative99.7%
associate-*r*99.7%
associate-*r*99.6%
*-commutative99.6%
associate-*r*99.7%
Applied egg-rr99.7%
associate-*r*99.7%
*-commutative99.7%
associate-*r*99.7%
associate-*l*99.6%
*-commutative99.6%
associate-*l*99.8%
*-commutative99.8%
Simplified99.8%
Final simplification74.7%
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
:precision binary64
(if (<= b 1.8e-138)
(pow a 2.0)
(+
(pow a 2.0)
(*
-0.005555555555555556
(*
(* b (* (* PI -0.005555555555555556) angle_m))
(* b (* PI angle_m)))))))angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if (b <= 1.8e-138) {
tmp = pow(a, 2.0);
} else {
tmp = pow(a, 2.0) + (-0.005555555555555556 * ((b * ((((double) M_PI) * -0.005555555555555556) * angle_m)) * (b * (((double) M_PI) * angle_m))));
}
return tmp;
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double tmp;
if (b <= 1.8e-138) {
tmp = Math.pow(a, 2.0);
} else {
tmp = Math.pow(a, 2.0) + (-0.005555555555555556 * ((b * ((Math.PI * -0.005555555555555556) * angle_m)) * (b * (Math.PI * angle_m))));
}
return tmp;
}
angle_m = math.fabs(angle) def code(a, b, angle_m): tmp = 0 if b <= 1.8e-138: tmp = math.pow(a, 2.0) else: tmp = math.pow(a, 2.0) + (-0.005555555555555556 * ((b * ((math.pi * -0.005555555555555556) * angle_m)) * (b * (math.pi * angle_m)))) return tmp
angle_m = abs(angle) function code(a, b, angle_m) tmp = 0.0 if (b <= 1.8e-138) tmp = a ^ 2.0; else tmp = Float64((a ^ 2.0) + Float64(-0.005555555555555556 * Float64(Float64(b * Float64(Float64(pi * -0.005555555555555556) * angle_m)) * Float64(b * Float64(pi * angle_m))))); end return tmp end
angle_m = abs(angle); function tmp_2 = code(a, b, angle_m) tmp = 0.0; if (b <= 1.8e-138) tmp = a ^ 2.0; else tmp = (a ^ 2.0) + (-0.005555555555555556 * ((b * ((pi * -0.005555555555555556) * angle_m)) * (b * (pi * angle_m)))); end tmp_2 = tmp; end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := If[LessEqual[b, 1.8e-138], N[Power[a, 2.0], $MachinePrecision], N[(N[Power[a, 2.0], $MachinePrecision] + N[(-0.005555555555555556 * N[(N[(b * N[(N[(Pi * -0.005555555555555556), $MachinePrecision] * angle$95$m), $MachinePrecision]), $MachinePrecision] * N[(b * N[(Pi * angle$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.8 \cdot 10^{-138}:\\
\;\;\;\;{a}^{2}\\
\mathbf{else}:\\
\;\;\;\;{a}^{2} + -0.005555555555555556 \cdot \left(\left(b \cdot \left(\left(\pi \cdot -0.005555555555555556\right) \cdot angle_m\right)\right) \cdot \left(b \cdot \left(\pi \cdot angle_m\right)\right)\right)\\
\end{array}
\end{array}
if b < 1.80000000000000009e-138Initial program 76.8%
Simplified76.8%
Taylor expanded in angle around 0 77.7%
div-inv77.7%
metadata-eval77.7%
rem-cube-cbrt77.6%
Applied egg-rr77.6%
Taylor expanded in angle around 0 62.5%
if 1.80000000000000009e-138 < b Initial program 85.5%
Simplified85.6%
Taylor expanded in angle around 0 85.2%
Taylor expanded in angle around 0 83.0%
unpow283.0%
*-commutative83.0%
associate-*r*83.0%
associate-*r*83.0%
*-commutative83.0%
associate-*r*83.0%
associate-*r*83.1%
*-commutative83.1%
associate-*r*83.1%
*-commutative83.1%
associate-*l*83.1%
*-commutative83.1%
Applied egg-rr83.1%
Final simplification68.8%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow a 2.0) (* -0.005555555555555556 (* b (* (* PI angle_m) (* b (* -0.005555555555555556 (* PI angle_m))))))))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow(a, 2.0) + (-0.005555555555555556 * (b * ((((double) M_PI) * angle_m) * (b * (-0.005555555555555556 * (((double) M_PI) * angle_m))))));
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return Math.pow(a, 2.0) + (-0.005555555555555556 * (b * ((Math.PI * angle_m) * (b * (-0.005555555555555556 * (Math.PI * angle_m))))));
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow(a, 2.0) + (-0.005555555555555556 * (b * ((math.pi * angle_m) * (b * (-0.005555555555555556 * (math.pi * angle_m))))))
angle_m = abs(angle) function code(a, b, angle_m) return Float64((a ^ 2.0) + Float64(-0.005555555555555556 * Float64(b * Float64(Float64(pi * angle_m) * Float64(b * Float64(-0.005555555555555556 * Float64(pi * angle_m))))))) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = (a ^ 2.0) + (-0.005555555555555556 * (b * ((pi * angle_m) * (b * (-0.005555555555555556 * (pi * angle_m)))))); end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(N[Power[a, 2.0], $MachinePrecision] + N[(-0.005555555555555556 * N[(b * N[(N[(Pi * angle$95$m), $MachinePrecision] * N[(b * N[(-0.005555555555555556 * N[(Pi * angle$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{a}^{2} + -0.005555555555555556 \cdot \left(b \cdot \left(\left(\pi \cdot angle_m\right) \cdot \left(b \cdot \left(-0.005555555555555556 \cdot \left(\pi \cdot angle_m\right)\right)\right)\right)\right)
\end{array}
Initial program 79.4%
Simplified79.5%
Taylor expanded in angle around 0 80.0%
Taylor expanded in angle around 0 75.3%
unpow275.3%
associate-*l*75.3%
*-commutative75.3%
associate-*l*75.4%
*-commutative75.4%
associate-*r*75.3%
*-commutative75.3%
associate-*r*75.4%
associate-*r*75.4%
*-commutative75.4%
associate-*r*75.4%
Applied egg-rr75.4%
associate-*l*73.6%
*-commutative73.6%
associate-*r*73.6%
*-commutative73.6%
Simplified73.6%
Final simplification73.6%
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
:precision binary64
(+
(pow a 2.0)
(*
PI
(*
b
(*
(* (* PI -0.005555555555555556) angle_m)
(* b (* -0.005555555555555556 angle_m)))))))angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow(a, 2.0) + (((double) M_PI) * (b * (((((double) M_PI) * -0.005555555555555556) * angle_m) * (b * (-0.005555555555555556 * angle_m)))));
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return Math.pow(a, 2.0) + (Math.PI * (b * (((Math.PI * -0.005555555555555556) * angle_m) * (b * (-0.005555555555555556 * angle_m)))));
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow(a, 2.0) + (math.pi * (b * (((math.pi * -0.005555555555555556) * angle_m) * (b * (-0.005555555555555556 * angle_m)))))
angle_m = abs(angle) function code(a, b, angle_m) return Float64((a ^ 2.0) + Float64(pi * Float64(b * Float64(Float64(Float64(pi * -0.005555555555555556) * angle_m) * Float64(b * Float64(-0.005555555555555556 * angle_m)))))) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = (a ^ 2.0) + (pi * (b * (((pi * -0.005555555555555556) * angle_m) * (b * (-0.005555555555555556 * angle_m))))); end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(N[Power[a, 2.0], $MachinePrecision] + N[(Pi * N[(b * N[(N[(N[(Pi * -0.005555555555555556), $MachinePrecision] * angle$95$m), $MachinePrecision] * N[(b * N[(-0.005555555555555556 * angle$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{a}^{2} + \pi \cdot \left(b \cdot \left(\left(\left(\pi \cdot -0.005555555555555556\right) \cdot angle_m\right) \cdot \left(b \cdot \left(-0.005555555555555556 \cdot angle_m\right)\right)\right)\right)
\end{array}
Initial program 79.4%
Simplified79.5%
Taylor expanded in angle around 0 80.0%
Taylor expanded in angle around 0 75.3%
unpow275.3%
associate-*r*75.3%
associate-*l*73.2%
*-commutative73.2%
associate-*r*73.1%
*-commutative73.1%
associate-*r*73.2%
associate-*r*73.2%
*-commutative73.2%
associate-*r*73.2%
Applied egg-rr73.2%
associate-*r*75.4%
*-commutative75.4%
associate-*l*73.5%
associate-*r*73.6%
*-commutative73.6%
*-commutative73.6%
associate-*l*73.6%
*-commutative73.6%
*-commutative73.6%
Simplified73.6%
Final simplification73.6%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow a 2.0) (* -0.005555555555555556 (* (* b (* (* PI -0.005555555555555556) angle_m)) (* b (* PI angle_m))))))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow(a, 2.0) + (-0.005555555555555556 * ((b * ((((double) M_PI) * -0.005555555555555556) * angle_m)) * (b * (((double) M_PI) * angle_m))));
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return Math.pow(a, 2.0) + (-0.005555555555555556 * ((b * ((Math.PI * -0.005555555555555556) * angle_m)) * (b * (Math.PI * angle_m))));
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow(a, 2.0) + (-0.005555555555555556 * ((b * ((math.pi * -0.005555555555555556) * angle_m)) * (b * (math.pi * angle_m))))
angle_m = abs(angle) function code(a, b, angle_m) return Float64((a ^ 2.0) + Float64(-0.005555555555555556 * Float64(Float64(b * Float64(Float64(pi * -0.005555555555555556) * angle_m)) * Float64(b * Float64(pi * angle_m))))) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = (a ^ 2.0) + (-0.005555555555555556 * ((b * ((pi * -0.005555555555555556) * angle_m)) * (b * (pi * angle_m)))); end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(N[Power[a, 2.0], $MachinePrecision] + N[(-0.005555555555555556 * N[(N[(b * N[(N[(Pi * -0.005555555555555556), $MachinePrecision] * angle$95$m), $MachinePrecision]), $MachinePrecision] * N[(b * N[(Pi * angle$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{a}^{2} + -0.005555555555555556 \cdot \left(\left(b \cdot \left(\left(\pi \cdot -0.005555555555555556\right) \cdot angle_m\right)\right) \cdot \left(b \cdot \left(\pi \cdot angle_m\right)\right)\right)
\end{array}
Initial program 79.4%
Simplified79.5%
Taylor expanded in angle around 0 80.0%
Taylor expanded in angle around 0 75.3%
unpow275.3%
*-commutative75.3%
associate-*r*75.3%
associate-*r*75.3%
*-commutative75.3%
associate-*r*75.3%
associate-*r*75.4%
*-commutative75.4%
associate-*r*75.3%
*-commutative75.3%
associate-*l*75.4%
*-commutative75.4%
Applied egg-rr75.4%
Final simplification75.4%
herbie shell --seed 2024019
(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)))