
(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 12 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
(fma
(cos (+ 1.0 (* 0.005555555555555556 (* angle_m PI))))
(cos 1.0)
(* (sin (fma PI (* 0.005555555555555556 angle_m) 1.0)) (sin 1.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 * fma(cos((1.0 + (0.005555555555555556 * (angle_m * ((double) M_PI))))), cos(1.0), (sin(fma(((double) M_PI), (0.005555555555555556 * angle_m), 1.0)) * sin(1.0)))), 2.0) + pow((b * sin((((double) M_PI) * (0.005555555555555556 * angle_m)))), 2.0);
}
angle_m = abs(angle) function code(a, b, angle_m) return Float64((Float64(a * fma(cos(Float64(1.0 + Float64(0.005555555555555556 * Float64(angle_m * pi)))), cos(1.0), Float64(sin(fma(pi, Float64(0.005555555555555556 * angle_m), 1.0)) * sin(1.0)))) ^ 2.0) + (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[(N[Power[N[(a * N[(N[Cos[N[(1.0 + N[(0.005555555555555556 * N[(angle$95$m * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[1.0], $MachinePrecision] + N[(N[Sin[N[(Pi * N[(0.005555555555555556 * angle$95$m), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] * N[Sin[1.0], $MachinePrecision]), $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 \mathsf{fma}\left(\cos \left(1 + 0.005555555555555556 \cdot \left(angle\_m \cdot \pi\right)\right), \cos 1, \sin \left(\mathsf{fma}\left(\pi, 0.005555555555555556 \cdot angle\_m, 1\right)\right) \cdot \sin 1\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(0.005555555555555556 \cdot angle\_m\right)\right)\right)}^{2}
\end{array}
Initial program 80.2%
Simplified80.2%
metadata-eval80.2%
div-inv80.2%
expm1-log1p-u66.0%
expm1-undefine66.0%
cos-diff66.0%
div-inv66.0%
metadata-eval66.0%
associate-*r*66.0%
*-commutative66.0%
Applied egg-rr66.0%
fma-define66.0%
log1p-undefine66.0%
rem-exp-log66.0%
*-commutative66.0%
log1p-undefine66.0%
rem-exp-log80.2%
*-commutative80.2%
Simplified80.2%
*-un-lft-identity80.2%
+-commutative80.2%
associate-*r*80.3%
*-commutative80.3%
*-commutative80.3%
fma-define80.3%
*-commutative80.3%
Applied egg-rr80.3%
*-lft-identity80.3%
Simplified80.3%
Final simplification80.3%
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
:precision binary64
(let* ((t_0 (+ 1.0 (* 0.005555555555555556 (* angle_m PI)))))
(+
(pow (* b (sin (* PI (* 0.005555555555555556 angle_m)))) 2.0)
(pow (* a (fma (cos t_0) (cos 1.0) (* (sin 1.0) (sin t_0)))) 2.0))))angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double t_0 = 1.0 + (0.005555555555555556 * (angle_m * ((double) M_PI)));
return pow((b * sin((((double) M_PI) * (0.005555555555555556 * angle_m)))), 2.0) + pow((a * fma(cos(t_0), cos(1.0), (sin(1.0) * sin(t_0)))), 2.0);
}
angle_m = abs(angle) function code(a, b, angle_m) t_0 = Float64(1.0 + Float64(0.005555555555555556 * Float64(angle_m * pi))) return Float64((Float64(b * sin(Float64(pi * Float64(0.005555555555555556 * angle_m)))) ^ 2.0) + (Float64(a * fma(cos(t_0), cos(1.0), Float64(sin(1.0) * sin(t_0)))) ^ 2.0)) end
angle_m = N[Abs[angle], $MachinePrecision]
code[a_, b_, angle$95$m_] := Block[{t$95$0 = N[(1.0 + N[(0.005555555555555556 * N[(angle$95$m * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(N[Power[N[(b * N[Sin[N[(Pi * N[(0.005555555555555556 * angle$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(a * N[(N[Cos[t$95$0], $MachinePrecision] * N[Cos[1.0], $MachinePrecision] + N[(N[Sin[1.0], $MachinePrecision] * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
t_0 := 1 + 0.005555555555555556 \cdot \left(angle\_m \cdot \pi\right)\\
{\left(b \cdot \sin \left(\pi \cdot \left(0.005555555555555556 \cdot angle\_m\right)\right)\right)}^{2} + {\left(a \cdot \mathsf{fma}\left(\cos t\_0, \cos 1, \sin 1 \cdot \sin t\_0\right)\right)}^{2}
\end{array}
\end{array}
Initial program 80.2%
Simplified80.2%
metadata-eval80.2%
div-inv80.2%
expm1-log1p-u66.0%
expm1-undefine66.0%
cos-diff66.0%
div-inv66.0%
metadata-eval66.0%
associate-*r*66.0%
*-commutative66.0%
Applied egg-rr66.0%
fma-define66.0%
log1p-undefine66.0%
rem-exp-log66.0%
*-commutative66.0%
log1p-undefine66.0%
rem-exp-log80.2%
*-commutative80.2%
Simplified80.2%
Final simplification80.2%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow (* a (cos (* PI (* 0.005555555555555556 angle_m)))) 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 * cos((((double) M_PI) * (0.005555555555555556 * angle_m)))), 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 * Math.cos((Math.PI * (0.005555555555555556 * angle_m)))), 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 * math.cos((math.pi * (0.005555555555555556 * angle_m)))), 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((Float64(a * cos(Float64(pi * Float64(0.005555555555555556 * angle_m)))) ^ 2.0) + (Float64(b * sin(Float64(Float64(angle_m * pi) / 180.0))) ^ 2.0)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = ((a * cos((pi * (0.005555555555555556 * angle_m)))) ^ 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[N[(a * N[Cos[N[(Pi * N[(0.005555555555555556 * angle$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[N[(N[(angle$95$m * Pi), $MachinePrecision] / 180.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{\left(a \cdot \cos \left(\pi \cdot \left(0.005555555555555556 \cdot angle\_m\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle\_m \cdot \pi}{180}\right)\right)}^{2}
\end{array}
Initial program 80.2%
Simplified80.2%
metadata-eval80.2%
div-inv80.2%
associate-*r/80.3%
Applied egg-rr80.3%
Final simplification80.3%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow (* a (cos (* PI (* 0.005555555555555556 angle_m)))) 2.0) (pow (* b (sin (/ PI (/ 180.0 angle_m)))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow((a * cos((((double) M_PI) * (0.005555555555555556 * angle_m)))), 2.0) + pow((b * sin((((double) M_PI) / (180.0 / 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.PI * (0.005555555555555556 * angle_m)))), 2.0) + Math.pow((b * Math.sin((Math.PI / (180.0 / angle_m)))), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow((a * math.cos((math.pi * (0.005555555555555556 * angle_m)))), 2.0) + math.pow((b * math.sin((math.pi / (180.0 / angle_m)))), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) return Float64((Float64(a * cos(Float64(pi * Float64(0.005555555555555556 * angle_m)))) ^ 2.0) + (Float64(b * sin(Float64(pi / Float64(180.0 / angle_m)))) ^ 2.0)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = ((a * cos((pi * (0.005555555555555556 * angle_m)))) ^ 2.0) + ((b * sin((pi / (180.0 / 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[(Pi * N[(0.005555555555555556 * angle$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[N[(Pi / N[(180.0 / angle$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{\left(a \cdot \cos \left(\pi \cdot \left(0.005555555555555556 \cdot angle\_m\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\pi}{\frac{180}{angle\_m}}\right)\right)}^{2}
\end{array}
Initial program 80.2%
Simplified80.2%
metadata-eval80.2%
div-inv80.2%
clear-num80.2%
un-div-inv80.2%
Applied egg-rr80.2%
Final simplification80.2%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (let* ((t_0 (* PI (* 0.005555555555555556 angle_m)))) (+ (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 = ((double) M_PI) * (0.005555555555555556 * angle_m);
return pow((b * sin(t_0)), 2.0) + pow((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 * (0.005555555555555556 * angle_m);
return Math.pow((b * Math.sin(t_0)), 2.0) + Math.pow((a * Math.cos(t_0)), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): t_0 = math.pi * (0.005555555555555556 * angle_m) return math.pow((b * math.sin(t_0)), 2.0) + math.pow((a * math.cos(t_0)), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) t_0 = Float64(pi * Float64(0.005555555555555556 * angle_m)) return Float64((Float64(b * sin(t_0)) ^ 2.0) + (Float64(a * cos(t_0)) ^ 2.0)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) t_0 = pi * (0.005555555555555556 * angle_m); tmp = ((b * sin(t_0)) ^ 2.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[(0.005555555555555556 * angle$95$m), $MachinePrecision]), $MachinePrecision]}, N[(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]), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
t_0 := \pi \cdot \left(0.005555555555555556 \cdot angle\_m\right)\\
{\left(b \cdot \sin t\_0\right)}^{2} + {\left(a \cdot \cos t\_0\right)}^{2}
\end{array}
\end{array}
Initial program 80.2%
Simplified80.2%
Final simplification80.2%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (if (<= b 5.6e+144) (pow (* a (cos (* angle_m (* 0.005555555555555556 PI)))) 2.0) (pow (* b (sin (* 0.005555555555555556 (* angle_m PI)))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if (b <= 5.6e+144) {
tmp = pow((a * cos((angle_m * (0.005555555555555556 * ((double) M_PI))))), 2.0);
} else {
tmp = pow((b * sin((0.005555555555555556 * (angle_m * ((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 (b <= 5.6e+144) {
tmp = Math.pow((a * Math.cos((angle_m * (0.005555555555555556 * Math.PI)))), 2.0);
} else {
tmp = Math.pow((b * Math.sin((0.005555555555555556 * (angle_m * Math.PI)))), 2.0);
}
return tmp;
}
angle_m = math.fabs(angle) def code(a, b, angle_m): tmp = 0 if b <= 5.6e+144: tmp = math.pow((a * math.cos((angle_m * (0.005555555555555556 * math.pi)))), 2.0) else: tmp = math.pow((b * math.sin((0.005555555555555556 * (angle_m * math.pi)))), 2.0) return tmp
angle_m = abs(angle) function code(a, b, angle_m) tmp = 0.0 if (b <= 5.6e+144) tmp = Float64(a * cos(Float64(angle_m * Float64(0.005555555555555556 * pi)))) ^ 2.0; else tmp = Float64(b * sin(Float64(0.005555555555555556 * Float64(angle_m * pi)))) ^ 2.0; end return tmp end
angle_m = abs(angle); function tmp_2 = code(a, b, angle_m) tmp = 0.0; if (b <= 5.6e+144) tmp = (a * cos((angle_m * (0.005555555555555556 * pi)))) ^ 2.0; else tmp = (b * sin((0.005555555555555556 * (angle_m * pi)))) ^ 2.0; end tmp_2 = tmp; end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := If[LessEqual[b, 5.6e+144], N[Power[N[(a * N[Cos[N[(angle$95$m * N[(0.005555555555555556 * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[Power[N[(b * N[Sin[N[(0.005555555555555556 * N[(angle$95$m * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
\mathbf{if}\;b \leq 5.6 \cdot 10^{+144}:\\
\;\;\;\;{\left(a \cdot \cos \left(angle\_m \cdot \left(0.005555555555555556 \cdot \pi\right)\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;{\left(b \cdot \sin \left(0.005555555555555556 \cdot \left(angle\_m \cdot \pi\right)\right)\right)}^{2}\\
\end{array}
\end{array}
if b < 5.60000000000000013e144Initial program 77.5%
Simplified77.5%
metadata-eval77.5%
div-inv77.5%
unpow277.5%
associate-*r*77.5%
div-inv77.4%
metadata-eval77.4%
associate-*r*74.2%
*-commutative74.2%
div-inv74.2%
metadata-eval74.2%
associate-*r*77.5%
*-commutative77.5%
Applied egg-rr77.5%
Taylor expanded in a around inf 65.0%
unpow265.0%
associate-*r*65.0%
*-commutative65.0%
unpow265.0%
swap-sqr65.0%
unpow265.0%
associate-*r*65.1%
*-commutative65.1%
Simplified65.1%
if 5.60000000000000013e144 < b Initial program 99.8%
Simplified99.8%
Taylor expanded in a around 0 71.4%
*-commutative71.4%
unpow271.4%
unpow271.4%
swap-sqr78.2%
unpow278.2%
*-commutative78.2%
Simplified78.2%
Final simplification66.7%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (if (<= b 5.5e+153) (pow (* a (cos (* angle_m (* 0.005555555555555556 PI)))) 2.0) (cbrt (pow a 6.0))))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if (b <= 5.5e+153) {
tmp = pow((a * cos((angle_m * (0.005555555555555556 * ((double) M_PI))))), 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 <= 5.5e+153) {
tmp = Math.pow((a * Math.cos((angle_m * (0.005555555555555556 * Math.PI)))), 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 <= 5.5e+153) tmp = Float64(a * cos(Float64(angle_m * Float64(0.005555555555555556 * pi)))) ^ 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, 5.5e+153], N[Power[N[(a * N[Cos[N[(angle$95$m * N[(0.005555555555555556 * Pi), $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 5.5 \cdot 10^{+153}:\\
\;\;\;\;{\left(a \cdot \cos \left(angle\_m \cdot \left(0.005555555555555556 \cdot \pi\right)\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{{a}^{6}}\\
\end{array}
\end{array}
if b < 5.5000000000000003e153Initial program 77.7%
Simplified77.7%
metadata-eval77.7%
div-inv77.7%
unpow277.7%
associate-*r*77.7%
div-inv77.6%
metadata-eval77.6%
associate-*r*74.4%
*-commutative74.4%
div-inv74.4%
metadata-eval74.4%
associate-*r*77.7%
*-commutative77.7%
Applied egg-rr77.7%
Taylor expanded in a around inf 64.9%
unpow264.9%
associate-*r*64.9%
*-commutative64.9%
unpow264.9%
swap-sqr64.9%
unpow264.9%
associate-*r*64.9%
*-commutative64.9%
Simplified64.9%
if 5.5000000000000003e153 < b Initial program 99.9%
Simplified99.9%
Taylor expanded in angle around 0 43.1%
unpow243.1%
Applied egg-rr43.1%
pow243.1%
add-cbrt-cube49.5%
pow1/349.5%
pow249.5%
pow249.5%
pow249.5%
pow349.5%
pow249.5%
pow-pow49.5%
metadata-eval49.5%
Applied egg-rr49.5%
unpow1/349.5%
Simplified49.5%
Final simplification63.2%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (if (<= b 5.8e+153) (pow (* a (cos (* 0.005555555555555556 (* angle_m PI)))) 2.0) (cbrt (pow a 6.0))))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if (b <= 5.8e+153) {
tmp = pow((a * cos((0.005555555555555556 * (angle_m * ((double) M_PI))))), 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 <= 5.8e+153) {
tmp = Math.pow((a * Math.cos((0.005555555555555556 * (angle_m * Math.PI)))), 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 <= 5.8e+153) tmp = Float64(a * cos(Float64(0.005555555555555556 * Float64(angle_m * pi)))) ^ 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, 5.8e+153], N[Power[N[(a * N[Cos[N[(0.005555555555555556 * N[(angle$95$m * Pi), $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 5.8 \cdot 10^{+153}:\\
\;\;\;\;{\left(a \cdot \cos \left(0.005555555555555556 \cdot \left(angle\_m \cdot \pi\right)\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{{a}^{6}}\\
\end{array}
\end{array}
if b < 5.80000000000000004e153Initial program 77.7%
Simplified77.7%
Taylor expanded in a around inf 64.9%
unpow264.9%
*-commutative64.9%
unpow264.9%
swap-sqr64.9%
unpow264.9%
*-commutative64.9%
Simplified64.9%
if 5.80000000000000004e153 < b Initial program 99.9%
Simplified99.9%
Taylor expanded in angle around 0 43.1%
unpow243.1%
Applied egg-rr43.1%
pow243.1%
add-cbrt-cube49.5%
pow1/349.5%
pow249.5%
pow249.5%
pow249.5%
pow349.5%
pow249.5%
pow-pow49.5%
metadata-eval49.5%
Applied egg-rr49.5%
unpow1/349.5%
Simplified49.5%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow (* b (sin (* PI (* 0.005555555555555556 angle_m)))) 2.0) (* a a)))
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) + (a * a);
}
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) + (a * a);
}
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) + (a * a)
angle_m = abs(angle) function code(a, b, angle_m) return Float64((Float64(b * sin(Float64(pi * Float64(0.005555555555555556 * angle_m)))) ^ 2.0) + Float64(a * a)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = ((b * sin((pi * (0.005555555555555556 * angle_m)))) ^ 2.0) + (a * a); 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[(a * a), $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 \cdot a
\end{array}
Initial program 80.2%
Simplified80.2%
metadata-eval80.2%
div-inv80.2%
log1p-expm1-u71.7%
log1p-undefine61.8%
pow161.8%
pow161.8%
div-inv61.8%
metadata-eval61.8%
associate-*r*61.8%
*-commutative61.8%
Applied egg-rr61.8%
Taylor expanded in angle around 0 61.8%
log1p-define71.8%
log1p-expm1-u80.2%
pow280.2%
Applied egg-rr80.2%
Final simplification80.2%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (if (<= b 5.1e+158) (* a a) (pow (pow a 6.0) 0.3333333333333333)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if (b <= 5.1e+158) {
tmp = a * a;
} else {
tmp = pow(pow(a, 6.0), 0.3333333333333333);
}
return tmp;
}
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
real(8) :: tmp
if (b <= 5.1d+158) then
tmp = a * a
else
tmp = (a ** 6.0d0) ** 0.3333333333333333d0
end if
code = tmp
end function
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double tmp;
if (b <= 5.1e+158) {
tmp = a * a;
} else {
tmp = Math.pow(Math.pow(a, 6.0), 0.3333333333333333);
}
return tmp;
}
angle_m = math.fabs(angle) def code(a, b, angle_m): tmp = 0 if b <= 5.1e+158: tmp = a * a else: tmp = math.pow(math.pow(a, 6.0), 0.3333333333333333) return tmp
angle_m = abs(angle) function code(a, b, angle_m) tmp = 0.0 if (b <= 5.1e+158) tmp = Float64(a * a); else tmp = (a ^ 6.0) ^ 0.3333333333333333; end return tmp end
angle_m = abs(angle); function tmp_2 = code(a, b, angle_m) tmp = 0.0; if (b <= 5.1e+158) tmp = a * a; else tmp = (a ^ 6.0) ^ 0.3333333333333333; end tmp_2 = tmp; end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := If[LessEqual[b, 5.1e+158], N[(a * a), $MachinePrecision], N[Power[N[Power[a, 6.0], $MachinePrecision], 0.3333333333333333], $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
\mathbf{if}\;b \leq 5.1 \cdot 10^{+158}:\\
\;\;\;\;a \cdot a\\
\mathbf{else}:\\
\;\;\;\;{\left({a}^{6}\right)}^{0.3333333333333333}\\
\end{array}
\end{array}
if b < 5.09999999999999987e158Initial program 77.7%
Simplified77.7%
Taylor expanded in angle around 0 64.8%
unpow264.8%
Applied egg-rr64.8%
if 5.09999999999999987e158 < b Initial program 99.9%
Simplified99.9%
Taylor expanded in angle around 0 43.1%
unpow243.1%
Applied egg-rr43.1%
pow243.1%
add-cbrt-cube49.5%
pow1/349.5%
pow249.5%
pow249.5%
pow249.5%
pow349.5%
pow249.5%
pow-pow49.5%
metadata-eval49.5%
Applied egg-rr49.5%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (if (<= b 6e+153) (* a a) (cbrt (pow a 6.0))))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if (b <= 6e+153) {
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 <= 6e+153) {
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 <= 6e+153) 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, 6e+153], 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 6 \cdot 10^{+153}:\\
\;\;\;\;a \cdot a\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{{a}^{6}}\\
\end{array}
\end{array}
if b < 6.00000000000000037e153Initial program 77.7%
Simplified77.7%
Taylor expanded in angle around 0 64.8%
unpow264.8%
Applied egg-rr64.8%
if 6.00000000000000037e153 < b Initial program 99.9%
Simplified99.9%
Taylor expanded in angle around 0 43.1%
unpow243.1%
Applied egg-rr43.1%
pow243.1%
add-cbrt-cube49.5%
pow1/349.5%
pow249.5%
pow249.5%
pow249.5%
pow349.5%
pow249.5%
pow-pow49.5%
metadata-eval49.5%
Applied egg-rr49.5%
unpow1/349.5%
Simplified49.5%
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 80.2%
Simplified80.2%
Taylor expanded in angle around 0 62.4%
unpow262.4%
Applied egg-rr62.4%
herbie shell --seed 2024139
(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)))