
(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 11 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}
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (* (/ angle 180.0) PI))) 2.0) (pow b 2.0)))
double code(double a, double b, double angle) {
return pow((a * sin(((angle / 180.0) * ((double) M_PI)))), 2.0) + pow(b, 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.sin(((angle / 180.0) * Math.PI))), 2.0) + Math.pow(b, 2.0);
}
def code(a, b, angle): return math.pow((a * math.sin(((angle / 180.0) * math.pi))), 2.0) + math.pow(b, 2.0)
function code(a, b, angle) return Float64((Float64(a * sin(Float64(Float64(angle / 180.0) * pi))) ^ 2.0) + (b ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((a * sin(((angle / 180.0) * pi))) ^ 2.0) + (b ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Sin[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {b}^{2}
\end{array}
Initial program 78.4%
associate-*l/78.3%
associate-/l*78.4%
associate-*l/78.3%
associate-/l*78.4%
Simplified78.4%
Taylor expanded in angle around 0 78.8%
clear-num78.8%
un-div-inv78.7%
Applied egg-rr78.7%
associate-/r/78.8%
Simplified78.8%
Final simplification78.8%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* angle (* 0.005555555555555556 (* a PI)))))
(if (<= a 7.5e-171)
(+ (sqrt (pow t_0 4.0)) (pow b 2.0))
(+
(* 0.005555555555555556 (* t_0 (* angle (* a PI))))
(pow (* b (cos (* angle (/ PI 180.0)))) 2.0)))))
double code(double a, double b, double angle) {
double t_0 = angle * (0.005555555555555556 * (a * ((double) M_PI)));
double tmp;
if (a <= 7.5e-171) {
tmp = sqrt(pow(t_0, 4.0)) + pow(b, 2.0);
} else {
tmp = (0.005555555555555556 * (t_0 * (angle * (a * ((double) M_PI))))) + pow((b * cos((angle * (((double) M_PI) / 180.0)))), 2.0);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double t_0 = angle * (0.005555555555555556 * (a * Math.PI));
double tmp;
if (a <= 7.5e-171) {
tmp = Math.sqrt(Math.pow(t_0, 4.0)) + Math.pow(b, 2.0);
} else {
tmp = (0.005555555555555556 * (t_0 * (angle * (a * Math.PI)))) + Math.pow((b * Math.cos((angle * (Math.PI / 180.0)))), 2.0);
}
return tmp;
}
def code(a, b, angle): t_0 = angle * (0.005555555555555556 * (a * math.pi)) tmp = 0 if a <= 7.5e-171: tmp = math.sqrt(math.pow(t_0, 4.0)) + math.pow(b, 2.0) else: tmp = (0.005555555555555556 * (t_0 * (angle * (a * math.pi)))) + math.pow((b * math.cos((angle * (math.pi / 180.0)))), 2.0) return tmp
function code(a, b, angle) t_0 = Float64(angle * Float64(0.005555555555555556 * Float64(a * pi))) tmp = 0.0 if (a <= 7.5e-171) tmp = Float64(sqrt((t_0 ^ 4.0)) + (b ^ 2.0)); else tmp = Float64(Float64(0.005555555555555556 * Float64(t_0 * Float64(angle * Float64(a * pi)))) + (Float64(b * cos(Float64(angle * Float64(pi / 180.0)))) ^ 2.0)); end return tmp end
function tmp_2 = code(a, b, angle) t_0 = angle * (0.005555555555555556 * (a * pi)); tmp = 0.0; if (a <= 7.5e-171) tmp = sqrt((t_0 ^ 4.0)) + (b ^ 2.0); else tmp = (0.005555555555555556 * (t_0 * (angle * (a * pi)))) + ((b * cos((angle * (pi / 180.0)))) ^ 2.0); end tmp_2 = tmp; end
code[a_, b_, angle_] := Block[{t$95$0 = N[(angle * N[(0.005555555555555556 * N[(a * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, 7.5e-171], N[(N[Sqrt[N[Power[t$95$0, 4.0], $MachinePrecision]], $MachinePrecision] + N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision], N[(N[(0.005555555555555556 * N[(t$95$0 * N[(angle * N[(a * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Power[N[(b * N[Cos[N[(angle * N[(Pi / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := angle \cdot \left(0.005555555555555556 \cdot \left(a \cdot \pi\right)\right)\\
\mathbf{if}\;a \leq 7.5 \cdot 10^{-171}:\\
\;\;\;\;\sqrt{{t\_0}^{4}} + {b}^{2}\\
\mathbf{else}:\\
\;\;\;\;0.005555555555555556 \cdot \left(t\_0 \cdot \left(angle \cdot \left(a \cdot \pi\right)\right)\right) + {\left(b \cdot \cos \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2}\\
\end{array}
\end{array}
if a < 7.50000000000000033e-171Initial program 78.6%
associate-*l/78.6%
associate-/l*78.6%
associate-*l/78.5%
associate-/l*78.6%
Simplified78.6%
Taylor expanded in angle around 0 72.3%
*-commutative72.3%
associate-*l*72.3%
Simplified72.3%
Taylor expanded in angle around 0 73.2%
add-sqr-sqrt73.2%
sqrt-unprod73.3%
pow-prod-up73.3%
*-commutative73.3%
associate-*l*73.2%
metadata-eval73.2%
Applied egg-rr73.2%
if 7.50000000000000033e-171 < a Initial program 78.0%
associate-*l/77.8%
associate-/l*78.0%
associate-*l/78.0%
associate-/l*78.1%
Simplified78.1%
Taylor expanded in angle around 0 74.5%
*-commutative74.5%
associate-*l*74.5%
Simplified74.5%
unpow273.9%
*-commutative73.9%
associate-*r*73.9%
*-commutative73.9%
associate-*l*73.9%
Applied egg-rr74.5%
Final simplification73.7%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (* 0.005555555555555556 (* angle PI)))) 2.0) (pow b 2.0)))
double code(double a, double b, double angle) {
return pow((a * sin((0.005555555555555556 * (angle * ((double) M_PI))))), 2.0) + pow(b, 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.sin((0.005555555555555556 * (angle * Math.PI)))), 2.0) + Math.pow(b, 2.0);
}
def code(a, b, angle): return math.pow((a * math.sin((0.005555555555555556 * (angle * math.pi)))), 2.0) + math.pow(b, 2.0)
function code(a, b, angle) return Float64((Float64(a * sin(Float64(0.005555555555555556 * Float64(angle * pi)))) ^ 2.0) + (b ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((a * sin((0.005555555555555556 * (angle * pi)))) ^ 2.0) + (b ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Sin[N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2} + {b}^{2}
\end{array}
Initial program 78.4%
associate-*l/78.3%
associate-/l*78.4%
associate-*l/78.3%
associate-/l*78.4%
Simplified78.4%
Taylor expanded in angle around 0 78.8%
Taylor expanded in angle around 0 78.7%
Final simplification78.7%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (* angle (/ PI 180.0)))) 2.0) (pow b 2.0)))
double code(double a, double b, double angle) {
return pow((a * sin((angle * (((double) M_PI) / 180.0)))), 2.0) + pow(b, 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.sin((angle * (Math.PI / 180.0)))), 2.0) + Math.pow(b, 2.0);
}
def code(a, b, angle): return math.pow((a * math.sin((angle * (math.pi / 180.0)))), 2.0) + math.pow(b, 2.0)
function code(a, b, angle) return Float64((Float64(a * sin(Float64(angle * Float64(pi / 180.0)))) ^ 2.0) + (b ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((a * sin((angle * (pi / 180.0)))) ^ 2.0) + (b ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Sin[N[(angle * N[(Pi / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {b}^{2}
\end{array}
Initial program 78.4%
associate-*l/78.3%
associate-/l*78.4%
associate-*l/78.3%
associate-/l*78.4%
Simplified78.4%
Taylor expanded in angle around 0 78.8%
Final simplification78.8%
(FPCore (a b angle)
:precision binary64
(if (<= angle 1.15e+20)
(+
(pow (* b (cos (* angle (/ PI 180.0)))) 2.0)
(*
(* angle (* a PI))
(* 0.005555555555555556 (* angle (* 0.005555555555555556 (* a PI))))))
(+
(pow b 2.0)
(*
(* angle 0.005555555555555556)
(* (* a PI) (* 0.005555555555555556 (* PI (* a angle))))))))
double code(double a, double b, double angle) {
double tmp;
if (angle <= 1.15e+20) {
tmp = pow((b * cos((angle * (((double) M_PI) / 180.0)))), 2.0) + ((angle * (a * ((double) M_PI))) * (0.005555555555555556 * (angle * (0.005555555555555556 * (a * ((double) M_PI))))));
} else {
tmp = pow(b, 2.0) + ((angle * 0.005555555555555556) * ((a * ((double) M_PI)) * (0.005555555555555556 * (((double) M_PI) * (a * angle)))));
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (angle <= 1.15e+20) {
tmp = Math.pow((b * Math.cos((angle * (Math.PI / 180.0)))), 2.0) + ((angle * (a * Math.PI)) * (0.005555555555555556 * (angle * (0.005555555555555556 * (a * Math.PI)))));
} else {
tmp = Math.pow(b, 2.0) + ((angle * 0.005555555555555556) * ((a * Math.PI) * (0.005555555555555556 * (Math.PI * (a * angle)))));
}
return tmp;
}
def code(a, b, angle): tmp = 0 if angle <= 1.15e+20: tmp = math.pow((b * math.cos((angle * (math.pi / 180.0)))), 2.0) + ((angle * (a * math.pi)) * (0.005555555555555556 * (angle * (0.005555555555555556 * (a * math.pi))))) else: tmp = math.pow(b, 2.0) + ((angle * 0.005555555555555556) * ((a * math.pi) * (0.005555555555555556 * (math.pi * (a * angle))))) return tmp
function code(a, b, angle) tmp = 0.0 if (angle <= 1.15e+20) tmp = Float64((Float64(b * cos(Float64(angle * Float64(pi / 180.0)))) ^ 2.0) + Float64(Float64(angle * Float64(a * pi)) * Float64(0.005555555555555556 * Float64(angle * Float64(0.005555555555555556 * Float64(a * pi)))))); else tmp = Float64((b ^ 2.0) + Float64(Float64(angle * 0.005555555555555556) * Float64(Float64(a * pi) * Float64(0.005555555555555556 * Float64(pi * Float64(a * angle)))))); end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (angle <= 1.15e+20) tmp = ((b * cos((angle * (pi / 180.0)))) ^ 2.0) + ((angle * (a * pi)) * (0.005555555555555556 * (angle * (0.005555555555555556 * (a * pi))))); else tmp = (b ^ 2.0) + ((angle * 0.005555555555555556) * ((a * pi) * (0.005555555555555556 * (pi * (a * angle))))); end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[angle, 1.15e+20], N[(N[Power[N[(b * N[Cos[N[(angle * N[(Pi / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(N[(angle * N[(a * Pi), $MachinePrecision]), $MachinePrecision] * N[(0.005555555555555556 * N[(angle * N[(0.005555555555555556 * N[(a * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[b, 2.0], $MachinePrecision] + N[(N[(angle * 0.005555555555555556), $MachinePrecision] * N[(N[(a * Pi), $MachinePrecision] * N[(0.005555555555555556 * N[(Pi * N[(a * angle), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;angle \leq 1.15 \cdot 10^{+20}:\\
\;\;\;\;{\left(b \cdot \cos \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + \left(angle \cdot \left(a \cdot \pi\right)\right) \cdot \left(0.005555555555555556 \cdot \left(angle \cdot \left(0.005555555555555556 \cdot \left(a \cdot \pi\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;{b}^{2} + \left(angle \cdot 0.005555555555555556\right) \cdot \left(\left(a \cdot \pi\right) \cdot \left(0.005555555555555556 \cdot \left(\pi \cdot \left(a \cdot angle\right)\right)\right)\right)\\
\end{array}
\end{array}
if angle < 1.15e20Initial program 85.2%
associate-*l/85.1%
associate-/l*85.1%
associate-*l/85.1%
associate-/l*85.2%
Simplified85.2%
Taylor expanded in angle around 0 83.5%
*-commutative83.5%
associate-*l*83.5%
Simplified83.5%
unpow283.5%
associate-*r*83.5%
*-commutative83.5%
associate-*l*83.5%
Applied egg-rr83.5%
if 1.15e20 < angle Initial program 58.3%
associate-*l/58.3%
associate-/l*58.4%
associate-*l/58.5%
associate-/l*58.4%
Simplified58.4%
Taylor expanded in angle around 0 42.7%
*-commutative42.7%
associate-*l*42.7%
Simplified42.7%
Taylor expanded in angle around 0 43.9%
unpow243.9%
associate-*r*43.9%
associate-*l*49.6%
*-commutative49.6%
*-commutative49.6%
associate-*l*49.6%
Applied egg-rr49.6%
Taylor expanded in angle around 0 49.6%
associate-*r*49.6%
Simplified49.6%
Final simplification74.9%
(FPCore (a b angle)
:precision binary64
(if (<= angle 4e+18)
(+
(*
0.005555555555555556
(* (* angle (* 0.005555555555555556 (* a PI))) (* angle (* a PI))))
(pow (* b (cos (* angle (/ PI 180.0)))) 2.0))
(+
(pow b 2.0)
(*
(* angle 0.005555555555555556)
(* (* a PI) (* 0.005555555555555556 (* PI (* a angle))))))))
double code(double a, double b, double angle) {
double tmp;
if (angle <= 4e+18) {
tmp = (0.005555555555555556 * ((angle * (0.005555555555555556 * (a * ((double) M_PI)))) * (angle * (a * ((double) M_PI))))) + pow((b * cos((angle * (((double) M_PI) / 180.0)))), 2.0);
} else {
tmp = pow(b, 2.0) + ((angle * 0.005555555555555556) * ((a * ((double) M_PI)) * (0.005555555555555556 * (((double) M_PI) * (a * angle)))));
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (angle <= 4e+18) {
tmp = (0.005555555555555556 * ((angle * (0.005555555555555556 * (a * Math.PI))) * (angle * (a * Math.PI)))) + Math.pow((b * Math.cos((angle * (Math.PI / 180.0)))), 2.0);
} else {
tmp = Math.pow(b, 2.0) + ((angle * 0.005555555555555556) * ((a * Math.PI) * (0.005555555555555556 * (Math.PI * (a * angle)))));
}
return tmp;
}
def code(a, b, angle): tmp = 0 if angle <= 4e+18: tmp = (0.005555555555555556 * ((angle * (0.005555555555555556 * (a * math.pi))) * (angle * (a * math.pi)))) + math.pow((b * math.cos((angle * (math.pi / 180.0)))), 2.0) else: tmp = math.pow(b, 2.0) + ((angle * 0.005555555555555556) * ((a * math.pi) * (0.005555555555555556 * (math.pi * (a * angle))))) return tmp
function code(a, b, angle) tmp = 0.0 if (angle <= 4e+18) tmp = Float64(Float64(0.005555555555555556 * Float64(Float64(angle * Float64(0.005555555555555556 * Float64(a * pi))) * Float64(angle * Float64(a * pi)))) + (Float64(b * cos(Float64(angle * Float64(pi / 180.0)))) ^ 2.0)); else tmp = Float64((b ^ 2.0) + Float64(Float64(angle * 0.005555555555555556) * Float64(Float64(a * pi) * Float64(0.005555555555555556 * Float64(pi * Float64(a * angle)))))); end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (angle <= 4e+18) tmp = (0.005555555555555556 * ((angle * (0.005555555555555556 * (a * pi))) * (angle * (a * pi)))) + ((b * cos((angle * (pi / 180.0)))) ^ 2.0); else tmp = (b ^ 2.0) + ((angle * 0.005555555555555556) * ((a * pi) * (0.005555555555555556 * (pi * (a * angle))))); end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[angle, 4e+18], N[(N[(0.005555555555555556 * N[(N[(angle * N[(0.005555555555555556 * N[(a * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(angle * N[(a * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Power[N[(b * N[Cos[N[(angle * N[(Pi / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], N[(N[Power[b, 2.0], $MachinePrecision] + N[(N[(angle * 0.005555555555555556), $MachinePrecision] * N[(N[(a * Pi), $MachinePrecision] * N[(0.005555555555555556 * N[(Pi * N[(a * angle), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;angle \leq 4 \cdot 10^{+18}:\\
\;\;\;\;0.005555555555555556 \cdot \left(\left(angle \cdot \left(0.005555555555555556 \cdot \left(a \cdot \pi\right)\right)\right) \cdot \left(angle \cdot \left(a \cdot \pi\right)\right)\right) + {\left(b \cdot \cos \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;{b}^{2} + \left(angle \cdot 0.005555555555555556\right) \cdot \left(\left(a \cdot \pi\right) \cdot \left(0.005555555555555556 \cdot \left(\pi \cdot \left(a \cdot angle\right)\right)\right)\right)\\
\end{array}
\end{array}
if angle < 4e18Initial program 85.2%
associate-*l/85.1%
associate-/l*85.1%
associate-*l/85.1%
associate-/l*85.2%
Simplified85.2%
Taylor expanded in angle around 0 83.5%
*-commutative83.5%
associate-*l*83.5%
Simplified83.5%
unpow283.5%
*-commutative83.5%
associate-*r*83.5%
*-commutative83.5%
associate-*l*83.5%
Applied egg-rr83.5%
if 4e18 < angle Initial program 58.3%
associate-*l/58.3%
associate-/l*58.4%
associate-*l/58.5%
associate-/l*58.4%
Simplified58.4%
Taylor expanded in angle around 0 42.7%
*-commutative42.7%
associate-*l*42.7%
Simplified42.7%
Taylor expanded in angle around 0 43.9%
unpow243.9%
associate-*r*43.9%
associate-*l*49.6%
*-commutative49.6%
*-commutative49.6%
associate-*l*49.6%
Applied egg-rr49.6%
Taylor expanded in angle around 0 49.6%
associate-*r*49.6%
Simplified49.6%
Final simplification74.9%
(FPCore (a b angle) :precision binary64 (+ (pow b 2.0) (pow (* 0.005555555555555556 (* angle (* a PI))) 2.0)))
double code(double a, double b, double angle) {
return pow(b, 2.0) + pow((0.005555555555555556 * (angle * (a * ((double) M_PI)))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow(b, 2.0) + Math.pow((0.005555555555555556 * (angle * (a * Math.PI))), 2.0);
}
def code(a, b, angle): return math.pow(b, 2.0) + math.pow((0.005555555555555556 * (angle * (a * math.pi))), 2.0)
function code(a, b, angle) return Float64((b ^ 2.0) + (Float64(0.005555555555555556 * Float64(angle * Float64(a * pi))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = (b ^ 2.0) + ((0.005555555555555556 * (angle * (a * pi))) ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[b, 2.0], $MachinePrecision] + N[Power[N[(0.005555555555555556 * N[(angle * N[(a * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{b}^{2} + {\left(0.005555555555555556 \cdot \left(angle \cdot \left(a \cdot \pi\right)\right)\right)}^{2}
\end{array}
Initial program 78.4%
associate-*l/78.3%
associate-/l*78.4%
associate-*l/78.3%
associate-/l*78.4%
Simplified78.4%
Taylor expanded in angle around 0 73.2%
*-commutative73.2%
associate-*l*73.2%
Simplified73.2%
Taylor expanded in angle around 0 73.5%
Final simplification73.5%
(FPCore (a b angle) :precision binary64 (+ (pow b 2.0) (* (* angle 0.005555555555555556) (* (* a PI) (* 0.005555555555555556 (* a (* angle PI)))))))
double code(double a, double b, double angle) {
return pow(b, 2.0) + ((angle * 0.005555555555555556) * ((a * ((double) M_PI)) * (0.005555555555555556 * (a * (angle * ((double) M_PI))))));
}
public static double code(double a, double b, double angle) {
return Math.pow(b, 2.0) + ((angle * 0.005555555555555556) * ((a * Math.PI) * (0.005555555555555556 * (a * (angle * Math.PI)))));
}
def code(a, b, angle): return math.pow(b, 2.0) + ((angle * 0.005555555555555556) * ((a * math.pi) * (0.005555555555555556 * (a * (angle * math.pi)))))
function code(a, b, angle) return Float64((b ^ 2.0) + Float64(Float64(angle * 0.005555555555555556) * Float64(Float64(a * pi) * Float64(0.005555555555555556 * Float64(a * Float64(angle * pi)))))) end
function tmp = code(a, b, angle) tmp = (b ^ 2.0) + ((angle * 0.005555555555555556) * ((a * pi) * (0.005555555555555556 * (a * (angle * pi))))); end
code[a_, b_, angle_] := N[(N[Power[b, 2.0], $MachinePrecision] + N[(N[(angle * 0.005555555555555556), $MachinePrecision] * N[(N[(a * Pi), $MachinePrecision] * N[(0.005555555555555556 * N[(a * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{b}^{2} + \left(angle \cdot 0.005555555555555556\right) \cdot \left(\left(a \cdot \pi\right) \cdot \left(0.005555555555555556 \cdot \left(a \cdot \left(angle \cdot \pi\right)\right)\right)\right)
\end{array}
Initial program 78.4%
associate-*l/78.3%
associate-/l*78.4%
associate-*l/78.3%
associate-/l*78.4%
Simplified78.4%
Taylor expanded in angle around 0 73.2%
*-commutative73.2%
associate-*l*73.2%
Simplified73.2%
Taylor expanded in angle around 0 73.5%
unpow273.5%
associate-*r*73.5%
associate-*l*72.8%
*-commutative72.8%
*-commutative72.8%
associate-*l*72.7%
Applied egg-rr72.7%
Taylor expanded in angle around 0 72.7%
Final simplification72.7%
(FPCore (a b angle) :precision binary64 (+ (pow b 2.0) (* (* angle 0.005555555555555556) (* (* a PI) (* 0.005555555555555556 (* PI (* a angle)))))))
double code(double a, double b, double angle) {
return pow(b, 2.0) + ((angle * 0.005555555555555556) * ((a * ((double) M_PI)) * (0.005555555555555556 * (((double) M_PI) * (a * angle)))));
}
public static double code(double a, double b, double angle) {
return Math.pow(b, 2.0) + ((angle * 0.005555555555555556) * ((a * Math.PI) * (0.005555555555555556 * (Math.PI * (a * angle)))));
}
def code(a, b, angle): return math.pow(b, 2.0) + ((angle * 0.005555555555555556) * ((a * math.pi) * (0.005555555555555556 * (math.pi * (a * angle)))))
function code(a, b, angle) return Float64((b ^ 2.0) + Float64(Float64(angle * 0.005555555555555556) * Float64(Float64(a * pi) * Float64(0.005555555555555556 * Float64(pi * Float64(a * angle)))))) end
function tmp = code(a, b, angle) tmp = (b ^ 2.0) + ((angle * 0.005555555555555556) * ((a * pi) * (0.005555555555555556 * (pi * (a * angle))))); end
code[a_, b_, angle_] := N[(N[Power[b, 2.0], $MachinePrecision] + N[(N[(angle * 0.005555555555555556), $MachinePrecision] * N[(N[(a * Pi), $MachinePrecision] * N[(0.005555555555555556 * N[(Pi * N[(a * angle), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{b}^{2} + \left(angle \cdot 0.005555555555555556\right) \cdot \left(\left(a \cdot \pi\right) \cdot \left(0.005555555555555556 \cdot \left(\pi \cdot \left(a \cdot angle\right)\right)\right)\right)
\end{array}
Initial program 78.4%
associate-*l/78.3%
associate-/l*78.4%
associate-*l/78.3%
associate-/l*78.4%
Simplified78.4%
Taylor expanded in angle around 0 73.2%
*-commutative73.2%
associate-*l*73.2%
Simplified73.2%
Taylor expanded in angle around 0 73.5%
unpow273.5%
associate-*r*73.5%
associate-*l*72.8%
*-commutative72.8%
*-commutative72.8%
associate-*l*72.7%
Applied egg-rr72.7%
Taylor expanded in angle around 0 72.7%
associate-*r*72.8%
Simplified72.8%
Final simplification72.8%
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* angle (* 0.005555555555555556 (* a PI))))) (+ (pow b 2.0) (* t_0 t_0))))
double code(double a, double b, double angle) {
double t_0 = angle * (0.005555555555555556 * (a * ((double) M_PI)));
return pow(b, 2.0) + (t_0 * t_0);
}
public static double code(double a, double b, double angle) {
double t_0 = angle * (0.005555555555555556 * (a * Math.PI));
return Math.pow(b, 2.0) + (t_0 * t_0);
}
def code(a, b, angle): t_0 = angle * (0.005555555555555556 * (a * math.pi)) return math.pow(b, 2.0) + (t_0 * t_0)
function code(a, b, angle) t_0 = Float64(angle * Float64(0.005555555555555556 * Float64(a * pi))) return Float64((b ^ 2.0) + Float64(t_0 * t_0)) end
function tmp = code(a, b, angle) t_0 = angle * (0.005555555555555556 * (a * pi)); tmp = (b ^ 2.0) + (t_0 * t_0); end
code[a_, b_, angle_] := Block[{t$95$0 = N[(angle * N[(0.005555555555555556 * 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}
\\
\begin{array}{l}
t_0 := angle \cdot \left(0.005555555555555556 \cdot \left(a \cdot \pi\right)\right)\\
{b}^{2} + t\_0 \cdot t\_0
\end{array}
\end{array}
Initial program 78.4%
associate-*l/78.3%
associate-/l*78.4%
associate-*l/78.3%
associate-/l*78.4%
Simplified78.4%
Taylor expanded in angle around 0 73.2%
*-commutative73.2%
associate-*l*73.2%
Simplified73.2%
Taylor expanded in angle around 0 73.5%
unpow273.5%
*-commutative73.5%
associate-*l*73.5%
*-commutative73.5%
associate-*l*73.5%
Applied egg-rr73.5%
Final simplification73.5%
(FPCore (a b angle) :precision binary64 (+ (pow b 2.0) (* 0.005555555555555556 (* (* angle (* 0.005555555555555556 (* a PI))) (* angle (* a PI))))))
double code(double a, double b, double angle) {
return pow(b, 2.0) + (0.005555555555555556 * ((angle * (0.005555555555555556 * (a * ((double) M_PI)))) * (angle * (a * ((double) M_PI)))));
}
public static double code(double a, double b, double angle) {
return Math.pow(b, 2.0) + (0.005555555555555556 * ((angle * (0.005555555555555556 * (a * Math.PI))) * (angle * (a * Math.PI))));
}
def code(a, b, angle): return math.pow(b, 2.0) + (0.005555555555555556 * ((angle * (0.005555555555555556 * (a * math.pi))) * (angle * (a * math.pi))))
function code(a, b, angle) return Float64((b ^ 2.0) + Float64(0.005555555555555556 * Float64(Float64(angle * Float64(0.005555555555555556 * Float64(a * pi))) * Float64(angle * Float64(a * pi))))) end
function tmp = code(a, b, angle) tmp = (b ^ 2.0) + (0.005555555555555556 * ((angle * (0.005555555555555556 * (a * pi))) * (angle * (a * pi)))); end
code[a_, b_, angle_] := N[(N[Power[b, 2.0], $MachinePrecision] + N[(0.005555555555555556 * N[(N[(angle * N[(0.005555555555555556 * N[(a * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(angle * N[(a * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{b}^{2} + 0.005555555555555556 \cdot \left(\left(angle \cdot \left(0.005555555555555556 \cdot \left(a \cdot \pi\right)\right)\right) \cdot \left(angle \cdot \left(a \cdot \pi\right)\right)\right)
\end{array}
Initial program 78.4%
associate-*l/78.3%
associate-/l*78.4%
associate-*l/78.3%
associate-/l*78.4%
Simplified78.4%
Taylor expanded in angle around 0 73.2%
*-commutative73.2%
associate-*l*73.2%
Simplified73.2%
Taylor expanded in angle around 0 73.5%
unpow273.5%
*-commutative73.5%
associate-*r*73.5%
*-commutative73.5%
associate-*l*73.5%
Applied egg-rr73.5%
Final simplification73.5%
herbie shell --seed 2024043
(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)))