
(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}
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (cbrt (* angle 0.005555555555555556))))
(+
(pow (* a (sin (* (/ angle 180.0) PI))) 2.0)
(pow
(*
b
(cos
(* (* (* (cbrt angle) (cbrt 0.005555555555555556)) t_0) (* PI t_0))))
2.0))))
double code(double a, double b, double angle) {
double t_0 = cbrt((angle * 0.005555555555555556));
return pow((a * sin(((angle / 180.0) * ((double) M_PI)))), 2.0) + pow((b * cos((((cbrt(angle) * cbrt(0.005555555555555556)) * t_0) * (((double) M_PI) * t_0)))), 2.0);
}
public static double code(double a, double b, double angle) {
double t_0 = Math.cbrt((angle * 0.005555555555555556));
return Math.pow((a * Math.sin(((angle / 180.0) * Math.PI))), 2.0) + Math.pow((b * Math.cos((((Math.cbrt(angle) * Math.cbrt(0.005555555555555556)) * t_0) * (Math.PI * t_0)))), 2.0);
}
function code(a, b, angle) t_0 = cbrt(Float64(angle * 0.005555555555555556)) return Float64((Float64(a * sin(Float64(Float64(angle / 180.0) * pi))) ^ 2.0) + (Float64(b * cos(Float64(Float64(Float64(cbrt(angle) * cbrt(0.005555555555555556)) * t_0) * Float64(pi * t_0)))) ^ 2.0)) end
code[a_, b_, angle_] := Block[{t$95$0 = N[Power[N[(angle * 0.005555555555555556), $MachinePrecision], 1/3], $MachinePrecision]}, N[(N[Power[N[(a * N[Sin[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[N[(N[(N[(N[Power[angle, 1/3], $MachinePrecision] * N[Power[0.005555555555555556, 1/3], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * N[(Pi * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{angle \cdot 0.005555555555555556}\\
{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\left(\left(\sqrt[3]{angle} \cdot \sqrt[3]{0.005555555555555556}\right) \cdot t_0\right) \cdot \left(\pi \cdot t_0\right)\right)\right)}^{2}
\end{array}
\end{array}
Initial program 82.1%
add-cube-cbrt82.0%
pow382.1%
associate-*l/82.0%
associate-*r/82.0%
div-inv82.0%
metadata-eval82.0%
Applied egg-rr82.0%
rem-cube-cbrt82.0%
*-commutative82.0%
associate-*r*82.1%
metadata-eval82.1%
div-inv82.1%
add-cube-cbrt81.8%
associate-*l*81.9%
pow281.9%
div-inv82.0%
metadata-eval82.0%
div-inv81.9%
metadata-eval81.9%
Applied egg-rr81.9%
unpow281.9%
cbrt-prod82.1%
associate-*l*82.1%
Applied egg-rr82.1%
associate-*r*82.1%
Simplified82.1%
Final simplification82.1%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (* 0.005555555555555556 (* angle PI)))) 2.0) (pow (* b (cos (* angle (/ PI 180.0)))) 2.0)))
double code(double a, double b, double angle) {
return pow((a * sin((0.005555555555555556 * (angle * ((double) M_PI))))), 2.0) + pow((b * cos((angle * (((double) M_PI) / 180.0)))), 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 * Math.cos((angle * (Math.PI / 180.0)))), 2.0);
}
def code(a, b, angle): return math.pow((a * math.sin((0.005555555555555556 * (angle * math.pi)))), 2.0) + math.pow((b * math.cos((angle * (math.pi / 180.0)))), 2.0)
function code(a, b, angle) return Float64((Float64(a * sin(Float64(0.005555555555555556 * Float64(angle * pi)))) ^ 2.0) + (Float64(b * cos(Float64(angle * Float64(pi / 180.0)))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((a * sin((0.005555555555555556 * (angle * pi)))) ^ 2.0) + ((b * cos((angle * (pi / 180.0)))) ^ 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[N[(b * N[Cos[N[(angle * N[(Pi / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2} + {\left(b \cdot \cos \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2}
\end{array}
Initial program 82.1%
unpow282.1%
swap-sqr82.1%
associate-*l/81.9%
associate-*r/82.0%
swap-sqr82.0%
unpow282.0%
associate-*l/82.0%
associate-*r/82.0%
Simplified82.0%
Taylor expanded in angle around inf 82.0%
Final simplification82.0%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (* (/ angle 180.0) PI))) 2.0) (pow (* b (cos (* PI (* angle 0.005555555555555556)))) 2.0)))
double code(double a, double b, double angle) {
return pow((a * sin(((angle / 180.0) * ((double) M_PI)))), 2.0) + pow((b * cos((((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 / 180.0) * Math.PI))), 2.0) + Math.pow((b * Math.cos((Math.PI * (angle * 0.005555555555555556)))), 2.0);
}
def code(a, b, angle): return math.pow((a * math.sin(((angle / 180.0) * math.pi))), 2.0) + math.pow((b * math.cos((math.pi * (angle * 0.005555555555555556)))), 2.0)
function code(a, b, angle) return Float64((Float64(a * sin(Float64(Float64(angle / 180.0) * pi))) ^ 2.0) + (Float64(b * cos(Float64(pi * Float64(angle * 0.005555555555555556)))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((a * sin(((angle / 180.0) * pi))) ^ 2.0) + ((b * cos((pi * (angle * 0.005555555555555556)))) ^ 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[N[(b * N[Cos[N[(Pi * N[(angle * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2}
\end{array}
Initial program 82.1%
add-cube-cbrt82.0%
pow382.1%
associate-*l/82.0%
associate-*r/82.0%
div-inv82.0%
metadata-eval82.0%
Applied egg-rr82.0%
rem-cube-cbrt82.0%
*-commutative82.0%
associate-*r*82.1%
Applied egg-rr82.1%
Final simplification82.1%
(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 82.1%
unpow282.1%
swap-sqr82.1%
associate-*l/81.9%
associate-*r/82.0%
swap-sqr82.0%
unpow282.0%
associate-*l/82.0%
associate-*r/82.0%
Simplified82.0%
Taylor expanded in angle around 0 81.3%
Taylor expanded in angle around inf 81.3%
Final simplification81.3%
(FPCore (a b angle) :precision binary64 (+ (pow b 2.0) (* 0.005555555555555556 (* (* PI (* a angle)) (* angle (* a (* PI 0.005555555555555556)))))))
double code(double a, double b, double angle) {
return pow(b, 2.0) + (0.005555555555555556 * ((((double) M_PI) * (a * angle)) * (angle * (a * (((double) M_PI) * 0.005555555555555556)))));
}
public static double code(double a, double b, double angle) {
return Math.pow(b, 2.0) + (0.005555555555555556 * ((Math.PI * (a * angle)) * (angle * (a * (Math.PI * 0.005555555555555556)))));
}
def code(a, b, angle): return math.pow(b, 2.0) + (0.005555555555555556 * ((math.pi * (a * angle)) * (angle * (a * (math.pi * 0.005555555555555556)))))
function code(a, b, angle) return Float64((b ^ 2.0) + Float64(0.005555555555555556 * Float64(Float64(pi * Float64(a * angle)) * Float64(angle * Float64(a * Float64(pi * 0.005555555555555556)))))) end
function tmp = code(a, b, angle) tmp = (b ^ 2.0) + (0.005555555555555556 * ((pi * (a * angle)) * (angle * (a * (pi * 0.005555555555555556))))); end
code[a_, b_, angle_] := N[(N[Power[b, 2.0], $MachinePrecision] + N[(0.005555555555555556 * N[(N[(Pi * N[(a * angle), $MachinePrecision]), $MachinePrecision] * N[(angle * N[(a * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{b}^{2} + 0.005555555555555556 \cdot \left(\left(\pi \cdot \left(a \cdot angle\right)\right) \cdot \left(angle \cdot \left(a \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)\right)
\end{array}
Initial program 82.1%
unpow282.1%
swap-sqr82.1%
associate-*l/81.9%
associate-*r/82.0%
swap-sqr82.0%
unpow282.0%
associate-*l/82.0%
associate-*r/82.0%
Simplified82.0%
Taylor expanded in angle around 0 81.3%
Taylor expanded in angle around 0 78.0%
*-commutative78.0%
associate-*l*78.1%
Simplified78.1%
unpow278.1%
associate-*l*78.0%
associate-*r*78.1%
*-commutative78.1%
associate-*r*78.1%
*-commutative78.1%
associate-*l*78.1%
Applied egg-rr78.1%
associate-*r*78.1%
*-commutative78.1%
*-commutative78.1%
associate-*r*78.1%
*-commutative78.1%
*-commutative78.1%
Simplified78.1%
Final simplification78.1%
(FPCore (a b angle) :precision binary64 (+ (pow b 2.0) (* (* PI (* a angle)) (* (* angle 0.005555555555555556) (* 0.005555555555555556 (* a PI))))))
double code(double a, double b, double angle) {
return pow(b, 2.0) + ((((double) M_PI) * (a * angle)) * ((angle * 0.005555555555555556) * (0.005555555555555556 * (a * ((double) M_PI)))));
}
public static double code(double a, double b, double angle) {
return Math.pow(b, 2.0) + ((Math.PI * (a * angle)) * ((angle * 0.005555555555555556) * (0.005555555555555556 * (a * Math.PI))));
}
def code(a, b, angle): return math.pow(b, 2.0) + ((math.pi * (a * angle)) * ((angle * 0.005555555555555556) * (0.005555555555555556 * (a * math.pi))))
function code(a, b, angle) return Float64((b ^ 2.0) + Float64(Float64(pi * Float64(a * angle)) * Float64(Float64(angle * 0.005555555555555556) * Float64(0.005555555555555556 * Float64(a * pi))))) end
function tmp = code(a, b, angle) tmp = (b ^ 2.0) + ((pi * (a * angle)) * ((angle * 0.005555555555555556) * (0.005555555555555556 * (a * pi)))); end
code[a_, b_, angle_] := N[(N[Power[b, 2.0], $MachinePrecision] + N[(N[(Pi * N[(a * angle), $MachinePrecision]), $MachinePrecision] * N[(N[(angle * 0.005555555555555556), $MachinePrecision] * N[(0.005555555555555556 * N[(a * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{b}^{2} + \left(\pi \cdot \left(a \cdot angle\right)\right) \cdot \left(\left(angle \cdot 0.005555555555555556\right) \cdot \left(0.005555555555555556 \cdot \left(a \cdot \pi\right)\right)\right)
\end{array}
Initial program 82.1%
unpow282.1%
swap-sqr82.1%
associate-*l/81.9%
associate-*r/82.0%
swap-sqr82.0%
unpow282.0%
associate-*l/82.0%
associate-*r/82.0%
Simplified82.0%
Taylor expanded in angle around 0 81.3%
Taylor expanded in angle around 0 78.0%
*-commutative78.0%
associate-*l*78.1%
Simplified78.1%
unpow278.1%
associate-*l*78.0%
associate-*r*78.1%
*-commutative78.1%
associate-*r*78.1%
*-commutative78.1%
associate-*l*78.1%
Applied egg-rr78.1%
associate-*r*78.1%
*-commutative78.1%
associate-*r*78.1%
associate-*r*78.1%
*-commutative78.1%
*-commutative78.1%
associate-*r*78.1%
*-commutative78.1%
Simplified78.1%
Final simplification78.1%
(FPCore (a b angle) :precision binary64 (+ (pow b 2.0) (* 3.08641975308642e-5 (* (* a angle) (* PI (* angle (* a PI)))))))
double code(double a, double b, double angle) {
return pow(b, 2.0) + (3.08641975308642e-5 * ((a * angle) * (((double) M_PI) * (angle * (a * ((double) M_PI))))));
}
public static double code(double a, double b, double angle) {
return Math.pow(b, 2.0) + (3.08641975308642e-5 * ((a * angle) * (Math.PI * (angle * (a * Math.PI)))));
}
def code(a, b, angle): return math.pow(b, 2.0) + (3.08641975308642e-5 * ((a * angle) * (math.pi * (angle * (a * math.pi)))))
function code(a, b, angle) return Float64((b ^ 2.0) + Float64(3.08641975308642e-5 * Float64(Float64(a * angle) * Float64(pi * Float64(angle * Float64(a * pi)))))) end
function tmp = code(a, b, angle) tmp = (b ^ 2.0) + (3.08641975308642e-5 * ((a * angle) * (pi * (angle * (a * pi))))); end
code[a_, b_, angle_] := N[(N[Power[b, 2.0], $MachinePrecision] + N[(3.08641975308642e-5 * N[(N[(a * angle), $MachinePrecision] * N[(Pi * N[(angle * N[(a * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{b}^{2} + 3.08641975308642 \cdot 10^{-5} \cdot \left(\left(a \cdot angle\right) \cdot \left(\pi \cdot \left(angle \cdot \left(a \cdot \pi\right)\right)\right)\right)
\end{array}
Initial program 82.1%
unpow282.1%
swap-sqr82.1%
associate-*l/81.9%
associate-*r/82.0%
swap-sqr82.0%
unpow282.0%
associate-*l/82.0%
associate-*r/82.0%
Simplified82.0%
Taylor expanded in angle around 0 81.3%
Taylor expanded in angle around 0 78.0%
*-commutative78.0%
associate-*l*78.1%
Simplified78.1%
Taylor expanded in angle around 0 66.8%
unpow266.8%
unpow266.8%
unpow266.8%
unswap-sqr66.7%
swap-sqr78.0%
unpow278.0%
associate-*r*78.0%
*-commutative78.0%
*-commutative78.0%
Simplified78.0%
unpow278.0%
associate-*r*78.1%
*-commutative78.1%
associate-*r*78.1%
Applied egg-rr78.1%
Final simplification78.1%
(FPCore (a b angle) :precision binary64 (+ (pow b 2.0) (* 3.08641975308642e-5 (* PI (* (* a angle) (* angle (* a PI)))))))
double code(double a, double b, double angle) {
return pow(b, 2.0) + (3.08641975308642e-5 * (((double) M_PI) * ((a * angle) * (angle * (a * ((double) M_PI))))));
}
public static double code(double a, double b, double angle) {
return Math.pow(b, 2.0) + (3.08641975308642e-5 * (Math.PI * ((a * angle) * (angle * (a * Math.PI)))));
}
def code(a, b, angle): return math.pow(b, 2.0) + (3.08641975308642e-5 * (math.pi * ((a * angle) * (angle * (a * math.pi)))))
function code(a, b, angle) return Float64((b ^ 2.0) + Float64(3.08641975308642e-5 * Float64(pi * Float64(Float64(a * angle) * Float64(angle * Float64(a * pi)))))) end
function tmp = code(a, b, angle) tmp = (b ^ 2.0) + (3.08641975308642e-5 * (pi * ((a * angle) * (angle * (a * pi))))); end
code[a_, b_, angle_] := N[(N[Power[b, 2.0], $MachinePrecision] + N[(3.08641975308642e-5 * N[(Pi * N[(N[(a * angle), $MachinePrecision] * N[(angle * N[(a * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{b}^{2} + 3.08641975308642 \cdot 10^{-5} \cdot \left(\pi \cdot \left(\left(a \cdot angle\right) \cdot \left(angle \cdot \left(a \cdot \pi\right)\right)\right)\right)
\end{array}
Initial program 82.1%
unpow282.1%
swap-sqr82.1%
associate-*l/81.9%
associate-*r/82.0%
swap-sqr82.0%
unpow282.0%
associate-*l/82.0%
associate-*r/82.0%
Simplified82.0%
Taylor expanded in angle around 0 81.3%
Taylor expanded in angle around 0 78.0%
*-commutative78.0%
associate-*l*78.1%
Simplified78.1%
Taylor expanded in angle around 0 66.8%
unpow266.8%
unpow266.8%
unpow266.8%
unswap-sqr66.7%
swap-sqr78.0%
unpow278.0%
associate-*r*78.0%
*-commutative78.0%
*-commutative78.0%
Simplified78.0%
unpow278.0%
*-commutative78.0%
associate-*r*78.1%
*-commutative78.1%
associate-*r*78.1%
Applied egg-rr78.1%
Final simplification78.1%
(FPCore (a b angle) :precision binary64 (+ (pow b 2.0) (* 3.08641975308642e-5 (pow (* PI (* a angle)) 2.0))))
double code(double a, double b, double angle) {
return pow(b, 2.0) + (3.08641975308642e-5 * pow((((double) M_PI) * (a * angle)), 2.0));
}
public static double code(double a, double b, double angle) {
return Math.pow(b, 2.0) + (3.08641975308642e-5 * Math.pow((Math.PI * (a * angle)), 2.0));
}
def code(a, b, angle): return math.pow(b, 2.0) + (3.08641975308642e-5 * math.pow((math.pi * (a * angle)), 2.0))
function code(a, b, angle) return Float64((b ^ 2.0) + Float64(3.08641975308642e-5 * (Float64(pi * Float64(a * angle)) ^ 2.0))) end
function tmp = code(a, b, angle) tmp = (b ^ 2.0) + (3.08641975308642e-5 * ((pi * (a * angle)) ^ 2.0)); end
code[a_, b_, angle_] := N[(N[Power[b, 2.0], $MachinePrecision] + N[(3.08641975308642e-5 * N[Power[N[(Pi * N[(a * angle), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{b}^{2} + 3.08641975308642 \cdot 10^{-5} \cdot {\left(\pi \cdot \left(a \cdot angle\right)\right)}^{2}
\end{array}
Initial program 82.1%
unpow282.1%
swap-sqr82.1%
associate-*l/81.9%
associate-*r/82.0%
swap-sqr82.0%
unpow282.0%
associate-*l/82.0%
associate-*r/82.0%
Simplified82.0%
Taylor expanded in angle around 0 81.3%
Taylor expanded in angle around 0 78.0%
*-commutative78.0%
associate-*l*78.1%
Simplified78.1%
Taylor expanded in angle around 0 66.8%
unpow266.8%
unpow266.8%
unpow266.8%
unswap-sqr66.7%
swap-sqr78.0%
unpow278.0%
associate-*r*78.0%
*-commutative78.0%
*-commutative78.0%
Simplified78.0%
Final simplification78.0%
(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 82.1%
unpow282.1%
swap-sqr82.1%
associate-*l/81.9%
associate-*r/82.0%
swap-sqr82.0%
unpow282.0%
associate-*l/82.0%
associate-*r/82.0%
Simplified82.0%
Taylor expanded in angle around 0 81.3%
Taylor expanded in angle around 0 78.0%
*-commutative78.0%
associate-*l*78.1%
Simplified78.1%
Final simplification78.1%
herbie shell --seed 2023311
(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)))