
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* PI (/ angle 180.0)))) (+ (pow (* a (cos t_0)) 2.0) (pow (* b (sin t_0)) 2.0))))
double code(double a, double b, double angle) {
double t_0 = ((double) M_PI) * (angle / 180.0);
return pow((a * cos(t_0)), 2.0) + pow((b * sin(t_0)), 2.0);
}
public static double code(double a, double b, double angle) {
double t_0 = Math.PI * (angle / 180.0);
return Math.pow((a * Math.cos(t_0)), 2.0) + Math.pow((b * Math.sin(t_0)), 2.0);
}
def code(a, b, angle): t_0 = math.pi * (angle / 180.0) return math.pow((a * math.cos(t_0)), 2.0) + math.pow((b * math.sin(t_0)), 2.0)
function code(a, b, angle) t_0 = Float64(pi * Float64(angle / 180.0)) return Float64((Float64(a * cos(t_0)) ^ 2.0) + (Float64(b * sin(t_0)) ^ 2.0)) end
function tmp = code(a, b, angle) t_0 = pi * (angle / 180.0); tmp = ((a * cos(t_0)) ^ 2.0) + ((b * sin(t_0)) ^ 2.0); end
code[a_, b_, angle_] := Block[{t$95$0 = N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]}, N[(N[Power[N[(a * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \pi \cdot \frac{angle}{180}\\
{\left(a \cdot \cos t_0\right)}^{2} + {\left(b \cdot \sin t_0\right)}^{2}
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* PI (/ angle 180.0)))) (+ (pow (* a (cos t_0)) 2.0) (pow (* b (sin t_0)) 2.0))))
double code(double a, double b, double angle) {
double t_0 = ((double) M_PI) * (angle / 180.0);
return pow((a * cos(t_0)), 2.0) + pow((b * sin(t_0)), 2.0);
}
public static double code(double a, double b, double angle) {
double t_0 = Math.PI * (angle / 180.0);
return Math.pow((a * Math.cos(t_0)), 2.0) + Math.pow((b * Math.sin(t_0)), 2.0);
}
def code(a, b, angle): t_0 = math.pi * (angle / 180.0) return math.pow((a * math.cos(t_0)), 2.0) + math.pow((b * math.sin(t_0)), 2.0)
function code(a, b, angle) t_0 = Float64(pi * Float64(angle / 180.0)) return Float64((Float64(a * cos(t_0)) ^ 2.0) + (Float64(b * sin(t_0)) ^ 2.0)) end
function tmp = code(a, b, angle) t_0 = pi * (angle / 180.0); tmp = ((a * cos(t_0)) ^ 2.0) + ((b * sin(t_0)) ^ 2.0); end
code[a_, b_, angle_] := Block[{t$95$0 = N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]}, N[(N[Power[N[(a * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \pi \cdot \frac{angle}{180}\\
{\left(a \cdot \cos t_0\right)}^{2} + {\left(b \cdot \sin t_0\right)}^{2}
\end{array}
\end{array}
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (cbrt (* PI (* angle 0.005555555555555556)))))
(+
(pow (* a (cos (* t_0 (pow (pow (cbrt t_0) 2.0) 3.0)))) 2.0)
(pow (* b (sin (* PI (/ angle 180.0)))) 2.0))))
double code(double a, double b, double angle) {
double t_0 = cbrt((((double) M_PI) * (angle * 0.005555555555555556)));
return pow((a * cos((t_0 * pow(pow(cbrt(t_0), 2.0), 3.0)))), 2.0) + pow((b * sin((((double) M_PI) * (angle / 180.0)))), 2.0);
}
public static double code(double a, double b, double angle) {
double t_0 = Math.cbrt((Math.PI * (angle * 0.005555555555555556)));
return Math.pow((a * Math.cos((t_0 * Math.pow(Math.pow(Math.cbrt(t_0), 2.0), 3.0)))), 2.0) + Math.pow((b * Math.sin((Math.PI * (angle / 180.0)))), 2.0);
}
function code(a, b, angle) t_0 = cbrt(Float64(pi * Float64(angle * 0.005555555555555556))) return Float64((Float64(a * cos(Float64(t_0 * ((cbrt(t_0) ^ 2.0) ^ 3.0)))) ^ 2.0) + (Float64(b * sin(Float64(pi * Float64(angle / 180.0)))) ^ 2.0)) end
code[a_, b_, angle_] := Block[{t$95$0 = N[Power[N[(Pi * N[(angle * 0.005555555555555556), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]}, N[(N[Power[N[(a * N[Cos[N[(t$95$0 * N[Power[N[Power[N[Power[t$95$0, 1/3], $MachinePrecision], 2.0], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{\pi \cdot \left(angle \cdot 0.005555555555555556\right)}\\
{\left(a \cdot \cos \left(t_0 \cdot {\left({\left(\sqrt[3]{t_0}\right)}^{2}\right)}^{3}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2}
\end{array}
\end{array}
Initial program 84.1%
add-cube-cbrt84.1%
pow384.1%
pow-to-exp41.9%
div-inv41.9%
metadata-eval41.9%
Applied egg-rr41.9%
pow-to-exp84.1%
rem-cube-cbrt84.2%
add-exp-log41.9%
*-un-lft-identity41.9%
exp-prod41.9%
metadata-eval41.9%
div-inv41.9%
Applied egg-rr41.9%
pow-exp41.9%
*-un-lft-identity41.9%
add-exp-log84.1%
rem-cube-cbrt84.1%
add-exp-log41.7%
add-cube-cbrt41.7%
unpow-prod-down41.7%
Applied egg-rr84.3%
Final simplification84.3%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (cbrt (* PI (* angle 0.005555555555555556)))))
(+
(pow (* b (sin (* PI (/ angle 180.0)))) 2.0)
(pow (* a (cos (* t_0 (pow (sqrt (cbrt t_0)) 12.0)))) 2.0))))
double code(double a, double b, double angle) {
double t_0 = cbrt((((double) M_PI) * (angle * 0.005555555555555556)));
return pow((b * sin((((double) M_PI) * (angle / 180.0)))), 2.0) + pow((a * cos((t_0 * pow(sqrt(cbrt(t_0)), 12.0)))), 2.0);
}
public static double code(double a, double b, double angle) {
double t_0 = Math.cbrt((Math.PI * (angle * 0.005555555555555556)));
return Math.pow((b * Math.sin((Math.PI * (angle / 180.0)))), 2.0) + Math.pow((a * Math.cos((t_0 * Math.pow(Math.sqrt(Math.cbrt(t_0)), 12.0)))), 2.0);
}
function code(a, b, angle) t_0 = cbrt(Float64(pi * Float64(angle * 0.005555555555555556))) return Float64((Float64(b * sin(Float64(pi * Float64(angle / 180.0)))) ^ 2.0) + (Float64(a * cos(Float64(t_0 * (sqrt(cbrt(t_0)) ^ 12.0)))) ^ 2.0)) end
code[a_, b_, angle_] := Block[{t$95$0 = N[Power[N[(Pi * N[(angle * 0.005555555555555556), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]}, N[(N[Power[N[(b * N[Sin[N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(a * N[Cos[N[(t$95$0 * N[Power[N[Sqrt[N[Power[t$95$0, 1/3], $MachinePrecision]], $MachinePrecision], 12.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{\pi \cdot \left(angle \cdot 0.005555555555555556\right)}\\
{\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(a \cdot \cos \left(t_0 \cdot {\left(\sqrt{\sqrt[3]{t_0}}\right)}^{12}\right)\right)}^{2}
\end{array}
\end{array}
Initial program 84.1%
add-cube-cbrt84.1%
pow384.1%
pow-to-exp41.9%
div-inv41.9%
metadata-eval41.9%
Applied egg-rr41.9%
pow-to-exp84.1%
rem-cube-cbrt84.2%
add-exp-log41.9%
*-un-lft-identity41.9%
exp-prod41.9%
metadata-eval41.9%
div-inv41.9%
Applied egg-rr41.9%
pow-exp41.9%
*-un-lft-identity41.9%
add-exp-log84.1%
rem-cube-cbrt84.1%
add-exp-log41.7%
add-cube-cbrt41.7%
unpow-prod-down41.7%
Applied egg-rr84.3%
pow-pow84.1%
add-sqr-sqrt41.8%
unpow-prod-down41.9%
metadata-eval41.9%
metadata-eval41.9%
Applied egg-rr41.9%
pow-sqr41.9%
metadata-eval41.9%
Simplified41.9%
Final simplification41.9%
(FPCore (a b angle)
:precision binary64
(+
(pow (* b (sin (* PI (/ angle 180.0)))) 2.0)
(pow
(*
a
(cos (pow (exp 0.5) (* 2.0 (log (* 0.005555555555555556 (* PI angle)))))))
2.0)))
double code(double a, double b, double angle) {
return pow((b * sin((((double) M_PI) * (angle / 180.0)))), 2.0) + pow((a * cos(pow(exp(0.5), (2.0 * log((0.005555555555555556 * (((double) M_PI) * angle))))))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((b * Math.sin((Math.PI * (angle / 180.0)))), 2.0) + Math.pow((a * Math.cos(Math.pow(Math.exp(0.5), (2.0 * Math.log((0.005555555555555556 * (Math.PI * angle))))))), 2.0);
}
def code(a, b, angle): return math.pow((b * math.sin((math.pi * (angle / 180.0)))), 2.0) + math.pow((a * math.cos(math.pow(math.exp(0.5), (2.0 * math.log((0.005555555555555556 * (math.pi * angle))))))), 2.0)
function code(a, b, angle) return Float64((Float64(b * sin(Float64(pi * Float64(angle / 180.0)))) ^ 2.0) + (Float64(a * cos((exp(0.5) ^ Float64(2.0 * log(Float64(0.005555555555555556 * Float64(pi * angle))))))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((b * sin((pi * (angle / 180.0)))) ^ 2.0) + ((a * cos((exp(0.5) ^ (2.0 * log((0.005555555555555556 * (pi * angle))))))) ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(b * N[Sin[N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(a * N[Cos[N[Power[N[Exp[0.5], $MachinePrecision], N[(2.0 * N[Log[N[(0.005555555555555556 * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(a \cdot \cos \left({\left(e^{0.5}\right)}^{\left(2 \cdot \log \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)\right)}\right)\right)}^{2}
\end{array}
Initial program 84.1%
add-cube-cbrt84.1%
pow384.1%
pow-to-exp41.9%
div-inv41.9%
metadata-eval41.9%
Applied egg-rr41.9%
pow-to-exp84.1%
rem-cube-cbrt84.2%
add-exp-log41.9%
*-un-lft-identity41.9%
exp-prod41.9%
metadata-eval41.9%
div-inv41.9%
Applied egg-rr41.9%
add-sqr-sqrt41.8%
unpow-prod-down41.8%
add-exp-log41.8%
pow1/241.8%
log-pow41.8%
add-log-exp41.8%
metadata-eval41.8%
div-inv41.8%
metadata-eval41.8%
add-exp-log41.8%
pow1/241.8%
log-pow41.8%
add-log-exp41.8%
metadata-eval41.8%
div-inv41.8%
metadata-eval41.8%
Applied egg-rr41.8%
pow-sqr41.8%
associate-*r*41.8%
*-commutative41.8%
Simplified41.8%
Final simplification41.8%
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* PI (/ angle 180.0)))) (+ (pow (* b (sin t_0)) 2.0) (pow (* a (cos (pow E (log t_0)))) 2.0))))
double code(double a, double b, double angle) {
double t_0 = ((double) M_PI) * (angle / 180.0);
return pow((b * sin(t_0)), 2.0) + pow((a * cos(pow(((double) M_E), log(t_0)))), 2.0);
}
public static double code(double a, double b, double angle) {
double t_0 = Math.PI * (angle / 180.0);
return Math.pow((b * Math.sin(t_0)), 2.0) + Math.pow((a * Math.cos(Math.pow(Math.E, Math.log(t_0)))), 2.0);
}
def code(a, b, angle): t_0 = math.pi * (angle / 180.0) return math.pow((b * math.sin(t_0)), 2.0) + math.pow((a * math.cos(math.pow(math.e, math.log(t_0)))), 2.0)
function code(a, b, angle) t_0 = Float64(pi * Float64(angle / 180.0)) return Float64((Float64(b * sin(t_0)) ^ 2.0) + (Float64(a * cos((exp(1) ^ log(t_0)))) ^ 2.0)) end
function tmp = code(a, b, angle) t_0 = pi * (angle / 180.0); tmp = ((b * sin(t_0)) ^ 2.0) + ((a * cos((2.71828182845904523536 ^ log(t_0)))) ^ 2.0); end
code[a_, b_, angle_] := Block[{t$95$0 = N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]}, N[(N[Power[N[(b * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(a * N[Cos[N[Power[E, N[Log[t$95$0], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \pi \cdot \frac{angle}{180}\\
{\left(b \cdot \sin t_0\right)}^{2} + {\left(a \cdot \cos \left({e}^{\log t_0}\right)\right)}^{2}
\end{array}
\end{array}
Initial program 84.1%
add-cube-cbrt84.1%
pow384.1%
pow-to-exp41.9%
div-inv41.9%
metadata-eval41.9%
Applied egg-rr41.9%
pow-to-exp84.1%
rem-cube-cbrt84.2%
add-exp-log41.9%
*-un-lft-identity41.9%
exp-prod41.9%
metadata-eval41.9%
div-inv41.9%
Applied egg-rr41.9%
Final simplification41.9%
(FPCore (a b angle) :precision binary64 (+ (pow (* b (sin (* PI (/ angle 180.0)))) 2.0) (pow (* a (cos (* angle (* (cbrt -1.7146776406035666e-7) (- PI))))) 2.0)))
double code(double a, double b, double angle) {
return pow((b * sin((((double) M_PI) * (angle / 180.0)))), 2.0) + pow((a * cos((angle * (cbrt(-1.7146776406035666e-7) * -((double) M_PI))))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((b * Math.sin((Math.PI * (angle / 180.0)))), 2.0) + Math.pow((a * Math.cos((angle * (Math.cbrt(-1.7146776406035666e-7) * -Math.PI)))), 2.0);
}
function code(a, b, angle) return Float64((Float64(b * sin(Float64(pi * Float64(angle / 180.0)))) ^ 2.0) + (Float64(a * cos(Float64(angle * Float64(cbrt(-1.7146776406035666e-7) * Float64(-pi))))) ^ 2.0)) end
code[a_, b_, angle_] := N[(N[Power[N[(b * N[Sin[N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(a * N[Cos[N[(angle * N[(N[Power[-1.7146776406035666e-7, 1/3], $MachinePrecision] * (-Pi)), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(a \cdot \cos \left(angle \cdot \left(\sqrt[3]{-1.7146776406035666 \cdot 10^{-7}} \cdot \left(-\pi\right)\right)\right)\right)}^{2}
\end{array}
Initial program 84.1%
add-cbrt-cube63.3%
pow1/349.9%
pow349.9%
div-inv49.9%
metadata-eval49.9%
Applied egg-rr49.9%
Taylor expanded in angle around -inf 84.2%
associate-*r*84.2%
neg-mul-184.2%
*-commutative84.2%
Simplified84.2%
Final simplification84.2%
(FPCore (a b angle) :precision binary64 (+ (pow (* b (sin (* PI (/ angle 180.0)))) 2.0) (pow (* a (cos (* PI (* angle 0.005555555555555556)))) 2.0)))
double code(double a, double b, double angle) {
return pow((b * sin((((double) M_PI) * (angle / 180.0)))), 2.0) + pow((a * cos((((double) M_PI) * (angle * 0.005555555555555556)))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((b * Math.sin((Math.PI * (angle / 180.0)))), 2.0) + Math.pow((a * Math.cos((Math.PI * (angle * 0.005555555555555556)))), 2.0);
}
def code(a, b, angle): return math.pow((b * math.sin((math.pi * (angle / 180.0)))), 2.0) + math.pow((a * math.cos((math.pi * (angle * 0.005555555555555556)))), 2.0)
function code(a, b, angle) return Float64((Float64(b * sin(Float64(pi * Float64(angle / 180.0)))) ^ 2.0) + (Float64(a * cos(Float64(pi * Float64(angle * 0.005555555555555556)))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((b * sin((pi * (angle / 180.0)))) ^ 2.0) + ((a * cos((pi * (angle * 0.005555555555555556)))) ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(b * N[Sin[N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(a * N[Cos[N[(Pi * N[(angle * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(a \cdot \cos \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2}
\end{array}
Initial program 84.1%
Taylor expanded in angle around inf 84.0%
*-commutative84.0%
*-commutative84.0%
associate-*r*84.2%
Simplified84.2%
Final simplification84.2%
(FPCore (a b angle) :precision binary64 (+ (pow (* b (sin (* PI (/ angle 180.0)))) 2.0) (pow (* a (cos (/ PI (/ 180.0 angle)))) 2.0)))
double code(double a, double b, double angle) {
return pow((b * sin((((double) M_PI) * (angle / 180.0)))), 2.0) + pow((a * cos((((double) M_PI) / (180.0 / angle)))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((b * Math.sin((Math.PI * (angle / 180.0)))), 2.0) + Math.pow((a * Math.cos((Math.PI / (180.0 / angle)))), 2.0);
}
def code(a, b, angle): return math.pow((b * math.sin((math.pi * (angle / 180.0)))), 2.0) + math.pow((a * math.cos((math.pi / (180.0 / angle)))), 2.0)
function code(a, b, angle) return Float64((Float64(b * sin(Float64(pi * Float64(angle / 180.0)))) ^ 2.0) + (Float64(a * cos(Float64(pi / Float64(180.0 / angle)))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((b * sin((pi * (angle / 180.0)))) ^ 2.0) + ((a * cos((pi / (180.0 / angle)))) ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(b * N[Sin[N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(a * N[Cos[N[(Pi / N[(180.0 / angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(a \cdot \cos \left(\frac{\pi}{\frac{180}{angle}}\right)\right)}^{2}
\end{array}
Initial program 84.1%
clear-num84.1%
un-div-inv84.2%
Applied egg-rr84.2%
Final simplification84.2%
(FPCore (a b angle) :precision binary64 (+ (pow a 2.0) (pow (* b (log1p (expm1 (sin (* PI (* angle 0.005555555555555556)))))) 2.0)))
double code(double a, double b, double angle) {
return pow(a, 2.0) + pow((b * log1p(expm1(sin((((double) M_PI) * (angle * 0.005555555555555556)))))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow(a, 2.0) + Math.pow((b * Math.log1p(Math.expm1(Math.sin((Math.PI * (angle * 0.005555555555555556)))))), 2.0);
}
def code(a, b, angle): return math.pow(a, 2.0) + math.pow((b * math.log1p(math.expm1(math.sin((math.pi * (angle * 0.005555555555555556)))))), 2.0)
function code(a, b, angle) return Float64((a ^ 2.0) + (Float64(b * log1p(expm1(sin(Float64(pi * Float64(angle * 0.005555555555555556)))))) ^ 2.0)) end
code[a_, b_, angle_] := N[(N[Power[a, 2.0], $MachinePrecision] + N[Power[N[(b * N[Log[1 + N[(Exp[N[Sin[N[(Pi * N[(angle * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{a}^{2} + {\left(b \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)\right)\right)}^{2}
\end{array}
Initial program 84.1%
Taylor expanded in angle around 0 84.0%
log1p-expm1-u84.1%
div-inv84.1%
metadata-eval84.1%
Applied egg-rr84.1%
Final simplification84.1%
(FPCore (a b angle) :precision binary64 (+ (pow a 2.0) (pow (* b (sin (* 0.005555555555555556 (* PI angle)))) 2.0)))
double code(double a, double b, double angle) {
return pow(a, 2.0) + pow((b * sin((0.005555555555555556 * (((double) M_PI) * angle)))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow(a, 2.0) + Math.pow((b * Math.sin((0.005555555555555556 * (Math.PI * angle)))), 2.0);
}
def code(a, b, angle): return math.pow(a, 2.0) + math.pow((b * math.sin((0.005555555555555556 * (math.pi * angle)))), 2.0)
function code(a, b, angle) return Float64((a ^ 2.0) + (Float64(b * sin(Float64(0.005555555555555556 * Float64(pi * angle)))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = (a ^ 2.0) + ((b * sin((0.005555555555555556 * (pi * angle)))) ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[a, 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[N[(0.005555555555555556 * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{a}^{2} + {\left(b \cdot \sin \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)\right)}^{2}
\end{array}
Initial program 84.1%
Taylor expanded in angle around 0 84.0%
Taylor expanded in angle around inf 84.1%
Final simplification84.1%
(FPCore (a b angle)
:precision binary64
(if (<= b 1.75e+207)
(+
(pow a 2.0)
(*
(* angle 0.005555555555555556)
(* (* PI b) (* angle (* 0.005555555555555556 (* PI b))))))
(+ (pow a 2.0) (* (pow (* b (* PI angle)) 2.0) 3.08641975308642e-5))))
double code(double a, double b, double angle) {
double tmp;
if (b <= 1.75e+207) {
tmp = pow(a, 2.0) + ((angle * 0.005555555555555556) * ((((double) M_PI) * b) * (angle * (0.005555555555555556 * (((double) M_PI) * b)))));
} else {
tmp = pow(a, 2.0) + (pow((b * (((double) M_PI) * angle)), 2.0) * 3.08641975308642e-5);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (b <= 1.75e+207) {
tmp = Math.pow(a, 2.0) + ((angle * 0.005555555555555556) * ((Math.PI * b) * (angle * (0.005555555555555556 * (Math.PI * b)))));
} else {
tmp = Math.pow(a, 2.0) + (Math.pow((b * (Math.PI * angle)), 2.0) * 3.08641975308642e-5);
}
return tmp;
}
def code(a, b, angle): tmp = 0 if b <= 1.75e+207: tmp = math.pow(a, 2.0) + ((angle * 0.005555555555555556) * ((math.pi * b) * (angle * (0.005555555555555556 * (math.pi * b))))) else: tmp = math.pow(a, 2.0) + (math.pow((b * (math.pi * angle)), 2.0) * 3.08641975308642e-5) return tmp
function code(a, b, angle) tmp = 0.0 if (b <= 1.75e+207) tmp = Float64((a ^ 2.0) + Float64(Float64(angle * 0.005555555555555556) * Float64(Float64(pi * b) * Float64(angle * Float64(0.005555555555555556 * Float64(pi * b)))))); else tmp = Float64((a ^ 2.0) + Float64((Float64(b * Float64(pi * angle)) ^ 2.0) * 3.08641975308642e-5)); end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (b <= 1.75e+207) tmp = (a ^ 2.0) + ((angle * 0.005555555555555556) * ((pi * b) * (angle * (0.005555555555555556 * (pi * b))))); else tmp = (a ^ 2.0) + (((b * (pi * angle)) ^ 2.0) * 3.08641975308642e-5); end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[b, 1.75e+207], N[(N[Power[a, 2.0], $MachinePrecision] + N[(N[(angle * 0.005555555555555556), $MachinePrecision] * N[(N[(Pi * b), $MachinePrecision] * N[(angle * N[(0.005555555555555556 * N[(Pi * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[a, 2.0], $MachinePrecision] + N[(N[Power[N[(b * N[(Pi * angle), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * 3.08641975308642e-5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.75 \cdot 10^{+207}:\\
\;\;\;\;{a}^{2} + \left(angle \cdot 0.005555555555555556\right) \cdot \left(\left(\pi \cdot b\right) \cdot \left(angle \cdot \left(0.005555555555555556 \cdot \left(\pi \cdot b\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;{a}^{2} + {\left(b \cdot \left(\pi \cdot angle\right)\right)}^{2} \cdot 3.08641975308642 \cdot 10^{-5}\\
\end{array}
\end{array}
if b < 1.75000000000000014e207Initial program 82.4%
Taylor expanded in angle around 0 82.3%
Taylor expanded in angle around 0 75.8%
*-commutative75.8%
Simplified75.8%
unpow275.8%
associate-*r*75.8%
*-commutative75.8%
metadata-eval75.8%
div-inv75.8%
associate-*l*77.1%
div-inv77.1%
metadata-eval77.1%
associate-*r*77.1%
*-commutative77.1%
associate-*l*77.1%
Applied egg-rr77.1%
if 1.75000000000000014e207 < b Initial program 99.8%
Taylor expanded in angle around 0 99.8%
Taylor expanded in angle around 0 99.8%
*-commutative99.8%
Simplified99.8%
*-commutative99.8%
unpow-prod-down99.9%
*-commutative99.9%
*-commutative99.9%
associate-*l*99.9%
metadata-eval99.9%
Applied egg-rr99.9%
Final simplification79.3%
(FPCore (a b angle) :precision binary64 (+ (pow a 2.0) (* 3.08641975308642e-5 (pow (* angle (* PI b)) 2.0))))
double code(double a, double b, double angle) {
return pow(a, 2.0) + (3.08641975308642e-5 * pow((angle * (((double) M_PI) * b)), 2.0));
}
public static double code(double a, double b, double angle) {
return Math.pow(a, 2.0) + (3.08641975308642e-5 * Math.pow((angle * (Math.PI * b)), 2.0));
}
def code(a, b, angle): return math.pow(a, 2.0) + (3.08641975308642e-5 * math.pow((angle * (math.pi * b)), 2.0))
function code(a, b, angle) return Float64((a ^ 2.0) + Float64(3.08641975308642e-5 * (Float64(angle * Float64(pi * b)) ^ 2.0))) end
function tmp = code(a, b, angle) tmp = (a ^ 2.0) + (3.08641975308642e-5 * ((angle * (pi * b)) ^ 2.0)); end
code[a_, b_, angle_] := N[(N[Power[a, 2.0], $MachinePrecision] + N[(3.08641975308642e-5 * N[Power[N[(angle * N[(Pi * b), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{a}^{2} + 3.08641975308642 \cdot 10^{-5} \cdot {\left(angle \cdot \left(\pi \cdot b\right)\right)}^{2}
\end{array}
Initial program 84.1%
Taylor expanded in angle around 0 84.0%
Taylor expanded in angle around 0 78.2%
*-commutative78.2%
Simplified78.2%
Taylor expanded in angle around 0 66.0%
associate-*r*66.1%
associate-*r*66.0%
*-commutative66.0%
associate-*l*66.0%
unpow266.0%
unpow266.0%
unpow266.0%
unswap-sqr66.0%
swap-sqr78.2%
unpow278.2%
*-commutative78.2%
associate-*l*78.2%
Simplified78.2%
Taylor expanded in angle around 0 78.2%
Final simplification78.2%
(FPCore (a b angle) :precision binary64 (+ (pow a 2.0) (* (pow (* b (* PI angle)) 2.0) 3.08641975308642e-5)))
double code(double a, double b, double angle) {
return pow(a, 2.0) + (pow((b * (((double) M_PI) * angle)), 2.0) * 3.08641975308642e-5);
}
public static double code(double a, double b, double angle) {
return Math.pow(a, 2.0) + (Math.pow((b * (Math.PI * angle)), 2.0) * 3.08641975308642e-5);
}
def code(a, b, angle): return math.pow(a, 2.0) + (math.pow((b * (math.pi * angle)), 2.0) * 3.08641975308642e-5)
function code(a, b, angle) return Float64((a ^ 2.0) + Float64((Float64(b * Float64(pi * angle)) ^ 2.0) * 3.08641975308642e-5)) end
function tmp = code(a, b, angle) tmp = (a ^ 2.0) + (((b * (pi * angle)) ^ 2.0) * 3.08641975308642e-5); end
code[a_, b_, angle_] := N[(N[Power[a, 2.0], $MachinePrecision] + N[(N[Power[N[(b * N[(Pi * angle), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * 3.08641975308642e-5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{a}^{2} + {\left(b \cdot \left(\pi \cdot angle\right)\right)}^{2} \cdot 3.08641975308642 \cdot 10^{-5}
\end{array}
Initial program 84.1%
Taylor expanded in angle around 0 84.0%
Taylor expanded in angle around 0 78.2%
*-commutative78.2%
Simplified78.2%
*-commutative78.2%
unpow-prod-down78.2%
*-commutative78.2%
*-commutative78.2%
associate-*l*78.2%
metadata-eval78.2%
Applied egg-rr78.2%
Final simplification78.2%
(FPCore (a b angle) :precision binary64 (+ (pow a 2.0) (pow (* angle (* 0.005555555555555556 (* PI b))) 2.0)))
double code(double a, double b, double angle) {
return pow(a, 2.0) + pow((angle * (0.005555555555555556 * (((double) M_PI) * b))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow(a, 2.0) + Math.pow((angle * (0.005555555555555556 * (Math.PI * b))), 2.0);
}
def code(a, b, angle): return math.pow(a, 2.0) + math.pow((angle * (0.005555555555555556 * (math.pi * b))), 2.0)
function code(a, b, angle) return Float64((a ^ 2.0) + (Float64(angle * Float64(0.005555555555555556 * Float64(pi * b))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = (a ^ 2.0) + ((angle * (0.005555555555555556 * (pi * b))) ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[a, 2.0], $MachinePrecision] + N[Power[N[(angle * N[(0.005555555555555556 * N[(Pi * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{a}^{2} + {\left(angle \cdot \left(0.005555555555555556 \cdot \left(\pi \cdot b\right)\right)\right)}^{2}
\end{array}
Initial program 84.1%
Taylor expanded in angle around 0 84.0%
Taylor expanded in angle around 0 78.2%
*-commutative78.2%
associate-*l*78.2%
*-commutative78.2%
Simplified78.2%
Final simplification78.2%
(FPCore (a b angle) :precision binary64 (+ (pow a 2.0) (pow (* b (* angle (* PI 0.005555555555555556))) 2.0)))
double code(double a, double b, double angle) {
return pow(a, 2.0) + pow((b * (angle * (((double) M_PI) * 0.005555555555555556))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow(a, 2.0) + Math.pow((b * (angle * (Math.PI * 0.005555555555555556))), 2.0);
}
def code(a, b, angle): return math.pow(a, 2.0) + math.pow((b * (angle * (math.pi * 0.005555555555555556))), 2.0)
function code(a, b, angle) return Float64((a ^ 2.0) + (Float64(b * Float64(angle * Float64(pi * 0.005555555555555556))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = (a ^ 2.0) + ((b * (angle * (pi * 0.005555555555555556))) ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[a, 2.0], $MachinePrecision] + N[Power[N[(b * N[(angle * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{a}^{2} + {\left(b \cdot \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)}^{2}
\end{array}
Initial program 84.1%
Taylor expanded in angle around 0 84.0%
Taylor expanded in angle around 0 78.2%
*-commutative78.2%
associate-*l*78.2%
Simplified78.2%
Final simplification78.2%
herbie shell --seed 2023230
(FPCore (a b angle)
:name "ab-angle->ABCF C"
:precision binary64
(+ (pow (* a (cos (* PI (/ angle 180.0)))) 2.0) (pow (* b (sin (* PI (/ angle 180.0)))) 2.0)))