
(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 16 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 PI) 180.0))) 2.0)
(pow
(*
b
(cos
(*
(cbrt (sqrt PI))
(* (* (sqrt PI) (* angle 0.005555555555555556)) (cbrt PI)))))
2.0)))
double code(double a, double b, double angle) {
return pow((a * sin(((angle * ((double) M_PI)) / 180.0))), 2.0) + pow((b * cos((cbrt(sqrt(((double) M_PI))) * ((sqrt(((double) M_PI)) * (angle * 0.005555555555555556)) * cbrt(((double) M_PI)))))), 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 * Math.cos((Math.cbrt(Math.sqrt(Math.PI)) * ((Math.sqrt(Math.PI) * (angle * 0.005555555555555556)) * Math.cbrt(Math.PI))))), 2.0);
}
function code(a, b, angle) return Float64((Float64(a * sin(Float64(Float64(angle * pi) / 180.0))) ^ 2.0) + (Float64(b * cos(Float64(cbrt(sqrt(pi)) * Float64(Float64(sqrt(pi) * Float64(angle * 0.005555555555555556)) * cbrt(pi))))) ^ 2.0)) end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Sin[N[(N[(angle * Pi), $MachinePrecision] / 180.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[N[(N[Power[N[Sqrt[Pi], $MachinePrecision], 1/3], $MachinePrecision] * N[(N[(N[Sqrt[Pi], $MachinePrecision] * N[(angle * 0.005555555555555556), $MachinePrecision]), $MachinePrecision] * N[Power[Pi, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \sin \left(\frac{angle \cdot \pi}{180}\right)\right)}^{2} + {\left(b \cdot \cos \left(\sqrt[3]{\sqrt{\pi}} \cdot \left(\left(\sqrt{\pi} \cdot \left(angle \cdot 0.005555555555555556\right)\right) \cdot \sqrt[3]{\pi}\right)\right)\right)}^{2}
\end{array}
Initial program 79.5%
associate-*l/79.6%
Applied egg-rr79.6%
expm1-log1p-u65.3%
expm1-undefine65.3%
associate-*l/65.3%
associate-*r/65.3%
div-inv65.3%
metadata-eval65.3%
Applied egg-rr65.3%
expm1-define65.3%
associate-*r*65.3%
*-commutative65.3%
associate-*r*65.3%
Simplified65.3%
expm1-log1p-u79.6%
*-commutative79.6%
*-commutative79.6%
metadata-eval79.6%
div-inv79.6%
clear-num79.6%
div-inv79.5%
add-sqr-sqrt79.5%
associate-*r/79.7%
*-commutative79.7%
add-cbrt-cube79.7%
add-sqr-sqrt79.7%
cbrt-prod79.6%
associate-*r*79.6%
associate-/r/79.7%
div-inv79.6%
metadata-eval79.6%
Applied egg-rr79.6%
*-commutative79.6%
associate-*l*79.7%
Simplified79.7%
Final simplification79.7%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (cbrt (* angle PI))))
(+
(pow (* a (sin (/ (* angle PI) 180.0))) 2.0)
(pow (* b (cos (* t_0 (* 0.005555555555555556 (pow t_0 2.0))))) 2.0))))
double code(double a, double b, double angle) {
double t_0 = cbrt((angle * ((double) M_PI)));
return pow((a * sin(((angle * ((double) M_PI)) / 180.0))), 2.0) + pow((b * cos((t_0 * (0.005555555555555556 * pow(t_0, 2.0))))), 2.0);
}
public static double code(double a, double b, double angle) {
double t_0 = Math.cbrt((angle * Math.PI));
return Math.pow((a * Math.sin(((angle * Math.PI) / 180.0))), 2.0) + Math.pow((b * Math.cos((t_0 * (0.005555555555555556 * Math.pow(t_0, 2.0))))), 2.0);
}
function code(a, b, angle) t_0 = cbrt(Float64(angle * pi)) return Float64((Float64(a * sin(Float64(Float64(angle * pi) / 180.0))) ^ 2.0) + (Float64(b * cos(Float64(t_0 * Float64(0.005555555555555556 * (t_0 ^ 2.0))))) ^ 2.0)) end
code[a_, b_, angle_] := Block[{t$95$0 = N[Power[N[(angle * Pi), $MachinePrecision], 1/3], $MachinePrecision]}, N[(N[Power[N[(a * N[Sin[N[(N[(angle * Pi), $MachinePrecision] / 180.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[N[(t$95$0 * N[(0.005555555555555556 * N[Power[t$95$0, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{angle \cdot \pi}\\
{\left(a \cdot \sin \left(\frac{angle \cdot \pi}{180}\right)\right)}^{2} + {\left(b \cdot \cos \left(t\_0 \cdot \left(0.005555555555555556 \cdot {t\_0}^{2}\right)\right)\right)}^{2}
\end{array}
\end{array}
Initial program 79.5%
associate-*l/79.6%
Applied egg-rr79.6%
expm1-log1p-u65.3%
expm1-undefine65.3%
associate-*l/65.3%
associate-*r/65.3%
div-inv65.3%
metadata-eval65.3%
Applied egg-rr65.3%
expm1-define65.3%
associate-*r*65.3%
*-commutative65.3%
associate-*r*65.3%
Simplified65.3%
expm1-log1p-u79.6%
associate-*l*79.5%
add-cube-cbrt79.6%
associate-*r*79.7%
pow279.7%
Applied egg-rr79.7%
Final simplification79.7%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (/ (* angle PI) 180.0))) 2.0) (pow (* b (cos (* (sqrt PI) (/ (sqrt PI) (/ 180.0 angle))))) 2.0)))
double code(double a, double b, double angle) {
return pow((a * sin(((angle * ((double) M_PI)) / 180.0))), 2.0) + pow((b * cos((sqrt(((double) M_PI)) * (sqrt(((double) M_PI)) / (180.0 / angle))))), 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 * Math.cos((Math.sqrt(Math.PI) * (Math.sqrt(Math.PI) / (180.0 / angle))))), 2.0);
}
def code(a, b, angle): return math.pow((a * math.sin(((angle * math.pi) / 180.0))), 2.0) + math.pow((b * math.cos((math.sqrt(math.pi) * (math.sqrt(math.pi) / (180.0 / angle))))), 2.0)
function code(a, b, angle) return Float64((Float64(a * sin(Float64(Float64(angle * pi) / 180.0))) ^ 2.0) + (Float64(b * cos(Float64(sqrt(pi) * Float64(sqrt(pi) / Float64(180.0 / angle))))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((a * sin(((angle * pi) / 180.0))) ^ 2.0) + ((b * cos((sqrt(pi) * (sqrt(pi) / (180.0 / angle))))) ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Sin[N[(N[(angle * Pi), $MachinePrecision] / 180.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[N[(N[Sqrt[Pi], $MachinePrecision] * N[(N[Sqrt[Pi], $MachinePrecision] / N[(180.0 / angle), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \sin \left(\frac{angle \cdot \pi}{180}\right)\right)}^{2} + {\left(b \cdot \cos \left(\sqrt{\pi} \cdot \frac{\sqrt{\pi}}{\frac{180}{angle}}\right)\right)}^{2}
\end{array}
Initial program 79.5%
associate-*l/79.6%
Applied egg-rr79.6%
expm1-log1p-u65.3%
expm1-undefine65.3%
associate-*l/65.3%
associate-*r/65.3%
div-inv65.3%
metadata-eval65.3%
Applied egg-rr65.3%
expm1-define65.3%
associate-*r*65.3%
*-commutative65.3%
associate-*r*65.3%
Simplified65.3%
expm1-log1p-u79.6%
*-commutative79.6%
*-commutative79.6%
metadata-eval79.6%
div-inv79.6%
clear-num79.6%
div-inv79.5%
add-sqr-sqrt79.5%
associate-*r/79.7%
clear-num79.7%
un-div-inv79.6%
Applied egg-rr79.6%
associate-/r/79.7%
Simplified79.7%
Final simplification79.7%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (/ (* angle PI) 180.0))) 2.0) (pow (* b (cos (* 0.005555555555555556 (pow (sqrt (* angle PI)) 2.0)))) 2.0)))
double code(double a, double b, double angle) {
return pow((a * sin(((angle * ((double) M_PI)) / 180.0))), 2.0) + pow((b * cos((0.005555555555555556 * pow(sqrt((angle * ((double) M_PI))), 2.0)))), 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 * Math.cos((0.005555555555555556 * Math.pow(Math.sqrt((angle * Math.PI)), 2.0)))), 2.0);
}
def code(a, b, angle): return math.pow((a * math.sin(((angle * math.pi) / 180.0))), 2.0) + math.pow((b * math.cos((0.005555555555555556 * math.pow(math.sqrt((angle * math.pi)), 2.0)))), 2.0)
function code(a, b, angle) return Float64((Float64(a * sin(Float64(Float64(angle * pi) / 180.0))) ^ 2.0) + (Float64(b * cos(Float64(0.005555555555555556 * (sqrt(Float64(angle * pi)) ^ 2.0)))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((a * sin(((angle * pi) / 180.0))) ^ 2.0) + ((b * cos((0.005555555555555556 * (sqrt((angle * pi)) ^ 2.0)))) ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Sin[N[(N[(angle * Pi), $MachinePrecision] / 180.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[N[(0.005555555555555556 * N[Power[N[Sqrt[N[(angle * Pi), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \sin \left(\frac{angle \cdot \pi}{180}\right)\right)}^{2} + {\left(b \cdot \cos \left(0.005555555555555556 \cdot {\left(\sqrt{angle \cdot \pi}\right)}^{2}\right)\right)}^{2}
\end{array}
Initial program 79.5%
associate-*l/79.6%
Applied egg-rr79.6%
expm1-log1p-u65.3%
expm1-undefine65.3%
associate-*l/65.3%
associate-*r/65.3%
div-inv65.3%
metadata-eval65.3%
Applied egg-rr65.3%
expm1-define65.3%
associate-*r*65.3%
*-commutative65.3%
associate-*r*65.3%
Simplified65.3%
expm1-log1p-u79.6%
*-commutative79.6%
*-commutative79.6%
metadata-eval79.6%
div-inv79.6%
clear-num79.6%
div-inv79.5%
*-un-lft-identity79.5%
div-inv79.5%
times-frac79.5%
metadata-eval79.5%
Applied egg-rr79.5%
div-inv79.6%
inv-pow79.6%
pow-flip79.5%
metadata-eval79.5%
pow179.5%
*-commutative79.5%
add-sqr-sqrt43.9%
pow243.9%
Applied egg-rr43.9%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (/ (* angle PI) 180.0))) 2.0) (pow (* b (cos (expm1 (log1p (* PI (* angle 0.005555555555555556)))))) 2.0)))
double code(double a, double b, double angle) {
return pow((a * sin(((angle * ((double) M_PI)) / 180.0))), 2.0) + pow((b * cos(expm1(log1p((((double) M_PI) * (angle * 0.005555555555555556)))))), 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 * Math.cos(Math.expm1(Math.log1p((Math.PI * (angle * 0.005555555555555556)))))), 2.0);
}
def code(a, b, angle): return math.pow((a * math.sin(((angle * math.pi) / 180.0))), 2.0) + math.pow((b * math.cos(math.expm1(math.log1p((math.pi * (angle * 0.005555555555555556)))))), 2.0)
function code(a, b, angle) return Float64((Float64(a * sin(Float64(Float64(angle * pi) / 180.0))) ^ 2.0) + (Float64(b * cos(expm1(log1p(Float64(pi * Float64(angle * 0.005555555555555556)))))) ^ 2.0)) end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Sin[N[(N[(angle * Pi), $MachinePrecision] / 180.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[N[(Exp[N[Log[1 + N[(Pi * N[(angle * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \sin \left(\frac{angle \cdot \pi}{180}\right)\right)}^{2} + {\left(b \cdot \cos \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)\right)\right)}^{2}
\end{array}
Initial program 79.5%
associate-*l/79.6%
Applied egg-rr79.6%
expm1-log1p-u65.3%
expm1-undefine65.3%
associate-*l/65.3%
associate-*r/65.3%
div-inv65.3%
metadata-eval65.3%
Applied egg-rr65.3%
expm1-define65.3%
associate-*r*65.3%
*-commutative65.3%
associate-*r*65.3%
Simplified65.3%
Final simplification65.3%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (/ (* angle PI) 180.0))) 2.0) (pow (* b (cos (* PI (/ angle 180.0)))) 2.0)))
double code(double a, double b, double angle) {
return pow((a * sin(((angle * ((double) M_PI)) / 180.0))), 2.0) + pow((b * cos((((double) M_PI) * (angle / 180.0)))), 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 * Math.cos((Math.PI * (angle / 180.0)))), 2.0);
}
def code(a, b, angle): return math.pow((a * math.sin(((angle * math.pi) / 180.0))), 2.0) + math.pow((b * math.cos((math.pi * (angle / 180.0)))), 2.0)
function code(a, b, angle) return Float64((Float64(a * sin(Float64(Float64(angle * pi) / 180.0))) ^ 2.0) + (Float64(b * cos(Float64(pi * Float64(angle / 180.0)))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((a * sin(((angle * pi) / 180.0))) ^ 2.0) + ((b * cos((pi * (angle / 180.0)))) ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Sin[N[(N[(angle * Pi), $MachinePrecision] / 180.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \sin \left(\frac{angle \cdot \pi}{180}\right)\right)}^{2} + {\left(b \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2}
\end{array}
Initial program 79.5%
associate-*l/79.6%
Applied egg-rr79.6%
Final simplification79.6%
(FPCore (a b angle) :precision binary64 (pow (hypot (* a (sin (* angle (/ PI 180.0)))) (* b (cos (/ angle (/ 180.0 PI))))) 2.0))
double code(double a, double b, double angle) {
return pow(hypot((a * sin((angle * (((double) M_PI) / 180.0)))), (b * cos((angle / (180.0 / ((double) M_PI)))))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow(Math.hypot((a * Math.sin((angle * (Math.PI / 180.0)))), (b * Math.cos((angle / (180.0 / Math.PI))))), 2.0);
}
def code(a, b, angle): return math.pow(math.hypot((a * math.sin((angle * (math.pi / 180.0)))), (b * math.cos((angle / (180.0 / math.pi))))), 2.0)
function code(a, b, angle) return hypot(Float64(a * sin(Float64(angle * Float64(pi / 180.0)))), Float64(b * cos(Float64(angle / Float64(180.0 / pi))))) ^ 2.0 end
function tmp = code(a, b, angle) tmp = hypot((a * sin((angle * (pi / 180.0)))), (b * cos((angle / (180.0 / pi))))) ^ 2.0; end
code[a_, b_, angle_] := N[Power[N[Sqrt[N[(a * N[Sin[N[(angle * N[(Pi / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] ^ 2 + N[(b * N[Cos[N[(angle / N[(180.0 / Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision], 2.0], $MachinePrecision]
\begin{array}{l}
\\
{\left(\mathsf{hypot}\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right), b \cdot \cos \left(\frac{angle}{\frac{180}{\pi}}\right)\right)\right)}^{2}
\end{array}
Initial program 79.5%
associate-*l/79.6%
Applied egg-rr79.6%
expm1-log1p-u65.3%
expm1-undefine65.3%
associate-*l/65.3%
associate-*r/65.3%
div-inv65.3%
metadata-eval65.3%
Applied egg-rr65.3%
expm1-define65.3%
associate-*r*65.3%
*-commutative65.3%
associate-*r*65.3%
Simplified65.3%
expm1-log1p-u79.6%
*-commutative79.6%
metadata-eval79.6%
div-inv79.6%
associate-/r/79.6%
*-un-lft-identity79.6%
add-cube-cbrt79.6%
times-frac79.6%
pow279.6%
Applied egg-rr79.6%
associate-*l/79.5%
*-lft-identity79.5%
Simplified79.5%
add-sqr-sqrt79.5%
pow279.5%
Applied egg-rr79.6%
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* angle (* PI 0.005555555555555556)))) (pow (hypot (* a (sin t_0)) (* b (cos t_0))) 2.0)))
double code(double a, double b, double angle) {
double t_0 = angle * (((double) M_PI) * 0.005555555555555556);
return pow(hypot((a * sin(t_0)), (b * cos(t_0))), 2.0);
}
public static double code(double a, double b, double angle) {
double t_0 = angle * (Math.PI * 0.005555555555555556);
return Math.pow(Math.hypot((a * Math.sin(t_0)), (b * Math.cos(t_0))), 2.0);
}
def code(a, b, angle): t_0 = angle * (math.pi * 0.005555555555555556) return math.pow(math.hypot((a * math.sin(t_0)), (b * math.cos(t_0))), 2.0)
function code(a, b, angle) t_0 = Float64(angle * Float64(pi * 0.005555555555555556)) return hypot(Float64(a * sin(t_0)), Float64(b * cos(t_0))) ^ 2.0 end
function tmp = code(a, b, angle) t_0 = angle * (pi * 0.005555555555555556); tmp = hypot((a * sin(t_0)), (b * cos(t_0))) ^ 2.0; end
code[a_, b_, angle_] := Block[{t$95$0 = N[(angle * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]}, N[Power[N[Sqrt[N[(a * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision] ^ 2 + N[(b * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision], 2.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := angle \cdot \left(\pi \cdot 0.005555555555555556\right)\\
{\left(\mathsf{hypot}\left(a \cdot \sin t\_0, b \cdot \cos t\_0\right)\right)}^{2}
\end{array}
\end{array}
Initial program 79.5%
associate-*l/79.6%
associate-/l*79.6%
cos-neg79.6%
distribute-lft-neg-out79.6%
distribute-frac-neg79.6%
distribute-frac-neg79.6%
distribute-lft-neg-out79.6%
cos-neg79.6%
associate-*l/79.5%
associate-/l*79.5%
Simplified79.5%
Applied egg-rr79.6%
(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(Float64(angle * 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[(N[(angle * Pi), $MachinePrecision] / 180.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \sin \left(\frac{angle \cdot \pi}{180}\right)\right)}^{2} + {b}^{2}
\end{array}
Initial program 79.5%
associate-*l/79.6%
Applied egg-rr79.6%
expm1-log1p-u65.3%
expm1-undefine65.3%
associate-*l/65.3%
associate-*r/65.3%
div-inv65.3%
metadata-eval65.3%
Applied egg-rr65.3%
expm1-define65.3%
associate-*r*65.3%
*-commutative65.3%
associate-*r*65.3%
Simplified65.3%
Taylor expanded in angle around 0 78.8%
(FPCore (a b angle) :precision binary64 (+ (pow b 2.0) (pow (* a (sin (* PI (/ angle 180.0)))) 2.0)))
double code(double a, double b, double angle) {
return pow(b, 2.0) + pow((a * sin((((double) M_PI) * (angle / 180.0)))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow(b, 2.0) + Math.pow((a * Math.sin((Math.PI * (angle / 180.0)))), 2.0);
}
def code(a, b, angle): return math.pow(b, 2.0) + math.pow((a * math.sin((math.pi * (angle / 180.0)))), 2.0)
function code(a, b, angle) return Float64((b ^ 2.0) + (Float64(a * sin(Float64(pi * Float64(angle / 180.0)))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = (b ^ 2.0) + ((a * sin((pi * (angle / 180.0)))) ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[b, 2.0], $MachinePrecision] + N[Power[N[(a * N[Sin[N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{b}^{2} + {\left(a \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2}
\end{array}
Initial program 79.5%
add-sqr-sqrt43.8%
pow243.8%
associate-*l/43.8%
associate-*r/43.8%
div-inv43.8%
metadata-eval43.8%
Applied egg-rr43.8%
Taylor expanded in angle around 0 78.7%
Final simplification78.7%
(FPCore (a b angle) :precision binary64 (if (<= b 1.25e-95) (pow (* a (sin (* angle (/ PI 180.0)))) 2.0) (pow (* b (cos (* PI (* angle 0.005555555555555556)))) 2.0)))
double code(double a, double b, double angle) {
double tmp;
if (b <= 1.25e-95) {
tmp = pow((a * sin((angle * (((double) M_PI) / 180.0)))), 2.0);
} else {
tmp = pow((b * cos((((double) M_PI) * (angle * 0.005555555555555556)))), 2.0);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (b <= 1.25e-95) {
tmp = Math.pow((a * Math.sin((angle * (Math.PI / 180.0)))), 2.0);
} else {
tmp = Math.pow((b * Math.cos((Math.PI * (angle * 0.005555555555555556)))), 2.0);
}
return tmp;
}
def code(a, b, angle): tmp = 0 if b <= 1.25e-95: tmp = math.pow((a * math.sin((angle * (math.pi / 180.0)))), 2.0) else: tmp = math.pow((b * math.cos((math.pi * (angle * 0.005555555555555556)))), 2.0) return tmp
function code(a, b, angle) tmp = 0.0 if (b <= 1.25e-95) tmp = Float64(a * sin(Float64(angle * Float64(pi / 180.0)))) ^ 2.0; else tmp = Float64(b * cos(Float64(pi * Float64(angle * 0.005555555555555556)))) ^ 2.0; end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (b <= 1.25e-95) tmp = (a * sin((angle * (pi / 180.0)))) ^ 2.0; else tmp = (b * cos((pi * (angle * 0.005555555555555556)))) ^ 2.0; end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[b, 1.25e-95], N[Power[N[(a * N[Sin[N[(angle * N[(Pi / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[Power[N[(b * N[Cos[N[(Pi * N[(angle * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.25 \cdot 10^{-95}:\\
\;\;\;\;{\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;{\left(b \cdot \cos \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2}\\
\end{array}
\end{array}
if b < 1.2499999999999999e-95Initial program 80.2%
associate-*l/80.3%
Applied egg-rr80.3%
Taylor expanded in a around inf 37.6%
unpow237.6%
*-commutative37.6%
associate-*r*37.6%
unpow237.6%
swap-sqr43.8%
unpow243.8%
Simplified43.8%
if 1.2499999999999999e-95 < b Initial program 78.2%
associate-*l/78.2%
Applied egg-rr78.2%
Taylor expanded in a around 0 66.0%
unpow266.0%
*-commutative66.0%
associate-*r*65.9%
unpow265.9%
swap-sqr65.9%
unpow265.9%
*-commutative65.9%
associate-*l*66.0%
Simplified66.0%
Final simplification51.4%
(FPCore (a b angle) :precision binary64 (if (<= b 1.4e-93) (pow (* a (sin (* angle (/ PI 180.0)))) 2.0) (pow (* b (cos (* (* angle PI) 0.005555555555555556))) 2.0)))
double code(double a, double b, double angle) {
double tmp;
if (b <= 1.4e-93) {
tmp = pow((a * sin((angle * (((double) M_PI) / 180.0)))), 2.0);
} else {
tmp = pow((b * cos(((angle * ((double) M_PI)) * 0.005555555555555556))), 2.0);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (b <= 1.4e-93) {
tmp = Math.pow((a * Math.sin((angle * (Math.PI / 180.0)))), 2.0);
} else {
tmp = Math.pow((b * Math.cos(((angle * Math.PI) * 0.005555555555555556))), 2.0);
}
return tmp;
}
def code(a, b, angle): tmp = 0 if b <= 1.4e-93: tmp = math.pow((a * math.sin((angle * (math.pi / 180.0)))), 2.0) else: tmp = math.pow((b * math.cos(((angle * math.pi) * 0.005555555555555556))), 2.0) return tmp
function code(a, b, angle) tmp = 0.0 if (b <= 1.4e-93) tmp = Float64(a * sin(Float64(angle * Float64(pi / 180.0)))) ^ 2.0; else tmp = Float64(b * cos(Float64(Float64(angle * pi) * 0.005555555555555556))) ^ 2.0; end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (b <= 1.4e-93) tmp = (a * sin((angle * (pi / 180.0)))) ^ 2.0; else tmp = (b * cos(((angle * pi) * 0.005555555555555556))) ^ 2.0; end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[b, 1.4e-93], N[Power[N[(a * N[Sin[N[(angle * N[(Pi / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[Power[N[(b * N[Cos[N[(N[(angle * Pi), $MachinePrecision] * 0.005555555555555556), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.4 \cdot 10^{-93}:\\
\;\;\;\;{\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;{\left(b \cdot \cos \left(\left(angle \cdot \pi\right) \cdot 0.005555555555555556\right)\right)}^{2}\\
\end{array}
\end{array}
if b < 1.39999999999999999e-93Initial program 80.2%
associate-*l/80.3%
Applied egg-rr80.3%
Taylor expanded in a around inf 37.6%
unpow237.6%
*-commutative37.6%
associate-*r*37.6%
unpow237.6%
swap-sqr43.8%
unpow243.8%
Simplified43.8%
if 1.39999999999999999e-93 < b Initial program 78.2%
associate-*l/78.2%
associate-/l*78.2%
cos-neg78.2%
distribute-lft-neg-out78.2%
distribute-frac-neg78.2%
distribute-frac-neg78.2%
distribute-lft-neg-out78.2%
cos-neg78.2%
associate-*l/78.2%
associate-/l*78.2%
Simplified78.2%
Taylor expanded in a around 0 66.0%
*-commutative66.0%
associate-*r*65.9%
unpow265.9%
unpow265.9%
swap-sqr65.9%
unpow265.9%
associate-*r*66.0%
*-commutative66.0%
Simplified66.0%
Final simplification51.4%
(FPCore (a b angle) :precision binary64 (if (<= b 4.4e-94) (pow (* a (sin (* angle (/ PI 180.0)))) 2.0) (* b b)))
double code(double a, double b, double angle) {
double tmp;
if (b <= 4.4e-94) {
tmp = pow((a * sin((angle * (((double) M_PI) / 180.0)))), 2.0);
} else {
tmp = b * b;
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (b <= 4.4e-94) {
tmp = Math.pow((a * Math.sin((angle * (Math.PI / 180.0)))), 2.0);
} else {
tmp = b * b;
}
return tmp;
}
def code(a, b, angle): tmp = 0 if b <= 4.4e-94: tmp = math.pow((a * math.sin((angle * (math.pi / 180.0)))), 2.0) else: tmp = b * b return tmp
function code(a, b, angle) tmp = 0.0 if (b <= 4.4e-94) tmp = Float64(a * sin(Float64(angle * Float64(pi / 180.0)))) ^ 2.0; else tmp = Float64(b * b); end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (b <= 4.4e-94) tmp = (a * sin((angle * (pi / 180.0)))) ^ 2.0; else tmp = b * b; end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[b, 4.4e-94], N[Power[N[(a * N[Sin[N[(angle * N[(Pi / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[(b * b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 4.4 \cdot 10^{-94}:\\
\;\;\;\;{\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;b \cdot b\\
\end{array}
\end{array}
if b < 4.40000000000000002e-94Initial program 80.2%
associate-*l/80.3%
Applied egg-rr80.3%
Taylor expanded in a around inf 37.6%
unpow237.6%
*-commutative37.6%
associate-*r*37.6%
unpow237.6%
swap-sqr43.8%
unpow243.8%
Simplified43.8%
if 4.40000000000000002e-94 < b Initial program 78.2%
associate-*l/78.2%
associate-/l*78.2%
cos-neg78.2%
distribute-lft-neg-out78.2%
distribute-frac-neg78.2%
distribute-frac-neg78.2%
distribute-lft-neg-out78.2%
cos-neg78.2%
associate-*l/78.2%
associate-/l*78.2%
Simplified78.2%
Taylor expanded in angle around 0 64.8%
unpow264.9%
Applied egg-rr64.9%
(FPCore (a b angle) :precision binary64 (if (<= b 2.9e-92) (pow (* a (sin (* (* angle PI) 0.005555555555555556))) 2.0) (* b b)))
double code(double a, double b, double angle) {
double tmp;
if (b <= 2.9e-92) {
tmp = pow((a * sin(((angle * ((double) M_PI)) * 0.005555555555555556))), 2.0);
} else {
tmp = b * b;
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (b <= 2.9e-92) {
tmp = Math.pow((a * Math.sin(((angle * Math.PI) * 0.005555555555555556))), 2.0);
} else {
tmp = b * b;
}
return tmp;
}
def code(a, b, angle): tmp = 0 if b <= 2.9e-92: tmp = math.pow((a * math.sin(((angle * math.pi) * 0.005555555555555556))), 2.0) else: tmp = b * b return tmp
function code(a, b, angle) tmp = 0.0 if (b <= 2.9e-92) tmp = Float64(a * sin(Float64(Float64(angle * pi) * 0.005555555555555556))) ^ 2.0; else tmp = Float64(b * b); end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (b <= 2.9e-92) tmp = (a * sin(((angle * pi) * 0.005555555555555556))) ^ 2.0; else tmp = b * b; end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[b, 2.9e-92], N[Power[N[(a * N[Sin[N[(N[(angle * Pi), $MachinePrecision] * 0.005555555555555556), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[(b * b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 2.9 \cdot 10^{-92}:\\
\;\;\;\;{\left(a \cdot \sin \left(\left(angle \cdot \pi\right) \cdot 0.005555555555555556\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;b \cdot b\\
\end{array}
\end{array}
if b < 2.89999999999999985e-92Initial program 80.2%
associate-*l/80.3%
associate-/l*80.3%
cos-neg80.3%
distribute-lft-neg-out80.3%
distribute-frac-neg80.3%
distribute-frac-neg80.3%
distribute-lft-neg-out80.3%
cos-neg80.3%
associate-*l/80.2%
associate-/l*80.2%
Simplified80.2%
Taylor expanded in a around inf 37.6%
unpow237.6%
*-commutative37.6%
associate-*r*37.6%
unpow237.6%
swap-sqr43.8%
unpow243.8%
associate-*r*43.8%
*-commutative43.8%
Simplified43.8%
if 2.89999999999999985e-92 < b Initial program 78.2%
associate-*l/78.2%
associate-/l*78.2%
cos-neg78.2%
distribute-lft-neg-out78.2%
distribute-frac-neg78.2%
distribute-frac-neg78.2%
distribute-lft-neg-out78.2%
cos-neg78.2%
associate-*l/78.2%
associate-/l*78.2%
Simplified78.2%
Taylor expanded in angle around 0 64.8%
unpow264.9%
Applied egg-rr64.9%
Final simplification51.0%
(FPCore (a b angle) :precision binary64 (if (<= a 1.7e+149) (* b b) (cbrt (pow b 6.0))))
double code(double a, double b, double angle) {
double tmp;
if (a <= 1.7e+149) {
tmp = b * b;
} else {
tmp = cbrt(pow(b, 6.0));
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (a <= 1.7e+149) {
tmp = b * b;
} else {
tmp = Math.cbrt(Math.pow(b, 6.0));
}
return tmp;
}
function code(a, b, angle) tmp = 0.0 if (a <= 1.7e+149) tmp = Float64(b * b); else tmp = cbrt((b ^ 6.0)); end return tmp end
code[a_, b_, angle_] := If[LessEqual[a, 1.7e+149], N[(b * b), $MachinePrecision], N[Power[N[Power[b, 6.0], $MachinePrecision], 1/3], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 1.7 \cdot 10^{+149}:\\
\;\;\;\;b \cdot b\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{{b}^{6}}\\
\end{array}
\end{array}
if a < 1.6999999999999999e149Initial program 76.7%
associate-*l/76.8%
associate-/l*76.8%
cos-neg76.8%
distribute-lft-neg-out76.8%
distribute-frac-neg76.8%
distribute-frac-neg76.8%
distribute-lft-neg-out76.8%
cos-neg76.8%
associate-*l/76.8%
associate-/l*76.8%
Simplified76.8%
Taylor expanded in angle around 0 62.7%
unpow262.7%
Applied egg-rr62.7%
if 1.6999999999999999e149 < a Initial program 95.4%
associate-*l/95.5%
associate-/l*95.5%
cos-neg95.5%
distribute-lft-neg-out95.5%
distribute-frac-neg95.5%
distribute-frac-neg95.5%
distribute-lft-neg-out95.5%
cos-neg95.5%
associate-*l/95.5%
associate-/l*95.5%
Simplified95.5%
Taylor expanded in angle around 0 32.8%
add-sqr-sqrt32.8%
sqrt-unprod46.9%
pow-prod-up46.9%
metadata-eval46.9%
Applied egg-rr46.9%
add-cbrt-cube49.4%
pow1/349.0%
add-sqr-sqrt49.0%
sqrt-pow149.0%
metadata-eval49.0%
pow-prod-up49.0%
metadata-eval49.0%
Applied egg-rr49.0%
unpow1/349.3%
Simplified49.3%
(FPCore (a b angle) :precision binary64 (* b b))
double code(double a, double b, double angle) {
return b * b;
}
real(8) function code(a, b, angle)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle
code = b * b
end function
public static double code(double a, double b, double angle) {
return b * b;
}
def code(a, b, angle): return b * b
function code(a, b, angle) return Float64(b * b) end
function tmp = code(a, b, angle) tmp = b * b; end
code[a_, b_, angle_] := N[(b * b), $MachinePrecision]
\begin{array}{l}
\\
b \cdot b
\end{array}
Initial program 79.5%
associate-*l/79.6%
associate-/l*79.6%
cos-neg79.6%
distribute-lft-neg-out79.6%
distribute-frac-neg79.6%
distribute-frac-neg79.6%
distribute-lft-neg-out79.6%
cos-neg79.6%
associate-*l/79.5%
associate-/l*79.5%
Simplified79.5%
Taylor expanded in angle around 0 58.3%
unpow258.3%
Applied egg-rr58.3%
herbie shell --seed 2024130
(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)))