
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* PI (/ angle 180.0)))) (+ (pow (* a (cos t_0)) 2.0) (pow (* b (sin t_0)) 2.0))))
double code(double a, double b, double angle) {
double t_0 = ((double) M_PI) * (angle / 180.0);
return pow((a * cos(t_0)), 2.0) + pow((b * sin(t_0)), 2.0);
}
public static double code(double a, double b, double angle) {
double t_0 = Math.PI * (angle / 180.0);
return Math.pow((a * Math.cos(t_0)), 2.0) + Math.pow((b * Math.sin(t_0)), 2.0);
}
def code(a, b, angle): t_0 = math.pi * (angle / 180.0) return math.pow((a * math.cos(t_0)), 2.0) + math.pow((b * math.sin(t_0)), 2.0)
function code(a, b, angle) t_0 = Float64(pi * Float64(angle / 180.0)) return Float64((Float64(a * cos(t_0)) ^ 2.0) + (Float64(b * sin(t_0)) ^ 2.0)) end
function tmp = code(a, b, angle) t_0 = pi * (angle / 180.0); tmp = ((a * cos(t_0)) ^ 2.0) + ((b * sin(t_0)) ^ 2.0); end
code[a_, b_, angle_] := Block[{t$95$0 = N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]}, N[(N[Power[N[(a * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \pi \cdot \frac{angle}{180}\\
{\left(a \cdot \cos t\_0\right)}^{2} + {\left(b \cdot \sin t\_0\right)}^{2}
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* PI (/ angle 180.0)))) (+ (pow (* a (cos t_0)) 2.0) (pow (* b (sin t_0)) 2.0))))
double code(double a, double b, double angle) {
double t_0 = ((double) M_PI) * (angle / 180.0);
return pow((a * cos(t_0)), 2.0) + pow((b * sin(t_0)), 2.0);
}
public static double code(double a, double b, double angle) {
double t_0 = Math.PI * (angle / 180.0);
return Math.pow((a * Math.cos(t_0)), 2.0) + Math.pow((b * Math.sin(t_0)), 2.0);
}
def code(a, b, angle): t_0 = math.pi * (angle / 180.0) return math.pow((a * math.cos(t_0)), 2.0) + math.pow((b * math.sin(t_0)), 2.0)
function code(a, b, angle) t_0 = Float64(pi * Float64(angle / 180.0)) return Float64((Float64(a * cos(t_0)) ^ 2.0) + (Float64(b * sin(t_0)) ^ 2.0)) end
function tmp = code(a, b, angle) t_0 = pi * (angle / 180.0); tmp = ((a * cos(t_0)) ^ 2.0) + ((b * sin(t_0)) ^ 2.0); end
code[a_, b_, angle_] := Block[{t$95$0 = N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]}, N[(N[Power[N[(a * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \pi \cdot \frac{angle}{180}\\
{\left(a \cdot \cos t\_0\right)}^{2} + {\left(b \cdot \sin t\_0\right)}^{2}
\end{array}
\end{array}
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* PI (* angle 0.005555555555555556)))
(t_1 (sin t_0))
(t_2 (* b t_1))
(t_3 (* t_1 t_1)))
(fma
t_2
t_2
(*
(* a a)
(+
0.5
(*
0.5
(/
(+
(pow (cos (* angle (* PI 0.005555555555555556))) 6.0)
(pow (* t_1 (- 0.0 t_1)) 3.0))
(+
(pow (cos t_0) 4.0)
(+
(* t_3 t_3)
(*
(fma
0.5
(cos
(*
(* angle (* (sqrt (* PI (sqrt PI))) (sqrt (sqrt PI))))
0.011111111111111112))
0.5)
t_3))))))))))
double code(double a, double b, double angle) {
double t_0 = ((double) M_PI) * (angle * 0.005555555555555556);
double t_1 = sin(t_0);
double t_2 = b * t_1;
double t_3 = t_1 * t_1;
return fma(t_2, t_2, ((a * a) * (0.5 + (0.5 * ((pow(cos((angle * (((double) M_PI) * 0.005555555555555556))), 6.0) + pow((t_1 * (0.0 - t_1)), 3.0)) / (pow(cos(t_0), 4.0) + ((t_3 * t_3) + (fma(0.5, cos(((angle * (sqrt((((double) M_PI) * sqrt(((double) M_PI)))) * sqrt(sqrt(((double) M_PI))))) * 0.011111111111111112)), 0.5) * t_3))))))));
}
function code(a, b, angle) t_0 = Float64(pi * Float64(angle * 0.005555555555555556)) t_1 = sin(t_0) t_2 = Float64(b * t_1) t_3 = Float64(t_1 * t_1) return fma(t_2, t_2, Float64(Float64(a * a) * Float64(0.5 + Float64(0.5 * Float64(Float64((cos(Float64(angle * Float64(pi * 0.005555555555555556))) ^ 6.0) + (Float64(t_1 * Float64(0.0 - t_1)) ^ 3.0)) / Float64((cos(t_0) ^ 4.0) + Float64(Float64(t_3 * t_3) + Float64(fma(0.5, cos(Float64(Float64(angle * Float64(sqrt(Float64(pi * sqrt(pi))) * sqrt(sqrt(pi)))) * 0.011111111111111112)), 0.5) * t_3)))))))) end
code[a_, b_, angle_] := Block[{t$95$0 = N[(Pi * N[(angle * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sin[t$95$0], $MachinePrecision]}, Block[{t$95$2 = N[(b * t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$1 * t$95$1), $MachinePrecision]}, N[(t$95$2 * t$95$2 + N[(N[(a * a), $MachinePrecision] * N[(0.5 + N[(0.5 * N[(N[(N[Power[N[Cos[N[(angle * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 6.0], $MachinePrecision] + N[Power[N[(t$95$1 * N[(0.0 - t$95$1), $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision] / N[(N[Power[N[Cos[t$95$0], $MachinePrecision], 4.0], $MachinePrecision] + N[(N[(t$95$3 * t$95$3), $MachinePrecision] + N[(N[(0.5 * N[Cos[N[(N[(angle * N[(N[Sqrt[N[(Pi * N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[Sqrt[Pi], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.011111111111111112), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision] * t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \pi \cdot \left(angle \cdot 0.005555555555555556\right)\\
t_1 := \sin t\_0\\
t_2 := b \cdot t\_1\\
t_3 := t\_1 \cdot t\_1\\
\mathsf{fma}\left(t\_2, t\_2, \left(a \cdot a\right) \cdot \left(0.5 + 0.5 \cdot \frac{{\cos \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)}^{6} + {\left(t\_1 \cdot \left(0 - t\_1\right)\right)}^{3}}{{\cos t\_0}^{4} + \left(t\_3 \cdot t\_3 + \mathsf{fma}\left(0.5, \cos \left(\left(angle \cdot \left(\sqrt{\pi \cdot \sqrt{\pi}} \cdot \sqrt{\sqrt{\pi}}\right)\right) \cdot 0.011111111111111112\right), 0.5\right) \cdot t\_3\right)}\right)\right)
\end{array}
\end{array}
Initial program 81.2%
+-commutativeN/A
unpow2N/A
accelerator-lowering-fma.f64N/A
Applied egg-rr81.4%
Applied egg-rr81.4%
add-sqr-sqrtN/A
sqrt-unprodN/A
add-sqr-sqrtN/A
associate-*r*N/A
sqrt-unprodN/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
sqrt-lowering-sqrt.f64N/A
PI-lowering-PI.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
PI-lowering-PI.f6481.4
Applied egg-rr81.4%
Taylor expanded in angle around inf
*-commutativeN/A
associate-*r*N/A
cos-lowering-cos.f64N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
PI-lowering-PI.f6481.4
Simplified81.4%
Final simplification81.4%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* PI (* angle 0.005555555555555556)))
(t_1 (cos t_0))
(t_2 (sin t_0))
(t_3 (* b t_2))
(t_4 (* t_2 t_2)))
(fma
t_3
t_3
(*
(* a a)
(+
0.5
(*
0.5
(/
(- (pow t_1 6.0) (pow t_2 6.0))
(+
(pow t_1 4.0)
(+
(* t_4 t_4)
(*
(fma 0.5 (cos (* 0.011111111111111112 (* PI angle))) 0.5)
t_4))))))))))
double code(double a, double b, double angle) {
double t_0 = ((double) M_PI) * (angle * 0.005555555555555556);
double t_1 = cos(t_0);
double t_2 = sin(t_0);
double t_3 = b * t_2;
double t_4 = t_2 * t_2;
return fma(t_3, t_3, ((a * a) * (0.5 + (0.5 * ((pow(t_1, 6.0) - pow(t_2, 6.0)) / (pow(t_1, 4.0) + ((t_4 * t_4) + (fma(0.5, cos((0.011111111111111112 * (((double) M_PI) * angle))), 0.5) * t_4))))))));
}
function code(a, b, angle) t_0 = Float64(pi * Float64(angle * 0.005555555555555556)) t_1 = cos(t_0) t_2 = sin(t_0) t_3 = Float64(b * t_2) t_4 = Float64(t_2 * t_2) return fma(t_3, t_3, Float64(Float64(a * a) * Float64(0.5 + Float64(0.5 * Float64(Float64((t_1 ^ 6.0) - (t_2 ^ 6.0)) / Float64((t_1 ^ 4.0) + Float64(Float64(t_4 * t_4) + Float64(fma(0.5, cos(Float64(0.011111111111111112 * Float64(pi * angle))), 0.5) * t_4)))))))) end
code[a_, b_, angle_] := Block[{t$95$0 = N[(Pi * N[(angle * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Cos[t$95$0], $MachinePrecision]}, Block[{t$95$2 = N[Sin[t$95$0], $MachinePrecision]}, Block[{t$95$3 = N[(b * t$95$2), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$2 * t$95$2), $MachinePrecision]}, N[(t$95$3 * t$95$3 + N[(N[(a * a), $MachinePrecision] * N[(0.5 + N[(0.5 * N[(N[(N[Power[t$95$1, 6.0], $MachinePrecision] - N[Power[t$95$2, 6.0], $MachinePrecision]), $MachinePrecision] / N[(N[Power[t$95$1, 4.0], $MachinePrecision] + N[(N[(t$95$4 * t$95$4), $MachinePrecision] + N[(N[(0.5 * N[Cos[N[(0.011111111111111112 * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision] * t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \pi \cdot \left(angle \cdot 0.005555555555555556\right)\\
t_1 := \cos t\_0\\
t_2 := \sin t\_0\\
t_3 := b \cdot t\_2\\
t_4 := t\_2 \cdot t\_2\\
\mathsf{fma}\left(t\_3, t\_3, \left(a \cdot a\right) \cdot \left(0.5 + 0.5 \cdot \frac{{t\_1}^{6} - {t\_2}^{6}}{{t\_1}^{4} + \left(t\_4 \cdot t\_4 + \mathsf{fma}\left(0.5, \cos \left(0.011111111111111112 \cdot \left(\pi \cdot angle\right)\right), 0.5\right) \cdot t\_4\right)}\right)\right)
\end{array}
\end{array}
Initial program 81.2%
+-commutativeN/A
unpow2N/A
accelerator-lowering-fma.f64N/A
Applied egg-rr81.4%
Applied egg-rr81.4%
unpow3N/A
Applied egg-rr81.4%
Final simplification81.4%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* PI (* angle 0.005555555555555556)))
(t_1 (sin t_0))
(t_2 (* b t_1))
(t_3 (cos t_0)))
(fma
t_2
t_2
(*
(* a a)
(+
0.5
(*
0.5
(/
(+ (pow (* t_1 (- 0.0 t_1)) 3.0) (pow t_3 6.0))
(fma
t_1
(+
(pow t_1 3.0)
(* t_1 (fma 0.5 (cos (* 0.011111111111111112 (* PI angle))) 0.5)))
(pow t_3 4.0)))))))))
double code(double a, double b, double angle) {
double t_0 = ((double) M_PI) * (angle * 0.005555555555555556);
double t_1 = sin(t_0);
double t_2 = b * t_1;
double t_3 = cos(t_0);
return fma(t_2, t_2, ((a * a) * (0.5 + (0.5 * ((pow((t_1 * (0.0 - t_1)), 3.0) + pow(t_3, 6.0)) / fma(t_1, (pow(t_1, 3.0) + (t_1 * fma(0.5, cos((0.011111111111111112 * (((double) M_PI) * angle))), 0.5))), pow(t_3, 4.0)))))));
}
function code(a, b, angle) t_0 = Float64(pi * Float64(angle * 0.005555555555555556)) t_1 = sin(t_0) t_2 = Float64(b * t_1) t_3 = cos(t_0) return fma(t_2, t_2, Float64(Float64(a * a) * Float64(0.5 + Float64(0.5 * Float64(Float64((Float64(t_1 * Float64(0.0 - t_1)) ^ 3.0) + (t_3 ^ 6.0)) / fma(t_1, Float64((t_1 ^ 3.0) + Float64(t_1 * fma(0.5, cos(Float64(0.011111111111111112 * Float64(pi * angle))), 0.5))), (t_3 ^ 4.0))))))) end
code[a_, b_, angle_] := Block[{t$95$0 = N[(Pi * N[(angle * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sin[t$95$0], $MachinePrecision]}, Block[{t$95$2 = N[(b * t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[Cos[t$95$0], $MachinePrecision]}, N[(t$95$2 * t$95$2 + N[(N[(a * a), $MachinePrecision] * N[(0.5 + N[(0.5 * N[(N[(N[Power[N[(t$95$1 * N[(0.0 - t$95$1), $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision] + N[Power[t$95$3, 6.0], $MachinePrecision]), $MachinePrecision] / N[(t$95$1 * N[(N[Power[t$95$1, 3.0], $MachinePrecision] + N[(t$95$1 * N[(0.5 * N[Cos[N[(0.011111111111111112 * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Power[t$95$3, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \pi \cdot \left(angle \cdot 0.005555555555555556\right)\\
t_1 := \sin t\_0\\
t_2 := b \cdot t\_1\\
t_3 := \cos t\_0\\
\mathsf{fma}\left(t\_2, t\_2, \left(a \cdot a\right) \cdot \left(0.5 + 0.5 \cdot \frac{{\left(t\_1 \cdot \left(0 - t\_1\right)\right)}^{3} + {t\_3}^{6}}{\mathsf{fma}\left(t\_1, {t\_1}^{3} + t\_1 \cdot \mathsf{fma}\left(0.5, \cos \left(0.011111111111111112 \cdot \left(\pi \cdot angle\right)\right), 0.5\right), {t\_3}^{4}\right)}\right)\right)
\end{array}
\end{array}
Initial program 81.2%
+-commutativeN/A
unpow2N/A
accelerator-lowering-fma.f64N/A
Applied egg-rr81.4%
Applied egg-rr81.4%
Applied egg-rr81.4%
Final simplification81.4%
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* PI (* angle 0.005555555555555556))) (t_1 (* b (sin t_0)))) (fma t_1 t_1 (* (* a a) (+ 0.5 (* 0.5 (cos (* t_0 2.0))))))))
double code(double a, double b, double angle) {
double t_0 = ((double) M_PI) * (angle * 0.005555555555555556);
double t_1 = b * sin(t_0);
return fma(t_1, t_1, ((a * a) * (0.5 + (0.5 * cos((t_0 * 2.0))))));
}
function code(a, b, angle) t_0 = Float64(pi * Float64(angle * 0.005555555555555556)) t_1 = Float64(b * sin(t_0)) return fma(t_1, t_1, Float64(Float64(a * a) * Float64(0.5 + Float64(0.5 * cos(Float64(t_0 * 2.0)))))) end
code[a_, b_, angle_] := Block[{t$95$0 = N[(Pi * N[(angle * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(b * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision]}, N[(t$95$1 * t$95$1 + N[(N[(a * a), $MachinePrecision] * N[(0.5 + N[(0.5 * N[Cos[N[(t$95$0 * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \pi \cdot \left(angle \cdot 0.005555555555555556\right)\\
t_1 := b \cdot \sin t\_0\\
\mathsf{fma}\left(t\_1, t\_1, \left(a \cdot a\right) \cdot \left(0.5 + 0.5 \cdot \cos \left(t\_0 \cdot 2\right)\right)\right)
\end{array}
\end{array}
Initial program 81.2%
+-commutativeN/A
unpow2N/A
accelerator-lowering-fma.f64N/A
Applied egg-rr81.4%
Final simplification81.4%
(FPCore (a b angle) :precision binary64 (+ (fma (* a (* 0.5 (cos (* 0.011111111111111112 (* PI angle))))) a (* (* a a) 0.5)) (pow (* b (sin (* PI (/ angle 180.0)))) 2.0)))
double code(double a, double b, double angle) {
return fma((a * (0.5 * cos((0.011111111111111112 * (((double) M_PI) * angle))))), a, ((a * a) * 0.5)) + pow((b * sin((((double) M_PI) * (angle / 180.0)))), 2.0);
}
function code(a, b, angle) return Float64(fma(Float64(a * Float64(0.5 * cos(Float64(0.011111111111111112 * Float64(pi * angle))))), a, Float64(Float64(a * a) * 0.5)) + (Float64(b * sin(Float64(pi * Float64(angle / 180.0)))) ^ 2.0)) end
code[a_, b_, angle_] := N[(N[(N[(a * N[(0.5 * N[Cos[N[(0.011111111111111112 * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * a + N[(N[(a * a), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] + N[Power[N[(b * N[Sin[N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(a \cdot \left(0.5 \cdot \cos \left(0.011111111111111112 \cdot \left(\pi \cdot angle\right)\right)\right), a, \left(a \cdot a\right) \cdot 0.5\right) + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2}
\end{array}
Initial program 81.2%
unpow1N/A
pow-to-expN/A
pow-expN/A
*-commutativeN/A
pow-expN/A
pow-lowering-pow.f64N/A
exp-lowering-exp.f64N/A
rem-log-expN/A
pow-to-expN/A
unpow1N/A
log-lowering-log.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
div-invN/A
*-lowering-*.f64N/A
metadata-eval45.4
Applied egg-rr45.4%
pow-expN/A
*-commutativeN/A
pow-to-expN/A
pow2N/A
swap-sqrN/A
metadata-evalN/A
div-invN/A
metadata-evalN/A
div-invN/A
sqr-cos-aN/A
div-invN/A
metadata-evalN/A
Applied egg-rr81.2%
Final simplification81.2%
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* b (sin (* PI (* angle 0.005555555555555556)))))) (fma t_0 t_0 (* a a))))
double code(double a, double b, double angle) {
double t_0 = b * sin((((double) M_PI) * (angle * 0.005555555555555556)));
return fma(t_0, t_0, (a * a));
}
function code(a, b, angle) t_0 = Float64(b * sin(Float64(pi * Float64(angle * 0.005555555555555556)))) return fma(t_0, t_0, Float64(a * a)) end
code[a_, b_, angle_] := Block[{t$95$0 = N[(b * N[Sin[N[(Pi * N[(angle * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, N[(t$95$0 * t$95$0 + N[(a * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\\
\mathsf{fma}\left(t\_0, t\_0, a \cdot a\right)
\end{array}
\end{array}
Initial program 81.2%
+-commutativeN/A
unpow2N/A
accelerator-lowering-fma.f64N/A
Applied egg-rr81.4%
Taylor expanded in angle around 0
Simplified80.8%
Final simplification80.8%
(FPCore (a b angle) :precision binary64 (+ (* a a) (pow (* b (sin (* PI (/ angle 180.0)))) 2.0)))
double code(double a, double b, double angle) {
return (a * a) + pow((b * sin((((double) M_PI) * (angle / 180.0)))), 2.0);
}
public static double code(double a, double b, double angle) {
return (a * a) + Math.pow((b * Math.sin((Math.PI * (angle / 180.0)))), 2.0);
}
def code(a, b, angle): return (a * a) + math.pow((b * math.sin((math.pi * (angle / 180.0)))), 2.0)
function code(a, b, angle) return Float64(Float64(a * a) + (Float64(b * sin(Float64(pi * Float64(angle / 180.0)))) ^ 2.0)) end
function tmp = code(a, b, angle) tmp = (a * a) + ((b * sin((pi * (angle / 180.0)))) ^ 2.0); end
code[a_, b_, angle_] := N[(N[(a * a), $MachinePrecision] + N[Power[N[(b * N[Sin[N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
a \cdot a + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2}
\end{array}
Initial program 81.2%
Taylor expanded in angle around 0
unpow2N/A
*-lowering-*.f6480.7
Simplified80.7%
(FPCore (a b angle)
:precision binary64
(if (<= angle 46000000.0)
(fma
(*
b
(*
angle
(*
PI
(fma
(* (* angle angle) -2.8577960676726107e-8)
(* PI PI)
0.005555555555555556))))
(* b (* 0.005555555555555556 (* PI angle)))
(*
(* a a)
(+ 0.5 (* 0.5 (cos (* (* PI (* angle 0.005555555555555556)) 2.0))))))
(fma
(* angle angle)
(* PI (* PI (* 3.08641975308642e-5 (* b b))))
(* a a))))
double code(double a, double b, double angle) {
double tmp;
if (angle <= 46000000.0) {
tmp = fma((b * (angle * (((double) M_PI) * fma(((angle * angle) * -2.8577960676726107e-8), (((double) M_PI) * ((double) M_PI)), 0.005555555555555556)))), (b * (0.005555555555555556 * (((double) M_PI) * angle))), ((a * a) * (0.5 + (0.5 * cos(((((double) M_PI) * (angle * 0.005555555555555556)) * 2.0))))));
} else {
tmp = fma((angle * angle), (((double) M_PI) * (((double) M_PI) * (3.08641975308642e-5 * (b * b)))), (a * a));
}
return tmp;
}
function code(a, b, angle) tmp = 0.0 if (angle <= 46000000.0) tmp = fma(Float64(b * Float64(angle * Float64(pi * fma(Float64(Float64(angle * angle) * -2.8577960676726107e-8), Float64(pi * pi), 0.005555555555555556)))), Float64(b * Float64(0.005555555555555556 * Float64(pi * angle))), Float64(Float64(a * a) * Float64(0.5 + Float64(0.5 * cos(Float64(Float64(pi * Float64(angle * 0.005555555555555556)) * 2.0)))))); else tmp = fma(Float64(angle * angle), Float64(pi * Float64(pi * Float64(3.08641975308642e-5 * Float64(b * b)))), Float64(a * a)); end return tmp end
code[a_, b_, angle_] := If[LessEqual[angle, 46000000.0], N[(N[(b * N[(angle * N[(Pi * N[(N[(N[(angle * angle), $MachinePrecision] * -2.8577960676726107e-8), $MachinePrecision] * N[(Pi * Pi), $MachinePrecision] + 0.005555555555555556), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(b * N[(0.005555555555555556 * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(a * a), $MachinePrecision] * N[(0.5 + N[(0.5 * N[Cos[N[(N[(Pi * N[(angle * 0.005555555555555556), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(angle * angle), $MachinePrecision] * N[(Pi * N[(Pi * N[(3.08641975308642e-5 * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(a * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;angle \leq 46000000:\\
\;\;\;\;\mathsf{fma}\left(b \cdot \left(angle \cdot \left(\pi \cdot \mathsf{fma}\left(\left(angle \cdot angle\right) \cdot -2.8577960676726107 \cdot 10^{-8}, \pi \cdot \pi, 0.005555555555555556\right)\right)\right), b \cdot \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right), \left(a \cdot a\right) \cdot \left(0.5 + 0.5 \cdot \cos \left(\left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right) \cdot 2\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(angle \cdot angle, \pi \cdot \left(\pi \cdot \left(3.08641975308642 \cdot 10^{-5} \cdot \left(b \cdot b\right)\right)\right), a \cdot a\right)\\
\end{array}
\end{array}
if angle < 4.6e7Initial program 86.0%
+-commutativeN/A
unpow2N/A
accelerator-lowering-fma.f64N/A
Applied egg-rr86.1%
Taylor expanded in angle around 0
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
+-commutativeN/A
*-lowering-*.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
unpow3N/A
unpow2N/A
associate-*r*N/A
Simplified76.0%
Taylor expanded in angle around 0
*-lowering-*.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f6469.9
Simplified69.9%
if 4.6e7 < angle Initial program 62.9%
Taylor expanded in angle around 0
accelerator-lowering-fma.f64N/A
Simplified21.8%
Taylor expanded in b around inf
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6455.9
Simplified55.9%
Final simplification67.0%
(FPCore (a b angle)
:precision binary64
(if (<= angle 140.0)
(fma
(*
b
(*
angle
(*
PI
(fma
(* (* angle angle) -2.8577960676726107e-8)
(* PI PI)
0.005555555555555556))))
(* b (sin (* PI (* angle 0.005555555555555556))))
(* a a))
(fma
(* angle angle)
(* PI (* PI (* 3.08641975308642e-5 (* b b))))
(* a a))))
double code(double a, double b, double angle) {
double tmp;
if (angle <= 140.0) {
tmp = fma((b * (angle * (((double) M_PI) * fma(((angle * angle) * -2.8577960676726107e-8), (((double) M_PI) * ((double) M_PI)), 0.005555555555555556)))), (b * sin((((double) M_PI) * (angle * 0.005555555555555556)))), (a * a));
} else {
tmp = fma((angle * angle), (((double) M_PI) * (((double) M_PI) * (3.08641975308642e-5 * (b * b)))), (a * a));
}
return tmp;
}
function code(a, b, angle) tmp = 0.0 if (angle <= 140.0) tmp = fma(Float64(b * Float64(angle * Float64(pi * fma(Float64(Float64(angle * angle) * -2.8577960676726107e-8), Float64(pi * pi), 0.005555555555555556)))), Float64(b * sin(Float64(pi * Float64(angle * 0.005555555555555556)))), Float64(a * a)); else tmp = fma(Float64(angle * angle), Float64(pi * Float64(pi * Float64(3.08641975308642e-5 * Float64(b * b)))), Float64(a * a)); end return tmp end
code[a_, b_, angle_] := If[LessEqual[angle, 140.0], N[(N[(b * N[(angle * N[(Pi * N[(N[(N[(angle * angle), $MachinePrecision] * -2.8577960676726107e-8), $MachinePrecision] * N[(Pi * Pi), $MachinePrecision] + 0.005555555555555556), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(b * N[Sin[N[(Pi * N[(angle * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(a * a), $MachinePrecision]), $MachinePrecision], N[(N[(angle * angle), $MachinePrecision] * N[(Pi * N[(Pi * N[(3.08641975308642e-5 * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(a * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;angle \leq 140:\\
\;\;\;\;\mathsf{fma}\left(b \cdot \left(angle \cdot \left(\pi \cdot \mathsf{fma}\left(\left(angle \cdot angle\right) \cdot -2.8577960676726107 \cdot 10^{-8}, \pi \cdot \pi, 0.005555555555555556\right)\right)\right), b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right), a \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(angle \cdot angle, \pi \cdot \left(\pi \cdot \left(3.08641975308642 \cdot 10^{-5} \cdot \left(b \cdot b\right)\right)\right), a \cdot a\right)\\
\end{array}
\end{array}
if angle < 140Initial program 85.9%
+-commutativeN/A
unpow2N/A
accelerator-lowering-fma.f64N/A
Applied egg-rr86.1%
Taylor expanded in angle around 0
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
+-commutativeN/A
*-lowering-*.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
unpow3N/A
unpow2N/A
associate-*r*N/A
Simplified75.7%
Taylor expanded in angle around 0
Simplified75.3%
if 140 < angle Initial program 64.4%
Taylor expanded in angle around 0
accelerator-lowering-fma.f64N/A
Simplified22.5%
Taylor expanded in b around inf
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6456.9
Simplified56.9%
Final simplification71.3%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* angle (* b PI))))
(if (<= b 8.5e-122)
(* (* a a) (fma 0.5 (cos (* 0.011111111111111112 (* PI angle))) 0.5))
(if (<= b 5e+145)
(fma
(* angle angle)
(* PI (* PI (* 3.08641975308642e-5 (* b b))))
(* a a))
(* 3.08641975308642e-5 (* t_0 t_0))))))
double code(double a, double b, double angle) {
double t_0 = angle * (b * ((double) M_PI));
double tmp;
if (b <= 8.5e-122) {
tmp = (a * a) * fma(0.5, cos((0.011111111111111112 * (((double) M_PI) * angle))), 0.5);
} else if (b <= 5e+145) {
tmp = fma((angle * angle), (((double) M_PI) * (((double) M_PI) * (3.08641975308642e-5 * (b * b)))), (a * a));
} else {
tmp = 3.08641975308642e-5 * (t_0 * t_0);
}
return tmp;
}
function code(a, b, angle) t_0 = Float64(angle * Float64(b * pi)) tmp = 0.0 if (b <= 8.5e-122) tmp = Float64(Float64(a * a) * fma(0.5, cos(Float64(0.011111111111111112 * Float64(pi * angle))), 0.5)); elseif (b <= 5e+145) tmp = fma(Float64(angle * angle), Float64(pi * Float64(pi * Float64(3.08641975308642e-5 * Float64(b * b)))), Float64(a * a)); else tmp = Float64(3.08641975308642e-5 * Float64(t_0 * t_0)); end return tmp end
code[a_, b_, angle_] := Block[{t$95$0 = N[(angle * N[(b * Pi), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 8.5e-122], N[(N[(a * a), $MachinePrecision] * N[(0.5 * N[Cos[N[(0.011111111111111112 * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 5e+145], N[(N[(angle * angle), $MachinePrecision] * N[(Pi * N[(Pi * N[(3.08641975308642e-5 * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(a * a), $MachinePrecision]), $MachinePrecision], N[(3.08641975308642e-5 * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := angle \cdot \left(b \cdot \pi\right)\\
\mathbf{if}\;b \leq 8.5 \cdot 10^{-122}:\\
\;\;\;\;\left(a \cdot a\right) \cdot \mathsf{fma}\left(0.5, \cos \left(0.011111111111111112 \cdot \left(\pi \cdot angle\right)\right), 0.5\right)\\
\mathbf{elif}\;b \leq 5 \cdot 10^{+145}:\\
\;\;\;\;\mathsf{fma}\left(angle \cdot angle, \pi \cdot \left(\pi \cdot \left(3.08641975308642 \cdot 10^{-5} \cdot \left(b \cdot b\right)\right)\right), a \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;3.08641975308642 \cdot 10^{-5} \cdot \left(t\_0 \cdot t\_0\right)\\
\end{array}
\end{array}
if b < 8.50000000000000003e-122Initial program 78.1%
+-commutativeN/A
unpow2N/A
accelerator-lowering-fma.f64N/A
Applied egg-rr78.3%
Taylor expanded in b around 0
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
cos-lowering-cos.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f6462.4
Simplified62.4%
if 8.50000000000000003e-122 < b < 4.99999999999999967e145Initial program 80.6%
Taylor expanded in angle around 0
accelerator-lowering-fma.f64N/A
Simplified53.5%
Taylor expanded in b around inf
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6478.7
Simplified78.7%
if 4.99999999999999967e145 < b Initial program 97.0%
Taylor expanded in angle around 0
accelerator-lowering-fma.f64N/A
Simplified42.1%
Taylor expanded in b around inf
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
PI-lowering-PI.f64N/A
unpow2N/A
*-lowering-*.f6464.3
Simplified64.3%
*-commutativeN/A
unswap-sqrN/A
unswap-sqrN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f6483.7
Applied egg-rr83.7%
Final simplification68.4%
(FPCore (a b angle)
:precision binary64
(let* ((t_0 (* angle (* b PI))))
(if (<= b 8.4e-122)
(* a a)
(if (<= b 5e+145)
(fma
(* angle angle)
(* PI (* PI (* 3.08641975308642e-5 (* b b))))
(* a a))
(* 3.08641975308642e-5 (* t_0 t_0))))))
double code(double a, double b, double angle) {
double t_0 = angle * (b * ((double) M_PI));
double tmp;
if (b <= 8.4e-122) {
tmp = a * a;
} else if (b <= 5e+145) {
tmp = fma((angle * angle), (((double) M_PI) * (((double) M_PI) * (3.08641975308642e-5 * (b * b)))), (a * a));
} else {
tmp = 3.08641975308642e-5 * (t_0 * t_0);
}
return tmp;
}
function code(a, b, angle) t_0 = Float64(angle * Float64(b * pi)) tmp = 0.0 if (b <= 8.4e-122) tmp = Float64(a * a); elseif (b <= 5e+145) tmp = fma(Float64(angle * angle), Float64(pi * Float64(pi * Float64(3.08641975308642e-5 * Float64(b * b)))), Float64(a * a)); else tmp = Float64(3.08641975308642e-5 * Float64(t_0 * t_0)); end return tmp end
code[a_, b_, angle_] := Block[{t$95$0 = N[(angle * N[(b * Pi), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 8.4e-122], N[(a * a), $MachinePrecision], If[LessEqual[b, 5e+145], N[(N[(angle * angle), $MachinePrecision] * N[(Pi * N[(Pi * N[(3.08641975308642e-5 * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(a * a), $MachinePrecision]), $MachinePrecision], N[(3.08641975308642e-5 * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := angle \cdot \left(b \cdot \pi\right)\\
\mathbf{if}\;b \leq 8.4 \cdot 10^{-122}:\\
\;\;\;\;a \cdot a\\
\mathbf{elif}\;b \leq 5 \cdot 10^{+145}:\\
\;\;\;\;\mathsf{fma}\left(angle \cdot angle, \pi \cdot \left(\pi \cdot \left(3.08641975308642 \cdot 10^{-5} \cdot \left(b \cdot b\right)\right)\right), a \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;3.08641975308642 \cdot 10^{-5} \cdot \left(t\_0 \cdot t\_0\right)\\
\end{array}
\end{array}
if b < 8.39999999999999969e-122Initial program 78.1%
Taylor expanded in angle around 0
unpow2N/A
*-lowering-*.f6462.7
Simplified62.7%
if 8.39999999999999969e-122 < b < 4.99999999999999967e145Initial program 80.6%
Taylor expanded in angle around 0
accelerator-lowering-fma.f64N/A
Simplified53.5%
Taylor expanded in b around inf
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6478.7
Simplified78.7%
if 4.99999999999999967e145 < b Initial program 97.0%
Taylor expanded in angle around 0
accelerator-lowering-fma.f64N/A
Simplified42.1%
Taylor expanded in b around inf
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
PI-lowering-PI.f64N/A
unpow2N/A
*-lowering-*.f6464.3
Simplified64.3%
*-commutativeN/A
unswap-sqrN/A
unswap-sqrN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f6483.7
Applied egg-rr83.7%
Final simplification68.6%
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* angle (* b PI)))) (if (<= b 1.5e+144) (* a a) (* 3.08641975308642e-5 (* t_0 t_0)))))
double code(double a, double b, double angle) {
double t_0 = angle * (b * ((double) M_PI));
double tmp;
if (b <= 1.5e+144) {
tmp = a * a;
} else {
tmp = 3.08641975308642e-5 * (t_0 * t_0);
}
return tmp;
}
public static double code(double a, double b, double angle) {
double t_0 = angle * (b * Math.PI);
double tmp;
if (b <= 1.5e+144) {
tmp = a * a;
} else {
tmp = 3.08641975308642e-5 * (t_0 * t_0);
}
return tmp;
}
def code(a, b, angle): t_0 = angle * (b * math.pi) tmp = 0 if b <= 1.5e+144: tmp = a * a else: tmp = 3.08641975308642e-5 * (t_0 * t_0) return tmp
function code(a, b, angle) t_0 = Float64(angle * Float64(b * pi)) tmp = 0.0 if (b <= 1.5e+144) tmp = Float64(a * a); else tmp = Float64(3.08641975308642e-5 * Float64(t_0 * t_0)); end return tmp end
function tmp_2 = code(a, b, angle) t_0 = angle * (b * pi); tmp = 0.0; if (b <= 1.5e+144) tmp = a * a; else tmp = 3.08641975308642e-5 * (t_0 * t_0); end tmp_2 = tmp; end
code[a_, b_, angle_] := Block[{t$95$0 = N[(angle * N[(b * Pi), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 1.5e+144], N[(a * a), $MachinePrecision], N[(3.08641975308642e-5 * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := angle \cdot \left(b \cdot \pi\right)\\
\mathbf{if}\;b \leq 1.5 \cdot 10^{+144}:\\
\;\;\;\;a \cdot a\\
\mathbf{else}:\\
\;\;\;\;3.08641975308642 \cdot 10^{-5} \cdot \left(t\_0 \cdot t\_0\right)\\
\end{array}
\end{array}
if b < 1.49999999999999995e144Initial program 78.6%
Taylor expanded in angle around 0
unpow2N/A
*-lowering-*.f6463.0
Simplified63.0%
if 1.49999999999999995e144 < b Initial program 97.0%
Taylor expanded in angle around 0
accelerator-lowering-fma.f64N/A
Simplified42.1%
Taylor expanded in b around inf
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
PI-lowering-PI.f64N/A
unpow2N/A
*-lowering-*.f6464.3
Simplified64.3%
*-commutativeN/A
unswap-sqrN/A
unswap-sqrN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f6483.7
Applied egg-rr83.7%
Final simplification65.9%
(FPCore (a b angle) :precision binary64 (if (<= b 7.8e+142) (* a a) (* 3.08641975308642e-5 (* angle (* angle (* PI (* PI (* b b))))))))
double code(double a, double b, double angle) {
double tmp;
if (b <= 7.8e+142) {
tmp = a * a;
} else {
tmp = 3.08641975308642e-5 * (angle * (angle * (((double) M_PI) * (((double) M_PI) * (b * b)))));
}
return tmp;
}
public static double code(double a, double b, double angle) {
double tmp;
if (b <= 7.8e+142) {
tmp = a * a;
} else {
tmp = 3.08641975308642e-5 * (angle * (angle * (Math.PI * (Math.PI * (b * b)))));
}
return tmp;
}
def code(a, b, angle): tmp = 0 if b <= 7.8e+142: tmp = a * a else: tmp = 3.08641975308642e-5 * (angle * (angle * (math.pi * (math.pi * (b * b))))) return tmp
function code(a, b, angle) tmp = 0.0 if (b <= 7.8e+142) tmp = Float64(a * a); else tmp = Float64(3.08641975308642e-5 * Float64(angle * Float64(angle * Float64(pi * Float64(pi * Float64(b * b)))))); end return tmp end
function tmp_2 = code(a, b, angle) tmp = 0.0; if (b <= 7.8e+142) tmp = a * a; else tmp = 3.08641975308642e-5 * (angle * (angle * (pi * (pi * (b * b))))); end tmp_2 = tmp; end
code[a_, b_, angle_] := If[LessEqual[b, 7.8e+142], N[(a * a), $MachinePrecision], N[(3.08641975308642e-5 * N[(angle * N[(angle * N[(Pi * N[(Pi * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 7.8 \cdot 10^{+142}:\\
\;\;\;\;a \cdot a\\
\mathbf{else}:\\
\;\;\;\;3.08641975308642 \cdot 10^{-5} \cdot \left(angle \cdot \left(angle \cdot \left(\pi \cdot \left(\pi \cdot \left(b \cdot b\right)\right)\right)\right)\right)\\
\end{array}
\end{array}
if b < 7.8000000000000001e142Initial program 78.6%
Taylor expanded in angle around 0
unpow2N/A
*-lowering-*.f6463.0
Simplified63.0%
if 7.8000000000000001e142 < b Initial program 97.0%
Taylor expanded in angle around 0
accelerator-lowering-fma.f64N/A
Simplified42.1%
Taylor expanded in b around inf
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
PI-lowering-PI.f64N/A
unpow2N/A
*-lowering-*.f6464.3
Simplified64.3%
Taylor expanded in angle around 0
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
unpow2N/A
*-lowering-*.f6470.9
Simplified70.9%
(FPCore (a b angle) :precision binary64 (* a a))
double code(double a, double b, double angle) {
return a * a;
}
real(8) function code(a, b, angle)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle
code = a * a
end function
public static double code(double a, double b, double angle) {
return a * a;
}
def code(a, b, angle): return a * a
function code(a, b, angle) return Float64(a * a) end
function tmp = code(a, b, angle) tmp = a * a; end
code[a_, b_, angle_] := N[(a * a), $MachinePrecision]
\begin{array}{l}
\\
a \cdot a
\end{array}
Initial program 81.2%
Taylor expanded in angle around 0
unpow2N/A
*-lowering-*.f6459.1
Simplified59.1%
herbie shell --seed 2024196
(FPCore (a b angle)
:name "ab-angle->ABCF C"
:precision binary64
(+ (pow (* a (cos (* PI (/ angle 180.0)))) 2.0) (pow (* b (sin (* PI (/ angle 180.0)))) 2.0)))