
(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 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* (/ angle 180.0) PI))) (+ (pow (* a (sin t_0)) 2.0) (pow (* b (cos t_0)) 2.0))))
double code(double a, double b, double angle) {
double t_0 = (angle / 180.0) * ((double) M_PI);
return pow((a * sin(t_0)), 2.0) + pow((b * cos(t_0)), 2.0);
}
public static double code(double a, double b, double angle) {
double t_0 = (angle / 180.0) * Math.PI;
return Math.pow((a * Math.sin(t_0)), 2.0) + Math.pow((b * Math.cos(t_0)), 2.0);
}
def code(a, b, angle): t_0 = (angle / 180.0) * math.pi return math.pow((a * math.sin(t_0)), 2.0) + math.pow((b * math.cos(t_0)), 2.0)
function code(a, b, angle) t_0 = Float64(Float64(angle / 180.0) * pi) return Float64((Float64(a * sin(t_0)) ^ 2.0) + (Float64(b * cos(t_0)) ^ 2.0)) end
function tmp = code(a, b, angle) t_0 = (angle / 180.0) * pi; tmp = ((a * sin(t_0)) ^ 2.0) + ((b * cos(t_0)) ^ 2.0); end
code[a_, b_, angle_] := Block[{t$95$0 = N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]}, N[(N[Power[N[(a * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{angle}{180} \cdot \pi\\
{\left(a \cdot \sin t\_0\right)}^{2} + {\left(b \cdot \cos t\_0\right)}^{2}
\end{array}
\end{array}
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (* (/ angle 180.0) PI))) 2.0) (pow (* b (cos (* (sqrt PI) (* (/ (sqrt PI) -180.0) (/ 1.0 (/ -1.0 angle)))))) 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((sqrt(((double) M_PI)) * ((sqrt(((double) M_PI)) / -180.0) * (1.0 / (-1.0 / angle)))))), 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.sqrt(Math.PI) * ((Math.sqrt(Math.PI) / -180.0) * (1.0 / (-1.0 / angle)))))), 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.sqrt(math.pi) * ((math.sqrt(math.pi) / -180.0) * (1.0 / (-1.0 / angle)))))), 2.0)
function code(a, b, angle) return Float64((Float64(a * sin(Float64(Float64(angle / 180.0) * pi))) ^ 2.0) + (Float64(b * cos(Float64(sqrt(pi) * Float64(Float64(sqrt(pi) / -180.0) * Float64(1.0 / Float64(-1.0 / angle)))))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((a * sin(((angle / 180.0) * pi))) ^ 2.0) + ((b * cos((sqrt(pi) * ((sqrt(pi) / -180.0) * (1.0 / (-1.0 / angle)))))) ^ 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[(N[Sqrt[Pi], $MachinePrecision] * N[(N[(N[Sqrt[Pi], $MachinePrecision] / -180.0), $MachinePrecision] * N[(1.0 / N[(-1.0 / angle), $MachinePrecision]), $MachinePrecision]), $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(\sqrt{\pi} \cdot \left(\frac{\sqrt{\pi}}{-180} \cdot \frac{1}{\frac{-1}{angle}}\right)\right)\right)}^{2}
\end{array}
Initial program 79.3%
associate-*l/N/A
clear-numN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f6479.4%
Applied egg-rr79.4%
clear-numN/A
associate-/l*N/A
associate-/r*N/A
clear-numN/A
add-sqr-sqrtN/A
associate-/l*N/A
div-invN/A
times-fracN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
PI-lowering-PI.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
PI-lowering-PI.f64N/A
/-lowering-/.f6479.3%
Applied egg-rr79.3%
frac-2negN/A
div-invN/A
*-lowering-*.f64N/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
PI-lowering-PI.f64N/A
metadata-evalN/A
/-lowering-/.f64N/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f6479.4%
Applied egg-rr79.4%
Final simplification79.4%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (* (/ angle 180.0) PI))) 2.0) (pow (* b (cos (/ 1.0 (/ 180.0 (* angle PI))))) 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((1.0 / (180.0 / (angle * ((double) M_PI)))))), 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((1.0 / (180.0 / (angle * Math.PI))))), 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((1.0 / (180.0 / (angle * math.pi))))), 2.0)
function code(a, b, angle) return Float64((Float64(a * sin(Float64(Float64(angle / 180.0) * pi))) ^ 2.0) + (Float64(b * cos(Float64(1.0 / Float64(180.0 / Float64(angle * pi))))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((a * sin(((angle / 180.0) * pi))) ^ 2.0) + ((b * cos((1.0 / (180.0 / (angle * pi))))) ^ 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[(1.0 / N[(180.0 / N[(angle * Pi), $MachinePrecision]), $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(\frac{1}{\frac{180}{angle \cdot \pi}}\right)\right)}^{2}
\end{array}
Initial program 79.3%
associate-*l/N/A
clear-numN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f6479.4%
Applied egg-rr79.4%
(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}
Initial program 79.3%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (* (/ angle 180.0) PI))) 2.0) (pow b 2.0)))
double code(double a, double b, double angle) {
return pow((a * sin(((angle / 180.0) * ((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(((angle / 180.0) * Math.PI))), 2.0) + Math.pow(b, 2.0);
}
def code(a, b, angle): return math.pow((a * math.sin(((angle / 180.0) * math.pi))), 2.0) + math.pow(b, 2.0)
function code(a, b, angle) return Float64((Float64(a * sin(Float64(Float64(angle / 180.0) * pi))) ^ 2.0) + (b ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((a * sin(((angle / 180.0) * pi))) ^ 2.0) + (b ^ 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[b, 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {b}^{2}
\end{array}
Initial program 79.3%
Taylor expanded in angle around 0
Simplified79.2%
Final simplification79.2%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (cos (* (* angle PI) 0.011111111111111112))))
(if (<= (/ angle 180.0) 4e-10)
(+
(pow (* b (cos (* (/ angle 180.0) PI))) 2.0)
(* a (* angle (* angle (* a (* (* PI PI) 3.08641975308642e-5))))))
(+ (* b (* b (+ 0.5 (* 0.5 t_0)))) (* a (* a (+ 0.5 (* t_0 -0.5))))))))
double code(double a, double b, double angle) {
double t_0 = cos(((angle * ((double) M_PI)) * 0.011111111111111112));
double tmp;
if ((angle / 180.0) <= 4e-10) {
tmp = pow((b * cos(((angle / 180.0) * ((double) M_PI)))), 2.0) + (a * (angle * (angle * (a * ((((double) M_PI) * ((double) M_PI)) * 3.08641975308642e-5)))));
} else {
tmp = (b * (b * (0.5 + (0.5 * t_0)))) + (a * (a * (0.5 + (t_0 * -0.5))));
}
return tmp;
}
public static double code(double a, double b, double angle) {
double t_0 = Math.cos(((angle * Math.PI) * 0.011111111111111112));
double tmp;
if ((angle / 180.0) <= 4e-10) {
tmp = Math.pow((b * Math.cos(((angle / 180.0) * Math.PI))), 2.0) + (a * (angle * (angle * (a * ((Math.PI * Math.PI) * 3.08641975308642e-5)))));
} else {
tmp = (b * (b * (0.5 + (0.5 * t_0)))) + (a * (a * (0.5 + (t_0 * -0.5))));
}
return tmp;
}
def code(a, b, angle): t_0 = math.cos(((angle * math.pi) * 0.011111111111111112)) tmp = 0 if (angle / 180.0) <= 4e-10: tmp = math.pow((b * math.cos(((angle / 180.0) * math.pi))), 2.0) + (a * (angle * (angle * (a * ((math.pi * math.pi) * 3.08641975308642e-5))))) else: tmp = (b * (b * (0.5 + (0.5 * t_0)))) + (a * (a * (0.5 + (t_0 * -0.5)))) return tmp
function code(a, b, angle) t_0 = cos(Float64(Float64(angle * pi) * 0.011111111111111112)) tmp = 0.0 if (Float64(angle / 180.0) <= 4e-10) tmp = Float64((Float64(b * cos(Float64(Float64(angle / 180.0) * pi))) ^ 2.0) + Float64(a * Float64(angle * Float64(angle * Float64(a * Float64(Float64(pi * pi) * 3.08641975308642e-5)))))); else tmp = Float64(Float64(b * Float64(b * Float64(0.5 + Float64(0.5 * t_0)))) + Float64(a * Float64(a * Float64(0.5 + Float64(t_0 * -0.5))))); end return tmp end
function tmp_2 = code(a, b, angle) t_0 = cos(((angle * pi) * 0.011111111111111112)); tmp = 0.0; if ((angle / 180.0) <= 4e-10) tmp = ((b * cos(((angle / 180.0) * pi))) ^ 2.0) + (a * (angle * (angle * (a * ((pi * pi) * 3.08641975308642e-5))))); else tmp = (b * (b * (0.5 + (0.5 * t_0)))) + (a * (a * (0.5 + (t_0 * -0.5)))); end tmp_2 = tmp; end
code[a_, b_, angle_] := Block[{t$95$0 = N[Cos[N[(N[(angle * Pi), $MachinePrecision] * 0.011111111111111112), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(angle / 180.0), $MachinePrecision], 4e-10], N[(N[Power[N[(b * N[Cos[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(a * N[(angle * N[(angle * N[(a * N[(N[(Pi * Pi), $MachinePrecision] * 3.08641975308642e-5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b * N[(b * N[(0.5 + N[(0.5 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(a * N[(a * N[(0.5 + N[(t$95$0 * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\left(angle \cdot \pi\right) \cdot 0.011111111111111112\right)\\
\mathbf{if}\;\frac{angle}{180} \leq 4 \cdot 10^{-10}:\\
\;\;\;\;{\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + a \cdot \left(angle \cdot \left(angle \cdot \left(a \cdot \left(\left(\pi \cdot \pi\right) \cdot 3.08641975308642 \cdot 10^{-5}\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;b \cdot \left(b \cdot \left(0.5 + 0.5 \cdot t\_0\right)\right) + a \cdot \left(a \cdot \left(0.5 + t\_0 \cdot -0.5\right)\right)\\
\end{array}
\end{array}
if (/.f64 angle #s(literal 180 binary64)) < 4.00000000000000015e-10Initial program 87.8%
rem-exp-logN/A
unpow2N/A
*-commutativeN/A
associate-*r*N/A
log-prodN/A
*-commutativeN/A
exp-sumN/A
rem-exp-logN/A
*-lowering-*.f64N/A
Applied egg-rr60.9%
Taylor expanded in angle around 0
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
PI-lowering-PI.f6484.6%
Simplified84.6%
if 4.00000000000000015e-10 < (/.f64 angle #s(literal 180 binary64)) Initial program 57.4%
associate-*l/N/A
clear-numN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f6457.2%
Applied egg-rr57.2%
Applied egg-rr57.3%
Final simplification77.1%
(FPCore (a b angle)
:precision binary64
(if (<= (/ angle 180.0) 4e-10)
(+
(pow (* b (cos (* (/ angle 180.0) PI))) 2.0)
(* a (* angle (* angle (* a (* (* PI PI) 3.08641975308642e-5))))))
(+
(pow b 2.0)
(*
a
(+
(* a 0.5)
(* a (* (cos (* (* angle PI) 0.011111111111111112)) -0.5)))))))
double code(double a, double b, double angle) {
double tmp;
if ((angle / 180.0) <= 4e-10) {
tmp = pow((b * cos(((angle / 180.0) * ((double) M_PI)))), 2.0) + (a * (angle * (angle * (a * ((((double) M_PI) * ((double) M_PI)) * 3.08641975308642e-5)))));
} else {
tmp = pow(b, 2.0) + (a * ((a * 0.5) + (a * (cos(((angle * ((double) M_PI)) * 0.011111111111111112)) * -0.5))));
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if ((angle / 180.0) <= 4e-10) {
tmp = Math.pow((b * Math.cos(((angle / 180.0) * Math.PI))), 2.0) + (a * (angle * (angle * (a * ((Math.PI * Math.PI) * 3.08641975308642e-5)))));
} else {
tmp = Math.pow(b, 2.0) + (a * ((a * 0.5) + (a * (Math.cos(((angle * Math.PI) * 0.011111111111111112)) * -0.5))));
}
return tmp;
}
def code(a, b, angle): tmp = 0 if (angle / 180.0) <= 4e-10: tmp = math.pow((b * math.cos(((angle / 180.0) * math.pi))), 2.0) + (a * (angle * (angle * (a * ((math.pi * math.pi) * 3.08641975308642e-5))))) else: tmp = math.pow(b, 2.0) + (a * ((a * 0.5) + (a * (math.cos(((angle * math.pi) * 0.011111111111111112)) * -0.5)))) return tmp
function code(a, b, angle) tmp = 0.0 if (Float64(angle / 180.0) <= 4e-10) tmp = Float64((Float64(b * cos(Float64(Float64(angle / 180.0) * pi))) ^ 2.0) + Float64(a * Float64(angle * Float64(angle * Float64(a * Float64(Float64(pi * pi) * 3.08641975308642e-5)))))); else tmp = Float64((b ^ 2.0) + Float64(a * Float64(Float64(a * 0.5) + Float64(a * Float64(cos(Float64(Float64(angle * pi) * 0.011111111111111112)) * -0.5))))); end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if ((angle / 180.0) <= 4e-10) tmp = ((b * cos(((angle / 180.0) * pi))) ^ 2.0) + (a * (angle * (angle * (a * ((pi * pi) * 3.08641975308642e-5))))); else tmp = (b ^ 2.0) + (a * ((a * 0.5) + (a * (cos(((angle * pi) * 0.011111111111111112)) * -0.5)))); end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[N[(angle / 180.0), $MachinePrecision], 4e-10], N[(N[Power[N[(b * N[Cos[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(a * N[(angle * N[(angle * N[(a * N[(N[(Pi * Pi), $MachinePrecision] * 3.08641975308642e-5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[b, 2.0], $MachinePrecision] + N[(a * N[(N[(a * 0.5), $MachinePrecision] + N[(a * N[(N[Cos[N[(N[(angle * Pi), $MachinePrecision] * 0.011111111111111112), $MachinePrecision]], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{angle}{180} \leq 4 \cdot 10^{-10}:\\
\;\;\;\;{\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + a \cdot \left(angle \cdot \left(angle \cdot \left(a \cdot \left(\left(\pi \cdot \pi\right) \cdot 3.08641975308642 \cdot 10^{-5}\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;{b}^{2} + a \cdot \left(a \cdot 0.5 + a \cdot \left(\cos \left(\left(angle \cdot \pi\right) \cdot 0.011111111111111112\right) \cdot -0.5\right)\right)\\
\end{array}
\end{array}
if (/.f64 angle #s(literal 180 binary64)) < 4.00000000000000015e-10Initial program 87.8%
rem-exp-logN/A
unpow2N/A
*-commutativeN/A
associate-*r*N/A
log-prodN/A
*-commutativeN/A
exp-sumN/A
rem-exp-logN/A
*-lowering-*.f64N/A
Applied egg-rr60.9%
Taylor expanded in angle around 0
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
PI-lowering-PI.f6484.6%
Simplified84.6%
if 4.00000000000000015e-10 < (/.f64 angle #s(literal 180 binary64)) Initial program 57.4%
rem-exp-logN/A
unpow2N/A
*-commutativeN/A
associate-*r*N/A
log-prodN/A
*-commutativeN/A
exp-sumN/A
rem-exp-logN/A
*-lowering-*.f64N/A
Applied egg-rr24.3%
rem-exp-logN/A
sub-negN/A
distribute-lft-inN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
Applied egg-rr57.4%
Taylor expanded in angle around 0
Simplified57.5%
Final simplification77.1%
(FPCore (a b angle)
:precision binary64
(if (<= (/ angle 180.0) 4e-10)
(+ (pow b 2.0) (pow (* a (* (* angle PI) 0.005555555555555556)) 2.0))
(+
(pow b 2.0)
(*
a
(+
(* a 0.5)
(* a (* (cos (* (* angle PI) 0.011111111111111112)) -0.5)))))))
double code(double a, double b, double angle) {
double tmp;
if ((angle / 180.0) <= 4e-10) {
tmp = pow(b, 2.0) + pow((a * ((angle * ((double) M_PI)) * 0.005555555555555556)), 2.0);
} else {
tmp = pow(b, 2.0) + (a * ((a * 0.5) + (a * (cos(((angle * ((double) M_PI)) * 0.011111111111111112)) * -0.5))));
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if ((angle / 180.0) <= 4e-10) {
tmp = Math.pow(b, 2.0) + Math.pow((a * ((angle * Math.PI) * 0.005555555555555556)), 2.0);
} else {
tmp = Math.pow(b, 2.0) + (a * ((a * 0.5) + (a * (Math.cos(((angle * Math.PI) * 0.011111111111111112)) * -0.5))));
}
return tmp;
}
def code(a, b, angle): tmp = 0 if (angle / 180.0) <= 4e-10: tmp = math.pow(b, 2.0) + math.pow((a * ((angle * math.pi) * 0.005555555555555556)), 2.0) else: tmp = math.pow(b, 2.0) + (a * ((a * 0.5) + (a * (math.cos(((angle * math.pi) * 0.011111111111111112)) * -0.5)))) return tmp
function code(a, b, angle) tmp = 0.0 if (Float64(angle / 180.0) <= 4e-10) tmp = Float64((b ^ 2.0) + (Float64(a * Float64(Float64(angle * pi) * 0.005555555555555556)) ^ 2.0)); else tmp = Float64((b ^ 2.0) + Float64(a * Float64(Float64(a * 0.5) + Float64(a * Float64(cos(Float64(Float64(angle * pi) * 0.011111111111111112)) * -0.5))))); end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if ((angle / 180.0) <= 4e-10) tmp = (b ^ 2.0) + ((a * ((angle * pi) * 0.005555555555555556)) ^ 2.0); else tmp = (b ^ 2.0) + (a * ((a * 0.5) + (a * (cos(((angle * pi) * 0.011111111111111112)) * -0.5)))); end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[N[(angle / 180.0), $MachinePrecision], 4e-10], N[(N[Power[b, 2.0], $MachinePrecision] + N[Power[N[(a * N[(N[(angle * Pi), $MachinePrecision] * 0.005555555555555556), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], N[(N[Power[b, 2.0], $MachinePrecision] + N[(a * N[(N[(a * 0.5), $MachinePrecision] + N[(a * N[(N[Cos[N[(N[(angle * Pi), $MachinePrecision] * 0.011111111111111112), $MachinePrecision]], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{angle}{180} \leq 4 \cdot 10^{-10}:\\
\;\;\;\;{b}^{2} + {\left(a \cdot \left(\left(angle \cdot \pi\right) \cdot 0.005555555555555556\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;{b}^{2} + a \cdot \left(a \cdot 0.5 + a \cdot \left(\cos \left(\left(angle \cdot \pi\right) \cdot 0.011111111111111112\right) \cdot -0.5\right)\right)\\
\end{array}
\end{array}
if (/.f64 angle #s(literal 180 binary64)) < 4.00000000000000015e-10Initial program 87.8%
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f6487.8%
Applied egg-rr87.8%
Taylor expanded in angle around 0
*-lowering-*.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f6484.6%
Simplified84.6%
Taylor expanded in angle around 0
Simplified84.4%
if 4.00000000000000015e-10 < (/.f64 angle #s(literal 180 binary64)) Initial program 57.4%
rem-exp-logN/A
unpow2N/A
*-commutativeN/A
associate-*r*N/A
log-prodN/A
*-commutativeN/A
exp-sumN/A
rem-exp-logN/A
*-lowering-*.f64N/A
Applied egg-rr24.3%
rem-exp-logN/A
sub-negN/A
distribute-lft-inN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
Applied egg-rr57.4%
Taylor expanded in angle around 0
Simplified57.5%
Final simplification76.9%
(FPCore (a b angle) :precision binary64 (if (<= a 9.5e-114) (* b b) (+ (pow b 2.0) (pow (* a (* (* angle PI) 0.005555555555555556)) 2.0))))
double code(double a, double b, double angle) {
double tmp;
if (a <= 9.5e-114) {
tmp = b * b;
} else {
tmp = pow(b, 2.0) + pow((a * ((angle * ((double) M_PI)) * 0.005555555555555556)), 2.0);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (a <= 9.5e-114) {
tmp = b * b;
} else {
tmp = Math.pow(b, 2.0) + Math.pow((a * ((angle * Math.PI) * 0.005555555555555556)), 2.0);
}
return tmp;
}
def code(a, b, angle): tmp = 0 if a <= 9.5e-114: tmp = b * b else: tmp = math.pow(b, 2.0) + math.pow((a * ((angle * math.pi) * 0.005555555555555556)), 2.0) return tmp
function code(a, b, angle) tmp = 0.0 if (a <= 9.5e-114) tmp = Float64(b * b); else tmp = Float64((b ^ 2.0) + (Float64(a * Float64(Float64(angle * pi) * 0.005555555555555556)) ^ 2.0)); end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (a <= 9.5e-114) tmp = b * b; else tmp = (b ^ 2.0) + ((a * ((angle * pi) * 0.005555555555555556)) ^ 2.0); end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[a, 9.5e-114], N[(b * b), $MachinePrecision], N[(N[Power[b, 2.0], $MachinePrecision] + N[Power[N[(a * N[(N[(angle * Pi), $MachinePrecision] * 0.005555555555555556), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 9.5 \cdot 10^{-114}:\\
\;\;\;\;b \cdot b\\
\mathbf{else}:\\
\;\;\;\;{b}^{2} + {\left(a \cdot \left(\left(angle \cdot \pi\right) \cdot 0.005555555555555556\right)\right)}^{2}\\
\end{array}
\end{array}
if a < 9.49999999999999958e-114Initial program 77.8%
Taylor expanded in angle around 0
unpow2N/A
*-lowering-*.f6460.1%
Simplified60.1%
if 9.49999999999999958e-114 < a Initial program 82.8%
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f6482.9%
Applied egg-rr82.9%
Taylor expanded in angle around 0
*-lowering-*.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f6479.4%
Simplified79.4%
Taylor expanded in angle around 0
Simplified78.5%
Final simplification65.8%
(FPCore (a b angle)
:precision binary64
(if (<= a 3.7e-113)
(* b b)
(if (<= a 3e+137)
(+
(* b b)
(* (* angle angle) (* (* PI PI) (* a (* a 3.08641975308642e-5)))))
(*
(* a 0.005555555555555556)
(* (* angle PI) (* a (/ PI (/ 180.0 angle))))))))
double code(double a, double b, double angle) {
double tmp;
if (a <= 3.7e-113) {
tmp = b * b;
} else if (a <= 3e+137) {
tmp = (b * b) + ((angle * angle) * ((((double) M_PI) * ((double) M_PI)) * (a * (a * 3.08641975308642e-5))));
} else {
tmp = (a * 0.005555555555555556) * ((angle * ((double) M_PI)) * (a * (((double) M_PI) / (180.0 / angle))));
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (a <= 3.7e-113) {
tmp = b * b;
} else if (a <= 3e+137) {
tmp = (b * b) + ((angle * angle) * ((Math.PI * Math.PI) * (a * (a * 3.08641975308642e-5))));
} else {
tmp = (a * 0.005555555555555556) * ((angle * Math.PI) * (a * (Math.PI / (180.0 / angle))));
}
return tmp;
}
def code(a, b, angle): tmp = 0 if a <= 3.7e-113: tmp = b * b elif a <= 3e+137: tmp = (b * b) + ((angle * angle) * ((math.pi * math.pi) * (a * (a * 3.08641975308642e-5)))) else: tmp = (a * 0.005555555555555556) * ((angle * math.pi) * (a * (math.pi / (180.0 / angle)))) return tmp
function code(a, b, angle) tmp = 0.0 if (a <= 3.7e-113) tmp = Float64(b * b); elseif (a <= 3e+137) tmp = Float64(Float64(b * b) + Float64(Float64(angle * angle) * Float64(Float64(pi * pi) * Float64(a * Float64(a * 3.08641975308642e-5))))); else tmp = Float64(Float64(a * 0.005555555555555556) * Float64(Float64(angle * pi) * Float64(a * Float64(pi / Float64(180.0 / angle))))); end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (a <= 3.7e-113) tmp = b * b; elseif (a <= 3e+137) tmp = (b * b) + ((angle * angle) * ((pi * pi) * (a * (a * 3.08641975308642e-5)))); else tmp = (a * 0.005555555555555556) * ((angle * pi) * (a * (pi / (180.0 / angle)))); end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[a, 3.7e-113], N[(b * b), $MachinePrecision], If[LessEqual[a, 3e+137], N[(N[(b * b), $MachinePrecision] + N[(N[(angle * angle), $MachinePrecision] * N[(N[(Pi * Pi), $MachinePrecision] * N[(a * N[(a * 3.08641975308642e-5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a * 0.005555555555555556), $MachinePrecision] * N[(N[(angle * Pi), $MachinePrecision] * N[(a * N[(Pi / N[(180.0 / angle), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 3.7 \cdot 10^{-113}:\\
\;\;\;\;b \cdot b\\
\mathbf{elif}\;a \leq 3 \cdot 10^{+137}:\\
\;\;\;\;b \cdot b + \left(angle \cdot angle\right) \cdot \left(\left(\pi \cdot \pi\right) \cdot \left(a \cdot \left(a \cdot 3.08641975308642 \cdot 10^{-5}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(a \cdot 0.005555555555555556\right) \cdot \left(\left(angle \cdot \pi\right) \cdot \left(a \cdot \frac{\pi}{\frac{180}{angle}}\right)\right)\\
\end{array}
\end{array}
if a < 3.6999999999999998e-113Initial program 77.8%
Taylor expanded in angle around 0
unpow2N/A
*-lowering-*.f6460.1%
Simplified60.1%
if 3.6999999999999998e-113 < a < 3.0000000000000001e137Initial program 73.9%
associate-*l/N/A
clear-numN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f6474.0%
Applied egg-rr74.0%
Taylor expanded in angle around 0
+-commutativeN/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt-outN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
PI-lowering-PI.f64N/A
+-lowering-+.f64N/A
Simplified39.2%
Taylor expanded in b around 0
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f6464.7%
Simplified64.7%
if 3.0000000000000001e137 < a Initial program 94.5%
associate-*l/N/A
clear-numN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f6494.5%
Applied egg-rr94.5%
Taylor expanded in angle around 0
+-commutativeN/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt-outN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
PI-lowering-PI.f64N/A
+-lowering-+.f64N/A
Simplified51.2%
Taylor expanded in b around 0
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
PI-lowering-PI.f6466.2%
Simplified66.2%
pow2N/A
associate-*r*N/A
metadata-evalN/A
unpow-prod-downN/A
pow2N/A
associate-*r*N/A
unswap-sqrN/A
swap-sqrN/A
associate-*r*N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
*-lowering-*.f64N/A
associate-*r*N/A
metadata-evalN/A
associate-/r/N/A
associate-/r/N/A
Applied egg-rr83.3%
Final simplification64.0%
(FPCore (a b angle)
:precision binary64
(if (<= a 1.05e+93)
(* b b)
(*
(* a 0.005555555555555556)
(* (* angle PI) (* a (/ PI (/ 180.0 angle)))))))
double code(double a, double b, double angle) {
double tmp;
if (a <= 1.05e+93) {
tmp = b * b;
} else {
tmp = (a * 0.005555555555555556) * ((angle * ((double) M_PI)) * (a * (((double) M_PI) / (180.0 / angle))));
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (a <= 1.05e+93) {
tmp = b * b;
} else {
tmp = (a * 0.005555555555555556) * ((angle * Math.PI) * (a * (Math.PI / (180.0 / angle))));
}
return tmp;
}
def code(a, b, angle): tmp = 0 if a <= 1.05e+93: tmp = b * b else: tmp = (a * 0.005555555555555556) * ((angle * math.pi) * (a * (math.pi / (180.0 / angle)))) return tmp
function code(a, b, angle) tmp = 0.0 if (a <= 1.05e+93) tmp = Float64(b * b); else tmp = Float64(Float64(a * 0.005555555555555556) * Float64(Float64(angle * pi) * Float64(a * Float64(pi / Float64(180.0 / angle))))); end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (a <= 1.05e+93) tmp = b * b; else tmp = (a * 0.005555555555555556) * ((angle * pi) * (a * (pi / (180.0 / angle)))); end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[a, 1.05e+93], N[(b * b), $MachinePrecision], N[(N[(a * 0.005555555555555556), $MachinePrecision] * N[(N[(angle * Pi), $MachinePrecision] * N[(a * N[(Pi / N[(180.0 / angle), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 1.05 \cdot 10^{+93}:\\
\;\;\;\;b \cdot b\\
\mathbf{else}:\\
\;\;\;\;\left(a \cdot 0.005555555555555556\right) \cdot \left(\left(angle \cdot \pi\right) \cdot \left(a \cdot \frac{\pi}{\frac{180}{angle}}\right)\right)\\
\end{array}
\end{array}
if a < 1.0499999999999999e93Initial program 76.7%
Taylor expanded in angle around 0
unpow2N/A
*-lowering-*.f6459.1%
Simplified59.1%
if 1.0499999999999999e93 < a Initial program 93.4%
associate-*l/N/A
clear-numN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f6493.4%
Applied egg-rr93.4%
Taylor expanded in angle around 0
+-commutativeN/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt-outN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
PI-lowering-PI.f64N/A
+-lowering-+.f64N/A
Simplified47.9%
Taylor expanded in b around 0
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
PI-lowering-PI.f6460.5%
Simplified60.5%
pow2N/A
associate-*r*N/A
metadata-evalN/A
unpow-prod-downN/A
pow2N/A
associate-*r*N/A
unswap-sqrN/A
swap-sqrN/A
associate-*r*N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
*-lowering-*.f64N/A
associate-*r*N/A
metadata-evalN/A
associate-/r/N/A
associate-/r/N/A
Applied egg-rr74.8%
Final simplification61.6%
(FPCore (a b angle) :precision binary64 (if (<= a 1.5e+94) (* b b) (* a (* (* a 3.08641975308642e-5) (* angle (* PI (* angle PI)))))))
double code(double a, double b, double angle) {
double tmp;
if (a <= 1.5e+94) {
tmp = b * b;
} else {
tmp = a * ((a * 3.08641975308642e-5) * (angle * (((double) M_PI) * (angle * ((double) M_PI)))));
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (a <= 1.5e+94) {
tmp = b * b;
} else {
tmp = a * ((a * 3.08641975308642e-5) * (angle * (Math.PI * (angle * Math.PI))));
}
return tmp;
}
def code(a, b, angle): tmp = 0 if a <= 1.5e+94: tmp = b * b else: tmp = a * ((a * 3.08641975308642e-5) * (angle * (math.pi * (angle * math.pi)))) return tmp
function code(a, b, angle) tmp = 0.0 if (a <= 1.5e+94) tmp = Float64(b * b); else tmp = Float64(a * Float64(Float64(a * 3.08641975308642e-5) * Float64(angle * Float64(pi * Float64(angle * pi))))); end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (a <= 1.5e+94) tmp = b * b; else tmp = a * ((a * 3.08641975308642e-5) * (angle * (pi * (angle * pi)))); end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[a, 1.5e+94], N[(b * b), $MachinePrecision], N[(a * N[(N[(a * 3.08641975308642e-5), $MachinePrecision] * N[(angle * N[(Pi * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 1.5 \cdot 10^{+94}:\\
\;\;\;\;b \cdot b\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(\left(a \cdot 3.08641975308642 \cdot 10^{-5}\right) \cdot \left(angle \cdot \left(\pi \cdot \left(angle \cdot \pi\right)\right)\right)\right)\\
\end{array}
\end{array}
if a < 1.5e94Initial program 76.7%
Taylor expanded in angle around 0
unpow2N/A
*-lowering-*.f6459.1%
Simplified59.1%
if 1.5e94 < a Initial program 93.4%
associate-*l/N/A
clear-numN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f6493.4%
Applied egg-rr93.4%
Taylor expanded in angle around 0
+-commutativeN/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt-outN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
PI-lowering-PI.f64N/A
+-lowering-+.f64N/A
Simplified47.9%
Taylor expanded in b around 0
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
PI-lowering-PI.f6460.5%
Simplified60.5%
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
pow2N/A
associate-*r*N/A
metadata-evalN/A
unpow-prod-downN/A
pow2N/A
unpow-prod-downN/A
associate-*r*N/A
*-lowering-*.f64N/A
Applied egg-rr62.9%
Final simplification59.7%
(FPCore (a b angle) :precision binary64 (if (<= a 2.25e+94) (* b b) (* (* angle 3.08641975308642e-5) (* (* PI (* angle PI)) (* a a)))))
double code(double a, double b, double angle) {
double tmp;
if (a <= 2.25e+94) {
tmp = b * b;
} else {
tmp = (angle * 3.08641975308642e-5) * ((((double) M_PI) * (angle * ((double) M_PI))) * (a * a));
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (a <= 2.25e+94) {
tmp = b * b;
} else {
tmp = (angle * 3.08641975308642e-5) * ((Math.PI * (angle * Math.PI)) * (a * a));
}
return tmp;
}
def code(a, b, angle): tmp = 0 if a <= 2.25e+94: tmp = b * b else: tmp = (angle * 3.08641975308642e-5) * ((math.pi * (angle * math.pi)) * (a * a)) return tmp
function code(a, b, angle) tmp = 0.0 if (a <= 2.25e+94) tmp = Float64(b * b); else tmp = Float64(Float64(angle * 3.08641975308642e-5) * Float64(Float64(pi * Float64(angle * pi)) * Float64(a * a))); end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (a <= 2.25e+94) tmp = b * b; else tmp = (angle * 3.08641975308642e-5) * ((pi * (angle * pi)) * (a * a)); end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[a, 2.25e+94], N[(b * b), $MachinePrecision], N[(N[(angle * 3.08641975308642e-5), $MachinePrecision] * N[(N[(Pi * N[(angle * Pi), $MachinePrecision]), $MachinePrecision] * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 2.25 \cdot 10^{+94}:\\
\;\;\;\;b \cdot b\\
\mathbf{else}:\\
\;\;\;\;\left(angle \cdot 3.08641975308642 \cdot 10^{-5}\right) \cdot \left(\left(\pi \cdot \left(angle \cdot \pi\right)\right) \cdot \left(a \cdot a\right)\right)\\
\end{array}
\end{array}
if a < 2.24999999999999986e94Initial program 76.7%
Taylor expanded in angle around 0
unpow2N/A
*-lowering-*.f6459.1%
Simplified59.1%
if 2.24999999999999986e94 < a Initial program 93.4%
associate-*l/N/A
clear-numN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f6493.4%
Applied egg-rr93.4%
Taylor expanded in angle around 0
+-commutativeN/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt-outN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
PI-lowering-PI.f64N/A
+-lowering-+.f64N/A
Simplified47.9%
Taylor expanded in b around 0
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
PI-lowering-PI.f6460.5%
Simplified60.5%
pow2N/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
pow2N/A
*-lowering-*.f6468.0%
Applied egg-rr68.0%
Final simplification60.5%
(FPCore (a b angle) :precision binary64 (if (<= a 2.2e+94) (* b b) (* (* a a) (* 3.08641975308642e-5 (* angle (* angle (* PI PI)))))))
double code(double a, double b, double angle) {
double tmp;
if (a <= 2.2e+94) {
tmp = b * b;
} else {
tmp = (a * a) * (3.08641975308642e-5 * (angle * (angle * (((double) M_PI) * ((double) M_PI)))));
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (a <= 2.2e+94) {
tmp = b * b;
} else {
tmp = (a * a) * (3.08641975308642e-5 * (angle * (angle * (Math.PI * Math.PI))));
}
return tmp;
}
def code(a, b, angle): tmp = 0 if a <= 2.2e+94: tmp = b * b else: tmp = (a * a) * (3.08641975308642e-5 * (angle * (angle * (math.pi * math.pi)))) return tmp
function code(a, b, angle) tmp = 0.0 if (a <= 2.2e+94) tmp = Float64(b * b); else tmp = Float64(Float64(a * a) * Float64(3.08641975308642e-5 * Float64(angle * Float64(angle * Float64(pi * pi))))); end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (a <= 2.2e+94) tmp = b * b; else tmp = (a * a) * (3.08641975308642e-5 * (angle * (angle * (pi * pi)))); end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[a, 2.2e+94], N[(b * b), $MachinePrecision], N[(N[(a * a), $MachinePrecision] * N[(3.08641975308642e-5 * N[(angle * N[(angle * N[(Pi * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 2.2 \cdot 10^{+94}:\\
\;\;\;\;b \cdot b\\
\mathbf{else}:\\
\;\;\;\;\left(a \cdot a\right) \cdot \left(3.08641975308642 \cdot 10^{-5} \cdot \left(angle \cdot \left(angle \cdot \left(\pi \cdot \pi\right)\right)\right)\right)\\
\end{array}
\end{array}
if a < 2.20000000000000012e94Initial program 76.7%
Taylor expanded in angle around 0
unpow2N/A
*-lowering-*.f6459.1%
Simplified59.1%
if 2.20000000000000012e94 < a Initial program 93.4%
associate-*l/N/A
clear-numN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f6493.4%
Applied egg-rr93.4%
Taylor expanded in angle around 0
+-commutativeN/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt-outN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
PI-lowering-PI.f64N/A
+-lowering-+.f64N/A
Simplified47.9%
Taylor expanded in b around 0
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
PI-lowering-PI.f6460.5%
Simplified60.5%
(FPCore (a b angle) :precision binary64 (* b b))
double code(double a, double b, double angle) {
return b * b;
}
real(8) function code(a, b, angle)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle
code = b * b
end function
public static double code(double a, double b, double angle) {
return b * b;
}
def code(a, b, angle): return b * b
function code(a, b, angle) return Float64(b * b) end
function tmp = code(a, b, angle) tmp = b * b; end
code[a_, b_, angle_] := N[(b * b), $MachinePrecision]
\begin{array}{l}
\\
b \cdot b
\end{array}
Initial program 79.3%
Taylor expanded in angle around 0
unpow2N/A
*-lowering-*.f6456.2%
Simplified56.2%
herbie shell --seed 2024192
(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)))