
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 34 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\end{array}
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (hypot (sin ky) (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / hypot(sin(ky), sin(kx))) * sin(th);
}
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot \sin th
\end{array}
Initial program 93.6%
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.7
Applied egg-rr99.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (* (sin th) (/ (sin ky) (hypot (sin ky) (fma kx (* kx kx) kx)))))
(t_2 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))))
(t_3 (hypot (sin ky) (sin kx))))
(if (<= t_2 -1.0)
t_1
(if (<= t_2 -0.01)
(* (/ (sin ky) t_3) (fma th (* -0.16666666666666666 (* th th)) th))
(if (<= t_2 2e-7)
(* (sin th) (/ (fma ky (* -0.16666666666666666 (* ky ky)) ky) t_3))
(if (<= t_2 0.9981109276908842)
(*
(* (sin ky) th)
(sqrt
(/
1.0
(fma
0.5
(- 1.0 (cos (* ky -2.0)))
(fma -0.5 (cos (* kx -2.0)) 0.5)))))
t_1))))))
double code(double kx, double ky, double th) {
double t_1 = sin(th) * (sin(ky) / hypot(sin(ky), fma(kx, (kx * kx), kx)));
double t_2 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double t_3 = hypot(sin(ky), sin(kx));
double tmp;
if (t_2 <= -1.0) {
tmp = t_1;
} else if (t_2 <= -0.01) {
tmp = (sin(ky) / t_3) * fma(th, (-0.16666666666666666 * (th * th)), th);
} else if (t_2 <= 2e-7) {
tmp = sin(th) * (fma(ky, (-0.16666666666666666 * (ky * ky)), ky) / t_3);
} else if (t_2 <= 0.9981109276908842) {
tmp = (sin(ky) * th) * sqrt((1.0 / fma(0.5, (1.0 - cos((ky * -2.0))), fma(-0.5, cos((kx * -2.0)), 0.5))));
} else {
tmp = t_1;
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), fma(kx, Float64(kx * kx), kx)))) t_2 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) t_3 = hypot(sin(ky), sin(kx)) tmp = 0.0 if (t_2 <= -1.0) tmp = t_1; elseif (t_2 <= -0.01) tmp = Float64(Float64(sin(ky) / t_3) * fma(th, Float64(-0.16666666666666666 * Float64(th * th)), th)); elseif (t_2 <= 2e-7) tmp = Float64(sin(th) * Float64(fma(ky, Float64(-0.16666666666666666 * Float64(ky * ky)), ky) / t_3)); elseif (t_2 <= 0.9981109276908842) tmp = Float64(Float64(sin(ky) * th) * sqrt(Float64(1.0 / fma(0.5, Float64(1.0 - cos(Float64(ky * -2.0))), fma(-0.5, cos(Float64(kx * -2.0)), 0.5))))); else tmp = t_1; end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[(kx * N[(kx * kx), $MachinePrecision] + kx), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[t$95$2, -1.0], t$95$1, If[LessEqual[t$95$2, -0.01], N[(N[(N[Sin[ky], $MachinePrecision] / t$95$3), $MachinePrecision] * N[(th * N[(-0.16666666666666666 * N[(th * th), $MachinePrecision]), $MachinePrecision] + th), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e-7], N[(N[Sin[th], $MachinePrecision] * N[(N[(ky * N[(-0.16666666666666666 * N[(ky * ky), $MachinePrecision]), $MachinePrecision] + ky), $MachinePrecision] / t$95$3), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.9981109276908842], N[(N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(0.5 * N[(1.0 - N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(-0.5 * N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \mathsf{fma}\left(kx, kx \cdot kx, kx\right)\right)}\\
t_2 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
t_3 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\
\mathbf{if}\;t\_2 \leq -1:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq -0.01:\\
\;\;\;\;\frac{\sin ky}{t\_3} \cdot \mathsf{fma}\left(th, -0.16666666666666666 \cdot \left(th \cdot th\right), th\right)\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{-7}:\\
\;\;\;\;\sin th \cdot \frac{\mathsf{fma}\left(ky, -0.16666666666666666 \cdot \left(ky \cdot ky\right), ky\right)}{t\_3}\\
\mathbf{elif}\;t\_2 \leq 0.9981109276908842:\\
\;\;\;\;\left(\sin ky \cdot th\right) \cdot \sqrt{\frac{1}{\mathsf{fma}\left(0.5, 1 - \cos \left(ky \cdot -2\right), \mathsf{fma}\left(-0.5, \cos \left(kx \cdot -2\right), 0.5\right)\right)}}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -1 or 0.99811092769088416 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 84.1%
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.f64100.0
Applied egg-rr100.0%
Taylor expanded in kx around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64100.0
Simplified100.0%
Taylor expanded in kx around inf
unpow2N/A
lower-*.f64100.0
Simplified100.0%
if -1 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.0100000000000000002Initial program 99.5%
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%
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-*.f6436.3
Simplified36.3%
if -0.0100000000000000002 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 1.9999999999999999e-7Initial program 99.5%
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
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6499.5
Simplified99.5%
if 1.9999999999999999e-7 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.99811092769088416Initial 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-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
count-2N/A
cos-diffN/A
cos-sin-sumN/A
lower--.f64N/A
count-2N/A
lower-cos.f64N/A
lower-+.f6499.4
lift-pow.f64N/A
Applied egg-rr99.4%
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
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
lower-fma.f64N/A
Simplified66.5%
Final simplification87.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (pow (sin kx) 2.0) 1e-12)
(*
(sin th)
(/
(sin ky)
(hypot (sin ky) (fma kx (* -0.16666666666666666 (* kx kx)) kx))))
(*
(sin th)
(*
(sin ky)
(sqrt
(/
1.0
(fma (- 1.0 (cos (+ kx kx))) 0.5 (+ 0.5 (* -0.5 (cos (+ ky ky)))))))))))
double code(double kx, double ky, double th) {
double tmp;
if (pow(sin(kx), 2.0) <= 1e-12) {
tmp = sin(th) * (sin(ky) / hypot(sin(ky), fma(kx, (-0.16666666666666666 * (kx * kx)), kx)));
} else {
tmp = sin(th) * (sin(ky) * sqrt((1.0 / fma((1.0 - cos((kx + kx))), 0.5, (0.5 + (-0.5 * cos((ky + ky))))))));
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if ((sin(kx) ^ 2.0) <= 1e-12) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), fma(kx, Float64(-0.16666666666666666 * Float64(kx * kx)), kx)))); else tmp = Float64(sin(th) * Float64(sin(ky) * sqrt(Float64(1.0 / fma(Float64(1.0 - cos(Float64(kx + kx))), 0.5, Float64(0.5 + Float64(-0.5 * cos(Float64(ky + ky))))))))); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision], 1e-12], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[(kx * N[(-0.16666666666666666 * N[(kx * kx), $MachinePrecision]), $MachinePrecision] + kx), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] * N[Sqrt[N[(1.0 / N[(N[(1.0 - N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5 + N[(0.5 + N[(-0.5 * N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\sin kx}^{2} \leq 10^{-12}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \mathsf{fma}\left(kx, -0.16666666666666666 \cdot \left(kx \cdot kx\right), kx\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \left(\sin ky \cdot \sqrt{\frac{1}{\mathsf{fma}\left(1 - \cos \left(kx + kx\right), 0.5, 0.5 + -0.5 \cdot \cos \left(ky + ky\right)\right)}}\right)\\
\end{array}
\end{array}
if (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) < 9.9999999999999998e-13Initial program 87.3%
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.9
Applied egg-rr99.9%
Taylor expanded in kx around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6499.9
Simplified99.9%
if 9.9999999999999998e-13 < (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) Initial program 99.5%
Applied egg-rr99.4%
Final simplification99.6%
(FPCore (kx ky th)
:precision binary64
(if (<= (pow (sin kx) 2.0) 1e-12)
(*
(sin th)
(/
(sin ky)
(hypot (sin ky) (fma kx (* -0.16666666666666666 (* kx kx)) kx))))
(*
(sqrt
(/
1.0
(fma (- 1.0 (cos (+ kx kx))) 0.5 (+ 0.5 (* -0.5 (cos (+ ky ky)))))))
(* (sin ky) (sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (pow(sin(kx), 2.0) <= 1e-12) {
tmp = sin(th) * (sin(ky) / hypot(sin(ky), fma(kx, (-0.16666666666666666 * (kx * kx)), kx)));
} else {
tmp = sqrt((1.0 / fma((1.0 - cos((kx + kx))), 0.5, (0.5 + (-0.5 * cos((ky + ky))))))) * (sin(ky) * sin(th));
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if ((sin(kx) ^ 2.0) <= 1e-12) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), fma(kx, Float64(-0.16666666666666666 * Float64(kx * kx)), kx)))); else tmp = Float64(sqrt(Float64(1.0 / fma(Float64(1.0 - cos(Float64(kx + kx))), 0.5, Float64(0.5 + Float64(-0.5 * cos(Float64(ky + ky))))))) * Float64(sin(ky) * sin(th))); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision], 1e-12], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[(kx * N[(-0.16666666666666666 * N[(kx * kx), $MachinePrecision]), $MachinePrecision] + kx), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(1.0 / N[(N[(1.0 - N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5 + N[(0.5 + N[(-0.5 * N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\sin kx}^{2} \leq 10^{-12}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \mathsf{fma}\left(kx, -0.16666666666666666 \cdot \left(kx \cdot kx\right), kx\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{1}{\mathsf{fma}\left(1 - \cos \left(kx + kx\right), 0.5, 0.5 + -0.5 \cdot \cos \left(ky + ky\right)\right)}} \cdot \left(\sin ky \cdot \sin th\right)\\
\end{array}
\end{array}
if (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) < 9.9999999999999998e-13Initial program 87.3%
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.9
Applied egg-rr99.9%
Taylor expanded in kx around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6499.9
Simplified99.9%
if 9.9999999999999998e-13 < (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) Initial program 99.5%
Applied egg-rr99.3%
Final simplification99.6%
(FPCore (kx ky th)
:precision binary64
(if (<= (pow (sin kx) 2.0) 1e-12)
(*
(sin th)
(/
(sin ky)
(hypot (sin ky) (fma kx (* -0.16666666666666666 (* kx kx)) kx))))
(*
(sin th)
(/
(sin ky)
(sqrt
(fma (- 1.0 (cos (+ ky ky))) 0.5 (+ 0.5 (* (cos (+ kx kx)) -0.5))))))))
double code(double kx, double ky, double th) {
double tmp;
if (pow(sin(kx), 2.0) <= 1e-12) {
tmp = sin(th) * (sin(ky) / hypot(sin(ky), fma(kx, (-0.16666666666666666 * (kx * kx)), kx)));
} else {
tmp = sin(th) * (sin(ky) / sqrt(fma((1.0 - cos((ky + ky))), 0.5, (0.5 + (cos((kx + kx)) * -0.5)))));
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if ((sin(kx) ^ 2.0) <= 1e-12) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), fma(kx, Float64(-0.16666666666666666 * Float64(kx * kx)), kx)))); else tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(fma(Float64(1.0 - cos(Float64(ky + ky))), 0.5, Float64(0.5 + Float64(cos(Float64(kx + kx)) * -0.5)))))); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision], 1e-12], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[(kx * N[(-0.16666666666666666 * N[(kx * kx), $MachinePrecision]), $MachinePrecision] + kx), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[(1.0 - N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5 + N[(0.5 + N[(N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\sin kx}^{2} \leq 10^{-12}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \mathsf{fma}\left(kx, -0.16666666666666666 \cdot \left(kx \cdot kx\right), kx\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{\mathsf{fma}\left(1 - \cos \left(ky + ky\right), 0.5, 0.5 + \cos \left(kx + kx\right) \cdot -0.5\right)}}\\
\end{array}
\end{array}
if (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) < 9.9999999999999998e-13Initial program 87.3%
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.9
Applied egg-rr99.9%
Taylor expanded in kx around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6499.9
Simplified99.9%
if 9.9999999999999998e-13 < (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) Initial program 99.5%
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-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
count-2N/A
cos-diffN/A
cos-sin-sumN/A
lower--.f64N/A
count-2N/A
lower-cos.f64N/A
lower-+.f6499.5
lift-pow.f64N/A
Applied egg-rr99.3%
Final simplification99.6%
(FPCore (kx ky th)
:precision binary64
(if (<= (pow (sin kx) 2.0) 1e-12)
(*
(sin th)
(/
(sin ky)
(hypot (sin ky) (fma kx (* -0.16666666666666666 (* kx kx)) kx))))
(*
(sin th)
(/
(sin ky)
(sqrt
(- (fma (- 1.0 (cos (+ ky ky))) 0.5 0.5) (* (cos (+ kx kx)) 0.5)))))))
double code(double kx, double ky, double th) {
double tmp;
if (pow(sin(kx), 2.0) <= 1e-12) {
tmp = sin(th) * (sin(ky) / hypot(sin(ky), fma(kx, (-0.16666666666666666 * (kx * kx)), kx)));
} else {
tmp = sin(th) * (sin(ky) / sqrt((fma((1.0 - cos((ky + ky))), 0.5, 0.5) - (cos((kx + kx)) * 0.5))));
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if ((sin(kx) ^ 2.0) <= 1e-12) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), fma(kx, Float64(-0.16666666666666666 * Float64(kx * kx)), kx)))); else tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(Float64(fma(Float64(1.0 - cos(Float64(ky + ky))), 0.5, 0.5) - Float64(cos(Float64(kx + kx)) * 0.5))))); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision], 1e-12], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[(kx * N[(-0.16666666666666666 * N[(kx * kx), $MachinePrecision]), $MachinePrecision] + kx), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[(N[(1.0 - N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5 + 0.5), $MachinePrecision] - N[(N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\sin kx}^{2} \leq 10^{-12}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \mathsf{fma}\left(kx, -0.16666666666666666 \cdot \left(kx \cdot kx\right), kx\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{\mathsf{fma}\left(1 - \cos \left(ky + ky\right), 0.5, 0.5\right) - \cos \left(kx + kx\right) \cdot 0.5}}\\
\end{array}
\end{array}
if (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) < 9.9999999999999998e-13Initial program 87.3%
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.9
Applied egg-rr99.9%
Taylor expanded in kx around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6499.9
Simplified99.9%
if 9.9999999999999998e-13 < (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) Initial program 99.5%
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-sin.f64N/A
lift-sin.f64N/A
sqr-sin-aN/A
associate-+r-N/A
lower--.f64N/A
Applied egg-rr99.3%
Final simplification99.6%
(FPCore (kx ky th)
:precision binary64
(if (<= (pow (sin kx) 2.0) 1e-12)
(*
(sin th)
(/
(sin ky)
(hypot (sin ky) (fma kx (* -0.16666666666666666 (* kx kx)) kx))))
(*
(sin th)
(/
(sin ky)
(sqrt
(- (fma (- 1.0 (cos (+ kx kx))) 0.5 0.5) (* 0.5 (cos (+ ky ky)))))))))
double code(double kx, double ky, double th) {
double tmp;
if (pow(sin(kx), 2.0) <= 1e-12) {
tmp = sin(th) * (sin(ky) / hypot(sin(ky), fma(kx, (-0.16666666666666666 * (kx * kx)), kx)));
} else {
tmp = sin(th) * (sin(ky) / sqrt((fma((1.0 - cos((kx + kx))), 0.5, 0.5) - (0.5 * cos((ky + ky))))));
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if ((sin(kx) ^ 2.0) <= 1e-12) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), fma(kx, Float64(-0.16666666666666666 * Float64(kx * kx)), kx)))); else tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(Float64(fma(Float64(1.0 - cos(Float64(kx + kx))), 0.5, 0.5) - Float64(0.5 * cos(Float64(ky + ky))))))); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision], 1e-12], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[(kx * N[(-0.16666666666666666 * N[(kx * kx), $MachinePrecision]), $MachinePrecision] + kx), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[(N[(1.0 - N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5 + 0.5), $MachinePrecision] - N[(0.5 * N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\sin kx}^{2} \leq 10^{-12}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \mathsf{fma}\left(kx, -0.16666666666666666 \cdot \left(kx \cdot kx\right), kx\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{\mathsf{fma}\left(1 - \cos \left(kx + kx\right), 0.5, 0.5\right) - 0.5 \cdot \cos \left(ky + ky\right)}}\\
\end{array}
\end{array}
if (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) < 9.9999999999999998e-13Initial program 87.3%
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.9
Applied egg-rr99.9%
Taylor expanded in kx around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6499.9
Simplified99.9%
if 9.9999999999999998e-13 < (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) Initial program 99.5%
lift-sin.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sqr-sin-aN/A
associate-+r-N/A
lower--.f64N/A
Applied egg-rr99.2%
Final simplification99.5%
(FPCore (kx ky th)
:precision binary64
(if (<= (pow (sin kx) 2.0) 1e-12)
(*
(sin th)
(/
1.0
(*
kx
(fma
-0.3333333333333333
(/ (* (* kx kx) (sqrt 0.5)) (* ky (sqrt 2.0)))
(* (sqrt 0.5) (/ (sqrt 2.0) ky))))))
(* ky (/ (sin th) (sqrt (* 0.5 (- 1.0 (cos (* kx -2.0)))))))))
double code(double kx, double ky, double th) {
double tmp;
if (pow(sin(kx), 2.0) <= 1e-12) {
tmp = sin(th) * (1.0 / (kx * fma(-0.3333333333333333, (((kx * kx) * sqrt(0.5)) / (ky * sqrt(2.0))), (sqrt(0.5) * (sqrt(2.0) / ky)))));
} else {
tmp = ky * (sin(th) / sqrt((0.5 * (1.0 - cos((kx * -2.0))))));
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if ((sin(kx) ^ 2.0) <= 1e-12) tmp = Float64(sin(th) * Float64(1.0 / Float64(kx * fma(-0.3333333333333333, Float64(Float64(Float64(kx * kx) * sqrt(0.5)) / Float64(ky * sqrt(2.0))), Float64(sqrt(0.5) * Float64(sqrt(2.0) / ky)))))); else tmp = Float64(ky * Float64(sin(th) / sqrt(Float64(0.5 * Float64(1.0 - cos(Float64(kx * -2.0))))))); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision], 1e-12], N[(N[Sin[th], $MachinePrecision] * N[(1.0 / N[(kx * N[(-0.3333333333333333 * N[(N[(N[(kx * kx), $MachinePrecision] * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision] / N[(ky * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[0.5], $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[(0.5 * 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^{-12}:\\
\;\;\;\;\sin th \cdot \frac{1}{kx \cdot \mathsf{fma}\left(-0.3333333333333333, \frac{\left(kx \cdot kx\right) \cdot \sqrt{0.5}}{ky \cdot \sqrt{2}}, \sqrt{0.5} \cdot \frac{\sqrt{2}}{ky}\right)}\\
\mathbf{else}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sqrt{0.5 \cdot \left(1 - \cos \left(kx \cdot -2\right)\right)}}\\
\end{array}
\end{array}
if (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) < 9.9999999999999998e-13Initial program 87.3%
Applied egg-rr56.2%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f642.6
Simplified2.6%
Taylor expanded in kx around 0
lower-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f6420.0
Simplified20.0%
if 9.9999999999999998e-13 < (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) Initial program 99.5%
Applied egg-rr99.3%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f6452.9
Simplified52.9%
lift-*.f64N/A
lift-cos.f64N/A
lift--.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
associate-*l/N/A
*-lft-identityN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
Applied egg-rr52.9%
Final simplification37.0%
(FPCore (kx ky th)
:precision binary64
(if (<= (pow (sin kx) 2.0) 1e-12)
(*
(sin th)
(/
1.0
(*
kx
(fma
-0.3333333333333333
(/ (* (* kx kx) (sqrt 0.5)) (* ky (sqrt 2.0)))
(* (sqrt 0.5) (/ (sqrt 2.0) ky))))))
(* (sin th) (/ ky (sqrt (* 0.5 (- 1.0 (cos (* kx -2.0)))))))))
double code(double kx, double ky, double th) {
double tmp;
if (pow(sin(kx), 2.0) <= 1e-12) {
tmp = sin(th) * (1.0 / (kx * fma(-0.3333333333333333, (((kx * kx) * sqrt(0.5)) / (ky * sqrt(2.0))), (sqrt(0.5) * (sqrt(2.0) / ky)))));
} else {
tmp = sin(th) * (ky / sqrt((0.5 * (1.0 - cos((kx * -2.0))))));
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if ((sin(kx) ^ 2.0) <= 1e-12) tmp = Float64(sin(th) * Float64(1.0 / Float64(kx * fma(-0.3333333333333333, Float64(Float64(Float64(kx * kx) * sqrt(0.5)) / Float64(ky * sqrt(2.0))), Float64(sqrt(0.5) * Float64(sqrt(2.0) / ky)))))); else tmp = Float64(sin(th) * Float64(ky / sqrt(Float64(0.5 * Float64(1.0 - cos(Float64(kx * -2.0))))))); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision], 1e-12], N[(N[Sin[th], $MachinePrecision] * N[(1.0 / N[(kx * N[(-0.3333333333333333 * N[(N[(N[(kx * kx), $MachinePrecision] * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision] / N[(ky * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[0.5], $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sqrt[N[(0.5 * 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^{-12}:\\
\;\;\;\;\sin th \cdot \frac{1}{kx \cdot \mathsf{fma}\left(-0.3333333333333333, \frac{\left(kx \cdot kx\right) \cdot \sqrt{0.5}}{ky \cdot \sqrt{2}}, \sqrt{0.5} \cdot \frac{\sqrt{2}}{ky}\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sqrt{0.5 \cdot \left(1 - \cos \left(kx \cdot -2\right)\right)}}\\
\end{array}
\end{array}
if (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) < 9.9999999999999998e-13Initial program 87.3%
Applied egg-rr56.2%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f642.6
Simplified2.6%
Taylor expanded in kx around 0
lower-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f6420.0
Simplified20.0%
if 9.9999999999999998e-13 < (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) Initial program 99.5%
Applied egg-rr99.3%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f6452.9
Simplified52.9%
lift-*.f64N/A
lift-cos.f64N/A
lift--.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
associate-*l/N/A
clear-numN/A
lower-/.f64N/A
*-lft-identityN/A
lower-/.f6452.0
Applied egg-rr52.0%
lift-*.f64N/A
lift-cos.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
associate-/r/N/A
lift-/.f64N/A
clear-numN/A
lower-*.f64N/A
Applied egg-rr52.9%
Final simplification37.0%
(FPCore (kx ky th)
:precision binary64
(if (<= kx 0.86)
(*
(sin th)
(/
(sin ky)
(hypot (sin ky) (fma kx (* -0.16666666666666666 (* kx kx)) kx))))
(*
(sin th)
(/ 1.0 (/ (* (sqrt (- 1.0 (cos (* kx -2.0)))) (sqrt 0.5)) (sin ky))))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.86) {
tmp = sin(th) * (sin(ky) / hypot(sin(ky), fma(kx, (-0.16666666666666666 * (kx * kx)), kx)));
} else {
tmp = sin(th) * (1.0 / ((sqrt((1.0 - cos((kx * -2.0)))) * sqrt(0.5)) / sin(ky)));
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (kx <= 0.86) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), fma(kx, Float64(-0.16666666666666666 * Float64(kx * kx)), kx)))); else tmp = Float64(sin(th) * Float64(1.0 / Float64(Float64(sqrt(Float64(1.0 - cos(Float64(kx * -2.0)))) * sqrt(0.5)) / sin(ky)))); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[kx, 0.86], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[(kx * N[(-0.16666666666666666 * N[(kx * kx), $MachinePrecision]), $MachinePrecision] + kx), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(1.0 / N[(N[(N[Sqrt[N[(1.0 - N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 0.86:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \mathsf{fma}\left(kx, -0.16666666666666666 \cdot \left(kx \cdot kx\right), kx\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{1}{\frac{\sqrt{1 - \cos \left(kx \cdot -2\right)} \cdot \sqrt{0.5}}{\sin ky}}\\
\end{array}
\end{array}
if kx < 0.859999999999999987Initial program 91.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.8
Applied egg-rr99.8%
Taylor expanded in kx around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6473.9
Simplified73.9%
if 0.859999999999999987 < kx Initial program 99.5%
Applied egg-rr99.2%
lift-+.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
flip-+N/A
lift-*.f64N/A
lift-*.f64N/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
flip-+N/A
lift-+.f64N/A
lower-fma.f6433.7
Applied egg-rr99.2%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f6466.7
Simplified66.7%
Final simplification71.9%
(FPCore (kx ky th)
:precision binary64
(if (<= kx 0.86)
(* (sin th) (/ (sin ky) (hypot (sin ky) (fma kx (* kx kx) kx))))
(*
(sin th)
(/ 1.0 (/ (* (sqrt (- 1.0 (cos (* kx -2.0)))) (sqrt 0.5)) (sin ky))))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.86) {
tmp = sin(th) * (sin(ky) / hypot(sin(ky), fma(kx, (kx * kx), kx)));
} else {
tmp = sin(th) * (1.0 / ((sqrt((1.0 - cos((kx * -2.0)))) * sqrt(0.5)) / sin(ky)));
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (kx <= 0.86) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), fma(kx, Float64(kx * kx), kx)))); else tmp = Float64(sin(th) * Float64(1.0 / Float64(Float64(sqrt(Float64(1.0 - cos(Float64(kx * -2.0)))) * sqrt(0.5)) / sin(ky)))); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[kx, 0.86], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[(kx * N[(kx * kx), $MachinePrecision] + kx), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(1.0 / N[(N[(N[Sqrt[N[(1.0 - N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 0.86:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \mathsf{fma}\left(kx, kx \cdot kx, kx\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{1}{\frac{\sqrt{1 - \cos \left(kx \cdot -2\right)} \cdot \sqrt{0.5}}{\sin ky}}\\
\end{array}
\end{array}
if kx < 0.859999999999999987Initial program 91.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.8
Applied egg-rr99.8%
Taylor expanded in kx around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6473.9
Simplified73.9%
Taylor expanded in kx around inf
unpow2N/A
lower-*.f6473.7
Simplified73.7%
if 0.859999999999999987 < kx Initial program 99.5%
Applied egg-rr99.2%
lift-+.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
flip-+N/A
lift-*.f64N/A
lift-*.f64N/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
flip-+N/A
lift-+.f64N/A
lower-fma.f6433.7
Applied egg-rr99.2%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f6466.7
Simplified66.7%
Final simplification71.8%
(FPCore (kx ky th)
:precision binary64
(if (<= (pow (sin kx) 2.0) 0.01)
(*
(sin th)
(/
1.0
(*
kx
(fma
-0.3333333333333333
(/ (* (* kx kx) (sqrt 0.5)) (* ky (sqrt 2.0)))
(* (sqrt 0.5) (/ (sqrt 2.0) ky))))))
(* (sqrt (/ 1.0 (- 1.0 (cos (* kx -2.0))))) (* ky (/ th (sqrt 0.5))))))
double code(double kx, double ky, double th) {
double tmp;
if (pow(sin(kx), 2.0) <= 0.01) {
tmp = sin(th) * (1.0 / (kx * fma(-0.3333333333333333, (((kx * kx) * sqrt(0.5)) / (ky * sqrt(2.0))), (sqrt(0.5) * (sqrt(2.0) / ky)))));
} else {
tmp = sqrt((1.0 / (1.0 - cos((kx * -2.0))))) * (ky * (th / sqrt(0.5)));
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if ((sin(kx) ^ 2.0) <= 0.01) tmp = Float64(sin(th) * Float64(1.0 / Float64(kx * fma(-0.3333333333333333, Float64(Float64(Float64(kx * kx) * sqrt(0.5)) / Float64(ky * sqrt(2.0))), Float64(sqrt(0.5) * Float64(sqrt(2.0) / ky)))))); else tmp = Float64(sqrt(Float64(1.0 / Float64(1.0 - cos(Float64(kx * -2.0))))) * Float64(ky * Float64(th / sqrt(0.5)))); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision], 0.01], N[(N[Sin[th], $MachinePrecision] * N[(1.0 / N[(kx * N[(-0.3333333333333333 * N[(N[(N[(kx * kx), $MachinePrecision] * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision] / N[(ky * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[0.5], $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\sin kx}^{2} \leq 0.01:\\
\;\;\;\;\sin th \cdot \frac{1}{kx \cdot \mathsf{fma}\left(-0.3333333333333333, \frac{\left(kx \cdot kx\right) \cdot \sqrt{0.5}}{ky \cdot \sqrt{2}}, \sqrt{0.5} \cdot \frac{\sqrt{2}}{ky}\right)}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{1}{1 - \cos \left(kx \cdot -2\right)}} \cdot \left(ky \cdot \frac{th}{\sqrt{0.5}}\right)\\
\end{array}
\end{array}
if (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) < 0.0100000000000000002Initial program 87.7%
Applied egg-rr57.6%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f644.1
Simplified4.1%
Taylor expanded in kx around 0
lower-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f6419.6
Simplified19.6%
if 0.0100000000000000002 < (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) Initial program 99.5%
Applied egg-rr99.4%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f6453.0
Simplified53.0%
Taylor expanded in th around 0
*-commutativeN/A
cos-negN/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower-*.f64N/A
Simplified31.1%
Final simplification25.3%
(FPCore (kx ky th)
:precision binary64
(if (<= kx 0.86)
(*
(sin th)
(/
1.0
(/
(sqrt
(fma
(* kx kx)
(fma
(* kx kx)
(fma (* kx kx) 0.044444444444444446 -0.3333333333333333)
1.0)
(fma -0.5 (cos (* ky -2.0)) 0.5)))
(sin ky))))
(*
(sin th)
(/ 1.0 (/ (* (sqrt (- 1.0 (cos (* kx -2.0)))) (sqrt 0.5)) (sin ky))))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.86) {
tmp = sin(th) * (1.0 / (sqrt(fma((kx * kx), fma((kx * kx), fma((kx * kx), 0.044444444444444446, -0.3333333333333333), 1.0), fma(-0.5, cos((ky * -2.0)), 0.5))) / sin(ky)));
} else {
tmp = sin(th) * (1.0 / ((sqrt((1.0 - cos((kx * -2.0)))) * sqrt(0.5)) / sin(ky)));
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (kx <= 0.86) tmp = Float64(sin(th) * Float64(1.0 / Float64(sqrt(fma(Float64(kx * kx), fma(Float64(kx * kx), fma(Float64(kx * kx), 0.044444444444444446, -0.3333333333333333), 1.0), fma(-0.5, cos(Float64(ky * -2.0)), 0.5))) / sin(ky)))); else tmp = Float64(sin(th) * Float64(1.0 / Float64(Float64(sqrt(Float64(1.0 - cos(Float64(kx * -2.0)))) * sqrt(0.5)) / sin(ky)))); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[kx, 0.86], N[(N[Sin[th], $MachinePrecision] * N[(1.0 / N[(N[Sqrt[N[(N[(kx * kx), $MachinePrecision] * N[(N[(kx * kx), $MachinePrecision] * N[(N[(kx * kx), $MachinePrecision] * 0.044444444444444446 + -0.3333333333333333), $MachinePrecision] + 1.0), $MachinePrecision] + N[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(1.0 / N[(N[(N[Sqrt[N[(1.0 - N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 0.86:\\
\;\;\;\;\sin th \cdot \frac{1}{\frac{\sqrt{\mathsf{fma}\left(kx \cdot kx, \mathsf{fma}\left(kx \cdot kx, \mathsf{fma}\left(kx \cdot kx, 0.044444444444444446, -0.3333333333333333\right), 1\right), \mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), 0.5\right)\right)}}{\sin ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{1}{\frac{\sqrt{1 - \cos \left(kx \cdot -2\right)} \cdot \sqrt{0.5}}{\sin ky}}\\
\end{array}
\end{array}
if kx < 0.859999999999999987Initial program 91.4%
Applied egg-rr70.6%
Taylor expanded in kx around 0
+-commutativeN/A
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
lower-fma.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-*.f64N/A
Simplified58.1%
if 0.859999999999999987 < kx Initial program 99.5%
Applied egg-rr99.2%
lift-+.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
flip-+N/A
lift-*.f64N/A
lift-*.f64N/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
flip-+N/A
lift-+.f64N/A
lower-fma.f6433.7
Applied egg-rr99.2%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f6466.7
Simplified66.7%
Final simplification60.5%
(FPCore (kx ky th) :precision binary64 (if (<= (pow (sin kx) 2.0) 0.01) (/ 1.0 (/ (/ (* (sqrt 2.0) (* kx (sqrt 0.5))) ky) (sin th))) (* (sqrt (/ 1.0 (- 1.0 (cos (* kx -2.0))))) (* ky (/ th (sqrt 0.5))))))
double code(double kx, double ky, double th) {
double tmp;
if (pow(sin(kx), 2.0) <= 0.01) {
tmp = 1.0 / (((sqrt(2.0) * (kx * sqrt(0.5))) / ky) / sin(th));
} else {
tmp = sqrt((1.0 / (1.0 - cos((kx * -2.0))))) * (ky * (th / sqrt(0.5)));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if ((sin(kx) ** 2.0d0) <= 0.01d0) then
tmp = 1.0d0 / (((sqrt(2.0d0) * (kx * sqrt(0.5d0))) / ky) / sin(th))
else
tmp = sqrt((1.0d0 / (1.0d0 - cos((kx * (-2.0d0)))))) * (ky * (th / sqrt(0.5d0)))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.pow(Math.sin(kx), 2.0) <= 0.01) {
tmp = 1.0 / (((Math.sqrt(2.0) * (kx * Math.sqrt(0.5))) / ky) / Math.sin(th));
} else {
tmp = Math.sqrt((1.0 / (1.0 - Math.cos((kx * -2.0))))) * (ky * (th / Math.sqrt(0.5)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.pow(math.sin(kx), 2.0) <= 0.01: tmp = 1.0 / (((math.sqrt(2.0) * (kx * math.sqrt(0.5))) / ky) / math.sin(th)) else: tmp = math.sqrt((1.0 / (1.0 - math.cos((kx * -2.0))))) * (ky * (th / math.sqrt(0.5))) return tmp
function code(kx, ky, th) tmp = 0.0 if ((sin(kx) ^ 2.0) <= 0.01) tmp = Float64(1.0 / Float64(Float64(Float64(sqrt(2.0) * Float64(kx * sqrt(0.5))) / ky) / sin(th))); else tmp = Float64(sqrt(Float64(1.0 / Float64(1.0 - cos(Float64(kx * -2.0))))) * Float64(ky * Float64(th / sqrt(0.5)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((sin(kx) ^ 2.0) <= 0.01) tmp = 1.0 / (((sqrt(2.0) * (kx * sqrt(0.5))) / ky) / sin(th)); else tmp = sqrt((1.0 / (1.0 - cos((kx * -2.0))))) * (ky * (th / sqrt(0.5))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision], 0.01], N[(1.0 / N[(N[(N[(N[Sqrt[2.0], $MachinePrecision] * N[(kx * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / ky), $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\sin kx}^{2} \leq 0.01:\\
\;\;\;\;\frac{1}{\frac{\frac{\sqrt{2} \cdot \left(kx \cdot \sqrt{0.5}\right)}{ky}}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{1}{1 - \cos \left(kx \cdot -2\right)}} \cdot \left(ky \cdot \frac{th}{\sqrt{0.5}}\right)\\
\end{array}
\end{array}
if (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) < 0.0100000000000000002Initial program 87.7%
Applied egg-rr57.6%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f644.1
Simplified4.1%
lift-*.f64N/A
lift-cos.f64N/A
lift--.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
associate-*l/N/A
clear-numN/A
lower-/.f64N/A
*-lft-identityN/A
lower-/.f644.1
Applied egg-rr4.1%
Taylor expanded in kx around 0
lower-/.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6419.5
Simplified19.5%
if 0.0100000000000000002 < (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) Initial program 99.5%
Applied egg-rr99.4%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f6453.0
Simplified53.0%
Taylor expanded in th around 0
*-commutativeN/A
cos-negN/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower-*.f64N/A
Simplified31.1%
Final simplification25.3%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (cos (* kx -2.0))))
(if (<= ky 3.5e-183)
(*
(sin th)
(/
(fma
ky
(*
(pow ky 6.0)
(fma 0.008333333333333333 (pow ky 6.0) -0.16666666666666666))
ky)
kx))
(if (<= ky 3.5e-161)
(/ 1.0 (* (sqrt (- 1.0 t_1)) (/ (sqrt 0.5) (* ky (sin th)))))
(if (<= ky 2.9e-92)
(* (sin th) (/ (sin ky) (sqrt (fma (* 2.0 (* ky ky)) 0.5 (* kx kx)))))
(if (<= ky 0.0048)
(* (sin th) (/ (sin ky) (sqrt (fma -0.5 t_1 (fma ky ky 0.5)))))
(*
(sin th)
(/ (sin ky) (sqrt (* 0.5 (- 1.0 (cos (* ky -2.0)))))))))))))
double code(double kx, double ky, double th) {
double t_1 = cos((kx * -2.0));
double tmp;
if (ky <= 3.5e-183) {
tmp = sin(th) * (fma(ky, (pow(ky, 6.0) * fma(0.008333333333333333, pow(ky, 6.0), -0.16666666666666666)), ky) / kx);
} else if (ky <= 3.5e-161) {
tmp = 1.0 / (sqrt((1.0 - t_1)) * (sqrt(0.5) / (ky * sin(th))));
} else if (ky <= 2.9e-92) {
tmp = sin(th) * (sin(ky) / sqrt(fma((2.0 * (ky * ky)), 0.5, (kx * kx))));
} else if (ky <= 0.0048) {
tmp = sin(th) * (sin(ky) / sqrt(fma(-0.5, t_1, fma(ky, ky, 0.5))));
} else {
tmp = sin(th) * (sin(ky) / sqrt((0.5 * (1.0 - cos((ky * -2.0))))));
}
return tmp;
}
function code(kx, ky, th) t_1 = cos(Float64(kx * -2.0)) tmp = 0.0 if (ky <= 3.5e-183) tmp = Float64(sin(th) * Float64(fma(ky, Float64((ky ^ 6.0) * fma(0.008333333333333333, (ky ^ 6.0), -0.16666666666666666)), ky) / kx)); elseif (ky <= 3.5e-161) tmp = Float64(1.0 / Float64(sqrt(Float64(1.0 - t_1)) * Float64(sqrt(0.5) / Float64(ky * sin(th))))); elseif (ky <= 2.9e-92) tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(fma(Float64(2.0 * Float64(ky * ky)), 0.5, Float64(kx * kx))))); elseif (ky <= 0.0048) tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(fma(-0.5, t_1, fma(ky, ky, 0.5))))); 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_] := Block[{t$95$1 = N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[ky, 3.5e-183], N[(N[Sin[th], $MachinePrecision] * N[(N[(ky * N[(N[Power[ky, 6.0], $MachinePrecision] * N[(0.008333333333333333 * N[Power[ky, 6.0], $MachinePrecision] + -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + ky), $MachinePrecision] / kx), $MachinePrecision]), $MachinePrecision], If[LessEqual[ky, 3.5e-161], N[(1.0 / N[(N[Sqrt[N[(1.0 - t$95$1), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[0.5], $MachinePrecision] / N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[ky, 2.9e-92], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[(2.0 * N[(ky * ky), $MachinePrecision]), $MachinePrecision] * 0.5 + N[(kx * kx), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[ky, 0.0048], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(-0.5 * t$95$1 + N[(ky * ky + 0.5), $MachinePrecision]), $MachinePrecision]], $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}
t_1 := \cos \left(kx \cdot -2\right)\\
\mathbf{if}\;ky \leq 3.5 \cdot 10^{-183}:\\
\;\;\;\;\sin th \cdot \frac{\mathsf{fma}\left(ky, {ky}^{6} \cdot \mathsf{fma}\left(0.008333333333333333, {ky}^{6}, -0.16666666666666666\right), ky\right)}{kx}\\
\mathbf{elif}\;ky \leq 3.5 \cdot 10^{-161}:\\
\;\;\;\;\frac{1}{\sqrt{1 - t\_1} \cdot \frac{\sqrt{0.5}}{ky \cdot \sin th}}\\
\mathbf{elif}\;ky \leq 2.9 \cdot 10^{-92}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{\mathsf{fma}\left(2 \cdot \left(ky \cdot ky\right), 0.5, kx \cdot kx\right)}}\\
\mathbf{elif}\;ky \leq 0.0048:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{\mathsf{fma}\left(-0.5, t\_1, \mathsf{fma}\left(ky, ky, 0.5\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 < 3.49999999999999991e-183Initial program 91.5%
Taylor expanded in ky around 0
lower-*.f64N/A
+-commutativeN/A
distribute-lft-inN/A
associate-+l+N/A
associate-*r*N/A
*-commutativeN/A
Simplified8.4%
Taylor expanded in kx around 0
lower-sqrt.f64N/A
lower-/.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6413.3
Simplified13.3%
Taylor expanded in kx around inf
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
lower-pow.f6425.3
Simplified25.3%
if 3.49999999999999991e-183 < ky < 3.5000000000000002e-161Initial program 75.3%
Applied egg-rr62.9%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f6463.0
Simplified63.0%
lift-*.f64N/A
lift-cos.f64N/A
lift--.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
associate-*l/N/A
clear-numN/A
lower-/.f64N/A
*-lft-identityN/A
lower-/.f6463.0
Applied egg-rr62.9%
Taylor expanded in kx around inf
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
cos-negN/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower-sqrt.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6463.1
Simplified63.1%
if 3.5000000000000002e-161 < ky < 2.89999999999999985e-92Initial program 99.6%
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-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
count-2N/A
cos-diffN/A
cos-sin-sumN/A
lower--.f64N/A
count-2N/A
lower-cos.f64N/A
lower-+.f6464.6
lift-pow.f64N/A
Applied egg-rr55.5%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6438.9
Simplified38.9%
Taylor expanded in ky around 0
lower-*.f64N/A
unpow2N/A
lower-*.f6473.9
Simplified73.9%
if 2.89999999999999985e-92 < ky < 0.00479999999999999958Initial program 99.6%
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-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
count-2N/A
cos-diffN/A
cos-sin-sumN/A
lower--.f64N/A
count-2N/A
lower-cos.f64N/A
lower-+.f6473.9
lift-pow.f64N/A
Applied egg-rr72.9%
Taylor expanded in ky around 0
+-commutativeN/A
associate-+l+N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-fma.f6472.9
Simplified72.9%
if 0.00479999999999999958 < ky Initial program 99.7%
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-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
count-2N/A
cos-diffN/A
cos-sin-sumN/A
lower--.f64N/A
count-2N/A
lower-cos.f64N/A
lower-+.f6499.5
lift-pow.f64N/A
Applied egg-rr99.5%
Taylor expanded in kx around 0
lower-*.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6455.4
Simplified55.4%
Final simplification37.5%
(FPCore (kx ky th) :precision binary64 (if (<= (pow (sin kx) 2.0) 0.01) (* (sin th) (/ 1.0 (/ (* (sqrt 2.0) (* kx (sqrt 0.5))) ky))) (* (sqrt (/ 1.0 (- 1.0 (cos (* kx -2.0))))) (* ky (/ th (sqrt 0.5))))))
double code(double kx, double ky, double th) {
double tmp;
if (pow(sin(kx), 2.0) <= 0.01) {
tmp = sin(th) * (1.0 / ((sqrt(2.0) * (kx * sqrt(0.5))) / ky));
} else {
tmp = sqrt((1.0 / (1.0 - cos((kx * -2.0))))) * (ky * (th / sqrt(0.5)));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if ((sin(kx) ** 2.0d0) <= 0.01d0) then
tmp = sin(th) * (1.0d0 / ((sqrt(2.0d0) * (kx * sqrt(0.5d0))) / ky))
else
tmp = sqrt((1.0d0 / (1.0d0 - cos((kx * (-2.0d0)))))) * (ky * (th / sqrt(0.5d0)))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.pow(Math.sin(kx), 2.0) <= 0.01) {
tmp = Math.sin(th) * (1.0 / ((Math.sqrt(2.0) * (kx * Math.sqrt(0.5))) / ky));
} else {
tmp = Math.sqrt((1.0 / (1.0 - Math.cos((kx * -2.0))))) * (ky * (th / Math.sqrt(0.5)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.pow(math.sin(kx), 2.0) <= 0.01: tmp = math.sin(th) * (1.0 / ((math.sqrt(2.0) * (kx * math.sqrt(0.5))) / ky)) else: tmp = math.sqrt((1.0 / (1.0 - math.cos((kx * -2.0))))) * (ky * (th / math.sqrt(0.5))) return tmp
function code(kx, ky, th) tmp = 0.0 if ((sin(kx) ^ 2.0) <= 0.01) tmp = Float64(sin(th) * Float64(1.0 / Float64(Float64(sqrt(2.0) * Float64(kx * sqrt(0.5))) / ky))); else tmp = Float64(sqrt(Float64(1.0 / Float64(1.0 - cos(Float64(kx * -2.0))))) * Float64(ky * Float64(th / sqrt(0.5)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((sin(kx) ^ 2.0) <= 0.01) tmp = sin(th) * (1.0 / ((sqrt(2.0) * (kx * sqrt(0.5))) / ky)); else tmp = sqrt((1.0 / (1.0 - cos((kx * -2.0))))) * (ky * (th / sqrt(0.5))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision], 0.01], N[(N[Sin[th], $MachinePrecision] * N[(1.0 / N[(N[(N[Sqrt[2.0], $MachinePrecision] * N[(kx * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\sin kx}^{2} \leq 0.01:\\
\;\;\;\;\sin th \cdot \frac{1}{\frac{\sqrt{2} \cdot \left(kx \cdot \sqrt{0.5}\right)}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{1}{1 - \cos \left(kx \cdot -2\right)}} \cdot \left(ky \cdot \frac{th}{\sqrt{0.5}}\right)\\
\end{array}
\end{array}
if (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) < 0.0100000000000000002Initial program 87.7%
Applied egg-rr57.6%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f644.1
Simplified4.1%
Taylor expanded in kx around 0
lower-/.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6419.5
Simplified19.5%
if 0.0100000000000000002 < (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) Initial program 99.5%
Applied egg-rr99.4%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f6453.0
Simplified53.0%
Taylor expanded in th around 0
*-commutativeN/A
cos-negN/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower-*.f64N/A
Simplified31.1%
Final simplification25.3%
(FPCore (kx ky th)
:precision binary64
(if (<= kx 0.86)
(* (sin th) (/ (sin ky) (sqrt (fma (- 1.0 (cos (+ ky ky))) 0.5 (* kx kx)))))
(*
(sin th)
(/ 1.0 (/ (* (sqrt (- 1.0 (cos (* kx -2.0)))) (sqrt 0.5)) (sin ky))))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.86) {
tmp = sin(th) * (sin(ky) / sqrt(fma((1.0 - cos((ky + ky))), 0.5, (kx * kx))));
} else {
tmp = sin(th) * (1.0 / ((sqrt((1.0 - cos((kx * -2.0)))) * sqrt(0.5)) / sin(ky)));
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (kx <= 0.86) tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(fma(Float64(1.0 - cos(Float64(ky + ky))), 0.5, Float64(kx * kx))))); else tmp = Float64(sin(th) * Float64(1.0 / Float64(Float64(sqrt(Float64(1.0 - cos(Float64(kx * -2.0)))) * sqrt(0.5)) / sin(ky)))); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[kx, 0.86], 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[(kx * kx), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(1.0 / N[(N[(N[Sqrt[N[(1.0 - N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 0.86:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{\mathsf{fma}\left(1 - \cos \left(ky + ky\right), 0.5, kx \cdot kx\right)}}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{1}{\frac{\sqrt{1 - \cos \left(kx \cdot -2\right)} \cdot \sqrt{0.5}}{\sin ky}}\\
\end{array}
\end{array}
if kx < 0.859999999999999987Initial program 91.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-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
count-2N/A
cos-diffN/A
cos-sin-sumN/A
lower--.f64N/A
count-2N/A
lower-cos.f64N/A
lower-+.f6483.9
lift-pow.f64N/A
Applied egg-rr70.7%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6458.2
Simplified58.2%
if 0.859999999999999987 < kx Initial program 99.5%
Applied egg-rr99.2%
lift-+.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
flip-+N/A
lift-*.f64N/A
lift-*.f64N/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
flip-+N/A
lift-+.f64N/A
lower-fma.f6433.7
Applied egg-rr99.2%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f6466.7
Simplified66.7%
Final simplification60.5%
(FPCore (kx ky th)
:precision binary64
(if (<= (pow (sin kx) 2.0) 0.01)
(* (sin th) (/ 1.0 (/ (* (sqrt 2.0) (* kx (sqrt 0.5))) ky)))
(*
(fma th (* -0.16666666666666666 (* th th)) th)
(* ky (sqrt (/ 1.0 (fma -0.5 (cos (* kx -2.0)) 0.5)))))))
double code(double kx, double ky, double th) {
double tmp;
if (pow(sin(kx), 2.0) <= 0.01) {
tmp = sin(th) * (1.0 / ((sqrt(2.0) * (kx * sqrt(0.5))) / ky));
} else {
tmp = fma(th, (-0.16666666666666666 * (th * th)), th) * (ky * sqrt((1.0 / fma(-0.5, cos((kx * -2.0)), 0.5))));
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if ((sin(kx) ^ 2.0) <= 0.01) tmp = Float64(sin(th) * Float64(1.0 / Float64(Float64(sqrt(2.0) * Float64(kx * sqrt(0.5))) / ky))); else tmp = Float64(fma(th, Float64(-0.16666666666666666 * Float64(th * th)), th) * Float64(ky * sqrt(Float64(1.0 / fma(-0.5, cos(Float64(kx * -2.0)), 0.5))))); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision], 0.01], N[(N[Sin[th], $MachinePrecision] * N[(1.0 / N[(N[(N[Sqrt[2.0], $MachinePrecision] * N[(kx * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(th * N[(-0.16666666666666666 * N[(th * th), $MachinePrecision]), $MachinePrecision] + th), $MachinePrecision] * N[(ky * N[Sqrt[N[(1.0 / N[(-0.5 * N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\sin kx}^{2} \leq 0.01:\\
\;\;\;\;\sin th \cdot \frac{1}{\frac{\sqrt{2} \cdot \left(kx \cdot \sqrt{0.5}\right)}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(th, -0.16666666666666666 \cdot \left(th \cdot th\right), th\right) \cdot \left(ky \cdot \sqrt{\frac{1}{\mathsf{fma}\left(-0.5, \cos \left(kx \cdot -2\right), 0.5\right)}}\right)\\
\end{array}
\end{array}
if (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) < 0.0100000000000000002Initial program 87.7%
Applied egg-rr57.6%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f644.1
Simplified4.1%
Taylor expanded in kx around 0
lower-/.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6419.5
Simplified19.5%
if 0.0100000000000000002 < (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) Initial program 99.5%
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-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
count-2N/A
cos-diffN/A
cos-sin-sumN/A
lower--.f64N/A
count-2N/A
lower-cos.f64N/A
lower-+.f6499.5
lift-pow.f64N/A
Applied egg-rr99.4%
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-*.f6453.8
Simplified53.8%
Taylor expanded in ky around 0
lower-*.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-*.f6430.5
Simplified30.5%
Final simplification25.0%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (* ky (sin th))) (t_2 (- 1.0 (cos (* kx -2.0)))))
(if (<= ky 3.5e-183)
(*
(sin th)
(/
(fma
ky
(*
(pow ky 6.0)
(fma 0.008333333333333333 (pow ky 6.0) -0.16666666666666666))
ky)
kx))
(if (<= ky 3.5e-161)
(/ 1.0 (* (sqrt t_2) (/ (sqrt 0.5) t_1)))
(if (<= ky 2.9e-92)
(* (sin th) (/ (sin ky) (sqrt (fma (* 2.0 (* ky ky)) 0.5 (* kx kx)))))
(if (<= ky 8.5e-5)
(* (sqrt (/ 1.0 t_2)) (* t_1 (sqrt 2.0)))
(*
(sin th)
(/ (sin ky) (sqrt (* 0.5 (- 1.0 (cos (* ky -2.0)))))))))))))
double code(double kx, double ky, double th) {
double t_1 = ky * sin(th);
double t_2 = 1.0 - cos((kx * -2.0));
double tmp;
if (ky <= 3.5e-183) {
tmp = sin(th) * (fma(ky, (pow(ky, 6.0) * fma(0.008333333333333333, pow(ky, 6.0), -0.16666666666666666)), ky) / kx);
} else if (ky <= 3.5e-161) {
tmp = 1.0 / (sqrt(t_2) * (sqrt(0.5) / t_1));
} else if (ky <= 2.9e-92) {
tmp = sin(th) * (sin(ky) / sqrt(fma((2.0 * (ky * ky)), 0.5, (kx * kx))));
} else if (ky <= 8.5e-5) {
tmp = sqrt((1.0 / t_2)) * (t_1 * sqrt(2.0));
} else {
tmp = sin(th) * (sin(ky) / sqrt((0.5 * (1.0 - cos((ky * -2.0))))));
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(ky * sin(th)) t_2 = Float64(1.0 - cos(Float64(kx * -2.0))) tmp = 0.0 if (ky <= 3.5e-183) tmp = Float64(sin(th) * Float64(fma(ky, Float64((ky ^ 6.0) * fma(0.008333333333333333, (ky ^ 6.0), -0.16666666666666666)), ky) / kx)); elseif (ky <= 3.5e-161) tmp = Float64(1.0 / Float64(sqrt(t_2) * Float64(sqrt(0.5) / t_1))); elseif (ky <= 2.9e-92) tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(fma(Float64(2.0 * Float64(ky * ky)), 0.5, Float64(kx * kx))))); elseif (ky <= 8.5e-5) tmp = Float64(sqrt(Float64(1.0 / t_2)) * Float64(t_1 * sqrt(2.0))); 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_] := Block[{t$95$1 = N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 - N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[ky, 3.5e-183], N[(N[Sin[th], $MachinePrecision] * N[(N[(ky * N[(N[Power[ky, 6.0], $MachinePrecision] * N[(0.008333333333333333 * N[Power[ky, 6.0], $MachinePrecision] + -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + ky), $MachinePrecision] / kx), $MachinePrecision]), $MachinePrecision], If[LessEqual[ky, 3.5e-161], N[(1.0 / N[(N[Sqrt[t$95$2], $MachinePrecision] * N[(N[Sqrt[0.5], $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[ky, 2.9e-92], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[(2.0 * N[(ky * ky), $MachinePrecision]), $MachinePrecision] * 0.5 + N[(kx * kx), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[ky, 8.5e-5], N[(N[Sqrt[N[(1.0 / t$95$2), $MachinePrecision]], $MachinePrecision] * N[(t$95$1 * N[Sqrt[2.0], $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}
t_1 := ky \cdot \sin th\\
t_2 := 1 - \cos \left(kx \cdot -2\right)\\
\mathbf{if}\;ky \leq 3.5 \cdot 10^{-183}:\\
\;\;\;\;\sin th \cdot \frac{\mathsf{fma}\left(ky, {ky}^{6} \cdot \mathsf{fma}\left(0.008333333333333333, {ky}^{6}, -0.16666666666666666\right), ky\right)}{kx}\\
\mathbf{elif}\;ky \leq 3.5 \cdot 10^{-161}:\\
\;\;\;\;\frac{1}{\sqrt{t\_2} \cdot \frac{\sqrt{0.5}}{t\_1}}\\
\mathbf{elif}\;ky \leq 2.9 \cdot 10^{-92}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{\mathsf{fma}\left(2 \cdot \left(ky \cdot ky\right), 0.5, kx \cdot kx\right)}}\\
\mathbf{elif}\;ky \leq 8.5 \cdot 10^{-5}:\\
\;\;\;\;\sqrt{\frac{1}{t\_2}} \cdot \left(t\_1 \cdot \sqrt{2}\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 < 3.49999999999999991e-183Initial program 91.5%
Taylor expanded in ky around 0
lower-*.f64N/A
+-commutativeN/A
distribute-lft-inN/A
associate-+l+N/A
associate-*r*N/A
*-commutativeN/A
Simplified8.4%
Taylor expanded in kx around 0
lower-sqrt.f64N/A
lower-/.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6413.3
Simplified13.3%
Taylor expanded in kx around inf
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
lower-pow.f6425.3
Simplified25.3%
if 3.49999999999999991e-183 < ky < 3.5000000000000002e-161Initial program 75.3%
Applied egg-rr62.9%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f6463.0
Simplified63.0%
lift-*.f64N/A
lift-cos.f64N/A
lift--.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
associate-*l/N/A
clear-numN/A
lower-/.f64N/A
*-lft-identityN/A
lower-/.f6463.0
Applied egg-rr62.9%
Taylor expanded in kx around inf
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
cos-negN/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower-sqrt.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6463.1
Simplified63.1%
if 3.5000000000000002e-161 < ky < 2.89999999999999985e-92Initial program 99.6%
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-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
count-2N/A
cos-diffN/A
cos-sin-sumN/A
lower--.f64N/A
count-2N/A
lower-cos.f64N/A
lower-+.f6464.6
lift-pow.f64N/A
Applied egg-rr55.5%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6438.9
Simplified38.9%
Taylor expanded in ky around 0
lower-*.f64N/A
unpow2N/A
lower-*.f6473.9
Simplified73.9%
if 2.89999999999999985e-92 < ky < 8.500000000000001e-5Initial program 99.6%
Applied egg-rr73.0%
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
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f6472.1
Simplified72.1%
if 8.500000000000001e-5 < ky Initial program 99.7%
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-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
count-2N/A
cos-diffN/A
cos-sin-sumN/A
lower--.f64N/A
count-2N/A
lower-cos.f64N/A
lower-+.f6499.5
lift-pow.f64N/A
Applied egg-rr99.5%
Taylor expanded in kx around 0
lower-*.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6455.4
Simplified55.4%
Final simplification37.5%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (* ky (sin th))) (t_2 (- 1.0 (cos (* kx -2.0)))))
(if (<= ky 3.5e-183)
(*
(sin th)
(/
(fma
ky
(*
(pow ky 6.0)
(fma 0.008333333333333333 (pow ky 6.0) -0.16666666666666666))
ky)
kx))
(if (<= ky 3.5e-161)
(/ 1.0 (* (sqrt t_2) (/ (sqrt 0.5) t_1)))
(if (<= ky 2.9e-92)
(* (sin th) (/ (sin ky) (sqrt (fma (* 2.0 (* ky ky)) 0.5 (* kx kx)))))
(if (<= ky 8.5e-5)
(* (sqrt (/ 1.0 t_2)) (* t_1 (sqrt 2.0)))
(*
(sin ky)
(/ (sin th) (sqrt (fma -0.5 (cos (* ky -2.0)) 0.5))))))))))
double code(double kx, double ky, double th) {
double t_1 = ky * sin(th);
double t_2 = 1.0 - cos((kx * -2.0));
double tmp;
if (ky <= 3.5e-183) {
tmp = sin(th) * (fma(ky, (pow(ky, 6.0) * fma(0.008333333333333333, pow(ky, 6.0), -0.16666666666666666)), ky) / kx);
} else if (ky <= 3.5e-161) {
tmp = 1.0 / (sqrt(t_2) * (sqrt(0.5) / t_1));
} else if (ky <= 2.9e-92) {
tmp = sin(th) * (sin(ky) / sqrt(fma((2.0 * (ky * ky)), 0.5, (kx * kx))));
} else if (ky <= 8.5e-5) {
tmp = sqrt((1.0 / t_2)) * (t_1 * sqrt(2.0));
} else {
tmp = sin(ky) * (sin(th) / sqrt(fma(-0.5, cos((ky * -2.0)), 0.5)));
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(ky * sin(th)) t_2 = Float64(1.0 - cos(Float64(kx * -2.0))) tmp = 0.0 if (ky <= 3.5e-183) tmp = Float64(sin(th) * Float64(fma(ky, Float64((ky ^ 6.0) * fma(0.008333333333333333, (ky ^ 6.0), -0.16666666666666666)), ky) / kx)); elseif (ky <= 3.5e-161) tmp = Float64(1.0 / Float64(sqrt(t_2) * Float64(sqrt(0.5) / t_1))); elseif (ky <= 2.9e-92) tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(fma(Float64(2.0 * Float64(ky * ky)), 0.5, Float64(kx * kx))))); elseif (ky <= 8.5e-5) tmp = Float64(sqrt(Float64(1.0 / t_2)) * Float64(t_1 * sqrt(2.0))); else tmp = Float64(sin(ky) * Float64(sin(th) / sqrt(fma(-0.5, cos(Float64(ky * -2.0)), 0.5)))); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 - N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[ky, 3.5e-183], N[(N[Sin[th], $MachinePrecision] * N[(N[(ky * N[(N[Power[ky, 6.0], $MachinePrecision] * N[(0.008333333333333333 * N[Power[ky, 6.0], $MachinePrecision] + -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + ky), $MachinePrecision] / kx), $MachinePrecision]), $MachinePrecision], If[LessEqual[ky, 3.5e-161], N[(1.0 / N[(N[Sqrt[t$95$2], $MachinePrecision] * N[(N[Sqrt[0.5], $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[ky, 2.9e-92], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[(2.0 * N[(ky * ky), $MachinePrecision]), $MachinePrecision] * 0.5 + N[(kx * kx), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[ky, 8.5e-5], N[(N[Sqrt[N[(1.0 / t$95$2), $MachinePrecision]], $MachinePrecision] * N[(t$95$1 * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := ky \cdot \sin th\\
t_2 := 1 - \cos \left(kx \cdot -2\right)\\
\mathbf{if}\;ky \leq 3.5 \cdot 10^{-183}:\\
\;\;\;\;\sin th \cdot \frac{\mathsf{fma}\left(ky, {ky}^{6} \cdot \mathsf{fma}\left(0.008333333333333333, {ky}^{6}, -0.16666666666666666\right), ky\right)}{kx}\\
\mathbf{elif}\;ky \leq 3.5 \cdot 10^{-161}:\\
\;\;\;\;\frac{1}{\sqrt{t\_2} \cdot \frac{\sqrt{0.5}}{t\_1}}\\
\mathbf{elif}\;ky \leq 2.9 \cdot 10^{-92}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{\mathsf{fma}\left(2 \cdot \left(ky \cdot ky\right), 0.5, kx \cdot kx\right)}}\\
\mathbf{elif}\;ky \leq 8.5 \cdot 10^{-5}:\\
\;\;\;\;\sqrt{\frac{1}{t\_2}} \cdot \left(t\_1 \cdot \sqrt{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sqrt{\mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), 0.5\right)}}\\
\end{array}
\end{array}
if ky < 3.49999999999999991e-183Initial program 91.5%
Taylor expanded in ky around 0
lower-*.f64N/A
+-commutativeN/A
distribute-lft-inN/A
associate-+l+N/A
associate-*r*N/A
*-commutativeN/A
Simplified8.4%
Taylor expanded in kx around 0
lower-sqrt.f64N/A
lower-/.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6413.3
Simplified13.3%
Taylor expanded in kx around inf
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
lower-pow.f6425.3
Simplified25.3%
if 3.49999999999999991e-183 < ky < 3.5000000000000002e-161Initial program 75.3%
Applied egg-rr62.9%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f6463.0
Simplified63.0%
lift-*.f64N/A
lift-cos.f64N/A
lift--.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
associate-*l/N/A
clear-numN/A
lower-/.f64N/A
*-lft-identityN/A
lower-/.f6463.0
Applied egg-rr62.9%
Taylor expanded in kx around inf
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
cos-negN/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower-sqrt.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6463.1
Simplified63.1%
if 3.5000000000000002e-161 < ky < 2.89999999999999985e-92Initial program 99.6%
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-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
count-2N/A
cos-diffN/A
cos-sin-sumN/A
lower--.f64N/A
count-2N/A
lower-cos.f64N/A
lower-+.f6464.6
lift-pow.f64N/A
Applied egg-rr55.5%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6438.9
Simplified38.9%
Taylor expanded in ky around 0
lower-*.f64N/A
unpow2N/A
lower-*.f6473.9
Simplified73.9%
if 2.89999999999999985e-92 < ky < 8.500000000000001e-5Initial program 99.6%
Applied egg-rr73.0%
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
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f6472.1
Simplified72.1%
if 8.500000000000001e-5 < ky Initial program 99.7%
Applied egg-rr99.4%
Taylor expanded in kx around 0
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6455.3
Simplified55.3%
Final simplification37.5%
(FPCore (kx ky th)
:precision binary64
(if (<= kx 5e-201)
(* (sin th) (/ (sin ky) (sqrt (fma (* 2.0 (* ky ky)) 0.5 (* kx kx)))))
(if (<= kx 0.86)
(*
(fma th (* -0.16666666666666666 (* th th)) 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 (fma -0.5 (cos (* kx -2.0)) 0.5)))))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 5e-201) {
tmp = sin(th) * (sin(ky) / sqrt(fma((2.0 * (ky * ky)), 0.5, (kx * kx))));
} else if (kx <= 0.86) {
tmp = fma(th, (-0.16666666666666666 * (th * th)), 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(fma(-0.5, cos((kx * -2.0)), 0.5)));
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (kx <= 5e-201) tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(fma(Float64(2.0 * Float64(ky * ky)), 0.5, Float64(kx * kx))))); elseif (kx <= 0.86) tmp = Float64(fma(th, Float64(-0.16666666666666666 * Float64(th * th)), 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(fma(-0.5, cos(Float64(kx * -2.0)), 0.5)))); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[kx, 5e-201], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[(2.0 * N[(ky * ky), $MachinePrecision]), $MachinePrecision] * 0.5 + N[(kx * kx), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[kx, 0.86], N[(N[(th * N[(-0.16666666666666666 * N[(th * th), $MachinePrecision]), $MachinePrecision] + 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[(-0.5 * N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 5 \cdot 10^{-201}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{\mathsf{fma}\left(2 \cdot \left(ky \cdot ky\right), 0.5, kx \cdot kx\right)}}\\
\mathbf{elif}\;kx \leq 0.86:\\
\;\;\;\;\mathsf{fma}\left(th, -0.16666666666666666 \cdot \left(th \cdot th\right), th\right) \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 \frac{\sin ky}{\sqrt{\mathsf{fma}\left(-0.5, \cos \left(kx \cdot -2\right), 0.5\right)}}\\
\end{array}
\end{array}
if kx < 4.9999999999999999e-201Initial program 91.6%
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-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
count-2N/A
cos-diffN/A
cos-sin-sumN/A
lower--.f64N/A
count-2N/A
lower-cos.f64N/A
lower-+.f6483.4
lift-pow.f64N/A
Applied egg-rr75.5%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6450.2
Simplified50.2%
Taylor expanded in ky around 0
lower-*.f64N/A
unpow2N/A
lower-*.f6427.7
Simplified27.7%
if 4.9999999999999999e-201 < kx < 0.859999999999999987Initial program 90.6%
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-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
count-2N/A
cos-diffN/A
cos-sin-sumN/A
lower--.f64N/A
count-2N/A
lower-cos.f64N/A
lower-+.f6485.8
lift-pow.f64N/A
Applied egg-rr54.0%
Taylor expanded in th around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6432.5
Simplified32.5%
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-*.f6451.3
Simplified51.3%
if 0.859999999999999987 < kx Initial program 99.5%
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-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
count-2N/A
cos-diffN/A
cos-sin-sumN/A
lower--.f64N/A
count-2N/A
lower-cos.f64N/A
lower-+.f6499.5
lift-pow.f64N/A
Applied egg-rr99.2%
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-*.f6466.6
Simplified66.6%
Final simplification42.2%
(FPCore (kx ky th) :precision binary64 (if (<= kx 0.86) (* (sin th) (/ (sin ky) (sqrt (fma (- 1.0 (cos (+ ky ky))) 0.5 (* kx kx))))) (* (sin ky) (/ (sin th) (sqrt (* 0.5 (- 1.0 (cos (* kx -2.0)))))))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.86) {
tmp = sin(th) * (sin(ky) / sqrt(fma((1.0 - cos((ky + ky))), 0.5, (kx * kx))));
} else {
tmp = sin(ky) * (sin(th) / sqrt((0.5 * (1.0 - cos((kx * -2.0))))));
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (kx <= 0.86) tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(fma(Float64(1.0 - cos(Float64(ky + ky))), 0.5, Float64(kx * kx))))); else tmp = Float64(sin(ky) * Float64(sin(th) / sqrt(Float64(0.5 * Float64(1.0 - cos(Float64(kx * -2.0))))))); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[kx, 0.86], 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[(kx * kx), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[(0.5 * 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 0.86:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{\mathsf{fma}\left(1 - \cos \left(ky + ky\right), 0.5, kx \cdot kx\right)}}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sqrt{0.5 \cdot \left(1 - \cos \left(kx \cdot -2\right)\right)}}\\
\end{array}
\end{array}
if kx < 0.859999999999999987Initial program 91.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-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
count-2N/A
cos-diffN/A
cos-sin-sumN/A
lower--.f64N/A
count-2N/A
lower-cos.f64N/A
lower-+.f6483.9
lift-pow.f64N/A
Applied egg-rr70.7%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6458.2
Simplified58.2%
if 0.859999999999999987 < 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-*.f6466.6
Simplified66.6%
Final simplification60.5%
(FPCore (kx ky th)
:precision binary64
(if (<= kx 5e-201)
(* (sin th) (/ (sin ky) (sqrt (fma (* 2.0 (* ky ky)) 0.5 (* kx kx)))))
(if (<= kx 0.86)
(*
(fma th (* -0.16666666666666666 (* th th)) 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))))))
(* (* ky (sin th)) (sqrt (/ 1.0 (fma -0.5 (cos (* kx -2.0)) 0.5)))))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 5e-201) {
tmp = sin(th) * (sin(ky) / sqrt(fma((2.0 * (ky * ky)), 0.5, (kx * kx))));
} else if (kx <= 0.86) {
tmp = fma(th, (-0.16666666666666666 * (th * th)), 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 = (ky * sin(th)) * sqrt((1.0 / fma(-0.5, cos((kx * -2.0)), 0.5)));
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (kx <= 5e-201) tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(fma(Float64(2.0 * Float64(ky * ky)), 0.5, Float64(kx * kx))))); elseif (kx <= 0.86) tmp = Float64(fma(th, Float64(-0.16666666666666666 * Float64(th * th)), 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(Float64(ky * sin(th)) * sqrt(Float64(1.0 / fma(-0.5, cos(Float64(kx * -2.0)), 0.5)))); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[kx, 5e-201], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[(2.0 * N[(ky * ky), $MachinePrecision]), $MachinePrecision] * 0.5 + N[(kx * kx), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[kx, 0.86], N[(N[(th * N[(-0.16666666666666666 * N[(th * th), $MachinePrecision]), $MachinePrecision] + 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[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(-0.5 * N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 5 \cdot 10^{-201}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{\mathsf{fma}\left(2 \cdot \left(ky \cdot ky\right), 0.5, kx \cdot kx\right)}}\\
\mathbf{elif}\;kx \leq 0.86:\\
\;\;\;\;\mathsf{fma}\left(th, -0.16666666666666666 \cdot \left(th \cdot th\right), th\right) \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}:\\
\;\;\;\;\left(ky \cdot \sin th\right) \cdot \sqrt{\frac{1}{\mathsf{fma}\left(-0.5, \cos \left(kx \cdot -2\right), 0.5\right)}}\\
\end{array}
\end{array}
if kx < 4.9999999999999999e-201Initial program 91.6%
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-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
count-2N/A
cos-diffN/A
cos-sin-sumN/A
lower--.f64N/A
count-2N/A
lower-cos.f64N/A
lower-+.f6483.4
lift-pow.f64N/A
Applied egg-rr75.5%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6450.2
Simplified50.2%
Taylor expanded in ky around 0
lower-*.f64N/A
unpow2N/A
lower-*.f6427.7
Simplified27.7%
if 4.9999999999999999e-201 < kx < 0.859999999999999987Initial program 90.6%
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-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
count-2N/A
cos-diffN/A
cos-sin-sumN/A
lower--.f64N/A
count-2N/A
lower-cos.f64N/A
lower-+.f6485.8
lift-pow.f64N/A
Applied egg-rr54.0%
Taylor expanded in th around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6432.5
Simplified32.5%
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-*.f6451.3
Simplified51.3%
if 0.859999999999999987 < kx Initial program 99.5%
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-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
count-2N/A
cos-diffN/A
cos-sin-sumN/A
lower--.f64N/A
count-2N/A
lower-cos.f64N/A
lower-+.f6499.5
lift-pow.f64N/A
Applied egg-rr99.2%
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-*.f6459.6
Simplified59.6%
Final simplification40.3%
(FPCore (kx ky th)
:precision binary64
(if (<= kx 5e-201)
(* (sin th) (/ (sin ky) (sqrt (fma (* 2.0 (* ky ky)) 0.5 (* kx kx)))))
(if (<= kx 0.86)
(*
(fma th (* -0.16666666666666666 (* th th)) th)
(/
(sin ky)
(sqrt
(fma
(- 1.0 (cos (+ ky ky)))
0.5
(*
(* kx kx)
(fma
(* kx kx)
(fma (* kx kx) 0.044444444444444446 -0.3333333333333333)
1.0))))))
(* (* ky (sin th)) (sqrt (/ 1.0 (fma -0.5 (cos (* kx -2.0)) 0.5)))))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 5e-201) {
tmp = sin(th) * (sin(ky) / sqrt(fma((2.0 * (ky * ky)), 0.5, (kx * kx))));
} else if (kx <= 0.86) {
tmp = fma(th, (-0.16666666666666666 * (th * th)), th) * (sin(ky) / sqrt(fma((1.0 - cos((ky + ky))), 0.5, ((kx * kx) * fma((kx * kx), fma((kx * kx), 0.044444444444444446, -0.3333333333333333), 1.0)))));
} else {
tmp = (ky * sin(th)) * sqrt((1.0 / fma(-0.5, cos((kx * -2.0)), 0.5)));
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (kx <= 5e-201) tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(fma(Float64(2.0 * Float64(ky * ky)), 0.5, Float64(kx * kx))))); elseif (kx <= 0.86) tmp = Float64(fma(th, Float64(-0.16666666666666666 * Float64(th * th)), 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), 0.044444444444444446, -0.3333333333333333), 1.0)))))); else tmp = Float64(Float64(ky * sin(th)) * sqrt(Float64(1.0 / fma(-0.5, cos(Float64(kx * -2.0)), 0.5)))); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[kx, 5e-201], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[(2.0 * N[(ky * ky), $MachinePrecision]), $MachinePrecision] * 0.5 + N[(kx * kx), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[kx, 0.86], N[(N[(th * N[(-0.16666666666666666 * N[(th * th), $MachinePrecision]), $MachinePrecision] + 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] * 0.044444444444444446 + -0.3333333333333333), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(-0.5 * N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 5 \cdot 10^{-201}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{\mathsf{fma}\left(2 \cdot \left(ky \cdot ky\right), 0.5, kx \cdot kx\right)}}\\
\mathbf{elif}\;kx \leq 0.86:\\
\;\;\;\;\mathsf{fma}\left(th, -0.16666666666666666 \cdot \left(th \cdot th\right), th\right) \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, 0.044444444444444446, -0.3333333333333333\right), 1\right)\right)}}\\
\mathbf{else}:\\
\;\;\;\;\left(ky \cdot \sin th\right) \cdot \sqrt{\frac{1}{\mathsf{fma}\left(-0.5, \cos \left(kx \cdot -2\right), 0.5\right)}}\\
\end{array}
\end{array}
if kx < 4.9999999999999999e-201Initial program 91.6%
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-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
count-2N/A
cos-diffN/A
cos-sin-sumN/A
lower--.f64N/A
count-2N/A
lower-cos.f64N/A
lower-+.f6483.4
lift-pow.f64N/A
Applied egg-rr75.5%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6450.2
Simplified50.2%
Taylor expanded in ky around 0
lower-*.f64N/A
unpow2N/A
lower-*.f6427.7
Simplified27.7%
if 4.9999999999999999e-201 < kx < 0.859999999999999987Initial program 90.6%
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-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
count-2N/A
cos-diffN/A
cos-sin-sumN/A
lower--.f64N/A
count-2N/A
lower-cos.f64N/A
lower-+.f6485.8
lift-pow.f64N/A
Applied egg-rr54.0%
Taylor expanded in th around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6432.5
Simplified32.5%
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-*.f6451.3
Simplified51.3%
if 0.859999999999999987 < kx Initial program 99.5%
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-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
count-2N/A
cos-diffN/A
cos-sin-sumN/A
lower--.f64N/A
count-2N/A
lower-cos.f64N/A
lower-+.f6499.5
lift-pow.f64N/A
Applied egg-rr99.2%
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-*.f6459.6
Simplified59.6%
Final simplification40.3%
(FPCore (kx ky th)
:precision binary64
(if (<= kx 5e-201)
(* (sin th) (/ (sin ky) (sqrt (fma (* 2.0 (* ky ky)) 0.5 (* kx kx)))))
(if (<= kx 0.86)
(*
(fma th (* -0.16666666666666666 (* th th)) th)
(/
(sin ky)
(sqrt
(fma
(- 1.0 (cos (+ ky ky)))
0.5
(* (* kx kx) (fma (* kx kx) -0.3333333333333333 1.0))))))
(* (* ky (sin th)) (sqrt (/ 1.0 (fma -0.5 (cos (* kx -2.0)) 0.5)))))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 5e-201) {
tmp = sin(th) * (sin(ky) / sqrt(fma((2.0 * (ky * ky)), 0.5, (kx * kx))));
} else if (kx <= 0.86) {
tmp = fma(th, (-0.16666666666666666 * (th * th)), th) * (sin(ky) / sqrt(fma((1.0 - cos((ky + ky))), 0.5, ((kx * kx) * fma((kx * kx), -0.3333333333333333, 1.0)))));
} else {
tmp = (ky * sin(th)) * sqrt((1.0 / fma(-0.5, cos((kx * -2.0)), 0.5)));
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (kx <= 5e-201) tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(fma(Float64(2.0 * Float64(ky * ky)), 0.5, Float64(kx * kx))))); elseif (kx <= 0.86) tmp = Float64(fma(th, Float64(-0.16666666666666666 * Float64(th * th)), th) * Float64(sin(ky) / sqrt(fma(Float64(1.0 - cos(Float64(ky + ky))), 0.5, Float64(Float64(kx * kx) * fma(Float64(kx * kx), -0.3333333333333333, 1.0)))))); else tmp = Float64(Float64(ky * sin(th)) * sqrt(Float64(1.0 / fma(-0.5, cos(Float64(kx * -2.0)), 0.5)))); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[kx, 5e-201], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[(2.0 * N[(ky * ky), $MachinePrecision]), $MachinePrecision] * 0.5 + N[(kx * kx), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[kx, 0.86], N[(N[(th * N[(-0.16666666666666666 * N[(th * th), $MachinePrecision]), $MachinePrecision] + 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] * -0.3333333333333333 + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(-0.5 * N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 5 \cdot 10^{-201}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{\mathsf{fma}\left(2 \cdot \left(ky \cdot ky\right), 0.5, kx \cdot kx\right)}}\\
\mathbf{elif}\;kx \leq 0.86:\\
\;\;\;\;\mathsf{fma}\left(th, -0.16666666666666666 \cdot \left(th \cdot th\right), th\right) \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, -0.3333333333333333, 1\right)\right)}}\\
\mathbf{else}:\\
\;\;\;\;\left(ky \cdot \sin th\right) \cdot \sqrt{\frac{1}{\mathsf{fma}\left(-0.5, \cos \left(kx \cdot -2\right), 0.5\right)}}\\
\end{array}
\end{array}
if kx < 4.9999999999999999e-201Initial program 91.6%
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-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
count-2N/A
cos-diffN/A
cos-sin-sumN/A
lower--.f64N/A
count-2N/A
lower-cos.f64N/A
lower-+.f6483.4
lift-pow.f64N/A
Applied egg-rr75.5%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6450.2
Simplified50.2%
Taylor expanded in ky around 0
lower-*.f64N/A
unpow2N/A
lower-*.f6427.7
Simplified27.7%
if 4.9999999999999999e-201 < kx < 0.859999999999999987Initial program 90.6%
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-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
count-2N/A
cos-diffN/A
cos-sin-sumN/A
lower--.f64N/A
count-2N/A
lower-cos.f64N/A
lower-+.f6485.8
lift-pow.f64N/A
Applied egg-rr54.0%
Taylor expanded in th around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6432.5
Simplified32.5%
Taylor expanded in kx around 0
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6451.3
Simplified51.3%
if 0.859999999999999987 < kx Initial program 99.5%
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-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
count-2N/A
cos-diffN/A
cos-sin-sumN/A
lower--.f64N/A
count-2N/A
lower-cos.f64N/A
lower-+.f6499.5
lift-pow.f64N/A
Applied egg-rr99.2%
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-*.f6459.6
Simplified59.6%
Final simplification40.3%
(FPCore (kx ky th)
:precision binary64
(if (<= kx 5e-201)
(* (sin th) (/ (sin ky) (sqrt (fma (* 2.0 (* ky ky)) 0.5 (* kx kx)))))
(if (<= kx 0.86)
(*
(fma th (* -0.16666666666666666 (* th th)) th)
(/ (sin ky) (sqrt (fma (- 1.0 (cos (+ ky ky))) 0.5 (* kx kx)))))
(* (* ky (sin th)) (sqrt (/ 1.0 (fma -0.5 (cos (* kx -2.0)) 0.5)))))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 5e-201) {
tmp = sin(th) * (sin(ky) / sqrt(fma((2.0 * (ky * ky)), 0.5, (kx * kx))));
} else if (kx <= 0.86) {
tmp = fma(th, (-0.16666666666666666 * (th * th)), th) * (sin(ky) / sqrt(fma((1.0 - cos((ky + ky))), 0.5, (kx * kx))));
} else {
tmp = (ky * sin(th)) * sqrt((1.0 / fma(-0.5, cos((kx * -2.0)), 0.5)));
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (kx <= 5e-201) tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(fma(Float64(2.0 * Float64(ky * ky)), 0.5, Float64(kx * kx))))); elseif (kx <= 0.86) tmp = Float64(fma(th, Float64(-0.16666666666666666 * Float64(th * th)), th) * Float64(sin(ky) / sqrt(fma(Float64(1.0 - cos(Float64(ky + ky))), 0.5, Float64(kx * kx))))); else tmp = Float64(Float64(ky * sin(th)) * sqrt(Float64(1.0 / fma(-0.5, cos(Float64(kx * -2.0)), 0.5)))); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[kx, 5e-201], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[(2.0 * N[(ky * ky), $MachinePrecision]), $MachinePrecision] * 0.5 + N[(kx * kx), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[kx, 0.86], N[(N[(th * N[(-0.16666666666666666 * N[(th * th), $MachinePrecision]), $MachinePrecision] + th), $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[(1.0 - N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5 + N[(kx * kx), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(-0.5 * N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 5 \cdot 10^{-201}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{\mathsf{fma}\left(2 \cdot \left(ky \cdot ky\right), 0.5, kx \cdot kx\right)}}\\
\mathbf{elif}\;kx \leq 0.86:\\
\;\;\;\;\mathsf{fma}\left(th, -0.16666666666666666 \cdot \left(th \cdot th\right), th\right) \cdot \frac{\sin ky}{\sqrt{\mathsf{fma}\left(1 - \cos \left(ky + ky\right), 0.5, kx \cdot kx\right)}}\\
\mathbf{else}:\\
\;\;\;\;\left(ky \cdot \sin th\right) \cdot \sqrt{\frac{1}{\mathsf{fma}\left(-0.5, \cos \left(kx \cdot -2\right), 0.5\right)}}\\
\end{array}
\end{array}
if kx < 4.9999999999999999e-201Initial program 91.6%
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-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
count-2N/A
cos-diffN/A
cos-sin-sumN/A
lower--.f64N/A
count-2N/A
lower-cos.f64N/A
lower-+.f6483.4
lift-pow.f64N/A
Applied egg-rr75.5%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6450.2
Simplified50.2%
Taylor expanded in ky around 0
lower-*.f64N/A
unpow2N/A
lower-*.f6427.7
Simplified27.7%
if 4.9999999999999999e-201 < kx < 0.859999999999999987Initial program 90.6%
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-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
count-2N/A
cos-diffN/A
cos-sin-sumN/A
lower--.f64N/A
count-2N/A
lower-cos.f64N/A
lower-+.f6485.8
lift-pow.f64N/A
Applied egg-rr54.0%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6485.6
Simplified85.6%
Taylor expanded in th around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6451.3
Simplified51.3%
if 0.859999999999999987 < kx Initial program 99.5%
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-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
count-2N/A
cos-diffN/A
cos-sin-sumN/A
lower--.f64N/A
count-2N/A
lower-cos.f64N/A
lower-+.f6499.5
lift-pow.f64N/A
Applied egg-rr99.2%
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-*.f6459.6
Simplified59.6%
Final simplification40.3%
(FPCore (kx ky th) :precision binary64 (if (<= kx 0.86) (* (sin th) (/ (sin ky) (sqrt (fma (* 2.0 (* ky ky)) 0.5 (* kx kx))))) (* (* ky (sin th)) (sqrt (/ 1.0 (fma -0.5 (cos (* kx -2.0)) 0.5))))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.86) {
tmp = sin(th) * (sin(ky) / sqrt(fma((2.0 * (ky * ky)), 0.5, (kx * kx))));
} else {
tmp = (ky * sin(th)) * sqrt((1.0 / fma(-0.5, cos((kx * -2.0)), 0.5)));
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (kx <= 0.86) tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(fma(Float64(2.0 * Float64(ky * ky)), 0.5, Float64(kx * kx))))); else tmp = Float64(Float64(ky * sin(th)) * sqrt(Float64(1.0 / fma(-0.5, cos(Float64(kx * -2.0)), 0.5)))); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[kx, 0.86], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[(2.0 * N[(ky * ky), $MachinePrecision]), $MachinePrecision] * 0.5 + N[(kx * kx), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(-0.5 * N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 0.86:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{\mathsf{fma}\left(2 \cdot \left(ky \cdot ky\right), 0.5, kx \cdot kx\right)}}\\
\mathbf{else}:\\
\;\;\;\;\left(ky \cdot \sin th\right) \cdot \sqrt{\frac{1}{\mathsf{fma}\left(-0.5, \cos \left(kx \cdot -2\right), 0.5\right)}}\\
\end{array}
\end{array}
if kx < 0.859999999999999987Initial program 91.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-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
count-2N/A
cos-diffN/A
cos-sin-sumN/A
lower--.f64N/A
count-2N/A
lower-cos.f64N/A
lower-+.f6483.9
lift-pow.f64N/A
Applied egg-rr70.7%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6458.2
Simplified58.2%
Taylor expanded in ky around 0
lower-*.f64N/A
unpow2N/A
lower-*.f6430.8
Simplified30.8%
if 0.859999999999999987 < kx Initial program 99.5%
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-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
count-2N/A
cos-diffN/A
cos-sin-sumN/A
lower--.f64N/A
count-2N/A
lower-cos.f64N/A
lower-+.f6499.5
lift-pow.f64N/A
Applied egg-rr99.2%
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-*.f6459.6
Simplified59.6%
Final simplification38.6%
(FPCore (kx ky th)
:precision binary64
(if (<= kx 0.0027)
(*
(sin th)
(/
1.0
(*
kx
(fma
-0.3333333333333333
(/ (* (* kx kx) (sqrt 0.5)) (* ky (sqrt 2.0)))
(* (sqrt 0.5) (/ (sqrt 2.0) ky))))))
(* (* ky (sin th)) (sqrt (/ 1.0 (fma -0.5 (cos (* kx -2.0)) 0.5))))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.0027) {
tmp = sin(th) * (1.0 / (kx * fma(-0.3333333333333333, (((kx * kx) * sqrt(0.5)) / (ky * sqrt(2.0))), (sqrt(0.5) * (sqrt(2.0) / ky)))));
} else {
tmp = (ky * sin(th)) * sqrt((1.0 / fma(-0.5, cos((kx * -2.0)), 0.5)));
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (kx <= 0.0027) tmp = Float64(sin(th) * Float64(1.0 / Float64(kx * fma(-0.3333333333333333, Float64(Float64(Float64(kx * kx) * sqrt(0.5)) / Float64(ky * sqrt(2.0))), Float64(sqrt(0.5) * Float64(sqrt(2.0) / ky)))))); else tmp = Float64(Float64(ky * sin(th)) * sqrt(Float64(1.0 / fma(-0.5, cos(Float64(kx * -2.0)), 0.5)))); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[kx, 0.0027], N[(N[Sin[th], $MachinePrecision] * N[(1.0 / N[(kx * N[(-0.3333333333333333 * N[(N[(N[(kx * kx), $MachinePrecision] * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision] / N[(ky * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[0.5], $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(-0.5 * N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 0.0027:\\
\;\;\;\;\sin th \cdot \frac{1}{kx \cdot \mathsf{fma}\left(-0.3333333333333333, \frac{\left(kx \cdot kx\right) \cdot \sqrt{0.5}}{ky \cdot \sqrt{2}}, \sqrt{0.5} \cdot \frac{\sqrt{2}}{ky}\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(ky \cdot \sin th\right) \cdot \sqrt{\frac{1}{\mathsf{fma}\left(-0.5, \cos \left(kx \cdot -2\right), 0.5\right)}}\\
\end{array}
\end{array}
if kx < 0.0027000000000000001Initial program 91.4%
Applied egg-rr70.6%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f6416.9
Simplified16.9%
Taylor expanded in kx around 0
lower-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f6420.4
Simplified20.4%
if 0.0027000000000000001 < kx Initial program 99.5%
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-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
count-2N/A
cos-diffN/A
cos-sin-sumN/A
lower--.f64N/A
count-2N/A
lower-cos.f64N/A
lower-+.f6499.5
lift-pow.f64N/A
Applied egg-rr99.2%
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-*.f6459.6
Simplified59.6%
Final simplification31.1%
(FPCore (kx ky th)
:precision binary64
(if (<= ky 3.86e-91)
(*
(sin th)
(*
ky
(*
(/ 1.0 kx)
(fma
ky
(* ky (fma (* ky ky) 0.008333333333333333 -0.16666666666666666))
1.0))))
(if (<= ky 3e-15)
(* (sqrt (/ 1.0 (- 1.0 (cos (* kx -2.0))))) (* ky (/ th (sqrt 0.5))))
(* (sin th) (/ 1.0 (sin ky))))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 3.86e-91) {
tmp = sin(th) * (ky * ((1.0 / kx) * fma(ky, (ky * fma((ky * ky), 0.008333333333333333, -0.16666666666666666)), 1.0)));
} else if (ky <= 3e-15) {
tmp = sqrt((1.0 / (1.0 - cos((kx * -2.0))))) * (ky * (th / sqrt(0.5)));
} else {
tmp = sin(th) * (1.0 / sin(ky));
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (ky <= 3.86e-91) tmp = Float64(sin(th) * Float64(ky * Float64(Float64(1.0 / kx) * fma(ky, Float64(ky * fma(Float64(ky * ky), 0.008333333333333333, -0.16666666666666666)), 1.0)))); elseif (ky <= 3e-15) tmp = Float64(sqrt(Float64(1.0 / Float64(1.0 - cos(Float64(kx * -2.0))))) * Float64(ky * Float64(th / sqrt(0.5)))); else tmp = Float64(sin(th) * Float64(1.0 / sin(ky))); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[ky, 3.86e-91], N[(N[Sin[th], $MachinePrecision] * N[(ky * N[(N[(1.0 / kx), $MachinePrecision] * N[(ky * N[(ky * N[(N[(ky * ky), $MachinePrecision] * 0.008333333333333333 + -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[ky, 3e-15], 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[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(1.0 / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 3.86 \cdot 10^{-91}:\\
\;\;\;\;\sin th \cdot \left(ky \cdot \left(\frac{1}{kx} \cdot \mathsf{fma}\left(ky, ky \cdot \mathsf{fma}\left(ky \cdot ky, 0.008333333333333333, -0.16666666666666666\right), 1\right)\right)\right)\\
\mathbf{elif}\;ky \leq 3 \cdot 10^{-15}:\\
\;\;\;\;\sqrt{\frac{1}{1 - \cos \left(kx \cdot -2\right)}} \cdot \left(ky \cdot \frac{th}{\sqrt{0.5}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{1}{\sin ky}\\
\end{array}
\end{array}
if ky < 3.86000000000000009e-91Initial program 91.4%
Taylor expanded in ky around 0
lower-*.f64N/A
+-commutativeN/A
distribute-lft-inN/A
associate-+l+N/A
associate-*r*N/A
*-commutativeN/A
Simplified8.4%
Taylor expanded in kx around 0
lower-sqrt.f64N/A
lower-/.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6413.2
Simplified13.2%
Taylor expanded in kx around 0
lower-/.f6426.1
Simplified26.1%
if 3.86000000000000009e-91 < ky < 3e-15Initial program 99.6%
Applied egg-rr75.2%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f6475.1
Simplified75.1%
Taylor expanded in th around 0
*-commutativeN/A
cos-negN/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower-*.f64N/A
Simplified28.5%
if 3e-15 < ky Initial program 99.7%
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.8
Applied egg-rr99.8%
Taylor expanded in kx around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6446.8
Simplified46.8%
Taylor expanded in kx around 0
lower-/.f64N/A
lower-sin.f6420.2
Simplified20.2%
Final simplification24.7%
(FPCore (kx ky th) :precision binary64 (* (sin th) (/ 1.0 (/ (* (sqrt 2.0) (* kx (sqrt 0.5))) ky))))
double code(double kx, double ky, double th) {
return sin(th) * (1.0 / ((sqrt(2.0) * (kx * sqrt(0.5))) / ky));
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = sin(th) * (1.0d0 / ((sqrt(2.0d0) * (kx * sqrt(0.5d0))) / ky))
end function
public static double code(double kx, double ky, double th) {
return Math.sin(th) * (1.0 / ((Math.sqrt(2.0) * (kx * Math.sqrt(0.5))) / ky));
}
def code(kx, ky, th): return math.sin(th) * (1.0 / ((math.sqrt(2.0) * (kx * math.sqrt(0.5))) / ky))
function code(kx, ky, th) return Float64(sin(th) * Float64(1.0 / Float64(Float64(sqrt(2.0) * Float64(kx * sqrt(0.5))) / ky))) end
function tmp = code(kx, ky, th) tmp = sin(th) * (1.0 / ((sqrt(2.0) * (kx * sqrt(0.5))) / ky)); end
code[kx_, ky_, th_] := N[(N[Sin[th], $MachinePrecision] * N[(1.0 / N[(N[(N[Sqrt[2.0], $MachinePrecision] * N[(kx * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin th \cdot \frac{1}{\frac{\sqrt{2} \cdot \left(kx \cdot \sqrt{0.5}\right)}{ky}}
\end{array}
Initial program 93.6%
Applied egg-rr78.5%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f6428.6
Simplified28.6%
Taylor expanded in kx around 0
lower-/.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6420.5
Simplified20.5%
Final simplification20.5%
(FPCore (kx ky th)
:precision binary64
(*
(sin th)
(*
ky
(*
(/ 1.0 kx)
(fma
ky
(* ky (fma (* ky ky) 0.008333333333333333 -0.16666666666666666))
1.0)))))
double code(double kx, double ky, double th) {
return sin(th) * (ky * ((1.0 / kx) * fma(ky, (ky * fma((ky * ky), 0.008333333333333333, -0.16666666666666666)), 1.0)));
}
function code(kx, ky, th) return Float64(sin(th) * Float64(ky * Float64(Float64(1.0 / kx) * fma(ky, Float64(ky * fma(Float64(ky * ky), 0.008333333333333333, -0.16666666666666666)), 1.0)))) end
code[kx_, ky_, th_] := N[(N[Sin[th], $MachinePrecision] * N[(ky * N[(N[(1.0 / kx), $MachinePrecision] * N[(ky * N[(ky * N[(N[(ky * ky), $MachinePrecision] * 0.008333333333333333 + -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin th \cdot \left(ky \cdot \left(\frac{1}{kx} \cdot \mathsf{fma}\left(ky, ky \cdot \mathsf{fma}\left(ky \cdot ky, 0.008333333333333333, -0.16666666666666666\right), 1\right)\right)\right)
\end{array}
Initial program 93.6%
Taylor expanded in ky around 0
lower-*.f64N/A
+-commutativeN/A
distribute-lft-inN/A
associate-+l+N/A
associate-*r*N/A
*-commutativeN/A
Simplified6.8%
Taylor expanded in kx around 0
lower-sqrt.f64N/A
lower-/.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6410.2
Simplified10.2%
Taylor expanded in kx around 0
lower-/.f6419.9
Simplified19.9%
Final simplification19.9%
(FPCore (kx ky th) :precision binary64 (/ (* ky (sin th)) kx))
double code(double kx, double ky, double th) {
return (ky * sin(th)) / kx;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (ky * sin(th)) / kx
end function
public static double code(double kx, double ky, double th) {
return (ky * Math.sin(th)) / kx;
}
def code(kx, ky, th): return (ky * math.sin(th)) / kx
function code(kx, ky, th) return Float64(Float64(ky * sin(th)) / kx) end
function tmp = code(kx, ky, th) tmp = (ky * sin(th)) / kx; end
code[kx_, ky_, th_] := N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] / kx), $MachinePrecision]
\begin{array}{l}
\\
\frac{ky \cdot \sin th}{kx}
\end{array}
Initial program 93.6%
Applied egg-rr78.5%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f6428.6
Simplified28.6%
Taylor expanded in kx around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f6419.5
Simplified19.5%
(FPCore (kx ky th) :precision binary64 (* (sin th) (/ 1.0 kx)))
double code(double kx, double ky, double th) {
return sin(th) * (1.0 / kx);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = sin(th) * (1.0d0 / kx)
end function
public static double code(double kx, double ky, double th) {
return Math.sin(th) * (1.0 / kx);
}
def code(kx, ky, th): return math.sin(th) * (1.0 / kx)
function code(kx, ky, th) return Float64(sin(th) * Float64(1.0 / kx)) end
function tmp = code(kx, ky, th) tmp = sin(th) * (1.0 / kx); end
code[kx_, ky_, th_] := N[(N[Sin[th], $MachinePrecision] * N[(1.0 / kx), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin th \cdot \frac{1}{kx}
\end{array}
Initial program 93.6%
Applied egg-rr78.5%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f6428.6
Simplified28.6%
Taylor expanded in kx around 0
lower-/.f6410.4
Simplified10.4%
Final simplification10.4%
(FPCore (kx ky th) :precision binary64 (/ th (* ky ky)))
double code(double kx, double ky, double th) {
return th / (ky * ky);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = th / (ky * ky)
end function
public static double code(double kx, double ky, double th) {
return th / (ky * ky);
}
def code(kx, ky, th): return th / (ky * ky)
function code(kx, ky, th) return Float64(th / Float64(ky * ky)) end
function tmp = code(kx, ky, th) tmp = th / (ky * ky); end
code[kx_, ky_, th_] := N[(th / N[(ky * ky), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{th}{ky \cdot ky}
\end{array}
Initial program 93.6%
Taylor expanded in kx around 0
lower-/.f64N/A
lower-sin.f64N/A
lower-pow.f64N/A
lower-sin.f6410.7
Simplified10.7%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f643.4
Simplified3.4%
Taylor expanded in th around 0
lower-/.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f643.4
Simplified3.4%
Taylor expanded in th around 0
lower-/.f64N/A
unpow2N/A
lower-*.f643.4
Simplified3.4%
herbie shell --seed 2024214
(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)))