
(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 31 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
(if (<= (pow (sin kx) 2.0) 2e-8)
(*
(sin th)
(/
(sin ky)
(hypot (sin ky) (fma kx (* -0.16666666666666666 (* kx kx)) kx))))
(*
(sin ky)
(/
(sin th)
(sqrt
(fma (- 1.0 (cos (+ kx kx))) 0.5 (+ 0.5 (* -0.5 (cos (+ ky ky))))))))))
double code(double kx, double ky, double th) {
double tmp;
if (pow(sin(kx), 2.0) <= 2e-8) {
tmp = sin(th) * (sin(ky) / hypot(sin(ky), fma(kx, (-0.16666666666666666 * (kx * kx)), kx)));
} else {
tmp = sin(ky) * (sin(th) / sqrt(fma((1.0 - cos((kx + kx))), 0.5, (0.5 + (-0.5 * cos((ky + ky)))))));
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if ((sin(kx) ^ 2.0) <= 2e-8) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), fma(kx, Float64(-0.16666666666666666 * Float64(kx * kx)), kx)))); else tmp = Float64(sin(ky) * Float64(sin(th) / sqrt(fma(Float64(1.0 - cos(Float64(kx + kx))), 0.5, Float64(0.5 + Float64(-0.5 * cos(Float64(ky + ky)))))))); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision], 2e-8], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[(kx * N[(-0.16666666666666666 * N[(kx * kx), $MachinePrecision]), $MachinePrecision] + kx), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[(N[(1.0 - N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5 + N[(0.5 + N[(-0.5 * N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\sin kx}^{2} \leq 2 \cdot 10^{-8}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \mathsf{fma}\left(kx, -0.16666666666666666 \cdot \left(kx \cdot kx\right), kx\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sqrt{\mathsf{fma}\left(1 - \cos \left(kx + kx\right), 0.5, 0.5 + -0.5 \cdot \cos \left(ky + ky\right)\right)}}\\
\end{array}
\end{array}
if (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) < 2e-8Initial program 89.9%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f64100.0
Applied rewrites100.0%
Taylor expanded in kx around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64100.0
Applied rewrites100.0%
if 2e-8 < (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) Initial program 99.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.3%
Final simplification99.6%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1
(*
(sin th)
(/
(sin ky)
(hypot (sin ky) (fma kx (* -0.16666666666666666 (* kx kx)) kx)))))
(t_2 (- 1.0 (cos (+ kx kx))))
(t_3 (cos (+ ky ky)))
(t_4 (pow (sin kx) 2.0))
(t_5 (/ (sin ky) (sqrt (+ t_4 (pow (sin ky) 2.0))))))
(if (<= t_5 -1.0)
t_1
(if (<= t_5 -0.05)
(*
(* (sin ky) (sqrt (/ 1.0 (fma t_2 0.5 (fma t_3 -0.5 0.5)))))
(fma th (* -0.16666666666666666 (* th th)) th))
(if (<= t_5 0.2)
(* (sin th) (* (sin ky) (sqrt (/ 1.0 t_4))))
(if (<= t_5 0.91)
(*
(* (sin ky) (sqrt (/ 1.0 (fma t_2 0.5 (+ 0.5 (* -0.5 t_3))))))
(* th (fma th (* th -0.16666666666666666) 1.0)))
t_1))))))
double code(double kx, double ky, double th) {
double t_1 = sin(th) * (sin(ky) / hypot(sin(ky), fma(kx, (-0.16666666666666666 * (kx * kx)), kx)));
double t_2 = 1.0 - cos((kx + kx));
double t_3 = cos((ky + ky));
double t_4 = pow(sin(kx), 2.0);
double t_5 = sin(ky) / sqrt((t_4 + pow(sin(ky), 2.0)));
double tmp;
if (t_5 <= -1.0) {
tmp = t_1;
} else if (t_5 <= -0.05) {
tmp = (sin(ky) * sqrt((1.0 / fma(t_2, 0.5, fma(t_3, -0.5, 0.5))))) * fma(th, (-0.16666666666666666 * (th * th)), th);
} else if (t_5 <= 0.2) {
tmp = sin(th) * (sin(ky) * sqrt((1.0 / t_4)));
} else if (t_5 <= 0.91) {
tmp = (sin(ky) * sqrt((1.0 / fma(t_2, 0.5, (0.5 + (-0.5 * t_3)))))) * (th * fma(th, (th * -0.16666666666666666), 1.0));
} else {
tmp = t_1;
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), fma(kx, Float64(-0.16666666666666666 * Float64(kx * kx)), kx)))) t_2 = Float64(1.0 - cos(Float64(kx + kx))) t_3 = cos(Float64(ky + ky)) t_4 = sin(kx) ^ 2.0 t_5 = Float64(sin(ky) / sqrt(Float64(t_4 + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_5 <= -1.0) tmp = t_1; elseif (t_5 <= -0.05) tmp = Float64(Float64(sin(ky) * sqrt(Float64(1.0 / fma(t_2, 0.5, fma(t_3, -0.5, 0.5))))) * fma(th, Float64(-0.16666666666666666 * Float64(th * th)), th)); elseif (t_5 <= 0.2) tmp = Float64(sin(th) * Float64(sin(ky) * sqrt(Float64(1.0 / t_4)))); elseif (t_5 <= 0.91) tmp = Float64(Float64(sin(ky) * sqrt(Float64(1.0 / fma(t_2, 0.5, Float64(0.5 + Float64(-0.5 * t_3)))))) * Float64(th * fma(th, Float64(th * -0.16666666666666666), 1.0))); else tmp = t_1; end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[(kx * N[(-0.16666666666666666 * N[(kx * kx), $MachinePrecision]), $MachinePrecision] + kx), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 - N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$5 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$4 + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$5, -1.0], t$95$1, If[LessEqual[t$95$5, -0.05], N[(N[(N[Sin[ky], $MachinePrecision] * N[Sqrt[N[(1.0 / N[(t$95$2 * 0.5 + N[(t$95$3 * -0.5 + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(th * N[(-0.16666666666666666 * N[(th * th), $MachinePrecision]), $MachinePrecision] + th), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$5, 0.2], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] * N[Sqrt[N[(1.0 / t$95$4), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$5, 0.91], N[(N[(N[Sin[ky], $MachinePrecision] * N[Sqrt[N[(1.0 / N[(t$95$2 * 0.5 + N[(0.5 + N[(-0.5 * t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(th * N[(th * N[(th * -0.16666666666666666), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \mathsf{fma}\left(kx, -0.16666666666666666 \cdot \left(kx \cdot kx\right), kx\right)\right)}\\
t_2 := 1 - \cos \left(kx + kx\right)\\
t_3 := \cos \left(ky + ky\right)\\
t_4 := {\sin kx}^{2}\\
t_5 := \frac{\sin ky}{\sqrt{t\_4 + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_5 \leq -1:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_5 \leq -0.05:\\
\;\;\;\;\left(\sin ky \cdot \sqrt{\frac{1}{\mathsf{fma}\left(t\_2, 0.5, \mathsf{fma}\left(t\_3, -0.5, 0.5\right)\right)}}\right) \cdot \mathsf{fma}\left(th, -0.16666666666666666 \cdot \left(th \cdot th\right), th\right)\\
\mathbf{elif}\;t\_5 \leq 0.2:\\
\;\;\;\;\sin th \cdot \left(\sin ky \cdot \sqrt{\frac{1}{t\_4}}\right)\\
\mathbf{elif}\;t\_5 \leq 0.91:\\
\;\;\;\;\left(\sin ky \cdot \sqrt{\frac{1}{\mathsf{fma}\left(t\_2, 0.5, 0.5 + -0.5 \cdot t\_3\right)}}\right) \cdot \left(th \cdot \mathsf{fma}\left(th, th \cdot -0.16666666666666666, 1\right)\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))))) < -1 or 0.910000000000000031 < (/.f64 (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 88.4%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f64100.0
Applied rewrites100.0%
Taylor expanded in kx around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6496.2
Applied rewrites96.2%
if -1 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.050000000000000003Initial program 99.1%
Applied rewrites99.1%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
flip-+N/A
lift-*.f64N/A
lift-*.f64N/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
flip-+N/A
lift-+.f64N/A
lower-fma.f6423.3
Applied rewrites99.1%
Taylor expanded in th around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6451.0
Applied rewrites51.0%
if -0.050000000000000003 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.20000000000000001Initial program 99.0%
Applied rewrites75.9%
lift-fma.f64N/A
+-commutativeN/A
Applied rewrites98.3%
Taylor expanded in ky around 0
lower-pow.f64N/A
lower-sin.f6494.5
Applied rewrites94.5%
if 0.20000000000000001 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.910000000000000031Initial program 99.1%
Applied rewrites99.3%
Taylor expanded in th around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6466.1
Applied rewrites66.1%
Applied rewrites66.2%
Final simplification86.9%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (- 1.0 (cos (+ kx kx))))
(t_2 (cos (+ ky ky)))
(t_3 (pow (sin kx) 2.0))
(t_4 (/ (sin ky) (sqrt (+ t_3 (pow (sin ky) 2.0)))))
(t_5 (fma th (* -0.16666666666666666 (* th th)) th)))
(if (<= t_4 -1.0)
(* (sin th) (* (sin ky) (sqrt (/ 2.0 (- 1.0 (cos (* ky -2.0)))))))
(if (<= t_4 -0.02)
(* (* (sin ky) (sqrt (/ 1.0 (fma t_1 0.5 (fma t_2 -0.5 0.5))))) t_5)
(if (<= t_4 4e-7)
(*
(sin th)
(/
(fma ky (* -0.16666666666666666 (* ky ky)) ky)
(sqrt (+ t_3 (* ky ky)))))
(if (<= t_4 0.91)
(*
(sqrt (/ 1.0 (fma t_1 0.5 (+ 0.5 (* -0.5 t_2)))))
(/ t_5 (/ 1.0 (sin ky))))
(sin th)))))))
double code(double kx, double ky, double th) {
double t_1 = 1.0 - cos((kx + kx));
double t_2 = cos((ky + ky));
double t_3 = pow(sin(kx), 2.0);
double t_4 = sin(ky) / sqrt((t_3 + pow(sin(ky), 2.0)));
double t_5 = fma(th, (-0.16666666666666666 * (th * th)), th);
double tmp;
if (t_4 <= -1.0) {
tmp = sin(th) * (sin(ky) * sqrt((2.0 / (1.0 - cos((ky * -2.0))))));
} else if (t_4 <= -0.02) {
tmp = (sin(ky) * sqrt((1.0 / fma(t_1, 0.5, fma(t_2, -0.5, 0.5))))) * t_5;
} else if (t_4 <= 4e-7) {
tmp = sin(th) * (fma(ky, (-0.16666666666666666 * (ky * ky)), ky) / sqrt((t_3 + (ky * ky))));
} else if (t_4 <= 0.91) {
tmp = sqrt((1.0 / fma(t_1, 0.5, (0.5 + (-0.5 * t_2))))) * (t_5 / (1.0 / sin(ky)));
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(1.0 - cos(Float64(kx + kx))) t_2 = cos(Float64(ky + ky)) t_3 = sin(kx) ^ 2.0 t_4 = Float64(sin(ky) / sqrt(Float64(t_3 + (sin(ky) ^ 2.0)))) t_5 = fma(th, Float64(-0.16666666666666666 * Float64(th * th)), th) tmp = 0.0 if (t_4 <= -1.0) tmp = Float64(sin(th) * Float64(sin(ky) * sqrt(Float64(2.0 / Float64(1.0 - cos(Float64(ky * -2.0))))))); elseif (t_4 <= -0.02) tmp = Float64(Float64(sin(ky) * sqrt(Float64(1.0 / fma(t_1, 0.5, fma(t_2, -0.5, 0.5))))) * t_5); elseif (t_4 <= 4e-7) tmp = Float64(sin(th) * Float64(fma(ky, Float64(-0.16666666666666666 * Float64(ky * ky)), ky) / sqrt(Float64(t_3 + Float64(ky * ky))))); elseif (t_4 <= 0.91) tmp = Float64(sqrt(Float64(1.0 / fma(t_1, 0.5, Float64(0.5 + Float64(-0.5 * t_2))))) * Float64(t_5 / Float64(1.0 / sin(ky)))); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(1.0 - N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$4 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$3 + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(th * N[(-0.16666666666666666 * N[(th * th), $MachinePrecision]), $MachinePrecision] + th), $MachinePrecision]}, If[LessEqual[t$95$4, -1.0], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] * N[Sqrt[N[(2.0 / N[(1.0 - N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, -0.02], N[(N[(N[Sin[ky], $MachinePrecision] * N[Sqrt[N[(1.0 / N[(t$95$1 * 0.5 + N[(t$95$2 * -0.5 + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$5), $MachinePrecision], If[LessEqual[t$95$4, 4e-7], N[(N[Sin[th], $MachinePrecision] * N[(N[(ky * N[(-0.16666666666666666 * N[(ky * ky), $MachinePrecision]), $MachinePrecision] + ky), $MachinePrecision] / N[Sqrt[N[(t$95$3 + N[(ky * ky), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 0.91], N[(N[Sqrt[N[(1.0 / N[(t$95$1 * 0.5 + N[(0.5 + N[(-0.5 * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(t$95$5 / N[(1.0 / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 1 - \cos \left(kx + kx\right)\\
t_2 := \cos \left(ky + ky\right)\\
t_3 := {\sin kx}^{2}\\
t_4 := \frac{\sin ky}{\sqrt{t\_3 + {\sin ky}^{2}}}\\
t_5 := \mathsf{fma}\left(th, -0.16666666666666666 \cdot \left(th \cdot th\right), th\right)\\
\mathbf{if}\;t\_4 \leq -1:\\
\;\;\;\;\sin th \cdot \left(\sin ky \cdot \sqrt{\frac{2}{1 - \cos \left(ky \cdot -2\right)}}\right)\\
\mathbf{elif}\;t\_4 \leq -0.02:\\
\;\;\;\;\left(\sin ky \cdot \sqrt{\frac{1}{\mathsf{fma}\left(t\_1, 0.5, \mathsf{fma}\left(t\_2, -0.5, 0.5\right)\right)}}\right) \cdot t\_5\\
\mathbf{elif}\;t\_4 \leq 4 \cdot 10^{-7}:\\
\;\;\;\;\sin th \cdot \frac{\mathsf{fma}\left(ky, -0.16666666666666666 \cdot \left(ky \cdot ky\right), ky\right)}{\sqrt{t\_3 + ky \cdot ky}}\\
\mathbf{elif}\;t\_4 \leq 0.91:\\
\;\;\;\;\sqrt{\frac{1}{\mathsf{fma}\left(t\_1, 0.5, 0.5 + -0.5 \cdot t\_2\right)}} \cdot \frac{t\_5}{\frac{1}{\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 88.3%
Applied rewrites66.9%
lift-fma.f64N/A
+-commutativeN/A
Applied rewrites67.1%
Taylor expanded in kx around 0
lower-/.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6466.9
Applied rewrites66.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.0200000000000000004Initial program 99.2%
Applied rewrites99.1%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
flip-+N/A
lift-*.f64N/A
lift-*.f64N/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
flip-+N/A
lift-+.f64N/A
lower-fma.f6423.2
Applied rewrites99.1%
Taylor expanded in th around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6449.7
Applied rewrites49.7%
if -0.0200000000000000004 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 3.9999999999999998e-7Initial program 99.0%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6499.0
Applied rewrites99.0%
Taylor expanded in ky around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6499.0
Applied rewrites99.0%
if 3.9999999999999998e-7 < (/.f64 (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.910000000000000031Initial program 99.0%
Applied rewrites99.0%
Taylor expanded in th around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6460.1
Applied rewrites60.1%
if 0.910000000000000031 < (/.f64 (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 88.5%
Taylor expanded in kx around 0
lower-sin.f6486.6
Applied rewrites86.6%
Final simplification79.4%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (- 1.0 (cos (+ kx kx))))
(t_2 (cos (+ ky ky)))
(t_3 (pow (sin kx) 2.0))
(t_4 (/ (sin ky) (sqrt (+ t_3 (pow (sin ky) 2.0))))))
(if (<= t_4 -1.0)
(* (sin th) (* (sin ky) (sqrt (/ 2.0 (- 1.0 (cos (* ky -2.0)))))))
(if (<= t_4 -0.05)
(*
(* (sin ky) (sqrt (/ 1.0 (fma t_1 0.5 (fma t_2 -0.5 0.5)))))
(fma th (* -0.16666666666666666 (* th th)) th))
(if (<= t_4 0.2)
(* (sin th) (* (sin ky) (sqrt (/ 1.0 t_3))))
(if (<= t_4 0.91)
(*
(* (sin ky) (sqrt (/ 1.0 (fma t_1 0.5 (+ 0.5 (* -0.5 t_2))))))
(* th (fma th (* th -0.16666666666666666) 1.0)))
(sin th)))))))
double code(double kx, double ky, double th) {
double t_1 = 1.0 - cos((kx + kx));
double t_2 = cos((ky + ky));
double t_3 = pow(sin(kx), 2.0);
double t_4 = sin(ky) / sqrt((t_3 + pow(sin(ky), 2.0)));
double tmp;
if (t_4 <= -1.0) {
tmp = sin(th) * (sin(ky) * sqrt((2.0 / (1.0 - cos((ky * -2.0))))));
} else if (t_4 <= -0.05) {
tmp = (sin(ky) * sqrt((1.0 / fma(t_1, 0.5, fma(t_2, -0.5, 0.5))))) * fma(th, (-0.16666666666666666 * (th * th)), th);
} else if (t_4 <= 0.2) {
tmp = sin(th) * (sin(ky) * sqrt((1.0 / t_3)));
} else if (t_4 <= 0.91) {
tmp = (sin(ky) * sqrt((1.0 / fma(t_1, 0.5, (0.5 + (-0.5 * t_2)))))) * (th * fma(th, (th * -0.16666666666666666), 1.0));
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(1.0 - cos(Float64(kx + kx))) t_2 = cos(Float64(ky + ky)) t_3 = sin(kx) ^ 2.0 t_4 = Float64(sin(ky) / sqrt(Float64(t_3 + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_4 <= -1.0) tmp = Float64(sin(th) * Float64(sin(ky) * sqrt(Float64(2.0 / Float64(1.0 - cos(Float64(ky * -2.0))))))); elseif (t_4 <= -0.05) tmp = Float64(Float64(sin(ky) * sqrt(Float64(1.0 / fma(t_1, 0.5, fma(t_2, -0.5, 0.5))))) * fma(th, Float64(-0.16666666666666666 * Float64(th * th)), th)); elseif (t_4 <= 0.2) tmp = Float64(sin(th) * Float64(sin(ky) * sqrt(Float64(1.0 / t_3)))); elseif (t_4 <= 0.91) tmp = Float64(Float64(sin(ky) * sqrt(Float64(1.0 / fma(t_1, 0.5, Float64(0.5 + Float64(-0.5 * t_2)))))) * Float64(th * fma(th, Float64(th * -0.16666666666666666), 1.0))); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(1.0 - N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$4 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$3 + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$4, -1.0], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] * N[Sqrt[N[(2.0 / N[(1.0 - N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, -0.05], N[(N[(N[Sin[ky], $MachinePrecision] * N[Sqrt[N[(1.0 / N[(t$95$1 * 0.5 + N[(t$95$2 * -0.5 + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(th * N[(-0.16666666666666666 * N[(th * th), $MachinePrecision]), $MachinePrecision] + th), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 0.2], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] * N[Sqrt[N[(1.0 / t$95$3), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 0.91], N[(N[(N[Sin[ky], $MachinePrecision] * N[Sqrt[N[(1.0 / N[(t$95$1 * 0.5 + N[(0.5 + N[(-0.5 * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(th * N[(th * N[(th * -0.16666666666666666), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 1 - \cos \left(kx + kx\right)\\
t_2 := \cos \left(ky + ky\right)\\
t_3 := {\sin kx}^{2}\\
t_4 := \frac{\sin ky}{\sqrt{t\_3 + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_4 \leq -1:\\
\;\;\;\;\sin th \cdot \left(\sin ky \cdot \sqrt{\frac{2}{1 - \cos \left(ky \cdot -2\right)}}\right)\\
\mathbf{elif}\;t\_4 \leq -0.05:\\
\;\;\;\;\left(\sin ky \cdot \sqrt{\frac{1}{\mathsf{fma}\left(t\_1, 0.5, \mathsf{fma}\left(t\_2, -0.5, 0.5\right)\right)}}\right) \cdot \mathsf{fma}\left(th, -0.16666666666666666 \cdot \left(th \cdot th\right), th\right)\\
\mathbf{elif}\;t\_4 \leq 0.2:\\
\;\;\;\;\sin th \cdot \left(\sin ky \cdot \sqrt{\frac{1}{t\_3}}\right)\\
\mathbf{elif}\;t\_4 \leq 0.91:\\
\;\;\;\;\left(\sin ky \cdot \sqrt{\frac{1}{\mathsf{fma}\left(t\_1, 0.5, 0.5 + -0.5 \cdot t\_2\right)}}\right) \cdot \left(th \cdot \mathsf{fma}\left(th, th \cdot -0.16666666666666666, 1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -1Initial program 88.3%
Applied rewrites66.9%
lift-fma.f64N/A
+-commutativeN/A
Applied rewrites67.1%
Taylor expanded in kx around 0
lower-/.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6466.9
Applied rewrites66.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.050000000000000003Initial program 99.1%
Applied rewrites99.1%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
flip-+N/A
lift-*.f64N/A
lift-*.f64N/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
flip-+N/A
lift-+.f64N/A
lower-fma.f6423.3
Applied rewrites99.1%
Taylor expanded in th around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6451.0
Applied rewrites51.0%
if -0.050000000000000003 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.20000000000000001Initial program 99.0%
Applied rewrites75.9%
lift-fma.f64N/A
+-commutativeN/A
Applied rewrites98.3%
Taylor expanded in ky around 0
lower-pow.f64N/A
lower-sin.f6494.5
Applied rewrites94.5%
if 0.20000000000000001 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.910000000000000031Initial program 99.1%
Applied rewrites99.3%
Taylor expanded in th around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6466.1
Applied rewrites66.1%
Applied rewrites66.2%
if 0.910000000000000031 < (/.f64 (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 88.5%
Taylor expanded in kx around 0
lower-sin.f6486.6
Applied rewrites86.6%
Final simplification79.2%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (- 1.0 (cos (+ kx kx))))
(t_2 (cos (+ ky ky)))
(t_3 (pow (sin kx) 2.0))
(t_4 (/ (sin ky) (sqrt (+ t_3 (pow (sin ky) 2.0))))))
(if (<= t_4 -1.0)
(* (sin th) (* (sin ky) (sqrt (/ 2.0 (- 1.0 (cos (* ky -2.0)))))))
(if (<= t_4 -0.02)
(*
(* (sin ky) (sqrt (/ 1.0 (fma t_1 0.5 (fma t_2 -0.5 0.5)))))
(fma th (* -0.16666666666666666 (* th th)) th))
(if (<= t_4 4e-7)
(*
(sin th)
(/
(fma ky (* -0.16666666666666666 (* ky ky)) ky)
(sqrt (+ t_3 (* ky ky)))))
(if (<= t_4 0.91)
(*
(* (sin ky) (sqrt (/ 1.0 (fma t_1 0.5 (+ 0.5 (* -0.5 t_2))))))
(* th (fma th (* th -0.16666666666666666) 1.0)))
(sin th)))))))
double code(double kx, double ky, double th) {
double t_1 = 1.0 - cos((kx + kx));
double t_2 = cos((ky + ky));
double t_3 = pow(sin(kx), 2.0);
double t_4 = sin(ky) / sqrt((t_3 + pow(sin(ky), 2.0)));
double tmp;
if (t_4 <= -1.0) {
tmp = sin(th) * (sin(ky) * sqrt((2.0 / (1.0 - cos((ky * -2.0))))));
} else if (t_4 <= -0.02) {
tmp = (sin(ky) * sqrt((1.0 / fma(t_1, 0.5, fma(t_2, -0.5, 0.5))))) * fma(th, (-0.16666666666666666 * (th * th)), th);
} else if (t_4 <= 4e-7) {
tmp = sin(th) * (fma(ky, (-0.16666666666666666 * (ky * ky)), ky) / sqrt((t_3 + (ky * ky))));
} else if (t_4 <= 0.91) {
tmp = (sin(ky) * sqrt((1.0 / fma(t_1, 0.5, (0.5 + (-0.5 * t_2)))))) * (th * fma(th, (th * -0.16666666666666666), 1.0));
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(1.0 - cos(Float64(kx + kx))) t_2 = cos(Float64(ky + ky)) t_3 = sin(kx) ^ 2.0 t_4 = Float64(sin(ky) / sqrt(Float64(t_3 + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_4 <= -1.0) tmp = Float64(sin(th) * Float64(sin(ky) * sqrt(Float64(2.0 / Float64(1.0 - cos(Float64(ky * -2.0))))))); elseif (t_4 <= -0.02) tmp = Float64(Float64(sin(ky) * sqrt(Float64(1.0 / fma(t_1, 0.5, fma(t_2, -0.5, 0.5))))) * fma(th, Float64(-0.16666666666666666 * Float64(th * th)), th)); elseif (t_4 <= 4e-7) tmp = Float64(sin(th) * Float64(fma(ky, Float64(-0.16666666666666666 * Float64(ky * ky)), ky) / sqrt(Float64(t_3 + Float64(ky * ky))))); elseif (t_4 <= 0.91) tmp = Float64(Float64(sin(ky) * sqrt(Float64(1.0 / fma(t_1, 0.5, Float64(0.5 + Float64(-0.5 * t_2)))))) * Float64(th * fma(th, Float64(th * -0.16666666666666666), 1.0))); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(1.0 - N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$4 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$3 + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$4, -1.0], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] * N[Sqrt[N[(2.0 / N[(1.0 - N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, -0.02], N[(N[(N[Sin[ky], $MachinePrecision] * N[Sqrt[N[(1.0 / N[(t$95$1 * 0.5 + N[(t$95$2 * -0.5 + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(th * N[(-0.16666666666666666 * N[(th * th), $MachinePrecision]), $MachinePrecision] + th), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 4e-7], N[(N[Sin[th], $MachinePrecision] * N[(N[(ky * N[(-0.16666666666666666 * N[(ky * ky), $MachinePrecision]), $MachinePrecision] + ky), $MachinePrecision] / N[Sqrt[N[(t$95$3 + N[(ky * ky), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 0.91], N[(N[(N[Sin[ky], $MachinePrecision] * N[Sqrt[N[(1.0 / N[(t$95$1 * 0.5 + N[(0.5 + N[(-0.5 * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(th * N[(th * N[(th * -0.16666666666666666), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 1 - \cos \left(kx + kx\right)\\
t_2 := \cos \left(ky + ky\right)\\
t_3 := {\sin kx}^{2}\\
t_4 := \frac{\sin ky}{\sqrt{t\_3 + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_4 \leq -1:\\
\;\;\;\;\sin th \cdot \left(\sin ky \cdot \sqrt{\frac{2}{1 - \cos \left(ky \cdot -2\right)}}\right)\\
\mathbf{elif}\;t\_4 \leq -0.02:\\
\;\;\;\;\left(\sin ky \cdot \sqrt{\frac{1}{\mathsf{fma}\left(t\_1, 0.5, \mathsf{fma}\left(t\_2, -0.5, 0.5\right)\right)}}\right) \cdot \mathsf{fma}\left(th, -0.16666666666666666 \cdot \left(th \cdot th\right), th\right)\\
\mathbf{elif}\;t\_4 \leq 4 \cdot 10^{-7}:\\
\;\;\;\;\sin th \cdot \frac{\mathsf{fma}\left(ky, -0.16666666666666666 \cdot \left(ky \cdot ky\right), ky\right)}{\sqrt{t\_3 + ky \cdot ky}}\\
\mathbf{elif}\;t\_4 \leq 0.91:\\
\;\;\;\;\left(\sin ky \cdot \sqrt{\frac{1}{\mathsf{fma}\left(t\_1, 0.5, 0.5 + -0.5 \cdot t\_2\right)}}\right) \cdot \left(th \cdot \mathsf{fma}\left(th, th \cdot -0.16666666666666666, 1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -1Initial program 88.3%
Applied rewrites66.9%
lift-fma.f64N/A
+-commutativeN/A
Applied rewrites67.1%
Taylor expanded in kx around 0
lower-/.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6466.9
Applied rewrites66.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.0200000000000000004Initial program 99.2%
Applied rewrites99.1%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
flip-+N/A
lift-*.f64N/A
lift-*.f64N/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
flip-+N/A
lift-+.f64N/A
lower-fma.f6423.2
Applied rewrites99.1%
Taylor expanded in th around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6449.7
Applied rewrites49.7%
if -0.0200000000000000004 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 3.9999999999999998e-7Initial program 99.0%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6499.0
Applied rewrites99.0%
Taylor expanded in ky around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6499.0
Applied rewrites99.0%
if 3.9999999999999998e-7 < (/.f64 (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.910000000000000031Initial program 99.0%
Applied rewrites99.3%
Taylor expanded in th around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6460.3
Applied rewrites60.3%
Applied rewrites60.4%
if 0.910000000000000031 < (/.f64 (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 88.5%
Taylor expanded in kx around 0
lower-sin.f6486.6
Applied rewrites86.6%
Final simplification79.4%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (pow (sin kx) 2.0))
(t_2 (/ (sin ky) (sqrt (+ t_1 (pow (sin ky) 2.0)))))
(t_3
(*
(*
(sin ky)
(sqrt
(/
1.0
(fma
(- 1.0 (cos (+ kx kx)))
0.5
(fma (cos (+ ky ky)) -0.5 0.5)))))
(fma th (* -0.16666666666666666 (* th th)) th))))
(if (<= t_2 -1.0)
(* (sin th) (* (sin ky) (sqrt (/ 2.0 (- 1.0 (cos (* ky -2.0)))))))
(if (<= t_2 -0.02)
t_3
(if (<= t_2 4e-7)
(*
(sin th)
(/
(fma ky (* -0.16666666666666666 (* ky ky)) ky)
(sqrt (+ t_1 (* ky ky)))))
(if (<= t_2 0.91) t_3 (sin th)))))))
double code(double kx, double ky, double th) {
double t_1 = pow(sin(kx), 2.0);
double t_2 = sin(ky) / sqrt((t_1 + pow(sin(ky), 2.0)));
double t_3 = (sin(ky) * sqrt((1.0 / fma((1.0 - cos((kx + kx))), 0.5, fma(cos((ky + ky)), -0.5, 0.5))))) * fma(th, (-0.16666666666666666 * (th * th)), th);
double tmp;
if (t_2 <= -1.0) {
tmp = sin(th) * (sin(ky) * sqrt((2.0 / (1.0 - cos((ky * -2.0))))));
} else if (t_2 <= -0.02) {
tmp = t_3;
} else if (t_2 <= 4e-7) {
tmp = sin(th) * (fma(ky, (-0.16666666666666666 * (ky * ky)), ky) / sqrt((t_1 + (ky * ky))));
} else if (t_2 <= 0.91) {
tmp = t_3;
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = sin(kx) ^ 2.0 t_2 = Float64(sin(ky) / sqrt(Float64(t_1 + (sin(ky) ^ 2.0)))) t_3 = Float64(Float64(sin(ky) * sqrt(Float64(1.0 / fma(Float64(1.0 - cos(Float64(kx + kx))), 0.5, fma(cos(Float64(ky + ky)), -0.5, 0.5))))) * fma(th, Float64(-0.16666666666666666 * Float64(th * th)), th)) tmp = 0.0 if (t_2 <= -1.0) tmp = Float64(sin(th) * Float64(sin(ky) * sqrt(Float64(2.0 / Float64(1.0 - cos(Float64(ky * -2.0))))))); elseif (t_2 <= -0.02) tmp = t_3; elseif (t_2 <= 4e-7) tmp = Float64(sin(th) * Float64(fma(ky, Float64(-0.16666666666666666 * Float64(ky * ky)), ky) / sqrt(Float64(t_1 + Float64(ky * ky))))); elseif (t_2 <= 0.91) tmp = t_3; else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$1 + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[Sin[ky], $MachinePrecision] * N[Sqrt[N[(1.0 / N[(N[(1.0 - N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5 + N[(N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision] * -0.5 + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(th * N[(-0.16666666666666666 * N[(th * th), $MachinePrecision]), $MachinePrecision] + th), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1.0], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] * N[Sqrt[N[(2.0 / N[(1.0 - N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -0.02], t$95$3, If[LessEqual[t$95$2, 4e-7], N[(N[Sin[th], $MachinePrecision] * N[(N[(ky * N[(-0.16666666666666666 * N[(ky * ky), $MachinePrecision]), $MachinePrecision] + ky), $MachinePrecision] / N[Sqrt[N[(t$95$1 + N[(ky * ky), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.91], t$95$3, N[Sin[th], $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := {\sin kx}^{2}\\
t_2 := \frac{\sin ky}{\sqrt{t\_1 + {\sin ky}^{2}}}\\
t_3 := \left(\sin ky \cdot \sqrt{\frac{1}{\mathsf{fma}\left(1 - \cos \left(kx + kx\right), 0.5, \mathsf{fma}\left(\cos \left(ky + ky\right), -0.5, 0.5\right)\right)}}\right) \cdot \mathsf{fma}\left(th, -0.16666666666666666 \cdot \left(th \cdot th\right), th\right)\\
\mathbf{if}\;t\_2 \leq -1:\\
\;\;\;\;\sin th \cdot \left(\sin ky \cdot \sqrt{\frac{2}{1 - \cos \left(ky \cdot -2\right)}}\right)\\
\mathbf{elif}\;t\_2 \leq -0.02:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{-7}:\\
\;\;\;\;\sin th \cdot \frac{\mathsf{fma}\left(ky, -0.16666666666666666 \cdot \left(ky \cdot ky\right), ky\right)}{\sqrt{t\_1 + ky \cdot ky}}\\
\mathbf{elif}\;t\_2 \leq 0.91:\\
\;\;\;\;t\_3\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -1Initial program 88.3%
Applied rewrites66.9%
lift-fma.f64N/A
+-commutativeN/A
Applied rewrites67.1%
Taylor expanded in kx around 0
lower-/.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6466.9
Applied rewrites66.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.0200000000000000004 or 3.9999999999999998e-7 < (/.f64 (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.910000000000000031Initial program 99.1%
Applied rewrites99.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
flip-+N/A
lift-*.f64N/A
lift-*.f64N/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
flip-+N/A
lift-+.f64N/A
lower-fma.f6422.8
Applied rewrites99.2%
Taylor expanded in th around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6454.3
Applied rewrites54.3%
if -0.0200000000000000004 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 3.9999999999999998e-7Initial program 99.0%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6499.0
Applied rewrites99.0%
Taylor expanded in ky around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6499.0
Applied rewrites99.0%
if 0.910000000000000031 < (/.f64 (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 88.5%
Taylor expanded in kx around 0
lower-sin.f6486.6
Applied rewrites86.6%
Final simplification79.4%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (pow (sin kx) 2.0))
(t_2 (/ (sin ky) (sqrt (+ t_1 (pow (sin ky) 2.0)))))
(t_3
(*
(sqrt
(/
1.0
(fma
(- 1.0 (cos (+ kx kx)))
0.5
(+ 0.5 (* -0.5 (cos (+ ky ky)))))))
(* (sin ky) th))))
(if (<= t_2 -1.0)
(* (sin th) (* (sin ky) (sqrt (/ 2.0 (- 1.0 (cos (* ky -2.0)))))))
(if (<= t_2 -0.005)
t_3
(if (<= t_2 4e-7)
(*
(sin th)
(/
(fma ky (* -0.16666666666666666 (* ky ky)) ky)
(sqrt (+ t_1 (* ky ky)))))
(if (<= t_2 0.91) t_3 (sin th)))))))
double code(double kx, double ky, double th) {
double t_1 = pow(sin(kx), 2.0);
double t_2 = sin(ky) / sqrt((t_1 + pow(sin(ky), 2.0)));
double t_3 = sqrt((1.0 / fma((1.0 - cos((kx + kx))), 0.5, (0.5 + (-0.5 * cos((ky + ky))))))) * (sin(ky) * th);
double tmp;
if (t_2 <= -1.0) {
tmp = sin(th) * (sin(ky) * sqrt((2.0 / (1.0 - cos((ky * -2.0))))));
} else if (t_2 <= -0.005) {
tmp = t_3;
} else if (t_2 <= 4e-7) {
tmp = sin(th) * (fma(ky, (-0.16666666666666666 * (ky * ky)), ky) / sqrt((t_1 + (ky * ky))));
} else if (t_2 <= 0.91) {
tmp = t_3;
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = sin(kx) ^ 2.0 t_2 = Float64(sin(ky) / sqrt(Float64(t_1 + (sin(ky) ^ 2.0)))) t_3 = Float64(sqrt(Float64(1.0 / fma(Float64(1.0 - cos(Float64(kx + kx))), 0.5, Float64(0.5 + Float64(-0.5 * cos(Float64(ky + ky))))))) * Float64(sin(ky) * th)) tmp = 0.0 if (t_2 <= -1.0) tmp = Float64(sin(th) * Float64(sin(ky) * sqrt(Float64(2.0 / Float64(1.0 - cos(Float64(ky * -2.0))))))); elseif (t_2 <= -0.005) tmp = t_3; elseif (t_2 <= 4e-7) tmp = Float64(sin(th) * Float64(fma(ky, Float64(-0.16666666666666666 * Float64(ky * ky)), ky) / sqrt(Float64(t_1 + Float64(ky * ky))))); elseif (t_2 <= 0.91) tmp = t_3; else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$1 + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Sqrt[N[(1.0 / N[(N[(1.0 - N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5 + N[(0.5 + N[(-0.5 * N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1.0], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] * N[Sqrt[N[(2.0 / N[(1.0 - N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -0.005], t$95$3, If[LessEqual[t$95$2, 4e-7], N[(N[Sin[th], $MachinePrecision] * N[(N[(ky * N[(-0.16666666666666666 * N[(ky * ky), $MachinePrecision]), $MachinePrecision] + ky), $MachinePrecision] / N[Sqrt[N[(t$95$1 + N[(ky * ky), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.91], t$95$3, N[Sin[th], $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := {\sin kx}^{2}\\
t_2 := \frac{\sin ky}{\sqrt{t\_1 + {\sin ky}^{2}}}\\
t_3 := \sqrt{\frac{1}{\mathsf{fma}\left(1 - \cos \left(kx + kx\right), 0.5, 0.5 + -0.5 \cdot \cos \left(ky + ky\right)\right)}} \cdot \left(\sin ky \cdot th\right)\\
\mathbf{if}\;t\_2 \leq -1:\\
\;\;\;\;\sin th \cdot \left(\sin ky \cdot \sqrt{\frac{2}{1 - \cos \left(ky \cdot -2\right)}}\right)\\
\mathbf{elif}\;t\_2 \leq -0.005:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{-7}:\\
\;\;\;\;\sin th \cdot \frac{\mathsf{fma}\left(ky, -0.16666666666666666 \cdot \left(ky \cdot ky\right), ky\right)}{\sqrt{t\_1 + ky \cdot ky}}\\
\mathbf{elif}\;t\_2 \leq 0.91:\\
\;\;\;\;t\_3\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -1Initial program 88.3%
Applied rewrites66.9%
lift-fma.f64N/A
+-commutativeN/A
Applied rewrites67.1%
Taylor expanded in kx around 0
lower-/.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6466.9
Applied rewrites66.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.0050000000000000001 or 3.9999999999999998e-7 < (/.f64 (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.910000000000000031Initial program 99.1%
Applied rewrites99.3%
Taylor expanded in th around 0
lower-*.f64N/A
lower-sin.f6454.0
Applied rewrites54.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))))) < 3.9999999999999998e-7Initial program 99.0%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6499.0
Applied rewrites99.0%
Taylor expanded in ky around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6499.0
Applied rewrites99.0%
if 0.910000000000000031 < (/.f64 (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 88.5%
Taylor expanded in kx around 0
lower-sin.f6486.6
Applied rewrites86.6%
Final simplification79.4%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (pow (sin kx) 2.0))
(t_2 (/ (sin ky) (sqrt (+ t_1 (pow (sin ky) 2.0))))))
(if (<= t_2 -0.005)
(* (sin th) (* (sin ky) (sqrt (/ 2.0 (- 1.0 (cos (* ky -2.0)))))))
(if (<= t_2 0.0002)
(*
(sin th)
(/
(fma ky (* -0.16666666666666666 (* ky ky)) ky)
(sqrt (+ t_1 (* ky ky)))))
(sin th)))))
double code(double kx, double ky, double th) {
double t_1 = pow(sin(kx), 2.0);
double t_2 = sin(ky) / sqrt((t_1 + pow(sin(ky), 2.0)));
double tmp;
if (t_2 <= -0.005) {
tmp = sin(th) * (sin(ky) * sqrt((2.0 / (1.0 - cos((ky * -2.0))))));
} else if (t_2 <= 0.0002) {
tmp = sin(th) * (fma(ky, (-0.16666666666666666 * (ky * ky)), ky) / sqrt((t_1 + (ky * ky))));
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = sin(kx) ^ 2.0 t_2 = Float64(sin(ky) / sqrt(Float64(t_1 + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_2 <= -0.005) tmp = Float64(sin(th) * Float64(sin(ky) * sqrt(Float64(2.0 / Float64(1.0 - cos(Float64(ky * -2.0))))))); elseif (t_2 <= 0.0002) tmp = Float64(sin(th) * Float64(fma(ky, Float64(-0.16666666666666666 * Float64(ky * ky)), ky) / sqrt(Float64(t_1 + Float64(ky * ky))))); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$1 + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -0.005], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] * N[Sqrt[N[(2.0 / N[(1.0 - N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.0002], N[(N[Sin[th], $MachinePrecision] * N[(N[(ky * N[(-0.16666666666666666 * N[(ky * ky), $MachinePrecision]), $MachinePrecision] + ky), $MachinePrecision] / N[Sqrt[N[(t$95$1 + N[(ky * ky), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := {\sin kx}^{2}\\
t_2 := \frac{\sin ky}{\sqrt{t\_1 + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_2 \leq -0.005:\\
\;\;\;\;\sin th \cdot \left(\sin ky \cdot \sqrt{\frac{2}{1 - \cos \left(ky \cdot -2\right)}}\right)\\
\mathbf{elif}\;t\_2 \leq 0.0002:\\
\;\;\;\;\sin th \cdot \frac{\mathsf{fma}\left(ky, -0.16666666666666666 \cdot \left(ky \cdot ky\right), ky\right)}{\sqrt{t\_1 + ky \cdot ky}}\\
\mathbf{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 92.8%
Applied rewrites80.2%
lift-fma.f64N/A
+-commutativeN/A
Applied rewrites80.3%
Taylor expanded in kx around 0
lower-/.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6447.7
Applied rewrites47.7%
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))))) < 2.0000000000000001e-4Initial program 99.0%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6499.0
Applied rewrites99.0%
Taylor expanded in ky around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6499.0
Applied rewrites99.0%
if 2.0000000000000001e-4 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 92.1%
Taylor expanded in kx around 0
lower-sin.f6463.2
Applied rewrites63.2%
Final simplification71.0%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
(if (<= t_1 -0.707)
(* (sin th) (* (sin ky) (sqrt (/ 2.0 (- 1.0 (cos (* ky -2.0)))))))
(if (<= t_1 0.7)
(* (sin ky) (* (sin th) (sqrt (/ 2.0 (- 1.0 (cos (* kx -2.0)))))))
(sin th)))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double tmp;
if (t_1 <= -0.707) {
tmp = sin(th) * (sin(ky) * sqrt((2.0 / (1.0 - cos((ky * -2.0))))));
} else if (t_1 <= 0.7) {
tmp = sin(ky) * (sin(th) * sqrt((2.0 / (1.0 - cos((kx * -2.0))))));
} 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.707d0)) then
tmp = sin(th) * (sin(ky) * sqrt((2.0d0 / (1.0d0 - cos((ky * (-2.0d0)))))))
else if (t_1 <= 0.7d0) then
tmp = sin(ky) * (sin(th) * sqrt((2.0d0 / (1.0d0 - cos((kx * (-2.0d0)))))))
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.707) {
tmp = Math.sin(th) * (Math.sin(ky) * Math.sqrt((2.0 / (1.0 - Math.cos((ky * -2.0))))));
} else if (t_1 <= 0.7) {
tmp = Math.sin(ky) * (Math.sin(th) * Math.sqrt((2.0 / (1.0 - Math.cos((kx * -2.0))))));
} 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.707: tmp = math.sin(th) * (math.sin(ky) * math.sqrt((2.0 / (1.0 - math.cos((ky * -2.0)))))) elif t_1 <= 0.7: tmp = math.sin(ky) * (math.sin(th) * math.sqrt((2.0 / (1.0 - math.cos((kx * -2.0)))))) 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.707) tmp = Float64(sin(th) * Float64(sin(ky) * sqrt(Float64(2.0 / Float64(1.0 - cos(Float64(ky * -2.0))))))); elseif (t_1 <= 0.7) tmp = Float64(sin(ky) * Float64(sin(th) * sqrt(Float64(2.0 / Float64(1.0 - cos(Float64(kx * -2.0))))))); 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.707) tmp = sin(th) * (sin(ky) * sqrt((2.0 / (1.0 - cos((ky * -2.0)))))); elseif (t_1 <= 0.7) tmp = sin(ky) * (sin(th) * sqrt((2.0 / (1.0 - cos((kx * -2.0)))))); 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.707], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] * N[Sqrt[N[(2.0 / N[(1.0 - N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.7], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] * N[Sqrt[N[(2.0 / N[(1.0 - N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_1 \leq -0.707:\\
\;\;\;\;\sin th \cdot \left(\sin ky \cdot \sqrt{\frac{2}{1 - \cos \left(ky \cdot -2\right)}}\right)\\
\mathbf{elif}\;t\_1 \leq 0.7:\\
\;\;\;\;\sin ky \cdot \left(\sin th \cdot \sqrt{\frac{2}{1 - \cos \left(kx \cdot -2\right)}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.706999999999999962Initial program 90.8%
Applied rewrites74.3%
lift-fma.f64N/A
+-commutativeN/A
Applied rewrites74.5%
Taylor expanded in kx around 0
lower-/.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6456.5
Applied rewrites56.5%
if -0.706999999999999962 < (/.f64 (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 99.0%
Applied rewrites81.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
flip-+N/A
lift-*.f64N/A
lift-*.f64N/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
flip-+N/A
lift-+.f64N/A
lower-fma.f6426.5
Applied rewrites81.8%
Taylor expanded in ky around 0
lower-/.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6459.6
Applied rewrites59.6%
lift-*.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites59.6%
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))))) Initial program 90.1%
Taylor expanded in kx around 0
lower-sin.f6476.8
Applied rewrites76.8%
Final simplification62.9%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
(if (<= t_1 -0.707)
(* (sin th) (* (sin ky) (sqrt (/ 2.0 (- 1.0 (cos (* ky -2.0)))))))
(if (<= t_1 0.7)
(* (sin th) (* (sin ky) (sqrt (/ 2.0 (- 1.0 (cos (* kx -2.0)))))))
(sin th)))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double tmp;
if (t_1 <= -0.707) {
tmp = sin(th) * (sin(ky) * sqrt((2.0 / (1.0 - cos((ky * -2.0))))));
} else if (t_1 <= 0.7) {
tmp = sin(th) * (sin(ky) * sqrt((2.0 / (1.0 - cos((kx * -2.0))))));
} 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.707d0)) then
tmp = sin(th) * (sin(ky) * sqrt((2.0d0 / (1.0d0 - cos((ky * (-2.0d0)))))))
else if (t_1 <= 0.7d0) then
tmp = sin(th) * (sin(ky) * sqrt((2.0d0 / (1.0d0 - cos((kx * (-2.0d0)))))))
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.707) {
tmp = Math.sin(th) * (Math.sin(ky) * Math.sqrt((2.0 / (1.0 - Math.cos((ky * -2.0))))));
} else if (t_1 <= 0.7) {
tmp = Math.sin(th) * (Math.sin(ky) * Math.sqrt((2.0 / (1.0 - Math.cos((kx * -2.0))))));
} 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.707: tmp = math.sin(th) * (math.sin(ky) * math.sqrt((2.0 / (1.0 - math.cos((ky * -2.0)))))) elif t_1 <= 0.7: tmp = math.sin(th) * (math.sin(ky) * math.sqrt((2.0 / (1.0 - math.cos((kx * -2.0)))))) 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.707) tmp = Float64(sin(th) * Float64(sin(ky) * sqrt(Float64(2.0 / Float64(1.0 - cos(Float64(ky * -2.0))))))); elseif (t_1 <= 0.7) tmp = Float64(sin(th) * Float64(sin(ky) * sqrt(Float64(2.0 / Float64(1.0 - cos(Float64(kx * -2.0))))))); else tmp = sin(th); end return tmp end
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.707) tmp = sin(th) * (sin(ky) * sqrt((2.0 / (1.0 - cos((ky * -2.0)))))); elseif (t_1 <= 0.7) tmp = sin(th) * (sin(ky) * sqrt((2.0 / (1.0 - cos((kx * -2.0)))))); 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.707], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] * N[Sqrt[N[(2.0 / N[(1.0 - N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.7], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] * N[Sqrt[N[(2.0 / N[(1.0 - N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_1 \leq -0.707:\\
\;\;\;\;\sin th \cdot \left(\sin ky \cdot \sqrt{\frac{2}{1 - \cos \left(ky \cdot -2\right)}}\right)\\
\mathbf{elif}\;t\_1 \leq 0.7:\\
\;\;\;\;\sin th \cdot \left(\sin ky \cdot \sqrt{\frac{2}{1 - \cos \left(kx \cdot -2\right)}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.706999999999999962Initial program 90.8%
Applied rewrites74.3%
lift-fma.f64N/A
+-commutativeN/A
Applied rewrites74.5%
Taylor expanded in kx around 0
lower-/.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6456.5
Applied rewrites56.5%
if -0.706999999999999962 < (/.f64 (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 99.0%
Applied rewrites81.8%
Taylor expanded in ky around 0
lower-/.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6459.6
Applied rewrites59.6%
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))))) Initial program 90.1%
Taylor expanded in kx around 0
lower-sin.f6476.8
Applied rewrites76.8%
Final simplification62.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.707)
(* (sin th) (* (sin ky) (sqrt (/ 2.0 (- 1.0 (cos (* ky -2.0)))))))
(if (<= t_1 0.7)
(* (sqrt (/ 2.0 (- 1.0 (cos (* kx -2.0))))) (* (sin ky) (sin th)))
(sin th)))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double tmp;
if (t_1 <= -0.707) {
tmp = sin(th) * (sin(ky) * sqrt((2.0 / (1.0 - cos((ky * -2.0))))));
} else if (t_1 <= 0.7) {
tmp = sqrt((2.0 / (1.0 - cos((kx * -2.0))))) * (sin(ky) * sin(th));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: t_1
real(8) :: tmp
t_1 = sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))
if (t_1 <= (-0.707d0)) then
tmp = sin(th) * (sin(ky) * sqrt((2.0d0 / (1.0d0 - cos((ky * (-2.0d0)))))))
else if (t_1 <= 0.7d0) then
tmp = sqrt((2.0d0 / (1.0d0 - cos((kx * (-2.0d0)))))) * (sin(ky) * sin(th))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)));
double tmp;
if (t_1 <= -0.707) {
tmp = Math.sin(th) * (Math.sin(ky) * Math.sqrt((2.0 / (1.0 - Math.cos((ky * -2.0))))));
} else if (t_1 <= 0.7) {
tmp = Math.sqrt((2.0 / (1.0 - Math.cos((kx * -2.0))))) * (Math.sin(ky) * Math.sin(th));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0))) tmp = 0 if t_1 <= -0.707: tmp = math.sin(th) * (math.sin(ky) * math.sqrt((2.0 / (1.0 - math.cos((ky * -2.0)))))) elif t_1 <= 0.7: tmp = math.sqrt((2.0 / (1.0 - math.cos((kx * -2.0))))) * (math.sin(ky) * math.sin(th)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_1 <= -0.707) tmp = Float64(sin(th) * Float64(sin(ky) * sqrt(Float64(2.0 / Float64(1.0 - cos(Float64(ky * -2.0))))))); elseif (t_1 <= 0.7) tmp = Float64(sqrt(Float64(2.0 / Float64(1.0 - cos(Float64(kx * -2.0))))) * Float64(sin(ky) * sin(th))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0))); tmp = 0.0; if (t_1 <= -0.707) tmp = sin(th) * (sin(ky) * sqrt((2.0 / (1.0 - cos((ky * -2.0)))))); elseif (t_1 <= 0.7) tmp = sqrt((2.0 / (1.0 - cos((kx * -2.0))))) * (sin(ky) * sin(th)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -0.707], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] * N[Sqrt[N[(2.0 / N[(1.0 - N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.7], N[(N[Sqrt[N[(2.0 / N[(1.0 - N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] * N[Sin[th], $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.707:\\
\;\;\;\;\sin th \cdot \left(\sin ky \cdot \sqrt{\frac{2}{1 - \cos \left(ky \cdot -2\right)}}\right)\\
\mathbf{elif}\;t\_1 \leq 0.7:\\
\;\;\;\;\sqrt{\frac{2}{1 - \cos \left(kx \cdot -2\right)}} \cdot \left(\sin ky \cdot \sin th\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.706999999999999962Initial program 90.8%
Applied rewrites74.3%
lift-fma.f64N/A
+-commutativeN/A
Applied rewrites74.5%
Taylor expanded in kx around 0
lower-/.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6456.5
Applied rewrites56.5%
if -0.706999999999999962 < (/.f64 (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 99.0%
Applied rewrites81.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
flip-+N/A
lift-*.f64N/A
lift-*.f64N/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
flip-+N/A
lift-+.f64N/A
lower-fma.f6426.5
Applied rewrites81.8%
Taylor expanded in ky around 0
lower-/.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6459.6
Applied rewrites59.6%
lift-*.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lift-sin.f6459.5
Applied rewrites59.5%
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))))) Initial program 90.1%
Taylor expanded in kx around 0
lower-sin.f6476.8
Applied rewrites76.8%
Final simplification62.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.707)
(* (sin th) (/ (sin ky) (sqrt (fma -0.5 (cos (* ky -2.0)) 0.5))))
(if (<= t_1 0.7)
(* (sqrt (/ 2.0 (- 1.0 (cos (* kx -2.0))))) (* (sin ky) (sin th)))
(sin th)))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double tmp;
if (t_1 <= -0.707) {
tmp = sin(th) * (sin(ky) / sqrt(fma(-0.5, cos((ky * -2.0)), 0.5)));
} else if (t_1 <= 0.7) {
tmp = sqrt((2.0 / (1.0 - cos((kx * -2.0))))) * (sin(ky) * sin(th));
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_1 <= -0.707) tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(fma(-0.5, cos(Float64(ky * -2.0)), 0.5)))); elseif (t_1 <= 0.7) tmp = Float64(sqrt(Float64(2.0 / Float64(1.0 - cos(Float64(kx * -2.0))))) * Float64(sin(ky) * sin(th))); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -0.707], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.7], N[(N[Sqrt[N[(2.0 / N[(1.0 - N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] * N[Sin[th], $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.707:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{\mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), 0.5\right)}}\\
\mathbf{elif}\;t\_1 \leq 0.7:\\
\;\;\;\;\sqrt{\frac{2}{1 - \cos \left(kx \cdot -2\right)}} \cdot \left(\sin ky \cdot \sin th\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.706999999999999962Initial program 90.8%
Applied rewrites74.3%
Taylor expanded in kx around 0
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6456.2
Applied rewrites56.2%
Applied rewrites56.5%
if -0.706999999999999962 < (/.f64 (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 99.0%
Applied rewrites81.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
flip-+N/A
lift-*.f64N/A
lift-*.f64N/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
flip-+N/A
lift-+.f64N/A
lower-fma.f6426.5
Applied rewrites81.8%
Taylor expanded in ky around 0
lower-/.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6459.6
Applied rewrites59.6%
lift-*.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lift-sin.f6459.5
Applied rewrites59.5%
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))))) Initial program 90.1%
Taylor expanded in kx around 0
lower-sin.f6476.8
Applied rewrites76.8%
Final simplification62.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.005)
(* (sin th) (/ (sin ky) (sqrt (fma -0.5 (cos (* ky -2.0)) 0.5))))
(if (<= t_1 0.0002)
(*
(sin th)
(* (sqrt (/ 1.0 (- 1.0 (cos (* kx -2.0))))) (* ky (sqrt 2.0))))
(sin th)))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double tmp;
if (t_1 <= -0.005) {
tmp = sin(th) * (sin(ky) / sqrt(fma(-0.5, cos((ky * -2.0)), 0.5)));
} else if (t_1 <= 0.0002) {
tmp = sin(th) * (sqrt((1.0 / (1.0 - cos((kx * -2.0))))) * (ky * sqrt(2.0)));
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_1 <= -0.005) tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(fma(-0.5, cos(Float64(ky * -2.0)), 0.5)))); elseif (t_1 <= 0.0002) tmp = Float64(sin(th) * Float64(sqrt(Float64(1.0 / Float64(1.0 - cos(Float64(kx * -2.0))))) * Float64(ky * sqrt(2.0)))); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -0.005], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0002], N[(N[Sin[th], $MachinePrecision] * N[(N[Sqrt[N[(1.0 / N[(1.0 - N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(ky * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_1 \leq -0.005:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{\mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), 0.5\right)}}\\
\mathbf{elif}\;t\_1 \leq 0.0002:\\
\;\;\;\;\sin th \cdot \left(\sqrt{\frac{1}{1 - \cos \left(kx \cdot -2\right)}} \cdot \left(ky \cdot \sqrt{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.0050000000000000001Initial program 92.8%
Applied rewrites80.2%
Taylor expanded in kx around 0
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6447.4
Applied rewrites47.4%
Applied rewrites47.7%
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))))) < 2.0000000000000001e-4Initial program 99.0%
Applied rewrites74.6%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f6474.0
Applied rewrites74.0%
if 2.0000000000000001e-4 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 92.1%
Taylor expanded in kx around 0
lower-sin.f6463.2
Applied rewrites63.2%
Final simplification62.0%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
(if (<= t_1 -0.005)
(*
(/ th (/ 1.0 (sin ky)))
(sqrt (/ 1.0 (fma -0.5 (cos (* ky -2.0)) 0.5))))
(if (<= t_1 0.0002)
(*
(sin th)
(* (sqrt (/ 1.0 (- 1.0 (cos (* kx -2.0))))) (* ky (sqrt 2.0))))
(sin th)))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double tmp;
if (t_1 <= -0.005) {
tmp = (th / (1.0 / sin(ky))) * sqrt((1.0 / fma(-0.5, cos((ky * -2.0)), 0.5)));
} else if (t_1 <= 0.0002) {
tmp = sin(th) * (sqrt((1.0 / (1.0 - cos((kx * -2.0))))) * (ky * sqrt(2.0)));
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_1 <= -0.005) tmp = Float64(Float64(th / Float64(1.0 / sin(ky))) * sqrt(Float64(1.0 / fma(-0.5, cos(Float64(ky * -2.0)), 0.5)))); elseif (t_1 <= 0.0002) tmp = Float64(sin(th) * Float64(sqrt(Float64(1.0 / Float64(1.0 - cos(Float64(kx * -2.0))))) * Float64(ky * sqrt(2.0)))); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -0.005], N[(N[(th / N[(1.0 / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0002], N[(N[Sin[th], $MachinePrecision] * N[(N[Sqrt[N[(1.0 / N[(1.0 - N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(ky * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_1 \leq -0.005:\\
\;\;\;\;\frac{th}{\frac{1}{\sin ky}} \cdot \sqrt{\frac{1}{\mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), 0.5\right)}}\\
\mathbf{elif}\;t\_1 \leq 0.0002:\\
\;\;\;\;\sin th \cdot \left(\sqrt{\frac{1}{1 - \cos \left(kx \cdot -2\right)}} \cdot \left(ky \cdot \sqrt{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.0050000000000000001Initial program 92.8%
Applied rewrites80.2%
Taylor expanded in kx around 0
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6447.4
Applied rewrites47.4%
Taylor expanded in th around 0
Applied rewrites18.7%
Applied rewrites18.8%
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))))) < 2.0000000000000001e-4Initial program 99.0%
Applied rewrites74.6%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f6474.0
Applied rewrites74.0%
if 2.0000000000000001e-4 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 92.1%
Taylor expanded in kx around 0
lower-sin.f6463.2
Applied rewrites63.2%
Final simplification52.4%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
(if (<= t_1 -0.005)
(*
(fma th (* -0.16666666666666666 (* th th)) th)
(* (sin ky) (sqrt (/ 1.0 (fma -0.5 (cos (* ky -2.0)) 0.5)))))
(if (<= t_1 0.0002)
(*
(sin th)
(* (sqrt (/ 1.0 (- 1.0 (cos (* kx -2.0))))) (* ky (sqrt 2.0))))
(sin th)))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double tmp;
if (t_1 <= -0.005) {
tmp = fma(th, (-0.16666666666666666 * (th * th)), th) * (sin(ky) * sqrt((1.0 / fma(-0.5, cos((ky * -2.0)), 0.5))));
} else if (t_1 <= 0.0002) {
tmp = sin(th) * (sqrt((1.0 / (1.0 - cos((kx * -2.0))))) * (ky * sqrt(2.0)));
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_1 <= -0.005) tmp = Float64(fma(th, Float64(-0.16666666666666666 * Float64(th * th)), th) * Float64(sin(ky) * sqrt(Float64(1.0 / fma(-0.5, cos(Float64(ky * -2.0)), 0.5))))); elseif (t_1 <= 0.0002) tmp = Float64(sin(th) * Float64(sqrt(Float64(1.0 / Float64(1.0 - cos(Float64(kx * -2.0))))) * Float64(ky * sqrt(2.0)))); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -0.005], N[(N[(th * N[(-0.16666666666666666 * N[(th * th), $MachinePrecision]), $MachinePrecision] + th), $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] * N[Sqrt[N[(1.0 / N[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0002], N[(N[Sin[th], $MachinePrecision] * N[(N[Sqrt[N[(1.0 / N[(1.0 - N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(ky * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_1 \leq -0.005:\\
\;\;\;\;\mathsf{fma}\left(th, -0.16666666666666666 \cdot \left(th \cdot th\right), th\right) \cdot \left(\sin ky \cdot \sqrt{\frac{1}{\mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), 0.5\right)}}\right)\\
\mathbf{elif}\;t\_1 \leq 0.0002:\\
\;\;\;\;\sin th \cdot \left(\sqrt{\frac{1}{1 - \cos \left(kx \cdot -2\right)}} \cdot \left(ky \cdot \sqrt{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.0050000000000000001Initial program 92.8%
Applied rewrites80.2%
Taylor expanded in th around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6434.4
Applied rewrites34.4%
Taylor expanded in kx around 0
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6418.7
Applied rewrites18.7%
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))))) < 2.0000000000000001e-4Initial program 99.0%
Applied rewrites74.6%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f6474.0
Applied rewrites74.0%
if 2.0000000000000001e-4 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 92.1%
Taylor expanded in kx around 0
lower-sin.f6463.2
Applied rewrites63.2%
Final simplification52.4%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
(if (<= t_1 -0.005)
(* (sqrt (/ 1.0 (fma -0.5 (cos (* ky -2.0)) 0.5))) (* (sin ky) th))
(if (<= t_1 0.0002)
(*
(sin th)
(* (sqrt (/ 1.0 (- 1.0 (cos (* kx -2.0))))) (* ky (sqrt 2.0))))
(sin th)))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double tmp;
if (t_1 <= -0.005) {
tmp = sqrt((1.0 / fma(-0.5, cos((ky * -2.0)), 0.5))) * (sin(ky) * th);
} else if (t_1 <= 0.0002) {
tmp = sin(th) * (sqrt((1.0 / (1.0 - cos((kx * -2.0))))) * (ky * sqrt(2.0)));
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_1 <= -0.005) tmp = Float64(sqrt(Float64(1.0 / fma(-0.5, cos(Float64(ky * -2.0)), 0.5))) * Float64(sin(ky) * th)); elseif (t_1 <= 0.0002) tmp = Float64(sin(th) * Float64(sqrt(Float64(1.0 / Float64(1.0 - cos(Float64(kx * -2.0))))) * Float64(ky * sqrt(2.0)))); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -0.005], N[(N[Sqrt[N[(1.0 / N[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0002], N[(N[Sin[th], $MachinePrecision] * N[(N[Sqrt[N[(1.0 / N[(1.0 - N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(ky * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_1 \leq -0.005:\\
\;\;\;\;\sqrt{\frac{1}{\mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), 0.5\right)}} \cdot \left(\sin ky \cdot th\right)\\
\mathbf{elif}\;t\_1 \leq 0.0002:\\
\;\;\;\;\sin th \cdot \left(\sqrt{\frac{1}{1 - \cos \left(kx \cdot -2\right)}} \cdot \left(ky \cdot \sqrt{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.0050000000000000001Initial program 92.8%
Applied rewrites80.2%
Taylor expanded in kx around 0
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6447.4
Applied rewrites47.4%
Taylor expanded in th around 0
Applied rewrites18.7%
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))))) < 2.0000000000000001e-4Initial program 99.0%
Applied rewrites74.6%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f6474.0
Applied rewrites74.0%
if 2.0000000000000001e-4 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 92.1%
Taylor expanded in kx around 0
lower-sin.f6463.2
Applied rewrites63.2%
Final simplification52.4%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
(if (<= t_1 -0.005)
(* (sqrt (/ 1.0 (fma -0.5 (cos (* ky -2.0)) 0.5))) (* (sin ky) th))
(if (<= t_1 0.0002)
(*
(sqrt (/ 1.0 (- 1.0 (cos (* kx -2.0)))))
(* (sqrt 2.0) (* ky (sin th))))
(sin th)))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double tmp;
if (t_1 <= -0.005) {
tmp = sqrt((1.0 / fma(-0.5, cos((ky * -2.0)), 0.5))) * (sin(ky) * th);
} else if (t_1 <= 0.0002) {
tmp = sqrt((1.0 / (1.0 - cos((kx * -2.0))))) * (sqrt(2.0) * (ky * sin(th)));
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_1 <= -0.005) tmp = Float64(sqrt(Float64(1.0 / fma(-0.5, cos(Float64(ky * -2.0)), 0.5))) * Float64(sin(ky) * th)); elseif (t_1 <= 0.0002) tmp = Float64(sqrt(Float64(1.0 / Float64(1.0 - cos(Float64(kx * -2.0))))) * Float64(sqrt(2.0) * Float64(ky * sin(th)))); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -0.005], N[(N[Sqrt[N[(1.0 / N[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0002], N[(N[Sqrt[N[(1.0 / N[(1.0 - N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] * N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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.005:\\
\;\;\;\;\sqrt{\frac{1}{\mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), 0.5\right)}} \cdot \left(\sin ky \cdot th\right)\\
\mathbf{elif}\;t\_1 \leq 0.0002:\\
\;\;\;\;\sqrt{\frac{1}{1 - \cos \left(kx \cdot -2\right)}} \cdot \left(\sqrt{2} \cdot \left(ky \cdot \sin th\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.0050000000000000001Initial program 92.8%
Applied rewrites80.2%
Taylor expanded in kx around 0
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6447.4
Applied rewrites47.4%
Taylor expanded in th around 0
Applied rewrites18.7%
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))))) < 2.0000000000000001e-4Initial program 99.0%
Applied rewrites74.6%
Taylor expanded in ky around 0
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6473.9
Applied rewrites73.9%
if 2.0000000000000001e-4 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 92.1%
Taylor expanded in kx around 0
lower-sin.f6463.2
Applied rewrites63.2%
Final simplification52.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 -0.005)
(* (sqrt (/ 1.0 (fma -0.5 (cos (* ky -2.0)) 0.5))) (* (sin ky) th))
(if (<= t_1 0.0002) (* (sin th) (/ ky (sin kx))) (sin th)))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double tmp;
if (t_1 <= -0.005) {
tmp = sqrt((1.0 / fma(-0.5, cos((ky * -2.0)), 0.5))) * (sin(ky) * th);
} else if (t_1 <= 0.0002) {
tmp = sin(th) * (ky / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_1 <= -0.005) tmp = Float64(sqrt(Float64(1.0 / fma(-0.5, cos(Float64(ky * -2.0)), 0.5))) * Float64(sin(ky) * th)); elseif (t_1 <= 0.0002) tmp = Float64(sin(th) * Float64(ky / sin(kx))); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -0.005], N[(N[Sqrt[N[(1.0 / N[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0002], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_1 \leq -0.005:\\
\;\;\;\;\sqrt{\frac{1}{\mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), 0.5\right)}} \cdot \left(\sin ky \cdot th\right)\\
\mathbf{elif}\;t\_1 \leq 0.0002:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.0050000000000000001Initial program 92.8%
Applied rewrites80.2%
Taylor expanded in kx around 0
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6447.4
Applied rewrites47.4%
Taylor expanded in th around 0
Applied rewrites18.7%
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))))) < 2.0000000000000001e-4Initial program 99.0%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-sin.f6462.0
Applied rewrites62.0%
if 2.0000000000000001e-4 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 92.1%
Taylor expanded in kx around 0
lower-sin.f6463.2
Applied rewrites63.2%
Final simplification48.0%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
(if (<= t_1 -0.005)
(/ (* (sin ky) th) (sqrt (fma -0.5 (cos (* ky -2.0)) 0.5)))
(if (<= t_1 0.0002) (* (sin th) (/ ky (sin kx))) (sin th)))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double tmp;
if (t_1 <= -0.005) {
tmp = (sin(ky) * th) / sqrt(fma(-0.5, cos((ky * -2.0)), 0.5));
} else if (t_1 <= 0.0002) {
tmp = sin(th) * (ky / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_1 <= -0.005) tmp = Float64(Float64(sin(ky) * th) / sqrt(fma(-0.5, cos(Float64(ky * -2.0)), 0.5))); elseif (t_1 <= 0.0002) tmp = Float64(sin(th) * Float64(ky / sin(kx))); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -0.005], N[(N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision] / N[Sqrt[N[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0002], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_1 \leq -0.005:\\
\;\;\;\;\frac{\sin ky \cdot th}{\sqrt{\mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), 0.5\right)}}\\
\mathbf{elif}\;t\_1 \leq 0.0002:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.0050000000000000001Initial program 92.8%
Applied rewrites80.2%
Taylor expanded in kx around 0
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6447.4
Applied rewrites47.4%
Taylor expanded in th around 0
Applied rewrites18.7%
Applied rewrites18.8%
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))))) < 2.0000000000000001e-4Initial program 99.0%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-sin.f6462.0
Applied rewrites62.0%
if 2.0000000000000001e-4 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 92.1%
Taylor expanded in kx around 0
lower-sin.f6463.2
Applied rewrites63.2%
Final simplification48.0%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 0.0002) (* (sin th) (/ ky (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) <= 0.0002) {
tmp = sin(th) * (ky / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if ((sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) <= 0.0002d0) then
tmp = sin(th) * (ky / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if ((Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) <= 0.0002) {
tmp = Math.sin(th) * (ky / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) <= 0.0002: tmp = math.sin(th) * (ky / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 0.0002) tmp = Float64(sin(th) * Float64(ky / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 0.0002) tmp = sin(th) * (ky / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 0.0002], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 0.0002:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2.0000000000000001e-4Initial program 96.0%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-sin.f6434.9
Applied rewrites34.9%
if 2.0000000000000001e-4 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 92.1%
Taylor expanded in kx around 0
lower-sin.f6463.2
Applied rewrites63.2%
Final simplification43.5%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 0.0002) (/ (* ky (sin th)) (sin kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) <= 0.0002) {
tmp = (ky * sin(th)) / sin(kx);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if ((sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) <= 0.0002d0) then
tmp = (ky * sin(th)) / sin(kx)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if ((Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) <= 0.0002) {
tmp = (ky * Math.sin(th)) / Math.sin(kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) <= 0.0002: tmp = (ky * math.sin(th)) / math.sin(kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 0.0002) tmp = Float64(Float64(ky * sin(th)) / sin(kx)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 0.0002) tmp = (ky * sin(th)) / sin(kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 0.0002], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 0.0002:\\
\;\;\;\;\frac{ky \cdot \sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2.0000000000000001e-4Initial program 96.0%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f6433.9
Applied rewrites33.9%
if 2.0000000000000001e-4 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 92.1%
Taylor expanded in kx around 0
lower-sin.f6463.2
Applied rewrites63.2%
(FPCore (kx ky th)
:precision binary64
(if (<=
(*
(sin th)
(/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))))
4e-307)
(* (* th th) (* th -0.16666666666666666))
(fma
th
(* (* th th) (fma 0.008333333333333333 (* th th) -0.16666666666666666))
th)))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(th) * (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0))))) <= 4e-307) {
tmp = (th * th) * (th * -0.16666666666666666);
} else {
tmp = fma(th, ((th * th) * fma(0.008333333333333333, (th * th), -0.16666666666666666)), th);
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(th) * Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0))))) <= 4e-307) tmp = Float64(Float64(th * th) * Float64(th * -0.16666666666666666)); else tmp = fma(th, Float64(Float64(th * th) * fma(0.008333333333333333, Float64(th * th), -0.16666666666666666)), th); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 4e-307], N[(N[(th * th), $MachinePrecision] * N[(th * -0.16666666666666666), $MachinePrecision]), $MachinePrecision], N[(th * N[(N[(th * th), $MachinePrecision] * N[(0.008333333333333333 * N[(th * th), $MachinePrecision] + -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + th), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin th \cdot \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 4 \cdot 10^{-307}:\\
\;\;\;\;\left(th \cdot th\right) \cdot \left(th \cdot -0.16666666666666666\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(th, \left(th \cdot th\right) \cdot \mathsf{fma}\left(0.008333333333333333, th \cdot th, -0.16666666666666666\right), th\right)\\
\end{array}
\end{array}
if (*.f64 (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) (sin.f64 th)) < 3.99999999999999964e-307Initial program 94.6%
Taylor expanded in kx around 0
lower-sin.f6421.8
Applied rewrites21.8%
Taylor expanded in th around 0
Applied rewrites11.2%
Taylor expanded in th around inf
Applied rewrites17.4%
Applied rewrites17.4%
if 3.99999999999999964e-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 95.1%
Taylor expanded in kx around 0
lower-sin.f6422.0
Applied rewrites22.0%
Taylor expanded in th around 0
Applied rewrites10.6%
Final simplification14.3%
(FPCore (kx ky th)
:precision binary64
(if (<= (pow (sin kx) 2.0) 2e-8)
(*
(sin th)
(/
(sin ky)
(hypot (sin ky) (fma kx (* -0.16666666666666666 (* kx kx)) kx))))
(*
(sin th)
(/
(sin ky)
(sqrt
(fma (- 1.0 (cos (+ kx kx))) 0.5 (+ 0.5 (* -0.5 (cos (+ ky ky))))))))))
double code(double kx, double ky, double th) {
double tmp;
if (pow(sin(kx), 2.0) <= 2e-8) {
tmp = sin(th) * (sin(ky) / hypot(sin(ky), fma(kx, (-0.16666666666666666 * (kx * kx)), kx)));
} else {
tmp = sin(th) * (sin(ky) / sqrt(fma((1.0 - cos((kx + kx))), 0.5, (0.5 + (-0.5 * cos((ky + ky)))))));
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if ((sin(kx) ^ 2.0) <= 2e-8) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), fma(kx, Float64(-0.16666666666666666 * Float64(kx * kx)), kx)))); else tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(fma(Float64(1.0 - cos(Float64(kx + kx))), 0.5, Float64(0.5 + Float64(-0.5 * cos(Float64(ky + ky)))))))); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision], 2e-8], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[(kx * N[(-0.16666666666666666 * N[(kx * kx), $MachinePrecision]), $MachinePrecision] + kx), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[(1.0 - N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5 + N[(0.5 + N[(-0.5 * N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\sin kx}^{2} \leq 2 \cdot 10^{-8}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \mathsf{fma}\left(kx, -0.16666666666666666 \cdot \left(kx \cdot kx\right), kx\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{\mathsf{fma}\left(1 - \cos \left(kx + kx\right), 0.5, 0.5 + -0.5 \cdot \cos \left(ky + ky\right)\right)}}\\
\end{array}
\end{array}
if (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) < 2e-8Initial program 89.9%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f64100.0
Applied rewrites100.0%
Taylor expanded in kx around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64100.0
Applied rewrites100.0%
if 2e-8 < (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) Initial program 99.3%
lift-+.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
count-2N/A
cos-diffN/A
cos-sin-sumN/A
lower--.f64N/A
count-2N/A
lower-cos.f64N/A
lower-+.f6499.2
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sqr-sin-aN/A
cancel-sign-sub-invN/A
Applied rewrites99.2%
Final simplification99.6%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 1e-30) (* (* (sin ky) th) (/ 1.0 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)))) <= 1e-30) {
tmp = (sin(ky) * th) * (1.0 / 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)))) <= 1d-30) then
tmp = (sin(ky) * th) * (1.0d0 / 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)))) <= 1e-30) {
tmp = (Math.sin(ky) * th) * (1.0 / 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)))) <= 1e-30: tmp = (math.sin(ky) * th) * (1.0 / 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)))) <= 1e-30) tmp = Float64(Float64(sin(ky) * th) * Float64(1.0 / 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)))) <= 1e-30) tmp = (sin(ky) * th) * (1.0 / 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], 1e-30], N[(N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision] * N[(1.0 / 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 10^{-30}:\\
\;\;\;\;\left(\sin ky \cdot th\right) \cdot \frac{1}{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))))) < 1e-30Initial program 95.9%
Applied rewrites76.5%
Taylor expanded in kx around 0
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6424.4
Applied rewrites24.4%
Taylor expanded in th around 0
Applied rewrites10.1%
Taylor expanded in ky around 0
Applied rewrites14.4%
if 1e-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 92.6%
Taylor expanded in kx around 0
lower-sin.f6459.5
Applied rewrites59.5%
(FPCore (kx ky th)
:precision binary64
(if (<=
(*
(sin th)
(/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))))
4e-307)
(* (* th th) (* th -0.16666666666666666))
(fma th (* -0.16666666666666666 (* th th)) th)))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(th) * (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0))))) <= 4e-307) {
tmp = (th * th) * (th * -0.16666666666666666);
} else {
tmp = fma(th, (-0.16666666666666666 * (th * th)), th);
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(th) * Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0))))) <= 4e-307) tmp = Float64(Float64(th * th) * Float64(th * -0.16666666666666666)); else tmp = fma(th, Float64(-0.16666666666666666 * Float64(th * th)), th); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 4e-307], N[(N[(th * th), $MachinePrecision] * N[(th * -0.16666666666666666), $MachinePrecision]), $MachinePrecision], N[(th * N[(-0.16666666666666666 * N[(th * th), $MachinePrecision]), $MachinePrecision] + th), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin th \cdot \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 4 \cdot 10^{-307}:\\
\;\;\;\;\left(th \cdot th\right) \cdot \left(th \cdot -0.16666666666666666\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(th, -0.16666666666666666 \cdot \left(th \cdot th\right), th\right)\\
\end{array}
\end{array}
if (*.f64 (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) (sin.f64 th)) < 3.99999999999999964e-307Initial program 94.6%
Taylor expanded in kx around 0
lower-sin.f6421.8
Applied rewrites21.8%
Taylor expanded in th around 0
Applied rewrites11.2%
Taylor expanded in th around inf
Applied rewrites17.4%
Applied rewrites17.4%
if 3.99999999999999964e-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 95.1%
Taylor expanded in kx around 0
lower-sin.f6422.0
Applied rewrites22.0%
Taylor expanded in th around 0
Applied rewrites10.9%
Final simplification14.4%
(FPCore (kx ky th)
:precision binary64
(if (<=
(*
(sin th)
(/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))))
4e-307)
(* (* th th) (* th -0.16666666666666666))
(* th (fma th (* th -0.16666666666666666) 1.0))))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(th) * (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0))))) <= 4e-307) {
tmp = (th * th) * (th * -0.16666666666666666);
} else {
tmp = th * fma(th, (th * -0.16666666666666666), 1.0);
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(th) * Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0))))) <= 4e-307) tmp = Float64(Float64(th * th) * Float64(th * -0.16666666666666666)); else tmp = Float64(th * fma(th, Float64(th * -0.16666666666666666), 1.0)); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 4e-307], N[(N[(th * th), $MachinePrecision] * N[(th * -0.16666666666666666), $MachinePrecision]), $MachinePrecision], N[(th * N[(th * N[(th * -0.16666666666666666), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin th \cdot \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 4 \cdot 10^{-307}:\\
\;\;\;\;\left(th \cdot th\right) \cdot \left(th \cdot -0.16666666666666666\right)\\
\mathbf{else}:\\
\;\;\;\;th \cdot \mathsf{fma}\left(th, th \cdot -0.16666666666666666, 1\right)\\
\end{array}
\end{array}
if (*.f64 (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) (sin.f64 th)) < 3.99999999999999964e-307Initial program 94.6%
Taylor expanded in kx around 0
lower-sin.f6421.8
Applied rewrites21.8%
Taylor expanded in th around 0
Applied rewrites11.2%
Taylor expanded in th around inf
Applied rewrites17.4%
Applied rewrites17.4%
if 3.99999999999999964e-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 95.1%
Taylor expanded in kx around 0
lower-sin.f6422.0
Applied rewrites22.0%
Taylor expanded in th around 0
Applied rewrites10.9%
Applied rewrites10.9%
Final simplification14.4%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 1.5e-28) (* -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)))) <= 1.5e-28) {
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)))) <= 1.5d-28) 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)))) <= 1.5e-28) {
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)))) <= 1.5e-28: 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)))) <= 1.5e-28) tmp = Float64(-0.16666666666666666 * Float64(th * Float64(th * th))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 1.5e-28) 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], 1.5e-28], N[(-0.16666666666666666 * N[(th * N[(th * th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 1.5 \cdot 10^{-28}:\\
\;\;\;\;-0.16666666666666666 \cdot \left(th \cdot \left(th \cdot th\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 1.50000000000000001e-28Initial program 95.9%
Taylor expanded in kx around 0
lower-sin.f643.5
Applied rewrites3.5%
Taylor expanded in th around 0
Applied rewrites3.3%
Taylor expanded in th around inf
Applied rewrites14.7%
if 1.50000000000000001e-28 < (/.f64 (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 92.6%
Taylor expanded in kx around 0
lower-sin.f6459.5
Applied rewrites59.5%
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (hypot (sin ky) (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / hypot(sin(ky), sin(kx))) * sin(th);
}
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot \sin th
\end{array}
Initial program 94.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.6
Applied rewrites99.6%
(FPCore (kx ky th)
:precision binary64
(if (<= ky 1.25e-164)
(* (sin th) (/ ky (sin kx)))
(if (<= ky 0.85)
(*
(sin th)
(* (sin ky) (sqrt (/ 1.0 (fma (- 1.0 (cos (+ kx kx))) 0.5 (* ky ky))))))
(* (sin th) (* (sin ky) (sqrt (/ 2.0 (- 1.0 (cos (* ky -2.0))))))))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 1.25e-164) {
tmp = sin(th) * (ky / sin(kx));
} else if (ky <= 0.85) {
tmp = sin(th) * (sin(ky) * sqrt((1.0 / fma((1.0 - cos((kx + kx))), 0.5, (ky * ky)))));
} else {
tmp = sin(th) * (sin(ky) * sqrt((2.0 / (1.0 - cos((ky * -2.0))))));
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (ky <= 1.25e-164) tmp = Float64(sin(th) * Float64(ky / sin(kx))); elseif (ky <= 0.85) tmp = Float64(sin(th) * Float64(sin(ky) * sqrt(Float64(1.0 / fma(Float64(1.0 - cos(Float64(kx + kx))), 0.5, Float64(ky * ky)))))); else tmp = Float64(sin(th) * Float64(sin(ky) * sqrt(Float64(2.0 / Float64(1.0 - cos(Float64(ky * -2.0))))))); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[ky, 1.25e-164], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[ky, 0.85], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] * N[Sqrt[N[(1.0 / N[(N[(1.0 - N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5 + N[(ky * ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] * N[Sqrt[N[(2.0 / N[(1.0 - N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 1.25 \cdot 10^{-164}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{elif}\;ky \leq 0.85:\\
\;\;\;\;\sin th \cdot \left(\sin ky \cdot \sqrt{\frac{1}{\mathsf{fma}\left(1 - \cos \left(kx + kx\right), 0.5, ky \cdot ky\right)}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \left(\sin ky \cdot \sqrt{\frac{2}{1 - \cos \left(ky \cdot -2\right)}}\right)\\
\end{array}
\end{array}
if ky < 1.2499999999999999e-164Initial program 91.8%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-sin.f6432.2
Applied rewrites32.2%
if 1.2499999999999999e-164 < ky < 0.849999999999999978Initial program 99.6%
Applied rewrites65.5%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6490.8
Applied rewrites90.8%
if 0.849999999999999978 < ky Initial program 99.5%
Applied rewrites99.1%
lift-fma.f64N/A
+-commutativeN/A
Applied rewrites99.1%
Taylor expanded in kx around 0
lower-/.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6449.5
Applied rewrites49.5%
Final simplification44.9%
(FPCore (kx ky th) :precision binary64 (* (* th th) (* th -0.16666666666666666)))
double code(double kx, double ky, double th) {
return (th * th) * (th * -0.16666666666666666);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (th * th) * (th * (-0.16666666666666666d0))
end function
public static double code(double kx, double ky, double th) {
return (th * th) * (th * -0.16666666666666666);
}
def code(kx, ky, th): return (th * th) * (th * -0.16666666666666666)
function code(kx, ky, th) return Float64(Float64(th * th) * Float64(th * -0.16666666666666666)) end
function tmp = code(kx, ky, th) tmp = (th * th) * (th * -0.16666666666666666); end
code[kx_, ky_, th_] := N[(N[(th * th), $MachinePrecision] * N[(th * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(th \cdot th\right) \cdot \left(th \cdot -0.16666666666666666\right)
\end{array}
Initial program 94.8%
Taylor expanded in kx around 0
lower-sin.f6421.9
Applied rewrites21.9%
Taylor expanded in th around 0
Applied rewrites11.1%
Taylor expanded in th around inf
Applied rewrites11.0%
Applied rewrites11.0%
(FPCore (kx ky th) :precision binary64 (* -0.16666666666666666 (* th (* th th))))
double code(double kx, double ky, double th) {
return -0.16666666666666666 * (th * (th * th));
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (-0.16666666666666666d0) * (th * (th * th))
end function
public static double code(double kx, double ky, double th) {
return -0.16666666666666666 * (th * (th * th));
}
def code(kx, ky, th): return -0.16666666666666666 * (th * (th * th))
function code(kx, ky, th) return Float64(-0.16666666666666666 * Float64(th * Float64(th * th))) end
function tmp = code(kx, ky, th) tmp = -0.16666666666666666 * (th * (th * th)); end
code[kx_, ky_, th_] := N[(-0.16666666666666666 * N[(th * N[(th * th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-0.16666666666666666 \cdot \left(th \cdot \left(th \cdot th\right)\right)
\end{array}
Initial program 94.8%
Taylor expanded in kx around 0
lower-sin.f6421.9
Applied rewrites21.9%
Taylor expanded in th around 0
Applied rewrites11.1%
Taylor expanded in th around inf
Applied rewrites11.0%
herbie shell --seed 2024221
(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)))