
(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 9 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 (+ (pow a 2.0) (pow (* (sin (* angle (* PI 0.005555555555555556))) b) 2.0)))
double code(double a, double b, double angle) {
return pow(a, 2.0) + pow((sin((angle * (((double) M_PI) * 0.005555555555555556))) * b), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow(a, 2.0) + Math.pow((Math.sin((angle * (Math.PI * 0.005555555555555556))) * b), 2.0);
}
def code(a, b, angle): return math.pow(a, 2.0) + math.pow((math.sin((angle * (math.pi * 0.005555555555555556))) * b), 2.0)
function code(a, b, angle) return Float64((a ^ 2.0) + (Float64(sin(Float64(angle * Float64(pi * 0.005555555555555556))) * b) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = (a ^ 2.0) + ((sin((angle * (pi * 0.005555555555555556))) * b) ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[a, 2.0], $MachinePrecision] + N[Power[N[(N[Sin[N[(angle * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * b), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{a}^{2} + {\left(\sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right) \cdot b\right)}^{2}
\end{array}
Initial program 81.0%
Taylor expanded in b around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6481.1
Simplified81.1%
Taylor expanded in angle around 0
Simplified81.5%
Final simplification81.5%
(FPCore (a b angle) :precision binary64 (+ (pow a 2.0) (pow (* b (sin (* 0.005555555555555556 (* angle PI)))) 2.0)))
double code(double a, double b, double angle) {
return pow(a, 2.0) + pow((b * sin((0.005555555555555556 * (angle * ((double) M_PI))))), 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 * (angle * Math.PI)))), 2.0);
}
def code(a, b, angle): return math.pow(a, 2.0) + math.pow((b * math.sin((0.005555555555555556 * (angle * math.pi)))), 2.0)
function code(a, b, angle) return Float64((a ^ 2.0) + (Float64(b * sin(Float64(0.005555555555555556 * Float64(angle * pi)))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = (a ^ 2.0) + ((b * sin((0.005555555555555556 * (angle * pi)))) ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[a, 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{a}^{2} + {\left(b \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2}
\end{array}
Initial program 81.0%
Taylor expanded in angle around 0
Simplified81.4%
Taylor expanded in b around 0
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-sin.f64N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f6481.0
Simplified81.0%
Final simplification81.0%
(FPCore (a b angle)
:precision binary64
(if (<= (/ angle 180.0) 0.001)
(+
(pow a 2.0)
(pow
(*
b
(*
angle
(*
PI
(fma
(* -2.8577960676726107e-8 (* angle angle))
(* PI PI)
0.005555555555555556))))
2.0))
(+
(pow a 2.0)
(*
(- 0.5 (* 0.5 (cos (* 2.0 (* angle (* PI 0.005555555555555556))))))
(* b b)))))
double code(double a, double b, double angle) {
double tmp;
if ((angle / 180.0) <= 0.001) {
tmp = pow(a, 2.0) + pow((b * (angle * (((double) M_PI) * fma((-2.8577960676726107e-8 * (angle * angle)), (((double) M_PI) * ((double) M_PI)), 0.005555555555555556)))), 2.0);
} else {
tmp = pow(a, 2.0) + ((0.5 - (0.5 * cos((2.0 * (angle * (((double) M_PI) * 0.005555555555555556)))))) * (b * b));
}
return tmp;
}
function code(a, b, angle) tmp = 0.0 if (Float64(angle / 180.0) <= 0.001) tmp = Float64((a ^ 2.0) + (Float64(b * Float64(angle * Float64(pi * fma(Float64(-2.8577960676726107e-8 * Float64(angle * angle)), Float64(pi * pi), 0.005555555555555556)))) ^ 2.0)); else tmp = Float64((a ^ 2.0) + Float64(Float64(0.5 - Float64(0.5 * cos(Float64(2.0 * Float64(angle * Float64(pi * 0.005555555555555556)))))) * Float64(b * b))); end return tmp end
code[a_, b_, angle_] := If[LessEqual[N[(angle / 180.0), $MachinePrecision], 0.001], N[(N[Power[a, 2.0], $MachinePrecision] + N[Power[N[(b * N[(angle * N[(Pi * N[(N[(-2.8577960676726107e-8 * N[(angle * angle), $MachinePrecision]), $MachinePrecision] * N[(Pi * Pi), $MachinePrecision] + 0.005555555555555556), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], N[(N[Power[a, 2.0], $MachinePrecision] + N[(N[(0.5 - N[(0.5 * N[Cos[N[(2.0 * N[(angle * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{angle}{180} \leq 0.001:\\
\;\;\;\;{a}^{2} + {\left(b \cdot \left(angle \cdot \left(\pi \cdot \mathsf{fma}\left(-2.8577960676726107 \cdot 10^{-8} \cdot \left(angle \cdot angle\right), \pi \cdot \pi, 0.005555555555555556\right)\right)\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;{a}^{2} + \left(0.5 - 0.5 \cdot \cos \left(2 \cdot \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)\right) \cdot \left(b \cdot b\right)\\
\end{array}
\end{array}
if (/.f64 angle #s(literal 180 binary64)) < 1e-3Initial program 88.8%
Taylor expanded in angle around 0
Simplified89.1%
Taylor expanded in angle around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
unpow3N/A
unpow2N/A
associate-*r*N/A
distribute-rgt-outN/A
+-commutativeN/A
lower-*.f64N/A
Simplified83.7%
if 1e-3 < (/.f64 angle #s(literal 180 binary64)) Initial program 60.8%
Taylor expanded in b around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6460.8
Simplified60.8%
Taylor expanded in angle around 0
Simplified61.5%
Applied egg-rr61.5%
Final simplification77.5%
(FPCore (a b angle)
:precision binary64
(if (<= (/ angle 180.0) 2e-5)
(+
(pow a 2.0)
(* (* angle b) (* (* PI (* PI 3.08641975308642e-5)) (* angle b))))
(+
(pow a 2.0)
(*
b
(*
b
(- 0.5 (* 0.5 (cos (* 2.0 (* angle (* PI 0.005555555555555556)))))))))))
double code(double a, double b, double angle) {
double tmp;
if ((angle / 180.0) <= 2e-5) {
tmp = pow(a, 2.0) + ((angle * b) * ((((double) M_PI) * (((double) M_PI) * 3.08641975308642e-5)) * (angle * b)));
} else {
tmp = pow(a, 2.0) + (b * (b * (0.5 - (0.5 * cos((2.0 * (angle * (((double) M_PI) * 0.005555555555555556))))))));
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if ((angle / 180.0) <= 2e-5) {
tmp = Math.pow(a, 2.0) + ((angle * b) * ((Math.PI * (Math.PI * 3.08641975308642e-5)) * (angle * b)));
} else {
tmp = Math.pow(a, 2.0) + (b * (b * (0.5 - (0.5 * Math.cos((2.0 * (angle * (Math.PI * 0.005555555555555556))))))));
}
return tmp;
}
def code(a, b, angle): tmp = 0 if (angle / 180.0) <= 2e-5: tmp = math.pow(a, 2.0) + ((angle * b) * ((math.pi * (math.pi * 3.08641975308642e-5)) * (angle * b))) else: tmp = math.pow(a, 2.0) + (b * (b * (0.5 - (0.5 * math.cos((2.0 * (angle * (math.pi * 0.005555555555555556)))))))) return tmp
function code(a, b, angle) tmp = 0.0 if (Float64(angle / 180.0) <= 2e-5) tmp = Float64((a ^ 2.0) + Float64(Float64(angle * b) * Float64(Float64(pi * Float64(pi * 3.08641975308642e-5)) * Float64(angle * b)))); else tmp = Float64((a ^ 2.0) + Float64(b * Float64(b * Float64(0.5 - Float64(0.5 * cos(Float64(2.0 * Float64(angle * Float64(pi * 0.005555555555555556))))))))); end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if ((angle / 180.0) <= 2e-5) tmp = (a ^ 2.0) + ((angle * b) * ((pi * (pi * 3.08641975308642e-5)) * (angle * b))); else tmp = (a ^ 2.0) + (b * (b * (0.5 - (0.5 * cos((2.0 * (angle * (pi * 0.005555555555555556)))))))); end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[N[(angle / 180.0), $MachinePrecision], 2e-5], N[(N[Power[a, 2.0], $MachinePrecision] + N[(N[(angle * b), $MachinePrecision] * N[(N[(Pi * N[(Pi * 3.08641975308642e-5), $MachinePrecision]), $MachinePrecision] * N[(angle * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[a, 2.0], $MachinePrecision] + N[(b * N[(b * N[(0.5 - N[(0.5 * N[Cos[N[(2.0 * N[(angle * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{angle}{180} \leq 2 \cdot 10^{-5}:\\
\;\;\;\;{a}^{2} + \left(angle \cdot b\right) \cdot \left(\left(\pi \cdot \left(\pi \cdot 3.08641975308642 \cdot 10^{-5}\right)\right) \cdot \left(angle \cdot b\right)\right)\\
\mathbf{else}:\\
\;\;\;\;{a}^{2} + b \cdot \left(b \cdot \left(0.5 - 0.5 \cdot \cos \left(2 \cdot \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)\right)\right)\\
\end{array}
\end{array}
if (/.f64 angle #s(literal 180 binary64)) < 2.00000000000000016e-5Initial program 88.7%
Taylor expanded in angle around 0
Simplified89.1%
Taylor expanded in angle around 0
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-PI.f64N/A
lower-PI.f6473.4
Simplified73.4%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-PI.f64N/A
associate-*l*N/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
associate-*l*N/A
associate-*l*N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
rem-square-sqrtN/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
Applied egg-rr84.8%
if 2.00000000000000016e-5 < (/.f64 angle #s(literal 180 binary64)) Initial program 61.3%
Taylor expanded in b around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6461.3
Simplified61.3%
Taylor expanded in angle around 0
Simplified62.0%
Applied egg-rr61.7%
Final simplification78.3%
(FPCore (a b angle)
:precision binary64
(if (<= b 1.5e+112)
(+
(pow a 2.0)
(* (* PI PI) (* angle (* 3.08641975308642e-5 (* angle (* b b))))))
(+
(pow a 2.0)
(* b (* (* PI (* PI 3.08641975308642e-5)) (* angle (* angle b)))))))
double code(double a, double b, double angle) {
double tmp;
if (b <= 1.5e+112) {
tmp = pow(a, 2.0) + ((((double) M_PI) * ((double) M_PI)) * (angle * (3.08641975308642e-5 * (angle * (b * b)))));
} else {
tmp = pow(a, 2.0) + (b * ((((double) M_PI) * (((double) M_PI) * 3.08641975308642e-5)) * (angle * (angle * b))));
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (b <= 1.5e+112) {
tmp = Math.pow(a, 2.0) + ((Math.PI * Math.PI) * (angle * (3.08641975308642e-5 * (angle * (b * b)))));
} else {
tmp = Math.pow(a, 2.0) + (b * ((Math.PI * (Math.PI * 3.08641975308642e-5)) * (angle * (angle * b))));
}
return tmp;
}
def code(a, b, angle): tmp = 0 if b <= 1.5e+112: tmp = math.pow(a, 2.0) + ((math.pi * math.pi) * (angle * (3.08641975308642e-5 * (angle * (b * b))))) else: tmp = math.pow(a, 2.0) + (b * ((math.pi * (math.pi * 3.08641975308642e-5)) * (angle * (angle * b)))) return tmp
function code(a, b, angle) tmp = 0.0 if (b <= 1.5e+112) tmp = Float64((a ^ 2.0) + Float64(Float64(pi * pi) * Float64(angle * Float64(3.08641975308642e-5 * Float64(angle * Float64(b * b)))))); else tmp = Float64((a ^ 2.0) + Float64(b * Float64(Float64(pi * Float64(pi * 3.08641975308642e-5)) * Float64(angle * Float64(angle * b))))); end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (b <= 1.5e+112) tmp = (a ^ 2.0) + ((pi * pi) * (angle * (3.08641975308642e-5 * (angle * (b * b))))); else tmp = (a ^ 2.0) + (b * ((pi * (pi * 3.08641975308642e-5)) * (angle * (angle * b)))); end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[b, 1.5e+112], N[(N[Power[a, 2.0], $MachinePrecision] + N[(N[(Pi * Pi), $MachinePrecision] * N[(angle * N[(3.08641975308642e-5 * N[(angle * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[a, 2.0], $MachinePrecision] + N[(b * N[(N[(Pi * N[(Pi * 3.08641975308642e-5), $MachinePrecision]), $MachinePrecision] * N[(angle * N[(angle * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.5 \cdot 10^{+112}:\\
\;\;\;\;{a}^{2} + \left(\pi \cdot \pi\right) \cdot \left(angle \cdot \left(3.08641975308642 \cdot 10^{-5} \cdot \left(angle \cdot \left(b \cdot b\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;{a}^{2} + b \cdot \left(\left(\pi \cdot \left(\pi \cdot 3.08641975308642 \cdot 10^{-5}\right)\right) \cdot \left(angle \cdot \left(angle \cdot b\right)\right)\right)\\
\end{array}
\end{array}
if b < 1.4999999999999999e112Initial program 77.9%
Taylor expanded in angle around 0
Simplified78.4%
Taylor expanded in angle around 0
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-PI.f64N/A
lower-PI.f6469.8
Simplified69.8%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6469.8
Applied egg-rr69.8%
if 1.4999999999999999e112 < b Initial program 95.9%
Taylor expanded in angle around 0
Simplified95.9%
Taylor expanded in angle around 0
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-PI.f64N/A
lower-PI.f6465.5
Simplified65.5%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-PI.f64N/A
associate-*l*N/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
associate-*l*N/A
associate-*l*N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
rem-square-sqrtN/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
Applied egg-rr95.7%
Final simplification74.2%
(FPCore (a b angle)
:precision binary64
(if (<= b 2e+124)
(+
(pow a 2.0)
(* (* PI PI) (* angle (* 3.08641975308642e-5 (* angle (* b b))))))
(+
(pow a 2.0)
(* (* (* angle b) (* angle b)) (* (* PI PI) 3.08641975308642e-5)))))
double code(double a, double b, double angle) {
double tmp;
if (b <= 2e+124) {
tmp = pow(a, 2.0) + ((((double) M_PI) * ((double) M_PI)) * (angle * (3.08641975308642e-5 * (angle * (b * b)))));
} else {
tmp = pow(a, 2.0) + (((angle * b) * (angle * b)) * ((((double) M_PI) * ((double) M_PI)) * 3.08641975308642e-5));
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (b <= 2e+124) {
tmp = Math.pow(a, 2.0) + ((Math.PI * Math.PI) * (angle * (3.08641975308642e-5 * (angle * (b * b)))));
} else {
tmp = Math.pow(a, 2.0) + (((angle * b) * (angle * b)) * ((Math.PI * Math.PI) * 3.08641975308642e-5));
}
return tmp;
}
def code(a, b, angle): tmp = 0 if b <= 2e+124: tmp = math.pow(a, 2.0) + ((math.pi * math.pi) * (angle * (3.08641975308642e-5 * (angle * (b * b))))) else: tmp = math.pow(a, 2.0) + (((angle * b) * (angle * b)) * ((math.pi * math.pi) * 3.08641975308642e-5)) return tmp
function code(a, b, angle) tmp = 0.0 if (b <= 2e+124) tmp = Float64((a ^ 2.0) + Float64(Float64(pi * pi) * Float64(angle * Float64(3.08641975308642e-5 * Float64(angle * Float64(b * b)))))); else tmp = Float64((a ^ 2.0) + Float64(Float64(Float64(angle * b) * Float64(angle * b)) * Float64(Float64(pi * pi) * 3.08641975308642e-5))); end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (b <= 2e+124) tmp = (a ^ 2.0) + ((pi * pi) * (angle * (3.08641975308642e-5 * (angle * (b * b))))); else tmp = (a ^ 2.0) + (((angle * b) * (angle * b)) * ((pi * pi) * 3.08641975308642e-5)); end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[b, 2e+124], N[(N[Power[a, 2.0], $MachinePrecision] + N[(N[(Pi * Pi), $MachinePrecision] * N[(angle * N[(3.08641975308642e-5 * N[(angle * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[a, 2.0], $MachinePrecision] + N[(N[(N[(angle * b), $MachinePrecision] * N[(angle * b), $MachinePrecision]), $MachinePrecision] * N[(N[(Pi * Pi), $MachinePrecision] * 3.08641975308642e-5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 2 \cdot 10^{+124}:\\
\;\;\;\;{a}^{2} + \left(\pi \cdot \pi\right) \cdot \left(angle \cdot \left(3.08641975308642 \cdot 10^{-5} \cdot \left(angle \cdot \left(b \cdot b\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;{a}^{2} + \left(\left(angle \cdot b\right) \cdot \left(angle \cdot b\right)\right) \cdot \left(\left(\pi \cdot \pi\right) \cdot 3.08641975308642 \cdot 10^{-5}\right)\\
\end{array}
\end{array}
if b < 1.9999999999999999e124Initial program 78.1%
Taylor expanded in angle around 0
Simplified78.6%
Taylor expanded in angle around 0
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-PI.f64N/A
lower-PI.f6470.0
Simplified70.0%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6470.1
Applied egg-rr70.1%
if 1.9999999999999999e124 < b Initial program 95.8%
Taylor expanded in angle around 0
Simplified95.8%
Taylor expanded in angle around 0
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-PI.f64N/A
lower-PI.f6463.9
Simplified63.9%
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6495.5
Applied egg-rr95.5%
Final simplification74.2%
(FPCore (a b angle)
:precision binary64
(if (<= b 2e+124)
(+
(pow a 2.0)
(* (* PI PI) (* angle (* 3.08641975308642e-5 (* angle (* b b))))))
(+
(pow a 2.0)
(* angle (* b (* b (* angle (* PI (* PI 3.08641975308642e-5)))))))))
double code(double a, double b, double angle) {
double tmp;
if (b <= 2e+124) {
tmp = pow(a, 2.0) + ((((double) M_PI) * ((double) M_PI)) * (angle * (3.08641975308642e-5 * (angle * (b * b)))));
} else {
tmp = pow(a, 2.0) + (angle * (b * (b * (angle * (((double) M_PI) * (((double) M_PI) * 3.08641975308642e-5))))));
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (b <= 2e+124) {
tmp = Math.pow(a, 2.0) + ((Math.PI * Math.PI) * (angle * (3.08641975308642e-5 * (angle * (b * b)))));
} else {
tmp = Math.pow(a, 2.0) + (angle * (b * (b * (angle * (Math.PI * (Math.PI * 3.08641975308642e-5))))));
}
return tmp;
}
def code(a, b, angle): tmp = 0 if b <= 2e+124: tmp = math.pow(a, 2.0) + ((math.pi * math.pi) * (angle * (3.08641975308642e-5 * (angle * (b * b))))) else: tmp = math.pow(a, 2.0) + (angle * (b * (b * (angle * (math.pi * (math.pi * 3.08641975308642e-5)))))) return tmp
function code(a, b, angle) tmp = 0.0 if (b <= 2e+124) tmp = Float64((a ^ 2.0) + Float64(Float64(pi * pi) * Float64(angle * Float64(3.08641975308642e-5 * Float64(angle * Float64(b * b)))))); else tmp = Float64((a ^ 2.0) + Float64(angle * Float64(b * Float64(b * Float64(angle * Float64(pi * Float64(pi * 3.08641975308642e-5))))))); end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (b <= 2e+124) tmp = (a ^ 2.0) + ((pi * pi) * (angle * (3.08641975308642e-5 * (angle * (b * b))))); else tmp = (a ^ 2.0) + (angle * (b * (b * (angle * (pi * (pi * 3.08641975308642e-5)))))); end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[b, 2e+124], N[(N[Power[a, 2.0], $MachinePrecision] + N[(N[(Pi * Pi), $MachinePrecision] * N[(angle * N[(3.08641975308642e-5 * N[(angle * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[a, 2.0], $MachinePrecision] + N[(angle * N[(b * N[(b * N[(angle * N[(Pi * N[(Pi * 3.08641975308642e-5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 2 \cdot 10^{+124}:\\
\;\;\;\;{a}^{2} + \left(\pi \cdot \pi\right) \cdot \left(angle \cdot \left(3.08641975308642 \cdot 10^{-5} \cdot \left(angle \cdot \left(b \cdot b\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;{a}^{2} + angle \cdot \left(b \cdot \left(b \cdot \left(angle \cdot \left(\pi \cdot \left(\pi \cdot 3.08641975308642 \cdot 10^{-5}\right)\right)\right)\right)\right)\\
\end{array}
\end{array}
if b < 1.9999999999999999e124Initial program 78.1%
Taylor expanded in angle around 0
Simplified78.6%
Taylor expanded in angle around 0
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-PI.f64N/A
lower-PI.f6470.0
Simplified70.0%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6470.1
Applied egg-rr70.1%
if 1.9999999999999999e124 < b Initial program 95.8%
Taylor expanded in angle around 0
Simplified95.8%
Taylor expanded in angle around 0
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-PI.f64N/A
lower-PI.f6463.9
Simplified63.9%
lift-*.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied egg-rr88.8%
Final simplification73.1%
(FPCore (a b angle)
:precision binary64
(if (<= b 5e+15)
(+
(pow a 2.0)
(* (* (* PI PI) 3.08641975308642e-5) (* angle (* angle (* b b)))))
(+
(pow a 2.0)
(* angle (* b (* b (* angle (* PI (* PI 3.08641975308642e-5)))))))))
double code(double a, double b, double angle) {
double tmp;
if (b <= 5e+15) {
tmp = pow(a, 2.0) + (((((double) M_PI) * ((double) M_PI)) * 3.08641975308642e-5) * (angle * (angle * (b * b))));
} else {
tmp = pow(a, 2.0) + (angle * (b * (b * (angle * (((double) M_PI) * (((double) M_PI) * 3.08641975308642e-5))))));
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (b <= 5e+15) {
tmp = Math.pow(a, 2.0) + (((Math.PI * Math.PI) * 3.08641975308642e-5) * (angle * (angle * (b * b))));
} else {
tmp = Math.pow(a, 2.0) + (angle * (b * (b * (angle * (Math.PI * (Math.PI * 3.08641975308642e-5))))));
}
return tmp;
}
def code(a, b, angle): tmp = 0 if b <= 5e+15: tmp = math.pow(a, 2.0) + (((math.pi * math.pi) * 3.08641975308642e-5) * (angle * (angle * (b * b)))) else: tmp = math.pow(a, 2.0) + (angle * (b * (b * (angle * (math.pi * (math.pi * 3.08641975308642e-5)))))) return tmp
function code(a, b, angle) tmp = 0.0 if (b <= 5e+15) tmp = Float64((a ^ 2.0) + Float64(Float64(Float64(pi * pi) * 3.08641975308642e-5) * Float64(angle * Float64(angle * Float64(b * b))))); else tmp = Float64((a ^ 2.0) + Float64(angle * Float64(b * Float64(b * Float64(angle * Float64(pi * Float64(pi * 3.08641975308642e-5))))))); end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (b <= 5e+15) tmp = (a ^ 2.0) + (((pi * pi) * 3.08641975308642e-5) * (angle * (angle * (b * b)))); else tmp = (a ^ 2.0) + (angle * (b * (b * (angle * (pi * (pi * 3.08641975308642e-5)))))); end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[b, 5e+15], N[(N[Power[a, 2.0], $MachinePrecision] + N[(N[(N[(Pi * Pi), $MachinePrecision] * 3.08641975308642e-5), $MachinePrecision] * N[(angle * N[(angle * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[a, 2.0], $MachinePrecision] + N[(angle * N[(b * N[(b * N[(angle * N[(Pi * N[(Pi * 3.08641975308642e-5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 5 \cdot 10^{+15}:\\
\;\;\;\;{a}^{2} + \left(\left(\pi \cdot \pi\right) \cdot 3.08641975308642 \cdot 10^{-5}\right) \cdot \left(angle \cdot \left(angle \cdot \left(b \cdot b\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;{a}^{2} + angle \cdot \left(b \cdot \left(b \cdot \left(angle \cdot \left(\pi \cdot \left(\pi \cdot 3.08641975308642 \cdot 10^{-5}\right)\right)\right)\right)\right)\\
\end{array}
\end{array}
if b < 5e15Initial program 78.0%
Taylor expanded in angle around 0
Simplified78.5%
Taylor expanded in angle around 0
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-PI.f64N/A
lower-PI.f6469.1
Simplified69.1%
if 5e15 < b Initial program 89.7%
Taylor expanded in angle around 0
Simplified89.6%
Taylor expanded in angle around 0
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-PI.f64N/A
lower-PI.f6468.8
Simplified68.8%
lift-*.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied egg-rr84.4%
Final simplification73.1%
(FPCore (a b angle) :precision binary64 (+ (pow a 2.0) (* (* (* PI PI) 3.08641975308642e-5) (* angle (* angle (* b b))))))
double code(double a, double b, double angle) {
return pow(a, 2.0) + (((((double) M_PI) * ((double) M_PI)) * 3.08641975308642e-5) * (angle * (angle * (b * b))));
}
public static double code(double a, double b, double angle) {
return Math.pow(a, 2.0) + (((Math.PI * Math.PI) * 3.08641975308642e-5) * (angle * (angle * (b * b))));
}
def code(a, b, angle): return math.pow(a, 2.0) + (((math.pi * math.pi) * 3.08641975308642e-5) * (angle * (angle * (b * b))))
function code(a, b, angle) return Float64((a ^ 2.0) + Float64(Float64(Float64(pi * pi) * 3.08641975308642e-5) * Float64(angle * Float64(angle * Float64(b * b))))) end
function tmp = code(a, b, angle) tmp = (a ^ 2.0) + (((pi * pi) * 3.08641975308642e-5) * (angle * (angle * (b * b)))); end
code[a_, b_, angle_] := N[(N[Power[a, 2.0], $MachinePrecision] + N[(N[(N[(Pi * Pi), $MachinePrecision] * 3.08641975308642e-5), $MachinePrecision] * N[(angle * N[(angle * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{a}^{2} + \left(\left(\pi \cdot \pi\right) \cdot 3.08641975308642 \cdot 10^{-5}\right) \cdot \left(angle \cdot \left(angle \cdot \left(b \cdot b\right)\right)\right)
\end{array}
Initial program 81.0%
Taylor expanded in angle around 0
Simplified81.4%
Taylor expanded in angle around 0
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-PI.f64N/A
lower-PI.f6469.0
Simplified69.0%
Final simplification69.0%
herbie shell --seed 2024219
(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)))