
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 32 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\end{array}
(FPCore (kx ky th) :precision binary64 (/ (sin th) (/ (hypot (sin ky) (sin kx)) (sin ky))))
double code(double kx, double ky, double th) {
return sin(th) / (hypot(sin(ky), sin(kx)) / sin(ky));
}
public static double code(double kx, double ky, double th) {
return Math.sin(th) / (Math.hypot(Math.sin(ky), Math.sin(kx)) / Math.sin(ky));
}
def code(kx, ky, th): return math.sin(th) / (math.hypot(math.sin(ky), math.sin(kx)) / math.sin(ky))
function code(kx, ky, th) return Float64(sin(th) / Float64(hypot(sin(ky), sin(kx)) / sin(ky))) end
function tmp = code(kx, ky, th) tmp = sin(th) / (hypot(sin(ky), sin(kx)) / sin(ky)); end
code[kx_, ky_, th_] := N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{\sin ky}}
\end{array}
Initial program 92.7%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6492.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.8
Applied rewrites99.8%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (hypot (sin ky) (sin kx)))
(t_2 (pow (sin kx) 2.0))
(t_3 (* (fma (* th th) -0.16666666666666666 1.0) th))
(t_4 (pow (sin ky) 2.0))
(t_5 (* (/ (sin ky) (sqrt (+ (* kx kx) t_4))) (sin th)))
(t_6 (/ (sin ky) (sqrt (+ t_2 t_4)))))
(if (<= t_6 -1.0)
t_5
(if (<= t_6 -0.15)
(/ t_3 (/ t_1 (sin ky)))
(if (<= t_6 4e-10)
(* (/ (sin ky) (sqrt (+ t_2 (* ky ky)))) (sin th))
(if (<= t_6 0.995)
(*
(/
(sin ky)
(/
(sqrt
(fma
(- 1.0 (cos (* ky 2.0)))
2.0
(* 2.0 (- 1.0 (cos (* 2.0 kx))))))
2.0))
t_3)
(if (<= t_6 1.0) t_5 (/ (/ (sin th) t_1) (pow ky -1.0)))))))))
double code(double kx, double ky, double th) {
double t_1 = hypot(sin(ky), sin(kx));
double t_2 = pow(sin(kx), 2.0);
double t_3 = fma((th * th), -0.16666666666666666, 1.0) * th;
double t_4 = pow(sin(ky), 2.0);
double t_5 = (sin(ky) / sqrt(((kx * kx) + t_4))) * sin(th);
double t_6 = sin(ky) / sqrt((t_2 + t_4));
double tmp;
if (t_6 <= -1.0) {
tmp = t_5;
} else if (t_6 <= -0.15) {
tmp = t_3 / (t_1 / sin(ky));
} else if (t_6 <= 4e-10) {
tmp = (sin(ky) / sqrt((t_2 + (ky * ky)))) * sin(th);
} else if (t_6 <= 0.995) {
tmp = (sin(ky) / (sqrt(fma((1.0 - cos((ky * 2.0))), 2.0, (2.0 * (1.0 - cos((2.0 * kx)))))) / 2.0)) * t_3;
} else if (t_6 <= 1.0) {
tmp = t_5;
} else {
tmp = (sin(th) / t_1) / pow(ky, -1.0);
}
return tmp;
}
function code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)) t_2 = sin(kx) ^ 2.0 t_3 = Float64(fma(Float64(th * th), -0.16666666666666666, 1.0) * th) t_4 = sin(ky) ^ 2.0 t_5 = Float64(Float64(sin(ky) / sqrt(Float64(Float64(kx * kx) + t_4))) * sin(th)) t_6 = Float64(sin(ky) / sqrt(Float64(t_2 + t_4))) tmp = 0.0 if (t_6 <= -1.0) tmp = t_5; elseif (t_6 <= -0.15) tmp = Float64(t_3 / Float64(t_1 / sin(ky))); elseif (t_6 <= 4e-10) tmp = Float64(Float64(sin(ky) / sqrt(Float64(t_2 + Float64(ky * ky)))) * sin(th)); elseif (t_6 <= 0.995) tmp = Float64(Float64(sin(ky) / Float64(sqrt(fma(Float64(1.0 - cos(Float64(ky * 2.0))), 2.0, Float64(2.0 * Float64(1.0 - cos(Float64(2.0 * kx)))))) / 2.0)) * t_3); elseif (t_6 <= 1.0) tmp = t_5; else tmp = Float64(Float64(sin(th) / t_1) / (ky ^ -1.0)); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]}, Block[{t$95$2 = N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(th * th), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * th), $MachinePrecision]}, Block[{t$95$4 = N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$5 = N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[(kx * kx), $MachinePrecision] + t$95$4), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$2 + t$95$4), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$6, -1.0], t$95$5, If[LessEqual[t$95$6, -0.15], N[(t$95$3 / N[(t$95$1 / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$6, 4e-10], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$2 + N[(ky * ky), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$6, 0.995], N[(N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[(N[(1.0 - N[Cos[N[(ky * 2.0), $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] * t$95$3), $MachinePrecision], If[LessEqual[t$95$6, 1.0], t$95$5, N[(N[(N[Sin[th], $MachinePrecision] / t$95$1), $MachinePrecision] / N[Power[ky, -1.0], $MachinePrecision]), $MachinePrecision]]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\
t_2 := {\sin kx}^{2}\\
t_3 := \mathsf{fma}\left(th \cdot th, -0.16666666666666666, 1\right) \cdot th\\
t_4 := {\sin ky}^{2}\\
t_5 := \frac{\sin ky}{\sqrt{kx \cdot kx + t\_4}} \cdot \sin th\\
t_6 := \frac{\sin ky}{\sqrt{t\_2 + t\_4}}\\
\mathbf{if}\;t\_6 \leq -1:\\
\;\;\;\;t\_5\\
\mathbf{elif}\;t\_6 \leq -0.15:\\
\;\;\;\;\frac{t\_3}{\frac{t\_1}{\sin ky}}\\
\mathbf{elif}\;t\_6 \leq 4 \cdot 10^{-10}:\\
\;\;\;\;\frac{\sin ky}{\sqrt{t\_2 + ky \cdot ky}} \cdot \sin th\\
\mathbf{elif}\;t\_6 \leq 0.995:\\
\;\;\;\;\frac{\sin ky}{\frac{\sqrt{\mathsf{fma}\left(1 - \cos \left(ky \cdot 2\right), 2, 2 \cdot \left(1 - \cos \left(2 \cdot kx\right)\right)\right)}}{2}} \cdot t\_3\\
\mathbf{elif}\;t\_6 \leq 1:\\
\;\;\;\;t\_5\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\sin th}{t\_1}}{{ky}^{-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))))) < -1 or 0.994999999999999996 < (/.f64 (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 89.7%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6489.4
Applied rewrites89.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.149999999999999994Initial program 99.6%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6499.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.4
Applied rewrites99.4%
Taylor expanded in th around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6440.4
Applied rewrites40.4%
if -0.149999999999999994 < (/.f64 (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.00000000000000015e-10Initial program 99.5%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6498.5
Applied rewrites98.5%
if 4.00000000000000015e-10 < (/.f64 (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.994999999999999996Initial program 99.3%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
frac-addN/A
metadata-evalN/A
metadata-evalN/A
sqrt-divN/A
Applied rewrites99.3%
Taylor expanded in th around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6457.9
Applied rewrites57.9%
if 1 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 2.8%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
div-invN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites99.5%
Taylor expanded in ky around 0
lower-/.f6499.5
Applied rewrites99.5%
Final simplification83.5%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (pow (sin ky) 2.0))
(t_2 (* (/ (sin ky) (sqrt (+ (* kx kx) t_1))) (sin th)))
(t_3 (pow (sin kx) 2.0))
(t_4 (/ (sin ky) (sqrt (+ t_3 t_1))))
(t_5
(*
(/
(sin ky)
(/
(sqrt
(fma
(- 1.0 (cos (* ky 2.0)))
2.0
(* 2.0 (- 1.0 (cos (* 2.0 kx))))))
2.0))
(* (fma (* th th) -0.16666666666666666 1.0) th))))
(if (<= t_4 -1.0)
t_2
(if (<= t_4 -0.15)
t_5
(if (<= t_4 4e-10)
(* (/ (sin ky) (sqrt (+ t_3 (* ky ky)))) (sin th))
(if (<= t_4 0.995)
t_5
(if (<= t_4 1.0)
t_2
(/ (/ (sin th) (hypot (sin ky) (sin kx))) (pow ky -1.0)))))))))
double code(double kx, double ky, double th) {
double t_1 = pow(sin(ky), 2.0);
double t_2 = (sin(ky) / sqrt(((kx * kx) + t_1))) * sin(th);
double t_3 = pow(sin(kx), 2.0);
double t_4 = sin(ky) / sqrt((t_3 + t_1));
double t_5 = (sin(ky) / (sqrt(fma((1.0 - cos((ky * 2.0))), 2.0, (2.0 * (1.0 - cos((2.0 * kx)))))) / 2.0)) * (fma((th * th), -0.16666666666666666, 1.0) * th);
double tmp;
if (t_4 <= -1.0) {
tmp = t_2;
} else if (t_4 <= -0.15) {
tmp = t_5;
} else if (t_4 <= 4e-10) {
tmp = (sin(ky) / sqrt((t_3 + (ky * ky)))) * sin(th);
} else if (t_4 <= 0.995) {
tmp = t_5;
} else if (t_4 <= 1.0) {
tmp = t_2;
} else {
tmp = (sin(th) / hypot(sin(ky), sin(kx))) / pow(ky, -1.0);
}
return tmp;
}
function code(kx, ky, th) t_1 = sin(ky) ^ 2.0 t_2 = Float64(Float64(sin(ky) / sqrt(Float64(Float64(kx * kx) + t_1))) * sin(th)) t_3 = sin(kx) ^ 2.0 t_4 = Float64(sin(ky) / sqrt(Float64(t_3 + t_1))) t_5 = Float64(Float64(sin(ky) / Float64(sqrt(fma(Float64(1.0 - cos(Float64(ky * 2.0))), 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)) tmp = 0.0 if (t_4 <= -1.0) tmp = t_2; elseif (t_4 <= -0.15) tmp = t_5; elseif (t_4 <= 4e-10) tmp = Float64(Float64(sin(ky) / sqrt(Float64(t_3 + Float64(ky * ky)))) * sin(th)); elseif (t_4 <= 0.995) tmp = t_5; elseif (t_4 <= 1.0) tmp = t_2; else tmp = Float64(Float64(sin(th) / hypot(sin(ky), sin(kx))) / (ky ^ -1.0)); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[(kx * kx), $MachinePrecision] + t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$4 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$3 + t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[(N[(1.0 - N[Cos[N[(ky * 2.0), $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$4, -1.0], t$95$2, If[LessEqual[t$95$4, -0.15], t$95$5, If[LessEqual[t$95$4, 4e-10], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$3 + N[(ky * ky), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 0.995], t$95$5, If[LessEqual[t$95$4, 1.0], t$95$2, N[(N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] / N[Power[ky, -1.0], $MachinePrecision]), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := {\sin ky}^{2}\\
t_2 := \frac{\sin ky}{\sqrt{kx \cdot kx + t\_1}} \cdot \sin th\\
t_3 := {\sin kx}^{2}\\
t_4 := \frac{\sin ky}{\sqrt{t\_3 + t\_1}}\\
t_5 := \frac{\sin ky}{\frac{\sqrt{\mathsf{fma}\left(1 - \cos \left(ky \cdot 2\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{if}\;t\_4 \leq -1:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_4 \leq -0.15:\\
\;\;\;\;t\_5\\
\mathbf{elif}\;t\_4 \leq 4 \cdot 10^{-10}:\\
\;\;\;\;\frac{\sin ky}{\sqrt{t\_3 + ky \cdot ky}} \cdot \sin th\\
\mathbf{elif}\;t\_4 \leq 0.995:\\
\;\;\;\;t\_5\\
\mathbf{elif}\;t\_4 \leq 1:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\sin th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}}{{ky}^{-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))))) < -1 or 0.994999999999999996 < (/.f64 (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 89.7%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6489.4
Applied rewrites89.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.149999999999999994 or 4.00000000000000015e-10 < (/.f64 (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.994999999999999996Initial program 99.4%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
frac-addN/A
metadata-evalN/A
metadata-evalN/A
sqrt-divN/A
Applied rewrites99.4%
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%
if -0.149999999999999994 < (/.f64 (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.00000000000000015e-10Initial program 99.5%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6498.5
Applied rewrites98.5%
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))))) Initial program 2.8%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
div-invN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites99.5%
Taylor expanded in ky around 0
lower-/.f6499.5
Applied rewrites99.5%
Final simplification83.5%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1
(*
(/
(sin ky)
(/
(sqrt
(fma
(- 1.0 (cos (* ky 2.0)))
2.0
(* 2.0 (- 1.0 (cos (* 2.0 kx))))))
2.0))
(* (fma (* th th) -0.16666666666666666 1.0) th)))
(t_2 (pow (sin ky) 2.0))
(t_3 (* (/ (sin ky) (sqrt (+ (* kx kx) t_2))) (sin th)))
(t_4 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) t_2))))
(t_5 (/ (/ (sin th) (hypot (sin ky) (sin kx))) (pow ky -1.0))))
(if (<= t_4 -1.0)
t_3
(if (<= t_4 -0.15)
t_1
(if (<= t_4 4e-10)
t_5
(if (<= t_4 0.995) t_1 (if (<= t_4 1.0) t_3 t_5)))))))
double code(double kx, double ky, double th) {
double t_1 = (sin(ky) / (sqrt(fma((1.0 - cos((ky * 2.0))), 2.0, (2.0 * (1.0 - cos((2.0 * kx)))))) / 2.0)) * (fma((th * th), -0.16666666666666666, 1.0) * th);
double t_2 = pow(sin(ky), 2.0);
double t_3 = (sin(ky) / sqrt(((kx * kx) + t_2))) * sin(th);
double t_4 = sin(ky) / sqrt((pow(sin(kx), 2.0) + t_2));
double t_5 = (sin(th) / hypot(sin(ky), sin(kx))) / pow(ky, -1.0);
double tmp;
if (t_4 <= -1.0) {
tmp = t_3;
} else if (t_4 <= -0.15) {
tmp = t_1;
} else if (t_4 <= 4e-10) {
tmp = t_5;
} else if (t_4 <= 0.995) {
tmp = t_1;
} else if (t_4 <= 1.0) {
tmp = t_3;
} else {
tmp = t_5;
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(Float64(sin(ky) / Float64(sqrt(fma(Float64(1.0 - cos(Float64(ky * 2.0))), 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)) t_2 = sin(ky) ^ 2.0 t_3 = Float64(Float64(sin(ky) / sqrt(Float64(Float64(kx * kx) + t_2))) * sin(th)) t_4 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + t_2))) t_5 = Float64(Float64(sin(th) / hypot(sin(ky), sin(kx))) / (ky ^ -1.0)) tmp = 0.0 if (t_4 <= -1.0) tmp = t_3; elseif (t_4 <= -0.15) tmp = t_1; elseif (t_4 <= 4e-10) tmp = t_5; elseif (t_4 <= 0.995) tmp = t_1; elseif (t_4 <= 1.0) tmp = t_3; else tmp = t_5; end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[(N[(1.0 - N[Cos[N[(ky * 2.0), $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]}, Block[{t$95$2 = N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[(kx * kx), $MachinePrecision] + t$95$2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + t$95$2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] / N[Power[ky, -1.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$4, -1.0], t$95$3, If[LessEqual[t$95$4, -0.15], t$95$1, If[LessEqual[t$95$4, 4e-10], t$95$5, If[LessEqual[t$95$4, 0.995], t$95$1, If[LessEqual[t$95$4, 1.0], t$95$3, t$95$5]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\frac{\sqrt{\mathsf{fma}\left(1 - \cos \left(ky \cdot 2\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)\\
t_2 := {\sin ky}^{2}\\
t_3 := \frac{\sin ky}{\sqrt{kx \cdot kx + t\_2}} \cdot \sin th\\
t_4 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + t\_2}}\\
t_5 := \frac{\frac{\sin th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}}{{ky}^{-1}}\\
\mathbf{if}\;t\_4 \leq -1:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_4 \leq -0.15:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_4 \leq 4 \cdot 10^{-10}:\\
\;\;\;\;t\_5\\
\mathbf{elif}\;t\_4 \leq 0.995:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_4 \leq 1:\\
\;\;\;\;t\_3\\
\mathbf{else}:\\
\;\;\;\;t\_5\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -1 or 0.994999999999999996 < (/.f64 (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 89.7%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6489.4
Applied rewrites89.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.149999999999999994 or 4.00000000000000015e-10 < (/.f64 (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.994999999999999996Initial program 99.4%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
frac-addN/A
metadata-evalN/A
metadata-evalN/A
sqrt-divN/A
Applied rewrites99.4%
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%
if -0.149999999999999994 < (/.f64 (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.00000000000000015e-10 or 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))))) Initial program 90.9%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
div-invN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites99.4%
Taylor expanded in ky around 0
lower-/.f6498.5
Applied rewrites98.5%
Final simplification83.4%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (/ (sin th) (hypot (sin ky) (sin kx))) (pow ky -1.0)))
(t_2 (pow (sin ky) 2.0))
(t_3 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) t_2))))
(t_4
(*
(/
(sin ky)
(/
(sqrt
(fma
(- 1.0 (cos (* ky 2.0)))
2.0
(* 2.0 (- 1.0 (cos (* 2.0 kx))))))
2.0))
(* (fma (* th th) -0.16666666666666666 1.0) th))))
(if (<= t_3 -1.0)
(*
(/ (sin ky) (sqrt (+ (* kx kx) (- 0.5 (* 0.5 (cos (* 2.0 ky)))))))
(sin th))
(if (<= t_3 -0.15)
t_4
(if (<= t_3 4e-10)
t_1
(if (<= t_3 0.995)
t_4
(if (<= t_3 1.0)
(/ (sin th) (fma (/ 0.5 t_2) (* kx kx) 1.0))
t_1)))))))
double code(double kx, double ky, double th) {
double t_1 = (sin(th) / hypot(sin(ky), sin(kx))) / pow(ky, -1.0);
double t_2 = pow(sin(ky), 2.0);
double t_3 = sin(ky) / sqrt((pow(sin(kx), 2.0) + t_2));
double t_4 = (sin(ky) / (sqrt(fma((1.0 - cos((ky * 2.0))), 2.0, (2.0 * (1.0 - cos((2.0 * kx)))))) / 2.0)) * (fma((th * th), -0.16666666666666666, 1.0) * th);
double tmp;
if (t_3 <= -1.0) {
tmp = (sin(ky) / sqrt(((kx * kx) + (0.5 - (0.5 * cos((2.0 * ky))))))) * sin(th);
} else if (t_3 <= -0.15) {
tmp = t_4;
} else if (t_3 <= 4e-10) {
tmp = t_1;
} else if (t_3 <= 0.995) {
tmp = t_4;
} else if (t_3 <= 1.0) {
tmp = sin(th) / fma((0.5 / t_2), (kx * kx), 1.0);
} else {
tmp = t_1;
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(Float64(sin(th) / hypot(sin(ky), sin(kx))) / (ky ^ -1.0)) t_2 = sin(ky) ^ 2.0 t_3 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + t_2))) t_4 = Float64(Float64(sin(ky) / Float64(sqrt(fma(Float64(1.0 - cos(Float64(ky * 2.0))), 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)) tmp = 0.0 if (t_3 <= -1.0) tmp = Float64(Float64(sin(ky) / sqrt(Float64(Float64(kx * kx) + Float64(0.5 - Float64(0.5 * cos(Float64(2.0 * ky))))))) * sin(th)); elseif (t_3 <= -0.15) tmp = t_4; elseif (t_3 <= 4e-10) tmp = t_1; elseif (t_3 <= 0.995) tmp = t_4; elseif (t_3 <= 1.0) tmp = Float64(sin(th) / fma(Float64(0.5 / t_2), Float64(kx * kx), 1.0)); else tmp = t_1; end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] / N[Power[ky, -1.0], $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]}, Block[{t$95$4 = N[(N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[(N[(1.0 - N[Cos[N[(ky * 2.0), $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, -1.0], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[(kx * kx), $MachinePrecision] + N[(0.5 - N[(0.5 * N[Cos[N[(2.0 * ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, -0.15], t$95$4, If[LessEqual[t$95$3, 4e-10], t$95$1, If[LessEqual[t$95$3, 0.995], t$95$4, If[LessEqual[t$95$3, 1.0], N[(N[Sin[th], $MachinePrecision] / N[(N[(0.5 / t$95$2), $MachinePrecision] * N[(kx * kx), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\frac{\sin th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}}{{ky}^{-1}}\\
t_2 := {\sin ky}^{2}\\
t_3 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + t\_2}}\\
t_4 := \frac{\sin ky}{\frac{\sqrt{\mathsf{fma}\left(1 - \cos \left(ky \cdot 2\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{if}\;t\_3 \leq -1:\\
\;\;\;\;\frac{\sin ky}{\sqrt{kx \cdot kx + \left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right)}} \cdot \sin th\\
\mathbf{elif}\;t\_3 \leq -0.15:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;t\_3 \leq 4 \cdot 10^{-10}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_3 \leq 0.995:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;t\_3 \leq 1:\\
\;\;\;\;\frac{\sin th}{\mathsf{fma}\left(\frac{0.5}{t\_2}, kx \cdot kx, 1\right)}\\
\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 79.9%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6479.9
Applied rewrites79.9%
lift-pow.f64N/A
pow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sqr-sin-aN/A
lower--.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-cos.f64N/A
lower-*.f6451.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f6451.7
Applied rewrites51.7%
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.149999999999999994 or 4.00000000000000015e-10 < (/.f64 (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.994999999999999996Initial program 99.4%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
frac-addN/A
metadata-evalN/A
metadata-evalN/A
sqrt-divN/A
Applied rewrites99.4%
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%
if -0.149999999999999994 < (/.f64 (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.00000000000000015e-10 or 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))))) Initial program 90.9%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
div-invN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites99.4%
Taylor expanded in ky around 0
lower-/.f6498.5
Applied rewrites98.5%
if 0.994999999999999996 < (/.f64 (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 100.0%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f64100.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 kx around 0
+-commutativeN/A
associate-*r/N/A
associate-*l/N/A
metadata-evalN/A
associate-*r/N/A
lower-fma.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
unpow2N/A
lower-*.f6498.9
Applied rewrites98.9%
Final simplification78.3%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (hypot (sin ky) (sin kx)))
(t_2 (* (fma (* th th) -0.16666666666666666 1.0) th))
(t_3 (pow (sin ky) 2.0))
(t_4 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) t_3))))
(t_5
(/ (sin th) (/ t_1 (* (fma -0.16666666666666666 (* ky ky) 1.0) ky)))))
(if (<= t_4 -1.0)
(* (/ (sin ky) (sqrt (+ (* kx kx) t_3))) (sin th))
(if (<= t_4 -0.15)
(/ t_2 (/ t_1 (sin ky)))
(if (<= t_4 4e-10)
t_5
(if (<= t_4 0.995)
(*
(/
(sin ky)
(/
(sqrt
(fma
(- 1.0 (cos (* ky 2.0)))
2.0
(* 2.0 (- 1.0 (cos (* 2.0 kx))))))
2.0))
t_2)
(if (<= t_4 1.0)
(*
(/
(sin ky)
(sqrt
(+ (* (fma -0.3333333333333333 (* kx kx) 1.0) (* kx kx)) t_3)))
(sin th))
t_5)))))))
double code(double kx, double ky, double th) {
double t_1 = hypot(sin(ky), sin(kx));
double t_2 = fma((th * th), -0.16666666666666666, 1.0) * th;
double t_3 = pow(sin(ky), 2.0);
double t_4 = sin(ky) / sqrt((pow(sin(kx), 2.0) + t_3));
double t_5 = sin(th) / (t_1 / (fma(-0.16666666666666666, (ky * ky), 1.0) * ky));
double tmp;
if (t_4 <= -1.0) {
tmp = (sin(ky) / sqrt(((kx * kx) + t_3))) * sin(th);
} else if (t_4 <= -0.15) {
tmp = t_2 / (t_1 / sin(ky));
} else if (t_4 <= 4e-10) {
tmp = t_5;
} else if (t_4 <= 0.995) {
tmp = (sin(ky) / (sqrt(fma((1.0 - cos((ky * 2.0))), 2.0, (2.0 * (1.0 - cos((2.0 * kx)))))) / 2.0)) * t_2;
} else if (t_4 <= 1.0) {
tmp = (sin(ky) / sqrt(((fma(-0.3333333333333333, (kx * kx), 1.0) * (kx * kx)) + t_3))) * sin(th);
} else {
tmp = t_5;
}
return tmp;
}
function code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)) t_2 = Float64(fma(Float64(th * th), -0.16666666666666666, 1.0) * th) t_3 = sin(ky) ^ 2.0 t_4 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + t_3))) t_5 = Float64(sin(th) / Float64(t_1 / Float64(fma(-0.16666666666666666, Float64(ky * ky), 1.0) * ky))) tmp = 0.0 if (t_4 <= -1.0) tmp = Float64(Float64(sin(ky) / sqrt(Float64(Float64(kx * kx) + t_3))) * sin(th)); elseif (t_4 <= -0.15) tmp = Float64(t_2 / Float64(t_1 / sin(ky))); elseif (t_4 <= 4e-10) tmp = t_5; elseif (t_4 <= 0.995) tmp = Float64(Float64(sin(ky) / Float64(sqrt(fma(Float64(1.0 - cos(Float64(ky * 2.0))), 2.0, Float64(2.0 * Float64(1.0 - cos(Float64(2.0 * kx)))))) / 2.0)) * t_2); elseif (t_4 <= 1.0) tmp = Float64(Float64(sin(ky) / sqrt(Float64(Float64(fma(-0.3333333333333333, Float64(kx * kx), 1.0) * Float64(kx * kx)) + t_3))) * sin(th)); else tmp = t_5; end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(th * th), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * th), $MachinePrecision]}, Block[{t$95$3 = N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$4 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + t$95$3), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(N[Sin[th], $MachinePrecision] / N[(t$95$1 / N[(N[(-0.16666666666666666 * N[(ky * ky), $MachinePrecision] + 1.0), $MachinePrecision] * ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$4, -1.0], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[(kx * kx), $MachinePrecision] + t$95$3), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, -0.15], N[(t$95$2 / N[(t$95$1 / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 4e-10], t$95$5, If[LessEqual[t$95$4, 0.995], N[(N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[(N[(1.0 - N[Cos[N[(ky * 2.0), $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] * t$95$2), $MachinePrecision], If[LessEqual[t$95$4, 1.0], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[(N[(-0.3333333333333333 * N[(kx * kx), $MachinePrecision] + 1.0), $MachinePrecision] * N[(kx * kx), $MachinePrecision]), $MachinePrecision] + t$95$3), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], t$95$5]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\
t_2 := \mathsf{fma}\left(th \cdot th, -0.16666666666666666, 1\right) \cdot th\\
t_3 := {\sin ky}^{2}\\
t_4 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + t\_3}}\\
t_5 := \frac{\sin th}{\frac{t\_1}{\mathsf{fma}\left(-0.16666666666666666, ky \cdot ky, 1\right) \cdot ky}}\\
\mathbf{if}\;t\_4 \leq -1:\\
\;\;\;\;\frac{\sin ky}{\sqrt{kx \cdot kx + t\_3}} \cdot \sin th\\
\mathbf{elif}\;t\_4 \leq -0.15:\\
\;\;\;\;\frac{t\_2}{\frac{t\_1}{\sin ky}}\\
\mathbf{elif}\;t\_4 \leq 4 \cdot 10^{-10}:\\
\;\;\;\;t\_5\\
\mathbf{elif}\;t\_4 \leq 0.995:\\
\;\;\;\;\frac{\sin ky}{\frac{\sqrt{\mathsf{fma}\left(1 - \cos \left(ky \cdot 2\right), 2, 2 \cdot \left(1 - \cos \left(2 \cdot kx\right)\right)\right)}}{2}} \cdot t\_2\\
\mathbf{elif}\;t\_4 \leq 1:\\
\;\;\;\;\frac{\sin ky}{\sqrt{\mathsf{fma}\left(-0.3333333333333333, kx \cdot kx, 1\right) \cdot \left(kx \cdot kx\right) + t\_3}} \cdot \sin th\\
\mathbf{else}:\\
\;\;\;\;t\_5\\
\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 79.9%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6479.9
Applied rewrites79.9%
if -1 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.149999999999999994Initial program 99.6%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6499.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.4
Applied rewrites99.4%
Taylor expanded in th around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6440.4
Applied rewrites40.4%
if -0.149999999999999994 < (/.f64 (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.00000000000000015e-10 or 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))))) Initial program 90.9%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6491.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.7
Applied rewrites99.7%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6498.8
Applied rewrites98.8%
if 4.00000000000000015e-10 < (/.f64 (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.994999999999999996Initial program 99.3%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
frac-addN/A
metadata-evalN/A
metadata-evalN/A
sqrt-divN/A
Applied rewrites99.3%
Taylor expanded in th around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6457.9
Applied rewrites57.9%
if 0.994999999999999996 < (/.f64 (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 100.0%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6499.4
Applied rewrites99.4%
Taylor expanded in kx around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64100.0
Applied rewrites100.0%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (hypot (sin ky) (sin kx)))
(t_2 (* (fma (* th th) -0.16666666666666666 1.0) th))
(t_3 (pow (sin ky) 2.0))
(t_4 (* (/ (sin ky) (sqrt (+ (* kx kx) t_3))) (sin th)))
(t_5 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) t_3))))
(t_6
(/ (sin th) (/ t_1 (* (fma -0.16666666666666666 (* ky ky) 1.0) ky)))))
(if (<= t_5 -1.0)
t_4
(if (<= t_5 -0.15)
(/ t_2 (/ t_1 (sin ky)))
(if (<= t_5 4e-10)
t_6
(if (<= t_5 0.995)
(*
(/
(sin ky)
(/
(sqrt
(fma
(- 1.0 (cos (* ky 2.0)))
2.0
(* 2.0 (- 1.0 (cos (* 2.0 kx))))))
2.0))
t_2)
(if (<= t_5 1.0) t_4 t_6)))))))
double code(double kx, double ky, double th) {
double t_1 = hypot(sin(ky), sin(kx));
double t_2 = fma((th * th), -0.16666666666666666, 1.0) * th;
double t_3 = pow(sin(ky), 2.0);
double t_4 = (sin(ky) / sqrt(((kx * kx) + t_3))) * sin(th);
double t_5 = sin(ky) / sqrt((pow(sin(kx), 2.0) + t_3));
double t_6 = sin(th) / (t_1 / (fma(-0.16666666666666666, (ky * ky), 1.0) * ky));
double tmp;
if (t_5 <= -1.0) {
tmp = t_4;
} else if (t_5 <= -0.15) {
tmp = t_2 / (t_1 / sin(ky));
} else if (t_5 <= 4e-10) {
tmp = t_6;
} else if (t_5 <= 0.995) {
tmp = (sin(ky) / (sqrt(fma((1.0 - cos((ky * 2.0))), 2.0, (2.0 * (1.0 - cos((2.0 * kx)))))) / 2.0)) * t_2;
} else if (t_5 <= 1.0) {
tmp = t_4;
} else {
tmp = t_6;
}
return tmp;
}
function code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)) t_2 = Float64(fma(Float64(th * th), -0.16666666666666666, 1.0) * th) t_3 = sin(ky) ^ 2.0 t_4 = Float64(Float64(sin(ky) / sqrt(Float64(Float64(kx * kx) + t_3))) * sin(th)) t_5 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + t_3))) t_6 = Float64(sin(th) / Float64(t_1 / Float64(fma(-0.16666666666666666, Float64(ky * ky), 1.0) * ky))) tmp = 0.0 if (t_5 <= -1.0) tmp = t_4; elseif (t_5 <= -0.15) tmp = Float64(t_2 / Float64(t_1 / sin(ky))); elseif (t_5 <= 4e-10) tmp = t_6; elseif (t_5 <= 0.995) tmp = Float64(Float64(sin(ky) / Float64(sqrt(fma(Float64(1.0 - cos(Float64(ky * 2.0))), 2.0, Float64(2.0 * Float64(1.0 - cos(Float64(2.0 * kx)))))) / 2.0)) * t_2); elseif (t_5 <= 1.0) tmp = t_4; else tmp = t_6; end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(th * th), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * th), $MachinePrecision]}, Block[{t$95$3 = N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$4 = N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[(kx * kx), $MachinePrecision] + t$95$3), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + t$95$3), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[(N[Sin[th], $MachinePrecision] / N[(t$95$1 / N[(N[(-0.16666666666666666 * N[(ky * ky), $MachinePrecision] + 1.0), $MachinePrecision] * ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$5, -1.0], t$95$4, If[LessEqual[t$95$5, -0.15], N[(t$95$2 / N[(t$95$1 / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$5, 4e-10], t$95$6, If[LessEqual[t$95$5, 0.995], N[(N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[(N[(1.0 - N[Cos[N[(ky * 2.0), $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] * t$95$2), $MachinePrecision], If[LessEqual[t$95$5, 1.0], t$95$4, t$95$6]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\
t_2 := \mathsf{fma}\left(th \cdot th, -0.16666666666666666, 1\right) \cdot th\\
t_3 := {\sin ky}^{2}\\
t_4 := \frac{\sin ky}{\sqrt{kx \cdot kx + t\_3}} \cdot \sin th\\
t_5 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + t\_3}}\\
t_6 := \frac{\sin th}{\frac{t\_1}{\mathsf{fma}\left(-0.16666666666666666, ky \cdot ky, 1\right) \cdot ky}}\\
\mathbf{if}\;t\_5 \leq -1:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;t\_5 \leq -0.15:\\
\;\;\;\;\frac{t\_2}{\frac{t\_1}{\sin ky}}\\
\mathbf{elif}\;t\_5 \leq 4 \cdot 10^{-10}:\\
\;\;\;\;t\_6\\
\mathbf{elif}\;t\_5 \leq 0.995:\\
\;\;\;\;\frac{\sin ky}{\frac{\sqrt{\mathsf{fma}\left(1 - \cos \left(ky \cdot 2\right), 2, 2 \cdot \left(1 - \cos \left(2 \cdot kx\right)\right)\right)}}{2}} \cdot t\_2\\
\mathbf{elif}\;t\_5 \leq 1:\\
\;\;\;\;t\_4\\
\mathbf{else}:\\
\;\;\;\;t\_6\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -1 or 0.994999999999999996 < (/.f64 (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 89.7%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6489.4
Applied rewrites89.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.149999999999999994Initial program 99.6%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6499.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.4
Applied rewrites99.4%
Taylor expanded in th around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6440.4
Applied rewrites40.4%
if -0.149999999999999994 < (/.f64 (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.00000000000000015e-10 or 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))))) Initial program 90.9%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6491.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.7
Applied rewrites99.7%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6498.8
Applied rewrites98.8%
if 4.00000000000000015e-10 < (/.f64 (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.994999999999999996Initial program 99.3%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
frac-addN/A
metadata-evalN/A
metadata-evalN/A
sqrt-divN/A
Applied rewrites99.3%
Taylor expanded in th around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6457.9
Applied rewrites57.9%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))))
(t_2 (- 1.0 (cos (* 2.0 kx))))
(t_3
(*
(/
(sin ky)
(/ (sqrt (fma (- 1.0 (cos (* ky 2.0))) 2.0 (* 2.0 t_2))) 2.0))
(* (fma (* th th) -0.16666666666666666 1.0) th))))
(if (<= t_1 -1.0)
(*
(/ (sin ky) (sqrt (+ (* kx kx) (- 0.5 (* 0.5 (cos (* 2.0 ky)))))))
(sin th))
(if (<= t_1 -0.41)
t_3
(if (<= t_1 1e-178)
(* (/ (sin ky) (/ (sqrt (* t_2 2.0)) 2.0)) (sin th))
(if (<= t_1 4e-10)
(/ (sin th) (/ (sin kx) ky))
(if (<= t_1 0.995)
t_3
(/
(sin th)
(fma (/ (* 0.5 kx) (sin ky)) (/ kx (sin ky)) 1.0)))))))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double t_2 = 1.0 - cos((2.0 * kx));
double t_3 = (sin(ky) / (sqrt(fma((1.0 - cos((ky * 2.0))), 2.0, (2.0 * t_2))) / 2.0)) * (fma((th * th), -0.16666666666666666, 1.0) * th);
double tmp;
if (t_1 <= -1.0) {
tmp = (sin(ky) / sqrt(((kx * kx) + (0.5 - (0.5 * cos((2.0 * ky))))))) * sin(th);
} else if (t_1 <= -0.41) {
tmp = t_3;
} else if (t_1 <= 1e-178) {
tmp = (sin(ky) / (sqrt((t_2 * 2.0)) / 2.0)) * sin(th);
} else if (t_1 <= 4e-10) {
tmp = sin(th) / (sin(kx) / ky);
} else if (t_1 <= 0.995) {
tmp = t_3;
} else {
tmp = sin(th) / fma(((0.5 * kx) / sin(ky)), (kx / sin(ky)), 1.0);
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) t_2 = Float64(1.0 - cos(Float64(2.0 * kx))) t_3 = Float64(Float64(sin(ky) / Float64(sqrt(fma(Float64(1.0 - cos(Float64(ky * 2.0))), 2.0, Float64(2.0 * t_2))) / 2.0)) * Float64(fma(Float64(th * th), -0.16666666666666666, 1.0) * th)) tmp = 0.0 if (t_1 <= -1.0) tmp = Float64(Float64(sin(ky) / sqrt(Float64(Float64(kx * kx) + Float64(0.5 - Float64(0.5 * cos(Float64(2.0 * ky))))))) * sin(th)); elseif (t_1 <= -0.41) tmp = t_3; elseif (t_1 <= 1e-178) tmp = Float64(Float64(sin(ky) / Float64(sqrt(Float64(t_2 * 2.0)) / 2.0)) * sin(th)); elseif (t_1 <= 4e-10) tmp = Float64(sin(th) / Float64(sin(kx) / ky)); elseif (t_1 <= 0.995) tmp = t_3; else tmp = Float64(sin(th) / fma(Float64(Float64(0.5 * kx) / sin(ky)), Float64(kx / sin(ky)), 1.0)); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 - N[Cos[N[(2.0 * kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[(N[(1.0 - N[Cos[N[(ky * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 2.0 + N[(2.0 * t$95$2), $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$1, -1.0], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[(kx * kx), $MachinePrecision] + N[(0.5 - N[(0.5 * N[Cos[N[(2.0 * ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -0.41], t$95$3, If[LessEqual[t$95$1, 1e-178], N[(N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[(t$95$2 * 2.0), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 4e-10], N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.995], t$95$3, N[(N[Sin[th], $MachinePrecision] / N[(N[(N[(0.5 * kx), $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision] * N[(kx / N[Sin[ky], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
t_2 := 1 - \cos \left(2 \cdot kx\right)\\
t_3 := \frac{\sin ky}{\frac{\sqrt{\mathsf{fma}\left(1 - \cos \left(ky \cdot 2\right), 2, 2 \cdot t\_2\right)}}{2}} \cdot \left(\mathsf{fma}\left(th \cdot th, -0.16666666666666666, 1\right) \cdot th\right)\\
\mathbf{if}\;t\_1 \leq -1:\\
\;\;\;\;\frac{\sin ky}{\sqrt{kx \cdot kx + \left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right)}} \cdot \sin th\\
\mathbf{elif}\;t\_1 \leq -0.41:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_1 \leq 10^{-178}:\\
\;\;\;\;\frac{\sin ky}{\frac{\sqrt{t\_2 \cdot 2}}{2}} \cdot \sin th\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{-10}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{ky}}\\
\mathbf{elif}\;t\_1 \leq 0.995:\\
\;\;\;\;t\_3\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th}{\mathsf{fma}\left(\frac{0.5 \cdot kx}{\sin ky}, \frac{kx}{\sin ky}, 1\right)}\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -1Initial program 79.9%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6479.9
Applied rewrites79.9%
lift-pow.f64N/A
pow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sqr-sin-aN/A
lower--.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-cos.f64N/A
lower-*.f6451.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f6451.7
Applied rewrites51.7%
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.409999999999999976 or 4.00000000000000015e-10 < (/.f64 (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.994999999999999996Initial program 99.4%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
frac-addN/A
metadata-evalN/A
metadata-evalN/A
sqrt-divN/A
Applied rewrites99.4%
Taylor expanded in th around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6454.2
Applied rewrites54.2%
if -0.409999999999999976 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 9.9999999999999995e-179Initial program 99.5%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
frac-addN/A
metadata-evalN/A
metadata-evalN/A
sqrt-divN/A
Applied rewrites79.3%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower--.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sqrt.f6472.2
Applied rewrites72.2%
Applied rewrites72.3%
if 9.9999999999999995e-179 < (/.f64 (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.00000000000000015e-10Initial program 99.6%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6499.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.8
Applied rewrites99.8%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-sin.f6454.7
Applied rewrites54.7%
if 0.994999999999999996 < (/.f64 (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 83.5%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6483.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.9
Applied rewrites99.9%
Taylor expanded in kx around 0
+-commutativeN/A
associate-*r/N/A
associate-*l/N/A
metadata-evalN/A
associate-*r/N/A
lower-fma.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
unpow2N/A
lower-*.f6482.1
Applied rewrites82.1%
Applied rewrites92.8%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))))
(t_2 (cos (* 2.0 kx)))
(t_3 (cos (* 2.0 ky)))
(t_4
(*
(* 2.0 (* (sin ky) th))
(sqrt (/ 0.5 (- 1.0 (- t_2 (- 1.0 t_3))))))))
(if (<= t_1 -1.0)
(* (/ (sin ky) (sqrt (+ (* kx kx) (- 0.5 (* 0.5 t_3))))) (sin th))
(if (<= t_1 -0.41)
t_4
(if (<= t_1 1e-178)
(* (/ (sin ky) (/ (sqrt (* (- 1.0 t_2) 2.0)) 2.0)) (sin th))
(if (<= t_1 2e-11)
(/ (sin th) (/ (sin kx) ky))
(if (<= t_1 0.995)
t_4
(/
(sin th)
(fma (/ (* 0.5 kx) (sin ky)) (/ kx (sin ky)) 1.0)))))))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double t_2 = cos((2.0 * kx));
double t_3 = cos((2.0 * ky));
double t_4 = (2.0 * (sin(ky) * th)) * sqrt((0.5 / (1.0 - (t_2 - (1.0 - t_3)))));
double tmp;
if (t_1 <= -1.0) {
tmp = (sin(ky) / sqrt(((kx * kx) + (0.5 - (0.5 * t_3))))) * sin(th);
} else if (t_1 <= -0.41) {
tmp = t_4;
} else if (t_1 <= 1e-178) {
tmp = (sin(ky) / (sqrt(((1.0 - t_2) * 2.0)) / 2.0)) * sin(th);
} else if (t_1 <= 2e-11) {
tmp = sin(th) / (sin(kx) / ky);
} else if (t_1 <= 0.995) {
tmp = t_4;
} else {
tmp = sin(th) / fma(((0.5 * kx) / sin(ky)), (kx / sin(ky)), 1.0);
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) t_2 = cos(Float64(2.0 * kx)) t_3 = cos(Float64(2.0 * ky)) t_4 = Float64(Float64(2.0 * Float64(sin(ky) * th)) * sqrt(Float64(0.5 / Float64(1.0 - Float64(t_2 - Float64(1.0 - t_3)))))) tmp = 0.0 if (t_1 <= -1.0) tmp = Float64(Float64(sin(ky) / sqrt(Float64(Float64(kx * kx) + Float64(0.5 - Float64(0.5 * t_3))))) * sin(th)); elseif (t_1 <= -0.41) tmp = t_4; elseif (t_1 <= 1e-178) tmp = Float64(Float64(sin(ky) / Float64(sqrt(Float64(Float64(1.0 - t_2) * 2.0)) / 2.0)) * sin(th)); elseif (t_1 <= 2e-11) tmp = Float64(sin(th) / Float64(sin(kx) / ky)); elseif (t_1 <= 0.995) tmp = t_4; else tmp = Float64(sin(th) / fma(Float64(Float64(0.5 * kx) / sin(ky)), Float64(kx / sin(ky)), 1.0)); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Cos[N[(2.0 * kx), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Cos[N[(2.0 * ky), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(N[(2.0 * N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(0.5 / N[(1.0 - N[(t$95$2 - N[(1.0 - t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1.0], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[(kx * kx), $MachinePrecision] + N[(0.5 - N[(0.5 * t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -0.41], t$95$4, If[LessEqual[t$95$1, 1e-178], N[(N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[(N[(1.0 - t$95$2), $MachinePrecision] * 2.0), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e-11], N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.995], t$95$4, N[(N[Sin[th], $MachinePrecision] / N[(N[(N[(0.5 * kx), $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision] * N[(kx / N[Sin[ky], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
t_2 := \cos \left(2 \cdot kx\right)\\
t_3 := \cos \left(2 \cdot ky\right)\\
t_4 := \left(2 \cdot \left(\sin ky \cdot th\right)\right) \cdot \sqrt{\frac{0.5}{1 - \left(t\_2 - \left(1 - t\_3\right)\right)}}\\
\mathbf{if}\;t\_1 \leq -1:\\
\;\;\;\;\frac{\sin ky}{\sqrt{kx \cdot kx + \left(0.5 - 0.5 \cdot t\_3\right)}} \cdot \sin th\\
\mathbf{elif}\;t\_1 \leq -0.41:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;t\_1 \leq 10^{-178}:\\
\;\;\;\;\frac{\sin ky}{\frac{\sqrt{\left(1 - t\_2\right) \cdot 2}}{2}} \cdot \sin th\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-11}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{ky}}\\
\mathbf{elif}\;t\_1 \leq 0.995:\\
\;\;\;\;t\_4\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th}{\mathsf{fma}\left(\frac{0.5 \cdot kx}{\sin ky}, \frac{kx}{\sin ky}, 1\right)}\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -1Initial program 79.9%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6479.9
Applied rewrites79.9%
lift-pow.f64N/A
pow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sqr-sin-aN/A
lower--.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-cos.f64N/A
lower-*.f6451.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f6451.7
Applied rewrites51.7%
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.409999999999999976 or 1.99999999999999988e-11 < (/.f64 (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.994999999999999996Initial program 99.4%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
frac-addN/A
metadata-evalN/A
metadata-evalN/A
sqrt-divN/A
Applied rewrites99.4%
Taylor expanded in th around 0
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
distribute-lft-outN/A
associate-/r*N/A
metadata-evalN/A
lower-/.f64N/A
associate-+l-N/A
lower--.f64N/A
lower--.f64N/A
Applied rewrites53.3%
if -0.409999999999999976 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 9.9999999999999995e-179Initial program 99.5%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
frac-addN/A
metadata-evalN/A
metadata-evalN/A
sqrt-divN/A
Applied rewrites79.3%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower--.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sqrt.f6472.2
Applied rewrites72.2%
Applied rewrites72.3%
if 9.9999999999999995e-179 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 1.99999999999999988e-11Initial program 99.6%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6499.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.8
Applied rewrites99.8%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-sin.f6453.3
Applied rewrites53.3%
if 0.994999999999999996 < (/.f64 (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 83.5%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6483.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.9
Applied rewrites99.9%
Taylor expanded in kx around 0
+-commutativeN/A
associate-*r/N/A
associate-*l/N/A
metadata-evalN/A
associate-*r/N/A
lower-fma.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
unpow2N/A
lower-*.f6482.1
Applied rewrites82.1%
Applied rewrites92.8%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
(if (<= t_1 -0.7)
(* (/ (sin ky) (/ (sqrt (* (- 1.0 (cos (* 2.0 ky))) 2.0)) 2.0)) (sin th))
(if (<= t_1 1e-178)
(*
(/ (sin ky) (/ (sqrt (* (- 1.0 (cos (* 2.0 kx))) 2.0)) 2.0))
(sin th))
(if (<= t_1 0.21) (/ (sin th) (/ (sin kx) (sin ky))) (sin th))))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double tmp;
if (t_1 <= -0.7) {
tmp = (sin(ky) / (sqrt(((1.0 - cos((2.0 * ky))) * 2.0)) / 2.0)) * sin(th);
} else if (t_1 <= 1e-178) {
tmp = (sin(ky) / (sqrt(((1.0 - cos((2.0 * kx))) * 2.0)) / 2.0)) * sin(th);
} else if (t_1 <= 0.21) {
tmp = sin(th) / (sin(kx) / sin(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 <= (-0.7d0)) then
tmp = (sin(ky) / (sqrt(((1.0d0 - cos((2.0d0 * ky))) * 2.0d0)) / 2.0d0)) * sin(th)
else if (t_1 <= 1d-178) then
tmp = (sin(ky) / (sqrt(((1.0d0 - cos((2.0d0 * kx))) * 2.0d0)) / 2.0d0)) * sin(th)
else if (t_1 <= 0.21d0) then
tmp = sin(th) / (sin(kx) / sin(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 <= -0.7) {
tmp = (Math.sin(ky) / (Math.sqrt(((1.0 - Math.cos((2.0 * ky))) * 2.0)) / 2.0)) * Math.sin(th);
} else if (t_1 <= 1e-178) {
tmp = (Math.sin(ky) / (Math.sqrt(((1.0 - Math.cos((2.0 * kx))) * 2.0)) / 2.0)) * Math.sin(th);
} else if (t_1 <= 0.21) {
tmp = Math.sin(th) / (Math.sin(kx) / Math.sin(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 <= -0.7: tmp = (math.sin(ky) / (math.sqrt(((1.0 - math.cos((2.0 * ky))) * 2.0)) / 2.0)) * math.sin(th) elif t_1 <= 1e-178: tmp = (math.sin(ky) / (math.sqrt(((1.0 - math.cos((2.0 * kx))) * 2.0)) / 2.0)) * math.sin(th) elif t_1 <= 0.21: tmp = math.sin(th) / (math.sin(kx) / math.sin(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 <= -0.7) tmp = Float64(Float64(sin(ky) / Float64(sqrt(Float64(Float64(1.0 - cos(Float64(2.0 * ky))) * 2.0)) / 2.0)) * sin(th)); elseif (t_1 <= 1e-178) tmp = Float64(Float64(sin(ky) / Float64(sqrt(Float64(Float64(1.0 - cos(Float64(2.0 * kx))) * 2.0)) / 2.0)) * sin(th)); elseif (t_1 <= 0.21) tmp = Float64(sin(th) / Float64(sin(kx) / sin(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 <= -0.7) tmp = (sin(ky) / (sqrt(((1.0 - cos((2.0 * ky))) * 2.0)) / 2.0)) * sin(th); elseif (t_1 <= 1e-178) tmp = (sin(ky) / (sqrt(((1.0 - cos((2.0 * kx))) * 2.0)) / 2.0)) * sin(th); elseif (t_1 <= 0.21) tmp = sin(th) / (sin(kx) / sin(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, -0.7], N[(N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[(N[(1.0 - N[Cos[N[(2.0 * ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e-178], N[(N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[(N[(1.0 - N[Cos[N[(2.0 * kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.21], N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_1 \leq -0.7:\\
\;\;\;\;\frac{\sin ky}{\frac{\sqrt{\left(1 - \cos \left(2 \cdot ky\right)\right) \cdot 2}}{2}} \cdot \sin th\\
\mathbf{elif}\;t\_1 \leq 10^{-178}:\\
\;\;\;\;\frac{\sin ky}{\frac{\sqrt{\left(1 - \cos \left(2 \cdot kx\right)\right) \cdot 2}}{2}} \cdot \sin th\\
\mathbf{elif}\;t\_1 \leq 0.21:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{\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))))) < -0.69999999999999996Initial program 84.0%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
frac-addN/A
metadata-evalN/A
metadata-evalN/A
sqrt-divN/A
Applied rewrites61.0%
Taylor expanded in kx around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-cos.f64N/A
lower-*.f6445.1
Applied rewrites45.1%
if -0.69999999999999996 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 9.9999999999999995e-179Initial program 99.5%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
frac-addN/A
metadata-evalN/A
metadata-evalN/A
sqrt-divN/A
Applied rewrites81.0%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower--.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sqrt.f6467.8
Applied rewrites67.8%
Applied rewrites67.9%
if 9.9999999999999995e-179 < (/.f64 (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.209999999999999992Initial program 99.7%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6499.7
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%
Taylor expanded in ky around 0
lower-sin.f6448.2
Applied rewrites48.2%
if 0.209999999999999992 < (/.f64 (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 89.8%
Taylor expanded in kx around 0
lower-sin.f6463.6
Applied rewrites63.6%
Final simplification58.1%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
(if (<= t_1 -1.0)
(*
(/ (sin ky) (sqrt (+ (* kx kx) (- 0.5 (* 0.5 (cos (* 2.0 ky)))))))
(sin th))
(if (<= t_1 1e-178)
(*
(/ (sin ky) (/ (sqrt (* (- 1.0 (cos (* 2.0 kx))) 2.0)) 2.0))
(sin th))
(if (<= t_1 0.21) (/ (sin th) (/ (sin kx) (sin 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 <= -1.0) {
tmp = (sin(ky) / sqrt(((kx * kx) + (0.5 - (0.5 * cos((2.0 * ky))))))) * sin(th);
} else if (t_1 <= 1e-178) {
tmp = (sin(ky) / (sqrt(((1.0 - cos((2.0 * kx))) * 2.0)) / 2.0)) * sin(th);
} else if (t_1 <= 0.21) {
tmp = sin(th) / (sin(kx) / sin(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 <= (-1.0d0)) then
tmp = (sin(ky) / sqrt(((kx * kx) + (0.5d0 - (0.5d0 * cos((2.0d0 * ky))))))) * sin(th)
else if (t_1 <= 1d-178) then
tmp = (sin(ky) / (sqrt(((1.0d0 - cos((2.0d0 * kx))) * 2.0d0)) / 2.0d0)) * sin(th)
else if (t_1 <= 0.21d0) then
tmp = sin(th) / (sin(kx) / sin(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 <= -1.0) {
tmp = (Math.sin(ky) / Math.sqrt(((kx * kx) + (0.5 - (0.5 * Math.cos((2.0 * ky))))))) * Math.sin(th);
} else if (t_1 <= 1e-178) {
tmp = (Math.sin(ky) / (Math.sqrt(((1.0 - Math.cos((2.0 * kx))) * 2.0)) / 2.0)) * Math.sin(th);
} else if (t_1 <= 0.21) {
tmp = Math.sin(th) / (Math.sin(kx) / Math.sin(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 <= -1.0: tmp = (math.sin(ky) / math.sqrt(((kx * kx) + (0.5 - (0.5 * math.cos((2.0 * ky))))))) * math.sin(th) elif t_1 <= 1e-178: tmp = (math.sin(ky) / (math.sqrt(((1.0 - math.cos((2.0 * kx))) * 2.0)) / 2.0)) * math.sin(th) elif t_1 <= 0.21: tmp = math.sin(th) / (math.sin(kx) / math.sin(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 <= -1.0) tmp = Float64(Float64(sin(ky) / sqrt(Float64(Float64(kx * kx) + Float64(0.5 - Float64(0.5 * cos(Float64(2.0 * ky))))))) * sin(th)); elseif (t_1 <= 1e-178) tmp = Float64(Float64(sin(ky) / Float64(sqrt(Float64(Float64(1.0 - cos(Float64(2.0 * kx))) * 2.0)) / 2.0)) * sin(th)); elseif (t_1 <= 0.21) tmp = Float64(sin(th) / Float64(sin(kx) / sin(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 <= -1.0) tmp = (sin(ky) / sqrt(((kx * kx) + (0.5 - (0.5 * cos((2.0 * ky))))))) * sin(th); elseif (t_1 <= 1e-178) tmp = (sin(ky) / (sqrt(((1.0 - cos((2.0 * kx))) * 2.0)) / 2.0)) * sin(th); elseif (t_1 <= 0.21) tmp = sin(th) / (sin(kx) / sin(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, -1.0], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[(kx * kx), $MachinePrecision] + N[(0.5 - N[(0.5 * N[Cos[N[(2.0 * ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e-178], N[(N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[(N[(1.0 - N[Cos[N[(2.0 * kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.21], N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_1 \leq -1:\\
\;\;\;\;\frac{\sin ky}{\sqrt{kx \cdot kx + \left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right)}} \cdot \sin th\\
\mathbf{elif}\;t\_1 \leq 10^{-178}:\\
\;\;\;\;\frac{\sin ky}{\frac{\sqrt{\left(1 - \cos \left(2 \cdot kx\right)\right) \cdot 2}}{2}} \cdot \sin th\\
\mathbf{elif}\;t\_1 \leq 0.21:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{\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 79.9%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6479.9
Applied rewrites79.9%
lift-pow.f64N/A
pow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sqr-sin-aN/A
lower--.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-cos.f64N/A
lower-*.f6451.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f6451.7
Applied rewrites51.7%
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))))) < 9.9999999999999995e-179Initial program 99.5%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
frac-addN/A
metadata-evalN/A
metadata-evalN/A
sqrt-divN/A
Applied rewrites83.8%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower--.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sqrt.f6460.5
Applied rewrites60.5%
Applied rewrites60.6%
if 9.9999999999999995e-179 < (/.f64 (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.209999999999999992Initial program 99.7%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6499.7
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%
Taylor expanded in ky around 0
lower-sin.f6448.2
Applied rewrites48.2%
if 0.209999999999999992 < (/.f64 (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 89.8%
Taylor expanded in kx around 0
lower-sin.f6463.6
Applied rewrites63.6%
Final simplification58.1%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
(if (<= t_1 -0.78)
(*
(/ (sin ky) (sqrt (+ (* kx kx) (- 0.5 (* 0.5 (cos (* 2.0 ky)))))))
(sin th))
(if (<= t_1 0.21) (/ (sin th) (/ (sin kx) (sin ky))) (sin th)))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double tmp;
if (t_1 <= -0.78) {
tmp = (sin(ky) / sqrt(((kx * kx) + (0.5 - (0.5 * cos((2.0 * ky))))))) * sin(th);
} else if (t_1 <= 0.21) {
tmp = sin(th) / (sin(kx) / sin(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 <= (-0.78d0)) then
tmp = (sin(ky) / sqrt(((kx * kx) + (0.5d0 - (0.5d0 * cos((2.0d0 * ky))))))) * sin(th)
else if (t_1 <= 0.21d0) then
tmp = sin(th) / (sin(kx) / sin(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 <= -0.78) {
tmp = (Math.sin(ky) / Math.sqrt(((kx * kx) + (0.5 - (0.5 * Math.cos((2.0 * ky))))))) * Math.sin(th);
} else if (t_1 <= 0.21) {
tmp = Math.sin(th) / (Math.sin(kx) / Math.sin(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 <= -0.78: tmp = (math.sin(ky) / math.sqrt(((kx * kx) + (0.5 - (0.5 * math.cos((2.0 * ky))))))) * math.sin(th) elif t_1 <= 0.21: tmp = math.sin(th) / (math.sin(kx) / math.sin(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 <= -0.78) tmp = Float64(Float64(sin(ky) / sqrt(Float64(Float64(kx * kx) + Float64(0.5 - Float64(0.5 * cos(Float64(2.0 * ky))))))) * sin(th)); elseif (t_1 <= 0.21) tmp = Float64(sin(th) / Float64(sin(kx) / sin(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 <= -0.78) tmp = (sin(ky) / sqrt(((kx * kx) + (0.5 - (0.5 * cos((2.0 * ky))))))) * sin(th); elseif (t_1 <= 0.21) tmp = sin(th) / (sin(kx) / sin(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, -0.78], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[(kx * kx), $MachinePrecision] + N[(0.5 - N[(0.5 * N[Cos[N[(2.0 * ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.21], N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_1 \leq -0.78:\\
\;\;\;\;\frac{\sin ky}{\sqrt{kx \cdot kx + \left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right)}} \cdot \sin th\\
\mathbf{elif}\;t\_1 \leq 0.21:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{\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))))) < -0.78000000000000003Initial program 82.5%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6470.3
Applied rewrites70.3%
lift-pow.f64N/A
pow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sqr-sin-aN/A
lower--.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-cos.f64N/A
lower-*.f6445.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6445.9
Applied rewrites45.9%
if -0.78000000000000003 < (/.f64 (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.209999999999999992Initial program 99.6%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6499.7
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%
Taylor expanded in ky around 0
lower-sin.f6451.1
Applied rewrites51.1%
if 0.209999999999999992 < (/.f64 (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 89.8%
Taylor expanded in kx around 0
lower-sin.f6463.6
Applied rewrites63.6%
Final simplification54.3%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
(if (<= t_1 1e-178)
(*
(/
(* (fma -0.16666666666666666 (* ky ky) 1.0) ky)
(/ (* (sqrt (- 1.0 (cos (* 2.0 kx)))) (sqrt 2.0)) 2.0))
(sin th))
(if (<= t_1 0.005) (/ (sin th) (/ (sin kx) 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 <= 1e-178) {
tmp = ((fma(-0.16666666666666666, (ky * ky), 1.0) * ky) / ((sqrt((1.0 - cos((2.0 * kx)))) * sqrt(2.0)) / 2.0)) * sin(th);
} else if (t_1 <= 0.005) {
tmp = sin(th) / (sin(kx) / ky);
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_1 <= 1e-178) tmp = Float64(Float64(Float64(fma(-0.16666666666666666, Float64(ky * ky), 1.0) * ky) / Float64(Float64(sqrt(Float64(1.0 - cos(Float64(2.0 * kx)))) * sqrt(2.0)) / 2.0)) * sin(th)); elseif (t_1 <= 0.005) tmp = Float64(sin(th) / Float64(sin(kx) / ky)); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 1e-178], N[(N[(N[(N[(-0.16666666666666666 * N[(ky * ky), $MachinePrecision] + 1.0), $MachinePrecision] * ky), $MachinePrecision] / N[(N[(N[Sqrt[N[(1.0 - N[Cos[N[(2.0 * kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.005], N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $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 10^{-178}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-0.16666666666666666, ky \cdot ky, 1\right) \cdot ky}{\frac{\sqrt{1 - \cos \left(2 \cdot kx\right)} \cdot \sqrt{2}}{2}} \cdot \sin th\\
\mathbf{elif}\;t\_1 \leq 0.005:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{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))))) < 9.9999999999999995e-179Initial program 92.4%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
frac-addN/A
metadata-evalN/A
metadata-evalN/A
sqrt-divN/A
Applied rewrites71.9%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower--.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sqrt.f6439.6
Applied rewrites39.6%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6435.8
Applied rewrites35.8%
if 9.9999999999999995e-179 < (/.f64 (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%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6499.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.8
Applied rewrites99.8%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-sin.f6454.4
Applied rewrites54.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 90.4%
Taylor expanded in kx around 0
lower-sin.f6460.6
Applied rewrites60.6%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (pow (sin kx) 2.0)))
(if (<= t_1 2e-314)
(sin th)
(if (<= t_1 5e-17)
(/ (sin th) (/ (sqrt (+ (* ky ky) (* kx kx))) (sin ky)))
(*
(* 2.0 (* (* (sin th) ky) (sqrt 0.5)))
(sqrt (pow (- 1.0 (cos (* 2.0 kx))) -1.0)))))))
double code(double kx, double ky, double th) {
double t_1 = pow(sin(kx), 2.0);
double tmp;
if (t_1 <= 2e-314) {
tmp = sin(th);
} else if (t_1 <= 5e-17) {
tmp = sin(th) / (sqrt(((ky * ky) + (kx * kx))) / sin(ky));
} else {
tmp = (2.0 * ((sin(th) * ky) * sqrt(0.5))) * sqrt(pow((1.0 - cos((2.0 * kx))), -1.0));
}
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(kx) ** 2.0d0
if (t_1 <= 2d-314) then
tmp = sin(th)
else if (t_1 <= 5d-17) then
tmp = sin(th) / (sqrt(((ky * ky) + (kx * kx))) / sin(ky))
else
tmp = (2.0d0 * ((sin(th) * ky) * sqrt(0.5d0))) * sqrt(((1.0d0 - cos((2.0d0 * kx))) ** (-1.0d0)))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double t_1 = Math.pow(Math.sin(kx), 2.0);
double tmp;
if (t_1 <= 2e-314) {
tmp = Math.sin(th);
} else if (t_1 <= 5e-17) {
tmp = Math.sin(th) / (Math.sqrt(((ky * ky) + (kx * kx))) / Math.sin(ky));
} else {
tmp = (2.0 * ((Math.sin(th) * ky) * Math.sqrt(0.5))) * Math.sqrt(Math.pow((1.0 - Math.cos((2.0 * kx))), -1.0));
}
return tmp;
}
def code(kx, ky, th): t_1 = math.pow(math.sin(kx), 2.0) tmp = 0 if t_1 <= 2e-314: tmp = math.sin(th) elif t_1 <= 5e-17: tmp = math.sin(th) / (math.sqrt(((ky * ky) + (kx * kx))) / math.sin(ky)) else: tmp = (2.0 * ((math.sin(th) * ky) * math.sqrt(0.5))) * math.sqrt(math.pow((1.0 - math.cos((2.0 * kx))), -1.0)) return tmp
function code(kx, ky, th) t_1 = sin(kx) ^ 2.0 tmp = 0.0 if (t_1 <= 2e-314) tmp = sin(th); elseif (t_1 <= 5e-17) tmp = Float64(sin(th) / Float64(sqrt(Float64(Float64(ky * ky) + Float64(kx * kx))) / sin(ky))); else tmp = Float64(Float64(2.0 * Float64(Float64(sin(th) * ky) * sqrt(0.5))) * sqrt((Float64(1.0 - cos(Float64(2.0 * kx))) ^ -1.0))); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = sin(kx) ^ 2.0; tmp = 0.0; if (t_1 <= 2e-314) tmp = sin(th); elseif (t_1 <= 5e-17) tmp = sin(th) / (sqrt(((ky * ky) + (kx * kx))) / sin(ky)); else tmp = (2.0 * ((sin(th) * ky) * sqrt(0.5))) * sqrt(((1.0 - cos((2.0 * kx))) ^ -1.0)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[t$95$1, 2e-314], N[Sin[th], $MachinePrecision], If[LessEqual[t$95$1, 5e-17], N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[N[(N[(ky * ky), $MachinePrecision] + N[(kx * kx), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 * N[(N[(N[Sin[th], $MachinePrecision] * ky), $MachinePrecision] * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[Power[N[(1.0 - N[Cos[N[(2.0 * kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := {\sin kx}^{2}\\
\mathbf{if}\;t\_1 \leq 2 \cdot 10^{-314}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{-17}:\\
\;\;\;\;\frac{\sin th}{\frac{\sqrt{ky \cdot ky + kx \cdot kx}}{\sin ky}}\\
\mathbf{else}:\\
\;\;\;\;\left(2 \cdot \left(\left(\sin th \cdot ky\right) \cdot \sqrt{0.5}\right)\right) \cdot \sqrt{{\left(1 - \cos \left(2 \cdot kx\right)\right)}^{-1}}\\
\end{array}
\end{array}
if (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) < 1.9999999999e-314Initial program 71.0%
Taylor expanded in kx around 0
lower-sin.f6450.7
Applied rewrites50.7%
if 1.9999999999e-314 < (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) < 4.9999999999999999e-17Initial program 99.8%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6499.8
Applied rewrites99.8%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6467.4
Applied rewrites67.4%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6467.5
Applied rewrites67.5%
if 4.9999999999999999e-17 < (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) Initial program 99.5%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
frac-addN/A
metadata-evalN/A
metadata-evalN/A
sqrt-divN/A
Applied rewrites99.1%
Taylor expanded in ky around 0
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-cos.f64N/A
lower-*.f6451.3
Applied rewrites51.3%
Final simplification55.0%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 0.005) (/ (sin th) (/ (sin kx) ky)) (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.005) {
tmp = sin(th) / (sin(kx) / 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) :: tmp
if ((sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) <= 0.005d0) then
tmp = sin(th) / (sin(kx) / ky)
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.005) {
tmp = Math.sin(th) / (Math.sin(kx) / ky);
} 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.005: tmp = math.sin(th) / (math.sin(kx) / ky) 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.005) tmp = Float64(sin(th) / Float64(sin(kx) / ky)); 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.005) tmp = sin(th) / (sin(kx) / ky); 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.005], N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / ky), $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.005:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{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))))) < 0.0050000000000000001Initial program 94.0%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6494.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.7
Applied rewrites99.7%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-sin.f6437.1
Applied rewrites37.1%
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 90.4%
Taylor expanded in kx around 0
lower-sin.f6460.6
Applied rewrites60.6%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 0.005) (* (/ 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.005) {
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.005d0) 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.005) {
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.005: 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.005) 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.005) 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.005], 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.005:\\
\;\;\;\;\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))))) < 0.0050000000000000001Initial program 94.0%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-sin.f6437.0
Applied rewrites37.0%
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 90.4%
Taylor expanded in kx around 0
lower-sin.f6460.6
Applied rewrites60.6%
(FPCore (kx ky th)
:precision binary64
(if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 5e-30)
(/
(sin th)
(fma (/ (/ (fma (* ky ky) 0.16666666666666666 0.5) ky) ky) (* kx kx) 1.0))
(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-30) {
tmp = sin(th) / fma(((fma((ky * ky), 0.16666666666666666, 0.5) / ky) / ky), (kx * kx), 1.0);
} 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)))) <= 5e-30) tmp = Float64(sin(th) / fma(Float64(Float64(fma(Float64(ky * ky), 0.16666666666666666, 0.5) / ky) / ky), Float64(kx * kx), 1.0)); 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], 5e-30], N[(N[Sin[th], $MachinePrecision] / N[(N[(N[(N[(N[(ky * ky), $MachinePrecision] * 0.16666666666666666 + 0.5), $MachinePrecision] / ky), $MachinePrecision] / ky), $MachinePrecision] * N[(kx * kx), $MachinePrecision] + 1.0), $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^{-30}:\\
\;\;\;\;\frac{\sin th}{\mathsf{fma}\left(\frac{\frac{\mathsf{fma}\left(ky \cdot ky, 0.16666666666666666, 0.5\right)}{ky}}{ky}, kx \cdot kx, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 4.99999999999999972e-30Initial program 93.7%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6493.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.8
Applied rewrites99.8%
Taylor expanded in kx around 0
+-commutativeN/A
associate-*r/N/A
associate-*l/N/A
metadata-evalN/A
associate-*r/N/A
lower-fma.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
unpow2N/A
lower-*.f6416.3
Applied rewrites16.3%
Taylor expanded in ky around 0
Applied rewrites16.3%
if 4.99999999999999972e-30 < (/.f64 (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 91.1%
Taylor expanded in kx around 0
lower-sin.f6456.7
Applied rewrites56.7%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 5e-30) (/ (sin th) (fma (/ 0.5 (* ky ky)) (* kx kx) 1.0)) (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-30) {
tmp = sin(th) / fma((0.5 / (ky * ky)), (kx * kx), 1.0);
} 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)))) <= 5e-30) tmp = Float64(sin(th) / fma(Float64(0.5 / Float64(ky * ky)), Float64(kx * kx), 1.0)); 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], 5e-30], N[(N[Sin[th], $MachinePrecision] / N[(N[(0.5 / N[(ky * ky), $MachinePrecision]), $MachinePrecision] * N[(kx * kx), $MachinePrecision] + 1.0), $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^{-30}:\\
\;\;\;\;\frac{\sin th}{\mathsf{fma}\left(\frac{0.5}{ky \cdot ky}, kx \cdot kx, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 4.99999999999999972e-30Initial program 93.7%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6493.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.8
Applied rewrites99.8%
Taylor expanded in kx around 0
+-commutativeN/A
associate-*r/N/A
associate-*l/N/A
metadata-evalN/A
associate-*r/N/A
lower-fma.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
unpow2N/A
lower-*.f6416.3
Applied rewrites16.3%
Taylor expanded in ky around 0
Applied rewrites16.1%
if 4.99999999999999972e-30 < (/.f64 (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 91.1%
Taylor expanded in kx around 0
lower-sin.f6456.7
Applied rewrites56.7%
(FPCore (kx ky th)
:precision binary64
(if (<=
(*
(/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))
(sin th))
2e-307)
(* (* (* -0.16666666666666666 th) th) th)
(*
(fma
(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)) <= 2e-307) {
tmp = ((-0.16666666666666666 * th) * th) * th;
} else {
tmp = fma(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)) <= 2e-307) tmp = Float64(Float64(Float64(-0.16666666666666666 * th) * th) * th); else tmp = Float64(fma(fma(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], 2e-307], N[(N[(N[(-0.16666666666666666 * th), $MachinePrecision] * th), $MachinePrecision] * th), $MachinePrecision], N[(N[(N[(N[(th * th), $MachinePrecision] * 0.008333333333333333 + -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 2 \cdot 10^{-307}:\\
\;\;\;\;\left(\left(-0.16666666666666666 \cdot th\right) \cdot th\right) \cdot th\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(th \cdot th, 0.008333333333333333, -0.16666666666666666\right), 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)) < 1.99999999999999982e-307Initial program 93.1%
Taylor expanded in kx around 0
lower-sin.f6423.3
Applied rewrites23.3%
Taylor expanded in th around 0
Applied rewrites13.0%
Taylor expanded in th around inf
Applied rewrites14.4%
Applied rewrites14.4%
if 1.99999999999999982e-307 < (*.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 92.0%
Taylor expanded in kx around 0
lower-sin.f6427.1
Applied rewrites27.1%
Taylor expanded in th around 0
Applied rewrites11.5%
(FPCore (kx ky th)
:precision binary64
(if (<=
(*
(/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))
(sin th))
2e-307)
(* (* (* -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)) <= 2e-307) {
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)) <= 2e-307) 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], 2e-307], 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 2 \cdot 10^{-307}:\\
\;\;\;\;\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)) < 1.99999999999999982e-307Initial program 93.1%
Taylor expanded in kx around 0
lower-sin.f6423.3
Applied rewrites23.3%
Taylor expanded in th around 0
Applied rewrites13.0%
Taylor expanded in th around inf
Applied rewrites14.4%
Applied rewrites14.4%
if 1.99999999999999982e-307 < (*.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 92.0%
Taylor expanded in kx around 0
lower-sin.f6427.1
Applied rewrites27.1%
Taylor expanded in th around 0
Applied rewrites11.6%
Applied rewrites11.6%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 2.7e-30) (* (* (* -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)))) <= 2.7e-30) {
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)))) <= 2.7d-30) 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)))) <= 2.7e-30) {
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)))) <= 2.7e-30: 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)))) <= 2.7e-30) 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)))) <= 2.7e-30) 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], 2.7e-30], 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 2.7 \cdot 10^{-30}:\\
\;\;\;\;\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))))) < 2.69999999999999987e-30Initial program 93.6%
Taylor expanded in kx around 0
lower-sin.f643.8
Applied rewrites3.8%
Taylor expanded in th around 0
Applied rewrites3.6%
Taylor expanded in th around inf
Applied rewrites14.1%
Applied rewrites14.1%
if 2.69999999999999987e-30 < (/.f64 (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 91.2%
Taylor expanded in kx around 0
lower-sin.f6456.2
Applied rewrites56.2%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.025)
(*
(* 2.0 (* (* (sin th) ky) (sqrt 0.5)))
(sqrt (pow (- 1.0 (cos (* 2.0 kx))) -1.0)))
(if (<= (sin kx) 4e-72)
(/ (sin th) (fma (/ (* 0.5 kx) (sin ky)) (/ kx (sin ky)) 1.0))
(/ (sin th) (/ (sin kx) (sin ky))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.025) {
tmp = (2.0 * ((sin(th) * ky) * sqrt(0.5))) * sqrt(pow((1.0 - cos((2.0 * kx))), -1.0));
} else if (sin(kx) <= 4e-72) {
tmp = sin(th) / fma(((0.5 * kx) / sin(ky)), (kx / sin(ky)), 1.0);
} else {
tmp = sin(th) / (sin(kx) / sin(ky));
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.025) tmp = Float64(Float64(2.0 * Float64(Float64(sin(th) * ky) * sqrt(0.5))) * sqrt((Float64(1.0 - cos(Float64(2.0 * kx))) ^ -1.0))); elseif (sin(kx) <= 4e-72) tmp = Float64(sin(th) / fma(Float64(Float64(0.5 * kx) / sin(ky)), Float64(kx / sin(ky)), 1.0)); else tmp = Float64(sin(th) / Float64(sin(kx) / sin(ky))); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.025], N[(N[(2.0 * N[(N[(N[Sin[th], $MachinePrecision] * ky), $MachinePrecision] * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[Power[N[(1.0 - N[Cos[N[(2.0 * kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 4e-72], N[(N[Sin[th], $MachinePrecision] / N[(N[(N[(0.5 * kx), $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision] * N[(kx / N[Sin[ky], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.025:\\
\;\;\;\;\left(2 \cdot \left(\left(\sin th \cdot ky\right) \cdot \sqrt{0.5}\right)\right) \cdot \sqrt{{\left(1 - \cos \left(2 \cdot kx\right)\right)}^{-1}}\\
\mathbf{elif}\;\sin kx \leq 4 \cdot 10^{-72}:\\
\;\;\;\;\frac{\sin th}{\mathsf{fma}\left(\frac{0.5 \cdot kx}{\sin ky}, \frac{kx}{\sin ky}, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{\sin ky}}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.025000000000000001Initial program 99.4%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
frac-addN/A
metadata-evalN/A
metadata-evalN/A
sqrt-divN/A
Applied rewrites99.3%
Taylor expanded in ky around 0
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-cos.f64N/A
lower-*.f6445.0
Applied rewrites45.0%
if -0.025000000000000001 < (sin.f64 kx) < 3.9999999999999999e-72Initial program 84.0%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6484.0
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6499.9
Applied rewrites99.9%
Taylor expanded in kx around 0
+-commutativeN/A
associate-*r/N/A
associate-*l/N/A
metadata-evalN/A
associate-*r/N/A
lower-fma.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
unpow2N/A
lower-*.f6441.1
Applied rewrites41.1%
Applied rewrites46.4%
if 3.9999999999999999e-72 < (sin.f64 kx) Initial program 99.7%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6499.7
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%
Taylor expanded in ky around 0
lower-sin.f6466.3
Applied rewrites66.3%
Final simplification51.4%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.02)
(*
(* 2.0 (* (* (sin th) ky) (sqrt 0.5)))
(sqrt (pow (- 1.0 (cos (* 2.0 kx))) -1.0)))
(if (<= (sin kx) 4e-72) (sin th) (/ (sin th) (/ (sin kx) (sin ky))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.02) {
tmp = (2.0 * ((sin(th) * ky) * sqrt(0.5))) * sqrt(pow((1.0 - cos((2.0 * kx))), -1.0));
} else if (sin(kx) <= 4e-72) {
tmp = sin(th);
} else {
tmp = sin(th) / (sin(kx) / sin(ky));
}
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(kx) <= (-0.02d0)) then
tmp = (2.0d0 * ((sin(th) * ky) * sqrt(0.5d0))) * sqrt(((1.0d0 - cos((2.0d0 * kx))) ** (-1.0d0)))
else if (sin(kx) <= 4d-72) then
tmp = sin(th)
else
tmp = sin(th) / (sin(kx) / sin(ky))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.02) {
tmp = (2.0 * ((Math.sin(th) * ky) * Math.sqrt(0.5))) * Math.sqrt(Math.pow((1.0 - Math.cos((2.0 * kx))), -1.0));
} else if (Math.sin(kx) <= 4e-72) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) / (Math.sin(kx) / Math.sin(ky));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.02: tmp = (2.0 * ((math.sin(th) * ky) * math.sqrt(0.5))) * math.sqrt(math.pow((1.0 - math.cos((2.0 * kx))), -1.0)) elif math.sin(kx) <= 4e-72: tmp = math.sin(th) else: tmp = math.sin(th) / (math.sin(kx) / math.sin(ky)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.02) tmp = Float64(Float64(2.0 * Float64(Float64(sin(th) * ky) * sqrt(0.5))) * sqrt((Float64(1.0 - cos(Float64(2.0 * kx))) ^ -1.0))); elseif (sin(kx) <= 4e-72) tmp = sin(th); else tmp = Float64(sin(th) / Float64(sin(kx) / sin(ky))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.02) tmp = (2.0 * ((sin(th) * ky) * sqrt(0.5))) * sqrt(((1.0 - cos((2.0 * kx))) ^ -1.0)); elseif (sin(kx) <= 4e-72) tmp = sin(th); else tmp = sin(th) / (sin(kx) / sin(ky)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.02], N[(N[(2.0 * N[(N[(N[Sin[th], $MachinePrecision] * ky), $MachinePrecision] * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[Power[N[(1.0 - N[Cos[N[(2.0 * kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 4e-72], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.02:\\
\;\;\;\;\left(2 \cdot \left(\left(\sin th \cdot ky\right) \cdot \sqrt{0.5}\right)\right) \cdot \sqrt{{\left(1 - \cos \left(2 \cdot kx\right)\right)}^{-1}}\\
\mathbf{elif}\;\sin kx \leq 4 \cdot 10^{-72}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{\sin ky}}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0200000000000000004Initial program 99.4%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
frac-addN/A
metadata-evalN/A
metadata-evalN/A
sqrt-divN/A
Applied rewrites99.3%
Taylor expanded in ky around 0
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-cos.f64N/A
lower-*.f6445.0
Applied rewrites45.0%
if -0.0200000000000000004 < (sin.f64 kx) < 3.9999999999999999e-72Initial program 84.0%
Taylor expanded in kx around 0
lower-sin.f6443.5
Applied rewrites43.5%
if 3.9999999999999999e-72 < (sin.f64 kx) Initial program 99.7%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6499.7
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%
Taylor expanded in ky around 0
lower-sin.f6466.3
Applied rewrites66.3%
Final simplification50.1%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.02)
(*
(* 2.0 (* (* (sin th) ky) (sqrt 0.5)))
(sqrt (pow (- 1.0 (cos (* 2.0 kx))) -1.0)))
(if (<= (sin kx) 4e-72) (sin th) (* (/ (sin ky) (sin kx)) (sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.02) {
tmp = (2.0 * ((sin(th) * ky) * sqrt(0.5))) * sqrt(pow((1.0 - cos((2.0 * kx))), -1.0));
} else if (sin(kx) <= 4e-72) {
tmp = sin(th);
} else {
tmp = (sin(ky) / sin(kx)) * 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(kx) <= (-0.02d0)) then
tmp = (2.0d0 * ((sin(th) * ky) * sqrt(0.5d0))) * sqrt(((1.0d0 - cos((2.0d0 * kx))) ** (-1.0d0)))
else if (sin(kx) <= 4d-72) then
tmp = sin(th)
else
tmp = (sin(ky) / sin(kx)) * sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.02) {
tmp = (2.0 * ((Math.sin(th) * ky) * Math.sqrt(0.5))) * Math.sqrt(Math.pow((1.0 - Math.cos((2.0 * kx))), -1.0));
} else if (Math.sin(kx) <= 4e-72) {
tmp = Math.sin(th);
} else {
tmp = (Math.sin(ky) / Math.sin(kx)) * Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.02: tmp = (2.0 * ((math.sin(th) * ky) * math.sqrt(0.5))) * math.sqrt(math.pow((1.0 - math.cos((2.0 * kx))), -1.0)) elif math.sin(kx) <= 4e-72: tmp = math.sin(th) else: tmp = (math.sin(ky) / math.sin(kx)) * math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.02) tmp = Float64(Float64(2.0 * Float64(Float64(sin(th) * ky) * sqrt(0.5))) * sqrt((Float64(1.0 - cos(Float64(2.0 * kx))) ^ -1.0))); elseif (sin(kx) <= 4e-72) tmp = sin(th); else tmp = Float64(Float64(sin(ky) / sin(kx)) * sin(th)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.02) tmp = (2.0 * ((sin(th) * ky) * sqrt(0.5))) * sqrt(((1.0 - cos((2.0 * kx))) ^ -1.0)); elseif (sin(kx) <= 4e-72) tmp = sin(th); else tmp = (sin(ky) / sin(kx)) * sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.02], N[(N[(2.0 * N[(N[(N[Sin[th], $MachinePrecision] * ky), $MachinePrecision] * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[Power[N[(1.0 - N[Cos[N[(2.0 * kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 4e-72], N[Sin[th], $MachinePrecision], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.02:\\
\;\;\;\;\left(2 \cdot \left(\left(\sin th \cdot ky\right) \cdot \sqrt{0.5}\right)\right) \cdot \sqrt{{\left(1 - \cos \left(2 \cdot kx\right)\right)}^{-1}}\\
\mathbf{elif}\;\sin kx \leq 4 \cdot 10^{-72}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky}{\sin kx} \cdot \sin th\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0200000000000000004Initial program 99.4%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
frac-addN/A
metadata-evalN/A
metadata-evalN/A
sqrt-divN/A
Applied rewrites99.3%
Taylor expanded in ky around 0
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-cos.f64N/A
lower-*.f6445.0
Applied rewrites45.0%
if -0.0200000000000000004 < (sin.f64 kx) < 3.9999999999999999e-72Initial program 84.0%
Taylor expanded in kx around 0
lower-sin.f6443.5
Applied rewrites43.5%
if 3.9999999999999999e-72 < (sin.f64 kx) Initial program 99.7%
Taylor expanded in ky around 0
lower-sin.f6466.3
Applied rewrites66.3%
Final simplification50.1%
(FPCore (kx ky th) :precision binary64 (* (/ (sin th) (hypot (sin ky) (sin kx))) (sin ky)))
double code(double kx, double ky, double th) {
return (sin(th) / hypot(sin(ky), sin(kx))) * sin(ky);
}
public static double code(double kx, double ky, double th) {
return (Math.sin(th) / Math.hypot(Math.sin(ky), Math.sin(kx))) * Math.sin(ky);
}
def code(kx, ky, th): return (math.sin(th) / math.hypot(math.sin(ky), math.sin(kx))) * math.sin(ky)
function code(kx, ky, th) return Float64(Float64(sin(th) / hypot(sin(ky), sin(kx))) * sin(ky)) end
function tmp = code(kx, ky, th) tmp = (sin(th) / hypot(sin(ky), sin(kx))) * sin(ky); end
code[kx_, ky_, th_] := N[(N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[ky], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot \sin ky
\end{array}
Initial program 92.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6492.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%
(FPCore (kx ky th)
:precision binary64
(if (<= ky 0.0012)
(/
(sin th)
(/
(hypot (sin ky) (sin kx))
(* (fma -0.16666666666666666 (* ky ky) 1.0) ky)))
(/
(sin th)
(/
(*
(sqrt (* 2.0 (+ (- 1.0 (cos (* 2.0 ky))) (- 1.0 (cos (* 2.0 kx))))))
0.5)
(sin ky)))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 0.0012) {
tmp = sin(th) / (hypot(sin(ky), sin(kx)) / (fma(-0.16666666666666666, (ky * ky), 1.0) * ky));
} else {
tmp = sin(th) / ((sqrt((2.0 * ((1.0 - cos((2.0 * ky))) + (1.0 - cos((2.0 * kx)))))) * 0.5) / sin(ky));
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (ky <= 0.0012) tmp = Float64(sin(th) / Float64(hypot(sin(ky), sin(kx)) / Float64(fma(-0.16666666666666666, Float64(ky * ky), 1.0) * ky))); else tmp = Float64(sin(th) / Float64(Float64(sqrt(Float64(2.0 * Float64(Float64(1.0 - cos(Float64(2.0 * ky))) + Float64(1.0 - cos(Float64(2.0 * kx)))))) * 0.5) / sin(ky))); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[ky, 0.0012], N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[(N[(-0.16666666666666666 * N[(ky * ky), $MachinePrecision] + 1.0), $MachinePrecision] * ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] / N[(N[(N[Sqrt[N[(2.0 * N[(N[(1.0 - N[Cos[N[(2.0 * ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[Cos[N[(2.0 * kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 0.0012:\\
\;\;\;\;\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{\mathsf{fma}\left(-0.16666666666666666, ky \cdot ky, 1\right) \cdot ky}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th}{\frac{\sqrt{2 \cdot \left(\left(1 - \cos \left(2 \cdot ky\right)\right) + \left(1 - \cos \left(2 \cdot kx\right)\right)\right)} \cdot 0.5}{\sin ky}}\\
\end{array}
\end{array}
if ky < 0.00119999999999999989Initial program 90.6%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6490.7
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6499.8
Applied rewrites99.8%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6469.2
Applied rewrites69.2%
if 0.00119999999999999989 < ky Initial program 99.6%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6499.7
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%
Applied rewrites99.0%
(FPCore (kx ky th)
:precision binary64
(if (<= ky 0.0012)
(/
(sin th)
(/
(hypot (sin ky) (sin kx))
(* (fma -0.16666666666666666 (* ky ky) 1.0) ky)))
(*
(/
(* (sin ky) (sin th))
(sqrt (* 2.0 (+ (- 1.0 (cos (* 2.0 ky))) (- 1.0 (cos (* 2.0 kx)))))))
2.0)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 0.0012) {
tmp = sin(th) / (hypot(sin(ky), sin(kx)) / (fma(-0.16666666666666666, (ky * ky), 1.0) * ky));
} else {
tmp = ((sin(ky) * sin(th)) / sqrt((2.0 * ((1.0 - cos((2.0 * ky))) + (1.0 - cos((2.0 * kx))))))) * 2.0;
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (ky <= 0.0012) tmp = Float64(sin(th) / Float64(hypot(sin(ky), sin(kx)) / Float64(fma(-0.16666666666666666, Float64(ky * ky), 1.0) * ky))); else tmp = Float64(Float64(Float64(sin(ky) * sin(th)) / sqrt(Float64(2.0 * Float64(Float64(1.0 - cos(Float64(2.0 * ky))) + Float64(1.0 - cos(Float64(2.0 * kx))))))) * 2.0); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[ky, 0.0012], N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[(N[(-0.16666666666666666 * N[(ky * ky), $MachinePrecision] + 1.0), $MachinePrecision] * ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Sin[ky], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(2.0 * N[(N[(1.0 - N[Cos[N[(2.0 * ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[Cos[N[(2.0 * kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 0.0012:\\
\;\;\;\;\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{\mathsf{fma}\left(-0.16666666666666666, ky \cdot ky, 1\right) \cdot ky}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky \cdot \sin th}{\sqrt{2 \cdot \left(\left(1 - \cos \left(2 \cdot ky\right)\right) + \left(1 - \cos \left(2 \cdot kx\right)\right)\right)}} \cdot 2\\
\end{array}
\end{array}
if ky < 0.00119999999999999989Initial program 90.6%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6490.7
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6499.8
Applied rewrites99.8%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6469.2
Applied rewrites69.2%
if 0.00119999999999999989 < ky Initial program 99.6%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6499.7
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%
Applied rewrites98.9%
(FPCore (kx ky th)
:precision binary64
(if (<= ky 0.0012)
(/
(sin th)
(/
(hypot (sin ky) (sin kx))
(* (fma -0.16666666666666666 (* ky ky) 1.0) ky)))
(*
(/
(* (sin ky) 2.0)
(sqrt (* 2.0 (+ (- 1.0 (cos (* 2.0 ky))) (- 1.0 (cos (* 2.0 kx)))))))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 0.0012) {
tmp = sin(th) / (hypot(sin(ky), sin(kx)) / (fma(-0.16666666666666666, (ky * ky), 1.0) * ky));
} else {
tmp = ((sin(ky) * 2.0) / sqrt((2.0 * ((1.0 - cos((2.0 * ky))) + (1.0 - cos((2.0 * kx))))))) * sin(th);
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (ky <= 0.0012) tmp = Float64(sin(th) / Float64(hypot(sin(ky), sin(kx)) / Float64(fma(-0.16666666666666666, Float64(ky * ky), 1.0) * ky))); else tmp = Float64(Float64(Float64(sin(ky) * 2.0) / sqrt(Float64(2.0 * Float64(Float64(1.0 - cos(Float64(2.0 * ky))) + Float64(1.0 - cos(Float64(2.0 * kx))))))) * sin(th)); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[ky, 0.0012], N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[(N[(-0.16666666666666666 * N[(ky * ky), $MachinePrecision] + 1.0), $MachinePrecision] * ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Sin[ky], $MachinePrecision] * 2.0), $MachinePrecision] / N[Sqrt[N[(2.0 * N[(N[(1.0 - N[Cos[N[(2.0 * ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[Cos[N[(2.0 * kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 0.0012:\\
\;\;\;\;\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{\mathsf{fma}\left(-0.16666666666666666, ky \cdot ky, 1\right) \cdot ky}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky \cdot 2}{\sqrt{2 \cdot \left(\left(1 - \cos \left(2 \cdot ky\right)\right) + \left(1 - \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th\\
\end{array}
\end{array}
if ky < 0.00119999999999999989Initial program 90.6%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6490.7
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6499.8
Applied rewrites99.8%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6469.2
Applied rewrites69.2%
if 0.00119999999999999989 < ky Initial program 99.6%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
frac-addN/A
metadata-evalN/A
metadata-evalN/A
sqrt-divN/A
Applied rewrites98.9%
Applied rewrites98.9%
(FPCore (kx ky th)
:precision binary64
(if (<= ky 0.0012)
(/
(sin th)
(/
(hypot (sin ky) (sin kx))
(* (fma -0.16666666666666666 (* ky ky) 1.0) ky)))
(*
(/
(sin ky)
(*
(sqrt (* 2.0 (- 1.0 (- (cos (* 2.0 kx)) (- 1.0 (cos (* 2.0 ky)))))))
0.5))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 0.0012) {
tmp = sin(th) / (hypot(sin(ky), sin(kx)) / (fma(-0.16666666666666666, (ky * ky), 1.0) * ky));
} else {
tmp = (sin(ky) / (sqrt((2.0 * (1.0 - (cos((2.0 * kx)) - (1.0 - cos((2.0 * ky))))))) * 0.5)) * sin(th);
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (ky <= 0.0012) tmp = Float64(sin(th) / Float64(hypot(sin(ky), sin(kx)) / Float64(fma(-0.16666666666666666, Float64(ky * ky), 1.0) * ky))); else tmp = Float64(Float64(sin(ky) / Float64(sqrt(Float64(2.0 * Float64(1.0 - Float64(cos(Float64(2.0 * kx)) - Float64(1.0 - cos(Float64(2.0 * ky))))))) * 0.5)) * sin(th)); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[ky, 0.0012], N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[(N[(-0.16666666666666666 * N[(ky * ky), $MachinePrecision] + 1.0), $MachinePrecision] * ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[(2.0 * N[(1.0 - N[(N[Cos[N[(2.0 * kx), $MachinePrecision]], $MachinePrecision] - N[(1.0 - N[Cos[N[(2.0 * ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 0.0012:\\
\;\;\;\;\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{\mathsf{fma}\left(-0.16666666666666666, ky \cdot ky, 1\right) \cdot ky}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky}{\sqrt{2 \cdot \left(1 - \left(\cos \left(2 \cdot kx\right) - \left(1 - \cos \left(2 \cdot ky\right)\right)\right)\right)} \cdot 0.5} \cdot \sin th\\
\end{array}
\end{array}
if ky < 0.00119999999999999989Initial program 90.6%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6490.7
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6499.8
Applied rewrites99.8%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6469.2
Applied rewrites69.2%
if 0.00119999999999999989 < ky Initial program 99.6%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
frac-addN/A
metadata-evalN/A
metadata-evalN/A
sqrt-divN/A
Applied rewrites98.9%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower--.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sqrt.f6413.7
Applied rewrites13.7%
Taylor expanded in kx around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites98.9%
(FPCore (kx ky th)
:precision binary64
(if (<= ky 0.0012)
(/
(sin th)
(/
(hypot (sin ky) (sin kx))
(* (fma -0.16666666666666666 (* ky ky) 1.0) ky)))
(*
(*
(* 2.0 (sin ky))
(sqrt (/ 0.5 (- 1.0 (- (cos (* 2.0 kx)) (- 1.0 (cos (* 2.0 ky))))))))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 0.0012) {
tmp = sin(th) / (hypot(sin(ky), sin(kx)) / (fma(-0.16666666666666666, (ky * ky), 1.0) * ky));
} else {
tmp = ((2.0 * sin(ky)) * sqrt((0.5 / (1.0 - (cos((2.0 * kx)) - (1.0 - cos((2.0 * ky)))))))) * sin(th);
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (ky <= 0.0012) tmp = Float64(sin(th) / Float64(hypot(sin(ky), sin(kx)) / Float64(fma(-0.16666666666666666, Float64(ky * ky), 1.0) * ky))); else tmp = Float64(Float64(Float64(2.0 * sin(ky)) * sqrt(Float64(0.5 / Float64(1.0 - Float64(cos(Float64(2.0 * kx)) - Float64(1.0 - cos(Float64(2.0 * ky)))))))) * sin(th)); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[ky, 0.0012], N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[(N[(-0.16666666666666666 * N[(ky * ky), $MachinePrecision] + 1.0), $MachinePrecision] * ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(2.0 * N[Sin[ky], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(0.5 / N[(1.0 - N[(N[Cos[N[(2.0 * kx), $MachinePrecision]], $MachinePrecision] - N[(1.0 - N[Cos[N[(2.0 * ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 0.0012:\\
\;\;\;\;\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{\mathsf{fma}\left(-0.16666666666666666, ky \cdot ky, 1\right) \cdot ky}}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(2 \cdot \sin ky\right) \cdot \sqrt{\frac{0.5}{1 - \left(\cos \left(2 \cdot kx\right) - \left(1 - \cos \left(2 \cdot ky\right)\right)\right)}}\right) \cdot \sin th\\
\end{array}
\end{array}
if ky < 0.00119999999999999989Initial program 90.6%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6490.7
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6499.8
Applied rewrites99.8%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6469.2
Applied rewrites69.2%
if 0.00119999999999999989 < ky Initial program 99.6%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
frac-addN/A
metadata-evalN/A
metadata-evalN/A
sqrt-divN/A
Applied rewrites98.9%
Taylor expanded in kx around inf
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
distribute-lft-outN/A
associate-/r*N/A
metadata-evalN/A
lower-/.f64N/A
associate-+l-N/A
lower--.f64N/A
lower--.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
Applied rewrites99.0%
(FPCore (kx ky th)
:precision binary64
(if (<= ky 0.0012)
(/
(sin th)
(/
(hypot (sin ky) (sin kx))
(* (fma -0.16666666666666666 (* ky ky) 1.0) ky)))
(*
(* 2.0 (* (sin th) (sin ky)))
(sqrt (/ 0.5 (- 1.0 (- (cos (* 2.0 kx)) (- 1.0 (cos (* 2.0 ky))))))))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 0.0012) {
tmp = sin(th) / (hypot(sin(ky), sin(kx)) / (fma(-0.16666666666666666, (ky * ky), 1.0) * ky));
} else {
tmp = (2.0 * (sin(th) * sin(ky))) * sqrt((0.5 / (1.0 - (cos((2.0 * kx)) - (1.0 - cos((2.0 * ky)))))));
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (ky <= 0.0012) tmp = Float64(sin(th) / Float64(hypot(sin(ky), sin(kx)) / Float64(fma(-0.16666666666666666, Float64(ky * ky), 1.0) * ky))); else tmp = Float64(Float64(2.0 * Float64(sin(th) * sin(ky))) * sqrt(Float64(0.5 / Float64(1.0 - Float64(cos(Float64(2.0 * kx)) - Float64(1.0 - cos(Float64(2.0 * ky)))))))); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[ky, 0.0012], N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[(N[(-0.16666666666666666 * N[(ky * ky), $MachinePrecision] + 1.0), $MachinePrecision] * ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 * N[(N[Sin[th], $MachinePrecision] * N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(0.5 / N[(1.0 - N[(N[Cos[N[(2.0 * kx), $MachinePrecision]], $MachinePrecision] - N[(1.0 - N[Cos[N[(2.0 * ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 0.0012:\\
\;\;\;\;\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{\mathsf{fma}\left(-0.16666666666666666, ky \cdot ky, 1\right) \cdot ky}}\\
\mathbf{else}:\\
\;\;\;\;\left(2 \cdot \left(\sin th \cdot \sin ky\right)\right) \cdot \sqrt{\frac{0.5}{1 - \left(\cos \left(2 \cdot kx\right) - \left(1 - \cos \left(2 \cdot ky\right)\right)\right)}}\\
\end{array}
\end{array}
if ky < 0.00119999999999999989Initial program 90.6%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6490.7
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6499.8
Applied rewrites99.8%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6469.2
Applied rewrites69.2%
if 0.00119999999999999989 < ky Initial program 99.6%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
frac-addN/A
metadata-evalN/A
metadata-evalN/A
sqrt-divN/A
Applied rewrites98.9%
Taylor expanded in kx around inf
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
distribute-lft-outN/A
associate-/r*N/A
metadata-evalN/A
lower-/.f64N/A
associate-+l-N/A
lower--.f64N/A
Applied rewrites98.9%
(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 92.7%
Taylor expanded in kx around 0
lower-sin.f6424.9
Applied rewrites24.9%
Taylor expanded in th around 0
Applied rewrites12.4%
Taylor expanded in th around inf
Applied rewrites9.8%
Applied rewrites9.8%
herbie shell --seed 2024321
(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)))