
(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 12 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 76.6%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (* (pow (/ -1.0 angle) -1.0) (/ 1.0 (/ -180.0 PI))))) 2.0) (* b b)))
double code(double a, double b, double angle) {
return pow((a * sin((pow((-1.0 / angle), -1.0) * (1.0 / (-180.0 / ((double) M_PI)))))), 2.0) + (b * b);
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.sin((Math.pow((-1.0 / angle), -1.0) * (1.0 / (-180.0 / Math.PI))))), 2.0) + (b * b);
}
def code(a, b, angle): return math.pow((a * math.sin((math.pow((-1.0 / angle), -1.0) * (1.0 / (-180.0 / math.pi))))), 2.0) + (b * b)
function code(a, b, angle) return Float64((Float64(a * sin(Float64((Float64(-1.0 / angle) ^ -1.0) * Float64(1.0 / Float64(-180.0 / pi))))) ^ 2.0) + Float64(b * b)) end
function tmp = code(a, b, angle) tmp = ((a * sin((((-1.0 / angle) ^ -1.0) * (1.0 / (-180.0 / pi))))) ^ 2.0) + (b * b); end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Sin[N[(N[Power[N[(-1.0 / angle), $MachinePrecision], -1.0], $MachinePrecision] * N[(1.0 / N[(-180.0 / Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \sin \left({\left(\frac{-1}{angle}\right)}^{-1} \cdot \frac{1}{\frac{-180}{\pi}}\right)\right)}^{2} + b \cdot b
\end{array}
Initial program 76.6%
Taylor expanded in angle around 0
Simplified76.5%
clear-numN/A
associate-*l/N/A
*-un-lft-identityN/A
add-sqr-sqrtN/A
div-invN/A
frac-timesN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
PI-lowering-PI.f64N/A
associate-/r/N/A
/-rgt-identityN/A
*-commutativeN/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
PI-lowering-PI.f6475.9%
Applied egg-rr75.9%
*-commutativeN/A
associate-*r/N/A
associate-*r*N/A
add-sqr-sqrtN/A
clear-numN/A
inv-powN/A
associate-/r*N/A
metadata-evalN/A
associate-*l/N/A
*-un-lft-identityN/A
times-fracN/A
metadata-evalN/A
distribute-neg-fracN/A
unpow-prod-downN/A
inv-powN/A
*-lowering-*.f64N/A
Applied egg-rr76.5%
unpow2N/A
*-lowering-*.f64N/A
*-rgt-identityN/A
*-rgt-identity76.5%
Applied egg-rr76.5%
Final simplification76.5%
(FPCore (a b angle) :precision binary64 (+ (* b b) (pow (* a (sin (/ PI (* (/ -1.0 angle) -180.0)))) 2.0)))
double code(double a, double b, double angle) {
return (b * b) + pow((a * sin((((double) M_PI) / ((-1.0 / angle) * -180.0)))), 2.0);
}
public static double code(double a, double b, double angle) {
return (b * b) + Math.pow((a * Math.sin((Math.PI / ((-1.0 / angle) * -180.0)))), 2.0);
}
def code(a, b, angle): return (b * b) + math.pow((a * math.sin((math.pi / ((-1.0 / angle) * -180.0)))), 2.0)
function code(a, b, angle) return Float64(Float64(b * b) + (Float64(a * sin(Float64(pi / Float64(Float64(-1.0 / angle) * -180.0)))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = (b * b) + ((a * sin((pi / ((-1.0 / angle) * -180.0)))) ^ 2.0); end
code[a_, b_, angle_] := N[(N[(b * b), $MachinePrecision] + N[Power[N[(a * N[Sin[N[(Pi / N[(N[(-1.0 / angle), $MachinePrecision] * -180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
b \cdot b + {\left(a \cdot \sin \left(\frac{\pi}{\frac{-1}{angle} \cdot -180}\right)\right)}^{2}
\end{array}
Initial program 76.6%
Taylor expanded in angle around 0
Simplified76.5%
*-commutativeN/A
clear-numN/A
div-invN/A
add-sqr-sqrtN/A
div-invN/A
*-commutativeN/A
frac-timesN/A
frac-2negN/A
frac-2negN/A
frac-timesN/A
sqr-negN/A
add-sqr-sqrtN/A
/-lowering-/.f64N/A
PI-lowering-PI.f64N/A
*-lowering-*.f64N/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f64N/A
metadata-eval76.5%
Applied egg-rr76.5%
*-rgt-identityN/A
pow2N/A
*-lowering-*.f6476.5%
Applied egg-rr76.5%
Final simplification76.5%
(FPCore (a b angle) :precision binary64 (+ (pow (* a (sin (* (/ angle 180.0) PI))) 2.0) (* b b)))
double code(double a, double b, double angle) {
return pow((a * sin(((angle / 180.0) * ((double) M_PI)))), 2.0) + (b * b);
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.sin(((angle / 180.0) * Math.PI))), 2.0) + (b * b);
}
def code(a, b, angle): return math.pow((a * math.sin(((angle / 180.0) * math.pi))), 2.0) + (b * b)
function code(a, b, angle) return Float64((Float64(a * sin(Float64(Float64(angle / 180.0) * pi))) ^ 2.0) + Float64(b * b)) end
function tmp = code(a, b, angle) tmp = ((a * sin(((angle / 180.0) * pi))) ^ 2.0) + (b * b); 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[(b * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + b \cdot b
\end{array}
Initial program 76.6%
Taylor expanded in angle around 0
Simplified76.5%
*-rgt-identityN/A
pow2N/A
*-lowering-*.f6476.5%
Applied egg-rr76.5%
(FPCore (a b angle)
:precision binary64
(let* ((t_0
(+
0.005555555555555556
(* angle (* angle (* -2.8577960676726107e-8 (* PI PI))))))
(t_1 (* 0.5 (cos (* 2.0 (/ angle (/ 180.0 PI)))))))
(if (<= angle 0.00012)
(+
(* b (* b (+ 0.5 t_1)))
(* angle (* (* a (* PI t_0)) (* t_0 (* angle (* a PI))))))
(+ (* b b) (* a (* a (- 0.5 t_1)))))))
double code(double a, double b, double angle) {
double t_0 = 0.005555555555555556 + (angle * (angle * (-2.8577960676726107e-8 * (((double) M_PI) * ((double) M_PI)))));
double t_1 = 0.5 * cos((2.0 * (angle / (180.0 / ((double) M_PI)))));
double tmp;
if (angle <= 0.00012) {
tmp = (b * (b * (0.5 + t_1))) + (angle * ((a * (((double) M_PI) * t_0)) * (t_0 * (angle * (a * ((double) M_PI))))));
} else {
tmp = (b * b) + (a * (a * (0.5 - t_1)));
}
return tmp;
}
public static double code(double a, double b, double angle) {
double t_0 = 0.005555555555555556 + (angle * (angle * (-2.8577960676726107e-8 * (Math.PI * Math.PI))));
double t_1 = 0.5 * Math.cos((2.0 * (angle / (180.0 / Math.PI))));
double tmp;
if (angle <= 0.00012) {
tmp = (b * (b * (0.5 + t_1))) + (angle * ((a * (Math.PI * t_0)) * (t_0 * (angle * (a * Math.PI)))));
} else {
tmp = (b * b) + (a * (a * (0.5 - t_1)));
}
return tmp;
}
def code(a, b, angle): t_0 = 0.005555555555555556 + (angle * (angle * (-2.8577960676726107e-8 * (math.pi * math.pi)))) t_1 = 0.5 * math.cos((2.0 * (angle / (180.0 / math.pi)))) tmp = 0 if angle <= 0.00012: tmp = (b * (b * (0.5 + t_1))) + (angle * ((a * (math.pi * t_0)) * (t_0 * (angle * (a * math.pi))))) else: tmp = (b * b) + (a * (a * (0.5 - t_1))) return tmp
function code(a, b, angle) t_0 = Float64(0.005555555555555556 + Float64(angle * Float64(angle * Float64(-2.8577960676726107e-8 * Float64(pi * pi))))) t_1 = Float64(0.5 * cos(Float64(2.0 * Float64(angle / Float64(180.0 / pi))))) tmp = 0.0 if (angle <= 0.00012) tmp = Float64(Float64(b * Float64(b * Float64(0.5 + t_1))) + Float64(angle * Float64(Float64(a * Float64(pi * t_0)) * Float64(t_0 * Float64(angle * Float64(a * pi)))))); else tmp = Float64(Float64(b * b) + Float64(a * Float64(a * Float64(0.5 - t_1)))); end return tmp end
function tmp_2 = code(a, b, angle) t_0 = 0.005555555555555556 + (angle * (angle * (-2.8577960676726107e-8 * (pi * pi)))); t_1 = 0.5 * cos((2.0 * (angle / (180.0 / pi)))); tmp = 0.0; if (angle <= 0.00012) tmp = (b * (b * (0.5 + t_1))) + (angle * ((a * (pi * t_0)) * (t_0 * (angle * (a * pi))))); else tmp = (b * b) + (a * (a * (0.5 - t_1))); end tmp_2 = tmp; end
code[a_, b_, angle_] := Block[{t$95$0 = N[(0.005555555555555556 + N[(angle * N[(angle * N[(-2.8577960676726107e-8 * N[(Pi * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.5 * N[Cos[N[(2.0 * N[(angle / N[(180.0 / Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[angle, 0.00012], N[(N[(b * N[(b * N[(0.5 + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(angle * N[(N[(a * N[(Pi * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[(angle * N[(a * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b * b), $MachinePrecision] + N[(a * N[(a * N[(0.5 - t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.005555555555555556 + angle \cdot \left(angle \cdot \left(-2.8577960676726107 \cdot 10^{-8} \cdot \left(\pi \cdot \pi\right)\right)\right)\\
t_1 := 0.5 \cdot \cos \left(2 \cdot \frac{angle}{\frac{180}{\pi}}\right)\\
\mathbf{if}\;angle \leq 0.00012:\\
\;\;\;\;b \cdot \left(b \cdot \left(0.5 + t\_1\right)\right) + angle \cdot \left(\left(a \cdot \left(\pi \cdot t\_0\right)\right) \cdot \left(t\_0 \cdot \left(angle \cdot \left(a \cdot \pi\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;b \cdot b + a \cdot \left(a \cdot \left(0.5 - t\_1\right)\right)\\
\end{array}
\end{array}
if angle < 1.20000000000000003e-4Initial program 83.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
Simplified83.7%
Taylor expanded in angle around 0
Simplified78.0%
Applied egg-rr77.1%
if 1.20000000000000003e-4 < angle Initial program 57.0%
Taylor expanded in angle around 0
Simplified56.4%
+-commutativeN/A
associate-*l/N/A
+-lowering-+.f64N/A
*-rgt-identityN/A
pow2N/A
*-lowering-*.f64N/A
unpow-prod-downN/A
pow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
associate-*l/N/A
associate-/r/N/A
unpow2N/A
Applied egg-rr56.3%
Final simplification71.6%
(FPCore (a b angle)
:precision binary64
(if (<= angle 0.00012)
(+
(* b b)
(* a (* a (* (* angle (* PI PI)) (* angle 3.08641975308642e-5)))))
(+
(* b b)
(* a (* a (- 0.5 (* 0.5 (cos (* 2.0 (/ angle (/ 180.0 PI)))))))))))
double code(double a, double b, double angle) {
double tmp;
if (angle <= 0.00012) {
tmp = (b * b) + (a * (a * ((angle * (((double) M_PI) * ((double) M_PI))) * (angle * 3.08641975308642e-5))));
} else {
tmp = (b * b) + (a * (a * (0.5 - (0.5 * cos((2.0 * (angle / (180.0 / ((double) M_PI)))))))));
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (angle <= 0.00012) {
tmp = (b * b) + (a * (a * ((angle * (Math.PI * Math.PI)) * (angle * 3.08641975308642e-5))));
} else {
tmp = (b * b) + (a * (a * (0.5 - (0.5 * Math.cos((2.0 * (angle / (180.0 / Math.PI))))))));
}
return tmp;
}
def code(a, b, angle): tmp = 0 if angle <= 0.00012: tmp = (b * b) + (a * (a * ((angle * (math.pi * math.pi)) * (angle * 3.08641975308642e-5)))) else: tmp = (b * b) + (a * (a * (0.5 - (0.5 * math.cos((2.0 * (angle / (180.0 / math.pi)))))))) return tmp
function code(a, b, angle) tmp = 0.0 if (angle <= 0.00012) tmp = Float64(Float64(b * b) + Float64(a * Float64(a * Float64(Float64(angle * Float64(pi * pi)) * Float64(angle * 3.08641975308642e-5))))); else tmp = Float64(Float64(b * b) + Float64(a * Float64(a * Float64(0.5 - Float64(0.5 * cos(Float64(2.0 * Float64(angle / Float64(180.0 / pi))))))))); end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (angle <= 0.00012) tmp = (b * b) + (a * (a * ((angle * (pi * pi)) * (angle * 3.08641975308642e-5)))); else tmp = (b * b) + (a * (a * (0.5 - (0.5 * cos((2.0 * (angle / (180.0 / pi)))))))); end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[angle, 0.00012], N[(N[(b * b), $MachinePrecision] + N[(a * N[(a * N[(N[(angle * N[(Pi * Pi), $MachinePrecision]), $MachinePrecision] * N[(angle * 3.08641975308642e-5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b * b), $MachinePrecision] + N[(a * N[(a * N[(0.5 - N[(0.5 * N[Cos[N[(2.0 * N[(angle / N[(180.0 / Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;angle \leq 0.00012:\\
\;\;\;\;b \cdot b + a \cdot \left(a \cdot \left(\left(angle \cdot \left(\pi \cdot \pi\right)\right) \cdot \left(angle \cdot 3.08641975308642 \cdot 10^{-5}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;b \cdot b + a \cdot \left(a \cdot \left(0.5 - 0.5 \cdot \cos \left(2 \cdot \frac{angle}{\frac{180}{\pi}}\right)\right)\right)\\
\end{array}
\end{array}
if angle < 1.20000000000000003e-4Initial program 83.6%
Taylor expanded in angle around 0
Simplified83.7%
Taylor expanded in angle around 0
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
+-commutativeN/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
associate-*l*N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
Simplified68.6%
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
PI-lowering-PI.f64N/A
*-lowering-*.f6474.0%
Applied egg-rr74.0%
if 1.20000000000000003e-4 < angle Initial program 57.0%
Taylor expanded in angle around 0
Simplified56.4%
+-commutativeN/A
associate-*l/N/A
+-lowering-+.f64N/A
*-rgt-identityN/A
pow2N/A
*-lowering-*.f64N/A
unpow-prod-downN/A
pow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
associate-*l/N/A
associate-/r/N/A
unpow2N/A
Applied egg-rr56.3%
Final simplification69.3%
(FPCore (a b angle)
:precision binary64
(if (<= a 12500000000000.0)
(* b b)
(+
(* b b)
(* a (* a (* (* angle (* PI PI)) (* angle 3.08641975308642e-5)))))))
double code(double a, double b, double angle) {
double tmp;
if (a <= 12500000000000.0) {
tmp = b * b;
} else {
tmp = (b * b) + (a * (a * ((angle * (((double) M_PI) * ((double) M_PI))) * (angle * 3.08641975308642e-5))));
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (a <= 12500000000000.0) {
tmp = b * b;
} else {
tmp = (b * b) + (a * (a * ((angle * (Math.PI * Math.PI)) * (angle * 3.08641975308642e-5))));
}
return tmp;
}
def code(a, b, angle): tmp = 0 if a <= 12500000000000.0: tmp = b * b else: tmp = (b * b) + (a * (a * ((angle * (math.pi * math.pi)) * (angle * 3.08641975308642e-5)))) return tmp
function code(a, b, angle) tmp = 0.0 if (a <= 12500000000000.0) tmp = Float64(b * b); else tmp = Float64(Float64(b * b) + Float64(a * Float64(a * Float64(Float64(angle * Float64(pi * pi)) * Float64(angle * 3.08641975308642e-5))))); end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (a <= 12500000000000.0) tmp = b * b; else tmp = (b * b) + (a * (a * ((angle * (pi * pi)) * (angle * 3.08641975308642e-5)))); end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[a, 12500000000000.0], N[(b * b), $MachinePrecision], N[(N[(b * b), $MachinePrecision] + N[(a * N[(a * N[(N[(angle * N[(Pi * Pi), $MachinePrecision]), $MachinePrecision] * N[(angle * 3.08641975308642e-5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 12500000000000:\\
\;\;\;\;b \cdot b\\
\mathbf{else}:\\
\;\;\;\;b \cdot b + a \cdot \left(a \cdot \left(\left(angle \cdot \left(\pi \cdot \pi\right)\right) \cdot \left(angle \cdot 3.08641975308642 \cdot 10^{-5}\right)\right)\right)\\
\end{array}
\end{array}
if a < 1.25e13Initial program 73.6%
Taylor expanded in angle around 0
unpow2N/A
*-lowering-*.f6460.1%
Simplified60.1%
if 1.25e13 < a Initial program 86.7%
Taylor expanded in angle around 0
Simplified86.7%
Taylor expanded in angle around 0
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
+-commutativeN/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
associate-*l*N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
Simplified65.4%
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
PI-lowering-PI.f64N/A
*-lowering-*.f6472.3%
Applied egg-rr72.3%
Final simplification62.9%
(FPCore (a b angle) :precision binary64 (if (<= a 2.3e+162) (* b b) (* (* PI PI) (* 3.08641975308642e-5 (* angle (* angle (* a a)))))))
double code(double a, double b, double angle) {
double tmp;
if (a <= 2.3e+162) {
tmp = b * b;
} else {
tmp = (((double) M_PI) * ((double) M_PI)) * (3.08641975308642e-5 * (angle * (angle * (a * a))));
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (a <= 2.3e+162) {
tmp = b * b;
} else {
tmp = (Math.PI * Math.PI) * (3.08641975308642e-5 * (angle * (angle * (a * a))));
}
return tmp;
}
def code(a, b, angle): tmp = 0 if a <= 2.3e+162: tmp = b * b else: tmp = (math.pi * math.pi) * (3.08641975308642e-5 * (angle * (angle * (a * a)))) return tmp
function code(a, b, angle) tmp = 0.0 if (a <= 2.3e+162) tmp = Float64(b * b); else tmp = Float64(Float64(pi * pi) * Float64(3.08641975308642e-5 * Float64(angle * Float64(angle * Float64(a * a))))); end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (a <= 2.3e+162) tmp = b * b; else tmp = (pi * pi) * (3.08641975308642e-5 * (angle * (angle * (a * a)))); end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[a, 2.3e+162], N[(b * b), $MachinePrecision], N[(N[(Pi * Pi), $MachinePrecision] * N[(3.08641975308642e-5 * N[(angle * N[(angle * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 2.3 \cdot 10^{+162}:\\
\;\;\;\;b \cdot b\\
\mathbf{else}:\\
\;\;\;\;\left(\pi \cdot \pi\right) \cdot \left(3.08641975308642 \cdot 10^{-5} \cdot \left(angle \cdot \left(angle \cdot \left(a \cdot a\right)\right)\right)\right)\\
\end{array}
\end{array}
if a < 2.29999999999999994e162Initial program 73.9%
Taylor expanded in angle around 0
unpow2N/A
*-lowering-*.f6458.6%
Simplified58.6%
if 2.29999999999999994e162 < a Initial program 99.7%
Taylor expanded in angle around 0
Simplified99.7%
Taylor expanded in angle around 0
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
+-commutativeN/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
associate-*l*N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
Simplified69.8%
Taylor expanded in b around 0
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-commutativeN/A
associate-*l*N/A
metadata-evalN/A
distribute-rgt-neg-inN/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
PI-lowering-PI.f6469.8%
Simplified69.8%
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
PI-lowering-PI.f6474.3%
Applied egg-rr74.3%
Final simplification60.2%
(FPCore (a b angle) :precision binary64 (if (<= a 2.5e+162) (* b b) (* a (* (* a (* (* PI PI) 3.08641975308642e-5)) (* angle angle)))))
double code(double a, double b, double angle) {
double tmp;
if (a <= 2.5e+162) {
tmp = b * b;
} else {
tmp = a * ((a * ((((double) M_PI) * ((double) M_PI)) * 3.08641975308642e-5)) * (angle * angle));
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (a <= 2.5e+162) {
tmp = b * b;
} else {
tmp = a * ((a * ((Math.PI * Math.PI) * 3.08641975308642e-5)) * (angle * angle));
}
return tmp;
}
def code(a, b, angle): tmp = 0 if a <= 2.5e+162: tmp = b * b else: tmp = a * ((a * ((math.pi * math.pi) * 3.08641975308642e-5)) * (angle * angle)) return tmp
function code(a, b, angle) tmp = 0.0 if (a <= 2.5e+162) tmp = Float64(b * b); else tmp = Float64(a * Float64(Float64(a * Float64(Float64(pi * pi) * 3.08641975308642e-5)) * Float64(angle * angle))); end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (a <= 2.5e+162) tmp = b * b; else tmp = a * ((a * ((pi * pi) * 3.08641975308642e-5)) * (angle * angle)); end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[a, 2.5e+162], N[(b * b), $MachinePrecision], N[(a * N[(N[(a * N[(N[(Pi * Pi), $MachinePrecision] * 3.08641975308642e-5), $MachinePrecision]), $MachinePrecision] * N[(angle * angle), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 2.5 \cdot 10^{+162}:\\
\;\;\;\;b \cdot b\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(\left(a \cdot \left(\left(\pi \cdot \pi\right) \cdot 3.08641975308642 \cdot 10^{-5}\right)\right) \cdot \left(angle \cdot angle\right)\right)\\
\end{array}
\end{array}
if a < 2.4999999999999998e162Initial program 73.9%
Taylor expanded in angle around 0
unpow2N/A
*-lowering-*.f6458.6%
Simplified58.6%
if 2.4999999999999998e162 < a Initial program 99.7%
Taylor expanded in angle around 0
Simplified99.7%
Taylor expanded in angle around 0
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
+-commutativeN/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
associate-*l*N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
Simplified69.8%
Taylor expanded in b around 0
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-commutativeN/A
associate-*l*N/A
metadata-evalN/A
distribute-rgt-neg-inN/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
PI-lowering-PI.f6469.8%
Simplified69.8%
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
PI-lowering-PI.f64N/A
*-lowering-*.f6466.7%
Applied egg-rr66.7%
Final simplification59.4%
(FPCore (a b angle) :precision binary64 (if (<= a 6.2e+162) (* b b) (* (* a a) (* (* (* PI PI) 3.08641975308642e-5) (* angle angle)))))
double code(double a, double b, double angle) {
double tmp;
if (a <= 6.2e+162) {
tmp = b * b;
} else {
tmp = (a * a) * (((((double) M_PI) * ((double) M_PI)) * 3.08641975308642e-5) * (angle * angle));
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (a <= 6.2e+162) {
tmp = b * b;
} else {
tmp = (a * a) * (((Math.PI * Math.PI) * 3.08641975308642e-5) * (angle * angle));
}
return tmp;
}
def code(a, b, angle): tmp = 0 if a <= 6.2e+162: tmp = b * b else: tmp = (a * a) * (((math.pi * math.pi) * 3.08641975308642e-5) * (angle * angle)) return tmp
function code(a, b, angle) tmp = 0.0 if (a <= 6.2e+162) tmp = Float64(b * b); else tmp = Float64(Float64(a * a) * Float64(Float64(Float64(pi * pi) * 3.08641975308642e-5) * Float64(angle * angle))); end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (a <= 6.2e+162) tmp = b * b; else tmp = (a * a) * (((pi * pi) * 3.08641975308642e-5) * (angle * angle)); end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[a, 6.2e+162], N[(b * b), $MachinePrecision], N[(N[(a * a), $MachinePrecision] * N[(N[(N[(Pi * Pi), $MachinePrecision] * 3.08641975308642e-5), $MachinePrecision] * N[(angle * angle), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 6.2 \cdot 10^{+162}:\\
\;\;\;\;b \cdot b\\
\mathbf{else}:\\
\;\;\;\;\left(a \cdot a\right) \cdot \left(\left(\left(\pi \cdot \pi\right) \cdot 3.08641975308642 \cdot 10^{-5}\right) \cdot \left(angle \cdot angle\right)\right)\\
\end{array}
\end{array}
if a < 6.1999999999999999e162Initial program 73.9%
Taylor expanded in angle around 0
unpow2N/A
*-lowering-*.f6458.6%
Simplified58.6%
if 6.1999999999999999e162 < a Initial program 99.7%
Taylor expanded in angle around 0
Simplified99.7%
Taylor expanded in angle around 0
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
+-commutativeN/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
associate-*l*N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
Simplified69.8%
Taylor expanded in b around 0
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-commutativeN/A
associate-*l*N/A
metadata-evalN/A
distribute-rgt-neg-inN/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
PI-lowering-PI.f6469.8%
Simplified69.8%
Final simplification59.7%
(FPCore (a b angle) :precision binary64 (+ (* b b) (* angle (* (* angle (* (* PI PI) 3.08641975308642e-5)) (* a a)))))
double code(double a, double b, double angle) {
return (b * b) + (angle * ((angle * ((((double) M_PI) * ((double) M_PI)) * 3.08641975308642e-5)) * (a * a)));
}
public static double code(double a, double b, double angle) {
return (b * b) + (angle * ((angle * ((Math.PI * Math.PI) * 3.08641975308642e-5)) * (a * a)));
}
def code(a, b, angle): return (b * b) + (angle * ((angle * ((math.pi * math.pi) * 3.08641975308642e-5)) * (a * a)))
function code(a, b, angle) return Float64(Float64(b * b) + Float64(angle * Float64(Float64(angle * Float64(Float64(pi * pi) * 3.08641975308642e-5)) * Float64(a * a)))) end
function tmp = code(a, b, angle) tmp = (b * b) + (angle * ((angle * ((pi * pi) * 3.08641975308642e-5)) * (a * a))); end
code[a_, b_, angle_] := N[(N[(b * b), $MachinePrecision] + N[(angle * N[(N[(angle * N[(N[(Pi * Pi), $MachinePrecision] * 3.08641975308642e-5), $MachinePrecision]), $MachinePrecision] * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
b \cdot b + angle \cdot \left(\left(angle \cdot \left(\left(\pi \cdot \pi\right) \cdot 3.08641975308642 \cdot 10^{-5}\right)\right) \cdot \left(a \cdot a\right)\right)
\end{array}
Initial program 76.6%
Taylor expanded in angle around 0
Simplified76.5%
Taylor expanded in angle around 0
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
+-commutativeN/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
associate-*l*N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
Simplified62.0%
*-commutativeN/A
associate-*l*N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
PI-lowering-PI.f64N/A
*-lowering-*.f6467.3%
Applied egg-rr67.3%
(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 76.6%
Taylor expanded in angle around 0
unpow2N/A
*-lowering-*.f6456.3%
Simplified56.3%
herbie shell --seed 2024161
(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)))