
(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 25 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 94.8%
+-commutativeN/A
unpow2N/A
unpow2N/A
accelerator-lowering-hypot.f64N/A
sin-lowering-sin.f64N/A
sin-lowering-sin.f6499.8
Applied egg-rr99.8%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (* (sin th) (/ (sin ky) (hypot ky (sin kx)))))
(t_2 (pow (sin ky) 2.0))
(t_3 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) t_2)))))
(if (<= t_3 -0.999)
(* (sin th) (/ (sin ky) (sqrt (+ t_2 (* kx kx)))))
(if (<= t_3 -0.2)
(*
(sin ky)
(/
th
(sqrt
(fma (- 1.0 (cos (+ ky ky))) 0.5 (+ 0.5 (* -0.5 (cos (+ kx kx))))))))
(if (<= t_3 2e-29)
t_1
(if (<= t_3 0.86)
(* (/ (sin ky) (hypot (sin ky) (sin kx))) th)
(if (<= t_3 2.0) (sin th) t_1)))))))
double code(double kx, double ky, double th) {
double t_1 = sin(th) * (sin(ky) / hypot(ky, sin(kx)));
double t_2 = pow(sin(ky), 2.0);
double t_3 = sin(ky) / sqrt((pow(sin(kx), 2.0) + t_2));
double tmp;
if (t_3 <= -0.999) {
tmp = sin(th) * (sin(ky) / sqrt((t_2 + (kx * kx))));
} else if (t_3 <= -0.2) {
tmp = sin(ky) * (th / sqrt(fma((1.0 - cos((ky + ky))), 0.5, (0.5 + (-0.5 * cos((kx + kx)))))));
} else if (t_3 <= 2e-29) {
tmp = t_1;
} else if (t_3 <= 0.86) {
tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * th;
} else if (t_3 <= 2.0) {
tmp = sin(th);
} else {
tmp = t_1;
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(th) * Float64(sin(ky) / hypot(ky, sin(kx)))) t_2 = sin(ky) ^ 2.0 t_3 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + t_2))) tmp = 0.0 if (t_3 <= -0.999) tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(Float64(t_2 + Float64(kx * kx))))); elseif (t_3 <= -0.2) tmp = Float64(sin(ky) * Float64(th / sqrt(fma(Float64(1.0 - cos(Float64(ky + ky))), 0.5, Float64(0.5 + Float64(-0.5 * cos(Float64(kx + kx)))))))); elseif (t_3 <= 2e-29) tmp = t_1; elseif (t_3 <= 0.86) tmp = Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * th); elseif (t_3 <= 2.0) tmp = sin(th); else tmp = t_1; end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$3 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + t$95$2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, -0.999], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$2 + N[(kx * kx), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, -0.2], N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sqrt[N[(N[(1.0 - N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5 + N[(0.5 + N[(-0.5 * N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 2e-29], t$95$1, If[LessEqual[t$95$3, 0.86], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * th), $MachinePrecision], If[LessEqual[t$95$3, 2.0], N[Sin[th], $MachinePrecision], t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
t_2 := {\sin ky}^{2}\\
t_3 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + t\_2}}\\
\mathbf{if}\;t\_3 \leq -0.999:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{t\_2 + kx \cdot kx}}\\
\mathbf{elif}\;t\_3 \leq -0.2:\\
\;\;\;\;\sin ky \cdot \frac{th}{\sqrt{\mathsf{fma}\left(1 - \cos \left(ky + ky\right), 0.5, 0.5 + -0.5 \cdot \cos \left(kx + kx\right)\right)}}\\
\mathbf{elif}\;t\_3 \leq 2 \cdot 10^{-29}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_3 \leq 0.86:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot th\\
\mathbf{elif}\;t\_3 \leq 2:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.998999999999999999Initial program 82.5%
Taylor expanded in kx around 0
unpow2N/A
*-lowering-*.f6482.5
Simplified82.5%
if -0.998999999999999999 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.20000000000000001Initial program 99.6%
+-commutativeN/A
unpow2N/A
unpow2N/A
accelerator-lowering-hypot.f64N/A
sin-lowering-sin.f64N/A
sin-lowering-sin.f6499.5
Applied egg-rr99.5%
Taylor expanded in th around 0
Simplified51.8%
associate-*l/N/A
associate-/l*N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
Applied egg-rr51.7%
if -0.20000000000000001 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 1.99999999999999989e-29 or 2 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 95.7%
+-commutativeN/A
unpow2N/A
unpow2N/A
accelerator-lowering-hypot.f64N/A
sin-lowering-sin.f64N/A
sin-lowering-sin.f6499.7
Applied egg-rr99.7%
Taylor expanded in ky around 0
Simplified94.8%
if 1.99999999999999989e-29 < (/.f64 (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.859999999999999987Initial program 99.4%
+-commutativeN/A
unpow2N/A
unpow2N/A
accelerator-lowering-hypot.f64N/A
sin-lowering-sin.f64N/A
sin-lowering-sin.f6499.5
Applied egg-rr99.5%
Taylor expanded in th around 0
Simplified65.0%
if 0.859999999999999987 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2Initial program 99.8%
Taylor expanded in kx around 0
sin-lowering-sin.f6487.2
Simplified87.2%
Final simplification83.6%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))))
(t_2 (- 1.0 (cos (+ ky ky))))
(t_3 (* (sin th) (/ (sin ky) (hypot ky (sin kx))))))
(if (<= t_1 -0.999)
(*
(sin th)
(/
(sin ky)
(sqrt
(fma t_2 0.5 (* (* kx kx) (fma (* kx kx) -0.3333333333333333 1.0))))))
(if (<= t_1 -0.2)
(*
(sin ky)
(/ th (sqrt (fma t_2 0.5 (+ 0.5 (* -0.5 (cos (+ kx kx))))))))
(if (<= t_1 2e-29)
t_3
(if (<= t_1 0.86)
(* (/ (sin ky) (hypot (sin ky) (sin kx))) th)
(if (<= t_1 2.0) (sin th) t_3)))))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double t_2 = 1.0 - cos((ky + ky));
double t_3 = sin(th) * (sin(ky) / hypot(ky, sin(kx)));
double tmp;
if (t_1 <= -0.999) {
tmp = sin(th) * (sin(ky) / sqrt(fma(t_2, 0.5, ((kx * kx) * fma((kx * kx), -0.3333333333333333, 1.0)))));
} else if (t_1 <= -0.2) {
tmp = sin(ky) * (th / sqrt(fma(t_2, 0.5, (0.5 + (-0.5 * cos((kx + kx)))))));
} else if (t_1 <= 2e-29) {
tmp = t_3;
} else if (t_1 <= 0.86) {
tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * th;
} else if (t_1 <= 2.0) {
tmp = sin(th);
} else {
tmp = t_3;
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) t_2 = Float64(1.0 - cos(Float64(ky + ky))) t_3 = Float64(sin(th) * Float64(sin(ky) / hypot(ky, sin(kx)))) tmp = 0.0 if (t_1 <= -0.999) tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(fma(t_2, 0.5, Float64(Float64(kx * kx) * fma(Float64(kx * kx), -0.3333333333333333, 1.0)))))); elseif (t_1 <= -0.2) tmp = Float64(sin(ky) * Float64(th / sqrt(fma(t_2, 0.5, Float64(0.5 + Float64(-0.5 * cos(Float64(kx + kx)))))))); elseif (t_1 <= 2e-29) tmp = t_3; elseif (t_1 <= 0.86) tmp = Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * th); elseif (t_1 <= 2.0) tmp = sin(th); else tmp = t_3; end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 - N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -0.999], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$2 * 0.5 + N[(N[(kx * kx), $MachinePrecision] * N[(N[(kx * kx), $MachinePrecision] * -0.3333333333333333 + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -0.2], N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sqrt[N[(t$95$2 * 0.5 + N[(0.5 + N[(-0.5 * N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e-29], t$95$3, If[LessEqual[t$95$1, 0.86], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * th), $MachinePrecision], If[LessEqual[t$95$1, 2.0], N[Sin[th], $MachinePrecision], t$95$3]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
t_2 := 1 - \cos \left(ky + ky\right)\\
t_3 := \sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\mathbf{if}\;t\_1 \leq -0.999:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{\mathsf{fma}\left(t\_2, 0.5, \left(kx \cdot kx\right) \cdot \mathsf{fma}\left(kx \cdot kx, -0.3333333333333333, 1\right)\right)}}\\
\mathbf{elif}\;t\_1 \leq -0.2:\\
\;\;\;\;\sin ky \cdot \frac{th}{\sqrt{\mathsf{fma}\left(t\_2, 0.5, 0.5 + -0.5 \cdot \cos \left(kx + kx\right)\right)}}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-29}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_1 \leq 0.86:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot th\\
\mathbf{elif}\;t\_1 \leq 2:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.998999999999999999Initial program 82.5%
sqrt-lowering-sqrt.f64N/A
+-commutativeN/A
unpow2N/A
sin-multN/A
div-invN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
count-2N/A
+-inversesN/A
cos-0N/A
--lowering--.f64N/A
count-2N/A
cos-lowering-cos.f64N/A
+-lowering-+.f64N/A
unpow2N/A
sqr-sin-aN/A
cancel-sign-sub-invN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
count-2N/A
cos-lowering-cos.f64N/A
+-lowering-+.f6463.6
Applied egg-rr63.6%
Taylor expanded in kx around 0
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f6464.1
Simplified64.1%
if -0.998999999999999999 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.20000000000000001Initial program 99.6%
+-commutativeN/A
unpow2N/A
unpow2N/A
accelerator-lowering-hypot.f64N/A
sin-lowering-sin.f64N/A
sin-lowering-sin.f6499.5
Applied egg-rr99.5%
Taylor expanded in th around 0
Simplified51.8%
associate-*l/N/A
associate-/l*N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
Applied egg-rr51.7%
if -0.20000000000000001 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 1.99999999999999989e-29 or 2 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 95.7%
+-commutativeN/A
unpow2N/A
unpow2N/A
accelerator-lowering-hypot.f64N/A
sin-lowering-sin.f64N/A
sin-lowering-sin.f6499.7
Applied egg-rr99.7%
Taylor expanded in ky around 0
Simplified94.8%
if 1.99999999999999989e-29 < (/.f64 (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.859999999999999987Initial program 99.4%
+-commutativeN/A
unpow2N/A
unpow2N/A
accelerator-lowering-hypot.f64N/A
sin-lowering-sin.f64N/A
sin-lowering-sin.f6499.5
Applied egg-rr99.5%
Taylor expanded in th around 0
Simplified65.0%
if 0.859999999999999987 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2Initial program 99.8%
Taylor expanded in kx around 0
sin-lowering-sin.f6487.2
Simplified87.2%
Final simplification80.0%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))))
(t_2 (- 1.0 (cos (+ ky ky))))
(t_3
(*
(sin ky)
(/ th (sqrt (fma t_2 0.5 (+ 0.5 (* -0.5 (cos (+ kx kx)))))))))
(t_4 (* (sin th) (/ (sin ky) (hypot ky (sin kx))))))
(if (<= t_1 -0.999)
(*
(sin th)
(/
(sin ky)
(sqrt
(fma t_2 0.5 (* (* kx kx) (fma (* kx kx) -0.3333333333333333 1.0))))))
(if (<= t_1 -0.2)
t_3
(if (<= t_1 1e-15)
t_4
(if (<= t_1 0.86) t_3 (if (<= t_1 2.0) (sin th) t_4)))))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double t_2 = 1.0 - cos((ky + ky));
double t_3 = sin(ky) * (th / sqrt(fma(t_2, 0.5, (0.5 + (-0.5 * cos((kx + kx)))))));
double t_4 = sin(th) * (sin(ky) / hypot(ky, sin(kx)));
double tmp;
if (t_1 <= -0.999) {
tmp = sin(th) * (sin(ky) / sqrt(fma(t_2, 0.5, ((kx * kx) * fma((kx * kx), -0.3333333333333333, 1.0)))));
} else if (t_1 <= -0.2) {
tmp = t_3;
} else if (t_1 <= 1e-15) {
tmp = t_4;
} else if (t_1 <= 0.86) {
tmp = t_3;
} else if (t_1 <= 2.0) {
tmp = sin(th);
} else {
tmp = t_4;
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) t_2 = Float64(1.0 - cos(Float64(ky + ky))) t_3 = Float64(sin(ky) * Float64(th / sqrt(fma(t_2, 0.5, Float64(0.5 + Float64(-0.5 * cos(Float64(kx + kx)))))))) t_4 = Float64(sin(th) * Float64(sin(ky) / hypot(ky, sin(kx)))) tmp = 0.0 if (t_1 <= -0.999) tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(fma(t_2, 0.5, Float64(Float64(kx * kx) * fma(Float64(kx * kx), -0.3333333333333333, 1.0)))))); elseif (t_1 <= -0.2) tmp = t_3; elseif (t_1 <= 1e-15) tmp = t_4; elseif (t_1 <= 0.86) tmp = t_3; elseif (t_1 <= 2.0) tmp = sin(th); else tmp = t_4; end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 - N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sqrt[N[(t$95$2 * 0.5 + N[(0.5 + N[(-0.5 * N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -0.999], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$2 * 0.5 + N[(N[(kx * kx), $MachinePrecision] * N[(N[(kx * kx), $MachinePrecision] * -0.3333333333333333 + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -0.2], t$95$3, If[LessEqual[t$95$1, 1e-15], t$95$4, If[LessEqual[t$95$1, 0.86], t$95$3, If[LessEqual[t$95$1, 2.0], N[Sin[th], $MachinePrecision], t$95$4]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
t_2 := 1 - \cos \left(ky + ky\right)\\
t_3 := \sin ky \cdot \frac{th}{\sqrt{\mathsf{fma}\left(t\_2, 0.5, 0.5 + -0.5 \cdot \cos \left(kx + kx\right)\right)}}\\
t_4 := \sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\mathbf{if}\;t\_1 \leq -0.999:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{\mathsf{fma}\left(t\_2, 0.5, \left(kx \cdot kx\right) \cdot \mathsf{fma}\left(kx \cdot kx, -0.3333333333333333, 1\right)\right)}}\\
\mathbf{elif}\;t\_1 \leq -0.2:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_1 \leq 10^{-15}:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;t\_1 \leq 0.86:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_1 \leq 2:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;t\_4\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.998999999999999999Initial program 82.5%
sqrt-lowering-sqrt.f64N/A
+-commutativeN/A
unpow2N/A
sin-multN/A
div-invN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
count-2N/A
+-inversesN/A
cos-0N/A
--lowering--.f64N/A
count-2N/A
cos-lowering-cos.f64N/A
+-lowering-+.f64N/A
unpow2N/A
sqr-sin-aN/A
cancel-sign-sub-invN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
count-2N/A
cos-lowering-cos.f64N/A
+-lowering-+.f6463.6
Applied egg-rr63.6%
Taylor expanded in kx around 0
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f6464.1
Simplified64.1%
if -0.998999999999999999 < (/.f64 (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.20000000000000001 or 1.0000000000000001e-15 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.859999999999999987Initial program 99.5%
+-commutativeN/A
unpow2N/A
unpow2N/A
accelerator-lowering-hypot.f64N/A
sin-lowering-sin.f64N/A
sin-lowering-sin.f6499.5
Applied egg-rr99.5%
Taylor expanded in th around 0
Simplified55.8%
associate-*l/N/A
associate-/l*N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
Applied egg-rr55.7%
if -0.20000000000000001 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 1.0000000000000001e-15 or 2 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 95.8%
+-commutativeN/A
unpow2N/A
unpow2N/A
accelerator-lowering-hypot.f64N/A
sin-lowering-sin.f64N/A
sin-lowering-sin.f6499.7
Applied egg-rr99.7%
Taylor expanded in ky around 0
Simplified95.0%
if 0.859999999999999987 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2Initial program 99.8%
Taylor expanded in kx around 0
sin-lowering-sin.f6487.2
Simplified87.2%
Final simplification80.0%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))))
(t_2 (- 1.0 (cos (+ ky ky))))
(t_3
(*
(sin ky)
(/ th (sqrt (fma t_2 0.5 (+ 0.5 (* -0.5 (cos (+ kx kx))))))))))
(if (<= t_1 -0.999)
(*
(sin th)
(/
(sin ky)
(sqrt
(fma t_2 0.5 (* (* kx kx) (fma (* kx kx) -0.3333333333333333 1.0))))))
(if (<= t_1 -0.5)
t_3
(if (<= t_1 2e-176)
(* (sin ky) (/ (sin th) (sqrt (fma -0.5 (cos (* kx -2.0)) 0.5))))
(if (<= t_1 1e-15)
(* (sin th) (/ (sin ky) (sin kx)))
(if (<= t_1 0.86) t_3 (sin th))))))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double t_2 = 1.0 - cos((ky + ky));
double t_3 = sin(ky) * (th / sqrt(fma(t_2, 0.5, (0.5 + (-0.5 * cos((kx + kx)))))));
double tmp;
if (t_1 <= -0.999) {
tmp = sin(th) * (sin(ky) / sqrt(fma(t_2, 0.5, ((kx * kx) * fma((kx * kx), -0.3333333333333333, 1.0)))));
} else if (t_1 <= -0.5) {
tmp = t_3;
} else if (t_1 <= 2e-176) {
tmp = sin(ky) * (sin(th) / sqrt(fma(-0.5, cos((kx * -2.0)), 0.5)));
} else if (t_1 <= 1e-15) {
tmp = sin(th) * (sin(ky) / sin(kx));
} else if (t_1 <= 0.86) {
tmp = t_3;
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) t_2 = Float64(1.0 - cos(Float64(ky + ky))) t_3 = Float64(sin(ky) * Float64(th / sqrt(fma(t_2, 0.5, Float64(0.5 + Float64(-0.5 * cos(Float64(kx + kx)))))))) tmp = 0.0 if (t_1 <= -0.999) tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(fma(t_2, 0.5, Float64(Float64(kx * kx) * fma(Float64(kx * kx), -0.3333333333333333, 1.0)))))); elseif (t_1 <= -0.5) tmp = t_3; elseif (t_1 <= 2e-176) tmp = Float64(sin(ky) * Float64(sin(th) / sqrt(fma(-0.5, cos(Float64(kx * -2.0)), 0.5)))); elseif (t_1 <= 1e-15) tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); elseif (t_1 <= 0.86) tmp = t_3; else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 - N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sqrt[N[(t$95$2 * 0.5 + N[(0.5 + N[(-0.5 * N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -0.999], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$2 * 0.5 + N[(N[(kx * kx), $MachinePrecision] * N[(N[(kx * kx), $MachinePrecision] * -0.3333333333333333 + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -0.5], t$95$3, If[LessEqual[t$95$1, 2e-176], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[(-0.5 * N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e-15], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.86], t$95$3, N[Sin[th], $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
t_2 := 1 - \cos \left(ky + ky\right)\\
t_3 := \sin ky \cdot \frac{th}{\sqrt{\mathsf{fma}\left(t\_2, 0.5, 0.5 + -0.5 \cdot \cos \left(kx + kx\right)\right)}}\\
\mathbf{if}\;t\_1 \leq -0.999:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{\mathsf{fma}\left(t\_2, 0.5, \left(kx \cdot kx\right) \cdot \mathsf{fma}\left(kx \cdot kx, -0.3333333333333333, 1\right)\right)}}\\
\mathbf{elif}\;t\_1 \leq -0.5:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-176}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sqrt{\mathsf{fma}\left(-0.5, \cos \left(kx \cdot -2\right), 0.5\right)}}\\
\mathbf{elif}\;t\_1 \leq 10^{-15}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\mathbf{elif}\;t\_1 \leq 0.86:\\
\;\;\;\;t\_3\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.998999999999999999Initial program 82.5%
sqrt-lowering-sqrt.f64N/A
+-commutativeN/A
unpow2N/A
sin-multN/A
div-invN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
count-2N/A
+-inversesN/A
cos-0N/A
--lowering--.f64N/A
count-2N/A
cos-lowering-cos.f64N/A
+-lowering-+.f64N/A
unpow2N/A
sqr-sin-aN/A
cancel-sign-sub-invN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
count-2N/A
cos-lowering-cos.f64N/A
+-lowering-+.f6463.6
Applied egg-rr63.6%
Taylor expanded in kx around 0
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f6464.1
Simplified64.1%
if -0.998999999999999999 < (/.f64 (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.5 or 1.0000000000000001e-15 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.859999999999999987Initial program 99.5%
+-commutativeN/A
unpow2N/A
unpow2N/A
accelerator-lowering-hypot.f64N/A
sin-lowering-sin.f64N/A
sin-lowering-sin.f6499.5
Applied egg-rr99.5%
Taylor expanded in th around 0
Simplified57.1%
associate-*l/N/A
associate-/l*N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
Applied egg-rr57.0%
if -0.5 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2e-176Initial program 99.8%
associate-*l/N/A
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
Applied egg-rr82.5%
Taylor expanded in ky around 0
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
accelerator-lowering-fma.f64N/A
cos-negN/A
cos-lowering-cos.f64N/A
*-commutativeN/A
*-lowering-*.f6474.6
Simplified74.6%
if 2e-176 < (/.f64 (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.0000000000000001e-15Initial program 99.7%
Taylor expanded in ky around 0
sin-lowering-sin.f6476.8
Simplified76.8%
if 0.859999999999999987 < (/.f64 (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 94.0%
Taylor expanded in kx around 0
sin-lowering-sin.f6485.2
Simplified85.2%
Final simplification72.5%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))))
(t_2 (- 1.0 (cos (+ ky ky))))
(t_3
(*
(sin ky)
(/ th (sqrt (fma t_2 0.5 (+ 0.5 (* -0.5 (cos (+ kx kx))))))))))
(if (<= t_1 -0.999)
(* (sin th) (/ (sin ky) (sqrt (fma t_2 0.5 (* kx kx)))))
(if (<= t_1 -0.5)
t_3
(if (<= t_1 2e-176)
(* (sin ky) (/ (sin th) (sqrt (fma -0.5 (cos (* kx -2.0)) 0.5))))
(if (<= t_1 1e-15)
(* (sin th) (/ (sin ky) (sin kx)))
(if (<= t_1 0.86) t_3 (sin th))))))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double t_2 = 1.0 - cos((ky + ky));
double t_3 = sin(ky) * (th / sqrt(fma(t_2, 0.5, (0.5 + (-0.5 * cos((kx + kx)))))));
double tmp;
if (t_1 <= -0.999) {
tmp = sin(th) * (sin(ky) / sqrt(fma(t_2, 0.5, (kx * kx))));
} else if (t_1 <= -0.5) {
tmp = t_3;
} else if (t_1 <= 2e-176) {
tmp = sin(ky) * (sin(th) / sqrt(fma(-0.5, cos((kx * -2.0)), 0.5)));
} else if (t_1 <= 1e-15) {
tmp = sin(th) * (sin(ky) / sin(kx));
} else if (t_1 <= 0.86) {
tmp = t_3;
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) t_2 = Float64(1.0 - cos(Float64(ky + ky))) t_3 = Float64(sin(ky) * Float64(th / sqrt(fma(t_2, 0.5, Float64(0.5 + Float64(-0.5 * cos(Float64(kx + kx)))))))) tmp = 0.0 if (t_1 <= -0.999) tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(fma(t_2, 0.5, Float64(kx * kx))))); elseif (t_1 <= -0.5) tmp = t_3; elseif (t_1 <= 2e-176) tmp = Float64(sin(ky) * Float64(sin(th) / sqrt(fma(-0.5, cos(Float64(kx * -2.0)), 0.5)))); elseif (t_1 <= 1e-15) tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); elseif (t_1 <= 0.86) tmp = t_3; else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 - N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sqrt[N[(t$95$2 * 0.5 + N[(0.5 + N[(-0.5 * N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -0.999], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$2 * 0.5 + N[(kx * kx), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -0.5], t$95$3, If[LessEqual[t$95$1, 2e-176], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[(-0.5 * N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e-15], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.86], t$95$3, N[Sin[th], $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
t_2 := 1 - \cos \left(ky + ky\right)\\
t_3 := \sin ky \cdot \frac{th}{\sqrt{\mathsf{fma}\left(t\_2, 0.5, 0.5 + -0.5 \cdot \cos \left(kx + kx\right)\right)}}\\
\mathbf{if}\;t\_1 \leq -0.999:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{\mathsf{fma}\left(t\_2, 0.5, kx \cdot kx\right)}}\\
\mathbf{elif}\;t\_1 \leq -0.5:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-176}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sqrt{\mathsf{fma}\left(-0.5, \cos \left(kx \cdot -2\right), 0.5\right)}}\\
\mathbf{elif}\;t\_1 \leq 10^{-15}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\mathbf{elif}\;t\_1 \leq 0.86:\\
\;\;\;\;t\_3\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.998999999999999999Initial program 82.5%
sqrt-lowering-sqrt.f64N/A
+-commutativeN/A
unpow2N/A
sin-multN/A
div-invN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
count-2N/A
+-inversesN/A
cos-0N/A
--lowering--.f64N/A
count-2N/A
cos-lowering-cos.f64N/A
+-lowering-+.f64N/A
unpow2N/A
sqr-sin-aN/A
cancel-sign-sub-invN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
count-2N/A
cos-lowering-cos.f64N/A
+-lowering-+.f6463.6
Applied egg-rr63.6%
Taylor expanded in kx around 0
unpow2N/A
*-lowering-*.f6464.1
Simplified64.1%
if -0.998999999999999999 < (/.f64 (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.5 or 1.0000000000000001e-15 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.859999999999999987Initial program 99.5%
+-commutativeN/A
unpow2N/A
unpow2N/A
accelerator-lowering-hypot.f64N/A
sin-lowering-sin.f64N/A
sin-lowering-sin.f6499.5
Applied egg-rr99.5%
Taylor expanded in th around 0
Simplified57.1%
associate-*l/N/A
associate-/l*N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
Applied egg-rr57.0%
if -0.5 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2e-176Initial program 99.8%
associate-*l/N/A
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
Applied egg-rr82.5%
Taylor expanded in ky around 0
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
accelerator-lowering-fma.f64N/A
cos-negN/A
cos-lowering-cos.f64N/A
*-commutativeN/A
*-lowering-*.f6474.6
Simplified74.6%
if 2e-176 < (/.f64 (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.0000000000000001e-15Initial program 99.7%
Taylor expanded in ky around 0
sin-lowering-sin.f6476.8
Simplified76.8%
if 0.859999999999999987 < (/.f64 (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 94.0%
Taylor expanded in kx around 0
sin-lowering-sin.f6485.2
Simplified85.2%
Final simplification72.5%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
(if (<= t_1 -0.71)
(* (sin th) (/ (sin ky) (sqrt (* 0.5 (- 1.0 (cos (* ky -2.0)))))))
(if (<= t_1 2e-176)
(* (sin ky) (/ (sin th) (sqrt (fma -0.5 (cos (* kx -2.0)) 0.5))))
(if (<= t_1 0.1) (* (sin th) (/ (sin ky) (sin kx))) (sin th))))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double tmp;
if (t_1 <= -0.71) {
tmp = sin(th) * (sin(ky) / sqrt((0.5 * (1.0 - cos((ky * -2.0))))));
} else if (t_1 <= 2e-176) {
tmp = sin(ky) * (sin(th) / sqrt(fma(-0.5, cos((kx * -2.0)), 0.5)));
} else if (t_1 <= 0.1) {
tmp = sin(th) * (sin(ky) / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_1 <= -0.71) tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(Float64(0.5 * Float64(1.0 - cos(Float64(ky * -2.0))))))); elseif (t_1 <= 2e-176) tmp = Float64(sin(ky) * Float64(sin(th) / sqrt(fma(-0.5, cos(Float64(kx * -2.0)), 0.5)))); elseif (t_1 <= 0.1) tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -0.71], 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], If[LessEqual[t$95$1, 2e-176], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[(-0.5 * N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.1], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_1 \leq -0.71:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{0.5 \cdot \left(1 - \cos \left(ky \cdot -2\right)\right)}}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-176}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sqrt{\mathsf{fma}\left(-0.5, \cos \left(kx \cdot -2\right), 0.5\right)}}\\
\mathbf{elif}\;t\_1 \leq 0.1:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.70999999999999996Initial program 86.2%
sqrt-lowering-sqrt.f64N/A
+-commutativeN/A
unpow2N/A
sin-multN/A
div-invN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
count-2N/A
+-inversesN/A
cos-0N/A
--lowering--.f64N/A
count-2N/A
cos-lowering-cos.f64N/A
+-lowering-+.f64N/A
unpow2N/A
sqr-sin-aN/A
cancel-sign-sub-invN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
count-2N/A
cos-lowering-cos.f64N/A
+-lowering-+.f6471.3
Applied egg-rr71.3%
Taylor expanded in kx around 0
*-lowering-*.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
--lowering--.f64N/A
cos-negN/A
cos-lowering-cos.f64N/A
*-commutativeN/A
*-lowering-*.f6454.9
Simplified54.9%
if -0.70999999999999996 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2e-176Initial program 99.8%
associate-*l/N/A
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
Applied egg-rr83.9%
Taylor expanded in ky around 0
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
accelerator-lowering-fma.f64N/A
cos-negN/A
cos-lowering-cos.f64N/A
*-commutativeN/A
*-lowering-*.f6470.0
Simplified70.0%
if 2e-176 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.10000000000000001Initial program 99.7%
Taylor expanded in ky around 0
sin-lowering-sin.f6469.1
Simplified69.1%
if 0.10000000000000001 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 95.2%
Taylor expanded in kx around 0
sin-lowering-sin.f6470.7
Simplified70.7%
Final simplification66.4%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
(if (<= t_1 -1.0)
(* th (/ (sin ky) (hypot (sin ky) kx)))
(if (<= t_1 2e-176)
(* (sin ky) (/ (sin th) (sqrt (fma -0.5 (cos (* kx -2.0)) 0.5))))
(if (<= t_1 0.1) (* (sin th) (/ (sin ky) (sin kx))) (sin th))))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double tmp;
if (t_1 <= -1.0) {
tmp = th * (sin(ky) / hypot(sin(ky), kx));
} else if (t_1 <= 2e-176) {
tmp = sin(ky) * (sin(th) / sqrt(fma(-0.5, cos((kx * -2.0)), 0.5)));
} else if (t_1 <= 0.1) {
tmp = sin(th) * (sin(ky) / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_1 <= -1.0) tmp = Float64(th * Float64(sin(ky) / hypot(sin(ky), kx))); elseif (t_1 <= 2e-176) tmp = Float64(sin(ky) * Float64(sin(th) / sqrt(fma(-0.5, cos(Float64(kx * -2.0)), 0.5)))); elseif (t_1 <= 0.1) tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1.0], N[(th * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e-176], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[(-0.5 * N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.1], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_1 \leq -1:\\
\;\;\;\;th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, kx\right)}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-176}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sqrt{\mathsf{fma}\left(-0.5, \cos \left(kx \cdot -2\right), 0.5\right)}}\\
\mathbf{elif}\;t\_1 \leq 0.1:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -1Initial program 82.1%
+-commutativeN/A
unpow2N/A
unpow2N/A
accelerator-lowering-hypot.f64N/A
sin-lowering-sin.f64N/A
sin-lowering-sin.f6499.9
Applied egg-rr99.9%
Taylor expanded in th around 0
Simplified43.6%
Taylor expanded in kx around 0
Simplified43.6%
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))))) < 2e-176Initial program 99.7%
associate-*l/N/A
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
Applied egg-rr85.3%
Taylor expanded in ky around 0
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
accelerator-lowering-fma.f64N/A
cos-negN/A
cos-lowering-cos.f64N/A
*-commutativeN/A
*-lowering-*.f6461.8
Simplified61.8%
if 2e-176 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.10000000000000001Initial program 99.7%
Taylor expanded in ky around 0
sin-lowering-sin.f6469.1
Simplified69.1%
if 0.10000000000000001 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 95.2%
Taylor expanded in kx around 0
sin-lowering-sin.f6470.7
Simplified70.7%
Final simplification62.0%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
(if (<= t_1 -1.0)
(* th (/ (sin ky) (hypot (sin ky) kx)))
(if (<= t_1 2e-176)
(* (sin th) (/ (sin ky) (sqrt (fma -0.5 (cos (* kx -2.0)) 0.5))))
(if (<= t_1 0.1) (* (sin th) (/ (sin ky) (sin kx))) (sin th))))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double tmp;
if (t_1 <= -1.0) {
tmp = th * (sin(ky) / hypot(sin(ky), kx));
} else if (t_1 <= 2e-176) {
tmp = sin(th) * (sin(ky) / sqrt(fma(-0.5, cos((kx * -2.0)), 0.5)));
} else if (t_1 <= 0.1) {
tmp = sin(th) * (sin(ky) / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_1 <= -1.0) tmp = Float64(th * Float64(sin(ky) / hypot(sin(ky), kx))); elseif (t_1 <= 2e-176) tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(fma(-0.5, cos(Float64(kx * -2.0)), 0.5)))); elseif (t_1 <= 0.1) tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1.0], N[(th * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e-176], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(-0.5 * N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.1], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_1 \leq -1:\\
\;\;\;\;th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, kx\right)}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-176}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{\mathsf{fma}\left(-0.5, \cos \left(kx \cdot -2\right), 0.5\right)}}\\
\mathbf{elif}\;t\_1 \leq 0.1:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -1Initial program 82.1%
+-commutativeN/A
unpow2N/A
unpow2N/A
accelerator-lowering-hypot.f64N/A
sin-lowering-sin.f64N/A
sin-lowering-sin.f6499.9
Applied egg-rr99.9%
Taylor expanded in th around 0
Simplified43.6%
Taylor expanded in kx around 0
Simplified43.6%
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))))) < 2e-176Initial program 99.7%
sqrt-lowering-sqrt.f64N/A
+-commutativeN/A
unpow2N/A
sin-multN/A
div-invN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
count-2N/A
+-inversesN/A
cos-0N/A
--lowering--.f64N/A
count-2N/A
cos-lowering-cos.f64N/A
+-lowering-+.f64N/A
unpow2N/A
sqr-sin-aN/A
cancel-sign-sub-invN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
count-2N/A
cos-lowering-cos.f64N/A
+-lowering-+.f6485.2
Applied egg-rr85.2%
Taylor expanded in ky around 0
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
accelerator-lowering-fma.f64N/A
cos-negN/A
cos-lowering-cos.f64N/A
*-commutativeN/A
*-lowering-*.f6461.9
Simplified61.9%
if 2e-176 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.10000000000000001Initial program 99.7%
Taylor expanded in ky around 0
sin-lowering-sin.f6469.1
Simplified69.1%
if 0.10000000000000001 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 95.2%
Taylor expanded in kx around 0
sin-lowering-sin.f6470.7
Simplified70.7%
Final simplification62.0%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
(if (<= t_1 -0.05)
(*
th
(* (sqrt (/ 1.0 (- 1.0 (cos (* ky -2.0))))) (* (sin ky) (sqrt 2.0))))
(if (<= t_1 2e-176)
(* (sin th) (* ky (sqrt (/ 1.0 (fma -0.5 (cos (* kx -2.0)) 0.5)))))
(if (<= t_1 0.1) (* (sin th) (/ (sin ky) (sin kx))) (sin th))))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double tmp;
if (t_1 <= -0.05) {
tmp = th * (sqrt((1.0 / (1.0 - cos((ky * -2.0))))) * (sin(ky) * sqrt(2.0)));
} else if (t_1 <= 2e-176) {
tmp = sin(th) * (ky * sqrt((1.0 / fma(-0.5, cos((kx * -2.0)), 0.5))));
} else if (t_1 <= 0.1) {
tmp = sin(th) * (sin(ky) / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_1 <= -0.05) tmp = Float64(th * Float64(sqrt(Float64(1.0 / Float64(1.0 - cos(Float64(ky * -2.0))))) * Float64(sin(ky) * sqrt(2.0)))); elseif (t_1 <= 2e-176) tmp = Float64(sin(th) * Float64(ky * sqrt(Float64(1.0 / fma(-0.5, cos(Float64(kx * -2.0)), 0.5))))); elseif (t_1 <= 0.1) tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -0.05], N[(th * N[(N[Sqrt[N[(1.0 / N[(1.0 - N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e-176], N[(N[Sin[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], If[LessEqual[t$95$1, 0.1], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_1 \leq -0.05:\\
\;\;\;\;th \cdot \left(\sqrt{\frac{1}{1 - \cos \left(ky \cdot -2\right)}} \cdot \left(\sin ky \cdot \sqrt{2}\right)\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-176}:\\
\;\;\;\;\sin th \cdot \left(ky \cdot \sqrt{\frac{1}{\mathsf{fma}\left(-0.5, \cos \left(kx \cdot -2\right), 0.5\right)}}\right)\\
\mathbf{elif}\;t\_1 \leq 0.1:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.050000000000000003Initial program 88.3%
+-commutativeN/A
unpow2N/A
unpow2N/A
accelerator-lowering-hypot.f64N/A
sin-lowering-sin.f64N/A
sin-lowering-sin.f6499.8
Applied egg-rr99.8%
Taylor expanded in th around 0
Simplified45.8%
div-invN/A
*-commutativeN/A
*-lowering-*.f64N/A
Applied egg-rr36.2%
Taylor expanded in kx around 0
*-commutativeN/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
--lowering--.f64N/A
cos-negN/A
cos-lowering-cos.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
sqrt-lowering-sqrt.f6424.1
Simplified24.1%
if -0.050000000000000003 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2e-176Initial program 99.8%
sqrt-lowering-sqrt.f64N/A
+-commutativeN/A
unpow2N/A
sin-multN/A
div-invN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
count-2N/A
+-inversesN/A
cos-0N/A
--lowering--.f64N/A
count-2N/A
cos-lowering-cos.f64N/A
+-lowering-+.f64N/A
unpow2N/A
sqr-sin-aN/A
cancel-sign-sub-invN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
count-2N/A
cos-lowering-cos.f64N/A
+-lowering-+.f6481.3
Applied egg-rr81.3%
Taylor expanded in ky around 0
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
accelerator-lowering-fma.f64N/A
cos-negN/A
cos-lowering-cos.f64N/A
*-commutativeN/A
*-lowering-*.f6476.6
Simplified76.6%
if 2e-176 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.10000000000000001Initial program 99.7%
Taylor expanded in ky around 0
sin-lowering-sin.f6469.1
Simplified69.1%
if 0.10000000000000001 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 95.2%
Taylor expanded in kx around 0
sin-lowering-sin.f6470.7
Simplified70.7%
Final simplification58.3%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
(if (<= t_1 -0.05)
(*
th
(* (sqrt (/ 1.0 (- 1.0 (cos (* ky -2.0))))) (* (sin ky) (sqrt 2.0))))
(if (<= t_1 2e-176)
(* (sin th) (* ky (sqrt (/ 1.0 (fma -0.5 (cos (* kx -2.0)) 0.5)))))
(if (<= t_1 0.0001) (* (sin th) (/ ky (sin kx))) (sin th))))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double tmp;
if (t_1 <= -0.05) {
tmp = th * (sqrt((1.0 / (1.0 - cos((ky * -2.0))))) * (sin(ky) * sqrt(2.0)));
} else if (t_1 <= 2e-176) {
tmp = sin(th) * (ky * sqrt((1.0 / fma(-0.5, cos((kx * -2.0)), 0.5))));
} else if (t_1 <= 0.0001) {
tmp = sin(th) * (ky / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_1 <= -0.05) tmp = Float64(th * Float64(sqrt(Float64(1.0 / Float64(1.0 - cos(Float64(ky * -2.0))))) * Float64(sin(ky) * sqrt(2.0)))); elseif (t_1 <= 2e-176) tmp = Float64(sin(th) * Float64(ky * sqrt(Float64(1.0 / fma(-0.5, cos(Float64(kx * -2.0)), 0.5))))); elseif (t_1 <= 0.0001) tmp = Float64(sin(th) * Float64(ky / sin(kx))); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -0.05], N[(th * N[(N[Sqrt[N[(1.0 / N[(1.0 - N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e-176], N[(N[Sin[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], If[LessEqual[t$95$1, 0.0001], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_1 \leq -0.05:\\
\;\;\;\;th \cdot \left(\sqrt{\frac{1}{1 - \cos \left(ky \cdot -2\right)}} \cdot \left(\sin ky \cdot \sqrt{2}\right)\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-176}:\\
\;\;\;\;\sin th \cdot \left(ky \cdot \sqrt{\frac{1}{\mathsf{fma}\left(-0.5, \cos \left(kx \cdot -2\right), 0.5\right)}}\right)\\
\mathbf{elif}\;t\_1 \leq 0.0001:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.050000000000000003Initial program 88.3%
+-commutativeN/A
unpow2N/A
unpow2N/A
accelerator-lowering-hypot.f64N/A
sin-lowering-sin.f64N/A
sin-lowering-sin.f6499.8
Applied egg-rr99.8%
Taylor expanded in th around 0
Simplified45.8%
div-invN/A
*-commutativeN/A
*-lowering-*.f64N/A
Applied egg-rr36.2%
Taylor expanded in kx around 0
*-commutativeN/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
--lowering--.f64N/A
cos-negN/A
cos-lowering-cos.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
sqrt-lowering-sqrt.f6424.1
Simplified24.1%
if -0.050000000000000003 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2e-176Initial program 99.8%
sqrt-lowering-sqrt.f64N/A
+-commutativeN/A
unpow2N/A
sin-multN/A
div-invN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
count-2N/A
+-inversesN/A
cos-0N/A
--lowering--.f64N/A
count-2N/A
cos-lowering-cos.f64N/A
+-lowering-+.f64N/A
unpow2N/A
sqr-sin-aN/A
cancel-sign-sub-invN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
count-2N/A
cos-lowering-cos.f64N/A
+-lowering-+.f6481.3
Applied egg-rr81.3%
Taylor expanded in ky around 0
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
accelerator-lowering-fma.f64N/A
cos-negN/A
cos-lowering-cos.f64N/A
*-commutativeN/A
*-lowering-*.f6476.6
Simplified76.6%
if 2e-176 < (/.f64 (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.00000000000000005e-4Initial program 99.7%
Taylor expanded in ky around 0
/-lowering-/.f64N/A
sin-lowering-sin.f6473.7
Simplified73.7%
if 1.00000000000000005e-4 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 95.3%
Taylor expanded in kx around 0
sin-lowering-sin.f6469.4
Simplified69.4%
Final simplification58.3%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
(if (<= t_1 -0.05)
(* th (* (sin ky) (/ 1.0 (sqrt (* 0.5 (- 1.0 (cos (* ky -2.0))))))))
(if (<= t_1 2e-176)
(* (sin th) (* ky (sqrt (/ 1.0 (fma -0.5 (cos (* kx -2.0)) 0.5)))))
(if (<= t_1 0.0001) (* (sin th) (/ ky (sin kx))) (sin th))))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double tmp;
if (t_1 <= -0.05) {
tmp = th * (sin(ky) * (1.0 / sqrt((0.5 * (1.0 - cos((ky * -2.0)))))));
} else if (t_1 <= 2e-176) {
tmp = sin(th) * (ky * sqrt((1.0 / fma(-0.5, cos((kx * -2.0)), 0.5))));
} else if (t_1 <= 0.0001) {
tmp = sin(th) * (ky / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_1 <= -0.05) tmp = Float64(th * Float64(sin(ky) * Float64(1.0 / sqrt(Float64(0.5 * Float64(1.0 - cos(Float64(ky * -2.0)))))))); elseif (t_1 <= 2e-176) tmp = Float64(sin(th) * Float64(ky * sqrt(Float64(1.0 / fma(-0.5, cos(Float64(kx * -2.0)), 0.5))))); elseif (t_1 <= 0.0001) tmp = Float64(sin(th) * Float64(ky / sin(kx))); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -0.05], N[(th * N[(N[Sin[ky], $MachinePrecision] * N[(1.0 / N[Sqrt[N[(0.5 * N[(1.0 - N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e-176], N[(N[Sin[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], If[LessEqual[t$95$1, 0.0001], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_1 \leq -0.05:\\
\;\;\;\;th \cdot \left(\sin ky \cdot \frac{1}{\sqrt{0.5 \cdot \left(1 - \cos \left(ky \cdot -2\right)\right)}}\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-176}:\\
\;\;\;\;\sin th \cdot \left(ky \cdot \sqrt{\frac{1}{\mathsf{fma}\left(-0.5, \cos \left(kx \cdot -2\right), 0.5\right)}}\right)\\
\mathbf{elif}\;t\_1 \leq 0.0001:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.050000000000000003Initial program 88.3%
+-commutativeN/A
unpow2N/A
unpow2N/A
accelerator-lowering-hypot.f64N/A
sin-lowering-sin.f64N/A
sin-lowering-sin.f6499.8
Applied egg-rr99.8%
Taylor expanded in th around 0
Simplified45.8%
div-invN/A
*-commutativeN/A
*-lowering-*.f64N/A
Applied egg-rr36.2%
Taylor expanded in kx around 0
*-lowering-*.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
--lowering--.f64N/A
cos-negN/A
cos-lowering-cos.f64N/A
*-commutativeN/A
*-lowering-*.f6424.0
Simplified24.0%
if -0.050000000000000003 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2e-176Initial program 99.8%
sqrt-lowering-sqrt.f64N/A
+-commutativeN/A
unpow2N/A
sin-multN/A
div-invN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
count-2N/A
+-inversesN/A
cos-0N/A
--lowering--.f64N/A
count-2N/A
cos-lowering-cos.f64N/A
+-lowering-+.f64N/A
unpow2N/A
sqr-sin-aN/A
cancel-sign-sub-invN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
count-2N/A
cos-lowering-cos.f64N/A
+-lowering-+.f6481.3
Applied egg-rr81.3%
Taylor expanded in ky around 0
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
accelerator-lowering-fma.f64N/A
cos-negN/A
cos-lowering-cos.f64N/A
*-commutativeN/A
*-lowering-*.f6476.6
Simplified76.6%
if 2e-176 < (/.f64 (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.00000000000000005e-4Initial program 99.7%
Taylor expanded in ky around 0
/-lowering-/.f64N/A
sin-lowering-sin.f6473.7
Simplified73.7%
if 1.00000000000000005e-4 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 95.3%
Taylor expanded in kx around 0
sin-lowering-sin.f6469.4
Simplified69.4%
Final simplification58.3%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
(if (<= t_1 2e-176)
(* (sin th) (* ky (sqrt (/ 1.0 (fma -0.5 (cos (* kx -2.0)) 0.5)))))
(if (<= t_1 0.0001) (* (sin th) (/ ky (sin kx))) (sin th)))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double tmp;
if (t_1 <= 2e-176) {
tmp = sin(th) * (ky * sqrt((1.0 / fma(-0.5, cos((kx * -2.0)), 0.5))));
} else if (t_1 <= 0.0001) {
tmp = sin(th) * (ky / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_1 <= 2e-176) tmp = Float64(sin(th) * Float64(ky * sqrt(Float64(1.0 / fma(-0.5, cos(Float64(kx * -2.0)), 0.5))))); elseif (t_1 <= 0.0001) tmp = Float64(sin(th) * Float64(ky / sin(kx))); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 2e-176], N[(N[Sin[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], If[LessEqual[t$95$1, 0.0001], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_1 \leq 2 \cdot 10^{-176}:\\
\;\;\;\;\sin th \cdot \left(ky \cdot \sqrt{\frac{1}{\mathsf{fma}\left(-0.5, \cos \left(kx \cdot -2\right), 0.5\right)}}\right)\\
\mathbf{elif}\;t\_1 \leq 0.0001:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2e-176Initial program 93.8%
sqrt-lowering-sqrt.f64N/A
+-commutativeN/A
unpow2N/A
sin-multN/A
div-invN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
count-2N/A
+-inversesN/A
cos-0N/A
--lowering--.f64N/A
count-2N/A
cos-lowering-cos.f64N/A
+-lowering-+.f64N/A
unpow2N/A
sqr-sin-aN/A
cancel-sign-sub-invN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
count-2N/A
cos-lowering-cos.f64N/A
+-lowering-+.f6478.4
Applied egg-rr78.4%
Taylor expanded in ky around 0
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
accelerator-lowering-fma.f64N/A
cos-negN/A
cos-lowering-cos.f64N/A
*-commutativeN/A
*-lowering-*.f6438.4
Simplified38.4%
if 2e-176 < (/.f64 (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.00000000000000005e-4Initial program 99.7%
Taylor expanded in ky around 0
/-lowering-/.f64N/A
sin-lowering-sin.f6473.7
Simplified73.7%
if 1.00000000000000005e-4 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 95.3%
Taylor expanded in kx around 0
sin-lowering-sin.f6469.4
Simplified69.4%
Final simplification52.1%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
(if (<= t_1 2e-176)
(* (sqrt (/ 1.0 (fma -0.5 (cos (* kx -2.0)) 0.5))) (* ky (sin th)))
(if (<= t_1 0.0001) (* (sin th) (/ ky (sin kx))) (sin th)))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double tmp;
if (t_1 <= 2e-176) {
tmp = sqrt((1.0 / fma(-0.5, cos((kx * -2.0)), 0.5))) * (ky * sin(th));
} else if (t_1 <= 0.0001) {
tmp = sin(th) * (ky / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_1 <= 2e-176) tmp = Float64(sqrt(Float64(1.0 / fma(-0.5, cos(Float64(kx * -2.0)), 0.5))) * Float64(ky * sin(th))); elseif (t_1 <= 0.0001) tmp = Float64(sin(th) * Float64(ky / sin(kx))); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 2e-176], N[(N[Sqrt[N[(1.0 / N[(-0.5 * N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0001], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_1 \leq 2 \cdot 10^{-176}:\\
\;\;\;\;\sqrt{\frac{1}{\mathsf{fma}\left(-0.5, \cos \left(kx \cdot -2\right), 0.5\right)}} \cdot \left(ky \cdot \sin th\right)\\
\mathbf{elif}\;t\_1 \leq 0.0001:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2e-176Initial program 93.8%
sqrt-lowering-sqrt.f64N/A
+-commutativeN/A
unpow2N/A
sin-multN/A
div-invN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
count-2N/A
+-inversesN/A
cos-0N/A
--lowering--.f64N/A
count-2N/A
cos-lowering-cos.f64N/A
+-lowering-+.f64N/A
unpow2N/A
sqr-sin-aN/A
cancel-sign-sub-invN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
count-2N/A
cos-lowering-cos.f64N/A
+-lowering-+.f6478.4
Applied egg-rr78.4%
Taylor expanded in ky around 0
*-lowering-*.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
accelerator-lowering-fma.f64N/A
cos-negN/A
cos-lowering-cos.f64N/A
*-commutativeN/A
*-lowering-*.f6438.2
Simplified38.2%
if 2e-176 < (/.f64 (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.00000000000000005e-4Initial program 99.7%
Taylor expanded in ky around 0
/-lowering-/.f64N/A
sin-lowering-sin.f6473.7
Simplified73.7%
if 1.00000000000000005e-4 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 95.3%
Taylor expanded in kx around 0
sin-lowering-sin.f6469.4
Simplified69.4%
Final simplification52.0%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 0.0001) (* (sin th) (/ ky (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) <= 0.0001) {
tmp = sin(th) * (ky / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if ((sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) <= 0.0001d0) then
tmp = sin(th) * (ky / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if ((Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) <= 0.0001) {
tmp = Math.sin(th) * (ky / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) <= 0.0001: tmp = math.sin(th) * (ky / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 0.0001) tmp = Float64(sin(th) * Float64(ky / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 0.0001) tmp = sin(th) * (ky / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 0.0001], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 0.0001:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 1.00000000000000005e-4Initial program 94.6%
Taylor expanded in ky around 0
/-lowering-/.f64N/A
sin-lowering-sin.f6439.2
Simplified39.2%
if 1.00000000000000005e-4 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 95.3%
Taylor expanded in kx around 0
sin-lowering-sin.f6469.4
Simplified69.4%
Final simplification49.4%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 0.02) (* (sin ky) (/ (sin th) kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) <= 0.02) {
tmp = sin(ky) * (sin(th) / kx);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if ((sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) <= 0.02d0) then
tmp = sin(ky) * (sin(th) / kx)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if ((Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) <= 0.02) {
tmp = Math.sin(ky) * (Math.sin(th) / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) <= 0.02: tmp = math.sin(ky) * (math.sin(th) / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 0.02) tmp = Float64(sin(ky) * Float64(sin(th) / kx)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 0.02) tmp = sin(ky) * (sin(th) / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 0.02], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 0.02:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.0200000000000000004Initial program 94.6%
associate-*l/N/A
frac-2negN/A
div-invN/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
neg-lowering-neg.f64N/A
sin-lowering-sin.f64N/A
neg-mul-1N/A
associate-/r*N/A
metadata-evalN/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
+-commutativeN/A
Applied egg-rr74.6%
Taylor expanded in ky around 0
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
accelerator-lowering-fma.f64N/A
cos-negN/A
cos-lowering-cos.f64N/A
*-commutativeN/A
*-lowering-*.f6443.3
Simplified43.3%
Taylor expanded in kx around 0
associate-/l*N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
/-lowering-/.f64N/A
sin-lowering-sin.f6424.0
Simplified24.0%
if 0.0200000000000000004 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 95.3%
Taylor expanded in kx around 0
sin-lowering-sin.f6469.4
Simplified69.4%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 0.0001) (* (* (sin th) (* ky (fma (* ky ky) 0.16666666666666666 -1.0))) (/ -1.0 kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) <= 0.0001) {
tmp = (sin(th) * (ky * fma((ky * ky), 0.16666666666666666, -1.0))) * (-1.0 / kx);
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 0.0001) tmp = Float64(Float64(sin(th) * Float64(ky * fma(Float64(ky * ky), 0.16666666666666666, -1.0))) * Float64(-1.0 / kx)); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 0.0001], N[(N[(N[Sin[th], $MachinePrecision] * N[(ky * N[(N[(ky * ky), $MachinePrecision] * 0.16666666666666666 + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-1.0 / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 0.0001:\\
\;\;\;\;\left(\sin th \cdot \left(ky \cdot \mathsf{fma}\left(ky \cdot ky, 0.16666666666666666, -1\right)\right)\right) \cdot \frac{-1}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 1.00000000000000005e-4Initial program 94.6%
associate-*l/N/A
frac-2negN/A
div-invN/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
neg-lowering-neg.f64N/A
sin-lowering-sin.f64N/A
neg-mul-1N/A
associate-/r*N/A
metadata-evalN/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
+-commutativeN/A
Applied egg-rr74.6%
Taylor expanded in ky around 0
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
accelerator-lowering-fma.f64N/A
cos-negN/A
cos-lowering-cos.f64N/A
*-commutativeN/A
*-lowering-*.f6443.3
Simplified43.3%
Taylor expanded in kx around 0
Simplified23.5%
Taylor expanded in ky around 0
*-lowering-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f6423.1
Simplified23.1%
if 1.00000000000000005e-4 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 95.3%
Taylor expanded in kx around 0
sin-lowering-sin.f6469.4
Simplified69.4%
(FPCore (kx ky th)
:precision binary64
(if (<=
(*
(sin th)
(/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))))
1e-299)
(* -0.16666666666666666 (* th (* th th)))
th))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(th) * (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0))))) <= 1e-299) {
tmp = -0.16666666666666666 * (th * (th * th));
} else {
tmp = th;
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if ((sin(th) * (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0))))) <= 1d-299) then
tmp = (-0.16666666666666666d0) * (th * (th * th))
else
tmp = th
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if ((Math.sin(th) * (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0))))) <= 1e-299) {
tmp = -0.16666666666666666 * (th * (th * th));
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (math.sin(th) * (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0))))) <= 1e-299: tmp = -0.16666666666666666 * (th * (th * th)) else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(th) * Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0))))) <= 1e-299) tmp = Float64(-0.16666666666666666 * Float64(th * Float64(th * th))); else tmp = th; end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((sin(th) * (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0))))) <= 1e-299) tmp = -0.16666666666666666 * (th * (th * th)); else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1e-299], N[(-0.16666666666666666 * N[(th * N[(th * th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], th]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin th \cdot \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 10^{-299}:\\
\;\;\;\;-0.16666666666666666 \cdot \left(th \cdot \left(th \cdot th\right)\right)\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if (*.f64 (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) (sin.f64 th)) < 9.99999999999999992e-300Initial program 94.7%
Taylor expanded in kx around 0
sin-lowering-sin.f6422.9
Simplified22.9%
Taylor expanded in th around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6414.3
Simplified14.3%
Taylor expanded in th around inf
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6417.2
Simplified17.2%
if 9.99999999999999992e-300 < (*.f64 (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) (sin.f64 th)) Initial program 95.0%
Taylor expanded in kx around 0
sin-lowering-sin.f6430.7
Simplified30.7%
Taylor expanded in th around 0
Simplified17.5%
Final simplification17.3%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 0.0001) (/ (* ky (sin th)) kx) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) <= 0.0001) {
tmp = (ky * sin(th)) / kx;
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if ((sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) <= 0.0001d0) then
tmp = (ky * sin(th)) / kx
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if ((Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) <= 0.0001) {
tmp = (ky * Math.sin(th)) / kx;
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) <= 0.0001: tmp = (ky * math.sin(th)) / kx else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 0.0001) tmp = Float64(Float64(ky * sin(th)) / kx); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 0.0001) tmp = (ky * sin(th)) / kx; else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 0.0001], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] / kx), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 0.0001:\\
\;\;\;\;\frac{ky \cdot \sin th}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 1.00000000000000005e-4Initial program 94.6%
associate-*l/N/A
frac-2negN/A
div-invN/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
neg-lowering-neg.f64N/A
sin-lowering-sin.f64N/A
neg-mul-1N/A
associate-/r*N/A
metadata-evalN/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
+-commutativeN/A
Applied egg-rr74.6%
Taylor expanded in ky around 0
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
accelerator-lowering-fma.f64N/A
cos-negN/A
cos-lowering-cos.f64N/A
*-commutativeN/A
*-lowering-*.f6443.3
Simplified43.3%
Taylor expanded in kx around 0
Simplified23.5%
Taylor expanded in ky around 0
/-lowering-/.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f6423.1
Simplified23.1%
if 1.00000000000000005e-4 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 95.3%
Taylor expanded in kx around 0
sin-lowering-sin.f6469.4
Simplified69.4%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 0.0001) (* th (/ ky (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) <= 0.0001) {
tmp = th * (ky / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if ((sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) <= 0.0001d0) then
tmp = th * (ky / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if ((Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) <= 0.0001) {
tmp = th * (ky / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) <= 0.0001: tmp = th * (ky / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 0.0001) tmp = Float64(th * Float64(ky / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 0.0001) tmp = th * (ky / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 0.0001], N[(th * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 0.0001:\\
\;\;\;\;th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 1.00000000000000005e-4Initial program 94.6%
+-commutativeN/A
unpow2N/A
unpow2N/A
accelerator-lowering-hypot.f64N/A
sin-lowering-sin.f64N/A
sin-lowering-sin.f6499.8
Applied egg-rr99.8%
Taylor expanded in th around 0
Simplified49.8%
Taylor expanded in ky around 0
/-lowering-/.f64N/A
sin-lowering-sin.f6422.4
Simplified22.4%
if 1.00000000000000005e-4 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 95.3%
Taylor expanded in kx around 0
sin-lowering-sin.f6469.4
Simplified69.4%
Final simplification38.4%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 0.0001) (* ky (/ th (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) <= 0.0001) {
tmp = ky * (th / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if ((sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) <= 0.0001d0) then
tmp = ky * (th / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if ((Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) <= 0.0001) {
tmp = ky * (th / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) <= 0.0001: tmp = ky * (th / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 0.0001) tmp = Float64(ky * Float64(th / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 0.0001) tmp = ky * (th / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 0.0001], N[(ky * N[(th / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 0.0001:\\
\;\;\;\;ky \cdot \frac{th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 1.00000000000000005e-4Initial program 94.6%
+-commutativeN/A
unpow2N/A
unpow2N/A
accelerator-lowering-hypot.f64N/A
sin-lowering-sin.f64N/A
sin-lowering-sin.f6499.8
Applied egg-rr99.8%
Taylor expanded in th around 0
Simplified49.8%
Taylor expanded in ky around 0
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
sin-lowering-sin.f6422.3
Simplified22.3%
if 1.00000000000000005e-4 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 95.3%
Taylor expanded in kx around 0
sin-lowering-sin.f6469.4
Simplified69.4%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 4e-47) (* -0.16666666666666666 (* th (* th th))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) <= 4e-47) {
tmp = -0.16666666666666666 * (th * (th * th));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if ((sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) <= 4d-47) then
tmp = (-0.16666666666666666d0) * (th * (th * th))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if ((Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) <= 4e-47) {
tmp = -0.16666666666666666 * (th * (th * th));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) <= 4e-47: tmp = -0.16666666666666666 * (th * (th * th)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 4e-47) tmp = Float64(-0.16666666666666666 * Float64(th * Float64(th * th))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 4e-47) tmp = -0.16666666666666666 * (th * (th * th)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 4e-47], N[(-0.16666666666666666 * N[(th * N[(th * th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 4 \cdot 10^{-47}:\\
\;\;\;\;-0.16666666666666666 \cdot \left(th \cdot \left(th \cdot th\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 3.9999999999999999e-47Initial program 94.5%
Taylor expanded in kx around 0
sin-lowering-sin.f643.6
Simplified3.6%
Taylor expanded in th around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f643.6
Simplified3.6%
Taylor expanded in th around inf
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6416.2
Simplified16.2%
if 3.9999999999999999e-47 < (/.f64 (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 95.5%
Taylor expanded in kx around 0
sin-lowering-sin.f6466.1
Simplified66.1%
(FPCore (kx ky th)
:precision binary64
(if (<= ky 5.8e-5)
(* (sin th) (/ (sin ky) (hypot ky (sin kx))))
(*
(sin ky)
(/
(sin th)
(sqrt
(fma (- 1.0 (cos (+ ky ky))) 0.5 (+ 0.5 (* -0.5 (cos (+ kx kx))))))))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 5.8e-5) {
tmp = sin(th) * (sin(ky) / hypot(ky, sin(kx)));
} else {
tmp = sin(ky) * (sin(th) / sqrt(fma((1.0 - cos((ky + ky))), 0.5, (0.5 + (-0.5 * cos((kx + kx)))))));
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (ky <= 5.8e-5) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(ky, sin(kx)))); else tmp = Float64(sin(ky) * Float64(sin(th) / sqrt(fma(Float64(1.0 - cos(Float64(ky + ky))), 0.5, Float64(0.5 + Float64(-0.5 * cos(Float64(kx + kx)))))))); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[ky, 5.8e-5], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[(N[(1.0 - N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5 + N[(0.5 + N[(-0.5 * N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 5.8 \cdot 10^{-5}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sqrt{\mathsf{fma}\left(1 - \cos \left(ky + ky\right), 0.5, 0.5 + -0.5 \cdot \cos \left(kx + kx\right)\right)}}\\
\end{array}
\end{array}
if ky < 5.8e-5Initial program 93.6%
+-commutativeN/A
unpow2N/A
unpow2N/A
accelerator-lowering-hypot.f64N/A
sin-lowering-sin.f64N/A
sin-lowering-sin.f6499.8
Applied egg-rr99.8%
Taylor expanded in ky around 0
Simplified67.3%
if 5.8e-5 < ky Initial program 99.7%
associate-*l/N/A
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
Applied egg-rr99.4%
Final simplification73.8%
(FPCore (kx ky th)
:precision binary64
(if (<= ky 5.8e-5)
(* (sin th) (/ (sin ky) (hypot ky (sin kx))))
(*
(sin th)
(/
(sin ky)
(sqrt
(fma (- 1.0 (cos (+ ky ky))) 0.5 (+ 0.5 (* -0.5 (cos (+ kx kx))))))))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 5.8e-5) {
tmp = sin(th) * (sin(ky) / hypot(ky, sin(kx)));
} else {
tmp = sin(th) * (sin(ky) / sqrt(fma((1.0 - cos((ky + ky))), 0.5, (0.5 + (-0.5 * cos((kx + kx)))))));
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (ky <= 5.8e-5) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(ky, sin(kx)))); else tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(fma(Float64(1.0 - cos(Float64(ky + ky))), 0.5, Float64(0.5 + Float64(-0.5 * cos(Float64(kx + kx)))))))); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[ky, 5.8e-5], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[ky ^ 2 + N[Sin[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[(-0.5 * N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 5.8 \cdot 10^{-5}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{\mathsf{fma}\left(1 - \cos \left(ky + ky\right), 0.5, 0.5 + -0.5 \cdot \cos \left(kx + kx\right)\right)}}\\
\end{array}
\end{array}
if ky < 5.8e-5Initial program 93.6%
+-commutativeN/A
unpow2N/A
unpow2N/A
accelerator-lowering-hypot.f64N/A
sin-lowering-sin.f64N/A
sin-lowering-sin.f6499.8
Applied egg-rr99.8%
Taylor expanded in ky around 0
Simplified67.3%
if 5.8e-5 < ky Initial program 99.7%
sqrt-lowering-sqrt.f64N/A
+-commutativeN/A
unpow2N/A
sin-multN/A
div-invN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
count-2N/A
+-inversesN/A
cos-0N/A
--lowering--.f64N/A
count-2N/A
cos-lowering-cos.f64N/A
+-lowering-+.f64N/A
unpow2N/A
sqr-sin-aN/A
cancel-sign-sub-invN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
count-2N/A
cos-lowering-cos.f64N/A
+-lowering-+.f6499.3
Applied egg-rr99.3%
Final simplification73.8%
(FPCore (kx ky th) :precision binary64 th)
double code(double kx, double ky, double th) {
return th;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = th
end function
public static double code(double kx, double ky, double th) {
return th;
}
def code(kx, ky, th): return th
function code(kx, ky, th) return th end
function tmp = code(kx, ky, th) tmp = th; end
code[kx_, ky_, th_] := th
\begin{array}{l}
\\
th
\end{array}
Initial program 94.8%
Taylor expanded in kx around 0
sin-lowering-sin.f6426.1
Simplified26.1%
Taylor expanded in th around 0
Simplified15.5%
herbie shell --seed 2024198
(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)))