
(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 (+ (pow (* a (sin (/ PI (/ 180.0 angle)))) 2.0) (pow (* b (log1p (expm1 (cos (* angle (* PI 0.005555555555555556)))))) 2.0)))
double code(double a, double b, double angle) {
return pow((a * sin((((double) M_PI) / (180.0 / angle)))), 2.0) + pow((b * log1p(expm1(cos((angle * (((double) M_PI) * 0.005555555555555556)))))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.sin((Math.PI / (180.0 / angle)))), 2.0) + Math.pow((b * Math.log1p(Math.expm1(Math.cos((angle * (Math.PI * 0.005555555555555556)))))), 2.0);
}
def code(a, b, angle): return math.pow((a * math.sin((math.pi / (180.0 / angle)))), 2.0) + math.pow((b * math.log1p(math.expm1(math.cos((angle * (math.pi * 0.005555555555555556)))))), 2.0)
function code(a, b, angle) return Float64((Float64(a * sin(Float64(pi / Float64(180.0 / angle)))) ^ 2.0) + (Float64(b * log1p(expm1(cos(Float64(angle * Float64(pi * 0.005555555555555556)))))) ^ 2.0)) end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Sin[N[(Pi / N[(180.0 / angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Log[1 + N[(Exp[N[Cos[N[(angle * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \sin \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2} + {\left(b \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\cos \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)\right)\right)}^{2}
\end{array}
Initial program 80.5%
unpow280.5%
*-commutative80.5%
associate-*r/80.6%
associate-/l*80.6%
unpow280.6%
*-commutative80.6%
associate-*r/80.7%
associate-/l*80.6%
Simplified80.6%
*-un-lft-identity80.6%
add-cube-cbrt80.6%
times-frac80.6%
pow280.6%
Applied egg-rr80.6%
Applied egg-rr80.7%
Final simplification80.7%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (expm1 (log1p (sin (* angle (* PI 0.005555555555555556)))))) 2.0) (pow (* b (cos (* angle (/ PI 180.0)))) 2.0)))
double code(double a, double b, double angle) {
return pow((a * expm1(log1p(sin((angle * (((double) M_PI) * 0.005555555555555556)))))), 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.expm1(Math.log1p(Math.sin((angle * (Math.PI * 0.005555555555555556)))))), 2.0) + Math.pow((b * Math.cos((angle * (Math.PI / 180.0)))), 2.0);
}
def code(a, b, angle): return math.pow((a * math.expm1(math.log1p(math.sin((angle * (math.pi * 0.005555555555555556)))))), 2.0) + math.pow((b * math.cos((angle * (math.pi / 180.0)))), 2.0)
function code(a, b, angle) return Float64((Float64(a * expm1(log1p(sin(Float64(angle * Float64(pi * 0.005555555555555556)))))) ^ 2.0) + (Float64(b * cos(Float64(angle * Float64(pi / 180.0)))) ^ 2.0)) end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[(Exp[N[Log[1 + N[Sin[N[(angle * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]] - 1), $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 \mathsf{expm1}\left(\mathsf{log1p}\left(\sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)\right)\right)}^{2} + {\left(b \cdot \cos \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2}
\end{array}
Initial program 80.5%
unpow280.5%
swap-sqr80.5%
*-commutative80.5%
associate-*r/80.6%
associate-*l/80.6%
*-commutative80.6%
swap-sqr80.6%
unpow280.6%
*-commutative80.6%
associate-*r/80.7%
associate-*l/80.7%
*-commutative80.7%
Simplified80.7%
*-commutative80.7%
associate-/r/80.7%
expm1-log1p-u80.7%
associate-/r/80.7%
*-commutative80.7%
div-inv80.7%
metadata-eval80.7%
Applied egg-rr80.7%
Final simplification80.7%
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* angle (/ PI 180.0)))) (+ (pow (* b (cos t_0)) 2.0) (pow (* a (sin t_0)) 2.0))))
double code(double a, double b, double angle) {
double t_0 = angle * (((double) M_PI) / 180.0);
return pow((b * cos(t_0)), 2.0) + pow((a * sin(t_0)), 2.0);
}
public static double code(double a, double b, double angle) {
double t_0 = angle * (Math.PI / 180.0);
return Math.pow((b * Math.cos(t_0)), 2.0) + Math.pow((a * Math.sin(t_0)), 2.0);
}
def code(a, b, angle): t_0 = angle * (math.pi / 180.0) return math.pow((b * math.cos(t_0)), 2.0) + math.pow((a * math.sin(t_0)), 2.0)
function code(a, b, angle) t_0 = Float64(angle * Float64(pi / 180.0)) return Float64((Float64(b * cos(t_0)) ^ 2.0) + (Float64(a * sin(t_0)) ^ 2.0)) end
function tmp = code(a, b, angle) t_0 = angle * (pi / 180.0); tmp = ((b * cos(t_0)) ^ 2.0) + ((a * sin(t_0)) ^ 2.0); end
code[a_, b_, angle_] := Block[{t$95$0 = N[(angle * N[(Pi / 180.0), $MachinePrecision]), $MachinePrecision]}, N[(N[Power[N[(b * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(a * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := angle \cdot \frac{\pi}{180}\\
{\left(b \cdot \cos t\_0\right)}^{2} + {\left(a \cdot \sin t\_0\right)}^{2}
\end{array}
\end{array}
Initial program 80.5%
unpow280.5%
swap-sqr80.5%
*-commutative80.5%
associate-*r/80.6%
associate-*l/80.6%
*-commutative80.6%
swap-sqr80.6%
unpow280.6%
*-commutative80.6%
associate-*r/80.7%
associate-*l/80.7%
*-commutative80.7%
Simplified80.7%
Final simplification80.7%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (* PI (/ -1.0 (/ -180.0 angle))))) 2.0) (pow b 2.0)))
double code(double a, double b, double angle) {
return pow((a * sin((((double) M_PI) * (-1.0 / (-180.0 / angle))))), 2.0) + pow(b, 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.sin((Math.PI * (-1.0 / (-180.0 / angle))))), 2.0) + Math.pow(b, 2.0);
}
def code(a, b, angle): return math.pow((a * math.sin((math.pi * (-1.0 / (-180.0 / angle))))), 2.0) + math.pow(b, 2.0)
function code(a, b, angle) return Float64((Float64(a * sin(Float64(pi * Float64(-1.0 / Float64(-180.0 / angle))))) ^ 2.0) + (b ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((a * sin((pi * (-1.0 / (-180.0 / angle))))) ^ 2.0) + (b ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Sin[N[(Pi * N[(-1.0 / N[(-180.0 / angle), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \sin \left(\pi \cdot \frac{-1}{\frac{-180}{angle}}\right)\right)}^{2} + {b}^{2}
\end{array}
Initial program 80.5%
unpow280.5%
*-commutative80.5%
associate-*r/80.6%
associate-/l*80.6%
unpow280.6%
*-commutative80.6%
associate-*r/80.7%
associate-/l*80.6%
Simplified80.6%
frac-2neg80.6%
div-inv80.6%
distribute-neg-frac80.6%
metadata-eval80.6%
Applied egg-rr80.6%
Taylor expanded in angle around 0 80.3%
Final simplification80.3%
(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 80.5%
unpow280.5%
swap-sqr80.5%
*-commutative80.5%
associate-*r/80.6%
associate-*l/80.6%
*-commutative80.6%
swap-sqr80.6%
unpow280.6%
*-commutative80.6%
associate-*r/80.7%
associate-*l/80.7%
*-commutative80.7%
Simplified80.7%
Taylor expanded in angle around 0 80.3%
Final simplification80.3%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (/ PI (/ 180.0 angle)))) 2.0) (pow b 2.0)))
double code(double a, double b, double angle) {
return pow((a * sin((((double) M_PI) / (180.0 / angle)))), 2.0) + pow(b, 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.sin((Math.PI / (180.0 / angle)))), 2.0) + Math.pow(b, 2.0);
}
def code(a, b, angle): return math.pow((a * math.sin((math.pi / (180.0 / angle)))), 2.0) + math.pow(b, 2.0)
function code(a, b, angle) return Float64((Float64(a * sin(Float64(pi / Float64(180.0 / angle)))) ^ 2.0) + (b ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((a * sin((pi / (180.0 / angle)))) ^ 2.0) + (b ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Sin[N[(Pi / N[(180.0 / angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \sin \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2} + {b}^{2}
\end{array}
Initial program 80.5%
unpow280.5%
swap-sqr80.5%
*-commutative80.5%
associate-*r/80.6%
associate-*l/80.6%
*-commutative80.6%
swap-sqr80.6%
unpow280.6%
*-commutative80.6%
associate-*r/80.7%
associate-*l/80.7%
*-commutative80.7%
Simplified80.7%
Taylor expanded in angle around 0 80.3%
*-commutative80.3%
associate-/r/80.3%
Applied egg-rr80.3%
Final simplification80.3%
(FPCore (a b angle) :precision binary64 (+ (pow b 2.0) (* (* angle 0.005555555555555556) (* (* a PI) (* angle (* PI (* a 0.005555555555555556)))))))
double code(double a, double b, double angle) {
return pow(b, 2.0) + ((angle * 0.005555555555555556) * ((a * ((double) M_PI)) * (angle * (((double) M_PI) * (a * 0.005555555555555556)))));
}
public static double code(double a, double b, double angle) {
return Math.pow(b, 2.0) + ((angle * 0.005555555555555556) * ((a * Math.PI) * (angle * (Math.PI * (a * 0.005555555555555556)))));
}
def code(a, b, angle): return math.pow(b, 2.0) + ((angle * 0.005555555555555556) * ((a * math.pi) * (angle * (math.pi * (a * 0.005555555555555556)))))
function code(a, b, angle) return Float64((b ^ 2.0) + Float64(Float64(angle * 0.005555555555555556) * Float64(Float64(a * pi) * Float64(angle * Float64(pi * Float64(a * 0.005555555555555556)))))) end
function tmp = code(a, b, angle) tmp = (b ^ 2.0) + ((angle * 0.005555555555555556) * ((a * pi) * (angle * (pi * (a * 0.005555555555555556))))); end
code[a_, b_, angle_] := N[(N[Power[b, 2.0], $MachinePrecision] + N[(N[(angle * 0.005555555555555556), $MachinePrecision] * N[(N[(a * Pi), $MachinePrecision] * N[(angle * N[(Pi * N[(a * 0.005555555555555556), $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(angle \cdot \left(\pi \cdot \left(a \cdot 0.005555555555555556\right)\right)\right)\right)
\end{array}
Initial program 80.5%
unpow280.5%
swap-sqr80.5%
*-commutative80.5%
associate-*r/80.6%
associate-*l/80.6%
*-commutative80.6%
swap-sqr80.6%
unpow280.6%
*-commutative80.6%
associate-*r/80.7%
associate-*l/80.7%
*-commutative80.7%
Simplified80.7%
Taylor expanded in angle around 0 80.3%
Taylor expanded in angle around 0 75.8%
*-commutative75.8%
associate-*l*75.8%
Simplified75.8%
unpow275.8%
associate-*r*75.8%
associate-*l*75.5%
*-commutative75.5%
associate-*l*75.4%
Applied egg-rr75.4%
Taylor expanded in a around 0 75.4%
*-commutative75.4%
*-commutative75.4%
associate-*r*75.5%
*-commutative75.5%
Simplified75.5%
Final simplification75.5%
(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 80.5%
unpow280.5%
swap-sqr80.5%
*-commutative80.5%
associate-*r/80.6%
associate-*l/80.6%
*-commutative80.6%
swap-sqr80.6%
unpow280.6%
*-commutative80.6%
associate-*r/80.7%
associate-*l/80.7%
*-commutative80.7%
Simplified80.7%
Taylor expanded in angle around 0 80.3%
Taylor expanded in angle around 0 75.8%
*-commutative75.8%
associate-*l*75.8%
Simplified75.8%
unpow275.8%
*-commutative75.8%
*-commutative75.8%
associate-*l*75.8%
associate-*l*75.8%
Applied egg-rr75.8%
Final simplification75.8%
(FPCore (a b angle) :precision binary64 (+ (pow b 2.0) (* (* angle (* a PI)) (* 0.005555555555555556 (* angle (* 0.005555555555555556 (* a PI)))))))
double code(double a, double b, double angle) {
return pow(b, 2.0) + ((angle * (a * ((double) M_PI))) * (0.005555555555555556 * (angle * (0.005555555555555556 * (a * ((double) M_PI))))));
}
public static double code(double a, double b, double angle) {
return Math.pow(b, 2.0) + ((angle * (a * Math.PI)) * (0.005555555555555556 * (angle * (0.005555555555555556 * (a * Math.PI)))));
}
def code(a, b, angle): return math.pow(b, 2.0) + ((angle * (a * math.pi)) * (0.005555555555555556 * (angle * (0.005555555555555556 * (a * math.pi)))))
function code(a, b, angle) return Float64((b ^ 2.0) + Float64(Float64(angle * Float64(a * pi)) * Float64(0.005555555555555556 * Float64(angle * Float64(0.005555555555555556 * Float64(a * pi)))))) end
function tmp = code(a, b, angle) tmp = (b ^ 2.0) + ((angle * (a * pi)) * (0.005555555555555556 * (angle * (0.005555555555555556 * (a * pi))))); end
code[a_, b_, angle_] := N[(N[Power[b, 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]
\begin{array}{l}
\\
{b}^{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)
\end{array}
Initial program 80.5%
unpow280.5%
swap-sqr80.5%
*-commutative80.5%
associate-*r/80.6%
associate-*l/80.6%
*-commutative80.6%
swap-sqr80.6%
unpow280.6%
*-commutative80.6%
associate-*r/80.7%
associate-*l/80.7%
*-commutative80.7%
Simplified80.7%
Taylor expanded in angle around 0 80.3%
Taylor expanded in angle around 0 75.8%
*-commutative75.8%
associate-*l*75.8%
Simplified75.8%
unpow275.8%
associate-*r*75.8%
*-commutative75.8%
associate-*l*75.8%
Applied egg-rr75.8%
Final simplification75.8%
(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 80.5%
unpow280.5%
swap-sqr80.5%
*-commutative80.5%
associate-*r/80.6%
associate-*l/80.6%
*-commutative80.6%
swap-sqr80.6%
unpow280.6%
*-commutative80.6%
associate-*r/80.7%
associate-*l/80.7%
*-commutative80.7%
Simplified80.7%
Taylor expanded in angle around 0 80.3%
Taylor expanded in angle around 0 75.8%
*-commutative75.8%
associate-*l*75.8%
Simplified75.8%
unpow275.8%
*-commutative75.8%
associate-*r*75.8%
*-commutative75.8%
associate-*l*75.8%
Applied egg-rr75.8%
Final simplification75.8%
herbie shell --seed 2024031
(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)))