
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* (/ angle 180.0) PI))) (+ (pow (* a (sin t_0)) 2.0) (pow (* b (cos t_0)) 2.0))))
double code(double a, double b, double angle) {
double t_0 = (angle / 180.0) * ((double) M_PI);
return pow((a * sin(t_0)), 2.0) + pow((b * cos(t_0)), 2.0);
}
public static double code(double a, double b, double angle) {
double t_0 = (angle / 180.0) * Math.PI;
return Math.pow((a * Math.sin(t_0)), 2.0) + Math.pow((b * Math.cos(t_0)), 2.0);
}
def code(a, b, angle): t_0 = (angle / 180.0) * math.pi return math.pow((a * math.sin(t_0)), 2.0) + math.pow((b * math.cos(t_0)), 2.0)
function code(a, b, angle) t_0 = Float64(Float64(angle / 180.0) * pi) return Float64((Float64(a * sin(t_0)) ^ 2.0) + (Float64(b * cos(t_0)) ^ 2.0)) end
function tmp = code(a, b, angle) t_0 = (angle / 180.0) * pi; tmp = ((a * sin(t_0)) ^ 2.0) + ((b * cos(t_0)) ^ 2.0); end
code[a_, b_, angle_] := Block[{t$95$0 = N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]}, N[(N[Power[N[(a * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{angle}{180} \cdot \pi\\
{\left(a \cdot \sin t\_0\right)}^{2} + {\left(b \cdot \cos t\_0\right)}^{2}
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* (/ angle 180.0) PI))) (+ (pow (* a (sin t_0)) 2.0) (pow (* b (cos t_0)) 2.0))))
double code(double a, double b, double angle) {
double t_0 = (angle / 180.0) * ((double) M_PI);
return pow((a * sin(t_0)), 2.0) + pow((b * cos(t_0)), 2.0);
}
public static double code(double a, double b, double angle) {
double t_0 = (angle / 180.0) * Math.PI;
return Math.pow((a * Math.sin(t_0)), 2.0) + Math.pow((b * Math.cos(t_0)), 2.0);
}
def code(a, b, angle): t_0 = (angle / 180.0) * math.pi return math.pow((a * math.sin(t_0)), 2.0) + math.pow((b * math.cos(t_0)), 2.0)
function code(a, b, angle) t_0 = Float64(Float64(angle / 180.0) * pi) return Float64((Float64(a * sin(t_0)) ^ 2.0) + (Float64(b * cos(t_0)) ^ 2.0)) end
function tmp = code(a, b, angle) t_0 = (angle / 180.0) * pi; tmp = ((a * sin(t_0)) ^ 2.0) + ((b * cos(t_0)) ^ 2.0); end
code[a_, b_, angle_] := Block[{t$95$0 = N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]}, N[(N[Power[N[(a * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{angle}{180} \cdot \pi\\
{\left(a \cdot \sin t\_0\right)}^{2} + {\left(b \cdot \cos t\_0\right)}^{2}
\end{array}
\end{array}
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* (/ 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 77.8%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (* (* angle PI) 0.005555555555555556))) 2.0) (pow (* b (cos (/ (* angle PI) 180.0))) 2.0)))
double code(double a, double b, double angle) {
return pow((a * sin(((angle * ((double) M_PI)) * 0.005555555555555556))), 2.0) + pow((b * cos(((angle * ((double) M_PI)) / 180.0))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.sin(((angle * Math.PI) * 0.005555555555555556))), 2.0) + Math.pow((b * Math.cos(((angle * Math.PI) / 180.0))), 2.0);
}
def code(a, b, angle): return math.pow((a * math.sin(((angle * math.pi) * 0.005555555555555556))), 2.0) + math.pow((b * math.cos(((angle * math.pi) / 180.0))), 2.0)
function code(a, b, angle) return Float64((Float64(a * sin(Float64(Float64(angle * pi) * 0.005555555555555556))) ^ 2.0) + (Float64(b * cos(Float64(Float64(angle * pi) / 180.0))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = ((a * sin(((angle * pi) * 0.005555555555555556))) ^ 2.0) + ((b * cos(((angle * pi) / 180.0))) ^ 2.0); end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Sin[N[(N[(angle * Pi), $MachinePrecision] * 0.005555555555555556), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[N[(N[(angle * Pi), $MachinePrecision] / 180.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \sin \left(\left(angle \cdot \pi\right) \cdot 0.005555555555555556\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle \cdot \pi}{180}\right)\right)}^{2}
\end{array}
Initial program 77.8%
+-lowering-+.f64N/A
pow-lowering-pow.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
pow-lowering-pow.f64N/A
Simplified77.6%
div-invN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
metadata-eval77.7%
Applied egg-rr77.7%
(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 77.8%
Taylor expanded in angle around 0
Simplified77.7%
Final simplification77.7%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (/ (* angle PI) 180.0))) 2.0) (* b b)))
double code(double a, double b, double angle) {
return pow((a * sin(((angle * ((double) M_PI)) / 180.0))), 2.0) + (b * b);
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.sin(((angle * Math.PI) / 180.0))), 2.0) + (b * b);
}
def code(a, b, angle): return math.pow((a * math.sin(((angle * math.pi) / 180.0))), 2.0) + (b * b)
function code(a, b, angle) return Float64((Float64(a * sin(Float64(Float64(angle * pi) / 180.0))) ^ 2.0) + Float64(b * b)) end
function tmp = code(a, b, angle) tmp = ((a * sin(((angle * pi) / 180.0))) ^ 2.0) + (b * b); end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Sin[N[(N[(angle * Pi), $MachinePrecision] / 180.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \sin \left(\frac{angle \cdot \pi}{180}\right)\right)}^{2} + b \cdot b
\end{array}
Initial program 77.8%
+-lowering-+.f64N/A
pow-lowering-pow.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
pow-lowering-pow.f64N/A
Simplified77.6%
clear-numN/A
associate-/r*N/A
clear-numN/A
/-lowering-/.f64N/A
PI-lowering-PI.f64N/A
/-lowering-/.f6477.7%
Applied egg-rr77.7%
associate-/r/N/A
*-commutativeN/A
clear-numN/A
div-invN/A
div-invN/A
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
PI-lowering-PI.f6477.8%
Applied egg-rr77.8%
Taylor expanded in angle around 0
unpow2N/A
*-lowering-*.f6477.6%
Simplified77.6%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* a (/ angle (/ 180.0 PI)))))
(if (<= a 1.95e-53)
(* b (* b (+ 0.5 (* 0.5 (cos (* angle (* PI 0.011111111111111112)))))))
(+
(* (* b b) (/ (+ 1.0 (cos (/ 2.0 (/ 180.0 (* angle PI))))) 2.0))
(* t_0 t_0)))))
double code(double a, double b, double angle) {
double t_0 = a * (angle / (180.0 / ((double) M_PI)));
double tmp;
if (a <= 1.95e-53) {
tmp = b * (b * (0.5 + (0.5 * cos((angle * (((double) M_PI) * 0.011111111111111112))))));
} else {
tmp = ((b * b) * ((1.0 + cos((2.0 / (180.0 / (angle * ((double) M_PI)))))) / 2.0)) + (t_0 * t_0);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double t_0 = a * (angle / (180.0 / Math.PI));
double tmp;
if (a <= 1.95e-53) {
tmp = b * (b * (0.5 + (0.5 * Math.cos((angle * (Math.PI * 0.011111111111111112))))));
} else {
tmp = ((b * b) * ((1.0 + Math.cos((2.0 / (180.0 / (angle * Math.PI))))) / 2.0)) + (t_0 * t_0);
}
return tmp;
}
def code(a, b, angle): t_0 = a * (angle / (180.0 / math.pi)) tmp = 0 if a <= 1.95e-53: tmp = b * (b * (0.5 + (0.5 * math.cos((angle * (math.pi * 0.011111111111111112)))))) else: tmp = ((b * b) * ((1.0 + math.cos((2.0 / (180.0 / (angle * math.pi))))) / 2.0)) + (t_0 * t_0) return tmp
function code(a, b, angle) t_0 = Float64(a * Float64(angle / Float64(180.0 / pi))) tmp = 0.0 if (a <= 1.95e-53) tmp = Float64(b * Float64(b * Float64(0.5 + Float64(0.5 * cos(Float64(angle * Float64(pi * 0.011111111111111112))))))); else tmp = Float64(Float64(Float64(b * b) * Float64(Float64(1.0 + cos(Float64(2.0 / Float64(180.0 / Float64(angle * pi))))) / 2.0)) + Float64(t_0 * t_0)); end return tmp end
function tmp_2 = code(a, b, angle) t_0 = a * (angle / (180.0 / pi)); tmp = 0.0; if (a <= 1.95e-53) tmp = b * (b * (0.5 + (0.5 * cos((angle * (pi * 0.011111111111111112)))))); else tmp = ((b * b) * ((1.0 + cos((2.0 / (180.0 / (angle * pi))))) / 2.0)) + (t_0 * t_0); end tmp_2 = tmp; end
code[a_, b_, angle_] := Block[{t$95$0 = N[(a * N[(angle / N[(180.0 / Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, 1.95e-53], N[(b * N[(b * N[(0.5 + N[(0.5 * N[Cos[N[(angle * N[(Pi * 0.011111111111111112), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(b * b), $MachinePrecision] * N[(N[(1.0 + N[Cos[N[(2.0 / N[(180.0 / N[(angle * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision] + N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot \frac{angle}{\frac{180}{\pi}}\\
\mathbf{if}\;a \leq 1.95 \cdot 10^{-53}:\\
\;\;\;\;b \cdot \left(b \cdot \left(0.5 + 0.5 \cdot \cos \left(angle \cdot \left(\pi \cdot 0.011111111111111112\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(b \cdot b\right) \cdot \frac{1 + \cos \left(\frac{2}{\frac{180}{angle \cdot \pi}}\right)}{2} + t\_0 \cdot t\_0\\
\end{array}
\end{array}
if a < 1.9500000000000001e-53Initial program 73.4%
+-lowering-+.f64N/A
Applied egg-rr65.3%
Taylor expanded in a around 0
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f6460.4%
Simplified60.4%
if 1.9500000000000001e-53 < a Initial program 86.4%
+-lowering-+.f64N/A
pow-lowering-pow.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
pow-lowering-pow.f64N/A
Simplified86.2%
Taylor expanded in angle around 0
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f6484.6%
Simplified84.6%
Applied egg-rr84.6%
Final simplification68.6%
(FPCore (a b angle) :precision binary64 (if (<= a 4.5e-54) (* b (* b (+ 0.5 (* 0.5 (cos (* angle (* PI 0.011111111111111112))))))) (+ (* b b) (pow (* a (* angle (* PI 0.005555555555555556))) 2.0))))
double code(double a, double b, double angle) {
double tmp;
if (a <= 4.5e-54) {
tmp = b * (b * (0.5 + (0.5 * cos((angle * (((double) M_PI) * 0.011111111111111112))))));
} else {
tmp = (b * b) + 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 <= 4.5e-54) {
tmp = b * (b * (0.5 + (0.5 * Math.cos((angle * (Math.PI * 0.011111111111111112))))));
} else {
tmp = (b * b) + Math.pow((a * (angle * (Math.PI * 0.005555555555555556))), 2.0);
}
return tmp;
}
def code(a, b, angle): tmp = 0 if a <= 4.5e-54: tmp = b * (b * (0.5 + (0.5 * math.cos((angle * (math.pi * 0.011111111111111112)))))) else: tmp = (b * b) + math.pow((a * (angle * (math.pi * 0.005555555555555556))), 2.0) return tmp
function code(a, b, angle) tmp = 0.0 if (a <= 4.5e-54) tmp = Float64(b * Float64(b * Float64(0.5 + Float64(0.5 * cos(Float64(angle * Float64(pi * 0.011111111111111112))))))); else tmp = Float64(Float64(b * b) + (Float64(a * Float64(angle * Float64(pi * 0.005555555555555556))) ^ 2.0)); end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (a <= 4.5e-54) tmp = b * (b * (0.5 + (0.5 * cos((angle * (pi * 0.011111111111111112)))))); else tmp = (b * b) + ((a * (angle * (pi * 0.005555555555555556))) ^ 2.0); end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[a, 4.5e-54], N[(b * N[(b * N[(0.5 + N[(0.5 * N[Cos[N[(angle * N[(Pi * 0.011111111111111112), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b * b), $MachinePrecision] + N[Power[N[(a * N[(angle * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 4.5 \cdot 10^{-54}:\\
\;\;\;\;b \cdot \left(b \cdot \left(0.5 + 0.5 \cdot \cos \left(angle \cdot \left(\pi \cdot 0.011111111111111112\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;b \cdot b + {\left(a \cdot \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)}^{2}\\
\end{array}
\end{array}
if a < 4.4999999999999998e-54Initial program 73.4%
+-lowering-+.f64N/A
Applied egg-rr65.3%
Taylor expanded in a around 0
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f6460.4%
Simplified60.4%
if 4.4999999999999998e-54 < a Initial program 86.4%
+-lowering-+.f64N/A
pow-lowering-pow.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
pow-lowering-pow.f64N/A
Simplified86.2%
Taylor expanded in angle around 0
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f6484.6%
Simplified84.6%
add-sqr-sqrtN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
PI-lowering-PI.f64N/A
sqrt-lowering-sqrt.f64N/A
PI-lowering-PI.f6484.5%
Applied egg-rr84.5%
Taylor expanded in angle around 0
unpow2N/A
*-lowering-*.f6484.6%
Simplified84.6%
Final simplification68.6%
(FPCore (a b angle) :precision binary64 (if (<= a 1e-54) (* b b) (+ (* b b) (pow (* a (* angle (* PI 0.005555555555555556))) 2.0))))
double code(double a, double b, double angle) {
double tmp;
if (a <= 1e-54) {
tmp = b * b;
} else {
tmp = (b * b) + 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 <= 1e-54) {
tmp = b * b;
} else {
tmp = (b * b) + Math.pow((a * (angle * (Math.PI * 0.005555555555555556))), 2.0);
}
return tmp;
}
def code(a, b, angle): tmp = 0 if a <= 1e-54: tmp = b * b else: tmp = (b * b) + math.pow((a * (angle * (math.pi * 0.005555555555555556))), 2.0) return tmp
function code(a, b, angle) tmp = 0.0 if (a <= 1e-54) tmp = Float64(b * b); else tmp = Float64(Float64(b * b) + (Float64(a * Float64(angle * Float64(pi * 0.005555555555555556))) ^ 2.0)); end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (a <= 1e-54) tmp = b * b; else tmp = (b * b) + ((a * (angle * (pi * 0.005555555555555556))) ^ 2.0); end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[a, 1e-54], N[(b * b), $MachinePrecision], N[(N[(b * b), $MachinePrecision] + N[Power[N[(a * N[(angle * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 10^{-54}:\\
\;\;\;\;b \cdot b\\
\mathbf{else}:\\
\;\;\;\;b \cdot b + {\left(a \cdot \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)}^{2}\\
\end{array}
\end{array}
if a < 1e-54Initial program 73.4%
Taylor expanded in angle around 0
unpow2N/A
*-lowering-*.f6460.3%
Simplified60.3%
if 1e-54 < a Initial program 86.4%
+-lowering-+.f64N/A
pow-lowering-pow.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
pow-lowering-pow.f64N/A
Simplified86.2%
Taylor expanded in angle around 0
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f6484.6%
Simplified84.6%
add-sqr-sqrtN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
PI-lowering-PI.f64N/A
sqrt-lowering-sqrt.f64N/A
PI-lowering-PI.f6484.5%
Applied egg-rr84.5%
Taylor expanded in angle around 0
unpow2N/A
*-lowering-*.f6484.6%
Simplified84.6%
Final simplification68.5%
(FPCore (a b angle) :precision binary64 (if (<= a 1.46e+129) (* b b) (* (* PI PI) (* angle (* (* a 3.08641975308642e-5) (* a angle))))))
double code(double a, double b, double angle) {
double tmp;
if (a <= 1.46e+129) {
tmp = b * b;
} else {
tmp = (((double) M_PI) * ((double) M_PI)) * (angle * ((a * 3.08641975308642e-5) * (a * angle)));
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (a <= 1.46e+129) {
tmp = b * b;
} else {
tmp = (Math.PI * Math.PI) * (angle * ((a * 3.08641975308642e-5) * (a * angle)));
}
return tmp;
}
def code(a, b, angle): tmp = 0 if a <= 1.46e+129: tmp = b * b else: tmp = (math.pi * math.pi) * (angle * ((a * 3.08641975308642e-5) * (a * angle))) return tmp
function code(a, b, angle) tmp = 0.0 if (a <= 1.46e+129) tmp = Float64(b * b); else tmp = Float64(Float64(pi * pi) * Float64(angle * Float64(Float64(a * 3.08641975308642e-5) * Float64(a * angle)))); end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (a <= 1.46e+129) tmp = b * b; else tmp = (pi * pi) * (angle * ((a * 3.08641975308642e-5) * (a * angle))); end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[a, 1.46e+129], N[(b * b), $MachinePrecision], N[(N[(Pi * Pi), $MachinePrecision] * N[(angle * N[(N[(a * 3.08641975308642e-5), $MachinePrecision] * N[(a * angle), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 1.46 \cdot 10^{+129}:\\
\;\;\;\;b \cdot b\\
\mathbf{else}:\\
\;\;\;\;\left(\pi \cdot \pi\right) \cdot \left(angle \cdot \left(\left(a \cdot 3.08641975308642 \cdot 10^{-5}\right) \cdot \left(a \cdot angle\right)\right)\right)\\
\end{array}
\end{array}
if a < 1.45999999999999992e129Initial program 74.0%
Taylor expanded in angle around 0
unpow2N/A
*-lowering-*.f6460.8%
Simplified60.8%
if 1.45999999999999992e129 < a Initial program 95.7%
+-lowering-+.f64N/A
pow-lowering-pow.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
pow-lowering-pow.f64N/A
Simplified95.6%
Taylor expanded in angle around 0
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f6495.5%
Simplified95.5%
Taylor expanded in a around inf
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-lowering-*.f64N/A
Simplified44.5%
pow2N/A
associate-*l*N/A
pow2N/A
unpow-prod-downN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
PI-lowering-PI.f64N/A
*-lowering-*.f64N/A
unpow2N/A
unswap-sqrN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6443.3%
Applied egg-rr43.3%
associate-*r*N/A
associate-*r*N/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f6464.9%
Applied egg-rr64.9%
Final simplification61.5%
(FPCore (a b angle) :precision binary64 (if (<= a 7.8e+130) (* b b) (* (* a 3.08641975308642e-5) (* (* PI PI) (* angle (* a angle))))))
double code(double a, double b, double angle) {
double tmp;
if (a <= 7.8e+130) {
tmp = b * b;
} else {
tmp = (a * 3.08641975308642e-5) * ((((double) M_PI) * ((double) M_PI)) * (angle * (a * angle)));
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (a <= 7.8e+130) {
tmp = b * b;
} else {
tmp = (a * 3.08641975308642e-5) * ((Math.PI * Math.PI) * (angle * (a * angle)));
}
return tmp;
}
def code(a, b, angle): tmp = 0 if a <= 7.8e+130: tmp = b * b else: tmp = (a * 3.08641975308642e-5) * ((math.pi * math.pi) * (angle * (a * angle))) return tmp
function code(a, b, angle) tmp = 0.0 if (a <= 7.8e+130) tmp = Float64(b * b); else tmp = Float64(Float64(a * 3.08641975308642e-5) * Float64(Float64(pi * pi) * Float64(angle * Float64(a * angle)))); end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (a <= 7.8e+130) tmp = b * b; else tmp = (a * 3.08641975308642e-5) * ((pi * pi) * (angle * (a * angle))); end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[a, 7.8e+130], N[(b * b), $MachinePrecision], N[(N[(a * 3.08641975308642e-5), $MachinePrecision] * N[(N[(Pi * Pi), $MachinePrecision] * N[(angle * N[(a * angle), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 7.8 \cdot 10^{+130}:\\
\;\;\;\;b \cdot b\\
\mathbf{else}:\\
\;\;\;\;\left(a \cdot 3.08641975308642 \cdot 10^{-5}\right) \cdot \left(\left(\pi \cdot \pi\right) \cdot \left(angle \cdot \left(a \cdot angle\right)\right)\right)\\
\end{array}
\end{array}
if a < 7.8000000000000004e130Initial program 74.1%
Taylor expanded in angle around 0
unpow2N/A
*-lowering-*.f6460.5%
Simplified60.5%
if 7.8000000000000004e130 < a Initial program 95.6%
+-lowering-+.f64N/A
pow-lowering-pow.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
pow-lowering-pow.f64N/A
Simplified95.5%
Taylor expanded in angle around 0
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f6495.4%
Simplified95.4%
Taylor expanded in a around inf
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-lowering-*.f64N/A
Simplified44.7%
pow2N/A
associate-*l*N/A
pow2N/A
unpow-prod-downN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
PI-lowering-PI.f64N/A
*-lowering-*.f64N/A
unpow2N/A
unswap-sqrN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6443.6%
Applied egg-rr43.6%
*-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
*-lowering-*.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
PI-lowering-PI.f6464.7%
Applied egg-rr64.7%
Final simplification61.2%
(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 77.8%
Taylor expanded in angle around 0
unpow2N/A
*-lowering-*.f6456.8%
Simplified56.8%
herbie shell --seed 2024155
(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)))