
(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 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 (+ (pow (* a (cos (pow (sqrt (* 0.005555555555555556 (* PI angle_m))) 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 * cos(pow(sqrt((0.005555555555555556 * (((double) M_PI) * angle_m))), 2.0))), 2.0) + 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 Math.pow((a * Math.cos(Math.pow(Math.sqrt((0.005555555555555556 * (Math.PI * angle_m))), 2.0))), 2.0) + 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 math.pow((a * math.cos(math.pow(math.sqrt((0.005555555555555556 * (math.pi * angle_m))), 2.0))), 2.0) + 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(a * cos((sqrt(Float64(0.005555555555555556 * Float64(pi * angle_m))) ^ 2.0))) ^ 2.0) + (Float64(b * sin(Float64(pi * Float64(0.005555555555555556 * angle_m)))) ^ 2.0)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = ((a * cos((sqrt((0.005555555555555556 * (pi * angle_m))) ^ 2.0))) ^ 2.0) + ((b * sin((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[Cos[N[Power[N[Sqrt[N[(0.005555555555555556 * N[(Pi * angle$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[N[(Pi * N[(0.005555555555555556 * angle$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{\left(a \cdot \cos \left({\left(\sqrt{0.005555555555555556 \cdot \left(\pi \cdot angle\_m\right)}\right)}^{2}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(0.005555555555555556 \cdot angle\_m\right)\right)\right)}^{2}
\end{array}
Initial program 82.9%
associate-*r/82.9%
metadata-eval82.9%
metadata-eval82.9%
distribute-neg-frac282.9%
distribute-frac-neg82.9%
distribute-rgt-neg-out82.9%
associate-/l*82.9%
neg-mul-182.9%
*-commutative82.9%
associate-/l*83.0%
metadata-eval83.0%
metadata-eval83.0%
Simplified83.0%
metadata-eval83.0%
div-inv83.0%
add-sqr-sqrt48.0%
pow248.0%
div-inv48.1%
metadata-eval48.1%
associate-*r*48.1%
*-commutative48.1%
Applied egg-rr48.1%
Final simplification48.1%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (pow (hypot (* a (cos (* (* PI angle_m) (cbrt 1.7146776406035666e-7)))) (* b (sin (* PI (* 0.005555555555555556 angle_m))))) 2.0))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow(hypot((a * cos(((((double) M_PI) * angle_m) * cbrt(1.7146776406035666e-7)))), (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 Math.pow(Math.hypot((a * Math.cos(((Math.PI * angle_m) * Math.cbrt(1.7146776406035666e-7)))), (b * Math.sin((Math.PI * (0.005555555555555556 * angle_m))))), 2.0);
}
angle_m = abs(angle) function code(a, b, angle_m) return hypot(Float64(a * cos(Float64(Float64(pi * angle_m) * cbrt(1.7146776406035666e-7)))), Float64(b * sin(Float64(pi * Float64(0.005555555555555556 * angle_m))))) ^ 2.0 end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[Power[N[Sqrt[N[(a * N[Cos[N[(N[(Pi * angle$95$m), $MachinePrecision] * N[Power[1.7146776406035666e-7, 1/3], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] ^ 2 + N[(b * N[Sin[N[(Pi * N[(0.005555555555555556 * angle$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision], 2.0], $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{\left(\mathsf{hypot}\left(a \cdot \cos \left(\left(\pi \cdot angle\_m\right) \cdot \sqrt[3]{1.7146776406035666 \cdot 10^{-7}}\right), b \cdot \sin \left(\pi \cdot \left(0.005555555555555556 \cdot angle\_m\right)\right)\right)\right)}^{2}
\end{array}
Initial program 82.9%
associate-*r/82.9%
metadata-eval82.9%
metadata-eval82.9%
distribute-neg-frac282.9%
distribute-frac-neg82.9%
distribute-rgt-neg-out82.9%
associate-/l*82.9%
neg-mul-182.9%
*-commutative82.9%
associate-/l*83.0%
metadata-eval83.0%
metadata-eval83.0%
Simplified83.0%
metadata-eval83.0%
div-inv83.0%
add-sqr-sqrt48.0%
pow248.0%
div-inv48.1%
metadata-eval48.1%
associate-*r*48.1%
*-commutative48.1%
Applied egg-rr48.1%
unpow248.1%
add-sqr-sqrt83.0%
rem-cbrt-cube64.8%
unpow-prod-down64.7%
cbrt-prod64.7%
metadata-eval64.7%
pow364.7%
add-cbrt-cube83.1%
Applied egg-rr83.1%
add-cube-cbrt83.1%
pow383.1%
associate-*r*83.1%
Applied egg-rr83.1%
add-sqr-sqrt83.1%
pow283.1%
Applied egg-rr83.1%
Final simplification83.1%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (pow (hypot (* b (sin (/ PI (/ 180.0 angle_m)))) (* a (cos (* PI (* 0.005555555555555556 angle_m))))) 2.0))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow(hypot((b * sin((((double) M_PI) / (180.0 / angle_m)))), (a * cos((((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 Math.pow(Math.hypot((b * Math.sin((Math.PI / (180.0 / angle_m)))), (a * Math.cos((Math.PI * (0.005555555555555556 * angle_m))))), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow(math.hypot((b * math.sin((math.pi / (180.0 / angle_m)))), (a * math.cos((math.pi * (0.005555555555555556 * angle_m))))), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) return hypot(Float64(b * sin(Float64(pi / Float64(180.0 / angle_m)))), Float64(a * cos(Float64(pi * Float64(0.005555555555555556 * angle_m))))) ^ 2.0 end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = hypot((b * sin((pi / (180.0 / angle_m)))), (a * cos((pi * (0.005555555555555556 * angle_m))))) ^ 2.0; end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[Power[N[Sqrt[N[(b * N[Sin[N[(Pi / N[(180.0 / angle$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] ^ 2 + N[(a * N[Cos[N[(Pi * N[(0.005555555555555556 * angle$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision], 2.0], $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{\left(\mathsf{hypot}\left(b \cdot \sin \left(\frac{\pi}{\frac{180}{angle\_m}}\right), a \cdot \cos \left(\pi \cdot \left(0.005555555555555556 \cdot angle\_m\right)\right)\right)\right)}^{2}
\end{array}
Initial program 82.9%
associate-*r/82.9%
metadata-eval82.9%
metadata-eval82.9%
distribute-neg-frac282.9%
distribute-frac-neg82.9%
distribute-rgt-neg-out82.9%
associate-/l*82.9%
neg-mul-182.9%
*-commutative82.9%
associate-/l*83.0%
metadata-eval83.0%
metadata-eval83.0%
Simplified83.0%
metadata-eval83.0%
div-inv83.0%
add-sqr-sqrt48.0%
pow248.0%
div-inv48.1%
metadata-eval48.1%
associate-*r*48.1%
*-commutative48.1%
Applied egg-rr48.1%
Applied egg-rr82.9%
div-inv83.0%
clear-num83.0%
*-commutative83.0%
div-inv83.0%
metadata-eval83.0%
Applied egg-rr83.0%
Final simplification83.0%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (let* ((t_0 (* PI (/ angle_m 180.0)))) (pow (hypot (* b (sin t_0)) (* a (cos t_0))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double t_0 = ((double) M_PI) * (angle_m / 180.0);
return pow(hypot((b * sin(t_0)), (a * cos(t_0))), 2.0);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double t_0 = Math.PI * (angle_m / 180.0);
return Math.pow(Math.hypot((b * Math.sin(t_0)), (a * Math.cos(t_0))), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): t_0 = math.pi * (angle_m / 180.0) return math.pow(math.hypot((b * math.sin(t_0)), (a * math.cos(t_0))), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) t_0 = Float64(pi * Float64(angle_m / 180.0)) return hypot(Float64(b * sin(t_0)), Float64(a * cos(t_0))) ^ 2.0 end
angle_m = abs(angle); function tmp = code(a, b, angle_m) t_0 = pi * (angle_m / 180.0); tmp = hypot((b * sin(t_0)), (a * cos(t_0))) ^ 2.0; 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]}, N[Power[N[Sqrt[N[(b * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision] ^ 2 + N[(a * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision], 2.0], $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
t_0 := \pi \cdot \frac{angle\_m}{180}\\
{\left(\mathsf{hypot}\left(b \cdot \sin t\_0, a \cdot \cos t\_0\right)\right)}^{2}
\end{array}
\end{array}
Initial program 82.9%
associate-*r/82.9%
metadata-eval82.9%
metadata-eval82.9%
distribute-neg-frac282.9%
distribute-frac-neg82.9%
distribute-rgt-neg-out82.9%
associate-/l*82.9%
neg-mul-182.9%
*-commutative82.9%
associate-/l*83.0%
metadata-eval83.0%
metadata-eval83.0%
Simplified83.0%
metadata-eval83.0%
div-inv83.0%
add-sqr-sqrt48.0%
pow248.0%
div-inv48.1%
metadata-eval48.1%
associate-*r*48.1%
*-commutative48.1%
Applied egg-rr48.1%
Applied egg-rr82.9%
*-rgt-identity82.9%
associate-/r/82.9%
associate-*l/82.9%
associate-/l*82.9%
associate-/r/82.9%
associate-*l/82.9%
associate-/l*82.9%
Simplified82.9%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (if (<= a 5.6e-134) (pow (* b (sin (* angle_m (* 0.005555555555555556 PI)))) 2.0) (pow (* a (cos (* angle_m (* PI (cbrt 1.7146776406035666e-7))))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if (a <= 5.6e-134) {
tmp = pow((b * sin((angle_m * (0.005555555555555556 * ((double) M_PI))))), 2.0);
} else {
tmp = pow((a * cos((angle_m * (((double) M_PI) * cbrt(1.7146776406035666e-7))))), 2.0);
}
return tmp;
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double tmp;
if (a <= 5.6e-134) {
tmp = Math.pow((b * Math.sin((angle_m * (0.005555555555555556 * Math.PI)))), 2.0);
} else {
tmp = Math.pow((a * Math.cos((angle_m * (Math.PI * Math.cbrt(1.7146776406035666e-7))))), 2.0);
}
return tmp;
}
angle_m = abs(angle) function code(a, b, angle_m) tmp = 0.0 if (a <= 5.6e-134) tmp = Float64(b * sin(Float64(angle_m * Float64(0.005555555555555556 * pi)))) ^ 2.0; else tmp = Float64(a * cos(Float64(angle_m * Float64(pi * cbrt(1.7146776406035666e-7))))) ^ 2.0; end return tmp end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := If[LessEqual[a, 5.6e-134], N[Power[N[(b * N[Sin[N[(angle$95$m * N[(0.005555555555555556 * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[Power[N[(a * N[Cos[N[(angle$95$m * N[(Pi * N[Power[1.7146776406035666e-7, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
\mathbf{if}\;a \leq 5.6 \cdot 10^{-134}:\\
\;\;\;\;{\left(b \cdot \sin \left(angle\_m \cdot \left(0.005555555555555556 \cdot \pi\right)\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;{\left(a \cdot \cos \left(angle\_m \cdot \left(\pi \cdot \sqrt[3]{1.7146776406035666 \cdot 10^{-7}}\right)\right)\right)}^{2}\\
\end{array}
\end{array}
if a < 5.5999999999999997e-134Initial program 79.8%
associate-*r/79.7%
metadata-eval79.7%
metadata-eval79.7%
distribute-neg-frac279.7%
distribute-frac-neg79.7%
distribute-rgt-neg-out79.7%
associate-/l*79.8%
neg-mul-179.8%
*-commutative79.8%
associate-/l*79.8%
metadata-eval79.8%
metadata-eval79.8%
Simplified79.8%
Taylor expanded in a around 0 43.2%
unpow243.2%
*-commutative43.2%
unpow243.2%
swap-sqr48.7%
unpow248.7%
*-commutative48.7%
*-commutative48.7%
associate-*r*48.8%
Simplified48.8%
if 5.5999999999999997e-134 < a Initial program 88.1%
associate-*r/88.2%
metadata-eval88.2%
metadata-eval88.2%
distribute-neg-frac288.2%
distribute-frac-neg88.2%
distribute-rgt-neg-out88.2%
associate-/l*88.1%
neg-mul-188.1%
*-commutative88.1%
associate-/l*88.1%
metadata-eval88.1%
metadata-eval88.1%
Simplified88.2%
metadata-eval88.2%
div-inv88.2%
add-sqr-sqrt50.9%
pow250.9%
div-inv50.9%
metadata-eval50.9%
associate-*r*50.9%
*-commutative50.9%
Applied egg-rr50.9%
unpow250.9%
add-sqr-sqrt88.2%
rem-cbrt-cube74.8%
unpow-prod-down74.8%
cbrt-prod74.8%
metadata-eval74.8%
pow374.8%
add-cbrt-cube88.3%
Applied egg-rr88.3%
Taylor expanded in a around inf 72.0%
unpow272.0%
*-commutative72.0%
*-commutative72.0%
unpow272.0%
swap-sqr72.0%
unpow272.0%
*-commutative72.0%
*-commutative72.0%
Simplified72.0%
Final simplification57.6%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow (* b (sin (* PI (* 0.005555555555555556 angle_m)))) 2.0) (pow a 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow((b * sin((((double) M_PI) * (0.005555555555555556 * angle_m)))), 2.0) + pow(a, 2.0);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return Math.pow((b * Math.sin((Math.PI * (0.005555555555555556 * angle_m)))), 2.0) + Math.pow(a, 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow((b * math.sin((math.pi * (0.005555555555555556 * angle_m)))), 2.0) + math.pow(a, 2.0)
angle_m = abs(angle) function code(a, b, angle_m) return Float64((Float64(b * sin(Float64(pi * Float64(0.005555555555555556 * angle_m)))) ^ 2.0) + (a ^ 2.0)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = ((b * sin((pi * (0.005555555555555556 * angle_m)))) ^ 2.0) + (a ^ 2.0); end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(N[Power[N[(b * N[Sin[N[(Pi * N[(0.005555555555555556 * angle$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{\left(b \cdot \sin \left(\pi \cdot \left(0.005555555555555556 \cdot angle\_m\right)\right)\right)}^{2} + {a}^{2}
\end{array}
Initial program 82.9%
associate-*r/82.9%
metadata-eval82.9%
metadata-eval82.9%
distribute-neg-frac282.9%
distribute-frac-neg82.9%
distribute-rgt-neg-out82.9%
associate-/l*82.9%
neg-mul-182.9%
*-commutative82.9%
associate-/l*83.0%
metadata-eval83.0%
metadata-eval83.0%
Simplified83.0%
Taylor expanded in angle around 0 82.4%
Final simplification82.4%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (let* ((t_0 (* angle_m (* 0.005555555555555556 PI)))) (if (<= a 4.5e-135) (pow (* b (sin t_0)) 2.0) (pow (* a (cos t_0)) 2.0))))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double t_0 = angle_m * (0.005555555555555556 * ((double) M_PI));
double tmp;
if (a <= 4.5e-135) {
tmp = pow((b * sin(t_0)), 2.0);
} else {
tmp = pow((a * cos(t_0)), 2.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 * Math.PI);
double tmp;
if (a <= 4.5e-135) {
tmp = Math.pow((b * Math.sin(t_0)), 2.0);
} else {
tmp = Math.pow((a * Math.cos(t_0)), 2.0);
}
return tmp;
}
angle_m = math.fabs(angle) def code(a, b, angle_m): t_0 = angle_m * (0.005555555555555556 * math.pi) tmp = 0 if a <= 4.5e-135: tmp = math.pow((b * math.sin(t_0)), 2.0) else: tmp = math.pow((a * math.cos(t_0)), 2.0) return tmp
angle_m = abs(angle) function code(a, b, angle_m) t_0 = Float64(angle_m * Float64(0.005555555555555556 * pi)) tmp = 0.0 if (a <= 4.5e-135) tmp = Float64(b * sin(t_0)) ^ 2.0; else tmp = Float64(a * cos(t_0)) ^ 2.0; end return tmp end
angle_m = abs(angle); function tmp_2 = code(a, b, angle_m) t_0 = angle_m * (0.005555555555555556 * pi); tmp = 0.0; if (a <= 4.5e-135) tmp = (b * sin(t_0)) ^ 2.0; else tmp = (a * cos(t_0)) ^ 2.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 * Pi), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, 4.5e-135], N[Power[N[(b * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[Power[N[(a * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
t_0 := angle\_m \cdot \left(0.005555555555555556 \cdot \pi\right)\\
\mathbf{if}\;a \leq 4.5 \cdot 10^{-135}:\\
\;\;\;\;{\left(b \cdot \sin t\_0\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;{\left(a \cdot \cos t\_0\right)}^{2}\\
\end{array}
\end{array}
if a < 4.49999999999999987e-135Initial program 79.8%
associate-*r/79.7%
metadata-eval79.7%
metadata-eval79.7%
distribute-neg-frac279.7%
distribute-frac-neg79.7%
distribute-rgt-neg-out79.7%
associate-/l*79.8%
neg-mul-179.8%
*-commutative79.8%
associate-/l*79.8%
metadata-eval79.8%
metadata-eval79.8%
Simplified79.8%
Taylor expanded in a around 0 43.2%
unpow243.2%
*-commutative43.2%
unpow243.2%
swap-sqr48.7%
unpow248.7%
*-commutative48.7%
*-commutative48.7%
associate-*r*48.8%
Simplified48.8%
if 4.49999999999999987e-135 < a Initial program 88.1%
associate-*r/88.2%
metadata-eval88.2%
metadata-eval88.2%
distribute-neg-frac288.2%
distribute-frac-neg88.2%
distribute-rgt-neg-out88.2%
associate-/l*88.1%
neg-mul-188.1%
*-commutative88.1%
associate-/l*88.1%
metadata-eval88.1%
metadata-eval88.1%
Simplified88.2%
Taylor expanded in a around inf 71.9%
*-commutative71.9%
unpow271.9%
unpow271.9%
swap-sqr71.9%
unpow271.9%
*-commutative71.9%
*-commutative71.9%
associate-*r*71.9%
Simplified71.9%
Final simplification57.5%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (if (<= a 4.5e-135) (pow (* b (sin (* 0.005555555555555556 (* PI angle_m)))) 2.0) (pow (* a (cos (* angle_m (* 0.005555555555555556 PI)))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if (a <= 4.5e-135) {
tmp = pow((b * sin((0.005555555555555556 * (((double) M_PI) * angle_m)))), 2.0);
} else {
tmp = pow((a * cos((angle_m * (0.005555555555555556 * ((double) M_PI))))), 2.0);
}
return tmp;
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double tmp;
if (a <= 4.5e-135) {
tmp = Math.pow((b * Math.sin((0.005555555555555556 * (Math.PI * angle_m)))), 2.0);
} else {
tmp = Math.pow((a * Math.cos((angle_m * (0.005555555555555556 * Math.PI)))), 2.0);
}
return tmp;
}
angle_m = math.fabs(angle) def code(a, b, angle_m): tmp = 0 if a <= 4.5e-135: tmp = math.pow((b * math.sin((0.005555555555555556 * (math.pi * angle_m)))), 2.0) else: tmp = math.pow((a * math.cos((angle_m * (0.005555555555555556 * math.pi)))), 2.0) return tmp
angle_m = abs(angle) function code(a, b, angle_m) tmp = 0.0 if (a <= 4.5e-135) tmp = Float64(b * sin(Float64(0.005555555555555556 * Float64(pi * angle_m)))) ^ 2.0; else tmp = Float64(a * cos(Float64(angle_m * Float64(0.005555555555555556 * pi)))) ^ 2.0; end return tmp end
angle_m = abs(angle); function tmp_2 = code(a, b, angle_m) tmp = 0.0; if (a <= 4.5e-135) tmp = (b * sin((0.005555555555555556 * (pi * angle_m)))) ^ 2.0; else tmp = (a * cos((angle_m * (0.005555555555555556 * pi)))) ^ 2.0; end tmp_2 = tmp; end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := If[LessEqual[a, 4.5e-135], N[Power[N[(b * N[Sin[N[(0.005555555555555556 * N[(Pi * angle$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[Power[N[(a * N[Cos[N[(angle$95$m * N[(0.005555555555555556 * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
\mathbf{if}\;a \leq 4.5 \cdot 10^{-135}:\\
\;\;\;\;{\left(b \cdot \sin \left(0.005555555555555556 \cdot \left(\pi \cdot angle\_m\right)\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;{\left(a \cdot \cos \left(angle\_m \cdot \left(0.005555555555555556 \cdot \pi\right)\right)\right)}^{2}\\
\end{array}
\end{array}
if a < 4.49999999999999987e-135Initial program 79.8%
associate-*r/79.7%
metadata-eval79.7%
metadata-eval79.7%
distribute-neg-frac279.7%
distribute-frac-neg79.7%
distribute-rgt-neg-out79.7%
associate-/l*79.8%
neg-mul-179.8%
*-commutative79.8%
associate-/l*79.8%
metadata-eval79.8%
metadata-eval79.8%
Simplified79.8%
Taylor expanded in a around 0 43.2%
unpow243.2%
*-commutative43.2%
unpow243.2%
swap-sqr48.7%
unpow248.7%
*-commutative48.7%
Simplified48.7%
if 4.49999999999999987e-135 < a Initial program 88.1%
associate-*r/88.2%
metadata-eval88.2%
metadata-eval88.2%
distribute-neg-frac288.2%
distribute-frac-neg88.2%
distribute-rgt-neg-out88.2%
associate-/l*88.1%
neg-mul-188.1%
*-commutative88.1%
associate-/l*88.1%
metadata-eval88.1%
metadata-eval88.1%
Simplified88.2%
Taylor expanded in a around inf 71.9%
*-commutative71.9%
unpow271.9%
unpow271.9%
swap-sqr71.9%
unpow271.9%
*-commutative71.9%
*-commutative71.9%
associate-*r*71.9%
Simplified71.9%
Final simplification57.5%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (if (<= b 1e+171) (pow (* a (cos (* 0.005555555555555556 (* PI angle_m)))) 2.0) (cbrt (pow a 6.0))))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if (b <= 1e+171) {
tmp = pow((a * cos((0.005555555555555556 * (((double) M_PI) * angle_m)))), 2.0);
} else {
tmp = cbrt(pow(a, 6.0));
}
return tmp;
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double tmp;
if (b <= 1e+171) {
tmp = Math.pow((a * Math.cos((0.005555555555555556 * (Math.PI * angle_m)))), 2.0);
} else {
tmp = Math.cbrt(Math.pow(a, 6.0));
}
return tmp;
}
angle_m = abs(angle) function code(a, b, angle_m) tmp = 0.0 if (b <= 1e+171) tmp = Float64(a * cos(Float64(0.005555555555555556 * Float64(pi * angle_m)))) ^ 2.0; else tmp = cbrt((a ^ 6.0)); end return tmp end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := If[LessEqual[b, 1e+171], N[Power[N[(a * N[Cos[N[(0.005555555555555556 * N[(Pi * angle$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[Power[N[Power[a, 6.0], $MachinePrecision], 1/3], $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
\mathbf{if}\;b \leq 10^{+171}:\\
\;\;\;\;{\left(a \cdot \cos \left(0.005555555555555556 \cdot \left(\pi \cdot angle\_m\right)\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{{a}^{6}}\\
\end{array}
\end{array}
if b < 9.99999999999999954e170Initial program 81.1%
associate-*r/81.1%
metadata-eval81.1%
metadata-eval81.1%
distribute-neg-frac281.1%
distribute-frac-neg81.1%
distribute-rgt-neg-out81.1%
associate-/l*81.1%
neg-mul-181.1%
*-commutative81.1%
associate-/l*81.2%
metadata-eval81.2%
metadata-eval81.2%
Simplified81.2%
Taylor expanded in a around inf 61.0%
*-commutative61.0%
unpow261.0%
unpow261.0%
swap-sqr60.9%
unpow260.9%
*-commutative60.9%
Simplified60.9%
if 9.99999999999999954e170 < b Initial program 99.8%
associate-*r/99.8%
metadata-eval99.8%
metadata-eval99.8%
distribute-neg-frac299.8%
distribute-frac-neg99.8%
distribute-rgt-neg-out99.8%
associate-/l*99.8%
neg-mul-199.8%
*-commutative99.8%
associate-/l*99.8%
metadata-eval99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in angle around 0 45.9%
add-sqr-sqrt45.9%
sqrt-unprod49.5%
pow-prod-up49.5%
metadata-eval49.5%
Applied egg-rr49.5%
add-cbrt-cube53.2%
pow1/352.7%
add-sqr-sqrt52.7%
sqrt-pow152.7%
metadata-eval52.7%
pow-prod-up52.7%
metadata-eval52.7%
Applied egg-rr52.7%
unpow1/353.2%
Simplified53.2%
Final simplification60.2%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (if (<= b 8.8e+169) (* a a) (cbrt (pow a 6.0))))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if (b <= 8.8e+169) {
tmp = a * a;
} else {
tmp = cbrt(pow(a, 6.0));
}
return tmp;
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double tmp;
if (b <= 8.8e+169) {
tmp = a * a;
} else {
tmp = Math.cbrt(Math.pow(a, 6.0));
}
return tmp;
}
angle_m = abs(angle) function code(a, b, angle_m) tmp = 0.0 if (b <= 8.8e+169) tmp = Float64(a * a); else tmp = cbrt((a ^ 6.0)); end return tmp end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := If[LessEqual[b, 8.8e+169], N[(a * a), $MachinePrecision], N[Power[N[Power[a, 6.0], $MachinePrecision], 1/3], $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
\mathbf{if}\;b \leq 8.8 \cdot 10^{+169}:\\
\;\;\;\;a \cdot a\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{{a}^{6}}\\
\end{array}
\end{array}
if b < 8.8000000000000001e169Initial program 81.1%
associate-*r/81.1%
metadata-eval81.1%
metadata-eval81.1%
distribute-neg-frac281.1%
distribute-frac-neg81.1%
distribute-rgt-neg-out81.1%
associate-/l*81.1%
neg-mul-181.1%
*-commutative81.1%
associate-/l*81.2%
metadata-eval81.2%
metadata-eval81.2%
Simplified81.2%
Taylor expanded in angle around 0 60.7%
unpow260.7%
Applied egg-rr60.7%
if 8.8000000000000001e169 < b Initial program 99.8%
associate-*r/99.8%
metadata-eval99.8%
metadata-eval99.8%
distribute-neg-frac299.8%
distribute-frac-neg99.8%
distribute-rgt-neg-out99.8%
associate-/l*99.8%
neg-mul-199.8%
*-commutative99.8%
associate-/l*99.8%
metadata-eval99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in angle around 0 45.9%
add-sqr-sqrt45.9%
sqrt-unprod49.5%
pow-prod-up49.5%
metadata-eval49.5%
Applied egg-rr49.5%
add-cbrt-cube53.2%
pow1/352.7%
add-sqr-sqrt52.7%
sqrt-pow152.7%
metadata-eval52.7%
pow-prod-up52.7%
metadata-eval52.7%
Applied egg-rr52.7%
unpow1/353.2%
Simplified53.2%
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 = abs(angle)
real(8) function code(a, b, angle_m)
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 82.9%
associate-*r/82.9%
metadata-eval82.9%
metadata-eval82.9%
distribute-neg-frac282.9%
distribute-frac-neg82.9%
distribute-rgt-neg-out82.9%
associate-/l*82.9%
neg-mul-182.9%
*-commutative82.9%
associate-/l*83.0%
metadata-eval83.0%
metadata-eval83.0%
Simplified83.0%
Taylor expanded in angle around 0 59.3%
unpow259.3%
Applied egg-rr59.3%
herbie shell --seed 2024180
(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)))