
(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 13 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 (fma angle_m (* PI 0.005555555555555556) 1.0)))
(+
(pow
(* a (sin (expm1 (log1p (* angle_m (* PI 0.005555555555555556))))))
2.0)
(pow (* b (fma (cos t_0) (cos 1.0) (* (sin t_0) (sin 1.0)))) 2.0))))angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double t_0 = fma(angle_m, (((double) M_PI) * 0.005555555555555556), 1.0);
return pow((a * sin(expm1(log1p((angle_m * (((double) M_PI) * 0.005555555555555556)))))), 2.0) + pow((b * fma(cos(t_0), cos(1.0), (sin(t_0) * sin(1.0)))), 2.0);
}
angle_m = abs(angle) function code(a, b, angle_m) t_0 = fma(angle_m, Float64(pi * 0.005555555555555556), 1.0) return Float64((Float64(a * sin(expm1(log1p(Float64(angle_m * Float64(pi * 0.005555555555555556)))))) ^ 2.0) + (Float64(b * fma(cos(t_0), cos(1.0), Float64(sin(t_0) * sin(1.0)))) ^ 2.0)) end
angle_m = N[Abs[angle], $MachinePrecision]
code[a_, b_, angle$95$m_] := Block[{t$95$0 = N[(angle$95$m * N[(Pi * 0.005555555555555556), $MachinePrecision] + 1.0), $MachinePrecision]}, N[(N[Power[N[(a * N[Sin[N[(Exp[N[Log[1 + N[(angle$95$m * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[(N[Cos[t$95$0], $MachinePrecision] * N[Cos[1.0], $MachinePrecision] + N[(N[Sin[t$95$0], $MachinePrecision] * N[Sin[1.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(angle\_m, \pi \cdot 0.005555555555555556, 1\right)\\
{\left(a \cdot \sin \left(\mathsf{expm1}\left(\mathsf{log1p}\left(angle\_m \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)\right)\right)}^{2} + {\left(b \cdot \mathsf{fma}\left(\cos t\_0, \cos 1, \sin t\_0 \cdot \sin 1\right)\right)}^{2}
\end{array}
\end{array}
Initial program 79.9%
clear-num80.0%
associate-/r/80.0%
expm1-log1p-u62.9%
clear-num62.9%
associate-/r/62.9%
*-commutative62.9%
div-inv62.9%
metadata-eval62.9%
Applied egg-rr62.9%
associate-*l/62.9%
associate-*r/62.9%
div-inv62.9%
metadata-eval62.9%
expm1-log1p-u62.9%
expm1-udef62.9%
cos-diff62.9%
log1p-udef62.9%
rem-exp-log62.9%
+-commutative62.9%
log1p-udef62.9%
rem-exp-log63.0%
+-commutative63.0%
Applied egg-rr63.0%
fma-def63.0%
fma-def63.0%
*-commutative63.0%
fma-def63.0%
*-commutative63.0%
Simplified63.0%
Final simplification63.0%
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
:precision binary64
(let* ((t_0 (* angle_m (* PI 0.005555555555555556))) (t_1 (+ t_0 1.0)))
(+
(pow (* a (sin (expm1 (log1p t_0)))) 2.0)
(pow (* b (+ (* (cos 1.0) (cos t_1)) (* (sin 1.0) (sin t_1)))) 2.0))))angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double t_0 = angle_m * (((double) M_PI) * 0.005555555555555556);
double t_1 = t_0 + 1.0;
return pow((a * sin(expm1(log1p(t_0)))), 2.0) + pow((b * ((cos(1.0) * cos(t_1)) + (sin(1.0) * sin(t_1)))), 2.0);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double t_0 = angle_m * (Math.PI * 0.005555555555555556);
double t_1 = t_0 + 1.0;
return Math.pow((a * Math.sin(Math.expm1(Math.log1p(t_0)))), 2.0) + Math.pow((b * ((Math.cos(1.0) * Math.cos(t_1)) + (Math.sin(1.0) * Math.sin(t_1)))), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): t_0 = angle_m * (math.pi * 0.005555555555555556) t_1 = t_0 + 1.0 return math.pow((a * math.sin(math.expm1(math.log1p(t_0)))), 2.0) + math.pow((b * ((math.cos(1.0) * math.cos(t_1)) + (math.sin(1.0) * math.sin(t_1)))), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) t_0 = Float64(angle_m * Float64(pi * 0.005555555555555556)) t_1 = Float64(t_0 + 1.0) return Float64((Float64(a * sin(expm1(log1p(t_0)))) ^ 2.0) + (Float64(b * Float64(Float64(cos(1.0) * cos(t_1)) + Float64(sin(1.0) * sin(t_1)))) ^ 2.0)) end
angle_m = N[Abs[angle], $MachinePrecision]
code[a_, b_, angle$95$m_] := Block[{t$95$0 = N[(angle$95$m * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 + 1.0), $MachinePrecision]}, N[(N[Power[N[(a * N[Sin[N[(Exp[N[Log[1 + t$95$0], $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[(N[(N[Cos[1.0], $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision] + N[(N[Sin[1.0], $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
t_0 := angle\_m \cdot \left(\pi \cdot 0.005555555555555556\right)\\
t_1 := t\_0 + 1\\
{\left(a \cdot \sin \left(\mathsf{expm1}\left(\mathsf{log1p}\left(t\_0\right)\right)\right)\right)}^{2} + {\left(b \cdot \left(\cos 1 \cdot \cos t\_1 + \sin 1 \cdot \sin t\_1\right)\right)}^{2}
\end{array}
\end{array}
Initial program 79.9%
clear-num80.0%
associate-/r/80.0%
expm1-log1p-u62.9%
clear-num62.9%
associate-/r/62.9%
*-commutative62.9%
div-inv62.9%
metadata-eval62.9%
Applied egg-rr62.9%
associate-*l/62.9%
associate-*r/62.9%
div-inv62.9%
metadata-eval62.9%
expm1-log1p-u62.9%
expm1-udef62.9%
cos-diff62.9%
log1p-udef62.9%
rem-exp-log62.9%
+-commutative62.9%
log1p-udef62.9%
rem-exp-log63.0%
+-commutative63.0%
Applied egg-rr63.0%
Final simplification63.0%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow (* a (sin (expm1 (log1p (* angle_m (* PI 0.005555555555555556)))))) 2.0) (pow (* b (cos (* PI (/ angle_m 180.0)))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow((a * sin(expm1(log1p((angle_m * (((double) M_PI) * 0.005555555555555556)))))), 2.0) + pow((b * cos((((double) M_PI) * (angle_m / 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.sin(Math.expm1(Math.log1p((angle_m * (Math.PI * 0.005555555555555556)))))), 2.0) + Math.pow((b * Math.cos((Math.PI * (angle_m / 180.0)))), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow((a * math.sin(math.expm1(math.log1p((angle_m * (math.pi * 0.005555555555555556)))))), 2.0) + math.pow((b * math.cos((math.pi * (angle_m / 180.0)))), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) return Float64((Float64(a * sin(expm1(log1p(Float64(angle_m * Float64(pi * 0.005555555555555556)))))) ^ 2.0) + (Float64(b * cos(Float64(pi * Float64(angle_m / 180.0)))) ^ 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[(angle$95$m * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[N[(Pi * N[(angle$95$m / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{\left(a \cdot \sin \left(\mathsf{expm1}\left(\mathsf{log1p}\left(angle\_m \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)\right)\right)}^{2} + {\left(b \cdot \cos \left(\pi \cdot \frac{angle\_m}{180}\right)\right)}^{2}
\end{array}
Initial program 79.9%
clear-num80.0%
associate-/r/80.0%
expm1-log1p-u62.9%
clear-num62.9%
associate-/r/62.9%
*-commutative62.9%
div-inv62.9%
metadata-eval62.9%
Applied egg-rr62.9%
Final simplification62.9%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (let* ((t_0 (* angle_m (/ PI 180.0)))) (+ (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 = angle_m * (((double) M_PI) / 180.0);
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 = angle_m * (Math.PI / 180.0);
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 = angle_m * (math.pi / 180.0) 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 = Float64(angle_m * Float64(pi / 180.0)) return Float64((Float64(a * sin(t_0)) ^ 2.0) + (Float64(b * cos(t_0)) ^ 2.0)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) t_0 = angle_m * (pi / 180.0); tmp = ((a * sin(t_0)) ^ 2.0) + ((b * cos(t_0)) ^ 2.0); end
angle_m = N[Abs[angle], $MachinePrecision]
code[a_, b_, angle$95$m_] := Block[{t$95$0 = N[(angle$95$m * N[(Pi / 180.0), $MachinePrecision]), $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 := angle\_m \cdot \frac{\pi}{180}\\
{\left(a \cdot \sin t\_0\right)}^{2} + {\left(b \cdot \cos t\_0\right)}^{2}
\end{array}
\end{array}
Initial program 79.9%
unpow279.9%
swap-sqr79.9%
*-commutative79.9%
associate-*r/80.0%
associate-*l/80.1%
*-commutative80.1%
swap-sqr80.1%
unpow280.1%
*-commutative80.1%
associate-*r/80.1%
associate-*l/80.1%
*-commutative80.1%
Simplified80.1%
Final simplification80.1%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow b 2.0) (pow (* a (sin (* 0.005555555555555556 (* angle_m PI)))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow(b, 2.0) + pow((a * sin((0.005555555555555556 * (angle_m * ((double) M_PI))))), 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((0.005555555555555556 * (angle_m * Math.PI)))), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow(b, 2.0) + math.pow((a * math.sin((0.005555555555555556 * (angle_m * math.pi)))), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) return Float64((b ^ 2.0) + (Float64(a * sin(Float64(0.005555555555555556 * Float64(angle_m * pi)))) ^ 2.0)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = (b ^ 2.0) + ((a * sin((0.005555555555555556 * (angle_m * pi)))) ^ 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[(0.005555555555555556 * N[(angle$95$m * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{b}^{2} + {\left(a \cdot \sin \left(0.005555555555555556 \cdot \left(angle\_m \cdot \pi\right)\right)\right)}^{2}
\end{array}
Initial program 79.9%
unpow279.9%
swap-sqr79.9%
*-commutative79.9%
associate-*r/80.0%
associate-*l/80.1%
*-commutative80.1%
swap-sqr80.1%
unpow280.1%
*-commutative80.1%
associate-*r/80.1%
associate-*l/80.1%
*-commutative80.1%
Simplified80.1%
Taylor expanded in angle around 0 80.0%
Taylor expanded in angle around inf 80.0%
Final simplification80.0%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow (* a (sin (* angle_m (/ PI 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((angle_m * (((double) M_PI) / 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((angle_m * (Math.PI / 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((angle_m * (math.pi / 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(angle_m * Float64(pi / 180.0)))) ^ 2.0) + (b ^ 2.0)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = ((a * sin((angle_m * (pi / 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[(angle$95$m * N[(Pi / 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(angle\_m \cdot \frac{\pi}{180}\right)\right)}^{2} + {b}^{2}
\end{array}
Initial program 79.9%
unpow279.9%
swap-sqr79.9%
*-commutative79.9%
associate-*r/80.0%
associate-*l/80.1%
*-commutative80.1%
swap-sqr80.1%
unpow280.1%
*-commutative80.1%
associate-*r/80.1%
associate-*l/80.1%
*-commutative80.1%
Simplified80.1%
Taylor expanded in angle around 0 80.0%
Final simplification80.0%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow b 2.0) (pow (* (* angle_m PI) (* a 0.005555555555555556)) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow(b, 2.0) + pow(((angle_m * ((double) M_PI)) * (a * 0.005555555555555556)), 2.0);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return Math.pow(b, 2.0) + Math.pow(((angle_m * Math.PI) * (a * 0.005555555555555556)), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow(b, 2.0) + math.pow(((angle_m * math.pi) * (a * 0.005555555555555556)), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) return Float64((b ^ 2.0) + (Float64(Float64(angle_m * pi) * Float64(a * 0.005555555555555556)) ^ 2.0)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = (b ^ 2.0) + (((angle_m * pi) * (a * 0.005555555555555556)) ^ 2.0); end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(N[Power[b, 2.0], $MachinePrecision] + N[Power[N[(N[(angle$95$m * Pi), $MachinePrecision] * N[(a * 0.005555555555555556), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{b}^{2} + {\left(\left(angle\_m \cdot \pi\right) \cdot \left(a \cdot 0.005555555555555556\right)\right)}^{2}
\end{array}
Initial program 79.9%
unpow279.9%
swap-sqr79.9%
*-commutative79.9%
associate-*r/80.0%
associate-*l/80.1%
*-commutative80.1%
swap-sqr80.1%
unpow280.1%
*-commutative80.1%
associate-*r/80.1%
associate-*l/80.1%
*-commutative80.1%
Simplified80.1%
Taylor expanded in angle around 0 80.0%
Taylor expanded in angle around 0 75.6%
associate-*r*75.7%
Simplified75.7%
Final simplification75.7%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow b 2.0) (pow (* (* a PI) (* angle_m 0.005555555555555556)) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow(b, 2.0) + pow(((a * ((double) M_PI)) * (angle_m * 0.005555555555555556)), 2.0);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return Math.pow(b, 2.0) + Math.pow(((a * Math.PI) * (angle_m * 0.005555555555555556)), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow(b, 2.0) + math.pow(((a * math.pi) * (angle_m * 0.005555555555555556)), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) return Float64((b ^ 2.0) + (Float64(Float64(a * pi) * Float64(angle_m * 0.005555555555555556)) ^ 2.0)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = (b ^ 2.0) + (((a * pi) * (angle_m * 0.005555555555555556)) ^ 2.0); end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(N[Power[b, 2.0], $MachinePrecision] + N[Power[N[(N[(a * Pi), $MachinePrecision] * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{b}^{2} + {\left(\left(a \cdot \pi\right) \cdot \left(angle\_m \cdot 0.005555555555555556\right)\right)}^{2}
\end{array}
Initial program 79.9%
unpow279.9%
swap-sqr79.9%
*-commutative79.9%
associate-*r/80.0%
associate-*l/80.1%
*-commutative80.1%
swap-sqr80.1%
unpow280.1%
*-commutative80.1%
associate-*r/80.1%
associate-*l/80.1%
*-commutative80.1%
Simplified80.1%
Taylor expanded in angle around 0 80.0%
Taylor expanded in angle around 0 75.6%
Taylor expanded in a around 0 62.1%
metadata-eval62.1%
*-commutative62.1%
unpow262.1%
unpow262.1%
swap-sqr62.1%
unpow262.1%
swap-sqr75.7%
associate-*r*75.7%
associate-*r*75.7%
swap-sqr75.6%
unpow275.6%
associate-*r*75.7%
*-commutative75.7%
*-commutative75.7%
Simplified75.7%
Final simplification75.7%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow b 2.0) (* (* a 0.005555555555555556) (* angle_m (* PI (* (* a PI) (* angle_m 0.005555555555555556)))))))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow(b, 2.0) + ((a * 0.005555555555555556) * (angle_m * (((double) M_PI) * ((a * ((double) M_PI)) * (angle_m * 0.005555555555555556)))));
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return Math.pow(b, 2.0) + ((a * 0.005555555555555556) * (angle_m * (Math.PI * ((a * Math.PI) * (angle_m * 0.005555555555555556)))));
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow(b, 2.0) + ((a * 0.005555555555555556) * (angle_m * (math.pi * ((a * math.pi) * (angle_m * 0.005555555555555556)))))
angle_m = abs(angle) function code(a, b, angle_m) return Float64((b ^ 2.0) + Float64(Float64(a * 0.005555555555555556) * Float64(angle_m * Float64(pi * Float64(Float64(a * pi) * Float64(angle_m * 0.005555555555555556)))))) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = (b ^ 2.0) + ((a * 0.005555555555555556) * (angle_m * (pi * ((a * pi) * (angle_m * 0.005555555555555556))))); end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(N[Power[b, 2.0], $MachinePrecision] + N[(N[(a * 0.005555555555555556), $MachinePrecision] * N[(angle$95$m * N[(Pi * N[(N[(a * Pi), $MachinePrecision] * N[(angle$95$m * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{b}^{2} + \left(a \cdot 0.005555555555555556\right) \cdot \left(angle\_m \cdot \left(\pi \cdot \left(\left(a \cdot \pi\right) \cdot \left(angle\_m \cdot 0.005555555555555556\right)\right)\right)\right)
\end{array}
Initial program 79.9%
unpow279.9%
swap-sqr79.9%
*-commutative79.9%
associate-*r/80.0%
associate-*l/80.1%
*-commutative80.1%
swap-sqr80.1%
unpow280.1%
*-commutative80.1%
associate-*r/80.1%
associate-*l/80.1%
*-commutative80.1%
Simplified80.1%
Taylor expanded in angle around 0 80.0%
Taylor expanded in angle around 0 75.6%
unpow275.6%
associate-*r*75.7%
associate-*l*74.7%
*-commutative74.7%
associate-*l*74.7%
Applied egg-rr74.7%
associate-*l*74.7%
associate-*r*74.7%
*-commutative74.7%
Simplified74.7%
Final simplification74.7%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (let* ((t_0 (* 0.005555555555555556 (* angle_m (* a PI))))) (+ (pow b 2.0) (* t_0 t_0))))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double t_0 = 0.005555555555555556 * (angle_m * (a * ((double) M_PI)));
return pow(b, 2.0) + (t_0 * t_0);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double t_0 = 0.005555555555555556 * (angle_m * (a * Math.PI));
return Math.pow(b, 2.0) + (t_0 * t_0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): t_0 = 0.005555555555555556 * (angle_m * (a * math.pi)) return math.pow(b, 2.0) + (t_0 * t_0)
angle_m = abs(angle) function code(a, b, angle_m) t_0 = Float64(0.005555555555555556 * Float64(angle_m * Float64(a * pi))) return Float64((b ^ 2.0) + Float64(t_0 * t_0)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) t_0 = 0.005555555555555556 * (angle_m * (a * pi)); tmp = (b ^ 2.0) + (t_0 * t_0); end
angle_m = N[Abs[angle], $MachinePrecision]
code[a_, b_, angle$95$m_] := Block[{t$95$0 = N[(0.005555555555555556 * N[(angle$95$m * N[(a * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(N[Power[b, 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 := 0.005555555555555556 \cdot \left(angle\_m \cdot \left(a \cdot \pi\right)\right)\\
{b}^{2} + t\_0 \cdot t\_0
\end{array}
\end{array}
Initial program 79.9%
unpow279.9%
swap-sqr79.9%
*-commutative79.9%
associate-*r/80.0%
associate-*l/80.1%
*-commutative80.1%
swap-sqr80.1%
unpow280.1%
*-commutative80.1%
associate-*r/80.1%
associate-*l/80.1%
*-commutative80.1%
Simplified80.1%
Taylor expanded in angle around 0 80.0%
Taylor expanded in angle around 0 75.6%
unpow-prod-down75.7%
add-sqr-sqrt75.6%
unpow-prod-down75.7%
unpow275.7%
sqrt-prod44.0%
add-sqr-sqrt59.8%
*-commutative59.8%
associate-*l*59.8%
unpow-prod-down59.8%
unpow259.8%
sqrt-prod44.0%
add-sqr-sqrt75.7%
*-commutative75.7%
associate-*l*75.6%
Applied egg-rr75.6%
Final simplification75.6%
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
:precision binary64
(let* ((t_0 (* angle_m (* a PI))))
(+
(pow b 2.0)
(* 0.005555555555555556 (* t_0 (* 0.005555555555555556 t_0))))))angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double t_0 = angle_m * (a * ((double) M_PI));
return pow(b, 2.0) + (0.005555555555555556 * (t_0 * (0.005555555555555556 * t_0)));
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double t_0 = angle_m * (a * Math.PI);
return Math.pow(b, 2.0) + (0.005555555555555556 * (t_0 * (0.005555555555555556 * t_0)));
}
angle_m = math.fabs(angle) def code(a, b, angle_m): t_0 = angle_m * (a * math.pi) return math.pow(b, 2.0) + (0.005555555555555556 * (t_0 * (0.005555555555555556 * t_0)))
angle_m = abs(angle) function code(a, b, angle_m) t_0 = Float64(angle_m * Float64(a * pi)) return Float64((b ^ 2.0) + Float64(0.005555555555555556 * Float64(t_0 * Float64(0.005555555555555556 * t_0)))) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) t_0 = angle_m * (a * pi); tmp = (b ^ 2.0) + (0.005555555555555556 * (t_0 * (0.005555555555555556 * t_0))); end
angle_m = N[Abs[angle], $MachinePrecision]
code[a_, b_, angle$95$m_] := Block[{t$95$0 = N[(angle$95$m * N[(a * Pi), $MachinePrecision]), $MachinePrecision]}, N[(N[Power[b, 2.0], $MachinePrecision] + N[(0.005555555555555556 * N[(t$95$0 * N[(0.005555555555555556 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
t_0 := angle\_m \cdot \left(a \cdot \pi\right)\\
{b}^{2} + 0.005555555555555556 \cdot \left(t\_0 \cdot \left(0.005555555555555556 \cdot t\_0\right)\right)
\end{array}
\end{array}
Initial program 79.9%
unpow279.9%
swap-sqr79.9%
*-commutative79.9%
associate-*r/80.0%
associate-*l/80.1%
*-commutative80.1%
swap-sqr80.1%
unpow280.1%
*-commutative80.1%
associate-*r/80.1%
associate-*l/80.1%
*-commutative80.1%
Simplified80.1%
Taylor expanded in angle around 0 80.0%
Taylor expanded in angle around 0 75.6%
unpow275.6%
*-commutative75.6%
associate-*r*75.7%
*-commutative75.7%
associate-*l*75.7%
*-commutative75.7%
associate-*l*75.7%
Applied egg-rr75.7%
Final simplification75.7%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow b 2.0) (* angle_m (* (* angle_m (* a PI)) (* PI (* a 3.08641975308642e-5))))))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow(b, 2.0) + (angle_m * ((angle_m * (a * ((double) M_PI))) * (((double) M_PI) * (a * 3.08641975308642e-5))));
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return Math.pow(b, 2.0) + (angle_m * ((angle_m * (a * Math.PI)) * (Math.PI * (a * 3.08641975308642e-5))));
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow(b, 2.0) + (angle_m * ((angle_m * (a * math.pi)) * (math.pi * (a * 3.08641975308642e-5))))
angle_m = abs(angle) function code(a, b, angle_m) return Float64((b ^ 2.0) + Float64(angle_m * Float64(Float64(angle_m * Float64(a * pi)) * Float64(pi * Float64(a * 3.08641975308642e-5))))) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = (b ^ 2.0) + (angle_m * ((angle_m * (a * pi)) * (pi * (a * 3.08641975308642e-5)))); end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(N[Power[b, 2.0], $MachinePrecision] + N[(angle$95$m * N[(N[(angle$95$m * N[(a * Pi), $MachinePrecision]), $MachinePrecision] * N[(Pi * N[(a * 3.08641975308642e-5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{b}^{2} + angle\_m \cdot \left(\left(angle\_m \cdot \left(a \cdot \pi\right)\right) \cdot \left(\pi \cdot \left(a \cdot 3.08641975308642 \cdot 10^{-5}\right)\right)\right)
\end{array}
Initial program 79.9%
unpow279.9%
swap-sqr79.9%
*-commutative79.9%
associate-*r/80.0%
associate-*l/80.1%
*-commutative80.1%
swap-sqr80.1%
unpow280.1%
*-commutative80.1%
associate-*r/80.1%
associate-*l/80.1%
*-commutative80.1%
Simplified80.1%
Taylor expanded in angle around 0 80.0%
Taylor expanded in angle around 0 75.6%
unpow275.6%
associate-*r*75.7%
associate-*l*74.7%
*-commutative74.7%
associate-*l*74.7%
Applied egg-rr74.7%
associate-*r*75.7%
*-commutative75.7%
associate-*l*74.3%
*-commutative74.3%
associate-*r*74.3%
*-commutative74.3%
*-commutative74.3%
associate-*r*74.3%
metadata-eval74.3%
Simplified74.3%
expm1-log1p-u74.0%
expm1-udef68.8%
associate-*l*68.8%
associate-*r*68.8%
associate-*r*68.8%
Applied egg-rr68.8%
expm1-def74.0%
expm1-log1p74.3%
associate-*r*74.3%
*-commutative74.3%
associate-*l*74.3%
Simplified74.3%
Final simplification74.3%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow b 2.0) (* (* angle_m PI) (* a (* 3.08641975308642e-5 (* a (* angle_m PI)))))))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return pow(b, 2.0) + ((angle_m * ((double) M_PI)) * (a * (3.08641975308642e-5 * (a * (angle_m * ((double) M_PI))))));
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return Math.pow(b, 2.0) + ((angle_m * Math.PI) * (a * (3.08641975308642e-5 * (a * (angle_m * Math.PI)))));
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return math.pow(b, 2.0) + ((angle_m * math.pi) * (a * (3.08641975308642e-5 * (a * (angle_m * math.pi)))))
angle_m = abs(angle) function code(a, b, angle_m) return Float64((b ^ 2.0) + Float64(Float64(angle_m * pi) * Float64(a * Float64(3.08641975308642e-5 * Float64(a * Float64(angle_m * pi)))))) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = (b ^ 2.0) + ((angle_m * pi) * (a * (3.08641975308642e-5 * (a * (angle_m * pi))))); end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(N[Power[b, 2.0], $MachinePrecision] + N[(N[(angle$95$m * Pi), $MachinePrecision] * N[(a * N[(3.08641975308642e-5 * N[(a * N[(angle$95$m * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{b}^{2} + \left(angle\_m \cdot \pi\right) \cdot \left(a \cdot \left(3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot \left(angle\_m \cdot \pi\right)\right)\right)\right)
\end{array}
Initial program 79.9%
unpow279.9%
swap-sqr79.9%
*-commutative79.9%
associate-*r/80.0%
associate-*l/80.1%
*-commutative80.1%
swap-sqr80.1%
unpow280.1%
*-commutative80.1%
associate-*r/80.1%
associate-*l/80.1%
*-commutative80.1%
Simplified80.1%
Taylor expanded in angle around 0 80.0%
Taylor expanded in angle around 0 75.6%
unpow275.6%
associate-*r*75.7%
associate-*l*74.7%
*-commutative74.7%
associate-*l*74.7%
Applied egg-rr74.7%
associate-*r*75.7%
*-commutative75.7%
associate-*l*74.3%
*-commutative74.3%
associate-*r*74.3%
*-commutative74.3%
*-commutative74.3%
associate-*r*74.3%
metadata-eval74.3%
Simplified74.3%
Taylor expanded in angle around 0 74.3%
Final simplification74.3%
herbie shell --seed 2024033
(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)))