
(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 34 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 95.9%
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 (pow (sin kx) 2.0))
(t_2 (pow (sin ky) 2.0))
(t_3 (/ (sin ky) (sqrt (+ t_1 t_2)))))
(if (<= t_3 -1.0)
(* (/ (sin ky) (sqrt t_2)) (sin th))
(if (<= t_3 -0.12)
(*
(/ (sin ky) (hypot (sin ky) (sin kx)))
(fma
(* th (* th th))
(-
(*
(* (fma (* th th) -0.0001984126984126984 0.008333333333333333) th)
th)
0.16666666666666666)
th))
(if (<= t_3 0.0002)
(* (/ (sin ky) (sqrt (+ t_1 (* ky ky)))) (sin th))
(if (<= t_3 0.998)
(/ (* th (sin ky)) (hypot (sin kx) (sin ky)))
(if (<= t_3 2.0)
(* (fma (* kx (/ kx t_2)) -0.5 1.0) (sin th))
(*
(/
(sin ky)
(hypot
(* (fma (* ky ky) -0.16666666666666666 1.0) ky)
(sin kx)))
(sin th)))))))))
double code(double kx, double ky, double th) {
double t_1 = pow(sin(kx), 2.0);
double t_2 = pow(sin(ky), 2.0);
double t_3 = sin(ky) / sqrt((t_1 + t_2));
double tmp;
if (t_3 <= -1.0) {
tmp = (sin(ky) / sqrt(t_2)) * sin(th);
} else if (t_3 <= -0.12) {
tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * fma((th * (th * th)), (((fma((th * th), -0.0001984126984126984, 0.008333333333333333) * th) * th) - 0.16666666666666666), th);
} else if (t_3 <= 0.0002) {
tmp = (sin(ky) / sqrt((t_1 + (ky * ky)))) * sin(th);
} else if (t_3 <= 0.998) {
tmp = (th * sin(ky)) / hypot(sin(kx), sin(ky));
} else if (t_3 <= 2.0) {
tmp = fma((kx * (kx / t_2)), -0.5, 1.0) * sin(th);
} else {
tmp = (sin(ky) / hypot((fma((ky * ky), -0.16666666666666666, 1.0) * ky), sin(kx))) * sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = sin(kx) ^ 2.0 t_2 = sin(ky) ^ 2.0 t_3 = Float64(sin(ky) / sqrt(Float64(t_1 + t_2))) tmp = 0.0 if (t_3 <= -1.0) tmp = Float64(Float64(sin(ky) / sqrt(t_2)) * sin(th)); elseif (t_3 <= -0.12) tmp = Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * fma(Float64(th * Float64(th * th)), Float64(Float64(Float64(fma(Float64(th * th), -0.0001984126984126984, 0.008333333333333333) * th) * th) - 0.16666666666666666), th)); elseif (t_3 <= 0.0002) tmp = Float64(Float64(sin(ky) / sqrt(Float64(t_1 + Float64(ky * ky)))) * sin(th)); elseif (t_3 <= 0.998) tmp = Float64(Float64(th * sin(ky)) / hypot(sin(kx), sin(ky))); elseif (t_3 <= 2.0) tmp = Float64(fma(Float64(kx * Float64(kx / t_2)), -0.5, 1.0) * sin(th)); else tmp = Float64(Float64(sin(ky) / hypot(Float64(fma(Float64(ky * ky), -0.16666666666666666, 1.0) * ky), sin(kx))) * sin(th)); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$3 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$1 + t$95$2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, -1.0], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[t$95$2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, -0.12], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[(N[(th * N[(th * th), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(N[(th * th), $MachinePrecision] * -0.0001984126984126984 + 0.008333333333333333), $MachinePrecision] * th), $MachinePrecision] * th), $MachinePrecision] - 0.16666666666666666), $MachinePrecision] + th), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 0.0002], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$1 + N[(ky * ky), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 0.998], N[(N[(th * N[Sin[ky], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 2.0], N[(N[(N[(kx * N[(kx / t$95$2), $MachinePrecision]), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[(N[(ky * ky), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * ky), $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := {\sin kx}^{2}\\
t_2 := {\sin ky}^{2}\\
t_3 := \frac{\sin ky}{\sqrt{t\_1 + t\_2}}\\
\mathbf{if}\;t\_3 \leq -1:\\
\;\;\;\;\frac{\sin ky}{\sqrt{t\_2}} \cdot \sin th\\
\mathbf{elif}\;t\_3 \leq -0.12:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot \mathsf{fma}\left(th \cdot \left(th \cdot th\right), \left(\mathsf{fma}\left(th \cdot th, -0.0001984126984126984, 0.008333333333333333\right) \cdot th\right) \cdot th - 0.16666666666666666, th\right)\\
\mathbf{elif}\;t\_3 \leq 0.0002:\\
\;\;\;\;\frac{\sin ky}{\sqrt{t\_1 + ky \cdot ky}} \cdot \sin th\\
\mathbf{elif}\;t\_3 \leq 0.998:\\
\;\;\;\;\frac{th \cdot \sin ky}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}\\
\mathbf{elif}\;t\_3 \leq 2:\\
\;\;\;\;\mathsf{fma}\left(kx \cdot \frac{kx}{t\_2}, -0.5, 1\right) \cdot \sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\mathsf{fma}\left(ky \cdot ky, -0.16666666666666666, 1\right) \cdot ky, \sin kx\right)} \cdot \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))))) < -1Initial program 82.4%
lift-pow.f64N/A
unpow2N/A
sqr-neg-revN/A
lift-sin.f64N/A
cos-+PI/2-revN/A
lift-sin.f64N/A
cos-+PI/2-revN/A
1-sub-sin-revN/A
metadata-evalN/A
sin-+PI/2-revN/A
sin-+PI/2-revN/A
lower--.f64N/A
metadata-evalN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-cos.f6462.1
Applied rewrites62.1%
Taylor expanded in kx around 0
unpow2N/A
1-sub-cosN/A
unpow2N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6482.4
Applied rewrites82.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.12Initial program 99.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.2
Applied rewrites99.2%
Taylor expanded in th around 0
+-commutativeN/A
distribute-lft-inN/A
associate-*r*N/A
*-rgt-identityN/A
lower-fma.f64N/A
Applied rewrites52.4%
if -0.12 < (/.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))))) < 2.0000000000000001e-4Initial program 99.6%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6497.5
Applied rewrites97.5%
if 2.0000000000000001e-4 < (/.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.998Initial program 99.5%
Taylor expanded in th around 0
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
unpow2N/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-pow.f64N/A
lower-sin.f6450.1
Applied rewrites50.1%
Applied rewrites50.1%
if 0.998 < (/.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))))) < 2Initial program 100.0%
Taylor expanded in kx around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-sin.f6497.7
Applied rewrites97.7%
if 2 < (/.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 2.0%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f64100.0
Applied rewrites100.0%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64100.0
Applied rewrites100.0%
Final simplification81.8%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (pow (sin kx) 2.0))
(t_2 (pow (sin ky) 2.0))
(t_3 (/ (sin ky) (sqrt (+ t_1 t_2)))))
(if (<= t_3 -1.0)
(* (/ (sin ky) (sqrt t_2)) (sin th))
(if (<= t_3 -0.12)
(*
(/ (sin ky) (hypot (sin ky) (sin kx)))
(*
(fma
(- (* (* th th) 0.008333333333333333) 0.16666666666666666)
(* th th)
1.0)
th))
(if (<= t_3 0.0002)
(* (/ (sin ky) (sqrt (+ t_1 (* ky ky)))) (sin th))
(if (<= t_3 0.998)
(/ (* th (sin ky)) (hypot (sin kx) (sin ky)))
(if (<= t_3 2.0)
(* (fma (* kx (/ kx t_2)) -0.5 1.0) (sin th))
(*
(/
(sin ky)
(hypot
(* (fma (* ky ky) -0.16666666666666666 1.0) ky)
(sin kx)))
(sin th)))))))))
double code(double kx, double ky, double th) {
double t_1 = pow(sin(kx), 2.0);
double t_2 = pow(sin(ky), 2.0);
double t_3 = sin(ky) / sqrt((t_1 + t_2));
double tmp;
if (t_3 <= -1.0) {
tmp = (sin(ky) / sqrt(t_2)) * sin(th);
} else if (t_3 <= -0.12) {
tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * (fma((((th * th) * 0.008333333333333333) - 0.16666666666666666), (th * th), 1.0) * th);
} else if (t_3 <= 0.0002) {
tmp = (sin(ky) / sqrt((t_1 + (ky * ky)))) * sin(th);
} else if (t_3 <= 0.998) {
tmp = (th * sin(ky)) / hypot(sin(kx), sin(ky));
} else if (t_3 <= 2.0) {
tmp = fma((kx * (kx / t_2)), -0.5, 1.0) * sin(th);
} else {
tmp = (sin(ky) / hypot((fma((ky * ky), -0.16666666666666666, 1.0) * ky), sin(kx))) * sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = sin(kx) ^ 2.0 t_2 = sin(ky) ^ 2.0 t_3 = Float64(sin(ky) / sqrt(Float64(t_1 + t_2))) tmp = 0.0 if (t_3 <= -1.0) tmp = Float64(Float64(sin(ky) / sqrt(t_2)) * sin(th)); elseif (t_3 <= -0.12) tmp = Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * Float64(fma(Float64(Float64(Float64(th * th) * 0.008333333333333333) - 0.16666666666666666), Float64(th * th), 1.0) * th)); elseif (t_3 <= 0.0002) tmp = Float64(Float64(sin(ky) / sqrt(Float64(t_1 + Float64(ky * ky)))) * sin(th)); elseif (t_3 <= 0.998) tmp = Float64(Float64(th * sin(ky)) / hypot(sin(kx), sin(ky))); elseif (t_3 <= 2.0) tmp = Float64(fma(Float64(kx * Float64(kx / t_2)), -0.5, 1.0) * sin(th)); else tmp = Float64(Float64(sin(ky) / hypot(Float64(fma(Float64(ky * ky), -0.16666666666666666, 1.0) * ky), sin(kx))) * sin(th)); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$3 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$1 + t$95$2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, -1.0], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[t$95$2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, -0.12], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(N[(th * th), $MachinePrecision] * 0.008333333333333333), $MachinePrecision] - 0.16666666666666666), $MachinePrecision] * N[(th * th), $MachinePrecision] + 1.0), $MachinePrecision] * th), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 0.0002], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$1 + N[(ky * ky), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 0.998], N[(N[(th * N[Sin[ky], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 2.0], N[(N[(N[(kx * N[(kx / t$95$2), $MachinePrecision]), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[(N[(ky * ky), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * ky), $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := {\sin kx}^{2}\\
t_2 := {\sin ky}^{2}\\
t_3 := \frac{\sin ky}{\sqrt{t\_1 + t\_2}}\\
\mathbf{if}\;t\_3 \leq -1:\\
\;\;\;\;\frac{\sin ky}{\sqrt{t\_2}} \cdot \sin th\\
\mathbf{elif}\;t\_3 \leq -0.12:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot \left(\mathsf{fma}\left(\left(th \cdot th\right) \cdot 0.008333333333333333 - 0.16666666666666666, th \cdot th, 1\right) \cdot th\right)\\
\mathbf{elif}\;t\_3 \leq 0.0002:\\
\;\;\;\;\frac{\sin ky}{\sqrt{t\_1 + ky \cdot ky}} \cdot \sin th\\
\mathbf{elif}\;t\_3 \leq 0.998:\\
\;\;\;\;\frac{th \cdot \sin ky}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}\\
\mathbf{elif}\;t\_3 \leq 2:\\
\;\;\;\;\mathsf{fma}\left(kx \cdot \frac{kx}{t\_2}, -0.5, 1\right) \cdot \sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\mathsf{fma}\left(ky \cdot ky, -0.16666666666666666, 1\right) \cdot ky, \sin kx\right)} \cdot \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))))) < -1Initial program 82.4%
lift-pow.f64N/A
unpow2N/A
sqr-neg-revN/A
lift-sin.f64N/A
cos-+PI/2-revN/A
lift-sin.f64N/A
cos-+PI/2-revN/A
1-sub-sin-revN/A
metadata-evalN/A
sin-+PI/2-revN/A
sin-+PI/2-revN/A
lower--.f64N/A
metadata-evalN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-cos.f6462.1
Applied rewrites62.1%
Taylor expanded in kx around 0
unpow2N/A
1-sub-cosN/A
unpow2N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6482.4
Applied rewrites82.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.12Initial program 99.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.2
Applied rewrites99.2%
Taylor expanded in th around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6452.0
Applied rewrites52.0%
if -0.12 < (/.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))))) < 2.0000000000000001e-4Initial program 99.6%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6497.5
Applied rewrites97.5%
if 2.0000000000000001e-4 < (/.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.998Initial program 99.5%
Taylor expanded in th around 0
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
unpow2N/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-pow.f64N/A
lower-sin.f6450.1
Applied rewrites50.1%
Applied rewrites50.1%
if 0.998 < (/.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))))) < 2Initial program 100.0%
Taylor expanded in kx around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-sin.f6497.7
Applied rewrites97.7%
if 2 < (/.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 2.0%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f64100.0
Applied rewrites100.0%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64100.0
Applied rewrites100.0%
Final simplification81.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (pow (sin kx) 2.0))
(t_2 (pow (sin ky) 2.0))
(t_3 (/ (sin ky) (sqrt (+ t_1 t_2)))))
(if (<= t_3 -1.0)
(* (/ (sin ky) (sqrt t_2)) (sin th))
(if (<= t_3 -0.12)
(*
(/
(sin ky)
(/
(sqrt
(fma
(- 1.0 (cos (* 2.0 ky)))
2.0
(* 2.0 (- 1.0 (cos (* -2.0 kx))))))
2.0))
(* (fma (* th th) -0.16666666666666666 1.0) th))
(if (<= t_3 0.0002)
(* (/ (sin ky) (sqrt (+ t_1 (* ky ky)))) (sin th))
(if (<= t_3 0.998)
(/ (* th (sin ky)) (hypot (sin kx) (sin ky)))
(if (<= t_3 2.0)
(* (fma (* kx (/ kx t_2)) -0.5 1.0) (sin th))
(*
(/
(sin ky)
(hypot
(* (fma (* ky ky) -0.16666666666666666 1.0) ky)
(sin kx)))
(sin th)))))))))
double code(double kx, double ky, double th) {
double t_1 = pow(sin(kx), 2.0);
double t_2 = pow(sin(ky), 2.0);
double t_3 = sin(ky) / sqrt((t_1 + t_2));
double tmp;
if (t_3 <= -1.0) {
tmp = (sin(ky) / sqrt(t_2)) * sin(th);
} else if (t_3 <= -0.12) {
tmp = (sin(ky) / (sqrt(fma((1.0 - cos((2.0 * ky))), 2.0, (2.0 * (1.0 - cos((-2.0 * kx)))))) / 2.0)) * (fma((th * th), -0.16666666666666666, 1.0) * th);
} else if (t_3 <= 0.0002) {
tmp = (sin(ky) / sqrt((t_1 + (ky * ky)))) * sin(th);
} else if (t_3 <= 0.998) {
tmp = (th * sin(ky)) / hypot(sin(kx), sin(ky));
} else if (t_3 <= 2.0) {
tmp = fma((kx * (kx / t_2)), -0.5, 1.0) * sin(th);
} else {
tmp = (sin(ky) / hypot((fma((ky * ky), -0.16666666666666666, 1.0) * ky), sin(kx))) * sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = sin(kx) ^ 2.0 t_2 = sin(ky) ^ 2.0 t_3 = Float64(sin(ky) / sqrt(Float64(t_1 + t_2))) tmp = 0.0 if (t_3 <= -1.0) tmp = Float64(Float64(sin(ky) / sqrt(t_2)) * sin(th)); elseif (t_3 <= -0.12) tmp = Float64(Float64(sin(ky) / Float64(sqrt(fma(Float64(1.0 - cos(Float64(2.0 * ky))), 2.0, Float64(2.0 * Float64(1.0 - cos(Float64(-2.0 * kx)))))) / 2.0)) * Float64(fma(Float64(th * th), -0.16666666666666666, 1.0) * th)); elseif (t_3 <= 0.0002) tmp = Float64(Float64(sin(ky) / sqrt(Float64(t_1 + Float64(ky * ky)))) * sin(th)); elseif (t_3 <= 0.998) tmp = Float64(Float64(th * sin(ky)) / hypot(sin(kx), sin(ky))); elseif (t_3 <= 2.0) tmp = Float64(fma(Float64(kx * Float64(kx / t_2)), -0.5, 1.0) * sin(th)); else tmp = Float64(Float64(sin(ky) / hypot(Float64(fma(Float64(ky * ky), -0.16666666666666666, 1.0) * ky), sin(kx))) * sin(th)); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$3 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$1 + t$95$2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, -1.0], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[t$95$2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, -0.12], N[(N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[(N[(1.0 - N[Cos[N[(2.0 * ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 2.0 + N[(2.0 * N[(1.0 - N[Cos[N[(-2.0 * kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(th * th), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * th), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 0.0002], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$1 + N[(ky * ky), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 0.998], N[(N[(th * N[Sin[ky], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 2.0], N[(N[(N[(kx * N[(kx / t$95$2), $MachinePrecision]), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[(N[(ky * ky), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * ky), $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := {\sin kx}^{2}\\
t_2 := {\sin ky}^{2}\\
t_3 := \frac{\sin ky}{\sqrt{t\_1 + t\_2}}\\
\mathbf{if}\;t\_3 \leq -1:\\
\;\;\;\;\frac{\sin ky}{\sqrt{t\_2}} \cdot \sin th\\
\mathbf{elif}\;t\_3 \leq -0.12:\\
\;\;\;\;\frac{\sin ky}{\frac{\sqrt{\mathsf{fma}\left(1 - \cos \left(2 \cdot ky\right), 2, 2 \cdot \left(1 - \cos \left(-2 \cdot kx\right)\right)\right)}}{2}} \cdot \left(\mathsf{fma}\left(th \cdot th, -0.16666666666666666, 1\right) \cdot th\right)\\
\mathbf{elif}\;t\_3 \leq 0.0002:\\
\;\;\;\;\frac{\sin ky}{\sqrt{t\_1 + ky \cdot ky}} \cdot \sin th\\
\mathbf{elif}\;t\_3 \leq 0.998:\\
\;\;\;\;\frac{th \cdot \sin ky}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}\\
\mathbf{elif}\;t\_3 \leq 2:\\
\;\;\;\;\mathsf{fma}\left(kx \cdot \frac{kx}{t\_2}, -0.5, 1\right) \cdot \sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\mathsf{fma}\left(ky \cdot ky, -0.16666666666666666, 1\right) \cdot ky, \sin kx\right)} \cdot \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))))) < -1Initial program 82.4%
lift-pow.f64N/A
unpow2N/A
sqr-neg-revN/A
lift-sin.f64N/A
cos-+PI/2-revN/A
lift-sin.f64N/A
cos-+PI/2-revN/A
1-sub-sin-revN/A
metadata-evalN/A
sin-+PI/2-revN/A
sin-+PI/2-revN/A
lower--.f64N/A
metadata-evalN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-cos.f6462.1
Applied rewrites62.1%
Taylor expanded in kx around 0
unpow2N/A
1-sub-cosN/A
unpow2N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6482.4
Applied rewrites82.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.12Initial program 99.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.2
Applied rewrites99.2%
Taylor expanded in th around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6451.7
Applied rewrites51.7%
lift-hypot.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
frac-addN/A
metadata-evalN/A
metadata-evalN/A
sqrt-divN/A
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites51.8%
if -0.12 < (/.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))))) < 2.0000000000000001e-4Initial program 99.6%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6497.5
Applied rewrites97.5%
if 2.0000000000000001e-4 < (/.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.998Initial program 99.5%
Taylor expanded in th around 0
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
unpow2N/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-pow.f64N/A
lower-sin.f6450.1
Applied rewrites50.1%
Applied rewrites50.1%
if 0.998 < (/.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))))) < 2Initial program 100.0%
Taylor expanded in kx around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-sin.f6497.7
Applied rewrites97.7%
if 2 < (/.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 2.0%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f64100.0
Applied rewrites100.0%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64100.0
Applied rewrites100.0%
Final simplification81.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1
(*
(/
(sin ky)
(hypot (* (fma (* ky ky) -0.16666666666666666 1.0) ky) (sin kx)))
(sin th)))
(t_2 (pow (sin ky) 2.0))
(t_3 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) t_2)))))
(if (<= t_3 -1.0)
(* (/ (sin ky) (sqrt t_2)) (sin th))
(if (<= t_3 -0.12)
(*
(/
(sin ky)
(/
(sqrt
(fma
(- 1.0 (cos (* 2.0 ky)))
2.0
(* 2.0 (- 1.0 (cos (* -2.0 kx))))))
2.0))
(* (fma (* th th) -0.16666666666666666 1.0) th))
(if (<= t_3 0.1)
t_1
(if (<= t_3 0.998)
(/ (* th (sin ky)) (hypot (sin kx) (sin ky)))
(if (<= t_3 2.0)
(* (fma (* kx (/ kx t_2)) -0.5 1.0) (sin th))
t_1)))))))
double code(double kx, double ky, double th) {
double t_1 = (sin(ky) / hypot((fma((ky * ky), -0.16666666666666666, 1.0) * ky), sin(kx))) * sin(th);
double t_2 = pow(sin(ky), 2.0);
double t_3 = sin(ky) / sqrt((pow(sin(kx), 2.0) + t_2));
double tmp;
if (t_3 <= -1.0) {
tmp = (sin(ky) / sqrt(t_2)) * sin(th);
} else if (t_3 <= -0.12) {
tmp = (sin(ky) / (sqrt(fma((1.0 - cos((2.0 * ky))), 2.0, (2.0 * (1.0 - cos((-2.0 * kx)))))) / 2.0)) * (fma((th * th), -0.16666666666666666, 1.0) * th);
} else if (t_3 <= 0.1) {
tmp = t_1;
} else if (t_3 <= 0.998) {
tmp = (th * sin(ky)) / hypot(sin(kx), sin(ky));
} else if (t_3 <= 2.0) {
tmp = fma((kx * (kx / t_2)), -0.5, 1.0) * sin(th);
} else {
tmp = t_1;
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(Float64(sin(ky) / hypot(Float64(fma(Float64(ky * ky), -0.16666666666666666, 1.0) * ky), sin(kx))) * sin(th)) t_2 = sin(ky) ^ 2.0 t_3 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + t_2))) tmp = 0.0 if (t_3 <= -1.0) tmp = Float64(Float64(sin(ky) / sqrt(t_2)) * sin(th)); elseif (t_3 <= -0.12) tmp = Float64(Float64(sin(ky) / Float64(sqrt(fma(Float64(1.0 - cos(Float64(2.0 * ky))), 2.0, Float64(2.0 * Float64(1.0 - cos(Float64(-2.0 * kx)))))) / 2.0)) * Float64(fma(Float64(th * th), -0.16666666666666666, 1.0) * th)); elseif (t_3 <= 0.1) tmp = t_1; elseif (t_3 <= 0.998) tmp = Float64(Float64(th * sin(ky)) / hypot(sin(kx), sin(ky))); elseif (t_3 <= 2.0) tmp = Float64(fma(Float64(kx * Float64(kx / t_2)), -0.5, 1.0) * sin(th)); else tmp = t_1; end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[(N[(ky * ky), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * ky), $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$3 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + t$95$2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, -1.0], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[t$95$2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, -0.12], N[(N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[(N[(1.0 - N[Cos[N[(2.0 * ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 2.0 + N[(2.0 * N[(1.0 - N[Cos[N[(-2.0 * kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(th * th), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * th), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 0.1], t$95$1, If[LessEqual[t$95$3, 0.998], N[(N[(th * N[Sin[ky], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 2.0], N[(N[(N[(kx * N[(kx / t$95$2), $MachinePrecision]), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\mathsf{hypot}\left(\mathsf{fma}\left(ky \cdot ky, -0.16666666666666666, 1\right) \cdot ky, \sin kx\right)} \cdot \sin th\\
t_2 := {\sin ky}^{2}\\
t_3 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + t\_2}}\\
\mathbf{if}\;t\_3 \leq -1:\\
\;\;\;\;\frac{\sin ky}{\sqrt{t\_2}} \cdot \sin th\\
\mathbf{elif}\;t\_3 \leq -0.12:\\
\;\;\;\;\frac{\sin ky}{\frac{\sqrt{\mathsf{fma}\left(1 - \cos \left(2 \cdot ky\right), 2, 2 \cdot \left(1 - \cos \left(-2 \cdot kx\right)\right)\right)}}{2}} \cdot \left(\mathsf{fma}\left(th \cdot th, -0.16666666666666666, 1\right) \cdot th\right)\\
\mathbf{elif}\;t\_3 \leq 0.1:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_3 \leq 0.998:\\
\;\;\;\;\frac{th \cdot \sin ky}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}\\
\mathbf{elif}\;t\_3 \leq 2:\\
\;\;\;\;\mathsf{fma}\left(kx \cdot \frac{kx}{t\_2}, -0.5, 1\right) \cdot \sin th\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\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 82.4%
lift-pow.f64N/A
unpow2N/A
sqr-neg-revN/A
lift-sin.f64N/A
cos-+PI/2-revN/A
lift-sin.f64N/A
cos-+PI/2-revN/A
1-sub-sin-revN/A
metadata-evalN/A
sin-+PI/2-revN/A
sin-+PI/2-revN/A
lower--.f64N/A
metadata-evalN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-cos.f6462.1
Applied rewrites62.1%
Taylor expanded in kx around 0
unpow2N/A
1-sub-cosN/A
unpow2N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6482.4
Applied rewrites82.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.12Initial program 99.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.2
Applied rewrites99.2%
Taylor expanded in th around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6451.7
Applied rewrites51.7%
lift-hypot.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
frac-addN/A
metadata-evalN/A
metadata-evalN/A
sqrt-divN/A
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites51.8%
if -0.12 < (/.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.10000000000000001 or 2 < (/.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 98.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
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6496.5
Applied rewrites96.5%
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.998Initial program 99.5%
Taylor expanded in th around 0
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
unpow2N/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-pow.f64N/A
lower-sin.f6450.1
Applied rewrites50.1%
Applied rewrites50.2%
if 0.998 < (/.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))))) < 2Initial program 100.0%
Taylor expanded in kx around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-sin.f6497.7
Applied rewrites97.7%
Final simplification81.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (pow (sin kx) 2.0))
(t_2 (/ (sin ky) (sqrt (+ t_1 (pow (sin ky) 2.0))))))
(if (<= t_2 -1.0)
(*
(sqrt (pow (- 1.0 (cos (* -2.0 ky))) -1.0))
(* (* (sqrt 2.0) (sin th)) (sin ky)))
(if (<= t_2 -0.1)
(*
(/
(sin ky)
(/
(sqrt
(fma
(- 1.0 (cos (* 2.0 ky)))
2.0
(* 2.0 (- 1.0 (cos (* -2.0 kx))))))
2.0))
(* (fma (* th th) -0.16666666666666666 1.0) th))
(if (<= t_2 0.0002)
(*
(/
(* (fma (* ky ky) -0.16666666666666666 1.0) ky)
(sqrt (+ t_1 (* ky ky))))
(sin th))
(if (<= t_2 0.998)
(* (* (sin ky) th) (pow (hypot (sin kx) (sin ky)) -1.0))
(sin th)))))))
double code(double kx, double ky, double th) {
double t_1 = pow(sin(kx), 2.0);
double t_2 = sin(ky) / sqrt((t_1 + pow(sin(ky), 2.0)));
double tmp;
if (t_2 <= -1.0) {
tmp = sqrt(pow((1.0 - cos((-2.0 * ky))), -1.0)) * ((sqrt(2.0) * sin(th)) * sin(ky));
} else if (t_2 <= -0.1) {
tmp = (sin(ky) / (sqrt(fma((1.0 - cos((2.0 * ky))), 2.0, (2.0 * (1.0 - cos((-2.0 * kx)))))) / 2.0)) * (fma((th * th), -0.16666666666666666, 1.0) * th);
} else if (t_2 <= 0.0002) {
tmp = ((fma((ky * ky), -0.16666666666666666, 1.0) * ky) / sqrt((t_1 + (ky * ky)))) * sin(th);
} else if (t_2 <= 0.998) {
tmp = (sin(ky) * th) * pow(hypot(sin(kx), sin(ky)), -1.0);
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = sin(kx) ^ 2.0 t_2 = Float64(sin(ky) / sqrt(Float64(t_1 + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_2 <= -1.0) tmp = Float64(sqrt((Float64(1.0 - cos(Float64(-2.0 * ky))) ^ -1.0)) * Float64(Float64(sqrt(2.0) * sin(th)) * sin(ky))); elseif (t_2 <= -0.1) tmp = Float64(Float64(sin(ky) / Float64(sqrt(fma(Float64(1.0 - cos(Float64(2.0 * ky))), 2.0, Float64(2.0 * Float64(1.0 - cos(Float64(-2.0 * kx)))))) / 2.0)) * Float64(fma(Float64(th * th), -0.16666666666666666, 1.0) * th)); elseif (t_2 <= 0.0002) tmp = Float64(Float64(Float64(fma(Float64(ky * ky), -0.16666666666666666, 1.0) * ky) / sqrt(Float64(t_1 + Float64(ky * ky)))) * sin(th)); elseif (t_2 <= 0.998) tmp = Float64(Float64(sin(ky) * th) * (hypot(sin(kx), sin(ky)) ^ -1.0)); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$1 + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1.0], N[(N[Sqrt[N[Power[N[(1.0 - N[Cos[N[(-2.0 * ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] * N[(N[(N[Sqrt[2.0], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision] * N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -0.1], N[(N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[(N[(1.0 - N[Cos[N[(2.0 * ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 2.0 + N[(2.0 * N[(1.0 - N[Cos[N[(-2.0 * kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(th * th), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * th), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.0002], N[(N[(N[(N[(N[(ky * ky), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * ky), $MachinePrecision] / N[Sqrt[N[(t$95$1 + N[(ky * ky), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.998], N[(N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision] * N[Power[N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := {\sin kx}^{2}\\
t_2 := \frac{\sin ky}{\sqrt{t\_1 + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_2 \leq -1:\\
\;\;\;\;\sqrt{{\left(1 - \cos \left(-2 \cdot ky\right)\right)}^{-1}} \cdot \left(\left(\sqrt{2} \cdot \sin th\right) \cdot \sin ky\right)\\
\mathbf{elif}\;t\_2 \leq -0.1:\\
\;\;\;\;\frac{\sin ky}{\frac{\sqrt{\mathsf{fma}\left(1 - \cos \left(2 \cdot ky\right), 2, 2 \cdot \left(1 - \cos \left(-2 \cdot kx\right)\right)\right)}}{2}} \cdot \left(\mathsf{fma}\left(th \cdot th, -0.16666666666666666, 1\right) \cdot th\right)\\
\mathbf{elif}\;t\_2 \leq 0.0002:\\
\;\;\;\;\frac{\mathsf{fma}\left(ky \cdot ky, -0.16666666666666666, 1\right) \cdot ky}{\sqrt{t\_1 + ky \cdot ky}} \cdot \sin th\\
\mathbf{elif}\;t\_2 \leq 0.998:\\
\;\;\;\;\left(\sin ky \cdot th\right) \cdot {\left(\mathsf{hypot}\left(\sin kx, \sin ky\right)\right)}^{-1}\\
\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))))) < -1Initial program 82.4%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6482.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.6
Applied rewrites99.6%
lift-hypot.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-add-revN/A
sqrt-divN/A
lower-/.f64N/A
Applied rewrites62.2%
Taylor expanded in kx around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower--.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sin.f64N/A
lower-sin.f6462.1
Applied rewrites62.1%
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.10000000000000001Initial program 99.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.2
Applied rewrites99.2%
Taylor expanded in th around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6450.3
Applied rewrites50.3%
lift-hypot.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
frac-addN/A
metadata-evalN/A
metadata-evalN/A
sqrt-divN/A
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites50.4%
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))))) < 2.0000000000000001e-4Initial program 99.6%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6498.6
Applied rewrites98.6%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6498.6
Applied rewrites98.6%
if 2.0000000000000001e-4 < (/.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.998Initial program 99.5%
Taylor expanded in th around 0
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
unpow2N/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-pow.f64N/A
lower-sin.f6450.1
Applied rewrites50.1%
Applied rewrites50.0%
if 0.998 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 97.8%
Taylor expanded in kx around 0
lower-sin.f6498.5
Applied rewrites98.5%
Final simplification77.8%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (cos (* -2.0 ky)))
(t_2 (pow (sin kx) 2.0))
(t_3 (/ (sin ky) (sqrt (+ t_2 (pow (sin ky) 2.0)))))
(t_4 (cos (* -2.0 kx))))
(if (<= t_3 -1.0)
(* (sqrt (pow (- 1.0 t_1) -1.0)) (* (* (sqrt 2.0) (sin th)) (sin ky)))
(if (<= t_3 -0.1)
(*
(/
(sin ky)
(/ (sqrt (fma (- 1.0 (cos (* 2.0 ky))) 2.0 (* 2.0 (- 1.0 t_4)))) 2.0))
(* (fma (* th th) -0.16666666666666666 1.0) th))
(if (<= t_3 0.0002)
(*
(/
(* (fma (* ky ky) -0.16666666666666666 1.0) ky)
(sqrt (+ t_2 (* ky ky))))
(sin th))
(if (<= t_3 0.998)
(*
(* (* th (sin ky)) (sqrt 2.0))
(sqrt (pow (- (- 2.0 t_4) t_1) -1.0)))
(sin th)))))))
double code(double kx, double ky, double th) {
double t_1 = cos((-2.0 * ky));
double t_2 = pow(sin(kx), 2.0);
double t_3 = sin(ky) / sqrt((t_2 + pow(sin(ky), 2.0)));
double t_4 = cos((-2.0 * kx));
double tmp;
if (t_3 <= -1.0) {
tmp = sqrt(pow((1.0 - t_1), -1.0)) * ((sqrt(2.0) * sin(th)) * sin(ky));
} else if (t_3 <= -0.1) {
tmp = (sin(ky) / (sqrt(fma((1.0 - cos((2.0 * ky))), 2.0, (2.0 * (1.0 - t_4)))) / 2.0)) * (fma((th * th), -0.16666666666666666, 1.0) * th);
} else if (t_3 <= 0.0002) {
tmp = ((fma((ky * ky), -0.16666666666666666, 1.0) * ky) / sqrt((t_2 + (ky * ky)))) * sin(th);
} else if (t_3 <= 0.998) {
tmp = ((th * sin(ky)) * sqrt(2.0)) * sqrt(pow(((2.0 - t_4) - t_1), -1.0));
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = cos(Float64(-2.0 * ky)) t_2 = sin(kx) ^ 2.0 t_3 = Float64(sin(ky) / sqrt(Float64(t_2 + (sin(ky) ^ 2.0)))) t_4 = cos(Float64(-2.0 * kx)) tmp = 0.0 if (t_3 <= -1.0) tmp = Float64(sqrt((Float64(1.0 - t_1) ^ -1.0)) * Float64(Float64(sqrt(2.0) * sin(th)) * sin(ky))); elseif (t_3 <= -0.1) tmp = Float64(Float64(sin(ky) / Float64(sqrt(fma(Float64(1.0 - cos(Float64(2.0 * ky))), 2.0, Float64(2.0 * Float64(1.0 - t_4)))) / 2.0)) * Float64(fma(Float64(th * th), -0.16666666666666666, 1.0) * th)); elseif (t_3 <= 0.0002) tmp = Float64(Float64(Float64(fma(Float64(ky * ky), -0.16666666666666666, 1.0) * ky) / sqrt(Float64(t_2 + Float64(ky * ky)))) * sin(th)); elseif (t_3 <= 0.998) tmp = Float64(Float64(Float64(th * sin(ky)) * sqrt(2.0)) * sqrt((Float64(Float64(2.0 - t_4) - t_1) ^ -1.0))); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Cos[N[(-2.0 * ky), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$3 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$2 + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Cos[N[(-2.0 * kx), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$3, -1.0], N[(N[Sqrt[N[Power[N[(1.0 - t$95$1), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] * N[(N[(N[Sqrt[2.0], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision] * N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, -0.1], N[(N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[(N[(1.0 - N[Cos[N[(2.0 * ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 2.0 + N[(2.0 * N[(1.0 - t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(th * th), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * th), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 0.0002], N[(N[(N[(N[(N[(ky * ky), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * ky), $MachinePrecision] / N[Sqrt[N[(t$95$2 + N[(ky * ky), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 0.998], N[(N[(N[(th * N[Sin[ky], $MachinePrecision]), $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[Power[N[(N[(2.0 - t$95$4), $MachinePrecision] - t$95$1), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \cos \left(-2 \cdot ky\right)\\
t_2 := {\sin kx}^{2}\\
t_3 := \frac{\sin ky}{\sqrt{t\_2 + {\sin ky}^{2}}}\\
t_4 := \cos \left(-2 \cdot kx\right)\\
\mathbf{if}\;t\_3 \leq -1:\\
\;\;\;\;\sqrt{{\left(1 - t\_1\right)}^{-1}} \cdot \left(\left(\sqrt{2} \cdot \sin th\right) \cdot \sin ky\right)\\
\mathbf{elif}\;t\_3 \leq -0.1:\\
\;\;\;\;\frac{\sin ky}{\frac{\sqrt{\mathsf{fma}\left(1 - \cos \left(2 \cdot ky\right), 2, 2 \cdot \left(1 - t\_4\right)\right)}}{2}} \cdot \left(\mathsf{fma}\left(th \cdot th, -0.16666666666666666, 1\right) \cdot th\right)\\
\mathbf{elif}\;t\_3 \leq 0.0002:\\
\;\;\;\;\frac{\mathsf{fma}\left(ky \cdot ky, -0.16666666666666666, 1\right) \cdot ky}{\sqrt{t\_2 + ky \cdot ky}} \cdot \sin th\\
\mathbf{elif}\;t\_3 \leq 0.998:\\
\;\;\;\;\left(\left(th \cdot \sin ky\right) \cdot \sqrt{2}\right) \cdot \sqrt{{\left(\left(2 - t\_4\right) - t\_1\right)}^{-1}}\\
\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))))) < -1Initial program 82.4%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6482.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.6
Applied rewrites99.6%
lift-hypot.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-add-revN/A
sqrt-divN/A
lower-/.f64N/A
Applied rewrites62.2%
Taylor expanded in kx around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower--.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sin.f64N/A
lower-sin.f6462.1
Applied rewrites62.1%
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.10000000000000001Initial program 99.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.2
Applied rewrites99.2%
Taylor expanded in th around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6450.3
Applied rewrites50.3%
lift-hypot.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
frac-addN/A
metadata-evalN/A
metadata-evalN/A
sqrt-divN/A
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites50.4%
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))))) < 2.0000000000000001e-4Initial program 99.6%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6498.6
Applied rewrites98.6%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6498.6
Applied rewrites98.6%
if 2.0000000000000001e-4 < (/.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.998Initial program 99.5%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.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.4
Applied rewrites99.4%
lift-hypot.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-add-revN/A
sqrt-divN/A
lower-/.f64N/A
Applied rewrites96.3%
Taylor expanded in th 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
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower-*.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
Applied rewrites49.9%
if 0.998 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 97.8%
Taylor expanded in kx around 0
lower-sin.f6498.5
Applied rewrites98.5%
Final simplification77.8%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (pow (sin kx) 2.0))
(t_2 (/ (sin ky) (sqrt (+ t_1 (pow (sin ky) 2.0)))))
(t_3 (cos (* -2.0 ky)))
(t_4 (sqrt (pow (- (- 2.0 (cos (* -2.0 kx))) t_3) -1.0))))
(if (<= t_2 -1.0)
(* (sqrt (pow (- 1.0 t_3) -1.0)) (* (* (sqrt 2.0) (sin th)) (sin ky)))
(if (<= t_2 -0.1)
(* (* (* (sqrt 2.0) th) t_4) (sin ky))
(if (<= t_2 0.0002)
(*
(/
(* (fma (* ky ky) -0.16666666666666666 1.0) ky)
(sqrt (+ t_1 (* ky ky))))
(sin th))
(if (<= t_2 0.998)
(* (* (* th (sin ky)) (sqrt 2.0)) t_4)
(sin th)))))))
double code(double kx, double ky, double th) {
double t_1 = pow(sin(kx), 2.0);
double t_2 = sin(ky) / sqrt((t_1 + pow(sin(ky), 2.0)));
double t_3 = cos((-2.0 * ky));
double t_4 = sqrt(pow(((2.0 - cos((-2.0 * kx))) - t_3), -1.0));
double tmp;
if (t_2 <= -1.0) {
tmp = sqrt(pow((1.0 - t_3), -1.0)) * ((sqrt(2.0) * sin(th)) * sin(ky));
} else if (t_2 <= -0.1) {
tmp = ((sqrt(2.0) * th) * t_4) * sin(ky);
} else if (t_2 <= 0.0002) {
tmp = ((fma((ky * ky), -0.16666666666666666, 1.0) * ky) / sqrt((t_1 + (ky * ky)))) * sin(th);
} else if (t_2 <= 0.998) {
tmp = ((th * sin(ky)) * sqrt(2.0)) * t_4;
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = sin(kx) ^ 2.0 t_2 = Float64(sin(ky) / sqrt(Float64(t_1 + (sin(ky) ^ 2.0)))) t_3 = cos(Float64(-2.0 * ky)) t_4 = sqrt((Float64(Float64(2.0 - cos(Float64(-2.0 * kx))) - t_3) ^ -1.0)) tmp = 0.0 if (t_2 <= -1.0) tmp = Float64(sqrt((Float64(1.0 - t_3) ^ -1.0)) * Float64(Float64(sqrt(2.0) * sin(th)) * sin(ky))); elseif (t_2 <= -0.1) tmp = Float64(Float64(Float64(sqrt(2.0) * th) * t_4) * sin(ky)); elseif (t_2 <= 0.0002) tmp = Float64(Float64(Float64(fma(Float64(ky * ky), -0.16666666666666666, 1.0) * ky) / sqrt(Float64(t_1 + Float64(ky * ky)))) * sin(th)); elseif (t_2 <= 0.998) tmp = Float64(Float64(Float64(th * sin(ky)) * sqrt(2.0)) * t_4); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$1 + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Cos[N[(-2.0 * ky), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[Power[N[(N[(2.0 - N[Cos[N[(-2.0 * kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t$95$3), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$2, -1.0], N[(N[Sqrt[N[Power[N[(1.0 - t$95$3), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] * N[(N[(N[Sqrt[2.0], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision] * N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -0.1], N[(N[(N[(N[Sqrt[2.0], $MachinePrecision] * th), $MachinePrecision] * t$95$4), $MachinePrecision] * N[Sin[ky], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.0002], N[(N[(N[(N[(N[(ky * ky), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * ky), $MachinePrecision] / N[Sqrt[N[(t$95$1 + N[(ky * ky), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.998], N[(N[(N[(th * N[Sin[ky], $MachinePrecision]), $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] * t$95$4), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := {\sin kx}^{2}\\
t_2 := \frac{\sin ky}{\sqrt{t\_1 + {\sin ky}^{2}}}\\
t_3 := \cos \left(-2 \cdot ky\right)\\
t_4 := \sqrt{{\left(\left(2 - \cos \left(-2 \cdot kx\right)\right) - t\_3\right)}^{-1}}\\
\mathbf{if}\;t\_2 \leq -1:\\
\;\;\;\;\sqrt{{\left(1 - t\_3\right)}^{-1}} \cdot \left(\left(\sqrt{2} \cdot \sin th\right) \cdot \sin ky\right)\\
\mathbf{elif}\;t\_2 \leq -0.1:\\
\;\;\;\;\left(\left(\sqrt{2} \cdot th\right) \cdot t\_4\right) \cdot \sin ky\\
\mathbf{elif}\;t\_2 \leq 0.0002:\\
\;\;\;\;\frac{\mathsf{fma}\left(ky \cdot ky, -0.16666666666666666, 1\right) \cdot ky}{\sqrt{t\_1 + ky \cdot ky}} \cdot \sin th\\
\mathbf{elif}\;t\_2 \leq 0.998:\\
\;\;\;\;\left(\left(th \cdot \sin ky\right) \cdot \sqrt{2}\right) \cdot t\_4\\
\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))))) < -1Initial program 82.4%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6482.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.6
Applied rewrites99.6%
lift-hypot.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-add-revN/A
sqrt-divN/A
lower-/.f64N/A
Applied rewrites62.2%
Taylor expanded in kx around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower--.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sin.f64N/A
lower-sin.f6462.1
Applied rewrites62.1%
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.10000000000000001Initial program 99.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.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.1
Applied rewrites99.1%
lift-hypot.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-add-revN/A
sqrt-divN/A
lower-/.f64N/A
Applied rewrites96.2%
Taylor expanded in th around 0
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower-*.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower-*.f6449.7
Applied rewrites49.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))))) < 2.0000000000000001e-4Initial program 99.6%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6498.6
Applied rewrites98.6%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6498.6
Applied rewrites98.6%
if 2.0000000000000001e-4 < (/.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.998Initial program 99.5%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.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.4
Applied rewrites99.4%
lift-hypot.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-add-revN/A
sqrt-divN/A
lower-/.f64N/A
Applied rewrites96.3%
Taylor expanded in th 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
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower-*.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
Applied rewrites49.9%
if 0.998 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 97.8%
Taylor expanded in kx around 0
lower-sin.f6498.5
Applied rewrites98.5%
Final simplification77.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (pow (sin kx) 2.0))
(t_2 (/ (sin ky) (sqrt (+ t_1 (pow (sin ky) 2.0)))))
(t_3 (cos (* -2.0 ky)))
(t_4
(*
(* (* th (sin ky)) (sqrt 2.0))
(sqrt (pow (- (- 2.0 (cos (* -2.0 kx))) t_3) -1.0)))))
(if (<= t_2 -1.0)
(* (sqrt (pow (- 1.0 t_3) -1.0)) (* (* (sqrt 2.0) (sin th)) (sin ky)))
(if (<= t_2 -0.1)
t_4
(if (<= t_2 0.0002)
(*
(/
(* (fma (* ky ky) -0.16666666666666666 1.0) ky)
(sqrt (+ t_1 (* ky ky))))
(sin th))
(if (<= t_2 0.998) t_4 (sin th)))))))
double code(double kx, double ky, double th) {
double t_1 = pow(sin(kx), 2.0);
double t_2 = sin(ky) / sqrt((t_1 + pow(sin(ky), 2.0)));
double t_3 = cos((-2.0 * ky));
double t_4 = ((th * sin(ky)) * sqrt(2.0)) * sqrt(pow(((2.0 - cos((-2.0 * kx))) - t_3), -1.0));
double tmp;
if (t_2 <= -1.0) {
tmp = sqrt(pow((1.0 - t_3), -1.0)) * ((sqrt(2.0) * sin(th)) * sin(ky));
} else if (t_2 <= -0.1) {
tmp = t_4;
} else if (t_2 <= 0.0002) {
tmp = ((fma((ky * ky), -0.16666666666666666, 1.0) * ky) / sqrt((t_1 + (ky * ky)))) * sin(th);
} else if (t_2 <= 0.998) {
tmp = t_4;
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = sin(kx) ^ 2.0 t_2 = Float64(sin(ky) / sqrt(Float64(t_1 + (sin(ky) ^ 2.0)))) t_3 = cos(Float64(-2.0 * ky)) t_4 = Float64(Float64(Float64(th * sin(ky)) * sqrt(2.0)) * sqrt((Float64(Float64(2.0 - cos(Float64(-2.0 * kx))) - t_3) ^ -1.0))) tmp = 0.0 if (t_2 <= -1.0) tmp = Float64(sqrt((Float64(1.0 - t_3) ^ -1.0)) * Float64(Float64(sqrt(2.0) * sin(th)) * sin(ky))); elseif (t_2 <= -0.1) tmp = t_4; elseif (t_2 <= 0.0002) tmp = Float64(Float64(Float64(fma(Float64(ky * ky), -0.16666666666666666, 1.0) * ky) / sqrt(Float64(t_1 + Float64(ky * ky)))) * sin(th)); elseif (t_2 <= 0.998) tmp = t_4; else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$1 + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Cos[N[(-2.0 * ky), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(N[(N[(th * N[Sin[ky], $MachinePrecision]), $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[Power[N[(N[(2.0 - N[Cos[N[(-2.0 * kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t$95$3), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1.0], N[(N[Sqrt[N[Power[N[(1.0 - t$95$3), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] * N[(N[(N[Sqrt[2.0], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision] * N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -0.1], t$95$4, If[LessEqual[t$95$2, 0.0002], N[(N[(N[(N[(N[(ky * ky), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * ky), $MachinePrecision] / N[Sqrt[N[(t$95$1 + N[(ky * ky), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.998], t$95$4, N[Sin[th], $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := {\sin kx}^{2}\\
t_2 := \frac{\sin ky}{\sqrt{t\_1 + {\sin ky}^{2}}}\\
t_3 := \cos \left(-2 \cdot ky\right)\\
t_4 := \left(\left(th \cdot \sin ky\right) \cdot \sqrt{2}\right) \cdot \sqrt{{\left(\left(2 - \cos \left(-2 \cdot kx\right)\right) - t\_3\right)}^{-1}}\\
\mathbf{if}\;t\_2 \leq -1:\\
\;\;\;\;\sqrt{{\left(1 - t\_3\right)}^{-1}} \cdot \left(\left(\sqrt{2} \cdot \sin th\right) \cdot \sin ky\right)\\
\mathbf{elif}\;t\_2 \leq -0.1:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;t\_2 \leq 0.0002:\\
\;\;\;\;\frac{\mathsf{fma}\left(ky \cdot ky, -0.16666666666666666, 1\right) \cdot ky}{\sqrt{t\_1 + ky \cdot ky}} \cdot \sin th\\
\mathbf{elif}\;t\_2 \leq 0.998:\\
\;\;\;\;t\_4\\
\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))))) < -1Initial program 82.4%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6482.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.6
Applied rewrites99.6%
lift-hypot.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-add-revN/A
sqrt-divN/A
lower-/.f64N/A
Applied rewrites62.2%
Taylor expanded in kx around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower--.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sin.f64N/A
lower-sin.f6462.1
Applied rewrites62.1%
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.10000000000000001 or 2.0000000000000001e-4 < (/.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.998Initial program 99.4%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.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.2
Applied rewrites99.2%
lift-hypot.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-add-revN/A
sqrt-divN/A
lower-/.f64N/A
Applied rewrites96.3%
Taylor expanded in th 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
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower-*.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
Applied rewrites49.8%
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))))) < 2.0000000000000001e-4Initial program 99.6%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6498.6
Applied rewrites98.6%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6498.6
Applied rewrites98.6%
if 0.998 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 97.8%
Taylor expanded in kx around 0
lower-sin.f6498.5
Applied rewrites98.5%
Final simplification77.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (pow (sin kx) 2.0))
(t_2 (pow (sin ky) 2.0))
(t_3 (/ (sin ky) (sqrt (+ t_1 t_2)))))
(if (<= t_3 -1.0)
(* (/ (sin ky) (sqrt t_2)) (sin th))
(if (<= t_3 -0.1)
(*
(/
(sin ky)
(/
(sqrt
(fma
(- 1.0 (cos (* 2.0 ky)))
2.0
(* 2.0 (- 1.0 (cos (* -2.0 kx))))))
2.0))
(* (fma (* th th) -0.16666666666666666 1.0) th))
(if (<= t_3 0.0002)
(*
(/
(* (fma (* ky ky) -0.16666666666666666 1.0) ky)
(sqrt (+ t_1 (* ky ky))))
(sin th))
(if (<= t_3 0.998)
(/ (* th (sin ky)) (hypot (sin kx) (sin ky)))
(sin th)))))))
double code(double kx, double ky, double th) {
double t_1 = pow(sin(kx), 2.0);
double t_2 = pow(sin(ky), 2.0);
double t_3 = sin(ky) / sqrt((t_1 + t_2));
double tmp;
if (t_3 <= -1.0) {
tmp = (sin(ky) / sqrt(t_2)) * sin(th);
} else if (t_3 <= -0.1) {
tmp = (sin(ky) / (sqrt(fma((1.0 - cos((2.0 * ky))), 2.0, (2.0 * (1.0 - cos((-2.0 * kx)))))) / 2.0)) * (fma((th * th), -0.16666666666666666, 1.0) * th);
} else if (t_3 <= 0.0002) {
tmp = ((fma((ky * ky), -0.16666666666666666, 1.0) * ky) / sqrt((t_1 + (ky * ky)))) * sin(th);
} else if (t_3 <= 0.998) {
tmp = (th * sin(ky)) / hypot(sin(kx), sin(ky));
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = sin(kx) ^ 2.0 t_2 = sin(ky) ^ 2.0 t_3 = Float64(sin(ky) / sqrt(Float64(t_1 + t_2))) tmp = 0.0 if (t_3 <= -1.0) tmp = Float64(Float64(sin(ky) / sqrt(t_2)) * sin(th)); elseif (t_3 <= -0.1) tmp = Float64(Float64(sin(ky) / Float64(sqrt(fma(Float64(1.0 - cos(Float64(2.0 * ky))), 2.0, Float64(2.0 * Float64(1.0 - cos(Float64(-2.0 * kx)))))) / 2.0)) * Float64(fma(Float64(th * th), -0.16666666666666666, 1.0) * th)); elseif (t_3 <= 0.0002) tmp = Float64(Float64(Float64(fma(Float64(ky * ky), -0.16666666666666666, 1.0) * ky) / sqrt(Float64(t_1 + Float64(ky * ky)))) * sin(th)); elseif (t_3 <= 0.998) tmp = Float64(Float64(th * sin(ky)) / hypot(sin(kx), sin(ky))); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$3 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$1 + t$95$2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, -1.0], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[t$95$2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, -0.1], N[(N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[(N[(1.0 - N[Cos[N[(2.0 * ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 2.0 + N[(2.0 * N[(1.0 - N[Cos[N[(-2.0 * kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(th * th), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * th), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 0.0002], N[(N[(N[(N[(N[(ky * ky), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * ky), $MachinePrecision] / N[Sqrt[N[(t$95$1 + N[(ky * ky), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 0.998], N[(N[(th * N[Sin[ky], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := {\sin kx}^{2}\\
t_2 := {\sin ky}^{2}\\
t_3 := \frac{\sin ky}{\sqrt{t\_1 + t\_2}}\\
\mathbf{if}\;t\_3 \leq -1:\\
\;\;\;\;\frac{\sin ky}{\sqrt{t\_2}} \cdot \sin th\\
\mathbf{elif}\;t\_3 \leq -0.1:\\
\;\;\;\;\frac{\sin ky}{\frac{\sqrt{\mathsf{fma}\left(1 - \cos \left(2 \cdot ky\right), 2, 2 \cdot \left(1 - \cos \left(-2 \cdot kx\right)\right)\right)}}{2}} \cdot \left(\mathsf{fma}\left(th \cdot th, -0.16666666666666666, 1\right) \cdot th\right)\\
\mathbf{elif}\;t\_3 \leq 0.0002:\\
\;\;\;\;\frac{\mathsf{fma}\left(ky \cdot ky, -0.16666666666666666, 1\right) \cdot ky}{\sqrt{t\_1 + ky \cdot ky}} \cdot \sin th\\
\mathbf{elif}\;t\_3 \leq 0.998:\\
\;\;\;\;\frac{th \cdot \sin ky}{\mathsf{hypot}\left(\sin kx, \sin ky\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))))) < -1Initial program 82.4%
lift-pow.f64N/A
unpow2N/A
sqr-neg-revN/A
lift-sin.f64N/A
cos-+PI/2-revN/A
lift-sin.f64N/A
cos-+PI/2-revN/A
1-sub-sin-revN/A
metadata-evalN/A
sin-+PI/2-revN/A
sin-+PI/2-revN/A
lower--.f64N/A
metadata-evalN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-cos.f6462.1
Applied rewrites62.1%
Taylor expanded in kx around 0
unpow2N/A
1-sub-cosN/A
unpow2N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6482.4
Applied rewrites82.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.10000000000000001Initial program 99.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.2
Applied rewrites99.2%
Taylor expanded in th around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6450.3
Applied rewrites50.3%
lift-hypot.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
frac-addN/A
metadata-evalN/A
metadata-evalN/A
sqrt-divN/A
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites50.4%
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))))) < 2.0000000000000001e-4Initial program 99.6%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6498.6
Applied rewrites98.6%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6498.6
Applied rewrites98.6%
if 2.0000000000000001e-4 < (/.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.998Initial program 99.5%
Taylor expanded in th around 0
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
unpow2N/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-pow.f64N/A
lower-sin.f6450.1
Applied rewrites50.1%
Applied rewrites50.1%
if 0.998 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 97.8%
Taylor expanded in kx around 0
lower-sin.f6498.5
Applied rewrites98.5%
Final simplification81.8%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (pow (sin kx) 2.0))
(t_2 (/ (sin ky) (sqrt (+ t_1 (pow (sin ky) 2.0))))))
(if (<= t_2 -1.0)
(*
(sqrt (pow (- 1.0 (cos (* -2.0 ky))) -1.0))
(* (* (sqrt 2.0) (sin th)) (sin ky)))
(if (<= t_2 -0.1)
(*
(/
(sin ky)
(/
(sqrt
(fma
(- 1.0 (cos (* 2.0 ky)))
2.0
(* 2.0 (- 1.0 (cos (* -2.0 kx))))))
2.0))
(* (fma (* th th) -0.16666666666666666 1.0) th))
(if (<= t_2 0.0002)
(*
(/
(* (fma (* ky ky) -0.16666666666666666 1.0) ky)
(sqrt (+ t_1 (* ky ky))))
(sin th))
(if (<= t_2 0.998)
(/ (* th (sin ky)) (hypot (sin kx) (sin ky)))
(sin th)))))))
double code(double kx, double ky, double th) {
double t_1 = pow(sin(kx), 2.0);
double t_2 = sin(ky) / sqrt((t_1 + pow(sin(ky), 2.0)));
double tmp;
if (t_2 <= -1.0) {
tmp = sqrt(pow((1.0 - cos((-2.0 * ky))), -1.0)) * ((sqrt(2.0) * sin(th)) * sin(ky));
} else if (t_2 <= -0.1) {
tmp = (sin(ky) / (sqrt(fma((1.0 - cos((2.0 * ky))), 2.0, (2.0 * (1.0 - cos((-2.0 * kx)))))) / 2.0)) * (fma((th * th), -0.16666666666666666, 1.0) * th);
} else if (t_2 <= 0.0002) {
tmp = ((fma((ky * ky), -0.16666666666666666, 1.0) * ky) / sqrt((t_1 + (ky * ky)))) * sin(th);
} else if (t_2 <= 0.998) {
tmp = (th * sin(ky)) / hypot(sin(kx), sin(ky));
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = sin(kx) ^ 2.0 t_2 = Float64(sin(ky) / sqrt(Float64(t_1 + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_2 <= -1.0) tmp = Float64(sqrt((Float64(1.0 - cos(Float64(-2.0 * ky))) ^ -1.0)) * Float64(Float64(sqrt(2.0) * sin(th)) * sin(ky))); elseif (t_2 <= -0.1) tmp = Float64(Float64(sin(ky) / Float64(sqrt(fma(Float64(1.0 - cos(Float64(2.0 * ky))), 2.0, Float64(2.0 * Float64(1.0 - cos(Float64(-2.0 * kx)))))) / 2.0)) * Float64(fma(Float64(th * th), -0.16666666666666666, 1.0) * th)); elseif (t_2 <= 0.0002) tmp = Float64(Float64(Float64(fma(Float64(ky * ky), -0.16666666666666666, 1.0) * ky) / sqrt(Float64(t_1 + Float64(ky * ky)))) * sin(th)); elseif (t_2 <= 0.998) tmp = Float64(Float64(th * sin(ky)) / hypot(sin(kx), sin(ky))); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$1 + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1.0], N[(N[Sqrt[N[Power[N[(1.0 - N[Cos[N[(-2.0 * ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] * N[(N[(N[Sqrt[2.0], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision] * N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -0.1], N[(N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[(N[(1.0 - N[Cos[N[(2.0 * ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 2.0 + N[(2.0 * N[(1.0 - N[Cos[N[(-2.0 * kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(th * th), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * th), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.0002], N[(N[(N[(N[(N[(ky * ky), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * ky), $MachinePrecision] / N[Sqrt[N[(t$95$1 + N[(ky * ky), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.998], N[(N[(th * N[Sin[ky], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := {\sin kx}^{2}\\
t_2 := \frac{\sin ky}{\sqrt{t\_1 + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_2 \leq -1:\\
\;\;\;\;\sqrt{{\left(1 - \cos \left(-2 \cdot ky\right)\right)}^{-1}} \cdot \left(\left(\sqrt{2} \cdot \sin th\right) \cdot \sin ky\right)\\
\mathbf{elif}\;t\_2 \leq -0.1:\\
\;\;\;\;\frac{\sin ky}{\frac{\sqrt{\mathsf{fma}\left(1 - \cos \left(2 \cdot ky\right), 2, 2 \cdot \left(1 - \cos \left(-2 \cdot kx\right)\right)\right)}}{2}} \cdot \left(\mathsf{fma}\left(th \cdot th, -0.16666666666666666, 1\right) \cdot th\right)\\
\mathbf{elif}\;t\_2 \leq 0.0002:\\
\;\;\;\;\frac{\mathsf{fma}\left(ky \cdot ky, -0.16666666666666666, 1\right) \cdot ky}{\sqrt{t\_1 + ky \cdot ky}} \cdot \sin th\\
\mathbf{elif}\;t\_2 \leq 0.998:\\
\;\;\;\;\frac{th \cdot \sin ky}{\mathsf{hypot}\left(\sin kx, \sin ky\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))))) < -1Initial program 82.4%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6482.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.6
Applied rewrites99.6%
lift-hypot.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-add-revN/A
sqrt-divN/A
lower-/.f64N/A
Applied rewrites62.2%
Taylor expanded in kx around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower--.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sin.f64N/A
lower-sin.f6462.1
Applied rewrites62.1%
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.10000000000000001Initial program 99.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.2
Applied rewrites99.2%
Taylor expanded in th around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6450.3
Applied rewrites50.3%
lift-hypot.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
frac-addN/A
metadata-evalN/A
metadata-evalN/A
sqrt-divN/A
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites50.4%
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))))) < 2.0000000000000001e-4Initial program 99.6%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6498.6
Applied rewrites98.6%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6498.6
Applied rewrites98.6%
if 2.0000000000000001e-4 < (/.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.998Initial program 99.5%
Taylor expanded in th around 0
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
unpow2N/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-pow.f64N/A
lower-sin.f6450.1
Applied rewrites50.1%
Applied rewrites50.1%
if 0.998 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 97.8%
Taylor expanded in kx around 0
lower-sin.f6498.5
Applied rewrites98.5%
Final simplification77.9%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (pow (sin kx) 2.0))
(t_2 (/ (sin ky) (sqrt (+ t_1 (pow (sin ky) 2.0))))))
(if (<= t_2 -1.0)
(*
(sqrt (pow (- 1.0 (cos (* -2.0 ky))) -1.0))
(* (* (sqrt 2.0) (sin th)) (sin ky)))
(if (<= t_2 -0.1)
(*
(/
(sin ky)
(/
(sqrt
(fma
(- 1.0 (cos (* 2.0 ky)))
2.0
(* 2.0 (- 1.0 (cos (* -2.0 kx))))))
2.0))
(* (fma (* th th) -0.16666666666666666 1.0) th))
(if (<= t_2 0.0002)
(*
(/
(* (fma (* ky ky) -0.16666666666666666 1.0) ky)
(sqrt (+ t_1 (* ky ky))))
(sin th))
(if (<= t_2 0.998)
(* (/ th (hypot (sin kx) (sin ky))) (sin ky))
(sin th)))))))
double code(double kx, double ky, double th) {
double t_1 = pow(sin(kx), 2.0);
double t_2 = sin(ky) / sqrt((t_1 + pow(sin(ky), 2.0)));
double tmp;
if (t_2 <= -1.0) {
tmp = sqrt(pow((1.0 - cos((-2.0 * ky))), -1.0)) * ((sqrt(2.0) * sin(th)) * sin(ky));
} else if (t_2 <= -0.1) {
tmp = (sin(ky) / (sqrt(fma((1.0 - cos((2.0 * ky))), 2.0, (2.0 * (1.0 - cos((-2.0 * kx)))))) / 2.0)) * (fma((th * th), -0.16666666666666666, 1.0) * th);
} else if (t_2 <= 0.0002) {
tmp = ((fma((ky * ky), -0.16666666666666666, 1.0) * ky) / sqrt((t_1 + (ky * ky)))) * sin(th);
} else if (t_2 <= 0.998) {
tmp = (th / hypot(sin(kx), sin(ky))) * sin(ky);
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = sin(kx) ^ 2.0 t_2 = Float64(sin(ky) / sqrt(Float64(t_1 + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_2 <= -1.0) tmp = Float64(sqrt((Float64(1.0 - cos(Float64(-2.0 * ky))) ^ -1.0)) * Float64(Float64(sqrt(2.0) * sin(th)) * sin(ky))); elseif (t_2 <= -0.1) tmp = Float64(Float64(sin(ky) / Float64(sqrt(fma(Float64(1.0 - cos(Float64(2.0 * ky))), 2.0, Float64(2.0 * Float64(1.0 - cos(Float64(-2.0 * kx)))))) / 2.0)) * Float64(fma(Float64(th * th), -0.16666666666666666, 1.0) * th)); elseif (t_2 <= 0.0002) tmp = Float64(Float64(Float64(fma(Float64(ky * ky), -0.16666666666666666, 1.0) * ky) / sqrt(Float64(t_1 + Float64(ky * ky)))) * sin(th)); elseif (t_2 <= 0.998) tmp = Float64(Float64(th / hypot(sin(kx), sin(ky))) * sin(ky)); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$1 + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1.0], N[(N[Sqrt[N[Power[N[(1.0 - N[Cos[N[(-2.0 * ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] * N[(N[(N[Sqrt[2.0], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision] * N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -0.1], N[(N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[(N[(1.0 - N[Cos[N[(2.0 * ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 2.0 + N[(2.0 * N[(1.0 - N[Cos[N[(-2.0 * kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(th * th), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * th), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.0002], N[(N[(N[(N[(N[(ky * ky), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * ky), $MachinePrecision] / N[Sqrt[N[(t$95$1 + N[(ky * ky), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.998], N[(N[(th / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[ky], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := {\sin kx}^{2}\\
t_2 := \frac{\sin ky}{\sqrt{t\_1 + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_2 \leq -1:\\
\;\;\;\;\sqrt{{\left(1 - \cos \left(-2 \cdot ky\right)\right)}^{-1}} \cdot \left(\left(\sqrt{2} \cdot \sin th\right) \cdot \sin ky\right)\\
\mathbf{elif}\;t\_2 \leq -0.1:\\
\;\;\;\;\frac{\sin ky}{\frac{\sqrt{\mathsf{fma}\left(1 - \cos \left(2 \cdot ky\right), 2, 2 \cdot \left(1 - \cos \left(-2 \cdot kx\right)\right)\right)}}{2}} \cdot \left(\mathsf{fma}\left(th \cdot th, -0.16666666666666666, 1\right) \cdot th\right)\\
\mathbf{elif}\;t\_2 \leq 0.0002:\\
\;\;\;\;\frac{\mathsf{fma}\left(ky \cdot ky, -0.16666666666666666, 1\right) \cdot ky}{\sqrt{t\_1 + ky \cdot ky}} \cdot \sin th\\
\mathbf{elif}\;t\_2 \leq 0.998:\\
\;\;\;\;\frac{th}{\mathsf{hypot}\left(\sin kx, \sin ky\right)} \cdot \sin ky\\
\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))))) < -1Initial program 82.4%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6482.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.6
Applied rewrites99.6%
lift-hypot.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-add-revN/A
sqrt-divN/A
lower-/.f64N/A
Applied rewrites62.2%
Taylor expanded in kx around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower--.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sin.f64N/A
lower-sin.f6462.1
Applied rewrites62.1%
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.10000000000000001Initial program 99.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.2
Applied rewrites99.2%
Taylor expanded in th around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6450.3
Applied rewrites50.3%
lift-hypot.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
frac-addN/A
metadata-evalN/A
metadata-evalN/A
sqrt-divN/A
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites50.4%
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))))) < 2.0000000000000001e-4Initial program 99.6%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6498.6
Applied rewrites98.6%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6498.6
Applied rewrites98.6%
if 2.0000000000000001e-4 < (/.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.998Initial program 99.5%
Taylor expanded in th around 0
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
unpow2N/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-pow.f64N/A
lower-sin.f6450.1
Applied rewrites50.1%
Applied rewrites50.1%
if 0.998 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 97.8%
Taylor expanded in kx around 0
lower-sin.f6498.5
Applied rewrites98.5%
Final simplification77.9%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (pow (sin kx) 2.0))
(t_2 (/ (sin ky) (sqrt (+ t_1 (pow (sin ky) 2.0))))))
(if (<= t_2 -1.0)
(*
(/
(sin ky)
(hypot (sin ky) (* (fma -0.16666666666666666 (* kx kx) 1.0) kx)))
(* (fma (* th th) -0.16666666666666666 1.0) th))
(if (<= t_2 -0.05)
(* (/ (sin ky) (sqrt (- 0.5 (* (cos (* -2.0 kx)) 0.5)))) (sin th))
(if (<= t_2 0.005)
(*
(/
(* (fma (* ky ky) -0.16666666666666666 1.0) ky)
(sqrt (+ t_1 (* ky ky))))
(sin th))
(sin th))))))
double code(double kx, double ky, double th) {
double t_1 = pow(sin(kx), 2.0);
double t_2 = sin(ky) / sqrt((t_1 + pow(sin(ky), 2.0)));
double tmp;
if (t_2 <= -1.0) {
tmp = (sin(ky) / hypot(sin(ky), (fma(-0.16666666666666666, (kx * kx), 1.0) * kx))) * (fma((th * th), -0.16666666666666666, 1.0) * th);
} else if (t_2 <= -0.05) {
tmp = (sin(ky) / sqrt((0.5 - (cos((-2.0 * kx)) * 0.5)))) * sin(th);
} else if (t_2 <= 0.005) {
tmp = ((fma((ky * ky), -0.16666666666666666, 1.0) * ky) / sqrt((t_1 + (ky * ky)))) * sin(th);
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = sin(kx) ^ 2.0 t_2 = Float64(sin(ky) / sqrt(Float64(t_1 + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_2 <= -1.0) tmp = Float64(Float64(sin(ky) / hypot(sin(ky), Float64(fma(-0.16666666666666666, Float64(kx * kx), 1.0) * kx))) * Float64(fma(Float64(th * th), -0.16666666666666666, 1.0) * th)); elseif (t_2 <= -0.05) tmp = Float64(Float64(sin(ky) / sqrt(Float64(0.5 - Float64(cos(Float64(-2.0 * kx)) * 0.5)))) * sin(th)); elseif (t_2 <= 0.005) tmp = Float64(Float64(Float64(fma(Float64(ky * ky), -0.16666666666666666, 1.0) * ky) / sqrt(Float64(t_1 + Float64(ky * ky)))) * sin(th)); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$1 + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1.0], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[(N[(-0.16666666666666666 * N[(kx * kx), $MachinePrecision] + 1.0), $MachinePrecision] * kx), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(th * th), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * th), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -0.05], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(0.5 - N[(N[Cos[N[(-2.0 * kx), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.005], N[(N[(N[(N[(N[(ky * ky), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * ky), $MachinePrecision] / N[Sqrt[N[(t$95$1 + N[(ky * ky), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := {\sin kx}^{2}\\
t_2 := \frac{\sin ky}{\sqrt{t\_1 + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_2 \leq -1:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \mathsf{fma}\left(-0.16666666666666666, kx \cdot kx, 1\right) \cdot kx\right)} \cdot \left(\mathsf{fma}\left(th \cdot th, -0.16666666666666666, 1\right) \cdot th\right)\\
\mathbf{elif}\;t\_2 \leq -0.05:\\
\;\;\;\;\frac{\sin ky}{\sqrt{0.5 - \cos \left(-2 \cdot kx\right) \cdot 0.5}} \cdot \sin th\\
\mathbf{elif}\;t\_2 \leq 0.005:\\
\;\;\;\;\frac{\mathsf{fma}\left(ky \cdot ky, -0.16666666666666666, 1\right) \cdot ky}{\sqrt{t\_1 + ky \cdot ky}} \cdot \sin th\\
\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))))) < -1Initial program 82.4%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6499.9
Applied rewrites99.9%
Taylor expanded in th around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6453.0
Applied rewrites53.0%
Taylor expanded in kx around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6453.0
Applied rewrites53.0%
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.050000000000000003Initial program 99.3%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f649.2
Applied rewrites9.2%
lift-pow.f64N/A
pow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sqr-sin-aN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
count-2-revN/A
lower-cos.f64N/A
count-2-revN/A
lower-*.f648.7
Applied rewrites8.7%
Taylor expanded in ky around 0
lower-sqrt.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval21.1
Applied rewrites21.1%
if -0.050000000000000003 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.0050000000000000001Initial program 99.6%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6499.4
Applied rewrites99.4%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6499.4
Applied rewrites99.4%
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))))) Initial program 98.5%
Taylor expanded in kx around 0
lower-sin.f6463.6
Applied rewrites63.6%
Final simplification68.1%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (pow (sin kx) 2.0))
(t_2 (/ (sin ky) (sqrt (+ t_1 (pow (sin ky) 2.0))))))
(if (<= t_2 -0.05)
(*
(sqrt (pow (- 1.0 (cos (* -2.0 ky))) -1.0))
(* (* (sqrt 2.0) (sin th)) (sin ky)))
(if (<= t_2 0.005)
(*
(/
(* (fma (* ky ky) -0.16666666666666666 1.0) ky)
(sqrt (+ t_1 (* ky ky))))
(sin th))
(sin th)))))
double code(double kx, double ky, double th) {
double t_1 = pow(sin(kx), 2.0);
double t_2 = sin(ky) / sqrt((t_1 + pow(sin(ky), 2.0)));
double tmp;
if (t_2 <= -0.05) {
tmp = sqrt(pow((1.0 - cos((-2.0 * ky))), -1.0)) * ((sqrt(2.0) * sin(th)) * sin(ky));
} else if (t_2 <= 0.005) {
tmp = ((fma((ky * ky), -0.16666666666666666, 1.0) * ky) / sqrt((t_1 + (ky * ky)))) * sin(th);
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = sin(kx) ^ 2.0 t_2 = Float64(sin(ky) / sqrt(Float64(t_1 + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_2 <= -0.05) tmp = Float64(sqrt((Float64(1.0 - cos(Float64(-2.0 * ky))) ^ -1.0)) * Float64(Float64(sqrt(2.0) * sin(th)) * sin(ky))); elseif (t_2 <= 0.005) tmp = Float64(Float64(Float64(fma(Float64(ky * ky), -0.16666666666666666, 1.0) * ky) / sqrt(Float64(t_1 + Float64(ky * ky)))) * sin(th)); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$1 + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -0.05], N[(N[Sqrt[N[Power[N[(1.0 - N[Cos[N[(-2.0 * ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] * N[(N[(N[Sqrt[2.0], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision] * N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.005], N[(N[(N[(N[(N[(ky * ky), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * ky), $MachinePrecision] / N[Sqrt[N[(t$95$1 + N[(ky * ky), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := {\sin kx}^{2}\\
t_2 := \frac{\sin ky}{\sqrt{t\_1 + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_2 \leq -0.05:\\
\;\;\;\;\sqrt{{\left(1 - \cos \left(-2 \cdot ky\right)\right)}^{-1}} \cdot \left(\left(\sqrt{2} \cdot \sin th\right) \cdot \sin ky\right)\\
\mathbf{elif}\;t\_2 \leq 0.005:\\
\;\;\;\;\frac{\mathsf{fma}\left(ky \cdot ky, -0.16666666666666666, 1\right) \cdot ky}{\sqrt{t\_1 + ky \cdot ky}} \cdot \sin th\\
\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.050000000000000003Initial program 89.5%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6489.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.4
Applied rewrites99.4%
lift-hypot.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-add-revN/A
sqrt-divN/A
lower-/.f64N/A
Applied rewrites76.5%
Taylor expanded in kx around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower--.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sin.f64N/A
lower-sin.f6444.4
Applied rewrites44.4%
if -0.050000000000000003 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.0050000000000000001Initial program 99.6%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6499.4
Applied rewrites99.4%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6499.4
Applied rewrites99.4%
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))))) Initial program 98.5%
Taylor expanded in kx around 0
lower-sin.f6463.6
Applied rewrites63.6%
Final simplification69.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 5e-125)
(* (/ ky (sin kx)) (sin th))
(if (<= t_1 0.005)
(* (* (sqrt (pow (- 0.5 (* (cos (* -2.0 kx)) 0.5)) -1.0)) ky) (sin th))
(sin th)))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double tmp;
if (t_1 <= 5e-125) {
tmp = (ky / sin(kx)) * sin(th);
} else if (t_1 <= 0.005) {
tmp = (sqrt(pow((0.5 - (cos((-2.0 * kx)) * 0.5)), -1.0)) * ky) * sin(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) :: t_1
real(8) :: tmp
t_1 = sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))
if (t_1 <= 5d-125) then
tmp = (ky / sin(kx)) * sin(th)
else if (t_1 <= 0.005d0) then
tmp = (sqrt(((0.5d0 - (cos(((-2.0d0) * kx)) * 0.5d0)) ** (-1.0d0))) * ky) * sin(th)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)));
double tmp;
if (t_1 <= 5e-125) {
tmp = (ky / Math.sin(kx)) * Math.sin(th);
} else if (t_1 <= 0.005) {
tmp = (Math.sqrt(Math.pow((0.5 - (Math.cos((-2.0 * kx)) * 0.5)), -1.0)) * ky) * Math.sin(th);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0))) tmp = 0 if t_1 <= 5e-125: tmp = (ky / math.sin(kx)) * math.sin(th) elif t_1 <= 0.005: tmp = (math.sqrt(math.pow((0.5 - (math.cos((-2.0 * kx)) * 0.5)), -1.0)) * ky) * math.sin(th) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_1 <= 5e-125) tmp = Float64(Float64(ky / sin(kx)) * sin(th)); elseif (t_1 <= 0.005) tmp = Float64(Float64(sqrt((Float64(0.5 - Float64(cos(Float64(-2.0 * kx)) * 0.5)) ^ -1.0)) * ky) * sin(th)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0))); tmp = 0.0; if (t_1 <= 5e-125) tmp = (ky / sin(kx)) * sin(th); elseif (t_1 <= 0.005) tmp = (sqrt(((0.5 - (cos((-2.0 * kx)) * 0.5)) ^ -1.0)) * ky) * sin(th); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 5e-125], N[(N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.005], N[(N[(N[Sqrt[N[Power[N[(0.5 - N[(N[Cos[N[(-2.0 * kx), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] * ky), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_1 \leq 5 \cdot 10^{-125}:\\
\;\;\;\;\frac{ky}{\sin kx} \cdot \sin th\\
\mathbf{elif}\;t\_1 \leq 0.005:\\
\;\;\;\;\left(\sqrt{{\left(0.5 - \cos \left(-2 \cdot kx\right) \cdot 0.5\right)}^{-1}} \cdot ky\right) \cdot \sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 4.99999999999999967e-125Initial program 94.2%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-sin.f6430.9
Applied rewrites30.9%
if 4.99999999999999967e-125 < (/.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 99.4%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6498.4
Applied rewrites98.4%
lift-pow.f64N/A
pow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sqr-sin-aN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
count-2-revN/A
lower-cos.f64N/A
count-2-revN/A
lower-*.f6480.8
Applied rewrites80.8%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval73.4
Applied rewrites73.4%
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))))) Initial program 98.5%
Taylor expanded in kx around 0
lower-sin.f6463.6
Applied rewrites63.6%
Final simplification43.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 2e-107)
(* (/ ky (sin kx)) (sin th))
(if (<= t_1 0.005)
(* (sqrt (pow (- 0.5 (* (cos (* -2.0 kx)) 0.5)) -1.0)) (* (sin th) ky))
(sin th)))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double tmp;
if (t_1 <= 2e-107) {
tmp = (ky / sin(kx)) * sin(th);
} else if (t_1 <= 0.005) {
tmp = sqrt(pow((0.5 - (cos((-2.0 * kx)) * 0.5)), -1.0)) * (sin(th) * ky);
} 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) :: t_1
real(8) :: tmp
t_1 = sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))
if (t_1 <= 2d-107) then
tmp = (ky / sin(kx)) * sin(th)
else if (t_1 <= 0.005d0) then
tmp = sqrt(((0.5d0 - (cos(((-2.0d0) * kx)) * 0.5d0)) ** (-1.0d0))) * (sin(th) * ky)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)));
double tmp;
if (t_1 <= 2e-107) {
tmp = (ky / Math.sin(kx)) * Math.sin(th);
} else if (t_1 <= 0.005) {
tmp = Math.sqrt(Math.pow((0.5 - (Math.cos((-2.0 * kx)) * 0.5)), -1.0)) * (Math.sin(th) * ky);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0))) tmp = 0 if t_1 <= 2e-107: tmp = (ky / math.sin(kx)) * math.sin(th) elif t_1 <= 0.005: tmp = math.sqrt(math.pow((0.5 - (math.cos((-2.0 * kx)) * 0.5)), -1.0)) * (math.sin(th) * ky) else: tmp = math.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 <= 2e-107) tmp = Float64(Float64(ky / sin(kx)) * sin(th)); elseif (t_1 <= 0.005) tmp = Float64(sqrt((Float64(0.5 - Float64(cos(Float64(-2.0 * kx)) * 0.5)) ^ -1.0)) * Float64(sin(th) * ky)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0))); tmp = 0.0; if (t_1 <= 2e-107) tmp = (ky / sin(kx)) * sin(th); elseif (t_1 <= 0.005) tmp = sqrt(((0.5 - (cos((-2.0 * kx)) * 0.5)) ^ -1.0)) * (sin(th) * ky); else tmp = sin(th); end tmp_2 = 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, 2e-107], N[(N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.005], N[(N[Sqrt[N[Power[N[(0.5 - N[(N[Cos[N[(-2.0 * kx), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] * ky), $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 2 \cdot 10^{-107}:\\
\;\;\;\;\frac{ky}{\sin kx} \cdot \sin th\\
\mathbf{elif}\;t\_1 \leq 0.005:\\
\;\;\;\;\sqrt{{\left(0.5 - \cos \left(-2 \cdot kx\right) \cdot 0.5\right)}^{-1}} \cdot \left(\sin th \cdot ky\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2e-107Initial program 94.2%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-sin.f6430.8
Applied rewrites30.8%
if 2e-107 < (/.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 99.5%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6498.4
Applied rewrites98.4%
lift-pow.f64N/A
pow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sqr-sin-aN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
count-2-revN/A
lower-cos.f64N/A
count-2-revN/A
lower-*.f6485.8
Applied rewrites85.8%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6477.9
Applied rewrites77.9%
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))))) Initial program 98.5%
Taylor expanded in kx around 0
lower-sin.f6463.6
Applied rewrites63.6%
Final simplification43.8%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 0.0002) (* (/ ky (sin kx)) (sin 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)))) <= 0.0002) {
tmp = (ky / sin(kx)) * sin(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)))) <= 0.0002d0) then
tmp = (ky / sin(kx)) * sin(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)))) <= 0.0002) {
tmp = (ky / Math.sin(kx)) * Math.sin(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)))) <= 0.0002: tmp = (ky / math.sin(kx)) * math.sin(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)))) <= 0.0002) tmp = Float64(Float64(ky / sin(kx)) * sin(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)))) <= 0.0002) tmp = (ky / sin(kx)) * sin(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], 0.0002], N[(N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $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.0002:\\
\;\;\;\;\frac{ky}{\sin kx} \cdot \sin th\\
\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))))) < 2.0000000000000001e-4Initial program 94.6%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-sin.f6432.7
Applied rewrites32.7%
if 2.0000000000000001e-4 < (/.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 98.5%
Taylor expanded in kx around 0
lower-sin.f6463.0
Applied rewrites63.0%
Final simplification42.3%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 0.0002) (/ (* (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.0002) {
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.0002d0) 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.0002) {
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.0002: 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.0002) tmp = Float64(Float64(sin(th) * 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.0002) 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.0002], N[(N[(N[Sin[th], $MachinePrecision] * ky), $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.0002:\\
\;\;\;\;\frac{\sin th \cdot 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))))) < 2.0000000000000001e-4Initial program 94.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
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f6432.1
Applied rewrites32.1%
if 2.0000000000000001e-4 < (/.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 98.5%
Taylor expanded in kx around 0
lower-sin.f6463.0
Applied rewrites63.0%
Final simplification41.9%
(FPCore (kx ky th)
:precision binary64
(if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 2e-15)
(*
(/
(* (fma (* ky ky) -0.16666666666666666 1.0) ky)
(sqrt (+ (* kx kx) (* ky ky))))
(sin 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-15) {
tmp = ((fma((ky * ky), -0.16666666666666666, 1.0) * ky) / sqrt(((kx * kx) + (ky * ky)))) * sin(th);
} else {
tmp = 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-15) tmp = Float64(Float64(Float64(fma(Float64(ky * ky), -0.16666666666666666, 1.0) * ky) / sqrt(Float64(Float64(kx * kx) + Float64(ky * ky)))) * sin(th)); else tmp = sin(th); end return 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-15], N[(N[(N[(N[(N[(ky * ky), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * ky), $MachinePrecision] / N[Sqrt[N[(N[(kx * kx), $MachinePrecision] + N[(ky * ky), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $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^{-15}:\\
\;\;\;\;\frac{\mathsf{fma}\left(ky \cdot ky, -0.16666666666666666, 1\right) \cdot ky}{\sqrt{kx \cdot kx + ky \cdot ky}} \cdot \sin th\\
\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))))) < 2.0000000000000002e-15Initial program 94.6%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6459.4
Applied rewrites59.4%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6431.6
Applied rewrites31.6%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6430.2
Applied rewrites30.2%
if 2.0000000000000002e-15 < (/.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 98.6%
Taylor expanded in kx around 0
lower-sin.f6461.8
Applied rewrites61.8%
Final simplification40.4%
(FPCore (kx ky th)
:precision binary64
(if (<=
(*
(/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))
(sin th))
0.0)
(* (* (* -0.16666666666666666 th) th) th)
(*
(fma
(- (* (* th th) 0.008333333333333333) 0.16666666666666666)
(* th th)
1.0)
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)))) * sin(th)) <= 0.0) {
tmp = ((-0.16666666666666666 * th) * th) * th;
} else {
tmp = fma((((th * th) * 0.008333333333333333) - 0.16666666666666666), (th * th), 1.0) * th;
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) <= 0.0) tmp = Float64(Float64(Float64(-0.16666666666666666 * th) * th) * th); else tmp = Float64(fma(Float64(Float64(Float64(th * th) * 0.008333333333333333) - 0.16666666666666666), Float64(th * th), 1.0) * th); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[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], 0.0], N[(N[(N[(-0.16666666666666666 * th), $MachinePrecision] * th), $MachinePrecision] * th), $MachinePrecision], N[(N[(N[(N[(N[(th * th), $MachinePrecision] * 0.008333333333333333), $MachinePrecision] - 0.16666666666666666), $MachinePrecision] * N[(th * th), $MachinePrecision] + 1.0), $MachinePrecision] * th), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \leq 0:\\
\;\;\;\;\left(\left(-0.16666666666666666 \cdot th\right) \cdot th\right) \cdot th\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(th \cdot th\right) \cdot 0.008333333333333333 - 0.16666666666666666, th \cdot th, 1\right) \cdot th\\
\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)) < 0.0Initial program 96.9%
Taylor expanded in kx around 0
lower-sin.f6422.3
Applied rewrites22.3%
Taylor expanded in th around 0
Applied rewrites11.5%
Taylor expanded in th around inf
Applied rewrites12.3%
Applied rewrites12.3%
if 0.0 < (*.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.7%
Taylor expanded in kx around 0
lower-sin.f6422.6
Applied rewrites22.6%
Taylor expanded in th around 0
Applied rewrites13.9%
Final simplification13.0%
(FPCore (kx ky th)
:precision binary64
(if (<=
(*
(/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))
(sin th))
0.0)
(* (* (* -0.16666666666666666 th) th) th)
(* (fma (* -0.16666666666666666 th) th 1.0) 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)))) * sin(th)) <= 0.0) {
tmp = ((-0.16666666666666666 * th) * th) * th;
} else {
tmp = fma((-0.16666666666666666 * th), th, 1.0) * th;
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) <= 0.0) tmp = Float64(Float64(Float64(-0.16666666666666666 * th) * th) * th); else tmp = Float64(fma(Float64(-0.16666666666666666 * th), th, 1.0) * th); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[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], 0.0], N[(N[(N[(-0.16666666666666666 * th), $MachinePrecision] * th), $MachinePrecision] * th), $MachinePrecision], N[(N[(N[(-0.16666666666666666 * th), $MachinePrecision] * th + 1.0), $MachinePrecision] * th), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \leq 0:\\
\;\;\;\;\left(\left(-0.16666666666666666 \cdot th\right) \cdot th\right) \cdot th\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.16666666666666666 \cdot th, th, 1\right) \cdot th\\
\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)) < 0.0Initial program 96.9%
Taylor expanded in kx around 0
lower-sin.f6422.3
Applied rewrites22.3%
Taylor expanded in th around 0
Applied rewrites11.5%
Taylor expanded in th around inf
Applied rewrites12.3%
Applied rewrites12.3%
if 0.0 < (*.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.7%
Taylor expanded in kx around 0
lower-sin.f6422.6
Applied rewrites22.6%
Taylor expanded in th around 0
Applied rewrites14.1%
Applied rewrites14.1%
Final simplification13.1%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 5e-6) (* ky (/ 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)))) <= 5e-6) {
tmp = ky * (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)))) <= 5d-6) then
tmp = ky * (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)))) <= 5e-6) {
tmp = ky * (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)))) <= 5e-6: tmp = ky * (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)))) <= 5e-6) tmp = Float64(ky * Float64(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)))) <= 5e-6) tmp = ky * (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], 5e-6], N[(ky * N[(th / 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 5 \cdot 10^{-6}:\\
\;\;\;\;ky \cdot \frac{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))))) < 5.00000000000000041e-6Initial program 94.6%
Taylor expanded in th around 0
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
unpow2N/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-pow.f64N/A
lower-sin.f6443.4
Applied rewrites43.4%
Taylor expanded in ky around 0
Applied rewrites17.7%
if 5.00000000000000041e-6 < (/.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 98.6%
Taylor expanded in kx around 0
lower-sin.f6462.4
Applied rewrites62.4%
Final simplification32.0%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 6e-60) (* (* (* -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)))) <= 6e-60) {
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)))) <= 6d-60) 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)))) <= 6e-60) {
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)))) <= 6e-60: 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)))) <= 6e-60) tmp = Float64(Float64(Float64(-0.16666666666666666 * th) * 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)))) <= 6e-60) 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], 6e-60], N[(N[(N[(-0.16666666666666666 * th), $MachinePrecision] * th), $MachinePrecision] * th), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 6 \cdot 10^{-60}:\\
\;\;\;\;\left(\left(-0.16666666666666666 \cdot th\right) \cdot th\right) \cdot th\\
\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))))) < 6.00000000000000038e-60Initial program 94.5%
Taylor expanded in kx around 0
lower-sin.f643.4
Applied rewrites3.4%
Taylor expanded in th around 0
Applied rewrites3.2%
Taylor expanded in th around inf
Applied rewrites10.9%
Applied rewrites10.9%
if 6.00000000000000038e-60 < (/.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 98.6%
Taylor expanded in kx around 0
lower-sin.f6459.3
Applied rewrites59.3%
Final simplification27.3%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.15)
(*
(/
(sin ky)
(hypot (sin ky) (* (fma -0.16666666666666666 (* kx kx) 1.0) kx)))
(* (fma (* th th) -0.16666666666666666 1.0) th))
(if (<= (sin ky) 2e-147)
(* (/ (sin th) (sin kx)) (sin ky))
(if (<= (sin ky) 0.0005)
(*
(/
(* (fma (* ky ky) -0.16666666666666666 1.0) ky)
(sqrt
(+
(- 0.5 (* (cos (* 2.0 kx)) 0.5))
(*
(fma
(-
(*
(*
(fma (* ky ky) -0.0031746031746031746 0.044444444444444446)
ky)
ky)
0.3333333333333333)
(* ky ky)
1.0)
(* ky ky)))))
(sin th))
(sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.15) {
tmp = (sin(ky) / hypot(sin(ky), (fma(-0.16666666666666666, (kx * kx), 1.0) * kx))) * (fma((th * th), -0.16666666666666666, 1.0) * th);
} else if (sin(ky) <= 2e-147) {
tmp = (sin(th) / sin(kx)) * sin(ky);
} else if (sin(ky) <= 0.0005) {
tmp = ((fma((ky * ky), -0.16666666666666666, 1.0) * ky) / sqrt(((0.5 - (cos((2.0 * kx)) * 0.5)) + (fma((((fma((ky * ky), -0.0031746031746031746, 0.044444444444444446) * ky) * ky) - 0.3333333333333333), (ky * ky), 1.0) * (ky * ky))))) * sin(th);
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.15) tmp = Float64(Float64(sin(ky) / hypot(sin(ky), Float64(fma(-0.16666666666666666, Float64(kx * kx), 1.0) * kx))) * Float64(fma(Float64(th * th), -0.16666666666666666, 1.0) * th)); elseif (sin(ky) <= 2e-147) tmp = Float64(Float64(sin(th) / sin(kx)) * sin(ky)); elseif (sin(ky) <= 0.0005) tmp = Float64(Float64(Float64(fma(Float64(ky * ky), -0.16666666666666666, 1.0) * ky) / sqrt(Float64(Float64(0.5 - Float64(cos(Float64(2.0 * kx)) * 0.5)) + Float64(fma(Float64(Float64(Float64(fma(Float64(ky * ky), -0.0031746031746031746, 0.044444444444444446) * ky) * ky) - 0.3333333333333333), Float64(ky * ky), 1.0) * Float64(ky * ky))))) * sin(th)); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.15], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[(N[(-0.16666666666666666 * N[(kx * kx), $MachinePrecision] + 1.0), $MachinePrecision] * kx), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(th * th), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * th), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-147], N[(N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision] * N[Sin[ky], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 0.0005], N[(N[(N[(N[(N[(ky * ky), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * ky), $MachinePrecision] / N[Sqrt[N[(N[(0.5 - N[(N[Cos[N[(2.0 * kx), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(N[(N[(N[(N[(ky * ky), $MachinePrecision] * -0.0031746031746031746 + 0.044444444444444446), $MachinePrecision] * ky), $MachinePrecision] * ky), $MachinePrecision] - 0.3333333333333333), $MachinePrecision] * N[(ky * ky), $MachinePrecision] + 1.0), $MachinePrecision] * N[(ky * ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.15:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \mathsf{fma}\left(-0.16666666666666666, kx \cdot kx, 1\right) \cdot kx\right)} \cdot \left(\mathsf{fma}\left(th \cdot th, -0.16666666666666666, 1\right) \cdot th\right)\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-147}:\\
\;\;\;\;\frac{\sin th}{\sin kx} \cdot \sin ky\\
\mathbf{elif}\;\sin ky \leq 0.0005:\\
\;\;\;\;\frac{\mathsf{fma}\left(ky \cdot ky, -0.16666666666666666, 1\right) \cdot ky}{\sqrt{\left(0.5 - \cos \left(2 \cdot kx\right) \cdot 0.5\right) + \mathsf{fma}\left(\left(\mathsf{fma}\left(ky \cdot ky, -0.0031746031746031746, 0.044444444444444446\right) \cdot ky\right) \cdot ky - 0.3333333333333333, ky \cdot ky, 1\right) \cdot \left(ky \cdot ky\right)}} \cdot \sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.149999999999999994Initial program 99.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 th around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6454.1
Applied rewrites54.1%
Taylor expanded in kx around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6427.4
Applied rewrites27.4%
if -0.149999999999999994 < (sin.f64 ky) < 1.9999999999999999e-147Initial program 90.1%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6490.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.5
Applied rewrites99.5%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-sin.f64N/A
lower-sin.f6444.4
Applied rewrites44.4%
if 1.9999999999999999e-147 < (sin.f64 ky) < 5.0000000000000001e-4Initial program 99.7%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6499.2
Applied rewrites99.2%
lift-pow.f64N/A
pow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sqr-sin-aN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
count-2-revN/A
lower-cos.f64N/A
count-2-revN/A
lower-*.f6493.7
Applied rewrites93.7%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites94.1%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6494.1
Applied rewrites94.1%
if 5.0000000000000001e-4 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0
lower-sin.f6457.0
Applied rewrites57.0%
Final simplification49.9%
(FPCore (kx ky th)
:precision binary64
(if (<= ky 0.00245)
(*
(/
(sin ky)
(hypot (* (fma (* ky ky) -0.16666666666666666 1.0) ky) (sin kx)))
(sin th))
(*
(*
(sqrt
(pow
(/ (+ (- 1.0 (cos (* 2.0 kx))) (- 1.0 (cos (* -2.0 ky)))) 2.0)
-1.0))
(sin ky))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 0.00245) {
tmp = (sin(ky) / hypot((fma((ky * ky), -0.16666666666666666, 1.0) * ky), sin(kx))) * sin(th);
} else {
tmp = (sqrt(pow((((1.0 - cos((2.0 * kx))) + (1.0 - cos((-2.0 * ky)))) / 2.0), -1.0)) * sin(ky)) * sin(th);
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (ky <= 0.00245) tmp = Float64(Float64(sin(ky) / hypot(Float64(fma(Float64(ky * ky), -0.16666666666666666, 1.0) * ky), sin(kx))) * sin(th)); else tmp = Float64(Float64(sqrt((Float64(Float64(Float64(1.0 - cos(Float64(2.0 * kx))) + Float64(1.0 - cos(Float64(-2.0 * ky)))) / 2.0) ^ -1.0)) * sin(ky)) * sin(th)); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[ky, 0.00245], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[(N[(ky * ky), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * ky), $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[Power[N[(N[(N[(1.0 - N[Cos[N[(2.0 * kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[Cos[N[(-2.0 * ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] * N[Sin[ky], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 0.00245:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\mathsf{fma}\left(ky \cdot ky, -0.16666666666666666, 1\right) \cdot ky, \sin kx\right)} \cdot \sin th\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{{\left(\frac{\left(1 - \cos \left(2 \cdot kx\right)\right) + \left(1 - \cos \left(-2 \cdot ky\right)\right)}{2}\right)}^{-1}} \cdot \sin ky\right) \cdot \sin th\\
\end{array}
\end{array}
if ky < 0.0024499999999999999Initial program 94.5%
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
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6467.9
Applied rewrites67.9%
if 0.0024499999999999999 < ky Initial program 99.8%
Taylor expanded in kx around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
unpow2N/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
lower-sin.f6499.6
Applied rewrites99.6%
Applied rewrites99.2%
Final simplification76.1%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) 2e-147)
(* (/ (sin th) (sin kx)) (sin ky))
(if (<= (sin ky) 0.0005)
(*
(/
(* (fma (* ky ky) -0.16666666666666666 1.0) ky)
(sqrt
(+
(- 0.5 (* (cos (* 2.0 kx)) 0.5))
(*
(fma
(-
(*
(* (fma (* ky ky) -0.0031746031746031746 0.044444444444444446) ky)
ky)
0.3333333333333333)
(* ky ky)
1.0)
(* ky ky)))))
(sin th))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 2e-147) {
tmp = (sin(th) / sin(kx)) * sin(ky);
} else if (sin(ky) <= 0.0005) {
tmp = ((fma((ky * ky), -0.16666666666666666, 1.0) * ky) / sqrt(((0.5 - (cos((2.0 * kx)) * 0.5)) + (fma((((fma((ky * ky), -0.0031746031746031746, 0.044444444444444446) * ky) * ky) - 0.3333333333333333), (ky * ky), 1.0) * (ky * ky))))) * sin(th);
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 2e-147) tmp = Float64(Float64(sin(th) / sin(kx)) * sin(ky)); elseif (sin(ky) <= 0.0005) tmp = Float64(Float64(Float64(fma(Float64(ky * ky), -0.16666666666666666, 1.0) * ky) / sqrt(Float64(Float64(0.5 - Float64(cos(Float64(2.0 * kx)) * 0.5)) + Float64(fma(Float64(Float64(Float64(fma(Float64(ky * ky), -0.0031746031746031746, 0.044444444444444446) * ky) * ky) - 0.3333333333333333), Float64(ky * ky), 1.0) * Float64(ky * ky))))) * sin(th)); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-147], N[(N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision] * N[Sin[ky], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 0.0005], N[(N[(N[(N[(N[(ky * ky), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * ky), $MachinePrecision] / N[Sqrt[N[(N[(0.5 - N[(N[Cos[N[(2.0 * kx), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(N[(N[(N[(N[(ky * ky), $MachinePrecision] * -0.0031746031746031746 + 0.044444444444444446), $MachinePrecision] * ky), $MachinePrecision] * ky), $MachinePrecision] - 0.3333333333333333), $MachinePrecision] * N[(ky * ky), $MachinePrecision] + 1.0), $MachinePrecision] * N[(ky * ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 2 \cdot 10^{-147}:\\
\;\;\;\;\frac{\sin th}{\sin kx} \cdot \sin ky\\
\mathbf{elif}\;\sin ky \leq 0.0005:\\
\;\;\;\;\frac{\mathsf{fma}\left(ky \cdot ky, -0.16666666666666666, 1\right) \cdot ky}{\sqrt{\left(0.5 - \cos \left(2 \cdot kx\right) \cdot 0.5\right) + \mathsf{fma}\left(\left(\mathsf{fma}\left(ky \cdot ky, -0.0031746031746031746, 0.044444444444444446\right) \cdot ky\right) \cdot ky - 0.3333333333333333, ky \cdot ky, 1\right) \cdot \left(ky \cdot ky\right)}} \cdot \sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 1.9999999999999999e-147Initial program 93.5%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6493.4
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
lower-/.f64N/A
lower-sin.f64N/A
lower-sin.f6431.3
Applied rewrites31.3%
if 1.9999999999999999e-147 < (sin.f64 ky) < 5.0000000000000001e-4Initial program 99.7%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6499.2
Applied rewrites99.2%
lift-pow.f64N/A
pow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sqr-sin-aN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
count-2-revN/A
lower-cos.f64N/A
count-2-revN/A
lower-*.f6493.7
Applied rewrites93.7%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites94.1%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6494.1
Applied rewrites94.1%
if 5.0000000000000001e-4 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0
lower-sin.f6457.0
Applied rewrites57.0%
Final simplification45.5%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) 2e-147)
(* (/ ky (sin kx)) (sin th))
(if (<= (sin ky) 0.0005)
(*
(/
(* (fma (* ky ky) -0.16666666666666666 1.0) ky)
(sqrt
(+
(- 0.5 (* (cos (* 2.0 kx)) 0.5))
(*
(fma
(-
(*
(* (fma (* ky ky) -0.0031746031746031746 0.044444444444444446) ky)
ky)
0.3333333333333333)
(* ky ky)
1.0)
(* ky ky)))))
(sin th))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 2e-147) {
tmp = (ky / sin(kx)) * sin(th);
} else if (sin(ky) <= 0.0005) {
tmp = ((fma((ky * ky), -0.16666666666666666, 1.0) * ky) / sqrt(((0.5 - (cos((2.0 * kx)) * 0.5)) + (fma((((fma((ky * ky), -0.0031746031746031746, 0.044444444444444446) * ky) * ky) - 0.3333333333333333), (ky * ky), 1.0) * (ky * ky))))) * sin(th);
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 2e-147) tmp = Float64(Float64(ky / sin(kx)) * sin(th)); elseif (sin(ky) <= 0.0005) tmp = Float64(Float64(Float64(fma(Float64(ky * ky), -0.16666666666666666, 1.0) * ky) / sqrt(Float64(Float64(0.5 - Float64(cos(Float64(2.0 * kx)) * 0.5)) + Float64(fma(Float64(Float64(Float64(fma(Float64(ky * ky), -0.0031746031746031746, 0.044444444444444446) * ky) * ky) - 0.3333333333333333), Float64(ky * ky), 1.0) * Float64(ky * ky))))) * sin(th)); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-147], N[(N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 0.0005], N[(N[(N[(N[(N[(ky * ky), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * ky), $MachinePrecision] / N[Sqrt[N[(N[(0.5 - N[(N[Cos[N[(2.0 * kx), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(N[(N[(N[(N[(ky * ky), $MachinePrecision] * -0.0031746031746031746 + 0.044444444444444446), $MachinePrecision] * ky), $MachinePrecision] * ky), $MachinePrecision] - 0.3333333333333333), $MachinePrecision] * N[(ky * ky), $MachinePrecision] + 1.0), $MachinePrecision] * N[(ky * ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 2 \cdot 10^{-147}:\\
\;\;\;\;\frac{ky}{\sin kx} \cdot \sin th\\
\mathbf{elif}\;\sin ky \leq 0.0005:\\
\;\;\;\;\frac{\mathsf{fma}\left(ky \cdot ky, -0.16666666666666666, 1\right) \cdot ky}{\sqrt{\left(0.5 - \cos \left(2 \cdot kx\right) \cdot 0.5\right) + \mathsf{fma}\left(\left(\mathsf{fma}\left(ky \cdot ky, -0.0031746031746031746, 0.044444444444444446\right) \cdot ky\right) \cdot ky - 0.3333333333333333, ky \cdot ky, 1\right) \cdot \left(ky \cdot ky\right)}} \cdot \sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 1.9999999999999999e-147Initial program 93.5%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-sin.f6429.3
Applied rewrites29.3%
if 1.9999999999999999e-147 < (sin.f64 ky) < 5.0000000000000001e-4Initial program 99.7%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6499.2
Applied rewrites99.2%
lift-pow.f64N/A
pow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sqr-sin-aN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
count-2-revN/A
lower-cos.f64N/A
count-2-revN/A
lower-*.f6493.7
Applied rewrites93.7%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites94.1%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6494.1
Applied rewrites94.1%
if 5.0000000000000001e-4 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0
lower-sin.f6457.0
Applied rewrites57.0%
Final simplification44.3%
(FPCore (kx ky th)
:precision binary64
(if (<= ky 0.00245)
(*
(/
(sin ky)
(hypot (* (fma (* ky ky) -0.16666666666666666 1.0) ky) (sin kx)))
(sin th))
(*
(/
(sin ky)
(/
(sqrt
(fma (- 1.0 (cos (* 2.0 ky))) 2.0 (* 2.0 (- 1.0 (cos (* 2.0 kx))))))
2.0))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 0.00245) {
tmp = (sin(ky) / hypot((fma((ky * ky), -0.16666666666666666, 1.0) * ky), sin(kx))) * sin(th);
} else {
tmp = (sin(ky) / (sqrt(fma((1.0 - cos((2.0 * ky))), 2.0, (2.0 * (1.0 - cos((2.0 * kx)))))) / 2.0)) * sin(th);
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (ky <= 0.00245) tmp = Float64(Float64(sin(ky) / hypot(Float64(fma(Float64(ky * ky), -0.16666666666666666, 1.0) * ky), sin(kx))) * sin(th)); else tmp = Float64(Float64(sin(ky) / Float64(sqrt(fma(Float64(1.0 - cos(Float64(2.0 * ky))), 2.0, Float64(2.0 * Float64(1.0 - cos(Float64(2.0 * kx)))))) / 2.0)) * sin(th)); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[ky, 0.00245], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[(N[(ky * ky), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * ky), $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], N[(N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[(N[(1.0 - N[Cos[N[(2.0 * ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 2.0 + N[(2.0 * N[(1.0 - N[Cos[N[(2.0 * kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 0.00245:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\mathsf{fma}\left(ky \cdot ky, -0.16666666666666666, 1\right) \cdot ky, \sin kx\right)} \cdot \sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky}{\frac{\sqrt{\mathsf{fma}\left(1 - \cos \left(2 \cdot ky\right), 2, 2 \cdot \left(1 - \cos \left(2 \cdot kx\right)\right)\right)}}{2}} \cdot \sin th\\
\end{array}
\end{array}
if ky < 0.0024499999999999999Initial program 94.5%
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
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6467.9
Applied rewrites67.9%
if 0.0024499999999999999 < ky Initial program 99.8%
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%
lift-hypot.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
frac-addN/A
metadata-evalN/A
metadata-evalN/A
sqrt-divN/A
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites99.4%
(FPCore (kx ky th)
:precision binary64
(if (<= ky 0.00245)
(*
(/
(sin ky)
(hypot (* (fma (* ky ky) -0.16666666666666666 1.0) ky) (sin kx)))
(sin th))
(*
(/
(* (sin th) (sqrt 2.0))
(sqrt (+ (- 1.0 (cos (* 2.0 kx))) (- 1.0 (cos (* -2.0 ky))))))
(sin ky))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 0.00245) {
tmp = (sin(ky) / hypot((fma((ky * ky), -0.16666666666666666, 1.0) * ky), sin(kx))) * sin(th);
} else {
tmp = ((sin(th) * sqrt(2.0)) / sqrt(((1.0 - cos((2.0 * kx))) + (1.0 - cos((-2.0 * ky)))))) * sin(ky);
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (ky <= 0.00245) tmp = Float64(Float64(sin(ky) / hypot(Float64(fma(Float64(ky * ky), -0.16666666666666666, 1.0) * ky), sin(kx))) * sin(th)); else tmp = Float64(Float64(Float64(sin(th) * sqrt(2.0)) / sqrt(Float64(Float64(1.0 - cos(Float64(2.0 * kx))) + Float64(1.0 - cos(Float64(-2.0 * ky)))))) * sin(ky)); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[ky, 0.00245], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[(N[(ky * ky), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * ky), $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Sin[th], $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(N[(1.0 - N[Cos[N[(2.0 * kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[Cos[N[(-2.0 * ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[ky], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 0.00245:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\mathsf{fma}\left(ky \cdot ky, -0.16666666666666666, 1\right) \cdot ky, \sin kx\right)} \cdot \sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th \cdot \sqrt{2}}{\sqrt{\left(1 - \cos \left(2 \cdot kx\right)\right) + \left(1 - \cos \left(-2 \cdot ky\right)\right)}} \cdot \sin ky\\
\end{array}
\end{array}
if ky < 0.0024499999999999999Initial program 94.5%
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
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6467.9
Applied rewrites67.9%
if 0.0024499999999999999 < ky Initial program 99.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.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.5
Applied rewrites99.5%
lift-hypot.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-add-revN/A
sqrt-divN/A
lower-/.f64N/A
Applied rewrites98.9%
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6499.0
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.0
lift-cos.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
metadata-evalN/A
lift-*.f6499.0
Applied rewrites99.0%
(FPCore (kx ky th)
:precision binary64
(if (<= ky 0.00245)
(*
(/
(sin ky)
(hypot (* (fma (* ky ky) -0.16666666666666666 1.0) ky) (sin kx)))
(sin th))
(*
(/
(* (sin th) (sin ky))
(sqrt (+ (- 1.0 (cos (* 2.0 kx))) (- 1.0 (cos (* -2.0 ky))))))
(sqrt 2.0))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 0.00245) {
tmp = (sin(ky) / hypot((fma((ky * ky), -0.16666666666666666, 1.0) * ky), sin(kx))) * sin(th);
} else {
tmp = ((sin(th) * sin(ky)) / sqrt(((1.0 - cos((2.0 * kx))) + (1.0 - cos((-2.0 * ky)))))) * sqrt(2.0);
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (ky <= 0.00245) tmp = Float64(Float64(sin(ky) / hypot(Float64(fma(Float64(ky * ky), -0.16666666666666666, 1.0) * ky), sin(kx))) * sin(th)); else tmp = Float64(Float64(Float64(sin(th) * sin(ky)) / sqrt(Float64(Float64(1.0 - cos(Float64(2.0 * kx))) + Float64(1.0 - cos(Float64(-2.0 * ky)))))) * sqrt(2.0)); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[ky, 0.00245], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[(N[(ky * ky), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * ky), $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Sin[th], $MachinePrecision] * N[Sin[ky], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(N[(1.0 - N[Cos[N[(2.0 * kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[Cos[N[(-2.0 * ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 0.00245:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\mathsf{fma}\left(ky \cdot ky, -0.16666666666666666, 1\right) \cdot ky, \sin kx\right)} \cdot \sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th \cdot \sin ky}{\sqrt{\left(1 - \cos \left(2 \cdot kx\right)\right) + \left(1 - \cos \left(-2 \cdot ky\right)\right)}} \cdot \sqrt{2}\\
\end{array}
\end{array}
if ky < 0.0024499999999999999Initial program 94.5%
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
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6467.9
Applied rewrites67.9%
if 0.0024499999999999999 < ky Initial program 99.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.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.5
Applied rewrites99.5%
lift-hypot.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-add-revN/A
sqrt-divN/A
lower-/.f64N/A
Applied rewrites98.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-/.f64N/A
associate-/r/N/A
lower-*.f64N/A
Applied rewrites98.9%
(FPCore (kx ky th)
:precision binary64
(if (<= ky 0.00245)
(*
(/
(sin ky)
(hypot (* (fma (* ky ky) -0.16666666666666666 1.0) ky) (sin kx)))
(sin th))
(*
(*
(/ (sin th) (sqrt (+ (- 1.0 (cos (* 2.0 kx))) (- 1.0 (cos (* -2.0 ky))))))
(sqrt 2.0))
(sin ky))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 0.00245) {
tmp = (sin(ky) / hypot((fma((ky * ky), -0.16666666666666666, 1.0) * ky), sin(kx))) * sin(th);
} else {
tmp = ((sin(th) / sqrt(((1.0 - cos((2.0 * kx))) + (1.0 - cos((-2.0 * ky)))))) * sqrt(2.0)) * sin(ky);
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (ky <= 0.00245) tmp = Float64(Float64(sin(ky) / hypot(Float64(fma(Float64(ky * ky), -0.16666666666666666, 1.0) * ky), sin(kx))) * sin(th)); else tmp = Float64(Float64(Float64(sin(th) / sqrt(Float64(Float64(1.0 - cos(Float64(2.0 * kx))) + Float64(1.0 - cos(Float64(-2.0 * ky)))))) * sqrt(2.0)) * sin(ky)); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[ky, 0.00245], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[(N[(ky * ky), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * ky), $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[(N[(1.0 - N[Cos[N[(2.0 * kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[Cos[N[(-2.0 * ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] * N[Sin[ky], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 0.00245:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\mathsf{fma}\left(ky \cdot ky, -0.16666666666666666, 1\right) \cdot ky, \sin kx\right)} \cdot \sin th\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{\sin th}{\sqrt{\left(1 - \cos \left(2 \cdot kx\right)\right) + \left(1 - \cos \left(-2 \cdot ky\right)\right)}} \cdot \sqrt{2}\right) \cdot \sin ky\\
\end{array}
\end{array}
if ky < 0.0024499999999999999Initial program 94.5%
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
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6467.9
Applied rewrites67.9%
if 0.0024499999999999999 < ky Initial program 99.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.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.5
Applied rewrites99.5%
lift-hypot.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-add-revN/A
sqrt-divN/A
lower-/.f64N/A
Applied rewrites98.9%
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
lower-*.f64N/A
Applied rewrites99.0%
(FPCore (kx ky th)
:precision binary64
(if (<= ky 0.00245)
(*
(/
(sin ky)
(hypot (* (fma (* ky ky) -0.16666666666666666 1.0) ky) (sin kx)))
(sin th))
(*
(*
(sin ky)
(/
(sin th)
(sqrt (+ (- 1.0 (cos (* 2.0 kx))) (- 1.0 (cos (* -2.0 ky)))))))
(sqrt 2.0))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 0.00245) {
tmp = (sin(ky) / hypot((fma((ky * ky), -0.16666666666666666, 1.0) * ky), sin(kx))) * sin(th);
} else {
tmp = (sin(ky) * (sin(th) / sqrt(((1.0 - cos((2.0 * kx))) + (1.0 - cos((-2.0 * ky))))))) * sqrt(2.0);
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (ky <= 0.00245) tmp = Float64(Float64(sin(ky) / hypot(Float64(fma(Float64(ky * ky), -0.16666666666666666, 1.0) * ky), sin(kx))) * sin(th)); else tmp = Float64(Float64(sin(ky) * Float64(sin(th) / sqrt(Float64(Float64(1.0 - cos(Float64(2.0 * kx))) + Float64(1.0 - cos(Float64(-2.0 * ky))))))) * sqrt(2.0)); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[ky, 0.00245], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[(N[(ky * ky), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * ky), $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], N[(N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[(N[(1.0 - N[Cos[N[(2.0 * kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[Cos[N[(-2.0 * ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 0.00245:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\mathsf{fma}\left(ky \cdot ky, -0.16666666666666666, 1\right) \cdot ky, \sin kx\right)} \cdot \sin th\\
\mathbf{else}:\\
\;\;\;\;\left(\sin ky \cdot \frac{\sin th}{\sqrt{\left(1 - \cos \left(2 \cdot kx\right)\right) + \left(1 - \cos \left(-2 \cdot ky\right)\right)}}\right) \cdot \sqrt{2}\\
\end{array}
\end{array}
if ky < 0.0024499999999999999Initial program 94.5%
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
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6467.9
Applied rewrites67.9%
if 0.0024499999999999999 < ky Initial program 99.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.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.5
Applied rewrites99.5%
lift-hypot.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-add-revN/A
sqrt-divN/A
lower-/.f64N/A
Applied rewrites98.9%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites98.9%
(FPCore (kx ky th)
:precision binary64
(if (<= kx 7e-146)
(sin th)
(if (<= kx 2e-5)
(* (sin ky) (/ (sin th) (sqrt (+ (* ky ky) (* kx kx)))))
(* (/ (sin ky) (sqrt (- 0.5 (* (cos (* -2.0 kx)) 0.5)))) (sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 7e-146) {
tmp = sin(th);
} else if (kx <= 2e-5) {
tmp = sin(ky) * (sin(th) / sqrt(((ky * ky) + (kx * kx))));
} else {
tmp = (sin(ky) / sqrt((0.5 - (cos((-2.0 * kx)) * 0.5)))) * 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 (kx <= 7d-146) then
tmp = sin(th)
else if (kx <= 2d-5) then
tmp = sin(ky) * (sin(th) / sqrt(((ky * ky) + (kx * kx))))
else
tmp = (sin(ky) / sqrt((0.5d0 - (cos(((-2.0d0) * kx)) * 0.5d0)))) * sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 7e-146) {
tmp = Math.sin(th);
} else if (kx <= 2e-5) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sqrt(((ky * ky) + (kx * kx))));
} else {
tmp = (Math.sin(ky) / Math.sqrt((0.5 - (Math.cos((-2.0 * kx)) * 0.5)))) * Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 7e-146: tmp = math.sin(th) elif kx <= 2e-5: tmp = math.sin(ky) * (math.sin(th) / math.sqrt(((ky * ky) + (kx * kx)))) else: tmp = (math.sin(ky) / math.sqrt((0.5 - (math.cos((-2.0 * kx)) * 0.5)))) * math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 7e-146) tmp = sin(th); elseif (kx <= 2e-5) tmp = Float64(sin(ky) * Float64(sin(th) / sqrt(Float64(Float64(ky * ky) + Float64(kx * kx))))); else tmp = Float64(Float64(sin(ky) / sqrt(Float64(0.5 - Float64(cos(Float64(-2.0 * kx)) * 0.5)))) * sin(th)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 7e-146) tmp = sin(th); elseif (kx <= 2e-5) tmp = sin(ky) * (sin(th) / sqrt(((ky * ky) + (kx * kx)))); else tmp = (sin(ky) / sqrt((0.5 - (cos((-2.0 * kx)) * 0.5)))) * sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 7e-146], N[Sin[th], $MachinePrecision], If[LessEqual[kx, 2e-5], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[(N[(ky * ky), $MachinePrecision] + N[(kx * kx), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(0.5 - N[(N[Cos[N[(-2.0 * kx), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 7 \cdot 10^{-146}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;kx \leq 2 \cdot 10^{-5}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sqrt{ky \cdot ky + kx \cdot kx}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky}{\sqrt{0.5 - \cos \left(-2 \cdot kx\right) \cdot 0.5}} \cdot \sin th\\
\end{array}
\end{array}
if kx < 7.0000000000000003e-146Initial program 93.6%
Taylor expanded in kx around 0
lower-sin.f6426.1
Applied rewrites26.1%
if 7.0000000000000003e-146 < kx < 2.00000000000000016e-5Initial program 99.8%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6451.8
Applied rewrites51.8%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6451.8
Applied rewrites51.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6451.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6451.8
Applied rewrites51.8%
if 2.00000000000000016e-5 < kx Initial program 99.6%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6449.5
Applied rewrites49.5%
lift-pow.f64N/A
pow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sqr-sin-aN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
count-2-revN/A
lower-cos.f64N/A
count-2-revN/A
lower-*.f6449.3
Applied rewrites49.3%
Taylor expanded in ky around 0
lower-sqrt.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval56.2
Applied rewrites56.2%
Final simplification37.0%
(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(Float64(Float64(-0.16666666666666666 * th) * th) * th) end
function tmp = code(kx, ky, th) tmp = ((-0.16666666666666666 * th) * th) * th; end
code[kx_, ky_, th_] := N[(N[(N[(-0.16666666666666666 * th), $MachinePrecision] * th), $MachinePrecision] * th), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(-0.16666666666666666 \cdot th\right) \cdot th\right) \cdot th
\end{array}
Initial program 95.9%
Taylor expanded in kx around 0
lower-sin.f6422.4
Applied rewrites22.4%
Taylor expanded in th around 0
Applied rewrites12.7%
Taylor expanded in th around inf
Applied rewrites8.4%
Applied rewrites8.4%
Final simplification8.4%
herbie shell --seed 2024340
(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)))