
(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
(+
(pow (* a (sin (/ (* angle_m PI) 180.0))) 2.0)
(pow
(*
b
(+
(*
(sqrt (pow (cos (fma (* angle_m PI) 0.005555555555555556 1.0)) 2.0))
(cos 1.0))
(* (sin (+ 1.0 (* (* angle_m PI) 0.005555555555555556))) (sin 1.0))))
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 * ((sqrt(pow(cos(fma((angle_m * ((double) M_PI)), 0.005555555555555556, 1.0)), 2.0)) * cos(1.0)) + (sin((1.0 + ((angle_m * ((double) M_PI)) * 0.005555555555555556))) * sin(1.0)))), 2.0);
}
angle_m = abs(angle) function code(a, b, angle_m) return Float64((Float64(a * sin(Float64(Float64(angle_m * pi) / 180.0))) ^ 2.0) + (Float64(b * Float64(Float64(sqrt((cos(fma(Float64(angle_m * pi), 0.005555555555555556, 1.0)) ^ 2.0)) * cos(1.0)) + Float64(sin(Float64(1.0 + Float64(Float64(angle_m * pi) * 0.005555555555555556))) * sin(1.0)))) ^ 2.0)) end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(N[Power[N[(a * N[Sin[N[(N[(angle$95$m * Pi), $MachinePrecision] / 180.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[(N[(N[Sqrt[N[Power[N[Cos[N[(N[(angle$95$m * Pi), $MachinePrecision] * 0.005555555555555556 + 1.0), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision] * N[Cos[1.0], $MachinePrecision]), $MachinePrecision] + N[(N[Sin[N[(1.0 + N[(N[(angle$95$m * Pi), $MachinePrecision] * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sin[1.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{\left(a \cdot \sin \left(\frac{angle\_m \cdot \pi}{180}\right)\right)}^{2} + {\left(b \cdot \left(\sqrt{{\cos \left(\mathsf{fma}\left(angle\_m \cdot \pi, 0.005555555555555556, 1\right)\right)}^{2}} \cdot \cos 1 + \sin \left(1 + \left(angle\_m \cdot \pi\right) \cdot 0.005555555555555556\right) \cdot \sin 1\right)\right)}^{2}
\end{array}
Initial program 78.9%
associate-*l/78.9%
Applied egg-rr78.9%
associate-*l/79.0%
div-inv79.0%
metadata-eval79.0%
*-commutative79.0%
associate-*r*79.0%
expm1-log1p-u62.9%
expm1-undefine62.9%
cos-diff62.8%
Applied egg-rr79.1%
add-sqr-sqrt66.8%
sqrt-unprod79.1%
pow279.1%
*-commutative79.1%
fma-define79.1%
Applied egg-rr79.1%
Final simplification79.1%
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
:precision binary64
(+
(pow (* a (sin (/ (* angle_m PI) 180.0))) 2.0)
(pow
(*
b
(+
(* (sin (+ 1.0 (* (* angle_m PI) 0.005555555555555556))) (sin 1.0))
(* (cos 1.0) (fabs (cos (fma angle_m (* PI 0.005555555555555556) 1.0))))))
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 * ((sin((1.0 + ((angle_m * ((double) M_PI)) * 0.005555555555555556))) * sin(1.0)) + (cos(1.0) * fabs(cos(fma(angle_m, (((double) M_PI) * 0.005555555555555556), 1.0)))))), 2.0);
}
angle_m = abs(angle) function code(a, b, angle_m) return Float64((Float64(a * sin(Float64(Float64(angle_m * pi) / 180.0))) ^ 2.0) + (Float64(b * Float64(Float64(sin(Float64(1.0 + Float64(Float64(angle_m * pi) * 0.005555555555555556))) * sin(1.0)) + Float64(cos(1.0) * abs(cos(fma(angle_m, Float64(pi * 0.005555555555555556), 1.0)))))) ^ 2.0)) end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(N[Power[N[(a * N[Sin[N[(N[(angle$95$m * Pi), $MachinePrecision] / 180.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[(N[(N[Sin[N[(1.0 + N[(N[(angle$95$m * Pi), $MachinePrecision] * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sin[1.0], $MachinePrecision]), $MachinePrecision] + N[(N[Cos[1.0], $MachinePrecision] * N[Abs[N[Cos[N[(angle$95$m * N[(Pi * 0.005555555555555556), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{\left(a \cdot \sin \left(\frac{angle\_m \cdot \pi}{180}\right)\right)}^{2} + {\left(b \cdot \left(\sin \left(1 + \left(angle\_m \cdot \pi\right) \cdot 0.005555555555555556\right) \cdot \sin 1 + \cos 1 \cdot \left|\cos \left(\mathsf{fma}\left(angle\_m, \pi \cdot 0.005555555555555556, 1\right)\right)\right|\right)\right)}^{2}
\end{array}
Initial program 78.9%
associate-*l/78.9%
Applied egg-rr78.9%
associate-*l/79.0%
div-inv79.0%
metadata-eval79.0%
*-commutative79.0%
associate-*r*79.0%
expm1-log1p-u62.9%
expm1-undefine62.9%
cos-diff62.8%
Applied egg-rr79.1%
add-sqr-sqrt66.8%
sqrt-unprod79.1%
pow279.1%
*-commutative79.1%
fma-define79.1%
Applied egg-rr79.1%
add-sqr-sqrt79.1%
sqrt-prod79.1%
rem-sqrt-square79.1%
sqrt-pow179.1%
metadata-eval79.1%
pow179.1%
fma-undefine79.1%
associate-*r*79.1%
metadata-eval79.1%
div-inv79.1%
fma-define79.1%
div-inv79.1%
metadata-eval79.1%
Applied egg-rr79.1%
Final simplification79.1%
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
:precision binary64
(+
(pow (* a (sin (/ (* angle_m PI) 180.0))) 2.0)
(pow
(*
b
(+
(* (cos 1.0) (cos (+ 1.0 (* (* angle_m PI) 0.005555555555555556))))
(* (sin 1.0) (sin (fma angle_m (* PI 0.005555555555555556) 1.0)))))
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 * ((cos(1.0) * cos((1.0 + ((angle_m * ((double) M_PI)) * 0.005555555555555556)))) + (sin(1.0) * sin(fma(angle_m, (((double) M_PI) * 0.005555555555555556), 1.0))))), 2.0);
}
angle_m = abs(angle) function code(a, b, angle_m) return Float64((Float64(a * sin(Float64(Float64(angle_m * pi) / 180.0))) ^ 2.0) + (Float64(b * Float64(Float64(cos(1.0) * cos(Float64(1.0 + Float64(Float64(angle_m * pi) * 0.005555555555555556)))) + Float64(sin(1.0) * sin(fma(angle_m, Float64(pi * 0.005555555555555556), 1.0))))) ^ 2.0)) end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(N[Power[N[(a * N[Sin[N[(N[(angle$95$m * Pi), $MachinePrecision] / 180.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[(N[(N[Cos[1.0], $MachinePrecision] * N[Cos[N[(1.0 + N[(N[(angle$95$m * Pi), $MachinePrecision] * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Sin[1.0], $MachinePrecision] * N[Sin[N[(angle$95$m * N[(Pi * 0.005555555555555556), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
{\left(a \cdot \sin \left(\frac{angle\_m \cdot \pi}{180}\right)\right)}^{2} + {\left(b \cdot \left(\cos 1 \cdot \cos \left(1 + \left(angle\_m \cdot \pi\right) \cdot 0.005555555555555556\right) + \sin 1 \cdot \sin \left(\mathsf{fma}\left(angle\_m, \pi \cdot 0.005555555555555556, 1\right)\right)\right)\right)}^{2}
\end{array}
Initial program 78.9%
associate-*l/78.9%
Applied egg-rr78.9%
associate-*l/79.0%
div-inv79.0%
metadata-eval79.0%
*-commutative79.0%
associate-*r*79.0%
expm1-log1p-u62.9%
expm1-undefine62.9%
cos-diff62.8%
Applied egg-rr79.1%
Taylor expanded in angle around inf 79.1%
+-commutative79.1%
*-commutative79.1%
associate-*r*79.1%
*-commutative79.1%
fma-define79.1%
Simplified79.1%
Final simplification79.1%
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
:precision binary64
(let* ((t_0 (+ 1.0 (* (* angle_m PI) 0.005555555555555556))))
(+
(pow (* a (sin (/ (* angle_m PI) 180.0))) 2.0)
(pow (* b (+ (* (sin t_0) (sin 1.0)) (* (cos 1.0) (cos t_0)))) 2.0))))angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double t_0 = 1.0 + ((angle_m * ((double) M_PI)) * 0.005555555555555556);
return pow((a * sin(((angle_m * ((double) M_PI)) / 180.0))), 2.0) + pow((b * ((sin(t_0) * sin(1.0)) + (cos(1.0) * cos(t_0)))), 2.0);
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double t_0 = 1.0 + ((angle_m * Math.PI) * 0.005555555555555556);
return Math.pow((a * Math.sin(((angle_m * Math.PI) / 180.0))), 2.0) + Math.pow((b * ((Math.sin(t_0) * Math.sin(1.0)) + (Math.cos(1.0) * Math.cos(t_0)))), 2.0);
}
angle_m = math.fabs(angle) def code(a, b, angle_m): t_0 = 1.0 + ((angle_m * math.pi) * 0.005555555555555556) return math.pow((a * math.sin(((angle_m * math.pi) / 180.0))), 2.0) + math.pow((b * ((math.sin(t_0) * math.sin(1.0)) + (math.cos(1.0) * math.cos(t_0)))), 2.0)
angle_m = abs(angle) function code(a, b, angle_m) t_0 = Float64(1.0 + Float64(Float64(angle_m * pi) * 0.005555555555555556)) return Float64((Float64(a * sin(Float64(Float64(angle_m * pi) / 180.0))) ^ 2.0) + (Float64(b * Float64(Float64(sin(t_0) * sin(1.0)) + Float64(cos(1.0) * cos(t_0)))) ^ 2.0)) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) t_0 = 1.0 + ((angle_m * pi) * 0.005555555555555556); tmp = ((a * sin(((angle_m * pi) / 180.0))) ^ 2.0) + ((b * ((sin(t_0) * sin(1.0)) + (cos(1.0) * cos(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[(N[(angle$95$m * Pi), $MachinePrecision] * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]}, N[(N[Power[N[(a * N[Sin[N[(N[(angle$95$m * Pi), $MachinePrecision] / 180.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[(N[(N[Sin[t$95$0], $MachinePrecision] * N[Sin[1.0], $MachinePrecision]), $MachinePrecision] + N[(N[Cos[1.0], $MachinePrecision] * N[Cos[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 + \left(angle\_m \cdot \pi\right) \cdot 0.005555555555555556\\
{\left(a \cdot \sin \left(\frac{angle\_m \cdot \pi}{180}\right)\right)}^{2} + {\left(b \cdot \left(\sin t\_0 \cdot \sin 1 + \cos 1 \cdot \cos t\_0\right)\right)}^{2}
\end{array}
\end{array}
Initial program 78.9%
associate-*l/78.9%
Applied egg-rr78.9%
associate-*l/79.0%
div-inv79.0%
metadata-eval79.0%
*-commutative79.0%
associate-*r*79.0%
expm1-log1p-u62.9%
expm1-undefine62.9%
cos-diff62.8%
Applied egg-rr79.1%
Final simplification79.1%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow (* a (sin (expm1 (log1p (* PI (* angle_m 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((((double) M_PI) * (angle_m * 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((Math.PI * (angle_m * 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((math.pi * (angle_m * 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(pi * Float64(angle_m * 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[(Pi * N[(angle$95$m * 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(\pi \cdot \left(angle\_m \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 78.9%
expm1-log1p-u62.9%
expm1-undefine52.4%
associate-*l/52.4%
associate-*r/52.4%
div-inv52.4%
metadata-eval52.4%
Applied egg-rr52.4%
expm1-define62.9%
associate-*r*62.9%
*-commutative62.9%
associate-*r*62.9%
Simplified62.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 78.9%
unpow278.9%
associate-*l/78.9%
associate-/l*79.0%
unpow279.0%
Simplified78.9%
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 78.9%
unpow278.9%
associate-*l/78.9%
associate-/l*79.0%
unpow279.0%
Simplified78.9%
Taylor expanded in angle around 0 78.9%
Final simplification78.9%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (if (<= a 7.5e+156) (* b b) (pow (* a (sin (* angle_m (* PI 0.005555555555555556)))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if (a <= 7.5e+156) {
tmp = b * b;
} else {
tmp = pow((a * sin((angle_m * (((double) M_PI) * 0.005555555555555556)))), 2.0);
}
return tmp;
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double tmp;
if (a <= 7.5e+156) {
tmp = b * b;
} else {
tmp = Math.pow((a * Math.sin((angle_m * (Math.PI * 0.005555555555555556)))), 2.0);
}
return tmp;
}
angle_m = math.fabs(angle) def code(a, b, angle_m): tmp = 0 if a <= 7.5e+156: tmp = b * b else: tmp = math.pow((a * math.sin((angle_m * (math.pi * 0.005555555555555556)))), 2.0) return tmp
angle_m = abs(angle) function code(a, b, angle_m) tmp = 0.0 if (a <= 7.5e+156) tmp = Float64(b * b); else tmp = Float64(a * sin(Float64(angle_m * Float64(pi * 0.005555555555555556)))) ^ 2.0; end return tmp end
angle_m = abs(angle); function tmp_2 = code(a, b, angle_m) tmp = 0.0; if (a <= 7.5e+156) tmp = b * b; else tmp = (a * sin((angle_m * (pi * 0.005555555555555556)))) ^ 2.0; end tmp_2 = tmp; end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := If[LessEqual[a, 7.5e+156], N[(b * b), $MachinePrecision], N[Power[N[(a * N[Sin[N[(angle$95$m * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
\mathbf{if}\;a \leq 7.5 \cdot 10^{+156}:\\
\;\;\;\;b \cdot b\\
\mathbf{else}:\\
\;\;\;\;{\left(a \cdot \sin \left(angle\_m \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)}^{2}\\
\end{array}
\end{array}
if a < 7.50000000000000026e156Initial program 75.5%
unpow275.5%
associate-*l/75.6%
associate-/l*75.6%
unpow275.6%
Simplified75.6%
Taylor expanded in angle around 0 59.3%
unpow259.3%
Applied egg-rr59.3%
if 7.50000000000000026e156 < a Initial program 99.4%
unpow299.4%
associate-*l/99.4%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
associate-*r/99.4%
associate-*l/99.4%
unpow299.4%
*-commutative99.4%
associate-*r*96.9%
Applied egg-rr97.1%
Taylor expanded in a around inf 56.5%
unpow256.5%
*-commutative56.5%
*-commutative56.5%
associate-*r*56.5%
unpow256.5%
swap-sqr81.3%
unpow281.3%
Simplified81.4%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (if (<= a 1.3e+157) (* b b) (pow (* a (sin (* (* angle_m PI) 0.005555555555555556))) 2.0)))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
double tmp;
if (a <= 1.3e+157) {
tmp = b * b;
} else {
tmp = pow((a * sin(((angle_m * ((double) M_PI)) * 0.005555555555555556))), 2.0);
}
return tmp;
}
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
double tmp;
if (a <= 1.3e+157) {
tmp = b * b;
} else {
tmp = Math.pow((a * Math.sin(((angle_m * Math.PI) * 0.005555555555555556))), 2.0);
}
return tmp;
}
angle_m = math.fabs(angle) def code(a, b, angle_m): tmp = 0 if a <= 1.3e+157: tmp = b * b else: tmp = math.pow((a * math.sin(((angle_m * math.pi) * 0.005555555555555556))), 2.0) return tmp
angle_m = abs(angle) function code(a, b, angle_m) tmp = 0.0 if (a <= 1.3e+157) tmp = Float64(b * b); else tmp = Float64(a * sin(Float64(Float64(angle_m * pi) * 0.005555555555555556))) ^ 2.0; end return tmp end
angle_m = abs(angle); function tmp_2 = code(a, b, angle_m) tmp = 0.0; if (a <= 1.3e+157) tmp = b * b; else tmp = (a * sin(((angle_m * pi) * 0.005555555555555556))) ^ 2.0; end tmp_2 = tmp; end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := If[LessEqual[a, 1.3e+157], N[(b * b), $MachinePrecision], N[Power[N[(a * N[Sin[N[(N[(angle$95$m * Pi), $MachinePrecision] * 0.005555555555555556), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]]
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
\mathbf{if}\;a \leq 1.3 \cdot 10^{+157}:\\
\;\;\;\;b \cdot b\\
\mathbf{else}:\\
\;\;\;\;{\left(a \cdot \sin \left(\left(angle\_m \cdot \pi\right) \cdot 0.005555555555555556\right)\right)}^{2}\\
\end{array}
\end{array}
if a < 1.30000000000000005e157Initial program 75.5%
unpow275.5%
associate-*l/75.6%
associate-/l*75.6%
unpow275.6%
Simplified75.6%
Taylor expanded in angle around 0 59.3%
unpow259.3%
Applied egg-rr59.3%
if 1.30000000000000005e157 < a Initial program 99.4%
unpow299.4%
associate-*l/99.4%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in a around inf 56.5%
unpow256.5%
*-commutative56.5%
associate-*r*56.5%
unpow256.5%
swap-sqr81.4%
unpow281.4%
associate-*r*81.4%
*-commutative81.4%
Simplified81.4%
Final simplification62.4%
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 78.9%
unpow278.9%
associate-*l/78.9%
associate-/l*79.0%
unpow279.0%
Simplified78.9%
Taylor expanded in angle around 0 55.2%
unpow255.2%
Applied egg-rr55.2%
herbie shell --seed 2024170
(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)))