
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 32 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\end{array}
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (hypot (sin ky) (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / hypot(sin(ky), sin(kx))) * sin(th);
}
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot \sin th
\end{array}
Initial program 96.2%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6499.7
Applied rewrites99.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (- 1.0 (cos (+ kx kx))))
(t_2 (pow (sin kx) 2.0))
(t_3 (pow (sin ky) 2.0))
(t_4 (/ (sin ky) (sqrt (+ t_2 t_3)))))
(if (<= t_4 -0.98)
(* (sin ky) (/ (sin th) (sqrt (fma -0.5 (cos (* ky -2.0)) 0.5))))
(if (<= t_4 -0.001)
(/ (* (sin ky) th) (sqrt (fma t_1 0.5 t_3)))
(if (<= t_4 0.05)
(* (sin th) (/ (sin ky) (sqrt (+ t_2 (* ky ky)))))
(if (<= t_4 0.99)
(*
(*
(sin ky)
(sqrt (/ 1.0 (fma t_1 0.5 (+ 0.5 (* -0.5 (cos (+ ky ky))))))))
(*
th
(fma
(* th th)
(fma
(* th th)
(fma -0.0001984126984126984 (* th th) 0.008333333333333333)
-0.16666666666666666)
1.0)))
(*
(sin th)
(/
(sin ky)
(hypot
(sin ky)
(fma kx (* -0.16666666666666666 (* kx kx)) kx))))))))))
double code(double kx, double ky, double th) {
double t_1 = 1.0 - cos((kx + kx));
double t_2 = pow(sin(kx), 2.0);
double t_3 = pow(sin(ky), 2.0);
double t_4 = sin(ky) / sqrt((t_2 + t_3));
double tmp;
if (t_4 <= -0.98) {
tmp = sin(ky) * (sin(th) / sqrt(fma(-0.5, cos((ky * -2.0)), 0.5)));
} else if (t_4 <= -0.001) {
tmp = (sin(ky) * th) / sqrt(fma(t_1, 0.5, t_3));
} else if (t_4 <= 0.05) {
tmp = sin(th) * (sin(ky) / sqrt((t_2 + (ky * ky))));
} else if (t_4 <= 0.99) {
tmp = (sin(ky) * sqrt((1.0 / fma(t_1, 0.5, (0.5 + (-0.5 * cos((ky + ky)))))))) * (th * fma((th * th), fma((th * th), fma(-0.0001984126984126984, (th * th), 0.008333333333333333), -0.16666666666666666), 1.0));
} else {
tmp = sin(th) * (sin(ky) / hypot(sin(ky), fma(kx, (-0.16666666666666666 * (kx * kx)), kx)));
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(1.0 - cos(Float64(kx + kx))) t_2 = sin(kx) ^ 2.0 t_3 = sin(ky) ^ 2.0 t_4 = Float64(sin(ky) / sqrt(Float64(t_2 + t_3))) tmp = 0.0 if (t_4 <= -0.98) tmp = Float64(sin(ky) * Float64(sin(th) / sqrt(fma(-0.5, cos(Float64(ky * -2.0)), 0.5)))); elseif (t_4 <= -0.001) tmp = Float64(Float64(sin(ky) * th) / sqrt(fma(t_1, 0.5, t_3))); elseif (t_4 <= 0.05) tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(Float64(t_2 + Float64(ky * ky))))); elseif (t_4 <= 0.99) tmp = Float64(Float64(sin(ky) * sqrt(Float64(1.0 / fma(t_1, 0.5, Float64(0.5 + Float64(-0.5 * cos(Float64(ky + ky)))))))) * Float64(th * fma(Float64(th * th), fma(Float64(th * th), fma(-0.0001984126984126984, Float64(th * th), 0.008333333333333333), -0.16666666666666666), 1.0))); else tmp = Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), fma(kx, Float64(-0.16666666666666666 * Float64(kx * kx)), kx)))); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(1.0 - N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$3 = N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$4 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$2 + t$95$3), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$4, -0.98], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, -0.001], N[(N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision] / N[Sqrt[N[(t$95$1 * 0.5 + t$95$3), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 0.05], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$2 + N[(ky * ky), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 0.99], N[(N[(N[Sin[ky], $MachinePrecision] * N[Sqrt[N[(1.0 / N[(t$95$1 * 0.5 + N[(0.5 + N[(-0.5 * N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(th * N[(N[(th * th), $MachinePrecision] * N[(N[(th * th), $MachinePrecision] * N[(-0.0001984126984126984 * N[(th * th), $MachinePrecision] + 0.008333333333333333), $MachinePrecision] + -0.16666666666666666), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[(kx * N[(-0.16666666666666666 * N[(kx * kx), $MachinePrecision]), $MachinePrecision] + kx), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 1 - \cos \left(kx + kx\right)\\
t_2 := {\sin kx}^{2}\\
t_3 := {\sin ky}^{2}\\
t_4 := \frac{\sin ky}{\sqrt{t\_2 + t\_3}}\\
\mathbf{if}\;t\_4 \leq -0.98:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sqrt{\mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), 0.5\right)}}\\
\mathbf{elif}\;t\_4 \leq -0.001:\\
\;\;\;\;\frac{\sin ky \cdot th}{\sqrt{\mathsf{fma}\left(t\_1, 0.5, t\_3\right)}}\\
\mathbf{elif}\;t\_4 \leq 0.05:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{t\_2 + ky \cdot ky}}\\
\mathbf{elif}\;t\_4 \leq 0.99:\\
\;\;\;\;\left(\sin ky \cdot \sqrt{\frac{1}{\mathsf{fma}\left(t\_1, 0.5, 0.5 + -0.5 \cdot \cos \left(ky + ky\right)\right)}}\right) \cdot \left(th \cdot \mathsf{fma}\left(th \cdot th, \mathsf{fma}\left(th \cdot th, \mathsf{fma}\left(-0.0001984126984126984, th \cdot th, 0.008333333333333333\right), -0.16666666666666666\right), 1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \mathsf{fma}\left(kx, -0.16666666666666666 \cdot \left(kx \cdot kx\right), kx\right)\right)}\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.97999999999999998Initial program 89.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6484.3
lift-+.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
Applied rewrites67.2%
Taylor expanded in kx around 0
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6463.2
Applied rewrites63.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6463.4
Applied rewrites63.4%
if -0.97999999999999998 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -1e-3Initial program 99.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6499.3
lift-+.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
Applied rewrites99.3%
lift-+.f64N/A
lift-*.f64N/A
metadata-evalN/A
cancel-sign-sub-invN/A
lift-cos.f64N/A
lift-+.f64N/A
count-2N/A
sqr-sin-aN/A
lift-sin.f64N/A
lift-sin.f64N/A
pow2N/A
lower-pow.f6499.3
Applied rewrites99.3%
Taylor expanded in th around 0
lower-*.f64N/A
lower-sin.f6445.9
Applied rewrites45.9%
if -1e-3 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.050000000000000003Initial program 99.5%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6497.7
Applied rewrites97.7%
if 0.050000000000000003 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.98999999999999999Initial program 99.4%
Applied rewrites99.3%
Taylor expanded in th around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6455.2
Applied rewrites55.2%
if 0.98999999999999999 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 95.4%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f64100.0
Applied rewrites100.0%
Taylor expanded in kx around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64100.0
Applied rewrites100.0%
Final simplification77.6%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1
(fma (- 1.0 (cos (+ kx kx))) 0.5 (+ 0.5 (* -0.5 (cos (+ ky ky))))))
(t_2 (pow (sin kx) 2.0))
(t_3 (/ (sin ky) (sqrt (+ t_2 (pow (sin ky) 2.0))))))
(if (<= t_3 -0.98)
(* (sin ky) (/ (sin th) (sqrt (fma -0.5 (cos (* ky -2.0)) 0.5))))
(if (<= t_3 -0.001)
(/ (* (sin ky) th) (sqrt t_1))
(if (<= t_3 0.05)
(* (sin th) (/ (sin ky) (sqrt (+ t_2 (* ky ky)))))
(if (<= t_3 0.99)
(*
(* (sin ky) (sqrt (/ 1.0 t_1)))
(*
th
(fma
(* th th)
(fma
(* th th)
(fma -0.0001984126984126984 (* th th) 0.008333333333333333)
-0.16666666666666666)
1.0)))
(*
(sin th)
(/
(sin ky)
(hypot
(sin ky)
(fma kx (* -0.16666666666666666 (* kx kx)) kx))))))))))
double code(double kx, double ky, double th) {
double t_1 = fma((1.0 - cos((kx + kx))), 0.5, (0.5 + (-0.5 * cos((ky + ky)))));
double t_2 = pow(sin(kx), 2.0);
double t_3 = sin(ky) / sqrt((t_2 + pow(sin(ky), 2.0)));
double tmp;
if (t_3 <= -0.98) {
tmp = sin(ky) * (sin(th) / sqrt(fma(-0.5, cos((ky * -2.0)), 0.5)));
} else if (t_3 <= -0.001) {
tmp = (sin(ky) * th) / sqrt(t_1);
} else if (t_3 <= 0.05) {
tmp = sin(th) * (sin(ky) / sqrt((t_2 + (ky * ky))));
} else if (t_3 <= 0.99) {
tmp = (sin(ky) * sqrt((1.0 / t_1))) * (th * fma((th * th), fma((th * th), fma(-0.0001984126984126984, (th * th), 0.008333333333333333), -0.16666666666666666), 1.0));
} else {
tmp = sin(th) * (sin(ky) / hypot(sin(ky), fma(kx, (-0.16666666666666666 * (kx * kx)), kx)));
}
return tmp;
}
function code(kx, ky, th) t_1 = fma(Float64(1.0 - cos(Float64(kx + kx))), 0.5, Float64(0.5 + Float64(-0.5 * cos(Float64(ky + ky))))) t_2 = sin(kx) ^ 2.0 t_3 = Float64(sin(ky) / sqrt(Float64(t_2 + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_3 <= -0.98) tmp = Float64(sin(ky) * Float64(sin(th) / sqrt(fma(-0.5, cos(Float64(ky * -2.0)), 0.5)))); elseif (t_3 <= -0.001) tmp = Float64(Float64(sin(ky) * th) / sqrt(t_1)); elseif (t_3 <= 0.05) tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(Float64(t_2 + Float64(ky * ky))))); elseif (t_3 <= 0.99) tmp = Float64(Float64(sin(ky) * sqrt(Float64(1.0 / t_1))) * Float64(th * fma(Float64(th * th), fma(Float64(th * th), fma(-0.0001984126984126984, Float64(th * th), 0.008333333333333333), -0.16666666666666666), 1.0))); else tmp = Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), fma(kx, Float64(-0.16666666666666666 * Float64(kx * kx)), kx)))); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[(1.0 - N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5 + N[(0.5 + N[(-0.5 * N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$3 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$2 + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, -0.98], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, -0.001], N[(N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision] / N[Sqrt[t$95$1], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 0.05], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$2 + N[(ky * ky), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 0.99], N[(N[(N[Sin[ky], $MachinePrecision] * N[Sqrt[N[(1.0 / t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(th * N[(N[(th * th), $MachinePrecision] * N[(N[(th * th), $MachinePrecision] * N[(-0.0001984126984126984 * N[(th * th), $MachinePrecision] + 0.008333333333333333), $MachinePrecision] + -0.16666666666666666), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[(kx * N[(-0.16666666666666666 * N[(kx * kx), $MachinePrecision]), $MachinePrecision] + kx), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(1 - \cos \left(kx + kx\right), 0.5, 0.5 + -0.5 \cdot \cos \left(ky + ky\right)\right)\\
t_2 := {\sin kx}^{2}\\
t_3 := \frac{\sin ky}{\sqrt{t\_2 + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_3 \leq -0.98:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sqrt{\mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), 0.5\right)}}\\
\mathbf{elif}\;t\_3 \leq -0.001:\\
\;\;\;\;\frac{\sin ky \cdot th}{\sqrt{t\_1}}\\
\mathbf{elif}\;t\_3 \leq 0.05:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{t\_2 + ky \cdot ky}}\\
\mathbf{elif}\;t\_3 \leq 0.99:\\
\;\;\;\;\left(\sin ky \cdot \sqrt{\frac{1}{t\_1}}\right) \cdot \left(th \cdot \mathsf{fma}\left(th \cdot th, \mathsf{fma}\left(th \cdot th, \mathsf{fma}\left(-0.0001984126984126984, th \cdot th, 0.008333333333333333\right), -0.16666666666666666\right), 1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \mathsf{fma}\left(kx, -0.16666666666666666 \cdot \left(kx \cdot kx\right), kx\right)\right)}\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.97999999999999998Initial program 89.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6484.3
lift-+.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
Applied rewrites67.2%
Taylor expanded in kx around 0
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6463.2
Applied rewrites63.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6463.4
Applied rewrites63.4%
if -0.97999999999999998 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -1e-3Initial program 99.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6499.3
lift-+.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
Applied rewrites99.3%
Taylor expanded in th around 0
lower-*.f64N/A
lower-sin.f6445.8
Applied rewrites45.8%
if -1e-3 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.050000000000000003Initial program 99.5%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6497.7
Applied rewrites97.7%
if 0.050000000000000003 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.98999999999999999Initial program 99.4%
Applied rewrites99.3%
Taylor expanded in th around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6455.2
Applied rewrites55.2%
if 0.98999999999999999 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 95.4%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f64100.0
Applied rewrites100.0%
Taylor expanded in kx around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64100.0
Applied rewrites100.0%
Final simplification77.6%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1
(fma (- 1.0 (cos (+ kx kx))) 0.5 (+ 0.5 (* -0.5 (cos (+ ky ky))))))
(t_2 (pow (sin kx) 2.0))
(t_3 (/ (sin ky) (sqrt (+ t_2 (pow (sin ky) 2.0))))))
(if (<= t_3 -0.98)
(* (sin ky) (/ (sin th) (sqrt (fma -0.5 (cos (* ky -2.0)) 0.5))))
(if (<= t_3 -0.001)
(/ (* (sin ky) th) (sqrt t_1))
(if (<= t_3 0.05)
(*
(sin th)
(/
(fma ky (* -0.16666666666666666 (* ky ky)) ky)
(sqrt (+ t_2 (* ky ky)))))
(if (<= t_3 0.99)
(*
(* (sin ky) (sqrt (/ 1.0 t_1)))
(*
th
(fma
(* th th)
(fma
(* th th)
(fma -0.0001984126984126984 (* th th) 0.008333333333333333)
-0.16666666666666666)
1.0)))
(*
(sin th)
(/
(sin ky)
(hypot
(sin ky)
(fma kx (* -0.16666666666666666 (* kx kx)) kx))))))))))
double code(double kx, double ky, double th) {
double t_1 = fma((1.0 - cos((kx + kx))), 0.5, (0.5 + (-0.5 * cos((ky + ky)))));
double t_2 = pow(sin(kx), 2.0);
double t_3 = sin(ky) / sqrt((t_2 + pow(sin(ky), 2.0)));
double tmp;
if (t_3 <= -0.98) {
tmp = sin(ky) * (sin(th) / sqrt(fma(-0.5, cos((ky * -2.0)), 0.5)));
} else if (t_3 <= -0.001) {
tmp = (sin(ky) * th) / sqrt(t_1);
} else if (t_3 <= 0.05) {
tmp = sin(th) * (fma(ky, (-0.16666666666666666 * (ky * ky)), ky) / sqrt((t_2 + (ky * ky))));
} else if (t_3 <= 0.99) {
tmp = (sin(ky) * sqrt((1.0 / t_1))) * (th * fma((th * th), fma((th * th), fma(-0.0001984126984126984, (th * th), 0.008333333333333333), -0.16666666666666666), 1.0));
} else {
tmp = sin(th) * (sin(ky) / hypot(sin(ky), fma(kx, (-0.16666666666666666 * (kx * kx)), kx)));
}
return tmp;
}
function code(kx, ky, th) t_1 = fma(Float64(1.0 - cos(Float64(kx + kx))), 0.5, Float64(0.5 + Float64(-0.5 * cos(Float64(ky + ky))))) t_2 = sin(kx) ^ 2.0 t_3 = Float64(sin(ky) / sqrt(Float64(t_2 + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_3 <= -0.98) tmp = Float64(sin(ky) * Float64(sin(th) / sqrt(fma(-0.5, cos(Float64(ky * -2.0)), 0.5)))); elseif (t_3 <= -0.001) tmp = Float64(Float64(sin(ky) * th) / sqrt(t_1)); elseif (t_3 <= 0.05) tmp = Float64(sin(th) * Float64(fma(ky, Float64(-0.16666666666666666 * Float64(ky * ky)), ky) / sqrt(Float64(t_2 + Float64(ky * ky))))); elseif (t_3 <= 0.99) tmp = Float64(Float64(sin(ky) * sqrt(Float64(1.0 / t_1))) * Float64(th * fma(Float64(th * th), fma(Float64(th * th), fma(-0.0001984126984126984, Float64(th * th), 0.008333333333333333), -0.16666666666666666), 1.0))); else tmp = Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), fma(kx, Float64(-0.16666666666666666 * Float64(kx * kx)), kx)))); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[(1.0 - N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5 + N[(0.5 + N[(-0.5 * N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$3 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$2 + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, -0.98], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, -0.001], N[(N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision] / N[Sqrt[t$95$1], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 0.05], N[(N[Sin[th], $MachinePrecision] * N[(N[(ky * N[(-0.16666666666666666 * N[(ky * ky), $MachinePrecision]), $MachinePrecision] + ky), $MachinePrecision] / N[Sqrt[N[(t$95$2 + N[(ky * ky), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 0.99], N[(N[(N[Sin[ky], $MachinePrecision] * N[Sqrt[N[(1.0 / t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(th * N[(N[(th * th), $MachinePrecision] * N[(N[(th * th), $MachinePrecision] * N[(-0.0001984126984126984 * N[(th * th), $MachinePrecision] + 0.008333333333333333), $MachinePrecision] + -0.16666666666666666), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[(kx * N[(-0.16666666666666666 * N[(kx * kx), $MachinePrecision]), $MachinePrecision] + kx), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(1 - \cos \left(kx + kx\right), 0.5, 0.5 + -0.5 \cdot \cos \left(ky + ky\right)\right)\\
t_2 := {\sin kx}^{2}\\
t_3 := \frac{\sin ky}{\sqrt{t\_2 + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_3 \leq -0.98:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sqrt{\mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), 0.5\right)}}\\
\mathbf{elif}\;t\_3 \leq -0.001:\\
\;\;\;\;\frac{\sin ky \cdot th}{\sqrt{t\_1}}\\
\mathbf{elif}\;t\_3 \leq 0.05:\\
\;\;\;\;\sin th \cdot \frac{\mathsf{fma}\left(ky, -0.16666666666666666 \cdot \left(ky \cdot ky\right), ky\right)}{\sqrt{t\_2 + ky \cdot ky}}\\
\mathbf{elif}\;t\_3 \leq 0.99:\\
\;\;\;\;\left(\sin ky \cdot \sqrt{\frac{1}{t\_1}}\right) \cdot \left(th \cdot \mathsf{fma}\left(th \cdot th, \mathsf{fma}\left(th \cdot th, \mathsf{fma}\left(-0.0001984126984126984, th \cdot th, 0.008333333333333333\right), -0.16666666666666666\right), 1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \mathsf{fma}\left(kx, -0.16666666666666666 \cdot \left(kx \cdot kx\right), kx\right)\right)}\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.97999999999999998Initial program 89.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6484.3
lift-+.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
Applied rewrites67.2%
Taylor expanded in kx around 0
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6463.2
Applied rewrites63.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6463.4
Applied rewrites63.4%
if -0.97999999999999998 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -1e-3Initial program 99.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6499.3
lift-+.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
Applied rewrites99.3%
Taylor expanded in th around 0
lower-*.f64N/A
lower-sin.f6445.8
Applied rewrites45.8%
if -1e-3 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.050000000000000003Initial program 99.5%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6497.7
Applied rewrites97.7%
Taylor expanded in ky around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6497.7
Applied rewrites97.7%
if 0.050000000000000003 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.98999999999999999Initial program 99.4%
Applied rewrites99.3%
Taylor expanded in th around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6455.2
Applied rewrites55.2%
if 0.98999999999999999 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 95.4%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f64100.0
Applied rewrites100.0%
Taylor expanded in kx around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64100.0
Applied rewrites100.0%
Final simplification77.5%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1
(fma (- 1.0 (cos (+ kx kx))) 0.5 (+ 0.5 (* -0.5 (cos (+ ky ky))))))
(t_2 (pow (sin kx) 2.0))
(t_3 (/ (sin ky) (sqrt (+ t_2 (pow (sin ky) 2.0))))))
(if (<= t_3 -0.98)
(* (sin ky) (/ (sin th) (sqrt (fma -0.5 (cos (* ky -2.0)) 0.5))))
(if (<= t_3 -0.001)
(/ (* (sin ky) th) (sqrt t_1))
(if (<= t_3 0.05)
(*
(sin th)
(/
(fma ky (* -0.16666666666666666 (* ky ky)) ky)
(sqrt (+ t_2 (* ky ky)))))
(if (<= t_3 0.93)
(*
(* (sin ky) (sqrt (/ 1.0 t_1)))
(*
th
(fma
(* th th)
(fma
(* th th)
(fma -0.0001984126984126984 (* th th) 0.008333333333333333)
-0.16666666666666666)
1.0)))
(sin th)))))))
double code(double kx, double ky, double th) {
double t_1 = fma((1.0 - cos((kx + kx))), 0.5, (0.5 + (-0.5 * cos((ky + ky)))));
double t_2 = pow(sin(kx), 2.0);
double t_3 = sin(ky) / sqrt((t_2 + pow(sin(ky), 2.0)));
double tmp;
if (t_3 <= -0.98) {
tmp = sin(ky) * (sin(th) / sqrt(fma(-0.5, cos((ky * -2.0)), 0.5)));
} else if (t_3 <= -0.001) {
tmp = (sin(ky) * th) / sqrt(t_1);
} else if (t_3 <= 0.05) {
tmp = sin(th) * (fma(ky, (-0.16666666666666666 * (ky * ky)), ky) / sqrt((t_2 + (ky * ky))));
} else if (t_3 <= 0.93) {
tmp = (sin(ky) * sqrt((1.0 / t_1))) * (th * fma((th * th), fma((th * th), fma(-0.0001984126984126984, (th * th), 0.008333333333333333), -0.16666666666666666), 1.0));
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = fma(Float64(1.0 - cos(Float64(kx + kx))), 0.5, Float64(0.5 + Float64(-0.5 * cos(Float64(ky + ky))))) t_2 = sin(kx) ^ 2.0 t_3 = Float64(sin(ky) / sqrt(Float64(t_2 + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_3 <= -0.98) tmp = Float64(sin(ky) * Float64(sin(th) / sqrt(fma(-0.5, cos(Float64(ky * -2.0)), 0.5)))); elseif (t_3 <= -0.001) tmp = Float64(Float64(sin(ky) * th) / sqrt(t_1)); elseif (t_3 <= 0.05) tmp = Float64(sin(th) * Float64(fma(ky, Float64(-0.16666666666666666 * Float64(ky * ky)), ky) / sqrt(Float64(t_2 + Float64(ky * ky))))); elseif (t_3 <= 0.93) tmp = Float64(Float64(sin(ky) * sqrt(Float64(1.0 / t_1))) * Float64(th * fma(Float64(th * th), fma(Float64(th * th), fma(-0.0001984126984126984, Float64(th * th), 0.008333333333333333), -0.16666666666666666), 1.0))); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[(1.0 - N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5 + N[(0.5 + N[(-0.5 * N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$3 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$2 + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, -0.98], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, -0.001], N[(N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision] / N[Sqrt[t$95$1], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 0.05], N[(N[Sin[th], $MachinePrecision] * N[(N[(ky * N[(-0.16666666666666666 * N[(ky * ky), $MachinePrecision]), $MachinePrecision] + ky), $MachinePrecision] / N[Sqrt[N[(t$95$2 + N[(ky * ky), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 0.93], N[(N[(N[Sin[ky], $MachinePrecision] * N[Sqrt[N[(1.0 / t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(th * N[(N[(th * th), $MachinePrecision] * N[(N[(th * th), $MachinePrecision] * N[(-0.0001984126984126984 * N[(th * th), $MachinePrecision] + 0.008333333333333333), $MachinePrecision] + -0.16666666666666666), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(1 - \cos \left(kx + kx\right), 0.5, 0.5 + -0.5 \cdot \cos \left(ky + ky\right)\right)\\
t_2 := {\sin kx}^{2}\\
t_3 := \frac{\sin ky}{\sqrt{t\_2 + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_3 \leq -0.98:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sqrt{\mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), 0.5\right)}}\\
\mathbf{elif}\;t\_3 \leq -0.001:\\
\;\;\;\;\frac{\sin ky \cdot th}{\sqrt{t\_1}}\\
\mathbf{elif}\;t\_3 \leq 0.05:\\
\;\;\;\;\sin th \cdot \frac{\mathsf{fma}\left(ky, -0.16666666666666666 \cdot \left(ky \cdot ky\right), ky\right)}{\sqrt{t\_2 + ky \cdot ky}}\\
\mathbf{elif}\;t\_3 \leq 0.93:\\
\;\;\;\;\left(\sin ky \cdot \sqrt{\frac{1}{t\_1}}\right) \cdot \left(th \cdot \mathsf{fma}\left(th \cdot th, \mathsf{fma}\left(th \cdot th, \mathsf{fma}\left(-0.0001984126984126984, th \cdot th, 0.008333333333333333\right), -0.16666666666666666\right), 1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.97999999999999998Initial program 89.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6484.3
lift-+.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
Applied rewrites67.2%
Taylor expanded in kx around 0
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6463.2
Applied rewrites63.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6463.4
Applied rewrites63.4%
if -0.97999999999999998 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -1e-3Initial program 99.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6499.3
lift-+.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
Applied rewrites99.3%
Taylor expanded in th around 0
lower-*.f64N/A
lower-sin.f6445.8
Applied rewrites45.8%
if -1e-3 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.050000000000000003Initial program 99.5%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6497.7
Applied rewrites97.7%
Taylor expanded in ky around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6497.7
Applied rewrites97.7%
if 0.050000000000000003 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.930000000000000049Initial program 99.4%
Applied rewrites99.3%
Taylor expanded in th around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6455.5
Applied rewrites55.5%
if 0.930000000000000049 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 95.6%
Taylor expanded in kx around 0
lower-sin.f6496.7
Applied rewrites96.7%
Final simplification77.3%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (- 1.0 (cos (+ kx kx))))
(t_2 (cos (+ ky ky)))
(t_3 (pow (sin kx) 2.0))
(t_4 (/ (sin ky) (sqrt (+ t_3 (pow (sin ky) 2.0))))))
(if (<= t_4 -0.98)
(* (sin ky) (/ (sin th) (sqrt (fma -0.5 (cos (* ky -2.0)) 0.5))))
(if (<= t_4 -0.001)
(/ (* (sin ky) th) (sqrt (fma t_1 0.5 (+ 0.5 (* -0.5 t_2)))))
(if (<= t_4 0.05)
(*
(sin th)
(/
(fma ky (* -0.16666666666666666 (* ky ky)) ky)
(sqrt (+ t_3 (* ky ky)))))
(if (<= t_4 0.93)
(*
(* (sin ky) (sqrt (/ 1.0 (fma t_1 0.5 (fma t_2 -0.5 0.5)))))
(fma
th
(*
(* th th)
(fma 0.008333333333333333 (* th th) -0.16666666666666666))
th))
(sin th)))))))
double code(double kx, double ky, double th) {
double t_1 = 1.0 - cos((kx + kx));
double t_2 = cos((ky + ky));
double t_3 = pow(sin(kx), 2.0);
double t_4 = sin(ky) / sqrt((t_3 + pow(sin(ky), 2.0)));
double tmp;
if (t_4 <= -0.98) {
tmp = sin(ky) * (sin(th) / sqrt(fma(-0.5, cos((ky * -2.0)), 0.5)));
} else if (t_4 <= -0.001) {
tmp = (sin(ky) * th) / sqrt(fma(t_1, 0.5, (0.5 + (-0.5 * t_2))));
} else if (t_4 <= 0.05) {
tmp = sin(th) * (fma(ky, (-0.16666666666666666 * (ky * ky)), ky) / sqrt((t_3 + (ky * ky))));
} else if (t_4 <= 0.93) {
tmp = (sin(ky) * sqrt((1.0 / fma(t_1, 0.5, fma(t_2, -0.5, 0.5))))) * fma(th, ((th * th) * fma(0.008333333333333333, (th * th), -0.16666666666666666)), th);
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(1.0 - cos(Float64(kx + kx))) t_2 = cos(Float64(ky + ky)) t_3 = sin(kx) ^ 2.0 t_4 = Float64(sin(ky) / sqrt(Float64(t_3 + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_4 <= -0.98) tmp = Float64(sin(ky) * Float64(sin(th) / sqrt(fma(-0.5, cos(Float64(ky * -2.0)), 0.5)))); elseif (t_4 <= -0.001) tmp = Float64(Float64(sin(ky) * th) / sqrt(fma(t_1, 0.5, Float64(0.5 + Float64(-0.5 * t_2))))); elseif (t_4 <= 0.05) tmp = Float64(sin(th) * Float64(fma(ky, Float64(-0.16666666666666666 * Float64(ky * ky)), ky) / sqrt(Float64(t_3 + Float64(ky * ky))))); elseif (t_4 <= 0.93) tmp = Float64(Float64(sin(ky) * sqrt(Float64(1.0 / fma(t_1, 0.5, fma(t_2, -0.5, 0.5))))) * fma(th, Float64(Float64(th * th) * fma(0.008333333333333333, Float64(th * th), -0.16666666666666666)), th)); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(1.0 - N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$4 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$3 + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$4, -0.98], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, -0.001], N[(N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision] / N[Sqrt[N[(t$95$1 * 0.5 + N[(0.5 + N[(-0.5 * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 0.05], N[(N[Sin[th], $MachinePrecision] * N[(N[(ky * N[(-0.16666666666666666 * N[(ky * ky), $MachinePrecision]), $MachinePrecision] + ky), $MachinePrecision] / N[Sqrt[N[(t$95$3 + N[(ky * ky), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 0.93], N[(N[(N[Sin[ky], $MachinePrecision] * N[Sqrt[N[(1.0 / N[(t$95$1 * 0.5 + N[(t$95$2 * -0.5 + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(th * N[(N[(th * th), $MachinePrecision] * N[(0.008333333333333333 * N[(th * th), $MachinePrecision] + -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + th), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 1 - \cos \left(kx + kx\right)\\
t_2 := \cos \left(ky + ky\right)\\
t_3 := {\sin kx}^{2}\\
t_4 := \frac{\sin ky}{\sqrt{t\_3 + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_4 \leq -0.98:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sqrt{\mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), 0.5\right)}}\\
\mathbf{elif}\;t\_4 \leq -0.001:\\
\;\;\;\;\frac{\sin ky \cdot th}{\sqrt{\mathsf{fma}\left(t\_1, 0.5, 0.5 + -0.5 \cdot t\_2\right)}}\\
\mathbf{elif}\;t\_4 \leq 0.05:\\
\;\;\;\;\sin th \cdot \frac{\mathsf{fma}\left(ky, -0.16666666666666666 \cdot \left(ky \cdot ky\right), ky\right)}{\sqrt{t\_3 + ky \cdot ky}}\\
\mathbf{elif}\;t\_4 \leq 0.93:\\
\;\;\;\;\left(\sin ky \cdot \sqrt{\frac{1}{\mathsf{fma}\left(t\_1, 0.5, \mathsf{fma}\left(t\_2, -0.5, 0.5\right)\right)}}\right) \cdot \mathsf{fma}\left(th, \left(th \cdot th\right) \cdot \mathsf{fma}\left(0.008333333333333333, th \cdot th, -0.16666666666666666\right), th\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.97999999999999998Initial program 89.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6484.3
lift-+.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
Applied rewrites67.2%
Taylor expanded in kx around 0
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6463.2
Applied rewrites63.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6463.4
Applied rewrites63.4%
if -0.97999999999999998 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -1e-3Initial program 99.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6499.3
lift-+.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
Applied rewrites99.3%
Taylor expanded in th around 0
lower-*.f64N/A
lower-sin.f6445.8
Applied rewrites45.8%
if -1e-3 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.050000000000000003Initial program 99.5%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6497.7
Applied rewrites97.7%
Taylor expanded in ky around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6497.7
Applied rewrites97.7%
if 0.050000000000000003 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.930000000000000049Initial program 99.4%
Applied rewrites99.3%
Taylor expanded in th around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6456.2
Applied rewrites56.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
flip-+N/A
+-inversesN/A
+-inversesN/A
lift-*.f64N/A
lift-*.f64N/A
+-inversesN/A
+-inversesN/A
flip-+N/A
lift-+.f64N/A
lower-fma.f6414.2
Applied rewrites56.2%
if 0.930000000000000049 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 95.6%
Taylor expanded in kx around 0
lower-sin.f6496.7
Applied rewrites96.7%
Final simplification77.4%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (pow (sin kx) 2.0))
(t_2 (* (sin ky) th))
(t_3 (/ (sin ky) (sqrt (+ t_1 (pow (sin ky) 2.0)))))
(t_4 (fma -0.5 (cos (* ky -2.0)) 0.5)))
(if (<= t_3 -0.98)
(* (sin ky) (/ (sin th) (sqrt t_4)))
(if (<= t_3 -0.001)
(/
t_2
(sqrt
(fma (- 1.0 (cos (+ kx kx))) 0.5 (+ 0.5 (* -0.5 (cos (+ ky ky)))))))
(if (<= t_3 0.05)
(*
(sin th)
(/
(fma ky (* -0.16666666666666666 (* ky ky)) ky)
(sqrt (+ t_1 (* ky ky)))))
(if (<= t_3 0.9999996186923419)
(* t_2 (sqrt (/ 1.0 (fma 0.5 (- 1.0 (cos (* kx -2.0))) t_4))))
(sin th)))))))
double code(double kx, double ky, double th) {
double t_1 = pow(sin(kx), 2.0);
double t_2 = sin(ky) * th;
double t_3 = sin(ky) / sqrt((t_1 + pow(sin(ky), 2.0)));
double t_4 = fma(-0.5, cos((ky * -2.0)), 0.5);
double tmp;
if (t_3 <= -0.98) {
tmp = sin(ky) * (sin(th) / sqrt(t_4));
} else if (t_3 <= -0.001) {
tmp = t_2 / sqrt(fma((1.0 - cos((kx + kx))), 0.5, (0.5 + (-0.5 * cos((ky + ky))))));
} else if (t_3 <= 0.05) {
tmp = sin(th) * (fma(ky, (-0.16666666666666666 * (ky * ky)), ky) / sqrt((t_1 + (ky * ky))));
} else if (t_3 <= 0.9999996186923419) {
tmp = t_2 * sqrt((1.0 / fma(0.5, (1.0 - cos((kx * -2.0))), t_4)));
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = sin(kx) ^ 2.0 t_2 = Float64(sin(ky) * th) t_3 = Float64(sin(ky) / sqrt(Float64(t_1 + (sin(ky) ^ 2.0)))) t_4 = fma(-0.5, cos(Float64(ky * -2.0)), 0.5) tmp = 0.0 if (t_3 <= -0.98) tmp = Float64(sin(ky) * Float64(sin(th) / sqrt(t_4))); elseif (t_3 <= -0.001) tmp = Float64(t_2 / sqrt(fma(Float64(1.0 - cos(Float64(kx + kx))), 0.5, Float64(0.5 + Float64(-0.5 * cos(Float64(ky + ky))))))); elseif (t_3 <= 0.05) tmp = Float64(sin(th) * Float64(fma(ky, Float64(-0.16666666666666666 * Float64(ky * ky)), ky) / sqrt(Float64(t_1 + Float64(ky * ky))))); elseif (t_3 <= 0.9999996186923419) tmp = Float64(t_2 * sqrt(Float64(1.0 / fma(0.5, Float64(1.0 - cos(Float64(kx * -2.0))), t_4)))); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision]}, Block[{t$95$3 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$1 + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]}, If[LessEqual[t$95$3, -0.98], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[t$95$4], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, -0.001], N[(t$95$2 / N[Sqrt[N[(N[(1.0 - N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5 + N[(0.5 + N[(-0.5 * N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 0.05], N[(N[Sin[th], $MachinePrecision] * N[(N[(ky * N[(-0.16666666666666666 * N[(ky * ky), $MachinePrecision]), $MachinePrecision] + ky), $MachinePrecision] / N[Sqrt[N[(t$95$1 + N[(ky * ky), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 0.9999996186923419], N[(t$95$2 * N[Sqrt[N[(1.0 / N[(0.5 * N[(1.0 - N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + t$95$4), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := {\sin kx}^{2}\\
t_2 := \sin ky \cdot th\\
t_3 := \frac{\sin ky}{\sqrt{t\_1 + {\sin ky}^{2}}}\\
t_4 := \mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), 0.5\right)\\
\mathbf{if}\;t\_3 \leq -0.98:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sqrt{t\_4}}\\
\mathbf{elif}\;t\_3 \leq -0.001:\\
\;\;\;\;\frac{t\_2}{\sqrt{\mathsf{fma}\left(1 - \cos \left(kx + kx\right), 0.5, 0.5 + -0.5 \cdot \cos \left(ky + ky\right)\right)}}\\
\mathbf{elif}\;t\_3 \leq 0.05:\\
\;\;\;\;\sin th \cdot \frac{\mathsf{fma}\left(ky, -0.16666666666666666 \cdot \left(ky \cdot ky\right), ky\right)}{\sqrt{t\_1 + ky \cdot ky}}\\
\mathbf{elif}\;t\_3 \leq 0.9999996186923419:\\
\;\;\;\;t\_2 \cdot \sqrt{\frac{1}{\mathsf{fma}\left(0.5, 1 - \cos \left(kx \cdot -2\right), t\_4\right)}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.97999999999999998Initial program 89.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6484.3
lift-+.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
Applied rewrites67.2%
Taylor expanded in kx around 0
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6463.2
Applied rewrites63.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6463.4
Applied rewrites63.4%
if -0.97999999999999998 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -1e-3Initial program 99.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6499.3
lift-+.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
Applied rewrites99.3%
Taylor expanded in th around 0
lower-*.f64N/A
lower-sin.f6445.8
Applied rewrites45.8%
if -1e-3 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.050000000000000003Initial program 99.5%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6497.7
Applied rewrites97.7%
Taylor expanded in ky around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6497.7
Applied rewrites97.7%
if 0.050000000000000003 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.99999961869234189Initial program 99.4%
Applied rewrites99.3%
Taylor expanded in th around 0
lower-*.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
lower-fma.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
Applied rewrites56.2%
if 0.99999961869234189 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 95.4%
Taylor expanded in kx around 0
lower-sin.f64100.0
Applied rewrites100.0%
Final simplification77.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (pow (sin kx) 2.0))
(t_2 (/ (sin ky) (sqrt (+ t_1 (pow (sin ky) 2.0)))))
(t_3
(/
(* (sin ky) th)
(sqrt
(fma
(- 1.0 (cos (+ kx kx)))
0.5
(+ 0.5 (* -0.5 (cos (+ ky ky)))))))))
(if (<= t_2 -0.98)
(* (sin ky) (/ (sin th) (sqrt (fma -0.5 (cos (* ky -2.0)) 0.5))))
(if (<= t_2 -0.001)
t_3
(if (<= t_2 0.05)
(*
(sin th)
(/
(fma ky (* -0.16666666666666666 (* ky ky)) ky)
(sqrt (+ t_1 (* ky ky)))))
(if (<= t_2 0.9999996186923419) t_3 (sin th)))))))
double code(double kx, double ky, double th) {
double t_1 = pow(sin(kx), 2.0);
double t_2 = sin(ky) / sqrt((t_1 + pow(sin(ky), 2.0)));
double t_3 = (sin(ky) * th) / sqrt(fma((1.0 - cos((kx + kx))), 0.5, (0.5 + (-0.5 * cos((ky + ky))))));
double tmp;
if (t_2 <= -0.98) {
tmp = sin(ky) * (sin(th) / sqrt(fma(-0.5, cos((ky * -2.0)), 0.5)));
} else if (t_2 <= -0.001) {
tmp = t_3;
} else if (t_2 <= 0.05) {
tmp = sin(th) * (fma(ky, (-0.16666666666666666 * (ky * ky)), ky) / sqrt((t_1 + (ky * ky))));
} else if (t_2 <= 0.9999996186923419) {
tmp = t_3;
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = sin(kx) ^ 2.0 t_2 = Float64(sin(ky) / sqrt(Float64(t_1 + (sin(ky) ^ 2.0)))) t_3 = Float64(Float64(sin(ky) * th) / sqrt(fma(Float64(1.0 - cos(Float64(kx + kx))), 0.5, Float64(0.5 + Float64(-0.5 * cos(Float64(ky + ky))))))) tmp = 0.0 if (t_2 <= -0.98) tmp = Float64(sin(ky) * Float64(sin(th) / sqrt(fma(-0.5, cos(Float64(ky * -2.0)), 0.5)))); elseif (t_2 <= -0.001) tmp = t_3; elseif (t_2 <= 0.05) tmp = Float64(sin(th) * Float64(fma(ky, Float64(-0.16666666666666666 * Float64(ky * ky)), ky) / sqrt(Float64(t_1 + Float64(ky * ky))))); elseif (t_2 <= 0.9999996186923419) tmp = t_3; else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$1 + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision] / N[Sqrt[N[(N[(1.0 - N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5 + N[(0.5 + N[(-0.5 * N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -0.98], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -0.001], t$95$3, If[LessEqual[t$95$2, 0.05], N[(N[Sin[th], $MachinePrecision] * N[(N[(ky * N[(-0.16666666666666666 * N[(ky * ky), $MachinePrecision]), $MachinePrecision] + ky), $MachinePrecision] / N[Sqrt[N[(t$95$1 + N[(ky * ky), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.9999996186923419], t$95$3, N[Sin[th], $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := {\sin kx}^{2}\\
t_2 := \frac{\sin ky}{\sqrt{t\_1 + {\sin ky}^{2}}}\\
t_3 := \frac{\sin ky \cdot th}{\sqrt{\mathsf{fma}\left(1 - \cos \left(kx + kx\right), 0.5, 0.5 + -0.5 \cdot \cos \left(ky + ky\right)\right)}}\\
\mathbf{if}\;t\_2 \leq -0.98:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sqrt{\mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), 0.5\right)}}\\
\mathbf{elif}\;t\_2 \leq -0.001:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 0.05:\\
\;\;\;\;\sin th \cdot \frac{\mathsf{fma}\left(ky, -0.16666666666666666 \cdot \left(ky \cdot ky\right), ky\right)}{\sqrt{t\_1 + ky \cdot ky}}\\
\mathbf{elif}\;t\_2 \leq 0.9999996186923419:\\
\;\;\;\;t\_3\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.97999999999999998Initial program 89.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6484.3
lift-+.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
Applied rewrites67.2%
Taylor expanded in kx around 0
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6463.2
Applied rewrites63.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6463.4
Applied rewrites63.4%
if -0.97999999999999998 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -1e-3 or 0.050000000000000003 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.99999961869234189Initial program 99.4%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6499.3
lift-+.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
Applied rewrites99.3%
Taylor expanded in th around 0
lower-*.f64N/A
lower-sin.f6450.8
Applied rewrites50.8%
if -1e-3 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.050000000000000003Initial program 99.5%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6497.7
Applied rewrites97.7%
Taylor expanded in ky around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6497.7
Applied rewrites97.7%
if 0.99999961869234189 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 95.4%
Taylor expanded in kx around 0
lower-sin.f64100.0
Applied rewrites100.0%
Final simplification77.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (- 1.0 (cos (+ kx kx))))
(t_2 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))))
(t_3
(/
(* (sin ky) th)
(sqrt (fma t_1 0.5 (+ 0.5 (* -0.5 (cos (+ ky ky)))))))))
(if (<= t_2 -0.98)
(* (sin ky) (/ (sin th) (sqrt (fma -0.5 (cos (* ky -2.0)) 0.5))))
(if (<= t_2 -0.001)
t_3
(if (<= t_2 0.05)
(*
(sin th)
(*
(sqrt
(/
1.0
(fma
t_1
0.5
(* (* ky ky) (fma (* ky ky) -0.3333333333333333 1.0)))))
(fma
ky
(*
(* ky ky)
(fma
(* ky ky)
(fma -0.0001984126984126984 (* ky ky) 0.008333333333333333)
-0.16666666666666666))
ky)))
(if (<= t_2 0.9999996186923419) t_3 (sin th)))))))
double code(double kx, double ky, double th) {
double t_1 = 1.0 - cos((kx + kx));
double t_2 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double t_3 = (sin(ky) * th) / sqrt(fma(t_1, 0.5, (0.5 + (-0.5 * cos((ky + ky))))));
double tmp;
if (t_2 <= -0.98) {
tmp = sin(ky) * (sin(th) / sqrt(fma(-0.5, cos((ky * -2.0)), 0.5)));
} else if (t_2 <= -0.001) {
tmp = t_3;
} else if (t_2 <= 0.05) {
tmp = sin(th) * (sqrt((1.0 / fma(t_1, 0.5, ((ky * ky) * fma((ky * ky), -0.3333333333333333, 1.0))))) * fma(ky, ((ky * ky) * fma((ky * ky), fma(-0.0001984126984126984, (ky * ky), 0.008333333333333333), -0.16666666666666666)), ky));
} else if (t_2 <= 0.9999996186923419) {
tmp = t_3;
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(1.0 - cos(Float64(kx + kx))) t_2 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) t_3 = Float64(Float64(sin(ky) * th) / sqrt(fma(t_1, 0.5, Float64(0.5 + Float64(-0.5 * cos(Float64(ky + ky))))))) tmp = 0.0 if (t_2 <= -0.98) tmp = Float64(sin(ky) * Float64(sin(th) / sqrt(fma(-0.5, cos(Float64(ky * -2.0)), 0.5)))); elseif (t_2 <= -0.001) tmp = t_3; elseif (t_2 <= 0.05) tmp = Float64(sin(th) * Float64(sqrt(Float64(1.0 / fma(t_1, 0.5, Float64(Float64(ky * ky) * fma(Float64(ky * ky), -0.3333333333333333, 1.0))))) * fma(ky, Float64(Float64(ky * ky) * fma(Float64(ky * ky), fma(-0.0001984126984126984, Float64(ky * ky), 0.008333333333333333), -0.16666666666666666)), ky))); elseif (t_2 <= 0.9999996186923419) tmp = t_3; else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(1.0 - N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision] / N[Sqrt[N[(t$95$1 * 0.5 + N[(0.5 + N[(-0.5 * N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -0.98], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -0.001], t$95$3, If[LessEqual[t$95$2, 0.05], N[(N[Sin[th], $MachinePrecision] * N[(N[Sqrt[N[(1.0 / N[(t$95$1 * 0.5 + N[(N[(ky * ky), $MachinePrecision] * N[(N[(ky * ky), $MachinePrecision] * -0.3333333333333333 + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(ky * N[(N[(ky * ky), $MachinePrecision] * N[(N[(ky * ky), $MachinePrecision] * N[(-0.0001984126984126984 * N[(ky * ky), $MachinePrecision] + 0.008333333333333333), $MachinePrecision] + -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.9999996186923419], t$95$3, N[Sin[th], $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 1 - \cos \left(kx + kx\right)\\
t_2 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
t_3 := \frac{\sin ky \cdot th}{\sqrt{\mathsf{fma}\left(t\_1, 0.5, 0.5 + -0.5 \cdot \cos \left(ky + ky\right)\right)}}\\
\mathbf{if}\;t\_2 \leq -0.98:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sqrt{\mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), 0.5\right)}}\\
\mathbf{elif}\;t\_2 \leq -0.001:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 0.05:\\
\;\;\;\;\sin th \cdot \left(\sqrt{\frac{1}{\mathsf{fma}\left(t\_1, 0.5, \left(ky \cdot ky\right) \cdot \mathsf{fma}\left(ky \cdot ky, -0.3333333333333333, 1\right)\right)}} \cdot \mathsf{fma}\left(ky, \left(ky \cdot ky\right) \cdot \mathsf{fma}\left(ky \cdot ky, \mathsf{fma}\left(-0.0001984126984126984, ky \cdot ky, 0.008333333333333333\right), -0.16666666666666666\right), ky\right)\right)\\
\mathbf{elif}\;t\_2 \leq 0.9999996186923419:\\
\;\;\;\;t\_3\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.97999999999999998Initial program 89.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6484.3
lift-+.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
Applied rewrites67.2%
Taylor expanded in kx around 0
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6463.2
Applied rewrites63.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6463.4
Applied rewrites63.4%
if -0.97999999999999998 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -1e-3 or 0.050000000000000003 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.99999961869234189Initial program 99.4%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6499.3
lift-+.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
Applied rewrites99.3%
Taylor expanded in th around 0
lower-*.f64N/A
lower-sin.f6450.8
Applied rewrites50.8%
if -1e-3 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.050000000000000003Initial program 99.5%
Applied rewrites76.8%
Taylor expanded in ky around 0
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6476.0
Applied rewrites76.0%
Taylor expanded in ky around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6476.0
Applied rewrites76.0%
if 0.99999961869234189 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 95.4%
Taylor expanded in kx around 0
lower-sin.f64100.0
Applied rewrites100.0%
Final simplification70.5%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
(if (<= t_1 -0.708)
(* (sin ky) (/ (sin th) (sqrt (fma -0.5 (cos (* ky -2.0)) 0.5))))
(if (<= t_1 0.71)
(/ (* (sin ky) (sin th)) (sqrt (* 0.5 (- 1.0 (cos (* kx -2.0))))))
(sin th)))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double tmp;
if (t_1 <= -0.708) {
tmp = sin(ky) * (sin(th) / sqrt(fma(-0.5, cos((ky * -2.0)), 0.5)));
} else if (t_1 <= 0.71) {
tmp = (sin(ky) * sin(th)) / sqrt((0.5 * (1.0 - cos((kx * -2.0)))));
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_1 <= -0.708) tmp = Float64(sin(ky) * Float64(sin(th) / sqrt(fma(-0.5, cos(Float64(ky * -2.0)), 0.5)))); elseif (t_1 <= 0.71) tmp = Float64(Float64(sin(ky) * sin(th)) / sqrt(Float64(0.5 * Float64(1.0 - cos(Float64(kx * -2.0)))))); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -0.708], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.71], N[(N[(N[Sin[ky], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(0.5 * N[(1.0 - N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_1 \leq -0.708:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sqrt{\mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), 0.5\right)}}\\
\mathbf{elif}\;t\_1 \leq 0.71:\\
\;\;\;\;\frac{\sin ky \cdot \sin th}{\sqrt{0.5 \cdot \left(1 - \cos \left(kx \cdot -2\right)\right)}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.70799999999999996Initial program 90.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6487.0
lift-+.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
Applied rewrites73.2%
Taylor expanded in kx around 0
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6455.7
Applied rewrites55.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6455.9
Applied rewrites55.9%
if -0.70799999999999996 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.70999999999999996Initial program 99.4%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6497.5
lift-+.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
Applied rewrites83.9%
Taylor expanded in ky around 0
lower-*.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6458.5
Applied rewrites58.5%
if 0.70999999999999996 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 96.4%
Taylor expanded in kx around 0
lower-sin.f6482.0
Applied rewrites82.0%
Final simplification62.9%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
(if (<= t_1 -0.708)
(* (sin ky) (/ (sin th) (sqrt (fma -0.5 (cos (* ky -2.0)) 0.5))))
(if (<= t_1 0.71)
(* (sin th) (* (sin ky) (sqrt (/ 2.0 (- 1.0 (cos (* kx -2.0)))))))
(sin th)))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double tmp;
if (t_1 <= -0.708) {
tmp = sin(ky) * (sin(th) / sqrt(fma(-0.5, cos((ky * -2.0)), 0.5)));
} else if (t_1 <= 0.71) {
tmp = sin(th) * (sin(ky) * sqrt((2.0 / (1.0 - cos((kx * -2.0))))));
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_1 <= -0.708) tmp = Float64(sin(ky) * Float64(sin(th) / sqrt(fma(-0.5, cos(Float64(ky * -2.0)), 0.5)))); elseif (t_1 <= 0.71) tmp = Float64(sin(th) * Float64(sin(ky) * sqrt(Float64(2.0 / Float64(1.0 - cos(Float64(kx * -2.0))))))); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -0.708], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.71], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] * N[Sqrt[N[(2.0 / N[(1.0 - N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_1 \leq -0.708:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sqrt{\mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), 0.5\right)}}\\
\mathbf{elif}\;t\_1 \leq 0.71:\\
\;\;\;\;\sin th \cdot \left(\sin ky \cdot \sqrt{\frac{2}{1 - \cos \left(kx \cdot -2\right)}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.70799999999999996Initial program 90.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6487.0
lift-+.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
Applied rewrites73.2%
Taylor expanded in kx around 0
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6455.7
Applied rewrites55.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6455.9
Applied rewrites55.9%
if -0.70799999999999996 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.70999999999999996Initial program 99.4%
Applied rewrites83.8%
Taylor expanded in ky around 0
lower-/.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6458.5
Applied rewrites58.5%
if 0.70999999999999996 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 96.4%
Taylor expanded in kx around 0
lower-sin.f6482.0
Applied rewrites82.0%
Final simplification62.9%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
(if (<= t_1 -0.001)
(* (sin ky) (/ (sin th) (sqrt (fma -0.5 (cos (* ky -2.0)) 0.5))))
(if (<= t_1 0.16)
(*
(sin th)
(*
(sqrt
(/
1.0
(fma
(- 1.0 (cos (+ kx kx)))
0.5
(* (* ky ky) (fma (* ky ky) -0.3333333333333333 1.0)))))
(fma
ky
(*
(* ky ky)
(fma
(* ky ky)
(fma -0.0001984126984126984 (* ky ky) 0.008333333333333333)
-0.16666666666666666))
ky)))
(sin th)))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double tmp;
if (t_1 <= -0.001) {
tmp = sin(ky) * (sin(th) / sqrt(fma(-0.5, cos((ky * -2.0)), 0.5)));
} else if (t_1 <= 0.16) {
tmp = sin(th) * (sqrt((1.0 / fma((1.0 - cos((kx + kx))), 0.5, ((ky * ky) * fma((ky * ky), -0.3333333333333333, 1.0))))) * fma(ky, ((ky * ky) * fma((ky * ky), fma(-0.0001984126984126984, (ky * ky), 0.008333333333333333), -0.16666666666666666)), ky));
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_1 <= -0.001) tmp = Float64(sin(ky) * Float64(sin(th) / sqrt(fma(-0.5, cos(Float64(ky * -2.0)), 0.5)))); elseif (t_1 <= 0.16) tmp = Float64(sin(th) * Float64(sqrt(Float64(1.0 / fma(Float64(1.0 - cos(Float64(kx + kx))), 0.5, Float64(Float64(ky * ky) * fma(Float64(ky * ky), -0.3333333333333333, 1.0))))) * fma(ky, Float64(Float64(ky * ky) * fma(Float64(ky * ky), fma(-0.0001984126984126984, Float64(ky * ky), 0.008333333333333333), -0.16666666666666666)), ky))); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -0.001], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.16], N[(N[Sin[th], $MachinePrecision] * N[(N[Sqrt[N[(1.0 / N[(N[(1.0 - N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5 + N[(N[(ky * ky), $MachinePrecision] * N[(N[(ky * ky), $MachinePrecision] * -0.3333333333333333 + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(ky * N[(N[(ky * ky), $MachinePrecision] * N[(N[(ky * ky), $MachinePrecision] * N[(-0.0001984126984126984 * N[(ky * ky), $MachinePrecision] + 0.008333333333333333), $MachinePrecision] + -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_1 \leq -0.001:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sqrt{\mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), 0.5\right)}}\\
\mathbf{elif}\;t\_1 \leq 0.16:\\
\;\;\;\;\sin th \cdot \left(\sqrt{\frac{1}{\mathsf{fma}\left(1 - \cos \left(kx + kx\right), 0.5, \left(ky \cdot ky\right) \cdot \mathsf{fma}\left(ky \cdot ky, -0.3333333333333333, 1\right)\right)}} \cdot \mathsf{fma}\left(ky, \left(ky \cdot ky\right) \cdot \mathsf{fma}\left(ky \cdot ky, \mathsf{fma}\left(-0.0001984126984126984, ky \cdot ky, 0.008333333333333333\right), -0.16666666666666666\right), ky\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -1e-3Initial program 92.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6489.7
lift-+.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
Applied rewrites78.8%
Taylor expanded in kx around 0
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6447.6
Applied rewrites47.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6447.7
Applied rewrites47.7%
if -1e-3 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.160000000000000003Initial program 99.5%
Applied rewrites77.3%
Taylor expanded in ky around 0
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6474.4
Applied rewrites74.4%
Taylor expanded in ky around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6474.2
Applied rewrites74.2%
if 0.160000000000000003 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 97.0%
Taylor expanded in kx around 0
lower-sin.f6468.0
Applied rewrites68.0%
Final simplification62.4%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
(if (<= t_1 -0.001)
(* (sin th) (/ (sin ky) (sqrt (fma -0.5 (cos (* ky -2.0)) 0.5))))
(if (<= t_1 0.16)
(*
(sin th)
(*
(sqrt
(/
1.0
(fma
(- 1.0 (cos (+ kx kx)))
0.5
(* (* ky ky) (fma (* ky ky) -0.3333333333333333 1.0)))))
(fma
ky
(*
(* ky ky)
(fma
(* ky ky)
(fma -0.0001984126984126984 (* ky ky) 0.008333333333333333)
-0.16666666666666666))
ky)))
(sin th)))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double tmp;
if (t_1 <= -0.001) {
tmp = sin(th) * (sin(ky) / sqrt(fma(-0.5, cos((ky * -2.0)), 0.5)));
} else if (t_1 <= 0.16) {
tmp = sin(th) * (sqrt((1.0 / fma((1.0 - cos((kx + kx))), 0.5, ((ky * ky) * fma((ky * ky), -0.3333333333333333, 1.0))))) * fma(ky, ((ky * ky) * fma((ky * ky), fma(-0.0001984126984126984, (ky * ky), 0.008333333333333333), -0.16666666666666666)), ky));
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_1 <= -0.001) tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(fma(-0.5, cos(Float64(ky * -2.0)), 0.5)))); elseif (t_1 <= 0.16) tmp = Float64(sin(th) * Float64(sqrt(Float64(1.0 / fma(Float64(1.0 - cos(Float64(kx + kx))), 0.5, Float64(Float64(ky * ky) * fma(Float64(ky * ky), -0.3333333333333333, 1.0))))) * fma(ky, Float64(Float64(ky * ky) * fma(Float64(ky * ky), fma(-0.0001984126984126984, Float64(ky * ky), 0.008333333333333333), -0.16666666666666666)), ky))); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -0.001], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.16], N[(N[Sin[th], $MachinePrecision] * N[(N[Sqrt[N[(1.0 / N[(N[(1.0 - N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5 + N[(N[(ky * ky), $MachinePrecision] * N[(N[(ky * ky), $MachinePrecision] * -0.3333333333333333 + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(ky * N[(N[(ky * ky), $MachinePrecision] * N[(N[(ky * ky), $MachinePrecision] * N[(-0.0001984126984126984 * N[(ky * ky), $MachinePrecision] + 0.008333333333333333), $MachinePrecision] + -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_1 \leq -0.001:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{\mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), 0.5\right)}}\\
\mathbf{elif}\;t\_1 \leq 0.16:\\
\;\;\;\;\sin th \cdot \left(\sqrt{\frac{1}{\mathsf{fma}\left(1 - \cos \left(kx + kx\right), 0.5, \left(ky \cdot ky\right) \cdot \mathsf{fma}\left(ky \cdot ky, -0.3333333333333333, 1\right)\right)}} \cdot \mathsf{fma}\left(ky, \left(ky \cdot ky\right) \cdot \mathsf{fma}\left(ky \cdot ky, \mathsf{fma}\left(-0.0001984126984126984, ky \cdot ky, 0.008333333333333333\right), -0.16666666666666666\right), ky\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -1e-3Initial program 92.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6489.7
lift-+.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
Applied rewrites78.8%
Taylor expanded in kx around 0
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6447.6
Applied rewrites47.6%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6447.7
Applied rewrites47.7%
if -1e-3 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.160000000000000003Initial program 99.5%
Applied rewrites77.3%
Taylor expanded in ky around 0
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6474.4
Applied rewrites74.4%
Taylor expanded in ky around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6474.2
Applied rewrites74.2%
if 0.160000000000000003 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 97.0%
Taylor expanded in kx around 0
lower-sin.f6468.0
Applied rewrites68.0%
Final simplification62.4%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
(if (<= t_1 -0.001)
(/ (* (sin ky) th) (sqrt (fma -0.5 (cos (* ky -2.0)) 0.5)))
(if (<= t_1 0.16)
(*
(sin th)
(*
(sqrt
(/
1.0
(fma
(- 1.0 (cos (+ kx kx)))
0.5
(* (* ky ky) (fma (* ky ky) -0.3333333333333333 1.0)))))
(fma
ky
(*
(* ky ky)
(fma
(* ky ky)
(fma -0.0001984126984126984 (* ky ky) 0.008333333333333333)
-0.16666666666666666))
ky)))
(sin th)))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double tmp;
if (t_1 <= -0.001) {
tmp = (sin(ky) * th) / sqrt(fma(-0.5, cos((ky * -2.0)), 0.5));
} else if (t_1 <= 0.16) {
tmp = sin(th) * (sqrt((1.0 / fma((1.0 - cos((kx + kx))), 0.5, ((ky * ky) * fma((ky * ky), -0.3333333333333333, 1.0))))) * fma(ky, ((ky * ky) * fma((ky * ky), fma(-0.0001984126984126984, (ky * ky), 0.008333333333333333), -0.16666666666666666)), ky));
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_1 <= -0.001) tmp = Float64(Float64(sin(ky) * th) / sqrt(fma(-0.5, cos(Float64(ky * -2.0)), 0.5))); elseif (t_1 <= 0.16) tmp = Float64(sin(th) * Float64(sqrt(Float64(1.0 / fma(Float64(1.0 - cos(Float64(kx + kx))), 0.5, Float64(Float64(ky * ky) * fma(Float64(ky * ky), -0.3333333333333333, 1.0))))) * fma(ky, Float64(Float64(ky * ky) * fma(Float64(ky * ky), fma(-0.0001984126984126984, Float64(ky * ky), 0.008333333333333333), -0.16666666666666666)), ky))); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -0.001], N[(N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision] / N[Sqrt[N[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.16], N[(N[Sin[th], $MachinePrecision] * N[(N[Sqrt[N[(1.0 / N[(N[(1.0 - N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5 + N[(N[(ky * ky), $MachinePrecision] * N[(N[(ky * ky), $MachinePrecision] * -0.3333333333333333 + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(ky * N[(N[(ky * ky), $MachinePrecision] * N[(N[(ky * ky), $MachinePrecision] * N[(-0.0001984126984126984 * N[(ky * ky), $MachinePrecision] + 0.008333333333333333), $MachinePrecision] + -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_1 \leq -0.001:\\
\;\;\;\;\frac{\sin ky \cdot th}{\sqrt{\mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), 0.5\right)}}\\
\mathbf{elif}\;t\_1 \leq 0.16:\\
\;\;\;\;\sin th \cdot \left(\sqrt{\frac{1}{\mathsf{fma}\left(1 - \cos \left(kx + kx\right), 0.5, \left(ky \cdot ky\right) \cdot \mathsf{fma}\left(ky \cdot ky, -0.3333333333333333, 1\right)\right)}} \cdot \mathsf{fma}\left(ky, \left(ky \cdot ky\right) \cdot \mathsf{fma}\left(ky \cdot ky, \mathsf{fma}\left(-0.0001984126984126984, ky \cdot ky, 0.008333333333333333\right), -0.16666666666666666\right), ky\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -1e-3Initial program 92.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6489.7
lift-+.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
Applied rewrites78.8%
Taylor expanded in kx around 0
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6447.6
Applied rewrites47.6%
Taylor expanded in th around 0
lower-*.f64N/A
lower-sin.f6426.7
Applied rewrites26.7%
if -1e-3 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.160000000000000003Initial program 99.5%
Applied rewrites77.3%
Taylor expanded in ky around 0
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6474.4
Applied rewrites74.4%
Taylor expanded in ky around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6474.2
Applied rewrites74.2%
if 0.160000000000000003 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 97.0%
Taylor expanded in kx around 0
lower-sin.f6468.0
Applied rewrites68.0%
Final simplification54.5%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
(if (<= t_1 -0.001)
(/ (* (sin ky) th) (sqrt (fma -0.5 (cos (* ky -2.0)) 0.5)))
(if (<= t_1 0.16)
(*
(sin th)
(*
(sqrt
(/
1.0
(fma
(- 1.0 (cos (+ kx kx)))
0.5
(* (* ky ky) (fma (* ky ky) -0.3333333333333333 1.0)))))
(*
ky
(fma
(* ky ky)
(fma 0.008333333333333333 (* ky ky) -0.16666666666666666)
1.0))))
(sin th)))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double tmp;
if (t_1 <= -0.001) {
tmp = (sin(ky) * th) / sqrt(fma(-0.5, cos((ky * -2.0)), 0.5));
} else if (t_1 <= 0.16) {
tmp = sin(th) * (sqrt((1.0 / fma((1.0 - cos((kx + kx))), 0.5, ((ky * ky) * fma((ky * ky), -0.3333333333333333, 1.0))))) * (ky * fma((ky * ky), fma(0.008333333333333333, (ky * ky), -0.16666666666666666), 1.0)));
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_1 <= -0.001) tmp = Float64(Float64(sin(ky) * th) / sqrt(fma(-0.5, cos(Float64(ky * -2.0)), 0.5))); elseif (t_1 <= 0.16) tmp = Float64(sin(th) * Float64(sqrt(Float64(1.0 / fma(Float64(1.0 - cos(Float64(kx + kx))), 0.5, Float64(Float64(ky * ky) * fma(Float64(ky * ky), -0.3333333333333333, 1.0))))) * Float64(ky * fma(Float64(ky * ky), fma(0.008333333333333333, Float64(ky * ky), -0.16666666666666666), 1.0)))); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -0.001], N[(N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision] / N[Sqrt[N[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.16], N[(N[Sin[th], $MachinePrecision] * N[(N[Sqrt[N[(1.0 / N[(N[(1.0 - N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5 + N[(N[(ky * ky), $MachinePrecision] * N[(N[(ky * ky), $MachinePrecision] * -0.3333333333333333 + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(ky * N[(N[(ky * ky), $MachinePrecision] * N[(0.008333333333333333 * N[(ky * ky), $MachinePrecision] + -0.16666666666666666), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_1 \leq -0.001:\\
\;\;\;\;\frac{\sin ky \cdot th}{\sqrt{\mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), 0.5\right)}}\\
\mathbf{elif}\;t\_1 \leq 0.16:\\
\;\;\;\;\sin th \cdot \left(\sqrt{\frac{1}{\mathsf{fma}\left(1 - \cos \left(kx + kx\right), 0.5, \left(ky \cdot ky\right) \cdot \mathsf{fma}\left(ky \cdot ky, -0.3333333333333333, 1\right)\right)}} \cdot \left(ky \cdot \mathsf{fma}\left(ky \cdot ky, \mathsf{fma}\left(0.008333333333333333, ky \cdot ky, -0.16666666666666666\right), 1\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -1e-3Initial program 92.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6489.7
lift-+.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
Applied rewrites78.8%
Taylor expanded in kx around 0
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6447.6
Applied rewrites47.6%
Taylor expanded in th around 0
lower-*.f64N/A
lower-sin.f6426.7
Applied rewrites26.7%
if -1e-3 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.160000000000000003Initial program 99.5%
Applied rewrites77.3%
Taylor expanded in ky around 0
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6474.4
Applied rewrites74.4%
Taylor expanded in ky around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6474.2
Applied rewrites74.2%
if 0.160000000000000003 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 97.0%
Taylor expanded in kx around 0
lower-sin.f6468.0
Applied rewrites68.0%
Final simplification54.5%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
(if (<= t_1 -0.001)
(/ (* (sin ky) th) (sqrt (fma -0.5 (cos (* ky -2.0)) 0.5)))
(if (<= t_1 0.05)
(*
(sin th)
(*
(sqrt
(/
1.0
(fma
(- 1.0 (cos (+ kx kx)))
0.5
(* (* ky ky) (fma (* ky ky) -0.3333333333333333 1.0)))))
(fma ky (* -0.16666666666666666 (* ky ky)) ky)))
(sin th)))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double tmp;
if (t_1 <= -0.001) {
tmp = (sin(ky) * th) / sqrt(fma(-0.5, cos((ky * -2.0)), 0.5));
} else if (t_1 <= 0.05) {
tmp = sin(th) * (sqrt((1.0 / fma((1.0 - cos((kx + kx))), 0.5, ((ky * ky) * fma((ky * ky), -0.3333333333333333, 1.0))))) * fma(ky, (-0.16666666666666666 * (ky * ky)), ky));
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_1 <= -0.001) tmp = Float64(Float64(sin(ky) * th) / sqrt(fma(-0.5, cos(Float64(ky * -2.0)), 0.5))); elseif (t_1 <= 0.05) tmp = Float64(sin(th) * Float64(sqrt(Float64(1.0 / fma(Float64(1.0 - cos(Float64(kx + kx))), 0.5, Float64(Float64(ky * ky) * fma(Float64(ky * ky), -0.3333333333333333, 1.0))))) * fma(ky, Float64(-0.16666666666666666 * Float64(ky * ky)), ky))); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -0.001], N[(N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision] / N[Sqrt[N[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.05], N[(N[Sin[th], $MachinePrecision] * N[(N[Sqrt[N[(1.0 / N[(N[(1.0 - N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5 + N[(N[(ky * ky), $MachinePrecision] * N[(N[(ky * ky), $MachinePrecision] * -0.3333333333333333 + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(ky * N[(-0.16666666666666666 * N[(ky * ky), $MachinePrecision]), $MachinePrecision] + ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_1 \leq -0.001:\\
\;\;\;\;\frac{\sin ky \cdot th}{\sqrt{\mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), 0.5\right)}}\\
\mathbf{elif}\;t\_1 \leq 0.05:\\
\;\;\;\;\sin th \cdot \left(\sqrt{\frac{1}{\mathsf{fma}\left(1 - \cos \left(kx + kx\right), 0.5, \left(ky \cdot ky\right) \cdot \mathsf{fma}\left(ky \cdot ky, -0.3333333333333333, 1\right)\right)}} \cdot \mathsf{fma}\left(ky, -0.16666666666666666 \cdot \left(ky \cdot ky\right), ky\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -1e-3Initial program 92.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6489.7
lift-+.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
Applied rewrites78.8%
Taylor expanded in kx around 0
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6447.6
Applied rewrites47.6%
Taylor expanded in th around 0
lower-*.f64N/A
lower-sin.f6426.7
Applied rewrites26.7%
if -1e-3 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.050000000000000003Initial program 99.5%
Applied rewrites76.8%
Taylor expanded in ky around 0
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6476.0
Applied rewrites76.0%
Taylor expanded in ky around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6475.7
Applied rewrites75.7%
if 0.050000000000000003 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 97.1%
Taylor expanded in kx around 0
lower-sin.f6466.6
Applied rewrites66.6%
Final simplification54.5%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
(if (<= t_1 -0.001)
(/ (* (sin ky) th) (sqrt (fma -0.5 (cos (* ky -2.0)) 0.5)))
(if (<= t_1 0.05)
(*
(sin th)
(* (sqrt (/ 1.0 (- 1.0 (cos (* kx -2.0))))) (* ky (sqrt 2.0))))
(sin th)))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double tmp;
if (t_1 <= -0.001) {
tmp = (sin(ky) * th) / sqrt(fma(-0.5, cos((ky * -2.0)), 0.5));
} else if (t_1 <= 0.05) {
tmp = sin(th) * (sqrt((1.0 / (1.0 - cos((kx * -2.0))))) * (ky * sqrt(2.0)));
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_1 <= -0.001) tmp = Float64(Float64(sin(ky) * th) / sqrt(fma(-0.5, cos(Float64(ky * -2.0)), 0.5))); elseif (t_1 <= 0.05) tmp = Float64(sin(th) * Float64(sqrt(Float64(1.0 / Float64(1.0 - cos(Float64(kx * -2.0))))) * Float64(ky * sqrt(2.0)))); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -0.001], N[(N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision] / N[Sqrt[N[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.05], N[(N[Sin[th], $MachinePrecision] * N[(N[Sqrt[N[(1.0 / N[(1.0 - N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(ky * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_1 \leq -0.001:\\
\;\;\;\;\frac{\sin ky \cdot th}{\sqrt{\mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), 0.5\right)}}\\
\mathbf{elif}\;t\_1 \leq 0.05:\\
\;\;\;\;\sin th \cdot \left(\sqrt{\frac{1}{1 - \cos \left(kx \cdot -2\right)}} \cdot \left(ky \cdot \sqrt{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -1e-3Initial program 92.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6489.7
lift-+.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
Applied rewrites78.8%
Taylor expanded in kx around 0
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6447.6
Applied rewrites47.6%
Taylor expanded in th around 0
lower-*.f64N/A
lower-sin.f6426.7
Applied rewrites26.7%
if -1e-3 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.050000000000000003Initial program 99.5%
Applied rewrites76.8%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f6473.9
Applied rewrites73.9%
if 0.050000000000000003 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 97.1%
Taylor expanded in kx around 0
lower-sin.f6466.6
Applied rewrites66.6%
Final simplification53.9%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
(if (<= t_1 -0.001)
(/ (* (sin ky) th) (sqrt (fma -0.5 (cos (* ky -2.0)) 0.5)))
(if (<= t_1 0.05)
(* (sin th) (/ (* ky (sqrt 2.0)) (sqrt (- 1.0 (cos (* kx -2.0))))))
(sin th)))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double tmp;
if (t_1 <= -0.001) {
tmp = (sin(ky) * th) / sqrt(fma(-0.5, cos((ky * -2.0)), 0.5));
} else if (t_1 <= 0.05) {
tmp = sin(th) * ((ky * sqrt(2.0)) / sqrt((1.0 - cos((kx * -2.0)))));
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_1 <= -0.001) tmp = Float64(Float64(sin(ky) * th) / sqrt(fma(-0.5, cos(Float64(ky * -2.0)), 0.5))); elseif (t_1 <= 0.05) tmp = Float64(sin(th) * Float64(Float64(ky * sqrt(2.0)) / sqrt(Float64(1.0 - cos(Float64(kx * -2.0)))))); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -0.001], N[(N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision] / N[Sqrt[N[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.05], N[(N[Sin[th], $MachinePrecision] * N[(N[(ky * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(1.0 - N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_1 \leq -0.001:\\
\;\;\;\;\frac{\sin ky \cdot th}{\sqrt{\mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), 0.5\right)}}\\
\mathbf{elif}\;t\_1 \leq 0.05:\\
\;\;\;\;\sin th \cdot \frac{ky \cdot \sqrt{2}}{\sqrt{1 - \cos \left(kx \cdot -2\right)}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -1e-3Initial program 92.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6489.7
lift-+.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
Applied rewrites78.8%
Taylor expanded in kx around 0
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6447.6
Applied rewrites47.6%
Taylor expanded in th around 0
lower-*.f64N/A
lower-sin.f6426.7
Applied rewrites26.7%
if -1e-3 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.050000000000000003Initial program 99.5%
Applied rewrites76.8%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f6473.9
Applied rewrites73.9%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6473.9
Applied rewrites73.9%
if 0.050000000000000003 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 97.1%
Taylor expanded in kx around 0
lower-sin.f6466.6
Applied rewrites66.6%
Final simplification53.9%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
(if (<= t_1 -0.001)
(/ (* (sin ky) th) (sqrt (fma -0.5 (cos (* ky -2.0)) 0.5)))
(if (<= t_1 2e-8) (* (sin th) (* ky (/ 1.0 (sin kx)))) (sin th)))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double tmp;
if (t_1 <= -0.001) {
tmp = (sin(ky) * th) / sqrt(fma(-0.5, cos((ky * -2.0)), 0.5));
} else if (t_1 <= 2e-8) {
tmp = sin(th) * (ky * (1.0 / sin(kx)));
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_1 <= -0.001) tmp = Float64(Float64(sin(ky) * th) / sqrt(fma(-0.5, cos(Float64(ky * -2.0)), 0.5))); elseif (t_1 <= 2e-8) tmp = Float64(sin(th) * Float64(ky * Float64(1.0 / sin(kx)))); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -0.001], N[(N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision] / N[Sqrt[N[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e-8], N[(N[Sin[th], $MachinePrecision] * N[(ky * N[(1.0 / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_1 \leq -0.001:\\
\;\;\;\;\frac{\sin ky \cdot th}{\sqrt{\mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), 0.5\right)}}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-8}:\\
\;\;\;\;\sin th \cdot \left(ky \cdot \frac{1}{\sin kx}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -1e-3Initial program 92.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6489.7
lift-+.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
Applied rewrites78.8%
Taylor expanded in kx around 0
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6447.6
Applied rewrites47.6%
Taylor expanded in th around 0
lower-*.f64N/A
lower-sin.f6426.7
Applied rewrites26.7%
if -1e-3 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2e-8Initial program 99.5%
Taylor expanded in ky around 0
lower-*.f64N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
Applied rewrites48.0%
Taylor expanded in ky around 0
Applied rewrites51.3%
if 2e-8 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 97.2%
Taylor expanded in kx around 0
lower-sin.f6464.5
Applied rewrites64.5%
Final simplification46.0%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
(if (<= t_1 1e-159)
(* (sin th) (* ky (/ (* -0.5 (* ky ky)) (* kx (* kx kx)))))
(if (<= t_1 2e-8)
(*
(*
(* ky (sqrt 2.0))
(/ (fma (* kx kx) (/ 0.08333333333333333 (sqrt 0.5)) (sqrt 0.5)) kx))
(fma th (* -0.16666666666666666 (* th th)) th))
(sin th)))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double tmp;
if (t_1 <= 1e-159) {
tmp = sin(th) * (ky * ((-0.5 * (ky * ky)) / (kx * (kx * kx))));
} else if (t_1 <= 2e-8) {
tmp = ((ky * sqrt(2.0)) * (fma((kx * kx), (0.08333333333333333 / sqrt(0.5)), sqrt(0.5)) / kx)) * fma(th, (-0.16666666666666666 * (th * th)), th);
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_1 <= 1e-159) tmp = Float64(sin(th) * Float64(ky * Float64(Float64(-0.5 * Float64(ky * ky)) / Float64(kx * Float64(kx * kx))))); elseif (t_1 <= 2e-8) tmp = Float64(Float64(Float64(ky * sqrt(2.0)) * Float64(fma(Float64(kx * kx), Float64(0.08333333333333333 / sqrt(0.5)), sqrt(0.5)) / kx)) * fma(th, Float64(-0.16666666666666666 * Float64(th * th)), th)); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 1e-159], N[(N[Sin[th], $MachinePrecision] * N[(ky * N[(N[(-0.5 * N[(ky * ky), $MachinePrecision]), $MachinePrecision] / N[(kx * N[(kx * kx), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e-8], N[(N[(N[(ky * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(kx * kx), $MachinePrecision] * N[(0.08333333333333333 / N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision] + N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision] / kx), $MachinePrecision]), $MachinePrecision] * N[(th * N[(-0.16666666666666666 * N[(th * th), $MachinePrecision]), $MachinePrecision] + th), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_1 \leq 10^{-159}:\\
\;\;\;\;\sin th \cdot \left(ky \cdot \frac{-0.5 \cdot \left(ky \cdot ky\right)}{kx \cdot \left(kx \cdot kx\right)}\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-8}:\\
\;\;\;\;\left(\left(ky \cdot \sqrt{2}\right) \cdot \frac{\mathsf{fma}\left(kx \cdot kx, \frac{0.08333333333333333}{\sqrt{0.5}}, \sqrt{0.5}\right)}{kx}\right) \cdot \mathsf{fma}\left(th, -0.16666666666666666 \cdot \left(th \cdot th\right), th\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 9.99999999999999989e-160Initial program 95.3%
Taylor expanded in ky around 0
lower-*.f64N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
Applied rewrites19.2%
Taylor expanded in kx around 0
Applied rewrites8.4%
if 9.99999999999999989e-160 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2e-8Initial program 99.3%
Applied rewrites67.8%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f6467.6
Applied rewrites67.6%
Taylor expanded in kx around 0
Applied rewrites20.0%
Taylor expanded in th around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6419.4
Applied rewrites19.4%
if 2e-8 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 97.2%
Taylor expanded in kx around 0
lower-sin.f6464.5
Applied rewrites64.5%
Final simplification26.3%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
(if (<= t_1 5e-172)
(* -0.16666666666666666 (* th (* th th)))
(if (<= t_1 2e-8)
(*
(*
(* ky (sqrt 2.0))
(/ (fma (* kx kx) (/ 0.08333333333333333 (sqrt 0.5)) (sqrt 0.5)) kx))
(fma th (* -0.16666666666666666 (* th th)) th))
(sin th)))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double tmp;
if (t_1 <= 5e-172) {
tmp = -0.16666666666666666 * (th * (th * th));
} else if (t_1 <= 2e-8) {
tmp = ((ky * sqrt(2.0)) * (fma((kx * kx), (0.08333333333333333 / sqrt(0.5)), sqrt(0.5)) / kx)) * fma(th, (-0.16666666666666666 * (th * th)), th);
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_1 <= 5e-172) tmp = Float64(-0.16666666666666666 * Float64(th * Float64(th * th))); elseif (t_1 <= 2e-8) tmp = Float64(Float64(Float64(ky * sqrt(2.0)) * Float64(fma(Float64(kx * kx), Float64(0.08333333333333333 / sqrt(0.5)), sqrt(0.5)) / kx)) * fma(th, Float64(-0.16666666666666666 * Float64(th * th)), th)); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 5e-172], N[(-0.16666666666666666 * N[(th * N[(th * th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e-8], N[(N[(N[(ky * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(kx * kx), $MachinePrecision] * N[(0.08333333333333333 / N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision] + N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision] / kx), $MachinePrecision]), $MachinePrecision] * N[(th * N[(-0.16666666666666666 * N[(th * th), $MachinePrecision]), $MachinePrecision] + th), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_1 \leq 5 \cdot 10^{-172}:\\
\;\;\;\;-0.16666666666666666 \cdot \left(th \cdot \left(th \cdot th\right)\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-8}:\\
\;\;\;\;\left(\left(ky \cdot \sqrt{2}\right) \cdot \frac{\mathsf{fma}\left(kx \cdot kx, \frac{0.08333333333333333}{\sqrt{0.5}}, \sqrt{0.5}\right)}{kx}\right) \cdot \mathsf{fma}\left(th, -0.16666666666666666 \cdot \left(th \cdot th\right), th\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 4.9999999999999999e-172Initial program 95.3%
Taylor expanded in kx around 0
lower-sin.f643.0
Applied rewrites3.0%
Taylor expanded in th around 0
Applied rewrites3.1%
Taylor expanded in th around inf
Applied rewrites10.0%
if 4.9999999999999999e-172 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2e-8Initial program 99.3%
Applied rewrites67.8%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f6467.6
Applied rewrites67.6%
Taylor expanded in kx around 0
Applied rewrites20.0%
Taylor expanded in th around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6419.4
Applied rewrites19.4%
if 2e-8 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 97.2%
Taylor expanded in kx around 0
lower-sin.f6464.5
Applied rewrites64.5%
Final simplification27.3%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
(if (<= t_1 5e-172)
(* -0.16666666666666666 (* th (* th th)))
(if (<= t_1 2e-8)
(*
(*
(* ky (sqrt 2.0))
(/ (fma (* kx kx) (/ 0.08333333333333333 (sqrt 0.5)) (sqrt 0.5)) kx))
(fma th (* -0.16666666666666666 (* th th)) th))
(fma
th
(* (* th th) (fma 0.008333333333333333 (* th th) -0.16666666666666666))
th)))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double tmp;
if (t_1 <= 5e-172) {
tmp = -0.16666666666666666 * (th * (th * th));
} else if (t_1 <= 2e-8) {
tmp = ((ky * sqrt(2.0)) * (fma((kx * kx), (0.08333333333333333 / sqrt(0.5)), sqrt(0.5)) / kx)) * fma(th, (-0.16666666666666666 * (th * th)), th);
} else {
tmp = fma(th, ((th * th) * fma(0.008333333333333333, (th * th), -0.16666666666666666)), th);
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_1 <= 5e-172) tmp = Float64(-0.16666666666666666 * Float64(th * Float64(th * th))); elseif (t_1 <= 2e-8) tmp = Float64(Float64(Float64(ky * sqrt(2.0)) * Float64(fma(Float64(kx * kx), Float64(0.08333333333333333 / sqrt(0.5)), sqrt(0.5)) / kx)) * fma(th, Float64(-0.16666666666666666 * Float64(th * th)), th)); else tmp = fma(th, Float64(Float64(th * th) * fma(0.008333333333333333, Float64(th * th), -0.16666666666666666)), th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 5e-172], N[(-0.16666666666666666 * N[(th * N[(th * th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e-8], N[(N[(N[(ky * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(kx * kx), $MachinePrecision] * N[(0.08333333333333333 / N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision] + N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision] / kx), $MachinePrecision]), $MachinePrecision] * N[(th * N[(-0.16666666666666666 * N[(th * th), $MachinePrecision]), $MachinePrecision] + th), $MachinePrecision]), $MachinePrecision], N[(th * N[(N[(th * th), $MachinePrecision] * N[(0.008333333333333333 * N[(th * th), $MachinePrecision] + -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + th), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_1 \leq 5 \cdot 10^{-172}:\\
\;\;\;\;-0.16666666666666666 \cdot \left(th \cdot \left(th \cdot th\right)\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-8}:\\
\;\;\;\;\left(\left(ky \cdot \sqrt{2}\right) \cdot \frac{\mathsf{fma}\left(kx \cdot kx, \frac{0.08333333333333333}{\sqrt{0.5}}, \sqrt{0.5}\right)}{kx}\right) \cdot \mathsf{fma}\left(th, -0.16666666666666666 \cdot \left(th \cdot th\right), th\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(th, \left(th \cdot th\right) \cdot \mathsf{fma}\left(0.008333333333333333, th \cdot th, -0.16666666666666666\right), th\right)\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 4.9999999999999999e-172Initial program 95.3%
Taylor expanded in kx around 0
lower-sin.f643.0
Applied rewrites3.0%
Taylor expanded in th around 0
Applied rewrites3.1%
Taylor expanded in th around inf
Applied rewrites10.0%
if 4.9999999999999999e-172 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2e-8Initial program 99.3%
Applied rewrites67.8%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f6467.6
Applied rewrites67.6%
Taylor expanded in kx around 0
Applied rewrites20.0%
Taylor expanded in th around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6419.4
Applied rewrites19.4%
if 2e-8 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 97.2%
Taylor expanded in kx around 0
lower-sin.f6464.5
Applied rewrites64.5%
Taylor expanded in th around 0
Applied rewrites36.9%
Final simplification18.9%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 2e-8) (* (sin th) (* ky (/ 1.0 (sin kx)))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) <= 2e-8) {
tmp = sin(th) * (ky * (1.0 / sin(kx)));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if ((sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) <= 2d-8) then
tmp = sin(th) * (ky * (1.0d0 / sin(kx)))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if ((Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) <= 2e-8) {
tmp = Math.sin(th) * (ky * (1.0 / Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) <= 2e-8: tmp = math.sin(th) * (ky * (1.0 / math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 2e-8) tmp = Float64(sin(th) * Float64(ky * Float64(1.0 / sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 2e-8) tmp = sin(th) * (ky * (1.0 / sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2e-8], N[(N[Sin[th], $MachinePrecision] * N[(ky * N[(1.0 / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 2 \cdot 10^{-8}:\\
\;\;\;\;\sin th \cdot \left(ky \cdot \frac{1}{\sin kx}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2e-8Initial program 95.8%
Taylor expanded in ky around 0
lower-*.f64N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
Applied rewrites23.0%
Taylor expanded in ky around 0
Applied rewrites25.7%
if 2e-8 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 97.2%
Taylor expanded in kx around 0
lower-sin.f6464.5
Applied rewrites64.5%
Final simplification37.4%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 2e-8) (* (sin th) (/ ky (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) <= 2e-8) {
tmp = sin(th) * (ky / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if ((sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) <= 2d-8) then
tmp = sin(th) * (ky / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if ((Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) <= 2e-8) {
tmp = Math.sin(th) * (ky / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) <= 2e-8: tmp = math.sin(th) * (ky / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 2e-8) tmp = Float64(sin(th) * Float64(ky / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 2e-8) tmp = sin(th) * (ky / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2e-8], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 2 \cdot 10^{-8}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2e-8Initial program 95.8%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-sin.f6425.7
Applied rewrites25.7%
if 2e-8 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 97.2%
Taylor expanded in kx around 0
lower-sin.f6464.5
Applied rewrites64.5%
Final simplification37.4%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 2e-8) (/ (* ky (sin th)) (sin kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) <= 2e-8) {
tmp = (ky * sin(th)) / sin(kx);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if ((sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) <= 2d-8) then
tmp = (ky * sin(th)) / sin(kx)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if ((Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) <= 2e-8) {
tmp = (ky * Math.sin(th)) / Math.sin(kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) <= 2e-8: tmp = (ky * math.sin(th)) / math.sin(kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 2e-8) tmp = Float64(Float64(ky * sin(th)) / sin(kx)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 2e-8) tmp = (ky * sin(th)) / sin(kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2e-8], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 2 \cdot 10^{-8}:\\
\;\;\;\;\frac{ky \cdot \sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2e-8Initial program 95.8%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f6424.4
Applied rewrites24.4%
if 2e-8 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 97.2%
Taylor expanded in kx around 0
lower-sin.f6464.5
Applied rewrites64.5%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 2e-8) (* (sin th) (* (* ky (sqrt 2.0)) (/ (sqrt 0.5) kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) <= 2e-8) {
tmp = sin(th) * ((ky * sqrt(2.0)) * (sqrt(0.5) / kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if ((sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) <= 2d-8) then
tmp = sin(th) * ((ky * sqrt(2.0d0)) * (sqrt(0.5d0) / kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if ((Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) <= 2e-8) {
tmp = Math.sin(th) * ((ky * Math.sqrt(2.0)) * (Math.sqrt(0.5) / kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) <= 2e-8: tmp = math.sin(th) * ((ky * math.sqrt(2.0)) * (math.sqrt(0.5) / kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 2e-8) tmp = Float64(sin(th) * Float64(Float64(ky * sqrt(2.0)) * Float64(sqrt(0.5) / kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 2e-8) tmp = sin(th) * ((ky * sqrt(2.0)) * (sqrt(0.5) / kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2e-8], N[(N[Sin[th], $MachinePrecision] * N[(N[(ky * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[0.5], $MachinePrecision] / kx), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 2 \cdot 10^{-8}:\\
\;\;\;\;\sin th \cdot \left(\left(ky \cdot \sqrt{2}\right) \cdot \frac{\sqrt{0.5}}{kx}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2e-8Initial program 95.8%
Applied rewrites77.5%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f6436.2
Applied rewrites36.2%
Taylor expanded in kx around 0
Applied rewrites16.1%
if 2e-8 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 97.2%
Taylor expanded in kx around 0
lower-sin.f6464.5
Applied rewrites64.5%
Final simplification30.7%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 2e-8) (* (sin th) (* (* (sqrt 2.0) (sqrt 0.5)) (/ ky kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) <= 2e-8) {
tmp = sin(th) * ((sqrt(2.0) * sqrt(0.5)) * (ky / kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if ((sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) <= 2d-8) then
tmp = sin(th) * ((sqrt(2.0d0) * sqrt(0.5d0)) * (ky / kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if ((Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) <= 2e-8) {
tmp = Math.sin(th) * ((Math.sqrt(2.0) * Math.sqrt(0.5)) * (ky / kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) <= 2e-8: tmp = math.sin(th) * ((math.sqrt(2.0) * math.sqrt(0.5)) * (ky / kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 2e-8) tmp = Float64(sin(th) * Float64(Float64(sqrt(2.0) * sqrt(0.5)) * Float64(ky / kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 2e-8) tmp = sin(th) * ((sqrt(2.0) * sqrt(0.5)) * (ky / kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2e-8], N[(N[Sin[th], $MachinePrecision] * N[(N[(N[Sqrt[2.0], $MachinePrecision] * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision] * N[(ky / kx), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 2 \cdot 10^{-8}:\\
\;\;\;\;\sin th \cdot \left(\left(\sqrt{2} \cdot \sqrt{0.5}\right) \cdot \frac{ky}{kx}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2e-8Initial program 95.8%
Applied rewrites77.5%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f6436.2
Applied rewrites36.2%
Taylor expanded in kx around 0
Applied rewrites16.1%
if 2e-8 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 97.2%
Taylor expanded in kx around 0
lower-sin.f6464.5
Applied rewrites64.5%
Final simplification30.6%
(FPCore (kx ky th)
:precision binary64
(if (<=
(*
(sin th)
(/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))))
8e-297)
(* -0.16666666666666666 (* th (* th th)))
(fma
th
(* (* th th) (fma 0.008333333333333333 (* th th) -0.16666666666666666))
th)))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(th) * (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0))))) <= 8e-297) {
tmp = -0.16666666666666666 * (th * (th * th));
} else {
tmp = fma(th, ((th * th) * fma(0.008333333333333333, (th * th), -0.16666666666666666)), th);
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(th) * Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0))))) <= 8e-297) tmp = Float64(-0.16666666666666666 * Float64(th * Float64(th * th))); else tmp = fma(th, Float64(Float64(th * th) * fma(0.008333333333333333, Float64(th * th), -0.16666666666666666)), th); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 8e-297], N[(-0.16666666666666666 * N[(th * N[(th * th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(th * N[(N[(th * th), $MachinePrecision] * N[(0.008333333333333333 * N[(th * th), $MachinePrecision] + -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + th), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin th \cdot \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 8 \cdot 10^{-297}:\\
\;\;\;\;-0.16666666666666666 \cdot \left(th \cdot \left(th \cdot th\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(th, \left(th \cdot th\right) \cdot \mathsf{fma}\left(0.008333333333333333, th \cdot th, -0.16666666666666666\right), th\right)\\
\end{array}
\end{array}
if (*.f64 (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) (sin.f64 th)) < 8.00000000000000032e-297Initial program 96.7%
Taylor expanded in kx around 0
lower-sin.f6421.1
Applied rewrites21.1%
Taylor expanded in th around 0
Applied rewrites11.3%
Taylor expanded in th around inf
Applied rewrites11.7%
if 8.00000000000000032e-297 < (*.f64 (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) (sin.f64 th)) Initial program 95.8%
Taylor expanded in kx around 0
lower-sin.f6422.5
Applied rewrites22.5%
Taylor expanded in th around 0
Applied rewrites15.4%
Final simplification13.5%
(FPCore (kx ky th)
:precision binary64
(if (<= (pow (sin kx) 2.0) 5e-9)
(*
(sin th)
(/
(sin ky)
(hypot (sin ky) (fma kx (* -0.16666666666666666 (* kx kx)) kx))))
(*
(sin ky)
(/
(sin th)
(sqrt
(fma (- 1.0 (cos (+ kx kx))) 0.5 (+ 0.5 (* -0.5 (cos (+ ky ky))))))))))
double code(double kx, double ky, double th) {
double tmp;
if (pow(sin(kx), 2.0) <= 5e-9) {
tmp = sin(th) * (sin(ky) / hypot(sin(ky), fma(kx, (-0.16666666666666666 * (kx * kx)), kx)));
} else {
tmp = sin(ky) * (sin(th) / sqrt(fma((1.0 - cos((kx + kx))), 0.5, (0.5 + (-0.5 * cos((ky + ky)))))));
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if ((sin(kx) ^ 2.0) <= 5e-9) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), fma(kx, Float64(-0.16666666666666666 * Float64(kx * kx)), kx)))); else tmp = Float64(sin(ky) * Float64(sin(th) / sqrt(fma(Float64(1.0 - cos(Float64(kx + kx))), 0.5, Float64(0.5 + Float64(-0.5 * cos(Float64(ky + ky)))))))); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision], 5e-9], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[(kx * N[(-0.16666666666666666 * N[(kx * kx), $MachinePrecision]), $MachinePrecision] + kx), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[(N[(1.0 - N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5 + N[(0.5 + N[(-0.5 * N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\sin kx}^{2} \leq 5 \cdot 10^{-9}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \mathsf{fma}\left(kx, -0.16666666666666666 \cdot \left(kx \cdot kx\right), kx\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sqrt{\mathsf{fma}\left(1 - \cos \left(kx + kx\right), 0.5, 0.5 + -0.5 \cdot \cos \left(ky + ky\right)\right)}}\\
\end{array}
\end{array}
if (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) < 5.0000000000000001e-9Initial program 92.6%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6499.9
Applied rewrites99.9%
Taylor expanded in kx around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6499.9
Applied rewrites99.9%
if 5.0000000000000001e-9 < (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) Initial program 99.4%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.0%
Final simplification99.4%
(FPCore (kx ky th)
:precision binary64
(if (<= (pow (sin kx) 2.0) 5e-9)
(*
(sin th)
(/
(sin ky)
(hypot (sin ky) (fma kx (* -0.16666666666666666 (* kx kx)) kx))))
(*
(sin th)
(/
(sin ky)
(sqrt
(fma (- 1.0 (cos (+ kx kx))) 0.5 (+ 0.5 (* -0.5 (cos (+ ky ky))))))))))
double code(double kx, double ky, double th) {
double tmp;
if (pow(sin(kx), 2.0) <= 5e-9) {
tmp = sin(th) * (sin(ky) / hypot(sin(ky), fma(kx, (-0.16666666666666666 * (kx * kx)), kx)));
} else {
tmp = sin(th) * (sin(ky) / sqrt(fma((1.0 - cos((kx + kx))), 0.5, (0.5 + (-0.5 * cos((ky + ky)))))));
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if ((sin(kx) ^ 2.0) <= 5e-9) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), fma(kx, Float64(-0.16666666666666666 * Float64(kx * kx)), kx)))); else tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(fma(Float64(1.0 - cos(Float64(kx + kx))), 0.5, Float64(0.5 + Float64(-0.5 * cos(Float64(ky + ky)))))))); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision], 5e-9], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[(kx * N[(-0.16666666666666666 * N[(kx * kx), $MachinePrecision]), $MachinePrecision] + kx), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[(1.0 - N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5 + N[(0.5 + N[(-0.5 * N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\sin kx}^{2} \leq 5 \cdot 10^{-9}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \mathsf{fma}\left(kx, -0.16666666666666666 \cdot \left(kx \cdot kx\right), kx\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{\mathsf{fma}\left(1 - \cos \left(kx + kx\right), 0.5, 0.5 + -0.5 \cdot \cos \left(ky + ky\right)\right)}}\\
\end{array}
\end{array}
if (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) < 5.0000000000000001e-9Initial program 92.6%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6499.9
Applied rewrites99.9%
Taylor expanded in kx around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6499.9
Applied rewrites99.9%
if 5.0000000000000001e-9 < (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) Initial program 99.4%
lift-+.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
count-2N/A
cos-diffN/A
cos-sin-sumN/A
lower--.f64N/A
count-2N/A
lower-cos.f64N/A
lower-+.f6499.0
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sqr-sin-aN/A
cancel-sign-sub-invN/A
Applied rewrites98.9%
Final simplification99.4%
(FPCore (kx ky th)
:precision binary64
(if (<=
(*
(sin th)
(/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))))
8e-297)
(* -0.16666666666666666 (* th (* th th)))
(fma th (* -0.16666666666666666 (* th th)) th)))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(th) * (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0))))) <= 8e-297) {
tmp = -0.16666666666666666 * (th * (th * th));
} else {
tmp = fma(th, (-0.16666666666666666 * (th * th)), th);
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(th) * Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0))))) <= 8e-297) tmp = Float64(-0.16666666666666666 * Float64(th * Float64(th * th))); else tmp = fma(th, Float64(-0.16666666666666666 * Float64(th * th)), th); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 8e-297], N[(-0.16666666666666666 * N[(th * N[(th * th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(th * N[(-0.16666666666666666 * N[(th * th), $MachinePrecision]), $MachinePrecision] + th), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin th \cdot \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 8 \cdot 10^{-297}:\\
\;\;\;\;-0.16666666666666666 \cdot \left(th \cdot \left(th \cdot th\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(th, -0.16666666666666666 \cdot \left(th \cdot th\right), th\right)\\
\end{array}
\end{array}
if (*.f64 (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) (sin.f64 th)) < 8.00000000000000032e-297Initial program 96.7%
Taylor expanded in kx around 0
lower-sin.f6421.1
Applied rewrites21.1%
Taylor expanded in th around 0
Applied rewrites11.3%
Taylor expanded in th around inf
Applied rewrites11.7%
if 8.00000000000000032e-297 < (*.f64 (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) (sin.f64 th)) Initial program 95.8%
Taylor expanded in kx around 0
lower-sin.f6422.5
Applied rewrites22.5%
Taylor expanded in th around 0
Applied rewrites15.5%
Final simplification13.6%
(FPCore (kx ky th) :precision binary64 (* -0.16666666666666666 (* th (* th th))))
double code(double kx, double ky, double th) {
return -0.16666666666666666 * (th * (th * th));
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (-0.16666666666666666d0) * (th * (th * th))
end function
public static double code(double kx, double ky, double th) {
return -0.16666666666666666 * (th * (th * th));
}
def code(kx, ky, th): return -0.16666666666666666 * (th * (th * th))
function code(kx, ky, th) return Float64(-0.16666666666666666 * Float64(th * Float64(th * th))) end
function tmp = code(kx, ky, th) tmp = -0.16666666666666666 * (th * (th * th)); end
code[kx_, ky_, th_] := N[(-0.16666666666666666 * N[(th * N[(th * th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-0.16666666666666666 \cdot \left(th \cdot \left(th \cdot th\right)\right)
\end{array}
Initial program 96.2%
Taylor expanded in kx around 0
lower-sin.f6421.8
Applied rewrites21.8%
Taylor expanded in th around 0
Applied rewrites13.3%
Taylor expanded in th around inf
Applied rewrites8.4%
herbie shell --seed 2024235
(FPCore (kx ky th)
:name "Toniolo and Linder, Equation (3b), real"
:precision binary64
(* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))