
(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 28 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 94.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 -2.0))))
(t_2 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))))
(t_3 (fma -0.5 (cos (* ky -2.0)) 0.5)))
(if (<= t_2 -1.0)
(* (sin th) (/ (sin ky) (sqrt t_3)))
(if (<= t_2 -0.2)
(*
th
(*
(sqrt (/ 1.0 (fma 0.5 t_1 t_3)))
(* (sin ky) (fma -0.16666666666666666 (* th th) 1.0))))
(if (<= t_2 4e-144)
(* (sin th) (/ (sin ky) (* (sqrt t_1) (sqrt 0.5))))
(if (<= t_2 0.1)
(* (sin th) (/ (sin ky) (sin kx)))
(if (<= t_2 0.996)
(/
1.0
(/
(sqrt
(fma
(- 1.0 (cos (+ kx kx)))
0.5
(+ 0.5 (* -0.5 (cos (+ ky ky))))))
(*
(sin ky)
(fma
th
(*
(* th th)
(fma 0.008333333333333333 (* th th) -0.16666666666666666))
th))))
(*
(sin th)
(/ (sin ky) (fma kx (* kx (/ 0.5 ky)) (sin ky)))))))))))
double code(double kx, double ky, double th) {
double t_1 = 1.0 - cos((kx * -2.0));
double t_2 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double t_3 = fma(-0.5, cos((ky * -2.0)), 0.5);
double tmp;
if (t_2 <= -1.0) {
tmp = sin(th) * (sin(ky) / sqrt(t_3));
} else if (t_2 <= -0.2) {
tmp = th * (sqrt((1.0 / fma(0.5, t_1, t_3))) * (sin(ky) * fma(-0.16666666666666666, (th * th), 1.0)));
} else if (t_2 <= 4e-144) {
tmp = sin(th) * (sin(ky) / (sqrt(t_1) * sqrt(0.5)));
} else if (t_2 <= 0.1) {
tmp = sin(th) * (sin(ky) / sin(kx));
} else if (t_2 <= 0.996) {
tmp = 1.0 / (sqrt(fma((1.0 - cos((kx + kx))), 0.5, (0.5 + (-0.5 * cos((ky + ky)))))) / (sin(ky) * fma(th, ((th * th) * fma(0.008333333333333333, (th * th), -0.16666666666666666)), th)));
} else {
tmp = sin(th) * (sin(ky) / fma(kx, (kx * (0.5 / ky)), sin(ky)));
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(1.0 - cos(Float64(kx * -2.0))) t_2 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) t_3 = fma(-0.5, cos(Float64(ky * -2.0)), 0.5) tmp = 0.0 if (t_2 <= -1.0) tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(t_3))); elseif (t_2 <= -0.2) tmp = Float64(th * Float64(sqrt(Float64(1.0 / fma(0.5, t_1, t_3))) * Float64(sin(ky) * fma(-0.16666666666666666, Float64(th * th), 1.0)))); elseif (t_2 <= 4e-144) tmp = Float64(sin(th) * Float64(sin(ky) / Float64(sqrt(t_1) * sqrt(0.5)))); elseif (t_2 <= 0.1) tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); elseif (t_2 <= 0.996) tmp = Float64(1.0 / Float64(sqrt(fma(Float64(1.0 - cos(Float64(kx + kx))), 0.5, Float64(0.5 + Float64(-0.5 * cos(Float64(ky + ky)))))) / Float64(sin(ky) * fma(th, Float64(Float64(th * th) * fma(0.008333333333333333, Float64(th * th), -0.16666666666666666)), th)))); else tmp = Float64(sin(th) * Float64(sin(ky) / fma(kx, Float64(kx * Float64(0.5 / ky)), sin(ky)))); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(1.0 - N[Cos[N[(kx * -2.0), $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[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]}, If[LessEqual[t$95$2, -1.0], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[t$95$3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -0.2], N[(th * N[(N[Sqrt[N[(1.0 / N[(0.5 * t$95$1 + t$95$3), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] * N[(-0.16666666666666666 * N[(th * th), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 4e-144], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[t$95$1], $MachinePrecision] * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.1], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.996], N[(1.0 / N[(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] / N[(N[Sin[ky], $MachinePrecision] * N[(th * N[(N[(th * th), $MachinePrecision] * N[(0.008333333333333333 * N[(th * th), $MachinePrecision] + -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[(kx * N[(kx * N[(0.5 / ky), $MachinePrecision]), $MachinePrecision] + N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 1 - \cos \left(kx \cdot -2\right)\\
t_2 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
t_3 := \mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), 0.5\right)\\
\mathbf{if}\;t\_2 \leq -1:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{t\_3}}\\
\mathbf{elif}\;t\_2 \leq -0.2:\\
\;\;\;\;th \cdot \left(\sqrt{\frac{1}{\mathsf{fma}\left(0.5, t\_1, t\_3\right)}} \cdot \left(\sin ky \cdot \mathsf{fma}\left(-0.16666666666666666, th \cdot th, 1\right)\right)\right)\\
\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{-144}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{t\_1} \cdot \sqrt{0.5}}\\
\mathbf{elif}\;t\_2 \leq 0.1:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\mathbf{elif}\;t\_2 \leq 0.996:\\
\;\;\;\;\frac{1}{\frac{\sqrt{\mathsf{fma}\left(1 - \cos \left(kx + kx\right), 0.5, 0.5 + -0.5 \cdot \cos \left(ky + ky\right)\right)}}{\sin ky \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 \cdot \frac{\sin ky}{\mathsf{fma}\left(kx, kx \cdot \frac{0.5}{ky}, \sin ky\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))))) < -1Initial program 90.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
Applied rewrites71.1%
Taylor expanded in kx around 0
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6471.2
Applied rewrites71.2%
Applied rewrites71.4%
if -1 < (/.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.20000000000000001Initial program 99.1%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
Applied rewrites94.6%
Taylor expanded in th around 0
Applied rewrites58.9%
if -0.20000000000000001 < (/.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))))) < 3.9999999999999998e-144Initial program 99.5%
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
count-2N/A
cos-diffN/A
cos-sin-sumN/A
lower--.f64N/A
count-2N/A
lower-cos.f64N/A
lower-+.f6480.7
Applied rewrites80.7%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.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-sqrt.f6478.0
Applied rewrites78.0%
if 3.9999999999999998e-144 < (/.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.10000000000000001Initial program 95.3%
Taylor expanded in ky around 0
lower-sin.f6455.7
Applied rewrites55.7%
if 0.10000000000000001 < (/.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.996Initial program 99.2%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
Applied rewrites95.9%
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-*.f6458.0
Applied rewrites58.0%
if 0.996 < (/.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 84.4%
Taylor expanded in kx around 0
+-commutativeN/A
*-commutativeN/A
associate-*l/N/A
associate-*r/N/A
metadata-evalN/A
associate-*r/N/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lower-sin.f64N/A
lower-sin.f6492.7
Applied rewrites92.7%
Taylor expanded in ky around 0
Applied rewrites92.0%
Final simplification72.9%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (- 1.0 (cos (* kx -2.0))))
(t_2 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))))
(t_3 (fma -0.5 (cos (* ky -2.0)) 0.5)))
(if (<= t_2 -1.0)
(* (sin th) (/ (sin ky) (sqrt t_3)))
(if (<= t_2 -0.2)
(*
th
(*
(sqrt (/ 1.0 (fma 0.5 t_1 t_3)))
(* (sin ky) (fma -0.16666666666666666 (* th th) 1.0))))
(if (<= t_2 4e-144)
(* (sin th) (/ (sin ky) (* (sqrt t_1) (sqrt 0.5))))
(if (<= t_2 0.1)
(* (sin th) (/ (sin ky) (sin kx)))
(if (<= t_2 0.996)
(/
(*
(sin ky)
(*
th
(fma
(* th th)
(fma 0.008333333333333333 (* th th) -0.16666666666666666)
1.0)))
(sqrt
(fma
(- 1.0 (cos (+ kx kx)))
0.5
(+ 0.5 (* -0.5 (cos (+ ky ky)))))))
(*
(sin th)
(/ (sin ky) (fma kx (* kx (/ 0.5 ky)) (sin ky)))))))))))
double code(double kx, double ky, double th) {
double t_1 = 1.0 - cos((kx * -2.0));
double t_2 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double t_3 = fma(-0.5, cos((ky * -2.0)), 0.5);
double tmp;
if (t_2 <= -1.0) {
tmp = sin(th) * (sin(ky) / sqrt(t_3));
} else if (t_2 <= -0.2) {
tmp = th * (sqrt((1.0 / fma(0.5, t_1, t_3))) * (sin(ky) * fma(-0.16666666666666666, (th * th), 1.0)));
} else if (t_2 <= 4e-144) {
tmp = sin(th) * (sin(ky) / (sqrt(t_1) * sqrt(0.5)));
} else if (t_2 <= 0.1) {
tmp = sin(th) * (sin(ky) / sin(kx));
} else if (t_2 <= 0.996) {
tmp = (sin(ky) * (th * fma((th * th), fma(0.008333333333333333, (th * th), -0.16666666666666666), 1.0))) / sqrt(fma((1.0 - cos((kx + kx))), 0.5, (0.5 + (-0.5 * cos((ky + ky))))));
} else {
tmp = sin(th) * (sin(ky) / fma(kx, (kx * (0.5 / ky)), sin(ky)));
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(1.0 - cos(Float64(kx * -2.0))) t_2 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) t_3 = fma(-0.5, cos(Float64(ky * -2.0)), 0.5) tmp = 0.0 if (t_2 <= -1.0) tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(t_3))); elseif (t_2 <= -0.2) tmp = Float64(th * Float64(sqrt(Float64(1.0 / fma(0.5, t_1, t_3))) * Float64(sin(ky) * fma(-0.16666666666666666, Float64(th * th), 1.0)))); elseif (t_2 <= 4e-144) tmp = Float64(sin(th) * Float64(sin(ky) / Float64(sqrt(t_1) * sqrt(0.5)))); elseif (t_2 <= 0.1) tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); elseif (t_2 <= 0.996) tmp = Float64(Float64(sin(ky) * Float64(th * fma(Float64(th * th), fma(0.008333333333333333, Float64(th * th), -0.16666666666666666), 1.0))) / sqrt(fma(Float64(1.0 - cos(Float64(kx + kx))), 0.5, Float64(0.5 + Float64(-0.5 * cos(Float64(ky + ky))))))); else tmp = Float64(sin(th) * Float64(sin(ky) / fma(kx, Float64(kx * Float64(0.5 / ky)), sin(ky)))); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(1.0 - N[Cos[N[(kx * -2.0), $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[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]}, If[LessEqual[t$95$2, -1.0], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[t$95$3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -0.2], N[(th * N[(N[Sqrt[N[(1.0 / N[(0.5 * t$95$1 + t$95$3), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] * N[(-0.16666666666666666 * N[(th * th), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 4e-144], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[t$95$1], $MachinePrecision] * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.1], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.996], N[(N[(N[Sin[ky], $MachinePrecision] * N[(th * N[(N[(th * th), $MachinePrecision] * N[(0.008333333333333333 * N[(th * th), $MachinePrecision] + -0.16666666666666666), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $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], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[(kx * N[(kx * N[(0.5 / ky), $MachinePrecision]), $MachinePrecision] + N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 1 - \cos \left(kx \cdot -2\right)\\
t_2 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
t_3 := \mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), 0.5\right)\\
\mathbf{if}\;t\_2 \leq -1:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{t\_3}}\\
\mathbf{elif}\;t\_2 \leq -0.2:\\
\;\;\;\;th \cdot \left(\sqrt{\frac{1}{\mathsf{fma}\left(0.5, t\_1, t\_3\right)}} \cdot \left(\sin ky \cdot \mathsf{fma}\left(-0.16666666666666666, th \cdot th, 1\right)\right)\right)\\
\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{-144}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{t\_1} \cdot \sqrt{0.5}}\\
\mathbf{elif}\;t\_2 \leq 0.1:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\mathbf{elif}\;t\_2 \leq 0.996:\\
\;\;\;\;\frac{\sin ky \cdot \left(th \cdot \mathsf{fma}\left(th \cdot th, \mathsf{fma}\left(0.008333333333333333, th \cdot th, -0.16666666666666666\right), 1\right)\right)}{\sqrt{\mathsf{fma}\left(1 - \cos \left(kx + kx\right), 0.5, 0.5 + -0.5 \cdot \cos \left(ky + ky\right)\right)}}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{fma}\left(kx, kx \cdot \frac{0.5}{ky}, \sin ky\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))))) < -1Initial program 90.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
Applied rewrites71.1%
Taylor expanded in kx around 0
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6471.2
Applied rewrites71.2%
Applied rewrites71.4%
if -1 < (/.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.20000000000000001Initial program 99.1%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
Applied rewrites94.6%
Taylor expanded in th around 0
Applied rewrites58.9%
if -0.20000000000000001 < (/.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))))) < 3.9999999999999998e-144Initial program 99.5%
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
count-2N/A
cos-diffN/A
cos-sin-sumN/A
lower--.f64N/A
count-2N/A
lower-cos.f64N/A
lower-+.f6480.7
Applied rewrites80.7%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.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-sqrt.f6478.0
Applied rewrites78.0%
if 3.9999999999999998e-144 < (/.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.10000000000000001Initial program 95.3%
Taylor expanded in ky around 0
lower-sin.f6455.7
Applied rewrites55.7%
if 0.10000000000000001 < (/.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.996Initial program 99.2%
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 rewrites96.0%
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-*.f6458.0
Applied rewrites58.0%
if 0.996 < (/.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 84.4%
Taylor expanded in kx around 0
+-commutativeN/A
*-commutativeN/A
associate-*l/N/A
associate-*r/N/A
metadata-evalN/A
associate-*r/N/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lower-sin.f64N/A
lower-sin.f6492.7
Applied rewrites92.7%
Taylor expanded in ky around 0
Applied rewrites92.0%
Final simplification72.9%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (- 1.0 (cos (* kx -2.0))))
(t_2 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))))
(t_3 (fma -0.5 (cos (* ky -2.0)) 0.5))
(t_4
(*
th
(*
(sqrt (/ 1.0 (fma 0.5 t_1 t_3)))
(* (sin ky) (fma -0.16666666666666666 (* th th) 1.0))))))
(if (<= t_2 -1.0)
(* (sin th) (/ (sin ky) (sqrt t_3)))
(if (<= t_2 -0.2)
t_4
(if (<= t_2 4e-144)
(* (sin th) (/ (sin ky) (* (sqrt t_1) (sqrt 0.5))))
(if (<= t_2 0.1)
(* (sin th) (/ (sin ky) (sin kx)))
(if (<= t_2 0.996)
t_4
(*
(sin th)
(/ (sin ky) (fma kx (* kx (/ 0.5 ky)) (sin ky)))))))))))
double code(double kx, double ky, double th) {
double t_1 = 1.0 - cos((kx * -2.0));
double t_2 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double t_3 = fma(-0.5, cos((ky * -2.0)), 0.5);
double t_4 = th * (sqrt((1.0 / fma(0.5, t_1, t_3))) * (sin(ky) * fma(-0.16666666666666666, (th * th), 1.0)));
double tmp;
if (t_2 <= -1.0) {
tmp = sin(th) * (sin(ky) / sqrt(t_3));
} else if (t_2 <= -0.2) {
tmp = t_4;
} else if (t_2 <= 4e-144) {
tmp = sin(th) * (sin(ky) / (sqrt(t_1) * sqrt(0.5)));
} else if (t_2 <= 0.1) {
tmp = sin(th) * (sin(ky) / sin(kx));
} else if (t_2 <= 0.996) {
tmp = t_4;
} else {
tmp = sin(th) * (sin(ky) / fma(kx, (kx * (0.5 / ky)), sin(ky)));
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(1.0 - cos(Float64(kx * -2.0))) t_2 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) t_3 = fma(-0.5, cos(Float64(ky * -2.0)), 0.5) t_4 = Float64(th * Float64(sqrt(Float64(1.0 / fma(0.5, t_1, t_3))) * Float64(sin(ky) * fma(-0.16666666666666666, Float64(th * th), 1.0)))) tmp = 0.0 if (t_2 <= -1.0) tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(t_3))); elseif (t_2 <= -0.2) tmp = t_4; elseif (t_2 <= 4e-144) tmp = Float64(sin(th) * Float64(sin(ky) / Float64(sqrt(t_1) * sqrt(0.5)))); elseif (t_2 <= 0.1) tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); elseif (t_2 <= 0.996) tmp = t_4; else tmp = Float64(sin(th) * Float64(sin(ky) / fma(kx, Float64(kx * Float64(0.5 / ky)), sin(ky)))); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(1.0 - N[Cos[N[(kx * -2.0), $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[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]}, Block[{t$95$4 = N[(th * N[(N[Sqrt[N[(1.0 / N[(0.5 * t$95$1 + t$95$3), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] * N[(-0.16666666666666666 * N[(th * th), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1.0], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[t$95$3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -0.2], t$95$4, If[LessEqual[t$95$2, 4e-144], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[t$95$1], $MachinePrecision] * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.1], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.996], t$95$4, N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[(kx * N[(kx * N[(0.5 / ky), $MachinePrecision]), $MachinePrecision] + N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 1 - \cos \left(kx \cdot -2\right)\\
t_2 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
t_3 := \mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), 0.5\right)\\
t_4 := th \cdot \left(\sqrt{\frac{1}{\mathsf{fma}\left(0.5, t\_1, t\_3\right)}} \cdot \left(\sin ky \cdot \mathsf{fma}\left(-0.16666666666666666, th \cdot th, 1\right)\right)\right)\\
\mathbf{if}\;t\_2 \leq -1:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{t\_3}}\\
\mathbf{elif}\;t\_2 \leq -0.2:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{-144}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{t\_1} \cdot \sqrt{0.5}}\\
\mathbf{elif}\;t\_2 \leq 0.1:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\mathbf{elif}\;t\_2 \leq 0.996:\\
\;\;\;\;t\_4\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{fma}\left(kx, kx \cdot \frac{0.5}{ky}, \sin ky\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))))) < -1Initial program 90.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
Applied rewrites71.1%
Taylor expanded in kx around 0
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6471.2
Applied rewrites71.2%
Applied rewrites71.4%
if -1 < (/.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.20000000000000001 or 0.10000000000000001 < (/.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.996Initial program 99.2%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
Applied rewrites95.3%
Taylor expanded in th around 0
Applied rewrites58.2%
if -0.20000000000000001 < (/.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))))) < 3.9999999999999998e-144Initial program 99.5%
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
count-2N/A
cos-diffN/A
cos-sin-sumN/A
lower--.f64N/A
count-2N/A
lower-cos.f64N/A
lower-+.f6480.7
Applied rewrites80.7%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.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-sqrt.f6478.0
Applied rewrites78.0%
if 3.9999999999999998e-144 < (/.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.10000000000000001Initial program 95.3%
Taylor expanded in ky around 0
lower-sin.f6455.7
Applied rewrites55.7%
if 0.996 < (/.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 84.4%
Taylor expanded in kx around 0
+-commutativeN/A
*-commutativeN/A
associate-*l/N/A
associate-*r/N/A
metadata-evalN/A
associate-*r/N/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lower-sin.f64N/A
lower-sin.f6492.7
Applied rewrites92.7%
Taylor expanded in ky around 0
Applied rewrites92.0%
Final simplification72.9%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (fma -0.16666666666666666 (* th th) 1.0))
(t_2 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))))
(t_3
(sqrt
(fma (- 1.0 (cos (+ kx kx))) 0.5 (+ 0.5 (* -0.5 (cos (+ ky ky))))))))
(if (<= t_2 -1.0)
(* (sin th) (/ (sin ky) (sqrt (fma -0.5 (cos (* ky -2.0)) 0.5))))
(if (<= t_2 -0.2)
(/ (* th (* (sin ky) t_1)) t_3)
(if (<= t_2 4e-144)
(*
(sin th)
(/ (sin ky) (* (sqrt (- 1.0 (cos (* kx -2.0)))) (sqrt 0.5))))
(if (<= t_2 0.1)
(* (sin th) (/ (sin ky) (sin kx)))
(if (<= t_2 0.996)
(/ (* t_1 (* (sin ky) th)) t_3)
(*
(sin th)
(/ (sin ky) (fma kx (* kx (/ 0.5 ky)) (sin ky)))))))))))
double code(double kx, double ky, double th) {
double t_1 = fma(-0.16666666666666666, (th * th), 1.0);
double t_2 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double t_3 = sqrt(fma((1.0 - cos((kx + kx))), 0.5, (0.5 + (-0.5 * cos((ky + ky))))));
double tmp;
if (t_2 <= -1.0) {
tmp = sin(th) * (sin(ky) / sqrt(fma(-0.5, cos((ky * -2.0)), 0.5)));
} else if (t_2 <= -0.2) {
tmp = (th * (sin(ky) * t_1)) / t_3;
} else if (t_2 <= 4e-144) {
tmp = sin(th) * (sin(ky) / (sqrt((1.0 - cos((kx * -2.0)))) * sqrt(0.5)));
} else if (t_2 <= 0.1) {
tmp = sin(th) * (sin(ky) / sin(kx));
} else if (t_2 <= 0.996) {
tmp = (t_1 * (sin(ky) * th)) / t_3;
} else {
tmp = sin(th) * (sin(ky) / fma(kx, (kx * (0.5 / ky)), sin(ky)));
}
return tmp;
}
function code(kx, ky, th) t_1 = fma(-0.16666666666666666, Float64(th * th), 1.0) t_2 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) t_3 = 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 <= -1.0) tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(fma(-0.5, cos(Float64(ky * -2.0)), 0.5)))); elseif (t_2 <= -0.2) tmp = Float64(Float64(th * Float64(sin(ky) * t_1)) / t_3); elseif (t_2 <= 4e-144) tmp = Float64(sin(th) * Float64(sin(ky) / Float64(sqrt(Float64(1.0 - cos(Float64(kx * -2.0)))) * sqrt(0.5)))); elseif (t_2 <= 0.1) tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); elseif (t_2 <= 0.996) tmp = Float64(Float64(t_1 * Float64(sin(ky) * th)) / t_3); else tmp = Float64(sin(th) * Float64(sin(ky) / fma(kx, Float64(kx * Float64(0.5 / ky)), sin(ky)))); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(-0.16666666666666666 * N[(th * th), $MachinePrecision] + 1.0), $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[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]}, If[LessEqual[t$95$2, -1.0], 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$2, -0.2], N[(N[(th * N[(N[Sin[ky], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision] / t$95$3), $MachinePrecision], If[LessEqual[t$95$2, 4e-144], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[(1.0 - N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.1], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.996], N[(N[(t$95$1 * N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision]), $MachinePrecision] / t$95$3), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[(kx * N[(kx * N[(0.5 / ky), $MachinePrecision]), $MachinePrecision] + N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-0.16666666666666666, th \cdot th, 1\right)\\
t_2 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
t_3 := \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 -1:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{\mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), 0.5\right)}}\\
\mathbf{elif}\;t\_2 \leq -0.2:\\
\;\;\;\;\frac{th \cdot \left(\sin ky \cdot t\_1\right)}{t\_3}\\
\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{-144}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{1 - \cos \left(kx \cdot -2\right)} \cdot \sqrt{0.5}}\\
\mathbf{elif}\;t\_2 \leq 0.1:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\mathbf{elif}\;t\_2 \leq 0.996:\\
\;\;\;\;\frac{t\_1 \cdot \left(\sin ky \cdot th\right)}{t\_3}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{fma}\left(kx, kx \cdot \frac{0.5}{ky}, \sin ky\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))))) < -1Initial program 90.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
Applied rewrites71.1%
Taylor expanded in kx around 0
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6471.2
Applied rewrites71.2%
Applied rewrites71.4%
if -1 < (/.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.20000000000000001Initial program 99.1%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6499.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
Applied rewrites94.8%
Taylor expanded in th around 0
lower-*.f64N/A
*-lft-identityN/A
associate-*r*N/A
distribute-rgt-inN/A
lower-*.f64N/A
lower-sin.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6458.7
Applied rewrites58.7%
if -0.20000000000000001 < (/.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))))) < 3.9999999999999998e-144Initial program 99.5%
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
count-2N/A
cos-diffN/A
cos-sin-sumN/A
lower--.f64N/A
count-2N/A
lower-cos.f64N/A
lower-+.f6480.7
Applied rewrites80.7%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.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-sqrt.f6478.0
Applied rewrites78.0%
if 3.9999999999999998e-144 < (/.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.10000000000000001Initial program 95.3%
Taylor expanded in ky around 0
lower-sin.f6455.7
Applied rewrites55.7%
if 0.10000000000000001 < (/.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.996Initial program 99.2%
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 rewrites96.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-*.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-*.f6458.6
Applied rewrites58.6%
Taylor expanded in th around 0
*-lft-identityN/A
associate-*r*N/A
distribute-rgt-inN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6457.7
Applied rewrites57.7%
if 0.996 < (/.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 84.4%
Taylor expanded in kx around 0
+-commutativeN/A
*-commutativeN/A
associate-*l/N/A
associate-*r/N/A
metadata-evalN/A
associate-*r/N/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lower-sin.f64N/A
lower-sin.f6492.7
Applied rewrites92.7%
Taylor expanded in ky around 0
Applied rewrites92.0%
Final simplification72.9%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))))
(t_2
(/
(* th (* (sin ky) (fma -0.16666666666666666 (* th th) 1.0)))
(sqrt
(fma
(- 1.0 (cos (+ kx kx)))
0.5
(+ 0.5 (* -0.5 (cos (+ ky ky)))))))))
(if (<= t_1 -1.0)
(* (sin th) (/ (sin ky) (sqrt (fma -0.5 (cos (* ky -2.0)) 0.5))))
(if (<= t_1 -0.2)
t_2
(if (<= t_1 4e-144)
(*
(sin th)
(/ (sin ky) (* (sqrt (- 1.0 (cos (* kx -2.0)))) (sqrt 0.5))))
(if (<= t_1 0.1)
(* (sin th) (/ (sin ky) (sin kx)))
(if (<= t_1 0.996)
t_2
(*
(sin th)
(/ (sin ky) (fma kx (* kx (/ 0.5 ky)) (sin ky)))))))))))
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 t_2 = (th * (sin(ky) * fma(-0.16666666666666666, (th * th), 1.0))) / sqrt(fma((1.0 - cos((kx + kx))), 0.5, (0.5 + (-0.5 * cos((ky + ky))))));
double tmp;
if (t_1 <= -1.0) {
tmp = sin(th) * (sin(ky) / sqrt(fma(-0.5, cos((ky * -2.0)), 0.5)));
} else if (t_1 <= -0.2) {
tmp = t_2;
} else if (t_1 <= 4e-144) {
tmp = sin(th) * (sin(ky) / (sqrt((1.0 - cos((kx * -2.0)))) * sqrt(0.5)));
} else if (t_1 <= 0.1) {
tmp = sin(th) * (sin(ky) / sin(kx));
} else if (t_1 <= 0.996) {
tmp = t_2;
} else {
tmp = sin(th) * (sin(ky) / fma(kx, (kx * (0.5 / ky)), sin(ky)));
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) t_2 = Float64(Float64(th * Float64(sin(ky) * fma(-0.16666666666666666, Float64(th * th), 1.0))) / 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_1 <= -1.0) tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(fma(-0.5, cos(Float64(ky * -2.0)), 0.5)))); elseif (t_1 <= -0.2) tmp = t_2; elseif (t_1 <= 4e-144) tmp = Float64(sin(th) * Float64(sin(ky) / Float64(sqrt(Float64(1.0 - cos(Float64(kx * -2.0)))) * sqrt(0.5)))); elseif (t_1 <= 0.1) tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); elseif (t_1 <= 0.996) tmp = t_2; else tmp = Float64(sin(th) * Float64(sin(ky) / fma(kx, Float64(kx * Float64(0.5 / ky)), sin(ky)))); 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]}, Block[{t$95$2 = N[(N[(th * N[(N[Sin[ky], $MachinePrecision] * N[(-0.16666666666666666 * N[(th * th), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $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$1, -1.0], 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.2], t$95$2, If[LessEqual[t$95$1, 4e-144], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[(1.0 - N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.1], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.996], t$95$2, N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[(kx * N[(kx * N[(0.5 / ky), $MachinePrecision]), $MachinePrecision] + N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
t_2 := \frac{th \cdot \left(\sin ky \cdot \mathsf{fma}\left(-0.16666666666666666, th \cdot th, 1\right)\right)}{\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\_1 \leq -1:\\
\;\;\;\;\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.2:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{-144}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{1 - \cos \left(kx \cdot -2\right)} \cdot \sqrt{0.5}}\\
\mathbf{elif}\;t\_1 \leq 0.1:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\mathbf{elif}\;t\_1 \leq 0.996:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{fma}\left(kx, kx \cdot \frac{0.5}{ky}, \sin ky\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))))) < -1Initial program 90.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
Applied rewrites71.1%
Taylor expanded in kx around 0
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6471.2
Applied rewrites71.2%
Applied rewrites71.4%
if -1 < (/.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.20000000000000001 or 0.10000000000000001 < (/.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.996Initial program 99.2%
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 rewrites95.5%
Taylor expanded in th around 0
lower-*.f64N/A
*-lft-identityN/A
associate-*r*N/A
distribute-rgt-inN/A
lower-*.f64N/A
lower-sin.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6458.2
Applied rewrites58.2%
if -0.20000000000000001 < (/.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))))) < 3.9999999999999998e-144Initial program 99.5%
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
count-2N/A
cos-diffN/A
cos-sin-sumN/A
lower--.f64N/A
count-2N/A
lower-cos.f64N/A
lower-+.f6480.7
Applied rewrites80.7%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.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-sqrt.f6478.0
Applied rewrites78.0%
if 3.9999999999999998e-144 < (/.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.10000000000000001Initial program 95.3%
Taylor expanded in ky around 0
lower-sin.f6455.7
Applied rewrites55.7%
if 0.996 < (/.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 84.4%
Taylor expanded in kx around 0
+-commutativeN/A
*-commutativeN/A
associate-*l/N/A
associate-*r/N/A
metadata-evalN/A
associate-*r/N/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lower-sin.f64N/A
lower-sin.f6492.7
Applied rewrites92.7%
Taylor expanded in ky around 0
Applied rewrites92.0%
Final simplification72.9%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (- 1.0 (cos (* kx -2.0))))
(t_2 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))))
(t_3 (fma -0.5 (cos (* ky -2.0)) 0.5))
(t_4 (* (sqrt (/ 1.0 (fma 0.5 t_1 t_3))) (* (sin ky) th))))
(if (<= t_2 -1.0)
(* (sin th) (/ (sin ky) (sqrt t_3)))
(if (<= t_2 -0.2)
t_4
(if (<= t_2 4e-144)
(* (sin th) (/ (sin ky) (* (sqrt t_1) (sqrt 0.5))))
(if (<= t_2 0.1)
(* (sin th) (/ (sin ky) (sin kx)))
(if (<= t_2 0.996)
t_4
(*
(sin th)
(/ (sin ky) (fma kx (* kx (/ 0.5 ky)) (sin ky)))))))))))
double code(double kx, double ky, double th) {
double t_1 = 1.0 - cos((kx * -2.0));
double t_2 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double t_3 = fma(-0.5, cos((ky * -2.0)), 0.5);
double t_4 = sqrt((1.0 / fma(0.5, t_1, t_3))) * (sin(ky) * th);
double tmp;
if (t_2 <= -1.0) {
tmp = sin(th) * (sin(ky) / sqrt(t_3));
} else if (t_2 <= -0.2) {
tmp = t_4;
} else if (t_2 <= 4e-144) {
tmp = sin(th) * (sin(ky) / (sqrt(t_1) * sqrt(0.5)));
} else if (t_2 <= 0.1) {
tmp = sin(th) * (sin(ky) / sin(kx));
} else if (t_2 <= 0.996) {
tmp = t_4;
} else {
tmp = sin(th) * (sin(ky) / fma(kx, (kx * (0.5 / ky)), sin(ky)));
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(1.0 - cos(Float64(kx * -2.0))) t_2 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) t_3 = fma(-0.5, cos(Float64(ky * -2.0)), 0.5) t_4 = Float64(sqrt(Float64(1.0 / fma(0.5, t_1, t_3))) * Float64(sin(ky) * th)) tmp = 0.0 if (t_2 <= -1.0) tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(t_3))); elseif (t_2 <= -0.2) tmp = t_4; elseif (t_2 <= 4e-144) tmp = Float64(sin(th) * Float64(sin(ky) / Float64(sqrt(t_1) * sqrt(0.5)))); elseif (t_2 <= 0.1) tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); elseif (t_2 <= 0.996) tmp = t_4; else tmp = Float64(sin(th) * Float64(sin(ky) / fma(kx, Float64(kx * Float64(0.5 / ky)), sin(ky)))); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(1.0 - N[Cos[N[(kx * -2.0), $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[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]}, Block[{t$95$4 = N[(N[Sqrt[N[(1.0 / N[(0.5 * t$95$1 + t$95$3), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1.0], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[t$95$3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -0.2], t$95$4, If[LessEqual[t$95$2, 4e-144], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[t$95$1], $MachinePrecision] * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.1], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.996], t$95$4, N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[(kx * N[(kx * N[(0.5 / ky), $MachinePrecision]), $MachinePrecision] + N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 1 - \cos \left(kx \cdot -2\right)\\
t_2 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
t_3 := \mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), 0.5\right)\\
t_4 := \sqrt{\frac{1}{\mathsf{fma}\left(0.5, t\_1, t\_3\right)}} \cdot \left(\sin ky \cdot th\right)\\
\mathbf{if}\;t\_2 \leq -1:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{t\_3}}\\
\mathbf{elif}\;t\_2 \leq -0.2:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{-144}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{t\_1} \cdot \sqrt{0.5}}\\
\mathbf{elif}\;t\_2 \leq 0.1:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\mathbf{elif}\;t\_2 \leq 0.996:\\
\;\;\;\;t\_4\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{fma}\left(kx, kx \cdot \frac{0.5}{ky}, \sin ky\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))))) < -1Initial program 90.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
Applied rewrites71.1%
Taylor expanded in kx around 0
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6471.2
Applied rewrites71.2%
Applied rewrites71.4%
if -1 < (/.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.20000000000000001 or 0.10000000000000001 < (/.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.996Initial program 99.2%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
Applied rewrites95.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 rewrites57.5%
if -0.20000000000000001 < (/.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))))) < 3.9999999999999998e-144Initial program 99.5%
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
count-2N/A
cos-diffN/A
cos-sin-sumN/A
lower--.f64N/A
count-2N/A
lower-cos.f64N/A
lower-+.f6480.7
Applied rewrites80.7%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.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-sqrt.f6478.0
Applied rewrites78.0%
if 3.9999999999999998e-144 < (/.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.10000000000000001Initial program 95.3%
Taylor expanded in ky around 0
lower-sin.f6455.7
Applied rewrites55.7%
if 0.996 < (/.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 84.4%
Taylor expanded in kx around 0
+-commutativeN/A
*-commutativeN/A
associate-*l/N/A
associate-*r/N/A
metadata-evalN/A
associate-*r/N/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lower-sin.f64N/A
lower-sin.f6492.7
Applied rewrites92.7%
Taylor expanded in ky around 0
Applied rewrites92.0%
Final simplification72.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))))
(t_2
(/
(* (sin ky) th)
(sqrt
(fma
(- 1.0 (cos (+ kx kx)))
0.5
(+ 0.5 (* -0.5 (cos (+ ky ky)))))))))
(if (<= t_1 -1.0)
(* (sin th) (/ (sin ky) (sqrt (fma -0.5 (cos (* ky -2.0)) 0.5))))
(if (<= t_1 -0.2)
t_2
(if (<= t_1 4e-144)
(*
(sin th)
(/ (sin ky) (* (sqrt (- 1.0 (cos (* kx -2.0)))) (sqrt 0.5))))
(if (<= t_1 0.1)
(* (sin th) (/ (sin ky) (sin kx)))
(if (<= t_1 0.996)
t_2
(*
(sin th)
(/ (sin ky) (fma kx (* kx (/ 0.5 ky)) (sin ky)))))))))))
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 t_2 = (sin(ky) * th) / sqrt(fma((1.0 - cos((kx + kx))), 0.5, (0.5 + (-0.5 * cos((ky + ky))))));
double tmp;
if (t_1 <= -1.0) {
tmp = sin(th) * (sin(ky) / sqrt(fma(-0.5, cos((ky * -2.0)), 0.5)));
} else if (t_1 <= -0.2) {
tmp = t_2;
} else if (t_1 <= 4e-144) {
tmp = sin(th) * (sin(ky) / (sqrt((1.0 - cos((kx * -2.0)))) * sqrt(0.5)));
} else if (t_1 <= 0.1) {
tmp = sin(th) * (sin(ky) / sin(kx));
} else if (t_1 <= 0.996) {
tmp = t_2;
} else {
tmp = sin(th) * (sin(ky) / fma(kx, (kx * (0.5 / ky)), sin(ky)));
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) t_2 = 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_1 <= -1.0) tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(fma(-0.5, cos(Float64(ky * -2.0)), 0.5)))); elseif (t_1 <= -0.2) tmp = t_2; elseif (t_1 <= 4e-144) tmp = Float64(sin(th) * Float64(sin(ky) / Float64(sqrt(Float64(1.0 - cos(Float64(kx * -2.0)))) * sqrt(0.5)))); elseif (t_1 <= 0.1) tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); elseif (t_1 <= 0.996) tmp = t_2; else tmp = Float64(sin(th) * Float64(sin(ky) / fma(kx, Float64(kx * Float64(0.5 / ky)), sin(ky)))); 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]}, Block[{t$95$2 = 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$1, -1.0], 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.2], t$95$2, If[LessEqual[t$95$1, 4e-144], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[(1.0 - N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.1], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.996], t$95$2, N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[(kx * N[(kx * N[(0.5 / ky), $MachinePrecision]), $MachinePrecision] + N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
t_2 := \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\_1 \leq -1:\\
\;\;\;\;\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.2:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{-144}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{1 - \cos \left(kx \cdot -2\right)} \cdot \sqrt{0.5}}\\
\mathbf{elif}\;t\_1 \leq 0.1:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\mathbf{elif}\;t\_1 \leq 0.996:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{fma}\left(kx, kx \cdot \frac{0.5}{ky}, \sin ky\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))))) < -1Initial program 90.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
Applied rewrites71.1%
Taylor expanded in kx around 0
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6471.2
Applied rewrites71.2%
Applied rewrites71.4%
if -1 < (/.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.20000000000000001 or 0.10000000000000001 < (/.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.996Initial program 99.2%
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 rewrites95.5%
Taylor expanded in th around 0
lower-*.f64N/A
lower-sin.f6457.3
Applied rewrites57.3%
if -0.20000000000000001 < (/.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))))) < 3.9999999999999998e-144Initial program 99.5%
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
count-2N/A
cos-diffN/A
cos-sin-sumN/A
lower--.f64N/A
count-2N/A
lower-cos.f64N/A
lower-+.f6480.7
Applied rewrites80.7%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.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-sqrt.f6478.0
Applied rewrites78.0%
if 3.9999999999999998e-144 < (/.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.10000000000000001Initial program 95.3%
Taylor expanded in ky around 0
lower-sin.f6455.7
Applied rewrites55.7%
if 0.996 < (/.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 84.4%
Taylor expanded in kx around 0
+-commutativeN/A
*-commutativeN/A
associate-*l/N/A
associate-*r/N/A
metadata-evalN/A
associate-*r/N/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lower-sin.f64N/A
lower-sin.f6492.7
Applied rewrites92.7%
Taylor expanded in ky around 0
Applied rewrites92.0%
Final simplification72.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (pow (sin ky) 2.0))
(t_2 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) t_1)))))
(if (<= t_2 -1.0)
(* (sin th) (/ (sin ky) (sqrt (+ t_1 (* kx kx)))))
(if (<= t_2 -0.2)
(*
(/ (sin ky) (hypot (sin ky) (sin kx)))
(fma th (* -0.16666666666666666 (* th th)) th))
(if (<= t_2 0.005)
(*
(sin th)
(/
(sin ky)
(hypot (fma ky (* (* ky ky) -0.16666666666666666) ky) (sin kx))))
(if (<= t_2 0.996)
(/
1.0
(/
(sqrt
(fma
(- 1.0 (cos (+ kx kx)))
0.5
(+ 0.5 (* -0.5 (cos (+ ky ky))))))
(*
(sin ky)
(fma
th
(*
(* th th)
(fma 0.008333333333333333 (* th th) -0.16666666666666666))
th))))
(*
(sin th)
(/ (sin ky) (fma kx (* kx (/ 0.5 (sin ky))) (sin ky))))))))))
double code(double kx, double ky, double th) {
double t_1 = pow(sin(ky), 2.0);
double t_2 = sin(ky) / sqrt((pow(sin(kx), 2.0) + t_1));
double tmp;
if (t_2 <= -1.0) {
tmp = sin(th) * (sin(ky) / sqrt((t_1 + (kx * kx))));
} else if (t_2 <= -0.2) {
tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * fma(th, (-0.16666666666666666 * (th * th)), th);
} else if (t_2 <= 0.005) {
tmp = sin(th) * (sin(ky) / hypot(fma(ky, ((ky * ky) * -0.16666666666666666), ky), sin(kx)));
} else if (t_2 <= 0.996) {
tmp = 1.0 / (sqrt(fma((1.0 - cos((kx + kx))), 0.5, (0.5 + (-0.5 * cos((ky + ky)))))) / (sin(ky) * fma(th, ((th * th) * fma(0.008333333333333333, (th * th), -0.16666666666666666)), th)));
} else {
tmp = sin(th) * (sin(ky) / fma(kx, (kx * (0.5 / sin(ky))), sin(ky)));
}
return tmp;
}
function code(kx, ky, th) t_1 = sin(ky) ^ 2.0 t_2 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + t_1))) tmp = 0.0 if (t_2 <= -1.0) tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(Float64(t_1 + Float64(kx * kx))))); elseif (t_2 <= -0.2) tmp = Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * fma(th, Float64(-0.16666666666666666 * Float64(th * th)), th)); elseif (t_2 <= 0.005) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(fma(ky, Float64(Float64(ky * ky) * -0.16666666666666666), ky), sin(kx)))); elseif (t_2 <= 0.996) tmp = Float64(1.0 / Float64(sqrt(fma(Float64(1.0 - cos(Float64(kx + kx))), 0.5, Float64(0.5 + Float64(-0.5 * cos(Float64(ky + ky)))))) / Float64(sin(ky) * fma(th, Float64(Float64(th * th) * fma(0.008333333333333333, Float64(th * th), -0.16666666666666666)), th)))); else tmp = Float64(sin(th) * Float64(sin(ky) / fma(kx, Float64(kx * Float64(0.5 / sin(ky))), sin(ky)))); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1.0], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$1 + N[(kx * kx), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -0.2], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[(th * N[(-0.16666666666666666 * N[(th * th), $MachinePrecision]), $MachinePrecision] + th), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.005], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(ky * N[(N[(ky * ky), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] + ky), $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.996], N[(1.0 / N[(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] / N[(N[Sin[ky], $MachinePrecision] * N[(th * N[(N[(th * th), $MachinePrecision] * N[(0.008333333333333333 * N[(th * th), $MachinePrecision] + -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[(kx * N[(kx * N[(0.5 / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := {\sin ky}^{2}\\
t_2 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + t\_1}}\\
\mathbf{if}\;t\_2 \leq -1:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{t\_1 + kx \cdot kx}}\\
\mathbf{elif}\;t\_2 \leq -0.2:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot \mathsf{fma}\left(th, -0.16666666666666666 \cdot \left(th \cdot th\right), th\right)\\
\mathbf{elif}\;t\_2 \leq 0.005:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\mathsf{fma}\left(ky, \left(ky \cdot ky\right) \cdot -0.16666666666666666, ky\right), \sin kx\right)}\\
\mathbf{elif}\;t\_2 \leq 0.996:\\
\;\;\;\;\frac{1}{\frac{\sqrt{\mathsf{fma}\left(1 - \cos \left(kx + kx\right), 0.5, 0.5 + -0.5 \cdot \cos \left(ky + ky\right)\right)}}{\sin ky \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 \cdot \frac{\sin ky}{\mathsf{fma}\left(kx, kx \cdot \frac{0.5}{\sin ky}, \sin ky\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))))) < -1Initial program 90.9%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6490.9
Applied rewrites90.9%
if -1 < (/.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.20000000000000001Initial program 99.1%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6499.2
Applied rewrites99.2%
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-*.f6463.3
Applied rewrites63.3%
if -0.20000000000000001 < (/.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.0050000000000000001Initial program 98.3%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6499.5
Applied rewrites99.5%
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.5
Applied rewrites97.5%
if 0.0050000000000000001 < (/.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.996Initial program 99.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
Applied rewrites96.2%
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-*.f6455.8
Applied rewrites55.8%
if 0.996 < (/.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 84.4%
Taylor expanded in kx around 0
+-commutativeN/A
*-commutativeN/A
associate-*l/N/A
associate-*r/N/A
metadata-evalN/A
associate-*r/N/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lower-sin.f64N/A
lower-sin.f6492.7
Applied rewrites92.7%
Final simplification86.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (pow (sin ky) 2.0))
(t_2 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) t_1)))))
(if (<= t_2 -1.0)
(* (sin th) (/ (sin ky) (sqrt (+ t_1 (* kx kx)))))
(if (<= t_2 -0.2)
(*
(/ (sin ky) (hypot (sin ky) (sin kx)))
(fma th (* -0.16666666666666666 (* th th)) th))
(if (<= t_2 0.005)
(*
(sin th)
(/
(sin ky)
(hypot (fma ky (* (* ky ky) -0.16666666666666666) ky) (sin kx))))
(if (<= t_2 0.996)
(/
1.0
(/
(sqrt
(fma
(- 1.0 (cos (+ kx kx)))
0.5
(+ 0.5 (* -0.5 (cos (+ ky ky))))))
(*
(sin ky)
(fma
th
(*
(* th th)
(fma 0.008333333333333333 (* th th) -0.16666666666666666))
th))))
(* (sin th) (/ (sin ky) (fma kx (* kx (/ 0.5 ky)) (sin ky))))))))))
double code(double kx, double ky, double th) {
double t_1 = pow(sin(ky), 2.0);
double t_2 = sin(ky) / sqrt((pow(sin(kx), 2.0) + t_1));
double tmp;
if (t_2 <= -1.0) {
tmp = sin(th) * (sin(ky) / sqrt((t_1 + (kx * kx))));
} else if (t_2 <= -0.2) {
tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * fma(th, (-0.16666666666666666 * (th * th)), th);
} else if (t_2 <= 0.005) {
tmp = sin(th) * (sin(ky) / hypot(fma(ky, ((ky * ky) * -0.16666666666666666), ky), sin(kx)));
} else if (t_2 <= 0.996) {
tmp = 1.0 / (sqrt(fma((1.0 - cos((kx + kx))), 0.5, (0.5 + (-0.5 * cos((ky + ky)))))) / (sin(ky) * fma(th, ((th * th) * fma(0.008333333333333333, (th * th), -0.16666666666666666)), th)));
} else {
tmp = sin(th) * (sin(ky) / fma(kx, (kx * (0.5 / ky)), sin(ky)));
}
return tmp;
}
function code(kx, ky, th) t_1 = sin(ky) ^ 2.0 t_2 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + t_1))) tmp = 0.0 if (t_2 <= -1.0) tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(Float64(t_1 + Float64(kx * kx))))); elseif (t_2 <= -0.2) tmp = Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * fma(th, Float64(-0.16666666666666666 * Float64(th * th)), th)); elseif (t_2 <= 0.005) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(fma(ky, Float64(Float64(ky * ky) * -0.16666666666666666), ky), sin(kx)))); elseif (t_2 <= 0.996) tmp = Float64(1.0 / Float64(sqrt(fma(Float64(1.0 - cos(Float64(kx + kx))), 0.5, Float64(0.5 + Float64(-0.5 * cos(Float64(ky + ky)))))) / Float64(sin(ky) * fma(th, Float64(Float64(th * th) * fma(0.008333333333333333, Float64(th * th), -0.16666666666666666)), th)))); else tmp = Float64(sin(th) * Float64(sin(ky) / fma(kx, Float64(kx * Float64(0.5 / ky)), sin(ky)))); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1.0], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$1 + N[(kx * kx), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -0.2], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[(th * N[(-0.16666666666666666 * N[(th * th), $MachinePrecision]), $MachinePrecision] + th), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.005], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(ky * N[(N[(ky * ky), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] + ky), $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.996], N[(1.0 / N[(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] / N[(N[Sin[ky], $MachinePrecision] * N[(th * N[(N[(th * th), $MachinePrecision] * N[(0.008333333333333333 * N[(th * th), $MachinePrecision] + -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[(kx * N[(kx * N[(0.5 / ky), $MachinePrecision]), $MachinePrecision] + N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := {\sin ky}^{2}\\
t_2 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + t\_1}}\\
\mathbf{if}\;t\_2 \leq -1:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{t\_1 + kx \cdot kx}}\\
\mathbf{elif}\;t\_2 \leq -0.2:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot \mathsf{fma}\left(th, -0.16666666666666666 \cdot \left(th \cdot th\right), th\right)\\
\mathbf{elif}\;t\_2 \leq 0.005:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\mathsf{fma}\left(ky, \left(ky \cdot ky\right) \cdot -0.16666666666666666, ky\right), \sin kx\right)}\\
\mathbf{elif}\;t\_2 \leq 0.996:\\
\;\;\;\;\frac{1}{\frac{\sqrt{\mathsf{fma}\left(1 - \cos \left(kx + kx\right), 0.5, 0.5 + -0.5 \cdot \cos \left(ky + ky\right)\right)}}{\sin ky \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 \cdot \frac{\sin ky}{\mathsf{fma}\left(kx, kx \cdot \frac{0.5}{ky}, \sin ky\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))))) < -1Initial program 90.9%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6490.9
Applied rewrites90.9%
if -1 < (/.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.20000000000000001Initial program 99.1%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6499.2
Applied rewrites99.2%
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-*.f6463.3
Applied rewrites63.3%
if -0.20000000000000001 < (/.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.0050000000000000001Initial program 98.3%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6499.5
Applied rewrites99.5%
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.5
Applied rewrites97.5%
if 0.0050000000000000001 < (/.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.996Initial program 99.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
Applied rewrites96.2%
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-*.f6455.8
Applied rewrites55.8%
if 0.996 < (/.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 84.4%
Taylor expanded in kx around 0
+-commutativeN/A
*-commutativeN/A
associate-*l/N/A
associate-*r/N/A
metadata-evalN/A
associate-*r/N/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lower-sin.f64N/A
lower-sin.f6492.7
Applied rewrites92.7%
Taylor expanded in ky around 0
Applied rewrites92.0%
Final simplification86.6%
(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 -1.0)
(* (sin th) (/ (sin ky) (sqrt (fma -0.5 (cos (* ky -2.0)) 0.5))))
(if (<= t_1 -0.2)
(*
(/ (sin ky) (hypot (sin ky) (sin kx)))
(fma th (* -0.16666666666666666 (* th th)) th))
(if (<= t_1 0.005)
(*
(sin th)
(/
(sin ky)
(hypot (fma ky (* (* ky ky) -0.16666666666666666) ky) (sin kx))))
(if (<= t_1 0.996)
(/
1.0
(/
(sqrt
(fma
(- 1.0 (cos (+ kx kx)))
0.5
(+ 0.5 (* -0.5 (cos (+ ky ky))))))
(*
(sin ky)
(fma
th
(*
(* th th)
(fma 0.008333333333333333 (* th th) -0.16666666666666666))
th))))
(* (sin th) (/ (sin ky) (fma kx (* kx (/ 0.5 ky)) (sin ky))))))))))
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 <= -1.0) {
tmp = sin(th) * (sin(ky) / sqrt(fma(-0.5, cos((ky * -2.0)), 0.5)));
} else if (t_1 <= -0.2) {
tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * fma(th, (-0.16666666666666666 * (th * th)), th);
} else if (t_1 <= 0.005) {
tmp = sin(th) * (sin(ky) / hypot(fma(ky, ((ky * ky) * -0.16666666666666666), ky), sin(kx)));
} else if (t_1 <= 0.996) {
tmp = 1.0 / (sqrt(fma((1.0 - cos((kx + kx))), 0.5, (0.5 + (-0.5 * cos((ky + ky)))))) / (sin(ky) * fma(th, ((th * th) * fma(0.008333333333333333, (th * th), -0.16666666666666666)), th)));
} else {
tmp = sin(th) * (sin(ky) / fma(kx, (kx * (0.5 / ky)), sin(ky)));
}
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 <= -1.0) tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(fma(-0.5, cos(Float64(ky * -2.0)), 0.5)))); elseif (t_1 <= -0.2) tmp = Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * fma(th, Float64(-0.16666666666666666 * Float64(th * th)), th)); elseif (t_1 <= 0.005) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(fma(ky, Float64(Float64(ky * ky) * -0.16666666666666666), ky), sin(kx)))); elseif (t_1 <= 0.996) tmp = Float64(1.0 / Float64(sqrt(fma(Float64(1.0 - cos(Float64(kx + kx))), 0.5, Float64(0.5 + Float64(-0.5 * cos(Float64(ky + ky)))))) / Float64(sin(ky) * fma(th, Float64(Float64(th * th) * fma(0.008333333333333333, Float64(th * th), -0.16666666666666666)), th)))); else tmp = Float64(sin(th) * Float64(sin(ky) / fma(kx, Float64(kx * Float64(0.5 / ky)), sin(ky)))); 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, -1.0], 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.2], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[(th * N[(-0.16666666666666666 * N[(th * th), $MachinePrecision]), $MachinePrecision] + th), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.005], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(ky * N[(N[(ky * ky), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] + ky), $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.996], N[(1.0 / N[(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] / N[(N[Sin[ky], $MachinePrecision] * N[(th * N[(N[(th * th), $MachinePrecision] * N[(0.008333333333333333 * N[(th * th), $MachinePrecision] + -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[(kx * N[(kx * N[(0.5 / ky), $MachinePrecision]), $MachinePrecision] + N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_1 \leq -1:\\
\;\;\;\;\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.2:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot \mathsf{fma}\left(th, -0.16666666666666666 \cdot \left(th \cdot th\right), th\right)\\
\mathbf{elif}\;t\_1 \leq 0.005:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\mathsf{fma}\left(ky, \left(ky \cdot ky\right) \cdot -0.16666666666666666, ky\right), \sin kx\right)}\\
\mathbf{elif}\;t\_1 \leq 0.996:\\
\;\;\;\;\frac{1}{\frac{\sqrt{\mathsf{fma}\left(1 - \cos \left(kx + kx\right), 0.5, 0.5 + -0.5 \cdot \cos \left(ky + ky\right)\right)}}{\sin ky \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 \cdot \frac{\sin ky}{\mathsf{fma}\left(kx, kx \cdot \frac{0.5}{ky}, \sin ky\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))))) < -1Initial program 90.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
Applied rewrites71.1%
Taylor expanded in kx around 0
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6471.2
Applied rewrites71.2%
Applied rewrites71.4%
if -1 < (/.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.20000000000000001Initial program 99.1%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6499.2
Applied rewrites99.2%
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-*.f6463.3
Applied rewrites63.3%
if -0.20000000000000001 < (/.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.0050000000000000001Initial program 98.3%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6499.5
Applied rewrites99.5%
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.5
Applied rewrites97.5%
if 0.0050000000000000001 < (/.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.996Initial program 99.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
Applied rewrites96.2%
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-*.f6455.8
Applied rewrites55.8%
if 0.996 < (/.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 84.4%
Taylor expanded in kx around 0
+-commutativeN/A
*-commutativeN/A
associate-*l/N/A
associate-*r/N/A
metadata-evalN/A
associate-*r/N/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lower-sin.f64N/A
lower-sin.f6492.7
Applied rewrites92.7%
Taylor expanded in ky around 0
Applied rewrites92.0%
Final simplification82.4%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))))
(t_2 (fma -0.5 (cos (* ky -2.0)) 0.5)))
(if (<= t_1 -1.0)
(* (sin th) (/ (sin ky) (sqrt t_2)))
(if (<= t_1 -0.2)
(*
th
(*
(sqrt (/ 1.0 (fma 0.5 (- 1.0 (cos (* kx -2.0))) t_2)))
(* (sin ky) (fma -0.16666666666666666 (* th th) 1.0))))
(if (<= t_1 0.005)
(*
(sin th)
(/
(sin ky)
(hypot (fma ky (* (* ky ky) -0.16666666666666666) ky) (sin kx))))
(if (<= t_1 0.996)
(/
1.0
(/
(sqrt
(fma
(- 1.0 (cos (+ kx kx)))
0.5
(+ 0.5 (* -0.5 (cos (+ ky ky))))))
(*
(sin ky)
(fma
th
(*
(* th th)
(fma 0.008333333333333333 (* th th) -0.16666666666666666))
th))))
(* (sin th) (/ (sin ky) (fma kx (* kx (/ 0.5 ky)) (sin ky))))))))))
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 t_2 = fma(-0.5, cos((ky * -2.0)), 0.5);
double tmp;
if (t_1 <= -1.0) {
tmp = sin(th) * (sin(ky) / sqrt(t_2));
} else if (t_1 <= -0.2) {
tmp = th * (sqrt((1.0 / fma(0.5, (1.0 - cos((kx * -2.0))), t_2))) * (sin(ky) * fma(-0.16666666666666666, (th * th), 1.0)));
} else if (t_1 <= 0.005) {
tmp = sin(th) * (sin(ky) / hypot(fma(ky, ((ky * ky) * -0.16666666666666666), ky), sin(kx)));
} else if (t_1 <= 0.996) {
tmp = 1.0 / (sqrt(fma((1.0 - cos((kx + kx))), 0.5, (0.5 + (-0.5 * cos((ky + ky)))))) / (sin(ky) * fma(th, ((th * th) * fma(0.008333333333333333, (th * th), -0.16666666666666666)), th)));
} else {
tmp = sin(th) * (sin(ky) / fma(kx, (kx * (0.5 / ky)), sin(ky)));
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) t_2 = fma(-0.5, cos(Float64(ky * -2.0)), 0.5) tmp = 0.0 if (t_1 <= -1.0) tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(t_2))); elseif (t_1 <= -0.2) tmp = Float64(th * Float64(sqrt(Float64(1.0 / fma(0.5, Float64(1.0 - cos(Float64(kx * -2.0))), t_2))) * Float64(sin(ky) * fma(-0.16666666666666666, Float64(th * th), 1.0)))); elseif (t_1 <= 0.005) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(fma(ky, Float64(Float64(ky * ky) * -0.16666666666666666), ky), sin(kx)))); elseif (t_1 <= 0.996) tmp = Float64(1.0 / Float64(sqrt(fma(Float64(1.0 - cos(Float64(kx + kx))), 0.5, Float64(0.5 + Float64(-0.5 * cos(Float64(ky + ky)))))) / Float64(sin(ky) * fma(th, Float64(Float64(th * th) * fma(0.008333333333333333, Float64(th * th), -0.16666666666666666)), th)))); else tmp = Float64(sin(th) * Float64(sin(ky) / fma(kx, Float64(kx * Float64(0.5 / ky)), sin(ky)))); 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]}, Block[{t$95$2 = N[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]}, If[LessEqual[t$95$1, -1.0], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[t$95$2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -0.2], N[(th * N[(N[Sqrt[N[(1.0 / N[(0.5 * N[(1.0 - N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] * N[(-0.16666666666666666 * N[(th * th), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.005], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(ky * N[(N[(ky * ky), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] + ky), $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.996], N[(1.0 / N[(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] / N[(N[Sin[ky], $MachinePrecision] * N[(th * N[(N[(th * th), $MachinePrecision] * N[(0.008333333333333333 * N[(th * th), $MachinePrecision] + -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[(kx * N[(kx * N[(0.5 / ky), $MachinePrecision]), $MachinePrecision] + N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
t_2 := \mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), 0.5\right)\\
\mathbf{if}\;t\_1 \leq -1:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{t\_2}}\\
\mathbf{elif}\;t\_1 \leq -0.2:\\
\;\;\;\;th \cdot \left(\sqrt{\frac{1}{\mathsf{fma}\left(0.5, 1 - \cos \left(kx \cdot -2\right), t\_2\right)}} \cdot \left(\sin ky \cdot \mathsf{fma}\left(-0.16666666666666666, th \cdot th, 1\right)\right)\right)\\
\mathbf{elif}\;t\_1 \leq 0.005:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\mathsf{fma}\left(ky, \left(ky \cdot ky\right) \cdot -0.16666666666666666, ky\right), \sin kx\right)}\\
\mathbf{elif}\;t\_1 \leq 0.996:\\
\;\;\;\;\frac{1}{\frac{\sqrt{\mathsf{fma}\left(1 - \cos \left(kx + kx\right), 0.5, 0.5 + -0.5 \cdot \cos \left(ky + ky\right)\right)}}{\sin ky \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 \cdot \frac{\sin ky}{\mathsf{fma}\left(kx, kx \cdot \frac{0.5}{ky}, \sin ky\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))))) < -1Initial program 90.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
Applied rewrites71.1%
Taylor expanded in kx around 0
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6471.2
Applied rewrites71.2%
Applied rewrites71.4%
if -1 < (/.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.20000000000000001Initial program 99.1%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
Applied rewrites94.6%
Taylor expanded in th around 0
Applied rewrites58.9%
if -0.20000000000000001 < (/.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.0050000000000000001Initial program 98.3%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6499.5
Applied rewrites99.5%
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.5
Applied rewrites97.5%
if 0.0050000000000000001 < (/.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.996Initial program 99.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
Applied rewrites96.2%
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-*.f6455.8
Applied rewrites55.8%
if 0.996 < (/.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 84.4%
Taylor expanded in kx around 0
+-commutativeN/A
*-commutativeN/A
associate-*l/N/A
associate-*r/N/A
metadata-evalN/A
associate-*r/N/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lower-sin.f64N/A
lower-sin.f6492.7
Applied rewrites92.7%
Taylor expanded in ky around 0
Applied rewrites92.0%
Final simplification82.1%
(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.715)
(* (sin th) (/ (sin ky) (sqrt (fma -0.5 (cos (* ky -2.0)) 0.5))))
(if (<= t_1 4e-144)
(*
(sin th)
(/ (sin ky) (* (sqrt (- 1.0 (cos (* kx -2.0)))) (sqrt 0.5))))
(if (<= t_1 0.1) (* (sin th) (/ (sin ky) (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.715) {
tmp = sin(th) * (sin(ky) / sqrt(fma(-0.5, cos((ky * -2.0)), 0.5)));
} else if (t_1 <= 4e-144) {
tmp = sin(th) * (sin(ky) / (sqrt((1.0 - cos((kx * -2.0)))) * sqrt(0.5)));
} else if (t_1 <= 0.1) {
tmp = sin(th) * (sin(ky) / 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.715) tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(fma(-0.5, cos(Float64(ky * -2.0)), 0.5)))); elseif (t_1 <= 4e-144) tmp = Float64(sin(th) * Float64(sin(ky) / Float64(sqrt(Float64(1.0 - cos(Float64(kx * -2.0)))) * sqrt(0.5)))); elseif (t_1 <= 0.1) tmp = Float64(sin(th) * Float64(sin(ky) / 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.715], 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, 4e-144], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[(1.0 - N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.1], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $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.715:\\
\;\;\;\;\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 4 \cdot 10^{-144}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{1 - \cos \left(kx \cdot -2\right)} \cdot \sqrt{0.5}}\\
\mathbf{elif}\;t\_1 \leq 0.1:\\
\;\;\;\;\sin th \cdot \frac{\sin 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))))) < -0.714999999999999969Initial program 92.5%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
Applied rewrites76.5%
Taylor expanded in kx around 0
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6462.3
Applied rewrites62.3%
Applied rewrites62.4%
if -0.714999999999999969 < (/.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))))) < 3.9999999999999998e-144Initial program 99.5%
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
count-2N/A
cos-diffN/A
cos-sin-sumN/A
lower--.f64N/A
count-2N/A
lower-cos.f64N/A
lower-+.f6482.7
Applied rewrites82.7%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.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-sqrt.f6471.7
Applied rewrites71.7%
if 3.9999999999999998e-144 < (/.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.10000000000000001Initial program 95.3%
Taylor expanded in ky around 0
lower-sin.f6455.7
Applied rewrites55.7%
if 0.10000000000000001 < (/.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 90.1%
Taylor expanded in kx around 0
lower-sin.f6463.8
Applied rewrites63.8%
Final simplification65.1%
(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.715)
(* (sin th) (/ (sin ky) (sqrt (fma -0.5 (cos (* ky -2.0)) 0.5))))
(if (<= t_1 4e-144)
(/ (* (sin ky) (sin th)) (sqrt (* 0.5 (- 1.0 (cos (* kx -2.0))))))
(if (<= t_1 0.1) (* (sin th) (/ (sin ky) (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.715) {
tmp = sin(th) * (sin(ky) / sqrt(fma(-0.5, cos((ky * -2.0)), 0.5)));
} else if (t_1 <= 4e-144) {
tmp = (sin(ky) * sin(th)) / sqrt((0.5 * (1.0 - cos((kx * -2.0)))));
} else if (t_1 <= 0.1) {
tmp = sin(th) * (sin(ky) / 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.715) tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(fma(-0.5, cos(Float64(ky * -2.0)), 0.5)))); elseif (t_1 <= 4e-144) tmp = Float64(Float64(sin(ky) * sin(th)) / sqrt(Float64(0.5 * Float64(1.0 - cos(Float64(kx * -2.0)))))); elseif (t_1 <= 0.1) tmp = Float64(sin(th) * Float64(sin(ky) / 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.715], 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, 4e-144], 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], If[LessEqual[t$95$1, 0.1], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $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.715:\\
\;\;\;\;\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 4 \cdot 10^{-144}:\\
\;\;\;\;\frac{\sin ky \cdot \sin th}{\sqrt{0.5 \cdot \left(1 - \cos \left(kx \cdot -2\right)\right)}}\\
\mathbf{elif}\;t\_1 \leq 0.1:\\
\;\;\;\;\sin th \cdot \frac{\sin 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))))) < -0.714999999999999969Initial program 92.5%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
Applied rewrites76.5%
Taylor expanded in kx around 0
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6462.3
Applied rewrites62.3%
Applied rewrites62.4%
if -0.714999999999999969 < (/.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))))) < 3.9999999999999998e-144Initial program 99.5%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6499.2
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 rewrites80.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-*.f6471.6
Applied rewrites71.6%
if 3.9999999999999998e-144 < (/.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.10000000000000001Initial program 95.3%
Taylor expanded in ky around 0
lower-sin.f6455.7
Applied rewrites55.7%
if 0.10000000000000001 < (/.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 90.1%
Taylor expanded in kx around 0
lower-sin.f6463.8
Applied rewrites63.8%
Final simplification65.1%
(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.02)
(* (sin th) (/ (sin ky) (sqrt (fma -0.5 (cos (* ky -2.0)) 0.5))))
(if (<= t_1 4e-144)
(*
(sin th)
(* (sqrt (/ 1.0 (- 1.0 (cos (* kx -2.0))))) (* ky (sqrt 2.0))))
(if (<= t_1 0.1) (* (sin th) (/ (sin ky) (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.02) {
tmp = sin(th) * (sin(ky) / sqrt(fma(-0.5, cos((ky * -2.0)), 0.5)));
} else if (t_1 <= 4e-144) {
tmp = sin(th) * (sqrt((1.0 / (1.0 - cos((kx * -2.0))))) * (ky * sqrt(2.0)));
} else if (t_1 <= 0.1) {
tmp = sin(th) * (sin(ky) / 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.02) tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(fma(-0.5, cos(Float64(ky * -2.0)), 0.5)))); elseif (t_1 <= 4e-144) tmp = Float64(sin(th) * Float64(sqrt(Float64(1.0 / Float64(1.0 - cos(Float64(kx * -2.0))))) * Float64(ky * sqrt(2.0)))); elseif (t_1 <= 0.1) tmp = Float64(sin(th) * Float64(sin(ky) / 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.02], 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, 4e-144], 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], If[LessEqual[t$95$1, 0.1], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $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.02:\\
\;\;\;\;\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 4 \cdot 10^{-144}:\\
\;\;\;\;\sin th \cdot \left(\sqrt{\frac{1}{1 - \cos \left(kx \cdot -2\right)}} \cdot \left(ky \cdot \sqrt{2}\right)\right)\\
\mathbf{elif}\;t\_1 \leq 0.1:\\
\;\;\;\;\sin th \cdot \frac{\sin 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))))) < -0.0200000000000000004Initial program 93.4%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
Applied rewrites78.2%
Taylor expanded in kx around 0
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6456.4
Applied rewrites56.4%
Applied rewrites56.5%
if -0.0200000000000000004 < (/.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))))) < 3.9999999999999998e-144Initial program 99.5%
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
count-2N/A
cos-diffN/A
cos-sin-sumN/A
lower--.f64N/A
count-2N/A
lower-cos.f64N/A
lower-+.f6480.4
Applied rewrites80.4%
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.f6478.3
Applied rewrites78.3%
if 3.9999999999999998e-144 < (/.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.10000000000000001Initial program 95.3%
Taylor expanded in ky around 0
lower-sin.f6455.7
Applied rewrites55.7%
if 0.10000000000000001 < (/.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 90.1%
Taylor expanded in kx around 0
lower-sin.f6463.8
Applied rewrites63.8%
Final simplification64.8%
(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.02)
(* (sin ky) (/ (sin th) (sqrt (fma -0.5 (cos (* ky -2.0)) 0.5))))
(if (<= t_1 4e-144)
(*
(sin th)
(* (sqrt (/ 1.0 (- 1.0 (cos (* kx -2.0))))) (* ky (sqrt 2.0))))
(if (<= t_1 0.1) (* (sin th) (/ (sin ky) (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.02) {
tmp = sin(ky) * (sin(th) / sqrt(fma(-0.5, cos((ky * -2.0)), 0.5)));
} else if (t_1 <= 4e-144) {
tmp = sin(th) * (sqrt((1.0 / (1.0 - cos((kx * -2.0))))) * (ky * sqrt(2.0)));
} else if (t_1 <= 0.1) {
tmp = sin(th) * (sin(ky) / 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.02) tmp = Float64(sin(ky) * Float64(sin(th) / sqrt(fma(-0.5, cos(Float64(ky * -2.0)), 0.5)))); elseif (t_1 <= 4e-144) tmp = Float64(sin(th) * Float64(sqrt(Float64(1.0 / Float64(1.0 - cos(Float64(kx * -2.0))))) * Float64(ky * sqrt(2.0)))); elseif (t_1 <= 0.1) tmp = Float64(sin(th) * Float64(sin(ky) / 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.02], 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, 4e-144], 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], If[LessEqual[t$95$1, 0.1], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $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.02:\\
\;\;\;\;\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 4 \cdot 10^{-144}:\\
\;\;\;\;\sin th \cdot \left(\sqrt{\frac{1}{1 - \cos \left(kx \cdot -2\right)}} \cdot \left(ky \cdot \sqrt{2}\right)\right)\\
\mathbf{elif}\;t\_1 \leq 0.1:\\
\;\;\;\;\sin th \cdot \frac{\sin 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))))) < -0.0200000000000000004Initial program 93.4%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
Applied rewrites78.2%
Taylor expanded in kx around 0
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6456.4
Applied rewrites56.4%
Applied rewrites56.4%
Applied rewrites56.5%
if -0.0200000000000000004 < (/.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))))) < 3.9999999999999998e-144Initial program 99.5%
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
count-2N/A
cos-diffN/A
cos-sin-sumN/A
lower--.f64N/A
count-2N/A
lower-cos.f64N/A
lower-+.f6480.4
Applied rewrites80.4%
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.f6478.3
Applied rewrites78.3%
if 3.9999999999999998e-144 < (/.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.10000000000000001Initial program 95.3%
Taylor expanded in ky around 0
lower-sin.f6455.7
Applied rewrites55.7%
if 0.10000000000000001 < (/.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 90.1%
Taylor expanded in kx around 0
lower-sin.f6463.8
Applied rewrites63.8%
Final simplification64.7%
(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.2)
(* th (* (sin ky) (sqrt (/ 1.0 (fma -0.5 (cos (* ky -2.0)) 0.5)))))
(if (<= t_1 4e-144)
(*
(sin th)
(* (sqrt (/ 1.0 (- 1.0 (cos (* kx -2.0))))) (* ky (sqrt 2.0))))
(if (<= t_1 0.1) (* (sin th) (/ (sin ky) (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.2) {
tmp = th * (sin(ky) * sqrt((1.0 / fma(-0.5, cos((ky * -2.0)), 0.5))));
} else if (t_1 <= 4e-144) {
tmp = sin(th) * (sqrt((1.0 / (1.0 - cos((kx * -2.0))))) * (ky * sqrt(2.0)));
} else if (t_1 <= 0.1) {
tmp = sin(th) * (sin(ky) / 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.2) tmp = Float64(th * Float64(sin(ky) * sqrt(Float64(1.0 / fma(-0.5, cos(Float64(ky * -2.0)), 0.5))))); elseif (t_1 <= 4e-144) tmp = Float64(sin(th) * Float64(sqrt(Float64(1.0 / Float64(1.0 - cos(Float64(kx * -2.0))))) * Float64(ky * sqrt(2.0)))); elseif (t_1 <= 0.1) tmp = Float64(sin(th) * Float64(sin(ky) / 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.2], N[(th * N[(N[Sin[ky], $MachinePrecision] * N[Sqrt[N[(1.0 / N[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 4e-144], 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], If[LessEqual[t$95$1, 0.1], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $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.2:\\
\;\;\;\;th \cdot \left(\sin ky \cdot \sqrt{\frac{1}{\mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), 0.5\right)}}\right)\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{-144}:\\
\;\;\;\;\sin th \cdot \left(\sqrt{\frac{1}{1 - \cos \left(kx \cdot -2\right)}} \cdot \left(ky \cdot \sqrt{2}\right)\right)\\
\mathbf{elif}\;t\_1 \leq 0.1:\\
\;\;\;\;\sin th \cdot \frac{\sin 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))))) < -0.20000000000000001Initial program 93.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
Applied rewrites77.9%
Taylor expanded in kx around 0
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6457.0
Applied rewrites57.0%
Taylor expanded in th around 0
Applied rewrites30.3%
Taylor expanded in th around 0
Applied rewrites30.9%
if -0.20000000000000001 < (/.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))))) < 3.9999999999999998e-144Initial program 99.5%
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
count-2N/A
cos-diffN/A
cos-sin-sumN/A
lower--.f64N/A
count-2N/A
lower-cos.f64N/A
lower-+.f6480.7
Applied rewrites80.7%
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.f6477.2
Applied rewrites77.2%
if 3.9999999999999998e-144 < (/.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.10000000000000001Initial program 95.3%
Taylor expanded in ky around 0
lower-sin.f6455.7
Applied rewrites55.7%
if 0.10000000000000001 < (/.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 90.1%
Taylor expanded in kx around 0
lower-sin.f6463.8
Applied rewrites63.8%
Final simplification57.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 -0.2)
(* th (* (sin ky) (sqrt (/ 1.0 (fma -0.5 (cos (* ky -2.0)) 0.5)))))
(if (<= t_1 4e-144)
(*
(sin th)
(* (sqrt (/ 1.0 (- 1.0 (cos (* kx -2.0))))) (* ky (sqrt 2.0))))
(if (<= t_1 0.01) (* (sin th) (/ ky (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.2) {
tmp = th * (sin(ky) * sqrt((1.0 / fma(-0.5, cos((ky * -2.0)), 0.5))));
} else if (t_1 <= 4e-144) {
tmp = sin(th) * (sqrt((1.0 / (1.0 - cos((kx * -2.0))))) * (ky * sqrt(2.0)));
} else if (t_1 <= 0.01) {
tmp = sin(th) * (ky / 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.2) tmp = Float64(th * Float64(sin(ky) * sqrt(Float64(1.0 / fma(-0.5, cos(Float64(ky * -2.0)), 0.5))))); elseif (t_1 <= 4e-144) tmp = Float64(sin(th) * Float64(sqrt(Float64(1.0 / Float64(1.0 - cos(Float64(kx * -2.0))))) * Float64(ky * sqrt(2.0)))); elseif (t_1 <= 0.01) tmp = Float64(sin(th) * Float64(ky / 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.2], N[(th * N[(N[Sin[ky], $MachinePrecision] * N[Sqrt[N[(1.0 / N[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 4e-144], 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], If[LessEqual[t$95$1, 0.01], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $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.2:\\
\;\;\;\;th \cdot \left(\sin ky \cdot \sqrt{\frac{1}{\mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), 0.5\right)}}\right)\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{-144}:\\
\;\;\;\;\sin th \cdot \left(\sqrt{\frac{1}{1 - \cos \left(kx \cdot -2\right)}} \cdot \left(ky \cdot \sqrt{2}\right)\right)\\
\mathbf{elif}\;t\_1 \leq 0.01:\\
\;\;\;\;\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))))) < -0.20000000000000001Initial program 93.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
Applied rewrites77.9%
Taylor expanded in kx around 0
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6457.0
Applied rewrites57.0%
Taylor expanded in th around 0
Applied rewrites30.3%
Taylor expanded in th around 0
Applied rewrites30.9%
if -0.20000000000000001 < (/.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))))) < 3.9999999999999998e-144Initial program 99.5%
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
count-2N/A
cos-diffN/A
cos-sin-sumN/A
lower--.f64N/A
count-2N/A
lower-cos.f64N/A
lower-+.f6480.7
Applied rewrites80.7%
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.f6477.2
Applied rewrites77.2%
if 3.9999999999999998e-144 < (/.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.0100000000000000002Initial program 95.0%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-sin.f6458.7
Applied rewrites58.7%
if 0.0100000000000000002 < (/.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 90.3%
Taylor expanded in kx around 0
lower-sin.f6462.6
Applied rewrites62.6%
Final simplification56.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.2)
(* th (* (sin ky) (sqrt (/ 1.0 (fma -0.5 (cos (* ky -2.0)) 0.5)))))
(if (<= t_1 4e-144)
(*
(sqrt (/ 1.0 (- 1.0 (cos (* kx -2.0)))))
(* (sqrt 2.0) (* ky (sin th))))
(if (<= t_1 0.01) (* (sin th) (/ ky (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.2) {
tmp = th * (sin(ky) * sqrt((1.0 / fma(-0.5, cos((ky * -2.0)), 0.5))));
} else if (t_1 <= 4e-144) {
tmp = sqrt((1.0 / (1.0 - cos((kx * -2.0))))) * (sqrt(2.0) * (ky * sin(th)));
} else if (t_1 <= 0.01) {
tmp = sin(th) * (ky / 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.2) tmp = Float64(th * Float64(sin(ky) * sqrt(Float64(1.0 / fma(-0.5, cos(Float64(ky * -2.0)), 0.5))))); elseif (t_1 <= 4e-144) tmp = Float64(sqrt(Float64(1.0 / Float64(1.0 - cos(Float64(kx * -2.0))))) * Float64(sqrt(2.0) * Float64(ky * sin(th)))); elseif (t_1 <= 0.01) tmp = Float64(sin(th) * Float64(ky / 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.2], N[(th * N[(N[Sin[ky], $MachinePrecision] * N[Sqrt[N[(1.0 / N[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 4e-144], N[(N[Sqrt[N[(1.0 / N[(1.0 - N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] * N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.01], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $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.2:\\
\;\;\;\;th \cdot \left(\sin ky \cdot \sqrt{\frac{1}{\mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), 0.5\right)}}\right)\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{-144}:\\
\;\;\;\;\sqrt{\frac{1}{1 - \cos \left(kx \cdot -2\right)}} \cdot \left(\sqrt{2} \cdot \left(ky \cdot \sin th\right)\right)\\
\mathbf{elif}\;t\_1 \leq 0.01:\\
\;\;\;\;\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))))) < -0.20000000000000001Initial program 93.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
Applied rewrites77.9%
Taylor expanded in kx around 0
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6457.0
Applied rewrites57.0%
Taylor expanded in th around 0
Applied rewrites30.3%
Taylor expanded in th around 0
Applied rewrites30.9%
if -0.20000000000000001 < (/.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))))) < 3.9999999999999998e-144Initial program 99.5%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
Applied rewrites77.6%
Taylor expanded in ky around 0
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.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-*.f6476.9
Applied rewrites76.9%
if 3.9999999999999998e-144 < (/.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.0100000000000000002Initial program 95.0%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-sin.f6458.7
Applied rewrites58.7%
if 0.0100000000000000002 < (/.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 90.3%
Taylor expanded in kx around 0
lower-sin.f6462.6
Applied rewrites62.6%
Final simplification56.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.2)
(* th (* (sin ky) (sqrt (/ 1.0 (fma -0.5 (cos (* ky -2.0)) 0.5)))))
(if (<= t_1 0.01) (* (sin th) (/ ky (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.2) {
tmp = th * (sin(ky) * sqrt((1.0 / fma(-0.5, cos((ky * -2.0)), 0.5))));
} else if (t_1 <= 0.01) {
tmp = sin(th) * (ky / 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.2) tmp = Float64(th * Float64(sin(ky) * sqrt(Float64(1.0 / fma(-0.5, cos(Float64(ky * -2.0)), 0.5))))); elseif (t_1 <= 0.01) tmp = Float64(sin(th) * Float64(ky / 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.2], N[(th * N[(N[Sin[ky], $MachinePrecision] * N[Sqrt[N[(1.0 / N[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.01], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $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.2:\\
\;\;\;\;th \cdot \left(\sin ky \cdot \sqrt{\frac{1}{\mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), 0.5\right)}}\right)\\
\mathbf{elif}\;t\_1 \leq 0.01:\\
\;\;\;\;\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))))) < -0.20000000000000001Initial program 93.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
Applied rewrites77.9%
Taylor expanded in kx around 0
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6457.0
Applied rewrites57.0%
Taylor expanded in th around 0
Applied rewrites30.3%
Taylor expanded in th around 0
Applied rewrites30.9%
if -0.20000000000000001 < (/.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.0100000000000000002Initial program 98.4%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-sin.f6463.6
Applied rewrites63.6%
if 0.0100000000000000002 < (/.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 90.3%
Taylor expanded in kx around 0
lower-sin.f6462.6
Applied rewrites62.6%
Final simplification53.6%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 0.01) (* (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)))) <= 0.01) {
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)))) <= 0.01d0) 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)))) <= 0.01) {
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)))) <= 0.01: 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)))) <= 0.01) 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)))) <= 0.01) 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], 0.01], 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 0.01:\\
\;\;\;\;\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))))) < 0.0100000000000000002Initial program 96.1%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-sin.f6437.3
Applied rewrites37.3%
if 0.0100000000000000002 < (/.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 90.3%
Taylor expanded in kx around 0
lower-sin.f6462.6
Applied rewrites62.6%
Final simplification45.5%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 0.01) (/ (* 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)))) <= 0.01) {
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)))) <= 0.01d0) 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)))) <= 0.01) {
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)))) <= 0.01: 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)))) <= 0.01) 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)))) <= 0.01) 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], 0.01], 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 0.01:\\
\;\;\;\;\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))))) < 0.0100000000000000002Initial program 96.1%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f6436.8
Applied rewrites36.8%
if 0.0100000000000000002 < (/.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 90.3%
Taylor expanded in kx around 0
lower-sin.f6462.6
Applied rewrites62.6%
(FPCore (kx ky th)
:precision binary64
(if (<=
(*
(sin th)
(/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))))
5e-295)
(* -0.16666666666666666 (* th (* th th)))
(*
th
(fma
(* th th)
(fma 0.008333333333333333 (* th th) -0.16666666666666666)
1.0))))
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))))) <= 5e-295) {
tmp = -0.16666666666666666 * (th * (th * th));
} else {
tmp = th * fma((th * th), fma(0.008333333333333333, (th * th), -0.16666666666666666), 1.0);
}
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))))) <= 5e-295) tmp = Float64(-0.16666666666666666 * Float64(th * Float64(th * th))); else tmp = Float64(th * fma(Float64(th * th), fma(0.008333333333333333, Float64(th * th), -0.16666666666666666), 1.0)); 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], 5e-295], 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] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin th \cdot \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 5 \cdot 10^{-295}:\\
\;\;\;\;-0.16666666666666666 \cdot \left(th \cdot \left(th \cdot th\right)\right)\\
\mathbf{else}:\\
\;\;\;\;th \cdot \mathsf{fma}\left(th \cdot th, \mathsf{fma}\left(0.008333333333333333, th \cdot th, -0.16666666666666666\right), 1\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)) < 5.00000000000000008e-295Initial program 94.0%
Taylor expanded in kx around 0
lower-sin.f6422.9
Applied rewrites22.9%
Taylor expanded in th around 0
Applied rewrites13.1%
Taylor expanded in th around inf
Applied rewrites16.1%
if 5.00000000000000008e-295 < (*.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 94.6%
Taylor expanded in kx around 0
lower-sin.f6423.0
Applied rewrites23.0%
Taylor expanded in th around 0
Applied rewrites11.4%
Taylor expanded in th around 0
Applied rewrites11.3%
Final simplification13.9%
(FPCore (kx ky th)
:precision binary64
(if (<=
(*
(sin th)
(/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))))
5e-295)
(* -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))))) <= 5e-295) {
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))))) <= 5e-295) 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], 5e-295], 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 5 \cdot 10^{-295}:\\
\;\;\;\;-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)) < 5.00000000000000008e-295Initial program 94.0%
Taylor expanded in kx around 0
lower-sin.f6422.9
Applied rewrites22.9%
Taylor expanded in th around 0
Applied rewrites13.1%
Taylor expanded in th around inf
Applied rewrites16.1%
if 5.00000000000000008e-295 < (*.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 94.6%
Taylor expanded in kx around 0
lower-sin.f6423.0
Applied rewrites23.0%
Taylor expanded in th around 0
Applied rewrites11.4%
Final simplification14.0%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 2e-90) (* -0.16666666666666666 (* th (* th th))) (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-90) {
tmp = -0.16666666666666666 * (th * (th * th));
} 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-90) then
tmp = (-0.16666666666666666d0) * (th * (th * th))
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-90) {
tmp = -0.16666666666666666 * (th * (th * th));
} 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-90: tmp = -0.16666666666666666 * (th * (th * th)) 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-90) tmp = Float64(-0.16666666666666666 * Float64(th * Float64(th * th))); 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-90) tmp = -0.16666666666666666 * (th * (th * th)); 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-90], N[(-0.16666666666666666 * N[(th * N[(th * th), $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^{-90}:\\
\;\;\;\;-0.16666666666666666 \cdot \left(th \cdot \left(th \cdot th\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))))) < 1.99999999999999999e-90Initial program 96.3%
Taylor expanded in kx around 0
lower-sin.f643.5
Applied rewrites3.5%
Taylor expanded in th around 0
Applied rewrites3.4%
Taylor expanded in th around inf
Applied rewrites14.7%
if 1.99999999999999999e-90 < (/.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 90.9%
Taylor expanded in kx around 0
lower-sin.f6453.9
Applied rewrites53.9%
(FPCore (kx ky th)
:precision binary64
(if (<= ky 0.003)
(*
(sin th)
(/
(sin ky)
(hypot (fma ky (* (* ky ky) -0.16666666666666666) ky) (sin kx))))
(*
(* (sin ky) (sin th))
(sqrt
(/
1.0
(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 (ky <= 0.003) {
tmp = sin(th) * (sin(ky) / hypot(fma(ky, ((ky * ky) * -0.16666666666666666), ky), sin(kx)));
} else {
tmp = (sin(ky) * sin(th)) * sqrt((1.0 / 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 (ky <= 0.003) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(fma(ky, Float64(Float64(ky * ky) * -0.16666666666666666), ky), sin(kx)))); else tmp = Float64(Float64(sin(ky) * sin(th)) * sqrt(Float64(1.0 / 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[ky, 0.003], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(ky * N[(N[(ky * ky), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] + ky), $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sin[ky], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(1.0 / 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}\;ky \leq 0.003:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\mathsf{fma}\left(ky, \left(ky \cdot ky\right) \cdot -0.16666666666666666, ky\right), \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(\sin ky \cdot \sin th\right) \cdot \sqrt{\frac{1}{\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 ky < 0.0030000000000000001Initial 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.6
Applied rewrites99.6%
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-*.f6467.0
Applied rewrites67.0%
if 0.0030000000000000001 < ky Initial program 99.7%
Applied rewrites97.2%
Final simplification73.9%
(FPCore (kx ky th)
:precision binary64
(if (<= ky 0.0032)
(*
(sin th)
(/
(sin ky)
(hypot (fma ky (* (* ky ky) -0.16666666666666666) ky) (sin kx))))
(/
(* (sin ky) (sin th))
(sqrt (fma (- 1.0 (cos (+ kx kx))) 0.5 (fma (cos (+ ky ky)) -0.5 0.5))))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 0.0032) {
tmp = sin(th) * (sin(ky) / hypot(fma(ky, ((ky * ky) * -0.16666666666666666), ky), sin(kx)));
} else {
tmp = (sin(ky) * sin(th)) / sqrt(fma((1.0 - cos((kx + kx))), 0.5, fma(cos((ky + ky)), -0.5, 0.5)));
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (ky <= 0.0032) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(fma(ky, Float64(Float64(ky * ky) * -0.16666666666666666), ky), sin(kx)))); else tmp = Float64(Float64(sin(ky) * sin(th)) / sqrt(fma(Float64(1.0 - cos(Float64(kx + kx))), 0.5, fma(cos(Float64(ky + ky)), -0.5, 0.5)))); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[ky, 0.0032], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(ky * N[(N[(ky * ky), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] + ky), $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sin[ky], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(N[(1.0 - N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5 + N[(N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision] * -0.5 + 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 0.0032:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\mathsf{fma}\left(ky, \left(ky \cdot ky\right) \cdot -0.16666666666666666, ky\right), \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky \cdot \sin th}{\sqrt{\mathsf{fma}\left(1 - \cos \left(kx + kx\right), 0.5, \mathsf{fma}\left(\cos \left(ky + ky\right), -0.5, 0.5\right)\right)}}\\
\end{array}
\end{array}
if ky < 0.00320000000000000015Initial 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.6
Applied rewrites99.6%
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-*.f6467.0
Applied rewrites67.0%
if 0.00320000000000000015 < ky Initial program 99.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6499.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 rewrites97.1%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
flip-+N/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
flip-+N/A
lift-+.f64N/A
lower-fma.f6411.3
lift-+.f64N/A
flip-+N/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
flip-+N/A
lift-+.f6497.1
Applied rewrites97.1%
Final simplification73.8%
(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 94.2%
Taylor expanded in kx around 0
lower-sin.f6423.0
Applied rewrites23.0%
Taylor expanded in th around 0
Applied rewrites12.3%
Taylor expanded in th around inf
Applied rewrites10.5%
herbie shell --seed 2024226
(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)))