
(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 (* (/ (sin ky) (hypot (sin ky) (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / hypot(sin(ky), sin(kx))) * sin(th);
}
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot \sin th
\end{array}
Initial program 96.2%
lift-sin.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6499.6
Applied egg-rr99.6%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (* (sin th) (/ (sin ky) (hypot (sin ky) kx))))
(t_2 (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 -0.98)
t_1
(if (<= t_5 -0.1)
(/
(* th (fma -0.16666666666666666 (* th th) 1.0))
(/ (sqrt (fma (- 1.0 t_2) 0.5 (+ 0.5 (* -0.5 t_3)))) (sin ky)))
(if (<= t_5 0.2)
(* (sin th) (/ (sin ky) (sqrt (+ t_4 (* ky ky)))))
(if (<= t_5 0.9991156854772065)
(*
(/ (sin ky) (sqrt (fma (- 1.0 t_3) 0.5 (fma t_2 -0.5 0.5))))
(fma th (* -0.16666666666666666 (* th th)) th))
t_1))))))
double code(double kx, double ky, double th) {
double t_1 = sin(th) * (sin(ky) / hypot(sin(ky), kx));
double t_2 = 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 <= -0.98) {
tmp = t_1;
} else if (t_5 <= -0.1) {
tmp = (th * fma(-0.16666666666666666, (th * th), 1.0)) / (sqrt(fma((1.0 - t_2), 0.5, (0.5 + (-0.5 * t_3)))) / sin(ky));
} else if (t_5 <= 0.2) {
tmp = sin(th) * (sin(ky) / sqrt((t_4 + (ky * ky))));
} else if (t_5 <= 0.9991156854772065) {
tmp = (sin(ky) / sqrt(fma((1.0 - t_3), 0.5, fma(t_2, -0.5, 0.5)))) * fma(th, (-0.16666666666666666 * (th * th)), th);
} else {
tmp = t_1;
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), kx))) t_2 = 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 <= -0.98) tmp = t_1; elseif (t_5 <= -0.1) tmp = Float64(Float64(th * fma(-0.16666666666666666, Float64(th * th), 1.0)) / Float64(sqrt(fma(Float64(1.0 - t_2), 0.5, Float64(0.5 + Float64(-0.5 * t_3)))) / sin(ky))); elseif (t_5 <= 0.2) tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(Float64(t_4 + Float64(ky * ky))))); elseif (t_5 <= 0.9991156854772065) tmp = Float64(Float64(sin(ky) / sqrt(fma(Float64(1.0 - t_3), 0.5, fma(t_2, -0.5, 0.5)))) * fma(th, Float64(-0.16666666666666666 * Float64(th * th)), th)); 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 + kx ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Cos[N[(kx + kx), $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, -0.98], t$95$1, If[LessEqual[t$95$5, -0.1], N[(N[(th * N[(-0.16666666666666666 * N[(th * th), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[N[(N[(1.0 - t$95$2), $MachinePrecision] * 0.5 + N[(0.5 + N[(-0.5 * t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$5, 0.2], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$4 + N[(ky * ky), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$5, 0.9991156854772065], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[(1.0 - t$95$3), $MachinePrecision] * 0.5 + N[(t$95$2 * -0.5 + 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(th * N[(-0.16666666666666666 * N[(th * th), $MachinePrecision]), $MachinePrecision] + th), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, kx\right)}\\
t_2 := \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 -0.98:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_5 \leq -0.1:\\
\;\;\;\;\frac{th \cdot \mathsf{fma}\left(-0.16666666666666666, th \cdot th, 1\right)}{\frac{\sqrt{\mathsf{fma}\left(1 - t\_2, 0.5, 0.5 + -0.5 \cdot t\_3\right)}}{\sin ky}}\\
\mathbf{elif}\;t\_5 \leq 0.2:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{t\_4 + ky \cdot ky}}\\
\mathbf{elif}\;t\_5 \leq 0.9991156854772065:\\
\;\;\;\;\frac{\sin ky}{\sqrt{\mathsf{fma}\left(1 - t\_3, 0.5, \mathsf{fma}\left(t\_2, -0.5, 0.5\right)\right)}} \cdot \mathsf{fma}\left(th, -0.16666666666666666 \cdot \left(th \cdot th\right), th\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))))) < -0.97999999999999998 or 0.99911568547720653 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 90.9%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6489.9
Simplified89.9%
lift-*.f64N/A
lift-sin.f64N/A
pow2N/A
+-commutativeN/A
lift-*.f64N/A
lower-hypot.f6499.0
Applied egg-rr99.0%
if -0.97999999999999998 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.10000000000000001Initial program 99.4%
Applied egg-rr99.4%
Taylor expanded in th around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6449.5
Simplified49.5%
if -0.10000000000000001 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.20000000000000001Initial program 99.4%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6495.6
Simplified95.6%
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.99911568547720653Initial program 99.2%
Applied egg-rr99.1%
Applied egg-rr23.2%
lift-+.f64N/A
lift-cos.f64N/A
lift-fma.f6423.2
lift-+.f64N/A
flip-+N/A
lift-*.f64N/A
lift-*.f64N/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
flip-+N/A
lift-+.f6499.2
Applied egg-rr99.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-*.f6440.7
Simplified40.7%
Final simplification84.9%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (* (sin th) (/ (sin ky) (hypot (sin ky) kx))))
(t_2 (cos (+ kx kx)))
(t_3 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))))
(t_4 (cos (+ ky ky))))
(if (<= t_3 -0.98)
t_1
(if (<= t_3 -0.1)
(/
(* th (fma -0.16666666666666666 (* th th) 1.0))
(/ (sqrt (fma (- 1.0 t_2) 0.5 (+ 0.5 (* -0.5 t_4)))) (sin ky)))
(if (<= t_3 0.001)
(*
(sin th)
(/
(* ky (fma (* ky ky) -0.16666666666666666 1.0))
(hypot (sin ky) (sin kx))))
(if (<= t_3 0.9991156854772065)
(*
(/ (sin ky) (sqrt (fma (- 1.0 t_4) 0.5 (fma t_2 -0.5 0.5))))
(fma th (* -0.16666666666666666 (* th th)) th))
t_1))))))
double code(double kx, double ky, double th) {
double t_1 = sin(th) * (sin(ky) / hypot(sin(ky), kx));
double t_2 = cos((kx + kx));
double t_3 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double t_4 = cos((ky + ky));
double tmp;
if (t_3 <= -0.98) {
tmp = t_1;
} else if (t_3 <= -0.1) {
tmp = (th * fma(-0.16666666666666666, (th * th), 1.0)) / (sqrt(fma((1.0 - t_2), 0.5, (0.5 + (-0.5 * t_4)))) / sin(ky));
} else if (t_3 <= 0.001) {
tmp = sin(th) * ((ky * fma((ky * ky), -0.16666666666666666, 1.0)) / hypot(sin(ky), sin(kx)));
} else if (t_3 <= 0.9991156854772065) {
tmp = (sin(ky) / sqrt(fma((1.0 - t_4), 0.5, fma(t_2, -0.5, 0.5)))) * fma(th, (-0.16666666666666666 * (th * th)), th);
} else {
tmp = t_1;
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), kx))) t_2 = cos(Float64(kx + kx)) t_3 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) t_4 = cos(Float64(ky + ky)) tmp = 0.0 if (t_3 <= -0.98) tmp = t_1; elseif (t_3 <= -0.1) tmp = Float64(Float64(th * fma(-0.16666666666666666, Float64(th * th), 1.0)) / Float64(sqrt(fma(Float64(1.0 - t_2), 0.5, Float64(0.5 + Float64(-0.5 * t_4)))) / sin(ky))); elseif (t_3 <= 0.001) tmp = Float64(sin(th) * Float64(Float64(ky * fma(Float64(ky * ky), -0.16666666666666666, 1.0)) / hypot(sin(ky), sin(kx)))); elseif (t_3 <= 0.9991156854772065) tmp = Float64(Float64(sin(ky) / sqrt(fma(Float64(1.0 - t_4), 0.5, fma(t_2, -0.5, 0.5)))) * fma(th, Float64(-0.16666666666666666 * Float64(th * th)), th)); 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 + kx ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$3, -0.98], t$95$1, If[LessEqual[t$95$3, -0.1], N[(N[(th * N[(-0.16666666666666666 * N[(th * th), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[N[(N[(1.0 - t$95$2), $MachinePrecision] * 0.5 + N[(0.5 + N[(-0.5 * t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 0.001], N[(N[Sin[th], $MachinePrecision] * N[(N[(ky * N[(N[(ky * ky), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 0.9991156854772065], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[(1.0 - t$95$4), $MachinePrecision] * 0.5 + N[(t$95$2 * -0.5 + 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(th * N[(-0.16666666666666666 * N[(th * th), $MachinePrecision]), $MachinePrecision] + th), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, kx\right)}\\
t_2 := \cos \left(kx + kx\right)\\
t_3 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
t_4 := \cos \left(ky + ky\right)\\
\mathbf{if}\;t\_3 \leq -0.98:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_3 \leq -0.1:\\
\;\;\;\;\frac{th \cdot \mathsf{fma}\left(-0.16666666666666666, th \cdot th, 1\right)}{\frac{\sqrt{\mathsf{fma}\left(1 - t\_2, 0.5, 0.5 + -0.5 \cdot t\_4\right)}}{\sin ky}}\\
\mathbf{elif}\;t\_3 \leq 0.001:\\
\;\;\;\;\sin th \cdot \frac{ky \cdot \mathsf{fma}\left(ky \cdot ky, -0.16666666666666666, 1\right)}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{elif}\;t\_3 \leq 0.9991156854772065:\\
\;\;\;\;\frac{\sin ky}{\sqrt{\mathsf{fma}\left(1 - t\_4, 0.5, \mathsf{fma}\left(t\_2, -0.5, 0.5\right)\right)}} \cdot \mathsf{fma}\left(th, -0.16666666666666666 \cdot \left(th \cdot th\right), th\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))))) < -0.97999999999999998 or 0.99911568547720653 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 90.9%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6489.9
Simplified89.9%
lift-*.f64N/A
lift-sin.f64N/A
pow2N/A
+-commutativeN/A
lift-*.f64N/A
lower-hypot.f6499.0
Applied egg-rr99.0%
if -0.97999999999999998 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.10000000000000001Initial program 99.4%
Applied egg-rr99.4%
Taylor expanded in th around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6449.5
Simplified49.5%
if -0.10000000000000001 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 1e-3Initial program 99.4%
lift-sin.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6499.5
Applied egg-rr99.5%
Taylor expanded in ky around 0
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6499.5
Simplified99.5%
if 1e-3 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.99911568547720653Initial program 99.2%
Applied egg-rr99.1%
Applied egg-rr22.4%
lift-+.f64N/A
lift-cos.f64N/A
lift-fma.f6422.4
lift-+.f64N/A
flip-+N/A
lift-*.f64N/A
lift-*.f64N/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
flip-+N/A
lift-+.f6499.3
Applied egg-rr99.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-*.f6438.8
Simplified38.8%
Final simplification85.3%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (pow (sin ky) 2.0))
(t_2 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) t_1)))))
(if (<= t_2 -1.0)
(* (* (sin ky) th) (sqrt (/ 1.0 (fma kx kx t_1))))
(if (<= t_2 1e-262)
(* (sin th) (* (sin ky) (sqrt (/ 2.0 (- 1.0 (cos (* kx -2.0)))))))
(if (<= t_2 5e-60)
(/ (* ky (sin th)) (sin kx))
(if (<= t_2 0.0004)
(*
(sin th)
(*
(sqrt (/ 1.0 (fma (- 1.0 (cos (+ kx kx))) 0.5 (* ky ky))))
(fma
ky
(*
(* ky ky)
(fma 0.008333333333333333 (* ky ky) -0.16666666666666666))
ky)))
(sin th)))))))
double code(double kx, double ky, double th) {
double t_1 = pow(sin(ky), 2.0);
double t_2 = sin(ky) / sqrt((pow(sin(kx), 2.0) + t_1));
double tmp;
if (t_2 <= -1.0) {
tmp = (sin(ky) * th) * sqrt((1.0 / fma(kx, kx, t_1)));
} else if (t_2 <= 1e-262) {
tmp = sin(th) * (sin(ky) * sqrt((2.0 / (1.0 - cos((kx * -2.0))))));
} else if (t_2 <= 5e-60) {
tmp = (ky * sin(th)) / sin(kx);
} else if (t_2 <= 0.0004) {
tmp = sin(th) * (sqrt((1.0 / fma((1.0 - cos((kx + kx))), 0.5, (ky * ky)))) * fma(ky, ((ky * ky) * fma(0.008333333333333333, (ky * ky), -0.16666666666666666)), ky));
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = sin(ky) ^ 2.0 t_2 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + t_1))) tmp = 0.0 if (t_2 <= -1.0) tmp = Float64(Float64(sin(ky) * th) * sqrt(Float64(1.0 / fma(kx, kx, t_1)))); elseif (t_2 <= 1e-262) tmp = Float64(sin(th) * Float64(sin(ky) * sqrt(Float64(2.0 / Float64(1.0 - cos(Float64(kx * -2.0))))))); elseif (t_2 <= 5e-60) tmp = Float64(Float64(ky * sin(th)) / sin(kx)); elseif (t_2 <= 0.0004) tmp = Float64(sin(th) * Float64(sqrt(Float64(1.0 / fma(Float64(1.0 - cos(Float64(kx + kx))), 0.5, Float64(ky * ky)))) * fma(ky, Float64(Float64(ky * ky) * fma(0.008333333333333333, Float64(ky * ky), -0.16666666666666666)), ky))); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1.0], N[(N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(kx * kx + t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e-262], 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], If[LessEqual[t$95$2, 5e-60], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.0004], N[(N[Sin[th], $MachinePrecision] * N[(N[Sqrt[N[(1.0 / N[(N[(1.0 - N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5 + N[(ky * ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(ky * N[(N[(ky * ky), $MachinePrecision] * N[(0.008333333333333333 * N[(ky * ky), $MachinePrecision] + -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := {\sin ky}^{2}\\
t_2 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + t\_1}}\\
\mathbf{if}\;t\_2 \leq -1:\\
\;\;\;\;\left(\sin ky \cdot th\right) \cdot \sqrt{\frac{1}{\mathsf{fma}\left(kx, kx, t\_1\right)}}\\
\mathbf{elif}\;t\_2 \leq 10^{-262}:\\
\;\;\;\;\sin th \cdot \left(\sin ky \cdot \sqrt{\frac{2}{1 - \cos \left(kx \cdot -2\right)}}\right)\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{-60}:\\
\;\;\;\;\frac{ky \cdot \sin th}{\sin kx}\\
\mathbf{elif}\;t\_2 \leq 0.0004:\\
\;\;\;\;\sin th \cdot \left(\sqrt{\frac{1}{\mathsf{fma}\left(1 - \cos \left(kx + kx\right), 0.5, ky \cdot ky\right)}} \cdot \mathsf{fma}\left(ky, \left(ky \cdot ky\right) \cdot \mathsf{fma}\left(0.008333333333333333, ky \cdot ky, -0.16666666666666666\right), ky\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -1Initial program 92.3%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6492.3
Simplified92.3%
Taylor expanded in th around 0
lower-*.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
unpow2N/A
lower-fma.f64N/A
lower-pow.f64N/A
lower-sin.f6441.7
Simplified41.7%
if -1 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 1.00000000000000001e-262Initial program 99.5%
Applied egg-rr85.5%
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-*.f6452.7
Simplified52.7%
if 1.00000000000000001e-262 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 5.0000000000000001e-60Initial program 99.4%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f6461.4
Simplified61.4%
if 5.0000000000000001e-60 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 4.00000000000000019e-4Initial program 99.1%
Applied egg-rr77.9%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6479.4
Simplified79.4%
Taylor expanded in ky around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6479.4
Simplified79.4%
if 4.00000000000000019e-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 93.1%
Taylor expanded in kx around 0
lower-sin.f6467.4
Simplified67.4%
Final simplification58.3%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (pow (sin ky) 2.0))
(t_2 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) t_1)))))
(if (<= t_2 -1.0)
(* (* (sin ky) th) (sqrt (/ 1.0 (fma kx kx t_1))))
(if (<= t_2 1e-262)
(* (sin th) (/ (sin ky) (sqrt (fma -0.5 (cos (* kx -2.0)) 0.5))))
(if (<= t_2 5e-60)
(/ (* ky (sin th)) (sin kx))
(if (<= t_2 0.0004)
(*
(sin th)
(*
(sqrt (/ 1.0 (fma (- 1.0 (cos (+ kx kx))) 0.5 (* ky ky))))
(fma
ky
(*
(* ky ky)
(fma 0.008333333333333333 (* ky ky) -0.16666666666666666))
ky)))
(sin th)))))))
double code(double kx, double ky, double th) {
double t_1 = pow(sin(ky), 2.0);
double t_2 = sin(ky) / sqrt((pow(sin(kx), 2.0) + t_1));
double tmp;
if (t_2 <= -1.0) {
tmp = (sin(ky) * th) * sqrt((1.0 / fma(kx, kx, t_1)));
} else if (t_2 <= 1e-262) {
tmp = sin(th) * (sin(ky) / sqrt(fma(-0.5, cos((kx * -2.0)), 0.5)));
} else if (t_2 <= 5e-60) {
tmp = (ky * sin(th)) / sin(kx);
} else if (t_2 <= 0.0004) {
tmp = sin(th) * (sqrt((1.0 / fma((1.0 - cos((kx + kx))), 0.5, (ky * ky)))) * fma(ky, ((ky * ky) * fma(0.008333333333333333, (ky * ky), -0.16666666666666666)), ky));
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = sin(ky) ^ 2.0 t_2 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + t_1))) tmp = 0.0 if (t_2 <= -1.0) tmp = Float64(Float64(sin(ky) * th) * sqrt(Float64(1.0 / fma(kx, kx, t_1)))); elseif (t_2 <= 1e-262) tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(fma(-0.5, cos(Float64(kx * -2.0)), 0.5)))); elseif (t_2 <= 5e-60) tmp = Float64(Float64(ky * sin(th)) / sin(kx)); elseif (t_2 <= 0.0004) tmp = Float64(sin(th) * Float64(sqrt(Float64(1.0 / fma(Float64(1.0 - cos(Float64(kx + kx))), 0.5, Float64(ky * ky)))) * fma(ky, Float64(Float64(ky * ky) * fma(0.008333333333333333, Float64(ky * ky), -0.16666666666666666)), ky))); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1.0], N[(N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(kx * kx + t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e-262], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(-0.5 * N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 5e-60], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.0004], N[(N[Sin[th], $MachinePrecision] * N[(N[Sqrt[N[(1.0 / N[(N[(1.0 - N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5 + N[(ky * ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(ky * N[(N[(ky * ky), $MachinePrecision] * N[(0.008333333333333333 * N[(ky * ky), $MachinePrecision] + -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := {\sin ky}^{2}\\
t_2 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + t\_1}}\\
\mathbf{if}\;t\_2 \leq -1:\\
\;\;\;\;\left(\sin ky \cdot th\right) \cdot \sqrt{\frac{1}{\mathsf{fma}\left(kx, kx, t\_1\right)}}\\
\mathbf{elif}\;t\_2 \leq 10^{-262}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{\mathsf{fma}\left(-0.5, \cos \left(kx \cdot -2\right), 0.5\right)}}\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{-60}:\\
\;\;\;\;\frac{ky \cdot \sin th}{\sin kx}\\
\mathbf{elif}\;t\_2 \leq 0.0004:\\
\;\;\;\;\sin th \cdot \left(\sqrt{\frac{1}{\mathsf{fma}\left(1 - \cos \left(kx + kx\right), 0.5, ky \cdot ky\right)}} \cdot \mathsf{fma}\left(ky, \left(ky \cdot ky\right) \cdot \mathsf{fma}\left(0.008333333333333333, ky \cdot ky, -0.16666666666666666\right), ky\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -1Initial program 92.3%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6492.3
Simplified92.3%
Taylor expanded in th around 0
lower-*.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
unpow2N/A
lower-fma.f64N/A
lower-pow.f64N/A
lower-sin.f6441.7
Simplified41.7%
if -1 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 1.00000000000000001e-262Initial program 99.5%
Applied egg-rr85.5%
Applied egg-rr10.5%
lift-+.f64N/A
lift-cos.f64N/A
lift-fma.f6410.5
lift-+.f64N/A
flip-+N/A
lift-*.f64N/A
lift-*.f64N/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
flip-+N/A
lift-+.f6485.5
Applied egg-rr85.5%
Taylor expanded in ky 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-*.f6452.7
Simplified52.7%
if 1.00000000000000001e-262 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 5.0000000000000001e-60Initial program 99.4%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f6461.4
Simplified61.4%
if 5.0000000000000001e-60 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 4.00000000000000019e-4Initial program 99.1%
Applied egg-rr77.9%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6479.4
Simplified79.4%
Taylor expanded in ky around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6479.4
Simplified79.4%
if 4.00000000000000019e-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 93.1%
Taylor expanded in kx around 0
lower-sin.f6467.4
Simplified67.4%
Final simplification58.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 -1.0)
(/
1.0
(/ (sqrt (fma -0.5 (cos (* ky -2.0)) (fma kx kx 0.5))) (* (sin ky) th)))
(if (<= t_1 1e-262)
(* (sin th) (/ (sin ky) (sqrt (fma -0.5 (cos (* kx -2.0)) 0.5))))
(if (<= t_1 5e-60)
(/ (* ky (sin th)) (sin kx))
(if (<= t_1 0.0004)
(*
(sin th)
(*
(sqrt (/ 1.0 (fma (- 1.0 (cos (+ kx kx))) 0.5 (* ky ky))))
(fma
ky
(*
(* ky ky)
(fma 0.008333333333333333 (* ky ky) -0.16666666666666666))
ky)))
(sin th)))))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double tmp;
if (t_1 <= -1.0) {
tmp = 1.0 / (sqrt(fma(-0.5, cos((ky * -2.0)), fma(kx, kx, 0.5))) / (sin(ky) * th));
} else if (t_1 <= 1e-262) {
tmp = sin(th) * (sin(ky) / sqrt(fma(-0.5, cos((kx * -2.0)), 0.5)));
} else if (t_1 <= 5e-60) {
tmp = (ky * sin(th)) / sin(kx);
} else if (t_1 <= 0.0004) {
tmp = sin(th) * (sqrt((1.0 / fma((1.0 - cos((kx + kx))), 0.5, (ky * ky)))) * fma(ky, ((ky * ky) * fma(0.008333333333333333, (ky * ky), -0.16666666666666666)), ky));
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_1 <= -1.0) tmp = Float64(1.0 / Float64(sqrt(fma(-0.5, cos(Float64(ky * -2.0)), fma(kx, kx, 0.5))) / Float64(sin(ky) * th))); elseif (t_1 <= 1e-262) tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(fma(-0.5, cos(Float64(kx * -2.0)), 0.5)))); elseif (t_1 <= 5e-60) tmp = Float64(Float64(ky * sin(th)) / sin(kx)); elseif (t_1 <= 0.0004) tmp = Float64(sin(th) * Float64(sqrt(Float64(1.0 / fma(Float64(1.0 - cos(Float64(kx + kx))), 0.5, Float64(ky * ky)))) * fma(ky, Float64(Float64(ky * ky) * fma(0.008333333333333333, Float64(ky * ky), -0.16666666666666666)), ky))); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1.0], N[(1.0 / N[(N[Sqrt[N[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + N[(kx * kx + 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e-262], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(-0.5 * N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e-60], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0004], N[(N[Sin[th], $MachinePrecision] * N[(N[Sqrt[N[(1.0 / N[(N[(1.0 - N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5 + N[(ky * ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(ky * N[(N[(ky * ky), $MachinePrecision] * N[(0.008333333333333333 * N[(ky * ky), $MachinePrecision] + -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_1 \leq -1:\\
\;\;\;\;\frac{1}{\frac{\sqrt{\mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), \mathsf{fma}\left(kx, kx, 0.5\right)\right)}}{\sin ky \cdot th}}\\
\mathbf{elif}\;t\_1 \leq 10^{-262}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{\mathsf{fma}\left(-0.5, \cos \left(kx \cdot -2\right), 0.5\right)}}\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{-60}:\\
\;\;\;\;\frac{ky \cdot \sin th}{\sin kx}\\
\mathbf{elif}\;t\_1 \leq 0.0004:\\
\;\;\;\;\sin th \cdot \left(\sqrt{\frac{1}{\mathsf{fma}\left(1 - \cos \left(kx + kx\right), 0.5, ky \cdot ky\right)}} \cdot \mathsf{fma}\left(ky, \left(ky \cdot ky\right) \cdot \mathsf{fma}\left(0.008333333333333333, ky \cdot ky, -0.16666666666666666\right), ky\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -1Initial program 92.3%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6492.3
Simplified92.3%
Applied egg-rr70.4%
Taylor expanded in th around 0
associate-*l/N/A
*-lft-identityN/A
lower-/.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
associate-+l+N/A
lower-fma.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-sin.f6426.9
Simplified26.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))))) < 1.00000000000000001e-262Initial program 99.5%
Applied egg-rr85.5%
Applied egg-rr10.5%
lift-+.f64N/A
lift-cos.f64N/A
lift-fma.f6410.5
lift-+.f64N/A
flip-+N/A
lift-*.f64N/A
lift-*.f64N/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
flip-+N/A
lift-+.f6485.5
Applied egg-rr85.5%
Taylor expanded in ky 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-*.f6452.7
Simplified52.7%
if 1.00000000000000001e-262 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 5.0000000000000001e-60Initial program 99.4%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f6461.4
Simplified61.4%
if 5.0000000000000001e-60 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 4.00000000000000019e-4Initial program 99.1%
Applied egg-rr77.9%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6479.4
Simplified79.4%
Taylor expanded in ky around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6479.4
Simplified79.4%
if 4.00000000000000019e-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 93.1%
Taylor expanded in kx around 0
lower-sin.f6467.4
Simplified67.4%
Final simplification56.1%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (* ky (sin th)))
(t_2 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
(if (<= t_2 -0.42)
(/
1.0
(/ (sqrt (fma -0.5 (cos (* ky -2.0)) (fma kx kx 0.5))) (* (sin ky) th)))
(if (<= t_2 5e-60)
(/ t_1 (sin kx))
(if (<= t_2 0.0004)
(* t_1 (sqrt (/ 1.0 (fma -0.5 (cos (* kx -2.0)) 0.5))))
(sin th))))))
double code(double kx, double ky, double th) {
double t_1 = ky * sin(th);
double t_2 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double tmp;
if (t_2 <= -0.42) {
tmp = 1.0 / (sqrt(fma(-0.5, cos((ky * -2.0)), fma(kx, kx, 0.5))) / (sin(ky) * th));
} else if (t_2 <= 5e-60) {
tmp = t_1 / sin(kx);
} else if (t_2 <= 0.0004) {
tmp = t_1 * sqrt((1.0 / fma(-0.5, cos((kx * -2.0)), 0.5)));
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(ky * sin(th)) t_2 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_2 <= -0.42) tmp = Float64(1.0 / Float64(sqrt(fma(-0.5, cos(Float64(ky * -2.0)), fma(kx, kx, 0.5))) / Float64(sin(ky) * th))); elseif (t_2 <= 5e-60) tmp = Float64(t_1 / sin(kx)); elseif (t_2 <= 0.0004) tmp = Float64(t_1 * sqrt(Float64(1.0 / fma(-0.5, cos(Float64(kx * -2.0)), 0.5)))); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -0.42], N[(1.0 / N[(N[Sqrt[N[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + N[(kx * kx + 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 5e-60], N[(t$95$1 / N[Sin[kx], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.0004], N[(t$95$1 * N[Sqrt[N[(1.0 / N[(-0.5 * N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := ky \cdot \sin th\\
t_2 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_2 \leq -0.42:\\
\;\;\;\;\frac{1}{\frac{\sqrt{\mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), \mathsf{fma}\left(kx, kx, 0.5\right)\right)}}{\sin ky \cdot th}}\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{-60}:\\
\;\;\;\;\frac{t\_1}{\sin kx}\\
\mathbf{elif}\;t\_2 \leq 0.0004:\\
\;\;\;\;t\_1 \cdot \sqrt{\frac{1}{\mathsf{fma}\left(-0.5, \cos \left(kx \cdot -2\right), 0.5\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.419999999999999984Initial program 95.5%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6455.0
Simplified55.0%
Applied egg-rr43.0%
Taylor expanded in th around 0
associate-*l/N/A
*-lft-identityN/A
lower-/.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
associate-+l+N/A
lower-fma.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-sin.f6417.0
Simplified17.0%
if -0.419999999999999984 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 5.0000000000000001e-60Initial program 99.5%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f6459.4
Simplified59.4%
if 5.0000000000000001e-60 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 4.00000000000000019e-4Initial program 99.1%
Applied egg-rr77.9%
Applied egg-rr2.6%
lift-+.f64N/A
lift-cos.f64N/A
lift-fma.f642.6
lift-+.f64N/A
flip-+N/A
lift-*.f64N/A
lift-*.f64N/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
flip-+N/A
lift-+.f6477.4
Applied egg-rr77.4%
Taylor expanded in ky around 0
lower-*.f64N/A
lower-*.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-*.f6478.2
Simplified78.2%
if 4.00000000000000019e-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 93.1%
Taylor expanded in kx around 0
lower-sin.f6467.4
Simplified67.4%
Final simplification51.4%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (* ky (sin th)))
(t_2 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
(if (<= t_2 -0.42)
(*
(* (sin ky) th)
(sqrt (/ 1.0 (fma -0.5 (cos (* ky -2.0)) (fma kx kx 0.5)))))
(if (<= t_2 5e-60)
(/ t_1 (sin kx))
(if (<= t_2 0.0004)
(* t_1 (sqrt (/ 1.0 (fma -0.5 (cos (* kx -2.0)) 0.5))))
(sin th))))))
double code(double kx, double ky, double th) {
double t_1 = ky * sin(th);
double t_2 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double tmp;
if (t_2 <= -0.42) {
tmp = (sin(ky) * th) * sqrt((1.0 / fma(-0.5, cos((ky * -2.0)), fma(kx, kx, 0.5))));
} else if (t_2 <= 5e-60) {
tmp = t_1 / sin(kx);
} else if (t_2 <= 0.0004) {
tmp = t_1 * sqrt((1.0 / fma(-0.5, cos((kx * -2.0)), 0.5)));
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(ky * sin(th)) t_2 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_2 <= -0.42) tmp = Float64(Float64(sin(ky) * th) * sqrt(Float64(1.0 / fma(-0.5, cos(Float64(ky * -2.0)), fma(kx, kx, 0.5))))); elseif (t_2 <= 5e-60) tmp = Float64(t_1 / sin(kx)); elseif (t_2 <= 0.0004) tmp = Float64(t_1 * sqrt(Float64(1.0 / fma(-0.5, cos(Float64(kx * -2.0)), 0.5)))); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -0.42], N[(N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + N[(kx * kx + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 5e-60], N[(t$95$1 / N[Sin[kx], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.0004], N[(t$95$1 * N[Sqrt[N[(1.0 / N[(-0.5 * N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := ky \cdot \sin th\\
t_2 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_2 \leq -0.42:\\
\;\;\;\;\left(\sin ky \cdot th\right) \cdot \sqrt{\frac{1}{\mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), \mathsf{fma}\left(kx, kx, 0.5\right)\right)}}\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{-60}:\\
\;\;\;\;\frac{t\_1}{\sin kx}\\
\mathbf{elif}\;t\_2 \leq 0.0004:\\
\;\;\;\;t\_1 \cdot \sqrt{\frac{1}{\mathsf{fma}\left(-0.5, \cos \left(kx \cdot -2\right), 0.5\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.419999999999999984Initial program 95.5%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6455.0
Simplified55.0%
Applied egg-rr43.0%
Taylor expanded in th around 0
lower-*.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
associate-+l+N/A
lower-fma.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-fma.f6417.0
Simplified17.0%
if -0.419999999999999984 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 5.0000000000000001e-60Initial program 99.5%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f6459.4
Simplified59.4%
if 5.0000000000000001e-60 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 4.00000000000000019e-4Initial program 99.1%
Applied egg-rr77.9%
Applied egg-rr2.6%
lift-+.f64N/A
lift-cos.f64N/A
lift-fma.f642.6
lift-+.f64N/A
flip-+N/A
lift-*.f64N/A
lift-*.f64N/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
flip-+N/A
lift-+.f6477.4
Applied egg-rr77.4%
Taylor expanded in ky around 0
lower-*.f64N/A
lower-*.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-*.f6478.2
Simplified78.2%
if 4.00000000000000019e-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 93.1%
Taylor expanded in kx around 0
lower-sin.f6467.4
Simplified67.4%
Final simplification51.4%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (* ky (sin th)))
(t_2 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
(if (<= t_2 5e-60)
(/ t_1 (sin kx))
(if (<= t_2 0.0004)
(* t_1 (sqrt (/ 1.0 (fma -0.5 (cos (* kx -2.0)) 0.5))))
(sin th)))))
double code(double kx, double ky, double th) {
double t_1 = ky * sin(th);
double t_2 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double tmp;
if (t_2 <= 5e-60) {
tmp = t_1 / sin(kx);
} else if (t_2 <= 0.0004) {
tmp = t_1 * sqrt((1.0 / fma(-0.5, cos((kx * -2.0)), 0.5)));
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(ky * sin(th)) t_2 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_2 <= 5e-60) tmp = Float64(t_1 / sin(kx)); elseif (t_2 <= 0.0004) tmp = Float64(t_1 * sqrt(Float64(1.0 / fma(-0.5, cos(Float64(kx * -2.0)), 0.5)))); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, 5e-60], N[(t$95$1 / N[Sin[kx], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.0004], N[(t$95$1 * N[Sqrt[N[(1.0 / N[(-0.5 * N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := ky \cdot \sin th\\
t_2 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_2 \leq 5 \cdot 10^{-60}:\\
\;\;\;\;\frac{t\_1}{\sin kx}\\
\mathbf{elif}\;t\_2 \leq 0.0004:\\
\;\;\;\;t\_1 \cdot \sqrt{\frac{1}{\mathsf{fma}\left(-0.5, \cos \left(kx \cdot -2\right), 0.5\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))))) < 5.0000000000000001e-60Initial program 97.7%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f6435.5
Simplified35.5%
if 5.0000000000000001e-60 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 4.00000000000000019e-4Initial program 99.1%
Applied egg-rr77.9%
Applied egg-rr2.6%
lift-+.f64N/A
lift-cos.f64N/A
lift-fma.f642.6
lift-+.f64N/A
flip-+N/A
lift-*.f64N/A
lift-*.f64N/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
flip-+N/A
lift-+.f6477.4
Applied egg-rr77.4%
Taylor expanded in ky around 0
lower-*.f64N/A
lower-*.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-*.f6478.2
Simplified78.2%
if 4.00000000000000019e-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 93.1%
Taylor expanded in kx around 0
lower-sin.f6467.4
Simplified67.4%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))))
(t_2 (* ky (sqrt 2.0))))
(if (<= t_1 5e-60)
(*
(sin th)
(*
(sqrt
(/
1.0
(*
(* kx kx)
(fma
(* kx kx)
(fma (* kx kx) 0.08888888888888889 -0.6666666666666666)
2.0))))
t_2))
(if (<= t_1 2e-10)
(* t_2 (* th (sqrt (/ 1.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 t_2 = ky * sqrt(2.0);
double tmp;
if (t_1 <= 5e-60) {
tmp = sin(th) * (sqrt((1.0 / ((kx * kx) * fma((kx * kx), fma((kx * kx), 0.08888888888888889, -0.6666666666666666), 2.0)))) * t_2);
} else if (t_1 <= 2e-10) {
tmp = t_2 * (th * sqrt((1.0 / (1.0 - cos((kx * -2.0))))));
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) t_2 = Float64(ky * sqrt(2.0)) tmp = 0.0 if (t_1 <= 5e-60) tmp = Float64(sin(th) * Float64(sqrt(Float64(1.0 / Float64(Float64(kx * kx) * fma(Float64(kx * kx), fma(Float64(kx * kx), 0.08888888888888889, -0.6666666666666666), 2.0)))) * t_2)); elseif (t_1 <= 2e-10) tmp = Float64(t_2 * Float64(th * sqrt(Float64(1.0 / Float64(1.0 - cos(Float64(kx * -2.0))))))); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(ky * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 5e-60], N[(N[Sin[th], $MachinePrecision] * N[(N[Sqrt[N[(1.0 / N[(N[(kx * kx), $MachinePrecision] * N[(N[(kx * kx), $MachinePrecision] * N[(N[(kx * kx), $MachinePrecision] * 0.08888888888888889 + -0.6666666666666666), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e-10], N[(t$95$2 * N[(th * N[Sqrt[N[(1.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}}}\\
t_2 := ky \cdot \sqrt{2}\\
\mathbf{if}\;t\_1 \leq 5 \cdot 10^{-60}:\\
\;\;\;\;\sin th \cdot \left(\sqrt{\frac{1}{\left(kx \cdot kx\right) \cdot \mathsf{fma}\left(kx \cdot kx, \mathsf{fma}\left(kx \cdot kx, 0.08888888888888889, -0.6666666666666666\right), 2\right)}} \cdot t\_2\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-10}:\\
\;\;\;\;t\_2 \cdot \left(th \cdot \sqrt{\frac{1}{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))))) < 5.0000000000000001e-60Initial program 97.7%
Applied egg-rr76.8%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f6438.9
Simplified38.9%
Taylor expanded in kx around 0
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6428.9
Simplified28.9%
if 5.0000000000000001e-60 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2.00000000000000007e-10Initial program 99.1%
Applied egg-rr77.9%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f6477.6
Simplified77.6%
lift-*.f64N/A
lift-cos.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied egg-rr78.1%
Taylor expanded in th around 0
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
cos-negN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6446.1
Simplified46.1%
if 2.00000000000000007e-10 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 93.1%
Taylor expanded in kx around 0
lower-sin.f6467.4
Simplified67.4%
Final simplification42.9%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (* ky (sqrt 2.0)))
(t_2 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
(if (<= t_2 5e-60)
(* (sin th) (* t_1 (sqrt (/ 0.5 (* kx kx)))))
(if (<= t_2 2e-10)
(* t_1 (* th (sqrt (/ 1.0 (- 1.0 (cos (* kx -2.0)))))))
(sin th)))))
double code(double kx, double ky, double th) {
double t_1 = ky * sqrt(2.0);
double t_2 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double tmp;
if (t_2 <= 5e-60) {
tmp = sin(th) * (t_1 * sqrt((0.5 / (kx * kx))));
} else if (t_2 <= 2e-10) {
tmp = t_1 * (th * sqrt((1.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) :: t_2
real(8) :: tmp
t_1 = ky * sqrt(2.0d0)
t_2 = sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))
if (t_2 <= 5d-60) then
tmp = sin(th) * (t_1 * sqrt((0.5d0 / (kx * kx))))
else if (t_2 <= 2d-10) then
tmp = t_1 * (th * sqrt((1.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 = ky * Math.sqrt(2.0);
double t_2 = Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)));
double tmp;
if (t_2 <= 5e-60) {
tmp = Math.sin(th) * (t_1 * Math.sqrt((0.5 / (kx * kx))));
} else if (t_2 <= 2e-10) {
tmp = t_1 * (th * Math.sqrt((1.0 / (1.0 - Math.cos((kx * -2.0))))));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = ky * math.sqrt(2.0) t_2 = math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0))) tmp = 0 if t_2 <= 5e-60: tmp = math.sin(th) * (t_1 * math.sqrt((0.5 / (kx * kx)))) elif t_2 <= 2e-10: tmp = t_1 * (th * math.sqrt((1.0 / (1.0 - math.cos((kx * -2.0)))))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = Float64(ky * sqrt(2.0)) t_2 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_2 <= 5e-60) tmp = Float64(sin(th) * Float64(t_1 * sqrt(Float64(0.5 / Float64(kx * kx))))); elseif (t_2 <= 2e-10) tmp = Float64(t_1 * Float64(th * sqrt(Float64(1.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 = ky * sqrt(2.0); t_2 = sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0))); tmp = 0.0; if (t_2 <= 5e-60) tmp = sin(th) * (t_1 * sqrt((0.5 / (kx * kx)))); elseif (t_2 <= 2e-10) tmp = t_1 * (th * sqrt((1.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[(ky * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, 5e-60], N[(N[Sin[th], $MachinePrecision] * N[(t$95$1 * N[Sqrt[N[(0.5 / N[(kx * kx), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e-10], N[(t$95$1 * N[(th * N[Sqrt[N[(1.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 := ky \cdot \sqrt{2}\\
t_2 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_2 \leq 5 \cdot 10^{-60}:\\
\;\;\;\;\sin th \cdot \left(t\_1 \cdot \sqrt{\frac{0.5}{kx \cdot kx}}\right)\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{-10}:\\
\;\;\;\;t\_1 \cdot \left(th \cdot \sqrt{\frac{1}{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))))) < 5.0000000000000001e-60Initial program 97.7%
Applied egg-rr76.8%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f6438.9
Simplified38.9%
Taylor expanded in kx around 0
lower-/.f64N/A
unpow2N/A
lower-*.f6428.8
Simplified28.8%
if 5.0000000000000001e-60 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2.00000000000000007e-10Initial program 99.1%
Applied egg-rr77.9%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f6477.6
Simplified77.6%
lift-*.f64N/A
lift-cos.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied egg-rr78.1%
Taylor expanded in th around 0
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
cos-negN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6446.1
Simplified46.1%
if 2.00000000000000007e-10 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 93.1%
Taylor expanded in kx around 0
lower-sin.f6467.4
Simplified67.4%
Final simplification42.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 5e-60)
(* (sin th) (* (* ky (sqrt 2.0)) (sqrt (/ 0.5 (* kx kx)))))
(if (<= t_1 2e-10)
(* (sqrt (/ 1.0 (- 1.0 (cos (* kx -2.0))))) (* ky (* th (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 <= 5e-60) {
tmp = sin(th) * ((ky * sqrt(2.0)) * sqrt((0.5 / (kx * kx))));
} else if (t_1 <= 2e-10) {
tmp = sqrt((1.0 / (1.0 - cos((kx * -2.0))))) * (ky * (th * sqrt(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 <= 5d-60) then
tmp = sin(th) * ((ky * sqrt(2.0d0)) * sqrt((0.5d0 / (kx * kx))))
else if (t_1 <= 2d-10) then
tmp = sqrt((1.0d0 / (1.0d0 - cos((kx * (-2.0d0)))))) * (ky * (th * sqrt(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 <= 5e-60) {
tmp = Math.sin(th) * ((ky * Math.sqrt(2.0)) * Math.sqrt((0.5 / (kx * kx))));
} else if (t_1 <= 2e-10) {
tmp = Math.sqrt((1.0 / (1.0 - Math.cos((kx * -2.0))))) * (ky * (th * Math.sqrt(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 <= 5e-60: tmp = math.sin(th) * ((ky * math.sqrt(2.0)) * math.sqrt((0.5 / (kx * kx)))) elif t_1 <= 2e-10: tmp = math.sqrt((1.0 / (1.0 - math.cos((kx * -2.0))))) * (ky * (th * math.sqrt(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 <= 5e-60) tmp = Float64(sin(th) * Float64(Float64(ky * sqrt(2.0)) * sqrt(Float64(0.5 / Float64(kx * kx))))); elseif (t_1 <= 2e-10) tmp = Float64(sqrt(Float64(1.0 / Float64(1.0 - cos(Float64(kx * -2.0))))) * Float64(ky * Float64(th * sqrt(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 <= 5e-60) tmp = sin(th) * ((ky * sqrt(2.0)) * sqrt((0.5 / (kx * kx)))); elseif (t_1 <= 2e-10) tmp = sqrt((1.0 / (1.0 - cos((kx * -2.0))))) * (ky * (th * sqrt(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, 5e-60], N[(N[Sin[th], $MachinePrecision] * N[(N[(ky * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(0.5 / N[(kx * kx), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e-10], N[(N[Sqrt[N[(1.0 / N[(1.0 - N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(ky * N[(th * 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 5 \cdot 10^{-60}:\\
\;\;\;\;\sin th \cdot \left(\left(ky \cdot \sqrt{2}\right) \cdot \sqrt{\frac{0.5}{kx \cdot kx}}\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-10}:\\
\;\;\;\;\sqrt{\frac{1}{1 - \cos \left(kx \cdot -2\right)}} \cdot \left(ky \cdot \left(th \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))))) < 5.0000000000000001e-60Initial program 97.7%
Applied egg-rr76.8%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f6438.9
Simplified38.9%
Taylor expanded in kx around 0
lower-/.f64N/A
unpow2N/A
lower-*.f6428.8
Simplified28.8%
if 5.0000000000000001e-60 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2.00000000000000007e-10Initial program 99.1%
Applied egg-rr77.9%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f6477.6
Simplified77.6%
Taylor expanded in th around 0
*-commutativeN/A
cos-negN/A
distribute-lft-neg-inN/A
metadata-evalN/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
Simplified45.9%
if 2.00000000000000007e-10 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 93.1%
Taylor expanded in kx around 0
lower-sin.f6467.4
Simplified67.4%
Final simplification42.8%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (pow (sin kx) 2.0)))
(if (<= t_1 0.0)
(sin th)
(if (<= t_1 1e-9)
(/
(sin th)
(/ (sqrt (fma kx kx (fma (cos (+ ky ky)) -0.5 0.5))) (sin ky)))
(* (sin th) (* (sin ky) (sqrt (/ 2.0 (- 1.0 (cos (* kx -2.0)))))))))))
double code(double kx, double ky, double th) {
double t_1 = pow(sin(kx), 2.0);
double tmp;
if (t_1 <= 0.0) {
tmp = sin(th);
} else if (t_1 <= 1e-9) {
tmp = sin(th) / (sqrt(fma(kx, kx, fma(cos((ky + ky)), -0.5, 0.5))) / sin(ky));
} else {
tmp = sin(th) * (sin(ky) * sqrt((2.0 / (1.0 - cos((kx * -2.0))))));
}
return tmp;
}
function code(kx, ky, th) t_1 = sin(kx) ^ 2.0 tmp = 0.0 if (t_1 <= 0.0) tmp = sin(th); elseif (t_1 <= 1e-9) tmp = Float64(sin(th) / Float64(sqrt(fma(kx, kx, fma(cos(Float64(ky + ky)), -0.5, 0.5))) / sin(ky))); else tmp = Float64(sin(th) * Float64(sin(ky) * sqrt(Float64(2.0 / Float64(1.0 - cos(Float64(kx * -2.0))))))); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[t$95$1, 0.0], N[Sin[th], $MachinePrecision], If[LessEqual[t$95$1, 1e-9], N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[N[(kx * kx + N[(N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision] * -0.5 + 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := {\sin kx}^{2}\\
\mathbf{if}\;t\_1 \leq 0:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;t\_1 \leq 10^{-9}:\\
\;\;\;\;\frac{\sin th}{\frac{\sqrt{\mathsf{fma}\left(kx, kx, \mathsf{fma}\left(\cos \left(ky + ky\right), -0.5, 0.5\right)\right)}}{\sin ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \left(\sin ky \cdot \sqrt{\frac{2}{1 - \cos \left(kx \cdot -2\right)}}\right)\\
\end{array}
\end{array}
if (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) < 0.0Initial program 78.0%
Taylor expanded in kx around 0
lower-sin.f6456.7
Simplified56.7%
if 0.0 < (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) < 1.00000000000000006e-9Initial program 99.8%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6499.8
Simplified99.8%
Applied egg-rr91.6%
if 1.00000000000000006e-9 < (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) Initial program 99.4%
Applied egg-rr99.0%
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.5
Simplified59.5%
Final simplification69.6%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (pow (sin kx) 2.0)))
(if (<= t_1 0.0)
(sin th)
(if (<= t_1 1e-9)
(*
(sin ky)
(/ (sin th) (sqrt (fma kx kx (fma (cos (+ ky ky)) -0.5 0.5)))))
(* (sin th) (* (sin ky) (sqrt (/ 2.0 (- 1.0 (cos (* kx -2.0)))))))))))
double code(double kx, double ky, double th) {
double t_1 = pow(sin(kx), 2.0);
double tmp;
if (t_1 <= 0.0) {
tmp = sin(th);
} else if (t_1 <= 1e-9) {
tmp = sin(ky) * (sin(th) / sqrt(fma(kx, kx, fma(cos((ky + ky)), -0.5, 0.5))));
} else {
tmp = sin(th) * (sin(ky) * sqrt((2.0 / (1.0 - cos((kx * -2.0))))));
}
return tmp;
}
function code(kx, ky, th) t_1 = sin(kx) ^ 2.0 tmp = 0.0 if (t_1 <= 0.0) tmp = sin(th); elseif (t_1 <= 1e-9) tmp = Float64(sin(ky) * Float64(sin(th) / sqrt(fma(kx, kx, fma(cos(Float64(ky + ky)), -0.5, 0.5))))); else tmp = Float64(sin(th) * Float64(sin(ky) * sqrt(Float64(2.0 / Float64(1.0 - cos(Float64(kx * -2.0))))))); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[t$95$1, 0.0], N[Sin[th], $MachinePrecision], If[LessEqual[t$95$1, 1e-9], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[(kx * kx + N[(N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision] * -0.5 + 0.5), $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[(kx * -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := {\sin kx}^{2}\\
\mathbf{if}\;t\_1 \leq 0:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;t\_1 \leq 10^{-9}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sqrt{\mathsf{fma}\left(kx, kx, \mathsf{fma}\left(\cos \left(ky + ky\right), -0.5, 0.5\right)\right)}}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \left(\sin ky \cdot \sqrt{\frac{2}{1 - \cos \left(kx \cdot -2\right)}}\right)\\
\end{array}
\end{array}
if (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) < 0.0Initial program 78.0%
Taylor expanded in kx around 0
lower-sin.f6456.7
Simplified56.7%
if 0.0 < (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) < 1.00000000000000006e-9Initial program 99.8%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6499.8
Simplified99.8%
Applied egg-rr91.5%
if 1.00000000000000006e-9 < (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) Initial program 99.4%
Applied egg-rr99.0%
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.5
Simplified59.5%
Final simplification69.6%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 0.001) (* 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.001) {
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.001d0) 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.001) {
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.001: 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.001) tmp = Float64(ky * Float64(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.001) 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.001], N[(ky * N[(N[Sin[th], $MachinePrecision] / 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.001:\\
\;\;\;\;ky \cdot \frac{\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))))) < 1e-3Initial program 97.8%
Taylor expanded in ky around 0
lower-*.f64N/A
distribute-lft-inN/A
*-commutativeN/A
associate-+r+N/A
+-commutativeN/A
Simplified33.2%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-sin.f64N/A
lower-sin.f6435.5
Simplified35.5%
if 1e-3 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 93.1%
Taylor expanded in kx around 0
lower-sin.f6467.4
Simplified67.4%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 0.001) (* (sin th) (* (* ky (sqrt 2.0)) (sqrt (/ 0.5 (* kx 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.001) {
tmp = sin(th) * ((ky * sqrt(2.0)) * sqrt((0.5 / (kx * 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.001d0) then
tmp = sin(th) * ((ky * sqrt(2.0d0)) * sqrt((0.5d0 / (kx * 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.001) {
tmp = Math.sin(th) * ((ky * Math.sqrt(2.0)) * Math.sqrt((0.5 / (kx * 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.001: tmp = math.sin(th) * ((ky * math.sqrt(2.0)) * math.sqrt((0.5 / (kx * 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.001) tmp = Float64(sin(th) * Float64(Float64(ky * sqrt(2.0)) * sqrt(Float64(0.5 / Float64(kx * 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.001) tmp = sin(th) * ((ky * sqrt(2.0)) * sqrt((0.5 / (kx * 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.001], N[(N[Sin[th], $MachinePrecision] * N[(N[(ky * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(0.5 / N[(kx * kx), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 0.001:\\
\;\;\;\;\sin th \cdot \left(\left(ky \cdot \sqrt{2}\right) \cdot \sqrt{\frac{0.5}{kx \cdot kx}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 1e-3Initial program 97.8%
Applied egg-rr76.9%
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.f6441.0
Simplified41.0%
Taylor expanded in kx around 0
lower-/.f64N/A
unpow2N/A
lower-*.f6428.6
Simplified28.6%
if 1e-3 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 93.1%
Taylor expanded in kx around 0
lower-sin.f6467.4
Simplified67.4%
Final simplification42.1%
(FPCore (kx ky th)
:precision binary64
(if (<= (pow (sin kx) 2.0) 1e-24)
(* (sin th) (/ (sin ky) (hypot (sin ky) kx)))
(/
(sin th)
(/
(sqrt (fma (- 1.0 (cos (+ kx kx))) 0.5 (+ 0.5 (* -0.5 (cos (+ ky ky))))))
(sin ky)))))
double code(double kx, double ky, double th) {
double tmp;
if (pow(sin(kx), 2.0) <= 1e-24) {
tmp = sin(th) * (sin(ky) / hypot(sin(ky), kx));
} else {
tmp = sin(th) / (sqrt(fma((1.0 - cos((kx + kx))), 0.5, (0.5 + (-0.5 * cos((ky + ky)))))) / sin(ky));
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if ((sin(kx) ^ 2.0) <= 1e-24) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), kx))); else tmp = Float64(sin(th) / Float64(sqrt(fma(Float64(1.0 - cos(Float64(kx + kx))), 0.5, Float64(0.5 + Float64(-0.5 * cos(Float64(ky + ky)))))) / sin(ky))); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision], 1e-24], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[N[(N[(1.0 - N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5 + N[(0.5 + N[(-0.5 * N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\sin kx}^{2} \leq 10^{-24}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th}{\frac{\sqrt{\mathsf{fma}\left(1 - \cos \left(kx + kx\right), 0.5, 0.5 + -0.5 \cdot \cos \left(ky + ky\right)\right)}}{\sin ky}}\\
\end{array}
\end{array}
if (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) < 9.99999999999999924e-25Initial program 92.7%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6492.7
Simplified92.7%
lift-*.f64N/A
lift-sin.f64N/A
pow2N/A
+-commutativeN/A
lift-*.f64N/A
lower-hypot.f6499.8
Applied egg-rr99.8%
if 9.99999999999999924e-25 < (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) Initial program 99.4%
Applied egg-rr99.1%
Final simplification99.5%
(FPCore (kx ky th)
:precision binary64
(if (<= (pow (sin kx) 2.0) 1e-24)
(* (sin th) (/ (sin ky) (hypot (sin ky) kx)))
(*
(sin th)
(/
(sin ky)
(sqrt
(fma (- 1.0 (cos (+ ky ky))) 0.5 (fma (cos (+ kx kx)) -0.5 0.5)))))))
double code(double kx, double ky, double th) {
double tmp;
if (pow(sin(kx), 2.0) <= 1e-24) {
tmp = sin(th) * (sin(ky) / hypot(sin(ky), kx));
} else {
tmp = sin(th) * (sin(ky) / sqrt(fma((1.0 - cos((ky + ky))), 0.5, fma(cos((kx + kx)), -0.5, 0.5))));
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if ((sin(kx) ^ 2.0) <= 1e-24) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), kx))); else tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(fma(Float64(1.0 - cos(Float64(ky + ky))), 0.5, fma(cos(Float64(kx + kx)), -0.5, 0.5))))); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision], 1e-24], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[(1.0 - N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5 + N[(N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision] * -0.5 + 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\sin kx}^{2} \leq 10^{-24}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{\mathsf{fma}\left(1 - \cos \left(ky + ky\right), 0.5, \mathsf{fma}\left(\cos \left(kx + kx\right), -0.5, 0.5\right)\right)}}\\
\end{array}
\end{array}
if (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) < 9.99999999999999924e-25Initial program 92.7%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6492.7
Simplified92.7%
lift-*.f64N/A
lift-sin.f64N/A
pow2N/A
+-commutativeN/A
lift-*.f64N/A
lower-hypot.f6499.8
Applied egg-rr99.8%
if 9.99999999999999924e-25 < (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) Initial program 99.4%
Applied egg-rr99.1%
Applied egg-rr12.3%
lift-+.f64N/A
lift-cos.f64N/A
lift-fma.f6412.3
lift-+.f64N/A
flip-+N/A
lift-*.f64N/A
lift-*.f64N/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
flip-+N/A
lift-+.f6499.1
Applied egg-rr99.1%
Final simplification99.4%
(FPCore (kx ky th)
:precision binary64
(if (<=
(*
(sin th)
(/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))))
4e-305)
(* -0.16666666666666666 (* th (* 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-305) {
tmp = -0.16666666666666666 * (th * (th * th));
} else {
tmp = 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(th) * (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0))))) <= 4d-305) then
tmp = (-0.16666666666666666d0) * (th * (th * th))
else
tmp = th
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if ((Math.sin(th) * (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0))))) <= 4e-305) {
tmp = -0.16666666666666666 * (th * (th * th));
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (math.sin(th) * (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0))))) <= 4e-305: tmp = -0.16666666666666666 * (th * (th * th)) else: tmp = 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-305) tmp = Float64(-0.16666666666666666 * Float64(th * Float64(th * th))); else tmp = th; end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((sin(th) * (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0))))) <= 4e-305) tmp = -0.16666666666666666 * (th * (th * th)); else tmp = th; end tmp_2 = 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-305], N[(-0.16666666666666666 * N[(th * N[(th * th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], th]
\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^{-305}:\\
\;\;\;\;-0.16666666666666666 \cdot \left(th \cdot \left(th \cdot th\right)\right)\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if (*.f64 (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) (sin.f64 th)) < 3.99999999999999999e-305Initial program 96.7%
Taylor expanded in kx around 0
lower-sin.f6423.4
Simplified23.4%
Taylor expanded in th around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6413.8
Simplified13.8%
Taylor expanded in th around inf
lower-*.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6418.7
Simplified18.7%
if 3.99999999999999999e-305 < (*.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.5%
Taylor expanded in kx around 0
lower-sin.f6428.9
Simplified28.9%
Taylor expanded in th around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6415.7
Simplified15.7%
Taylor expanded in th around 0
Simplified16.7%
*-rgt-identity16.7
Applied egg-rr16.7%
Final simplification17.8%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 0.001) (/ (* ky (sin th)) 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.001) {
tmp = (ky * sin(th)) / 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.001d0) then
tmp = (ky * sin(th)) / 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.001) {
tmp = (ky * Math.sin(th)) / 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.001: tmp = (ky * math.sin(th)) / 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.001) tmp = Float64(Float64(ky * sin(th)) / 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.001) tmp = (ky * sin(th)) / 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.001], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] / kx), $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.001:\\
\;\;\;\;\frac{ky \cdot \sin th}{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))))) < 1e-3Initial program 97.8%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6450.3
Simplified50.3%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f6424.0
Simplified24.0%
if 1e-3 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 93.1%
Taylor expanded in kx around 0
lower-sin.f6467.4
Simplified67.4%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 0.001) (* (sin th) (/ ky kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) <= 0.001) {
tmp = sin(th) * (ky / kx);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if ((sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) <= 0.001d0) then
tmp = sin(th) * (ky / kx)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if ((Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) <= 0.001) {
tmp = Math.sin(th) * (ky / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) <= 0.001: tmp = math.sin(th) * (ky / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 0.001) tmp = Float64(sin(th) * Float64(ky / kx)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 0.001) tmp = sin(th) * (ky / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 0.001], N[(N[Sin[th], $MachinePrecision] * N[(ky / 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.001:\\
\;\;\;\;\sin th \cdot \frac{ky}{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))))) < 1e-3Initial program 97.8%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6450.3
Simplified50.3%
Taylor expanded in ky around 0
lower-/.f6424.0
Simplified24.0%
if 1e-3 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 93.1%
Taylor expanded in kx around 0
lower-sin.f6467.4
Simplified67.4%
Final simplification39.1%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 6e-77) (* -0.16666666666666666 (* th (* th th))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) <= 6e-77) {
tmp = -0.16666666666666666 * (th * (th * th));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if ((sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) <= 6d-77) then
tmp = (-0.16666666666666666d0) * (th * (th * th))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if ((Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) <= 6e-77) {
tmp = -0.16666666666666666 * (th * (th * th));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) <= 6e-77: tmp = -0.16666666666666666 * (th * (th * th)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 6e-77) 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)))) <= 6e-77) tmp = -0.16666666666666666 * (th * (th * th)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 6e-77], 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 6 \cdot 10^{-77}:\\
\;\;\;\;-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))))) < 6.00000000000000033e-77Initial program 97.7%
Taylor expanded in kx around 0
lower-sin.f643.5
Simplified3.5%
Taylor expanded in th around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f643.4
Simplified3.4%
Taylor expanded in th around inf
lower-*.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6417.5
Simplified17.5%
if 6.00000000000000033e-77 < (/.f64 (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 93.9%
Taylor expanded in kx around 0
lower-sin.f6459.3
Simplified59.3%
(FPCore (kx ky th) :precision binary64 (if (<= (pow (sin kx) 2.0) 1e-9) (* (sin th) (/ (sin ky) (hypot (sin ky) kx))) (* (sin th) (* (sin ky) (sqrt (/ 2.0 (- 1.0 (cos (* kx -2.0)))))))))
double code(double kx, double ky, double th) {
double tmp;
if (pow(sin(kx), 2.0) <= 1e-9) {
tmp = sin(th) * (sin(ky) / hypot(sin(ky), kx));
} else {
tmp = sin(th) * (sin(ky) * sqrt((2.0 / (1.0 - cos((kx * -2.0))))));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.pow(Math.sin(kx), 2.0) <= 1e-9) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.hypot(Math.sin(ky), kx));
} else {
tmp = Math.sin(th) * (Math.sin(ky) * Math.sqrt((2.0 / (1.0 - Math.cos((kx * -2.0))))));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.pow(math.sin(kx), 2.0) <= 1e-9: tmp = math.sin(th) * (math.sin(ky) / math.hypot(math.sin(ky), kx)) else: tmp = math.sin(th) * (math.sin(ky) * math.sqrt((2.0 / (1.0 - math.cos((kx * -2.0)))))) return tmp
function code(kx, ky, th) tmp = 0.0 if ((sin(kx) ^ 2.0) <= 1e-9) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), kx))); else tmp = Float64(sin(th) * Float64(sin(ky) * sqrt(Float64(2.0 / Float64(1.0 - cos(Float64(kx * -2.0))))))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((sin(kx) ^ 2.0) <= 1e-9) tmp = sin(th) * (sin(ky) / hypot(sin(ky), kx)); else tmp = sin(th) * (sin(ky) * sqrt((2.0 / (1.0 - cos((kx * -2.0)))))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision], 1e-9], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\sin kx}^{2} \leq 10^{-9}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \left(\sin ky \cdot \sqrt{\frac{2}{1 - \cos \left(kx \cdot -2\right)}}\right)\\
\end{array}
\end{array}
if (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) < 1.00000000000000006e-9Initial program 92.8%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6492.8
Simplified92.8%
lift-*.f64N/A
lift-sin.f64N/A
pow2N/A
+-commutativeN/A
lift-*.f64N/A
lower-hypot.f6499.8
Applied egg-rr99.8%
if 1.00000000000000006e-9 < (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) Initial program 99.4%
Applied egg-rr99.0%
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.5
Simplified59.5%
Final simplification79.0%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.002)
(/
1.0
(/ (sqrt (fma -0.5 (cos (* ky -2.0)) (fma kx kx 0.5))) (* (sin ky) th)))
(if (<= (sin ky) 5e-152)
(* ky (/ (sin th) (sin kx)))
(if (<= (sin ky) 0.0004)
(*
(sin th)
(*
(sqrt (/ 1.0 (fma (- 1.0 (cos (+ kx kx))) 0.5 (* ky ky))))
(fma
ky
(*
(* ky ky)
(fma 0.008333333333333333 (* ky ky) -0.16666666666666666))
ky)))
(sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.002) {
tmp = 1.0 / (sqrt(fma(-0.5, cos((ky * -2.0)), fma(kx, kx, 0.5))) / (sin(ky) * th));
} else if (sin(ky) <= 5e-152) {
tmp = ky * (sin(th) / sin(kx));
} else if (sin(ky) <= 0.0004) {
tmp = sin(th) * (sqrt((1.0 / fma((1.0 - cos((kx + kx))), 0.5, (ky * ky)))) * fma(ky, ((ky * ky) * fma(0.008333333333333333, (ky * ky), -0.16666666666666666)), ky));
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.002) tmp = Float64(1.0 / Float64(sqrt(fma(-0.5, cos(Float64(ky * -2.0)), fma(kx, kx, 0.5))) / Float64(sin(ky) * th))); elseif (sin(ky) <= 5e-152) tmp = Float64(ky * Float64(sin(th) / sin(kx))); elseif (sin(ky) <= 0.0004) tmp = Float64(sin(th) * Float64(sqrt(Float64(1.0 / fma(Float64(1.0 - cos(Float64(kx + kx))), 0.5, Float64(ky * ky)))) * fma(ky, Float64(Float64(ky * ky) * fma(0.008333333333333333, Float64(ky * ky), -0.16666666666666666)), ky))); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.002], N[(1.0 / N[(N[Sqrt[N[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + N[(kx * kx + 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-152], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 0.0004], N[(N[Sin[th], $MachinePrecision] * N[(N[Sqrt[N[(1.0 / N[(N[(1.0 - N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5 + N[(ky * ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(ky * N[(N[(ky * ky), $MachinePrecision] * N[(0.008333333333333333 * N[(ky * ky), $MachinePrecision] + -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.002:\\
\;\;\;\;\frac{1}{\frac{\sqrt{\mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), \mathsf{fma}\left(kx, kx, 0.5\right)\right)}}{\sin ky \cdot th}}\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-152}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{elif}\;\sin ky \leq 0.0004:\\
\;\;\;\;\sin th \cdot \left(\sqrt{\frac{1}{\mathsf{fma}\left(1 - \cos \left(kx + kx\right), 0.5, ky \cdot ky\right)}} \cdot \mathsf{fma}\left(ky, \left(ky \cdot ky\right) \cdot \mathsf{fma}\left(0.008333333333333333, ky \cdot ky, -0.16666666666666666\right), ky\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -2e-3Initial program 99.7%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6448.7
Simplified48.7%
Applied egg-rr47.7%
Taylor expanded in th around 0
associate-*l/N/A
*-lft-identityN/A
lower-/.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
associate-+l+N/A
lower-fma.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-sin.f6418.7
Simplified18.7%
if -2e-3 < (sin.f64 ky) < 4.9999999999999997e-152Initial program 89.4%
Taylor expanded in ky around 0
lower-*.f64N/A
distribute-lft-inN/A
*-commutativeN/A
associate-+r+N/A
+-commutativeN/A
Simplified50.9%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-sin.f64N/A
lower-sin.f6456.7
Simplified56.7%
if 4.9999999999999997e-152 < (sin.f64 ky) < 4.00000000000000019e-4Initial program 99.5%
Applied egg-rr62.3%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6488.5
Simplified88.5%
Taylor expanded in ky around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6488.5
Simplified88.5%
if 4.00000000000000019e-4 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0
lower-sin.f6465.8
Simplified65.8%
Final simplification54.4%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.002)
(/
1.0
(/ (sqrt (fma -0.5 (cos (* ky -2.0)) (fma kx kx 0.5))) (* (sin ky) th)))
(if (<= (sin ky) 5e-152)
(* ky (/ (sin th) (sin kx)))
(if (<= (sin ky) 0.0004)
(*
(sin th)
(*
(sqrt (/ 1.0 (fma (- 1.0 (cos (+ kx kx))) 0.5 (* ky ky))))
(fma ky (* -0.16666666666666666 (* ky ky)) ky)))
(sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.002) {
tmp = 1.0 / (sqrt(fma(-0.5, cos((ky * -2.0)), fma(kx, kx, 0.5))) / (sin(ky) * th));
} else if (sin(ky) <= 5e-152) {
tmp = ky * (sin(th) / sin(kx));
} else if (sin(ky) <= 0.0004) {
tmp = sin(th) * (sqrt((1.0 / fma((1.0 - cos((kx + kx))), 0.5, (ky * ky)))) * fma(ky, (-0.16666666666666666 * (ky * ky)), ky));
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.002) tmp = Float64(1.0 / Float64(sqrt(fma(-0.5, cos(Float64(ky * -2.0)), fma(kx, kx, 0.5))) / Float64(sin(ky) * th))); elseif (sin(ky) <= 5e-152) tmp = Float64(ky * Float64(sin(th) / sin(kx))); elseif (sin(ky) <= 0.0004) tmp = Float64(sin(th) * Float64(sqrt(Float64(1.0 / fma(Float64(1.0 - cos(Float64(kx + kx))), 0.5, Float64(ky * ky)))) * fma(ky, Float64(-0.16666666666666666 * Float64(ky * ky)), ky))); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.002], N[(1.0 / N[(N[Sqrt[N[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + N[(kx * kx + 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-152], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 0.0004], N[(N[Sin[th], $MachinePrecision] * N[(N[Sqrt[N[(1.0 / N[(N[(1.0 - N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5 + N[(ky * ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(ky * N[(-0.16666666666666666 * N[(ky * ky), $MachinePrecision]), $MachinePrecision] + ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.002:\\
\;\;\;\;\frac{1}{\frac{\sqrt{\mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), \mathsf{fma}\left(kx, kx, 0.5\right)\right)}}{\sin ky \cdot th}}\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-152}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{elif}\;\sin ky \leq 0.0004:\\
\;\;\;\;\sin th \cdot \left(\sqrt{\frac{1}{\mathsf{fma}\left(1 - \cos \left(kx + kx\right), 0.5, ky \cdot ky\right)}} \cdot \mathsf{fma}\left(ky, -0.16666666666666666 \cdot \left(ky \cdot ky\right), ky\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -2e-3Initial program 99.7%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6448.7
Simplified48.7%
Applied egg-rr47.7%
Taylor expanded in th around 0
associate-*l/N/A
*-lft-identityN/A
lower-/.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
associate-+l+N/A
lower-fma.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-sin.f6418.7
Simplified18.7%
if -2e-3 < (sin.f64 ky) < 4.9999999999999997e-152Initial program 89.4%
Taylor expanded in ky around 0
lower-*.f64N/A
distribute-lft-inN/A
*-commutativeN/A
associate-+r+N/A
+-commutativeN/A
Simplified50.9%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-sin.f64N/A
lower-sin.f6456.7
Simplified56.7%
if 4.9999999999999997e-152 < (sin.f64 ky) < 4.00000000000000019e-4Initial program 99.5%
Applied egg-rr62.3%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6488.5
Simplified88.5%
Taylor expanded in ky around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6488.5
Simplified88.5%
if 4.00000000000000019e-4 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0
lower-sin.f6465.8
Simplified65.8%
Final simplification54.4%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) 5e-152)
(* (sin th) (/ (sin ky) (sin kx)))
(if (<= (sin ky) 0.0004)
(*
(sin th)
(*
(sqrt (/ 1.0 (fma (- 1.0 (cos (+ kx kx))) 0.5 (* ky ky))))
(fma
ky
(* (* ky ky) (fma 0.008333333333333333 (* ky ky) -0.16666666666666666))
ky)))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 5e-152) {
tmp = sin(th) * (sin(ky) / sin(kx));
} else if (sin(ky) <= 0.0004) {
tmp = sin(th) * (sqrt((1.0 / fma((1.0 - cos((kx + kx))), 0.5, (ky * ky)))) * fma(ky, ((ky * ky) * fma(0.008333333333333333, (ky * ky), -0.16666666666666666)), ky));
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 5e-152) tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); elseif (sin(ky) <= 0.0004) tmp = Float64(sin(th) * Float64(sqrt(Float64(1.0 / fma(Float64(1.0 - cos(Float64(kx + kx))), 0.5, Float64(ky * ky)))) * fma(ky, Float64(Float64(ky * ky) * fma(0.008333333333333333, Float64(ky * ky), -0.16666666666666666)), ky))); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-152], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 0.0004], N[(N[Sin[th], $MachinePrecision] * N[(N[Sqrt[N[(1.0 / N[(N[(1.0 - N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5 + N[(ky * ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(ky * N[(N[(ky * ky), $MachinePrecision] * N[(0.008333333333333333 * N[(ky * ky), $MachinePrecision] + -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 5 \cdot 10^{-152}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\mathbf{elif}\;\sin ky \leq 0.0004:\\
\;\;\;\;\sin th \cdot \left(\sqrt{\frac{1}{\mathsf{fma}\left(1 - \cos \left(kx + kx\right), 0.5, ky \cdot ky\right)}} \cdot \mathsf{fma}\left(ky, \left(ky \cdot ky\right) \cdot \mathsf{fma}\left(0.008333333333333333, ky \cdot ky, -0.16666666666666666\right), ky\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 4.9999999999999997e-152Initial program 93.7%
Taylor expanded in ky around 0
lower-sin.f6436.6
Simplified36.6%
if 4.9999999999999997e-152 < (sin.f64 ky) < 4.00000000000000019e-4Initial program 99.5%
Applied egg-rr62.3%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6488.5
Simplified88.5%
Taylor expanded in ky around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6488.5
Simplified88.5%
if 4.00000000000000019e-4 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0
lower-sin.f6465.8
Simplified65.8%
Final simplification51.9%
(FPCore (kx ky th)
:precision binary64
(if (<= kx 1.22e-162)
(sin th)
(if (<= kx 0.5)
(*
(sin th)
(/
(sin ky)
(sqrt
(fma
(- 1.0 (cos (+ ky ky)))
0.5
(*
(* kx kx)
(fma
(* kx kx)
(fma
(* kx kx)
(fma (* kx kx) -0.0031746031746031746 0.044444444444444446)
-0.3333333333333333)
1.0))))))
(* (sin th) (* (sin ky) (sqrt (/ 2.0 (- 1.0 (cos (* kx -2.0))))))))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 1.22e-162) {
tmp = sin(th);
} else if (kx <= 0.5) {
tmp = sin(th) * (sin(ky) / sqrt(fma((1.0 - cos((ky + ky))), 0.5, ((kx * kx) * fma((kx * kx), fma((kx * kx), fma((kx * kx), -0.0031746031746031746, 0.044444444444444446), -0.3333333333333333), 1.0)))));
} else {
tmp = sin(th) * (sin(ky) * sqrt((2.0 / (1.0 - cos((kx * -2.0))))));
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (kx <= 1.22e-162) tmp = sin(th); elseif (kx <= 0.5) tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(fma(Float64(1.0 - cos(Float64(ky + ky))), 0.5, Float64(Float64(kx * kx) * fma(Float64(kx * kx), fma(Float64(kx * kx), fma(Float64(kx * kx), -0.0031746031746031746, 0.044444444444444446), -0.3333333333333333), 1.0)))))); else tmp = Float64(sin(th) * Float64(sin(ky) * sqrt(Float64(2.0 / Float64(1.0 - cos(Float64(kx * -2.0))))))); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[kx, 1.22e-162], N[Sin[th], $MachinePrecision], If[LessEqual[kx, 0.5], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[(1.0 - N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5 + N[(N[(kx * kx), $MachinePrecision] * N[(N[(kx * kx), $MachinePrecision] * N[(N[(kx * kx), $MachinePrecision] * N[(N[(kx * kx), $MachinePrecision] * -0.0031746031746031746 + 0.044444444444444446), $MachinePrecision] + -0.3333333333333333), $MachinePrecision] + 1.0), $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[(kx * -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 1.22 \cdot 10^{-162}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;kx \leq 0.5:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{\mathsf{fma}\left(1 - \cos \left(ky + ky\right), 0.5, \left(kx \cdot kx\right) \cdot \mathsf{fma}\left(kx \cdot kx, \mathsf{fma}\left(kx \cdot kx, \mathsf{fma}\left(kx \cdot kx, -0.0031746031746031746, 0.044444444444444446\right), -0.3333333333333333\right), 1\right)\right)}}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \left(\sin ky \cdot \sqrt{\frac{2}{1 - \cos \left(kx \cdot -2\right)}}\right)\\
\end{array}
\end{array}
if kx < 1.22000000000000012e-162Initial program 93.6%
Taylor expanded in kx around 0
lower-sin.f6432.9
Simplified32.9%
if 1.22000000000000012e-162 < kx < 0.5Initial program 99.8%
Applied egg-rr59.1%
Applied egg-rr12.5%
lift-+.f64N/A
lift-cos.f64N/A
lift-fma.f6412.5
lift-+.f64N/A
flip-+N/A
lift-*.f64N/A
lift-*.f64N/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
flip-+N/A
lift-+.f6459.2
Applied egg-rr59.2%
Taylor expanded in kx around 0
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6491.7
Simplified91.7%
if 0.5 < kx Initial program 99.5%
Applied egg-rr99.2%
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-*.f6464.9
Simplified64.9%
Final simplification51.3%
(FPCore (kx ky th)
:precision binary64
(if (<= kx 1.14e-163)
(sin th)
(if (<= kx 0.47)
(*
(sin th)
(/
(sin ky)
(sqrt
(fma
(- 1.0 (cos (+ ky ky)))
0.5
(*
(* kx kx)
(fma
(* kx kx)
(fma 0.044444444444444446 (* kx kx) -0.3333333333333333)
1.0))))))
(* (sin th) (* (sin ky) (sqrt (/ 2.0 (- 1.0 (cos (* kx -2.0))))))))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 1.14e-163) {
tmp = sin(th);
} else if (kx <= 0.47) {
tmp = sin(th) * (sin(ky) / sqrt(fma((1.0 - cos((ky + ky))), 0.5, ((kx * kx) * fma((kx * kx), fma(0.044444444444444446, (kx * kx), -0.3333333333333333), 1.0)))));
} else {
tmp = sin(th) * (sin(ky) * sqrt((2.0 / (1.0 - cos((kx * -2.0))))));
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (kx <= 1.14e-163) tmp = sin(th); elseif (kx <= 0.47) tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(fma(Float64(1.0 - cos(Float64(ky + ky))), 0.5, Float64(Float64(kx * kx) * fma(Float64(kx * kx), fma(0.044444444444444446, Float64(kx * kx), -0.3333333333333333), 1.0)))))); else tmp = Float64(sin(th) * Float64(sin(ky) * sqrt(Float64(2.0 / Float64(1.0 - cos(Float64(kx * -2.0))))))); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[kx, 1.14e-163], N[Sin[th], $MachinePrecision], If[LessEqual[kx, 0.47], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[(1.0 - N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5 + N[(N[(kx * kx), $MachinePrecision] * N[(N[(kx * kx), $MachinePrecision] * N[(0.044444444444444446 * N[(kx * kx), $MachinePrecision] + -0.3333333333333333), $MachinePrecision] + 1.0), $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[(kx * -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 1.14 \cdot 10^{-163}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;kx \leq 0.47:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{\mathsf{fma}\left(1 - \cos \left(ky + ky\right), 0.5, \left(kx \cdot kx\right) \cdot \mathsf{fma}\left(kx \cdot kx, \mathsf{fma}\left(0.044444444444444446, kx \cdot kx, -0.3333333333333333\right), 1\right)\right)}}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \left(\sin ky \cdot \sqrt{\frac{2}{1 - \cos \left(kx \cdot -2\right)}}\right)\\
\end{array}
\end{array}
if kx < 1.14000000000000005e-163Initial program 93.6%
Taylor expanded in kx around 0
lower-sin.f6432.9
Simplified32.9%
if 1.14000000000000005e-163 < kx < 0.46999999999999997Initial program 99.8%
Applied egg-rr59.1%
Applied egg-rr12.5%
lift-+.f64N/A
lift-cos.f64N/A
lift-fma.f6412.5
lift-+.f64N/A
flip-+N/A
lift-*.f64N/A
lift-*.f64N/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
flip-+N/A
lift-+.f6459.2
Applied egg-rr59.2%
Taylor expanded in kx around 0
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6491.5
Simplified91.5%
if 0.46999999999999997 < kx Initial program 99.5%
Applied egg-rr99.2%
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-*.f6464.9
Simplified64.9%
Final simplification51.2%
(FPCore (kx ky th)
:precision binary64
(if (<= kx 1.15e-165)
(sin th)
(if (<= kx 0.09)
(*
(sin th)
(/
(sin ky)
(sqrt
(fma
(- 1.0 (cos (+ ky ky)))
0.5
(* (* kx kx) (fma -0.3333333333333333 (* kx kx) 1.0))))))
(* (sin th) (* (sin ky) (sqrt (/ 2.0 (- 1.0 (cos (* kx -2.0))))))))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 1.15e-165) {
tmp = sin(th);
} else if (kx <= 0.09) {
tmp = sin(th) * (sin(ky) / sqrt(fma((1.0 - cos((ky + ky))), 0.5, ((kx * kx) * fma(-0.3333333333333333, (kx * kx), 1.0)))));
} else {
tmp = sin(th) * (sin(ky) * sqrt((2.0 / (1.0 - cos((kx * -2.0))))));
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (kx <= 1.15e-165) tmp = sin(th); elseif (kx <= 0.09) tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(fma(Float64(1.0 - cos(Float64(ky + ky))), 0.5, Float64(Float64(kx * kx) * fma(-0.3333333333333333, Float64(kx * kx), 1.0)))))); else tmp = Float64(sin(th) * Float64(sin(ky) * sqrt(Float64(2.0 / Float64(1.0 - cos(Float64(kx * -2.0))))))); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[kx, 1.15e-165], N[Sin[th], $MachinePrecision], If[LessEqual[kx, 0.09], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[(1.0 - N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5 + N[(N[(kx * kx), $MachinePrecision] * N[(-0.3333333333333333 * N[(kx * kx), $MachinePrecision] + 1.0), $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[(kx * -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 1.15 \cdot 10^{-165}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;kx \leq 0.09:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{\mathsf{fma}\left(1 - \cos \left(ky + ky\right), 0.5, \left(kx \cdot kx\right) \cdot \mathsf{fma}\left(-0.3333333333333333, kx \cdot kx, 1\right)\right)}}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \left(\sin ky \cdot \sqrt{\frac{2}{1 - \cos \left(kx \cdot -2\right)}}\right)\\
\end{array}
\end{array}
if kx < 1.15e-165Initial program 93.6%
Taylor expanded in kx around 0
lower-sin.f6432.9
Simplified32.9%
if 1.15e-165 < kx < 0.089999999999999997Initial program 99.8%
Applied egg-rr59.1%
Applied egg-rr12.5%
lift-+.f64N/A
lift-cos.f64N/A
lift-fma.f6412.5
lift-+.f64N/A
flip-+N/A
lift-*.f64N/A
lift-*.f64N/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
flip-+N/A
lift-+.f6459.2
Applied egg-rr59.2%
Taylor expanded in kx around 0
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6491.0
Simplified91.0%
if 0.089999999999999997 < kx Initial program 99.5%
Applied egg-rr99.2%
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-*.f6464.9
Simplified64.9%
Final simplification51.2%
(FPCore (kx ky th)
:precision binary64
(if (<= ky 4.2e-152)
(* ky (/ (sin th) (sin kx)))
(if (<= ky 0.0024)
(*
(sin th)
(*
(sqrt (/ 1.0 (fma (- 1.0 (cos (+ kx kx))) 0.5 (* ky ky))))
(fma
ky
(* (* ky ky) (fma 0.008333333333333333 (* ky ky) -0.16666666666666666))
ky)))
(* (sin th) (/ (sin ky) (sqrt (* 0.5 (- 1.0 (cos (* ky -2.0))))))))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 4.2e-152) {
tmp = ky * (sin(th) / sin(kx));
} else if (ky <= 0.0024) {
tmp = sin(th) * (sqrt((1.0 / fma((1.0 - cos((kx + kx))), 0.5, (ky * ky)))) * fma(ky, ((ky * ky) * fma(0.008333333333333333, (ky * ky), -0.16666666666666666)), ky));
} else {
tmp = sin(th) * (sin(ky) / sqrt((0.5 * (1.0 - cos((ky * -2.0))))));
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (ky <= 4.2e-152) tmp = Float64(ky * Float64(sin(th) / sin(kx))); elseif (ky <= 0.0024) tmp = Float64(sin(th) * Float64(sqrt(Float64(1.0 / fma(Float64(1.0 - cos(Float64(kx + kx))), 0.5, Float64(ky * ky)))) * fma(ky, Float64(Float64(ky * ky) * fma(0.008333333333333333, Float64(ky * ky), -0.16666666666666666)), ky))); else tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(Float64(0.5 * Float64(1.0 - cos(Float64(ky * -2.0))))))); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[ky, 4.2e-152], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[ky, 0.0024], N[(N[Sin[th], $MachinePrecision] * N[(N[Sqrt[N[(1.0 / N[(N[(1.0 - N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5 + N[(ky * ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(ky * N[(N[(ky * ky), $MachinePrecision] * N[(0.008333333333333333 * N[(ky * ky), $MachinePrecision] + -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(0.5 * 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 4.2 \cdot 10^{-152}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{elif}\;ky \leq 0.0024:\\
\;\;\;\;\sin th \cdot \left(\sqrt{\frac{1}{\mathsf{fma}\left(1 - \cos \left(kx + kx\right), 0.5, ky \cdot ky\right)}} \cdot \mathsf{fma}\left(ky, \left(ky \cdot ky\right) \cdot \mathsf{fma}\left(0.008333333333333333, ky \cdot ky, -0.16666666666666666\right), ky\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{0.5 \cdot \left(1 - \cos \left(ky \cdot -2\right)\right)}}\\
\end{array}
\end{array}
if ky < 4.19999999999999998e-152Initial program 93.5%
Taylor expanded in ky around 0
lower-*.f64N/A
distribute-lft-inN/A
*-commutativeN/A
associate-+r+N/A
+-commutativeN/A
Simplified31.4%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-sin.f64N/A
lower-sin.f6435.0
Simplified35.0%
if 4.19999999999999998e-152 < ky < 0.00239999999999999979Initial program 99.5%
Applied egg-rr62.3%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6488.5
Simplified88.5%
Taylor expanded in ky around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6488.5
Simplified88.5%
if 0.00239999999999999979 < ky Initial program 99.7%
Applied egg-rr99.2%
Applied egg-rr21.4%
lift-+.f64N/A
lift-cos.f64N/A
lift-fma.f6421.4
lift-+.f64N/A
flip-+N/A
lift-*.f64N/A
lift-*.f64N/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
flip-+N/A
lift-+.f6499.4
Applied egg-rr99.4%
Taylor expanded in kx around 0
lower-*.f64N/A
lower--.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6463.6
Simplified63.6%
Final simplification50.8%
(FPCore (kx ky th) :precision binary64 th)
double code(double kx, double ky, double th) {
return th;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = th
end function
public static double code(double kx, double ky, double th) {
return th;
}
def code(kx, ky, th): return th
function code(kx, ky, th) return th end
function tmp = code(kx, ky, th) tmp = th; end
code[kx_, ky_, th_] := th
\begin{array}{l}
\\
th
\end{array}
Initial program 96.2%
Taylor expanded in kx around 0
lower-sin.f6426.0
Simplified26.0%
Taylor expanded in th around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6414.7
Simplified14.7%
Taylor expanded in th around 0
Simplified15.1%
*-rgt-identity15.1
Applied egg-rr15.1%
herbie shell --seed 2024207
(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)))