
(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 10 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
(let* ((t_0
(pow
(pow (* angle_m (* 0.005555555555555556 PI)) 0.16666666666666666)
3.0)))
(+
(pow
(* a (sin (expm1 (log1p (* (* 0.005555555555555556 angle_m) PI)))))
2.0)
(pow (* b (cos (* t_0 t_0))) 2.0))))angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double t_0 = pow(pow((angle_m * (0.005555555555555556 * ((double) M_PI))), 0.16666666666666666), 3.0);
return pow((a * sin(expm1(log1p(((0.005555555555555556 * angle_m) * ((double) M_PI)))))), 2.0) + pow((b * cos((t_0 * t_0))), 2.0);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double t_0 = Math.pow(Math.pow((angle_m * (0.005555555555555556 * Math.PI)), 0.16666666666666666), 3.0);
return Math.pow((a * Math.sin(Math.expm1(Math.log1p(((0.005555555555555556 * angle_m) * Math.PI))))), 2.0) + Math.pow((b * Math.cos((t_0 * t_0))), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): t_0 = math.pow(math.pow((angle_m * (0.005555555555555556 * math.pi)), 0.16666666666666666), 3.0) return math.pow((a * math.sin(math.expm1(math.log1p(((0.005555555555555556 * angle_m) * math.pi))))), 2.0) + math.pow((b * math.cos((t_0 * t_0))), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) t_0 = (Float64(angle_m * Float64(0.005555555555555556 * pi)) ^ 0.16666666666666666) ^ 3.0 return Float64((Float64(a * sin(expm1(log1p(Float64(Float64(0.005555555555555556 * angle_m) * pi))))) ^ 2.0) + (Float64(b * cos(Float64(t_0 * t_0))) ^ 2.0)) end
angle_m = N[Abs[angle], $MachinePrecision]
code[a_, b_, angle$95$m_] := Block[{t$95$0 = N[Power[N[Power[N[(angle$95$m * N[(0.005555555555555556 * Pi), $MachinePrecision]), $MachinePrecision], 0.16666666666666666], $MachinePrecision], 3.0], $MachinePrecision]}, N[(N[Power[N[(a * N[Sin[N[(Exp[N[Log[1 + N[(N[(0.005555555555555556 * angle$95$m), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[N[(t$95$0 * t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
t_0 := {\left({\left(angle\_m \cdot \left(0.005555555555555556 \cdot \pi\right)\right)}^{0.16666666666666666}\right)}^{3}\\
{\left(a \cdot \sin \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\left(0.005555555555555556 \cdot angle\_m\right) \cdot \pi\right)\right)\right)\right)}^{2} + {\left(b \cdot \cos \left(t\_0 \cdot t\_0\right)\right)}^{2}
\end{array}
\end{array}
Initial program 80.9%
expm1-log1p-u67.7%
expm1-undefine56.2%
associate-*l/56.2%
associate-*r/56.2%
div-inv56.2%
metadata-eval56.2%
Applied egg-rr56.2%
expm1-define67.7%
associate-*r*67.7%
*-commutative67.7%
associate-*r*67.7%
Simplified67.7%
expm1-log1p-u67.7%
expm1-undefine56.2%
associate-*l/56.2%
associate-*r/56.2%
div-inv56.2%
metadata-eval56.2%
Applied egg-rr67.8%
expm1-define67.7%
associate-*r*67.7%
*-commutative67.7%
associate-*r*67.7%
Simplified67.8%
expm1-log1p-u67.7%
*-commutative67.7%
associate-*r*67.7%
*-commutative67.7%
rem-cube-cbrt67.8%
add-sqr-sqrt42.5%
unpow-prod-down42.4%
pow1/342.5%
sqrt-pow142.4%
*-commutative42.4%
metadata-eval42.4%
pow1/342.5%
sqrt-pow142.5%
*-commutative42.5%
metadata-eval42.5%
Applied egg-rr42.5%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (let* ((t_0 (expm1 (log1p (* (* 0.005555555555555556 angle_m) PI))))) (+ (pow (* a (sin t_0)) 2.0) (pow (* b (cos t_0)) 2.0))))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double t_0 = expm1(log1p(((0.005555555555555556 * angle_m) * ((double) M_PI))));
return pow((a * sin(t_0)), 2.0) + pow((b * 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.expm1(Math.log1p(((0.005555555555555556 * angle_m) * Math.PI)));
return Math.pow((a * Math.sin(t_0)), 2.0) + Math.pow((b * Math.cos(t_0)), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): t_0 = math.expm1(math.log1p(((0.005555555555555556 * angle_m) * math.pi))) return math.pow((a * math.sin(t_0)), 2.0) + math.pow((b * math.cos(t_0)), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) t_0 = expm1(log1p(Float64(Float64(0.005555555555555556 * angle_m) * pi))) return Float64((Float64(a * sin(t_0)) ^ 2.0) + (Float64(b * cos(t_0)) ^ 2.0)) end
angle_m = N[Abs[angle], $MachinePrecision]
code[a_, b_, angle$95$m_] := Block[{t$95$0 = N[(Exp[N[Log[1 + N[(N[(0.005555555555555556 * angle$95$m), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]] - 1), $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}
angle_m = \left|angle\right|
\\
\begin{array}{l}
t_0 := \mathsf{expm1}\left(\mathsf{log1p}\left(\left(0.005555555555555556 \cdot angle\_m\right) \cdot \pi\right)\right)\\
{\left(a \cdot \sin t\_0\right)}^{2} + {\left(b \cdot \cos t\_0\right)}^{2}
\end{array}
\end{array}
Initial program 80.9%
expm1-log1p-u67.7%
expm1-undefine56.2%
associate-*l/56.2%
associate-*r/56.2%
div-inv56.2%
metadata-eval56.2%
Applied egg-rr56.2%
expm1-define67.7%
associate-*r*67.7%
*-commutative67.7%
associate-*r*67.7%
Simplified67.7%
expm1-log1p-u67.7%
expm1-undefine56.2%
associate-*l/56.2%
associate-*r/56.2%
div-inv56.2%
metadata-eval56.2%
Applied egg-rr67.8%
expm1-define67.7%
associate-*r*67.7%
*-commutative67.7%
associate-*r*67.7%
Simplified67.8%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow (* a (sin (expm1 (log1p (* (* 0.005555555555555556 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(expm1(log1p(((0.005555555555555556 * 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(Math.expm1(Math.log1p(((0.005555555555555556 * 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(math.expm1(math.log1p(((0.005555555555555556 * 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(expm1(log1p(Float64(Float64(0.005555555555555556 * 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[(Exp[N[Log[1 + N[(N[(0.005555555555555556 * angle$95$m), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]] - 1), $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(\mathsf{expm1}\left(\mathsf{log1p}\left(\left(0.005555555555555556 \cdot angle\_m\right) \cdot \pi\right)\right)\right)\right)}^{2} + {b}^{2}
\end{array}
Initial program 80.9%
expm1-log1p-u67.7%
expm1-undefine56.2%
associate-*l/56.2%
associate-*r/56.2%
div-inv56.2%
metadata-eval56.2%
Applied egg-rr56.2%
expm1-define67.7%
associate-*r*67.7%
*-commutative67.7%
associate-*r*67.7%
Simplified67.7%
expm1-log1p-u67.7%
expm1-undefine56.2%
associate-*l/56.2%
associate-*r/56.2%
div-inv56.2%
metadata-eval56.2%
Applied egg-rr67.8%
expm1-define67.7%
associate-*r*67.7%
*-commutative67.7%
associate-*r*67.7%
Simplified67.8%
expm1-log1p-u67.7%
*-commutative67.7%
associate-*r*67.7%
*-commutative67.7%
rem-cube-cbrt67.8%
add-sqr-sqrt42.5%
unpow-prod-down42.4%
pow1/342.5%
sqrt-pow142.4%
*-commutative42.4%
metadata-eval42.4%
pow1/342.5%
sqrt-pow142.5%
*-commutative42.5%
metadata-eval42.5%
Applied egg-rr42.5%
Taylor expanded in angle around 0 67.8%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow (* a (sin (* PI (/ angle_m 180.0)))) 2.0) (pow b 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow((a * sin((((double) M_PI) * (angle_m / 180.0)))), 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((Math.PI * (angle_m / 180.0)))), 2.0) + Math.pow(b, 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow((a * math.sin((math.pi * (angle_m / 180.0)))), 2.0) + math.pow(b, 2.0)
angle_m = abs(angle) function code(a, b, angle_m) return Float64((Float64(a * sin(Float64(pi * Float64(angle_m / 180.0)))) ^ 2.0) + (b ^ 2.0)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = ((a * sin((pi * (angle_m / 180.0)))) ^ 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[(Pi * N[(angle$95$m / 180.0), $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(\pi \cdot \frac{angle\_m}{180}\right)\right)}^{2} + {b}^{2}
\end{array}
Initial program 80.9%
add-cube-cbrt81.0%
pow381.0%
associate-*l/81.0%
associate-*r/81.0%
div-inv81.0%
metadata-eval81.0%
Applied egg-rr81.0%
Taylor expanded in angle around 0 81.0%
Final simplification81.0%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow b 2.0) (pow (* a (sin (* angle_m (/ PI 180.0)))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow(b, 2.0) + pow((a * 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(b, 2.0) + Math.pow((a * Math.sin((angle_m * (Math.PI / 180.0)))), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow(b, 2.0) + math.pow((a * math.sin((angle_m * (math.pi / 180.0)))), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) return Float64((b ^ 2.0) + (Float64(a * sin(Float64(angle_m * Float64(pi / 180.0)))) ^ 2.0)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = (b ^ 2.0) + ((a * sin((angle_m * (pi / 180.0)))) ^ 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[(angle$95$m * N[(Pi / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{b}^{2} + {\left(a \cdot \sin \left(angle\_m \cdot \frac{\pi}{180}\right)\right)}^{2}
\end{array}
Initial program 80.9%
unpow280.9%
associate-*l/80.9%
associate-/l*80.9%
unpow280.9%
Simplified80.9%
Taylor expanded in angle around 0 81.0%
Final simplification81.0%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (if (<= b 4e-29) (pow (* a (sin (* (* 0.005555555555555556 angle_m) PI))) 2.0) (* b b)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if (b <= 4e-29) {
tmp = pow((a * sin(((0.005555555555555556 * angle_m) * ((double) M_PI)))), 2.0);
} else {
tmp = b * b;
}
return tmp;
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double tmp;
if (b <= 4e-29) {
tmp = Math.pow((a * Math.sin(((0.005555555555555556 * angle_m) * Math.PI))), 2.0);
} else {
tmp = b * b;
}
return tmp;
}
angle_m = math.fabs(angle) def code(a, b, angle_m): tmp = 0 if b <= 4e-29: tmp = math.pow((a * math.sin(((0.005555555555555556 * angle_m) * math.pi))), 2.0) else: tmp = b * b return tmp
angle_m = abs(angle) function code(a, b, angle_m) tmp = 0.0 if (b <= 4e-29) tmp = Float64(a * sin(Float64(Float64(0.005555555555555556 * angle_m) * pi))) ^ 2.0; else tmp = Float64(b * b); end return tmp end
angle_m = abs(angle); function tmp_2 = code(a, b, angle_m) tmp = 0.0; if (b <= 4e-29) tmp = (a * sin(((0.005555555555555556 * angle_m) * pi))) ^ 2.0; else tmp = b * b; end tmp_2 = tmp; end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := If[LessEqual[b, 4e-29], N[Power[N[(a * N[Sin[N[(N[(0.005555555555555556 * angle$95$m), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[(b * b), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
\mathbf{if}\;b \leq 4 \cdot 10^{-29}:\\
\;\;\;\;{\left(a \cdot \sin \left(\left(0.005555555555555556 \cdot angle\_m\right) \cdot \pi\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;b \cdot b\\
\end{array}
\end{array}
if b < 3.99999999999999977e-29Initial program 79.4%
unpow279.4%
associate-*l/79.4%
associate-/l*79.4%
unpow279.4%
Simplified79.4%
Taylor expanded in a around inf 44.9%
unpow244.9%
*-commutative44.9%
associate-*r*45.0%
unpow245.0%
swap-sqr49.6%
unpow249.6%
associate-*r*49.5%
*-commutative49.5%
associate-*r*49.6%
Simplified49.6%
if 3.99999999999999977e-29 < b Initial program 85.7%
unpow285.7%
associate-*l/85.6%
associate-/l*85.6%
unpow285.6%
Simplified85.6%
Taylor expanded in angle around 0 70.1%
unpow270.1%
Applied egg-rr70.1%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (if (<= b 7.8e-29) (pow (* a (sin (* angle_m (* 0.005555555555555556 PI)))) 2.0) (* b b)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if (b <= 7.8e-29) {
tmp = pow((a * sin((angle_m * (0.005555555555555556 * ((double) M_PI))))), 2.0);
} else {
tmp = b * b;
}
return tmp;
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double tmp;
if (b <= 7.8e-29) {
tmp = Math.pow((a * Math.sin((angle_m * (0.005555555555555556 * Math.PI)))), 2.0);
} else {
tmp = b * b;
}
return tmp;
}
angle_m = math.fabs(angle) def code(a, b, angle_m): tmp = 0 if b <= 7.8e-29: tmp = math.pow((a * math.sin((angle_m * (0.005555555555555556 * math.pi)))), 2.0) else: tmp = b * b return tmp
angle_m = abs(angle) function code(a, b, angle_m) tmp = 0.0 if (b <= 7.8e-29) tmp = Float64(a * sin(Float64(angle_m * Float64(0.005555555555555556 * pi)))) ^ 2.0; else tmp = Float64(b * b); end return tmp end
angle_m = abs(angle); function tmp_2 = code(a, b, angle_m) tmp = 0.0; if (b <= 7.8e-29) tmp = (a * sin((angle_m * (0.005555555555555556 * pi)))) ^ 2.0; else tmp = b * b; end tmp_2 = tmp; end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := If[LessEqual[b, 7.8e-29], N[Power[N[(a * N[Sin[N[(angle$95$m * N[(0.005555555555555556 * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[(b * b), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
\mathbf{if}\;b \leq 7.8 \cdot 10^{-29}:\\
\;\;\;\;{\left(a \cdot \sin \left(angle\_m \cdot \left(0.005555555555555556 \cdot \pi\right)\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;b \cdot b\\
\end{array}
\end{array}
if b < 7.7999999999999995e-29Initial program 79.4%
expm1-log1p-u67.7%
expm1-undefine53.3%
associate-*l/53.3%
associate-*r/53.3%
div-inv53.3%
metadata-eval53.3%
Applied egg-rr53.3%
expm1-define67.8%
associate-*r*67.7%
*-commutative67.7%
associate-*r*67.8%
Simplified67.8%
expm1-log1p-u67.7%
expm1-undefine53.3%
associate-*l/53.3%
associate-*r/53.3%
div-inv53.3%
metadata-eval53.3%
Applied egg-rr67.8%
expm1-define67.8%
associate-*r*67.7%
*-commutative67.7%
associate-*r*67.8%
Simplified67.8%
expm1-log1p-u67.7%
*-commutative67.7%
associate-*r*67.7%
*-commutative67.7%
rem-cube-cbrt67.8%
add-sqr-sqrt41.5%
unpow-prod-down41.5%
pow1/341.5%
sqrt-pow141.5%
*-commutative41.5%
metadata-eval41.5%
pow1/341.6%
sqrt-pow141.6%
*-commutative41.6%
metadata-eval41.6%
Applied egg-rr41.6%
Taylor expanded in a around inf 44.9%
unpow244.9%
unpow244.9%
swap-sqr49.5%
unpow249.5%
associate-*r*49.6%
*-commutative49.6%
associate-*r*49.6%
*-commutative49.6%
Simplified49.6%
if 7.7999999999999995e-29 < b Initial program 85.7%
unpow285.7%
associate-*l/85.6%
associate-/l*85.6%
unpow285.6%
Simplified85.6%
Taylor expanded in angle around 0 70.1%
unpow270.1%
Applied egg-rr70.1%
Final simplification54.6%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (if (<= b 7.5e-29) (pow (* a (sin (* 0.005555555555555556 (* angle_m PI)))) 2.0) (* b b)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if (b <= 7.5e-29) {
tmp = pow((a * sin((0.005555555555555556 * (angle_m * ((double) M_PI))))), 2.0);
} else {
tmp = b * b;
}
return tmp;
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double tmp;
if (b <= 7.5e-29) {
tmp = Math.pow((a * Math.sin((0.005555555555555556 * (angle_m * Math.PI)))), 2.0);
} else {
tmp = b * b;
}
return tmp;
}
angle_m = math.fabs(angle) def code(a, b, angle_m): tmp = 0 if b <= 7.5e-29: tmp = math.pow((a * math.sin((0.005555555555555556 * (angle_m * math.pi)))), 2.0) else: tmp = b * b return tmp
angle_m = abs(angle) function code(a, b, angle_m) tmp = 0.0 if (b <= 7.5e-29) tmp = Float64(a * sin(Float64(0.005555555555555556 * Float64(angle_m * pi)))) ^ 2.0; else tmp = Float64(b * b); end return tmp end
angle_m = abs(angle); function tmp_2 = code(a, b, angle_m) tmp = 0.0; if (b <= 7.5e-29) tmp = (a * sin((0.005555555555555556 * (angle_m * pi)))) ^ 2.0; else tmp = b * b; end tmp_2 = tmp; end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := If[LessEqual[b, 7.5e-29], N[Power[N[(a * N[Sin[N[(0.005555555555555556 * N[(angle$95$m * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[(b * b), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
\mathbf{if}\;b \leq 7.5 \cdot 10^{-29}:\\
\;\;\;\;{\left(a \cdot \sin \left(0.005555555555555556 \cdot \left(angle\_m \cdot \pi\right)\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;b \cdot b\\
\end{array}
\end{array}
if b < 7.50000000000000006e-29Initial program 79.4%
unpow279.4%
associate-*l/79.4%
associate-/l*79.4%
unpow279.4%
Simplified79.4%
Taylor expanded in a around inf 44.9%
unpow244.9%
*-commutative44.9%
associate-*r*45.0%
unpow245.0%
swap-sqr49.6%
unpow249.6%
associate-*r*49.5%
*-commutative49.5%
Simplified49.5%
if 7.50000000000000006e-29 < b Initial program 85.7%
unpow285.7%
associate-*l/85.6%
associate-/l*85.6%
unpow285.6%
Simplified85.6%
Taylor expanded in angle around 0 70.1%
unpow270.1%
Applied egg-rr70.1%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (if (<= a 1.18e+207) (* b b) (cbrt (pow b 6.0))))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if (a <= 1.18e+207) {
tmp = b * b;
} else {
tmp = cbrt(pow(b, 6.0));
}
return tmp;
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double tmp;
if (a <= 1.18e+207) {
tmp = b * b;
} else {
tmp = Math.cbrt(Math.pow(b, 6.0));
}
return tmp;
}
angle_m = abs(angle) function code(a, b, angle_m) tmp = 0.0 if (a <= 1.18e+207) tmp = Float64(b * b); else tmp = cbrt((b ^ 6.0)); end return tmp end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := If[LessEqual[a, 1.18e+207], N[(b * b), $MachinePrecision], N[Power[N[Power[b, 6.0], $MachinePrecision], 1/3], $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
\mathbf{if}\;a \leq 1.18 \cdot 10^{+207}:\\
\;\;\;\;b \cdot b\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{{b}^{6}}\\
\end{array}
\end{array}
if a < 1.18e207Initial program 79.1%
unpow279.1%
associate-*l/79.0%
associate-/l*79.0%
unpow279.0%
Simplified79.1%
Taylor expanded in angle around 0 58.6%
unpow258.6%
Applied egg-rr58.6%
if 1.18e207 < a Initial program 99.6%
unpow299.6%
associate-*l/99.8%
associate-/l*99.7%
unpow299.7%
Simplified99.7%
Taylor expanded in angle around 0 28.4%
add-sqr-sqrt28.4%
sqrt-unprod32.4%
pow-prod-up32.4%
metadata-eval32.4%
Applied egg-rr32.4%
add-cbrt-cube36.6%
pow1/336.6%
add-sqr-sqrt36.6%
sqrt-pow136.6%
metadata-eval36.6%
pow-prod-up36.6%
metadata-eval36.6%
Applied egg-rr36.6%
unpow1/336.6%
Simplified36.6%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (* b b))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return b * b;
}
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 = b * b
end function
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return b * b;
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return b * b
angle_m = abs(angle) function code(a, b, angle_m) return Float64(b * b) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = b * b; end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(b * b), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
b \cdot b
\end{array}
Initial program 80.9%
unpow280.9%
associate-*l/80.9%
associate-/l*80.9%
unpow280.9%
Simplified80.9%
Taylor expanded in angle around 0 55.9%
unpow255.9%
Applied egg-rr55.9%
herbie shell --seed 2024177
(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)))