
(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 30 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\end{array}
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (hypot (sin ky) (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / hypot(sin(ky), sin(kx))) * sin(th);
}
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot \sin th
\end{array}
Initial program 93.0%
lift-sin.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6499.6
Applied egg-rr99.6%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1
(*
(/ (sin ky) (hypot (sin ky) (sin kx)))
(* th (fma -0.16666666666666666 (* th th) 1.0))))
(t_2 (pow (sin kx) 2.0))
(t_3 (pow (sin ky) 2.0))
(t_4 (/ (sin ky) (sqrt (+ t_2 t_3)))))
(if (<= t_4 -0.998)
(*
(sin ky)
(/
(sin th)
(sqrt
(fma
-0.5
(cos (* ky -2.0))
(fma (* kx kx) (fma (* kx kx) -0.3333333333333333 1.0) 0.5)))))
(if (<= t_4 -0.05)
t_1
(if (<= t_4 0.34)
(* (sin th) (/ (sin ky) (sqrt t_2)))
(if (<= t_4 0.998)
t_1
(if (<= t_4 2.0)
(* (sin th) (fma (* kx kx) (/ -0.5 t_3) 1.0))
(*
(sin th)
(/
(fma ky (* -0.16666666666666666 (* ky ky)) ky)
(hypot (sin kx) ky))))))))))
double code(double kx, double ky, double th) {
double t_1 = (sin(ky) / hypot(sin(ky), sin(kx))) * (th * fma(-0.16666666666666666, (th * th), 1.0));
double t_2 = pow(sin(kx), 2.0);
double t_3 = pow(sin(ky), 2.0);
double t_4 = sin(ky) / sqrt((t_2 + t_3));
double tmp;
if (t_4 <= -0.998) {
tmp = sin(ky) * (sin(th) / sqrt(fma(-0.5, cos((ky * -2.0)), fma((kx * kx), fma((kx * kx), -0.3333333333333333, 1.0), 0.5))));
} else if (t_4 <= -0.05) {
tmp = t_1;
} else if (t_4 <= 0.34) {
tmp = sin(th) * (sin(ky) / sqrt(t_2));
} else if (t_4 <= 0.998) {
tmp = t_1;
} else if (t_4 <= 2.0) {
tmp = sin(th) * fma((kx * kx), (-0.5 / t_3), 1.0);
} else {
tmp = sin(th) * (fma(ky, (-0.16666666666666666 * (ky * ky)), ky) / hypot(sin(kx), ky));
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * Float64(th * fma(-0.16666666666666666, Float64(th * th), 1.0))) t_2 = sin(kx) ^ 2.0 t_3 = sin(ky) ^ 2.0 t_4 = Float64(sin(ky) / sqrt(Float64(t_2 + t_3))) tmp = 0.0 if (t_4 <= -0.998) tmp = Float64(sin(ky) * Float64(sin(th) / sqrt(fma(-0.5, cos(Float64(ky * -2.0)), fma(Float64(kx * kx), fma(Float64(kx * kx), -0.3333333333333333, 1.0), 0.5))))); elseif (t_4 <= -0.05) tmp = t_1; elseif (t_4 <= 0.34) tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(t_2))); elseif (t_4 <= 0.998) tmp = t_1; elseif (t_4 <= 2.0) tmp = Float64(sin(th) * fma(Float64(kx * kx), Float64(-0.5 / t_3), 1.0)); else tmp = Float64(sin(th) * Float64(fma(ky, Float64(-0.16666666666666666 * Float64(ky * ky)), ky) / hypot(sin(kx), ky))); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[(th * N[(-0.16666666666666666 * N[(th * th), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$3 = N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$4 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$2 + t$95$3), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$4, -0.998], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + N[(N[(kx * kx), $MachinePrecision] * N[(N[(kx * kx), $MachinePrecision] * -0.3333333333333333 + 1.0), $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, -0.05], t$95$1, If[LessEqual[t$95$4, 0.34], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[t$95$2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 0.998], t$95$1, If[LessEqual[t$95$4, 2.0], N[(N[Sin[th], $MachinePrecision] * N[(N[(kx * kx), $MachinePrecision] * N[(-0.5 / t$95$3), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[(ky * N[(-0.16666666666666666 * N[(ky * ky), $MachinePrecision]), $MachinePrecision] + ky), $MachinePrecision] / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + ky ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot \left(th \cdot \mathsf{fma}\left(-0.16666666666666666, th \cdot th, 1\right)\right)\\
t_2 := {\sin kx}^{2}\\
t_3 := {\sin ky}^{2}\\
t_4 := \frac{\sin ky}{\sqrt{t\_2 + t\_3}}\\
\mathbf{if}\;t\_4 \leq -0.998:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sqrt{\mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), \mathsf{fma}\left(kx \cdot kx, \mathsf{fma}\left(kx \cdot kx, -0.3333333333333333, 1\right), 0.5\right)\right)}}\\
\mathbf{elif}\;t\_4 \leq -0.05:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_4 \leq 0.34:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{t\_2}}\\
\mathbf{elif}\;t\_4 \leq 0.998:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_4 \leq 2:\\
\;\;\;\;\sin th \cdot \mathsf{fma}\left(kx \cdot kx, \frac{-0.5}{t\_3}, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\mathsf{fma}\left(ky, -0.16666666666666666 \cdot \left(ky \cdot ky\right), ky\right)}{\mathsf{hypot}\left(\sin kx, ky\right)}\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.998Initial program 81.5%
Applied egg-rr64.9%
Taylor expanded in kx around 0
+-commutativeN/A
associate-+l+N/A
lower-fma.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6464.9
Simplified64.9%
if -0.998 < (/.f64 (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.050000000000000003 or 0.340000000000000024 < (/.f64 (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.998Initial program 99.4%
lift-sin.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6499.4
Applied egg-rr99.4%
Taylor expanded in th around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6455.0
Simplified55.0%
if -0.050000000000000003 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.340000000000000024Initial program 98.8%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6492.4
Simplified92.4%
Taylor expanded in ky around 0
lower-pow.f64N/A
lower-sin.f6493.5
Simplified93.5%
if 0.998 < (/.f64 (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 100.0%
Taylor expanded in kx around 0
*-commutativeN/A
associate-*l/N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
associate-*r/N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
lower-/.f64N/A
lower-pow.f64N/A
lower-sin.f6499.4
Simplified99.4%
if 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 2.4%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f642.4
Simplified2.4%
lift-sin.f64N/A
pow2N/A
lower-hypot.f6499.7
Applied egg-rr99.7%
Taylor expanded in ky around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6499.7
Simplified99.7%
Final simplification79.3%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (cos (* ky -2.0)))
(t_2 (pow (sin kx) 2.0))
(t_3 (pow (sin ky) 2.0))
(t_4 (/ (sin ky) (sqrt (+ t_2 t_3)))))
(if (<= t_4 -0.998)
(*
(sin ky)
(/
(sin th)
(sqrt
(fma
-0.5
t_1
(fma (* kx kx) (fma (* kx kx) -0.3333333333333333 1.0) 0.5)))))
(if (<= t_4 -0.05)
(*
(* th (fma -0.16666666666666666 (* th th) 1.0))
(*
(sin ky)
(sqrt
(/
1.0
(fma
(- 1.0 (cos (+ kx kx)))
0.5
(+ 0.5 (* -0.5 (cos (+ ky ky)))))))))
(if (<= t_4 0.34)
(* (sin th) (/ (sin ky) (sqrt t_2)))
(if (<= t_4 0.998)
(*
(sin ky)
(*
th
(sqrt
(/
1.0
(+ 0.5 (fma -0.5 t_1 (fma -0.5 (cos (* kx -2.0)) 0.5)))))))
(if (<= t_4 2.0)
(* (sin th) (fma (* kx kx) (/ -0.5 t_3) 1.0))
(*
(sin th)
(/
(fma ky (* -0.16666666666666666 (* ky ky)) ky)
(hypot (sin kx) ky))))))))))
double code(double kx, double ky, double th) {
double t_1 = cos((ky * -2.0));
double t_2 = pow(sin(kx), 2.0);
double t_3 = pow(sin(ky), 2.0);
double t_4 = sin(ky) / sqrt((t_2 + t_3));
double tmp;
if (t_4 <= -0.998) {
tmp = sin(ky) * (sin(th) / sqrt(fma(-0.5, t_1, fma((kx * kx), fma((kx * kx), -0.3333333333333333, 1.0), 0.5))));
} else if (t_4 <= -0.05) {
tmp = (th * fma(-0.16666666666666666, (th * th), 1.0)) * (sin(ky) * sqrt((1.0 / fma((1.0 - cos((kx + kx))), 0.5, (0.5 + (-0.5 * cos((ky + ky))))))));
} else if (t_4 <= 0.34) {
tmp = sin(th) * (sin(ky) / sqrt(t_2));
} else if (t_4 <= 0.998) {
tmp = sin(ky) * (th * sqrt((1.0 / (0.5 + fma(-0.5, t_1, fma(-0.5, cos((kx * -2.0)), 0.5))))));
} else if (t_4 <= 2.0) {
tmp = sin(th) * fma((kx * kx), (-0.5 / t_3), 1.0);
} else {
tmp = sin(th) * (fma(ky, (-0.16666666666666666 * (ky * ky)), ky) / hypot(sin(kx), ky));
}
return tmp;
}
function code(kx, ky, th) t_1 = cos(Float64(ky * -2.0)) t_2 = sin(kx) ^ 2.0 t_3 = sin(ky) ^ 2.0 t_4 = Float64(sin(ky) / sqrt(Float64(t_2 + t_3))) tmp = 0.0 if (t_4 <= -0.998) tmp = Float64(sin(ky) * Float64(sin(th) / sqrt(fma(-0.5, t_1, fma(Float64(kx * kx), fma(Float64(kx * kx), -0.3333333333333333, 1.0), 0.5))))); elseif (t_4 <= -0.05) tmp = Float64(Float64(th * fma(-0.16666666666666666, Float64(th * th), 1.0)) * Float64(sin(ky) * sqrt(Float64(1.0 / fma(Float64(1.0 - cos(Float64(kx + kx))), 0.5, Float64(0.5 + Float64(-0.5 * cos(Float64(ky + ky))))))))); elseif (t_4 <= 0.34) tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(t_2))); elseif (t_4 <= 0.998) tmp = Float64(sin(ky) * Float64(th * sqrt(Float64(1.0 / Float64(0.5 + fma(-0.5, t_1, fma(-0.5, cos(Float64(kx * -2.0)), 0.5))))))); elseif (t_4 <= 2.0) tmp = Float64(sin(th) * fma(Float64(kx * kx), Float64(-0.5 / t_3), 1.0)); else tmp = Float64(sin(th) * Float64(fma(ky, Float64(-0.16666666666666666 * Float64(ky * ky)), ky) / hypot(sin(kx), ky))); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$3 = N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$4 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$2 + t$95$3), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$4, -0.998], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[(-0.5 * t$95$1 + N[(N[(kx * kx), $MachinePrecision] * N[(N[(kx * kx), $MachinePrecision] * -0.3333333333333333 + 1.0), $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, -0.05], N[(N[(th * N[(-0.16666666666666666 * N[(th * th), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] * N[Sqrt[N[(1.0 / N[(N[(1.0 - N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5 + N[(0.5 + N[(-0.5 * N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 0.34], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[t$95$2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 0.998], N[(N[Sin[ky], $MachinePrecision] * N[(th * N[Sqrt[N[(1.0 / N[(0.5 + N[(-0.5 * t$95$1 + N[(-0.5 * N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 2.0], N[(N[Sin[th], $MachinePrecision] * N[(N[(kx * kx), $MachinePrecision] * N[(-0.5 / t$95$3), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[(ky * N[(-0.16666666666666666 * N[(ky * ky), $MachinePrecision]), $MachinePrecision] + ky), $MachinePrecision] / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + ky ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \cos \left(ky \cdot -2\right)\\
t_2 := {\sin kx}^{2}\\
t_3 := {\sin ky}^{2}\\
t_4 := \frac{\sin ky}{\sqrt{t\_2 + t\_3}}\\
\mathbf{if}\;t\_4 \leq -0.998:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sqrt{\mathsf{fma}\left(-0.5, t\_1, \mathsf{fma}\left(kx \cdot kx, \mathsf{fma}\left(kx \cdot kx, -0.3333333333333333, 1\right), 0.5\right)\right)}}\\
\mathbf{elif}\;t\_4 \leq -0.05:\\
\;\;\;\;\left(th \cdot \mathsf{fma}\left(-0.16666666666666666, th \cdot th, 1\right)\right) \cdot \left(\sin ky \cdot \sqrt{\frac{1}{\mathsf{fma}\left(1 - \cos \left(kx + kx\right), 0.5, 0.5 + -0.5 \cdot \cos \left(ky + ky\right)\right)}}\right)\\
\mathbf{elif}\;t\_4 \leq 0.34:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{t\_2}}\\
\mathbf{elif}\;t\_4 \leq 0.998:\\
\;\;\;\;\sin ky \cdot \left(th \cdot \sqrt{\frac{1}{0.5 + \mathsf{fma}\left(-0.5, t\_1, \mathsf{fma}\left(-0.5, \cos \left(kx \cdot -2\right), 0.5\right)\right)}}\right)\\
\mathbf{elif}\;t\_4 \leq 2:\\
\;\;\;\;\sin th \cdot \mathsf{fma}\left(kx \cdot kx, \frac{-0.5}{t\_3}, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\mathsf{fma}\left(ky, -0.16666666666666666 \cdot \left(ky \cdot ky\right), ky\right)}{\mathsf{hypot}\left(\sin kx, ky\right)}\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.998Initial program 81.5%
Applied egg-rr64.9%
Taylor expanded in kx around 0
+-commutativeN/A
associate-+l+N/A
lower-fma.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6464.9
Simplified64.9%
if -0.998 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.050000000000000003Initial program 99.3%
Applied egg-rr96.0%
Taylor expanded in th around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6450.7
Simplified50.7%
if -0.050000000000000003 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.340000000000000024Initial program 98.8%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6492.4
Simplified92.4%
Taylor expanded in ky around 0
lower-pow.f64N/A
lower-sin.f6493.5
Simplified93.5%
if 0.340000000000000024 < (/.f64 (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.998Initial program 99.4%
Applied egg-rr99.3%
Taylor expanded in th around 0
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-+.f64N/A
sub-negN/A
metadata-evalN/A
distribute-lft-neg-inN/A
sub-negN/A
sub-negN/A
distribute-lft-inN/A
Simplified56.5%
if 0.998 < (/.f64 (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 100.0%
Taylor expanded in kx around 0
*-commutativeN/A
associate-*l/N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
associate-*r/N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
lower-/.f64N/A
lower-pow.f64N/A
lower-sin.f6499.4
Simplified99.4%
if 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 2.4%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f642.4
Simplified2.4%
lift-sin.f64N/A
pow2N/A
lower-hypot.f6499.7
Applied egg-rr99.7%
Taylor expanded in ky around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6499.7
Simplified99.7%
Final simplification78.9%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (cos (* ky -2.0)))
(t_2 (hypot (sin kx) ky))
(t_3 (pow (sin ky) 2.0))
(t_4 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) t_3)))))
(if (<= t_4 -0.998)
(*
(sin ky)
(/
(sin th)
(sqrt
(fma
-0.5
t_1
(fma (* kx kx) (fma (* kx kx) -0.3333333333333333 1.0) 0.5)))))
(if (<= t_4 -0.05)
(*
(* th (fma -0.16666666666666666 (* th th) 1.0))
(*
(sin ky)
(sqrt
(/
1.0
(fma
(- 1.0 (cos (+ kx kx)))
0.5
(+ 0.5 (* -0.5 (cos (+ ky ky)))))))))
(if (<= t_4 0.2)
(* (sin th) (/ (sin ky) t_2))
(if (<= t_4 0.998)
(*
(sin ky)
(*
th
(sqrt
(/
1.0
(+ 0.5 (fma -0.5 t_1 (fma -0.5 (cos (* kx -2.0)) 0.5)))))))
(if (<= t_4 2.0)
(* (sin th) (fma (* kx kx) (/ -0.5 t_3) 1.0))
(*
(sin th)
(/ (fma ky (* -0.16666666666666666 (* ky ky)) ky) t_2)))))))))
double code(double kx, double ky, double th) {
double t_1 = cos((ky * -2.0));
double t_2 = hypot(sin(kx), ky);
double t_3 = pow(sin(ky), 2.0);
double t_4 = sin(ky) / sqrt((pow(sin(kx), 2.0) + t_3));
double tmp;
if (t_4 <= -0.998) {
tmp = sin(ky) * (sin(th) / sqrt(fma(-0.5, t_1, fma((kx * kx), fma((kx * kx), -0.3333333333333333, 1.0), 0.5))));
} else if (t_4 <= -0.05) {
tmp = (th * fma(-0.16666666666666666, (th * th), 1.0)) * (sin(ky) * sqrt((1.0 / fma((1.0 - cos((kx + kx))), 0.5, (0.5 + (-0.5 * cos((ky + ky))))))));
} else if (t_4 <= 0.2) {
tmp = sin(th) * (sin(ky) / t_2);
} else if (t_4 <= 0.998) {
tmp = sin(ky) * (th * sqrt((1.0 / (0.5 + fma(-0.5, t_1, fma(-0.5, cos((kx * -2.0)), 0.5))))));
} else if (t_4 <= 2.0) {
tmp = sin(th) * fma((kx * kx), (-0.5 / t_3), 1.0);
} else {
tmp = sin(th) * (fma(ky, (-0.16666666666666666 * (ky * ky)), ky) / t_2);
}
return tmp;
}
function code(kx, ky, th) t_1 = cos(Float64(ky * -2.0)) t_2 = hypot(sin(kx), ky) t_3 = sin(ky) ^ 2.0 t_4 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + t_3))) tmp = 0.0 if (t_4 <= -0.998) tmp = Float64(sin(ky) * Float64(sin(th) / sqrt(fma(-0.5, t_1, fma(Float64(kx * kx), fma(Float64(kx * kx), -0.3333333333333333, 1.0), 0.5))))); elseif (t_4 <= -0.05) tmp = Float64(Float64(th * fma(-0.16666666666666666, Float64(th * th), 1.0)) * Float64(sin(ky) * sqrt(Float64(1.0 / fma(Float64(1.0 - cos(Float64(kx + kx))), 0.5, Float64(0.5 + Float64(-0.5 * cos(Float64(ky + ky))))))))); elseif (t_4 <= 0.2) tmp = Float64(sin(th) * Float64(sin(ky) / t_2)); elseif (t_4 <= 0.998) tmp = Float64(sin(ky) * Float64(th * sqrt(Float64(1.0 / Float64(0.5 + fma(-0.5, t_1, fma(-0.5, cos(Float64(kx * -2.0)), 0.5))))))); elseif (t_4 <= 2.0) tmp = Float64(sin(th) * fma(Float64(kx * kx), Float64(-0.5 / t_3), 1.0)); else tmp = Float64(sin(th) * Float64(fma(ky, Float64(-0.16666666666666666 * Float64(ky * ky)), ky) / t_2)); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + ky ^ 2], $MachinePrecision]}, Block[{t$95$3 = N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$4 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + t$95$3), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$4, -0.998], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[(-0.5 * t$95$1 + N[(N[(kx * kx), $MachinePrecision] * N[(N[(kx * kx), $MachinePrecision] * -0.3333333333333333 + 1.0), $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, -0.05], N[(N[(th * N[(-0.16666666666666666 * N[(th * th), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] * N[Sqrt[N[(1.0 / N[(N[(1.0 - N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5 + N[(0.5 + N[(-0.5 * N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 0.2], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 0.998], N[(N[Sin[ky], $MachinePrecision] * N[(th * N[Sqrt[N[(1.0 / N[(0.5 + N[(-0.5 * t$95$1 + N[(-0.5 * N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 2.0], N[(N[Sin[th], $MachinePrecision] * N[(N[(kx * kx), $MachinePrecision] * N[(-0.5 / t$95$3), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[(ky * N[(-0.16666666666666666 * N[(ky * ky), $MachinePrecision]), $MachinePrecision] + ky), $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \cos \left(ky \cdot -2\right)\\
t_2 := \mathsf{hypot}\left(\sin kx, ky\right)\\
t_3 := {\sin ky}^{2}\\
t_4 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + t\_3}}\\
\mathbf{if}\;t\_4 \leq -0.998:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sqrt{\mathsf{fma}\left(-0.5, t\_1, \mathsf{fma}\left(kx \cdot kx, \mathsf{fma}\left(kx \cdot kx, -0.3333333333333333, 1\right), 0.5\right)\right)}}\\
\mathbf{elif}\;t\_4 \leq -0.05:\\
\;\;\;\;\left(th \cdot \mathsf{fma}\left(-0.16666666666666666, th \cdot th, 1\right)\right) \cdot \left(\sin ky \cdot \sqrt{\frac{1}{\mathsf{fma}\left(1 - \cos \left(kx + kx\right), 0.5, 0.5 + -0.5 \cdot \cos \left(ky + ky\right)\right)}}\right)\\
\mathbf{elif}\;t\_4 \leq 0.2:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{t\_2}\\
\mathbf{elif}\;t\_4 \leq 0.998:\\
\;\;\;\;\sin ky \cdot \left(th \cdot \sqrt{\frac{1}{0.5 + \mathsf{fma}\left(-0.5, t\_1, \mathsf{fma}\left(-0.5, \cos \left(kx \cdot -2\right), 0.5\right)\right)}}\right)\\
\mathbf{elif}\;t\_4 \leq 2:\\
\;\;\;\;\sin th \cdot \mathsf{fma}\left(kx \cdot kx, \frac{-0.5}{t\_3}, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\mathsf{fma}\left(ky, -0.16666666666666666 \cdot \left(ky \cdot ky\right), ky\right)}{t\_2}\\
\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.998Initial program 81.5%
Applied egg-rr64.9%
Taylor expanded in kx around 0
+-commutativeN/A
associate-+l+N/A
lower-fma.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6464.9
Simplified64.9%
if -0.998 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.050000000000000003Initial program 99.3%
Applied egg-rr96.0%
Taylor expanded in th around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6450.7
Simplified50.7%
if -0.050000000000000003 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.20000000000000001Initial program 98.8%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6494.3
Simplified94.3%
lift-sin.f64N/A
pow2N/A
lower-hypot.f6495.0
Applied egg-rr95.0%
if 0.20000000000000001 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.998Initial program 99.4%
Applied egg-rr99.3%
Taylor expanded in th around 0
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-+.f64N/A
sub-negN/A
metadata-evalN/A
distribute-lft-neg-inN/A
sub-negN/A
sub-negN/A
distribute-lft-inN/A
Simplified59.4%
if 0.998 < (/.f64 (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 100.0%
Taylor expanded in kx around 0
*-commutativeN/A
associate-*l/N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
associate-*r/N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
lower-/.f64N/A
lower-pow.f64N/A
lower-sin.f6499.4
Simplified99.4%
if 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 2.4%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f642.4
Simplified2.4%
lift-sin.f64N/A
pow2N/A
lower-hypot.f6499.7
Applied egg-rr99.7%
Taylor expanded in ky around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6499.7
Simplified99.7%
Final simplification79.5%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (cos (* ky -2.0)))
(t_2 (pow (sin ky) 2.0))
(t_3 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) t_2))))
(t_4 (hypot (sin kx) ky)))
(if (<= t_3 -0.998)
(*
(sin ky)
(/
(sin th)
(sqrt
(fma
-0.5
t_1
(fma (* kx kx) (fma (* kx kx) -0.3333333333333333 1.0) 0.5)))))
(if (<= t_3 -0.05)
(*
(* th (fma -0.16666666666666666 (* th th) 1.0))
(*
(sin ky)
(sqrt
(/
1.0
(fma
(- 1.0 (cos (+ kx kx)))
0.5
(+ 0.5 (* -0.5 (cos (+ ky ky)))))))))
(if (<= t_3 0.002)
(*
(sin th)
(/
(*
ky
(fma
(* ky ky)
(fma
(* ky ky)
(fma -0.0001984126984126984 (* ky ky) 0.008333333333333333)
-0.16666666666666666)
1.0))
t_4))
(if (<= t_3 0.998)
(*
(sin ky)
(*
th
(sqrt
(/
1.0
(+ 0.5 (fma -0.5 t_1 (fma -0.5 (cos (* kx -2.0)) 0.5)))))))
(if (<= t_3 2.0)
(* (sin th) (fma (* kx kx) (/ -0.5 t_2) 1.0))
(*
(sin th)
(/ (fma ky (* -0.16666666666666666 (* ky ky)) ky) t_4)))))))))
double code(double kx, double ky, double th) {
double t_1 = cos((ky * -2.0));
double t_2 = pow(sin(ky), 2.0);
double t_3 = sin(ky) / sqrt((pow(sin(kx), 2.0) + t_2));
double t_4 = hypot(sin(kx), ky);
double tmp;
if (t_3 <= -0.998) {
tmp = sin(ky) * (sin(th) / sqrt(fma(-0.5, t_1, fma((kx * kx), fma((kx * kx), -0.3333333333333333, 1.0), 0.5))));
} else if (t_3 <= -0.05) {
tmp = (th * fma(-0.16666666666666666, (th * th), 1.0)) * (sin(ky) * sqrt((1.0 / fma((1.0 - cos((kx + kx))), 0.5, (0.5 + (-0.5 * cos((ky + ky))))))));
} else if (t_3 <= 0.002) {
tmp = sin(th) * ((ky * fma((ky * ky), fma((ky * ky), fma(-0.0001984126984126984, (ky * ky), 0.008333333333333333), -0.16666666666666666), 1.0)) / t_4);
} else if (t_3 <= 0.998) {
tmp = sin(ky) * (th * sqrt((1.0 / (0.5 + fma(-0.5, t_1, fma(-0.5, cos((kx * -2.0)), 0.5))))));
} else if (t_3 <= 2.0) {
tmp = sin(th) * fma((kx * kx), (-0.5 / t_2), 1.0);
} else {
tmp = sin(th) * (fma(ky, (-0.16666666666666666 * (ky * ky)), ky) / t_4);
}
return tmp;
}
function code(kx, ky, th) t_1 = cos(Float64(ky * -2.0)) t_2 = sin(ky) ^ 2.0 t_3 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + t_2))) t_4 = hypot(sin(kx), ky) tmp = 0.0 if (t_3 <= -0.998) tmp = Float64(sin(ky) * Float64(sin(th) / sqrt(fma(-0.5, t_1, fma(Float64(kx * kx), fma(Float64(kx * kx), -0.3333333333333333, 1.0), 0.5))))); elseif (t_3 <= -0.05) tmp = Float64(Float64(th * fma(-0.16666666666666666, Float64(th * th), 1.0)) * Float64(sin(ky) * sqrt(Float64(1.0 / fma(Float64(1.0 - cos(Float64(kx + kx))), 0.5, Float64(0.5 + Float64(-0.5 * cos(Float64(ky + ky))))))))); elseif (t_3 <= 0.002) tmp = Float64(sin(th) * Float64(Float64(ky * fma(Float64(ky * ky), fma(Float64(ky * ky), fma(-0.0001984126984126984, Float64(ky * ky), 0.008333333333333333), -0.16666666666666666), 1.0)) / t_4)); elseif (t_3 <= 0.998) tmp = Float64(sin(ky) * Float64(th * sqrt(Float64(1.0 / Float64(0.5 + fma(-0.5, t_1, fma(-0.5, cos(Float64(kx * -2.0)), 0.5))))))); elseif (t_3 <= 2.0) tmp = Float64(sin(th) * fma(Float64(kx * kx), Float64(-0.5 / t_2), 1.0)); else tmp = Float64(sin(th) * Float64(fma(ky, Float64(-0.16666666666666666 * Float64(ky * ky)), ky) / t_4)); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$3 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + t$95$2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + ky ^ 2], $MachinePrecision]}, If[LessEqual[t$95$3, -0.998], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[(-0.5 * t$95$1 + N[(N[(kx * kx), $MachinePrecision] * N[(N[(kx * kx), $MachinePrecision] * -0.3333333333333333 + 1.0), $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, -0.05], N[(N[(th * N[(-0.16666666666666666 * N[(th * th), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] * N[Sqrt[N[(1.0 / N[(N[(1.0 - N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5 + N[(0.5 + N[(-0.5 * N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 0.002], N[(N[Sin[th], $MachinePrecision] * N[(N[(ky * N[(N[(ky * ky), $MachinePrecision] * N[(N[(ky * ky), $MachinePrecision] * N[(-0.0001984126984126984 * N[(ky * ky), $MachinePrecision] + 0.008333333333333333), $MachinePrecision] + -0.16666666666666666), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / t$95$4), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 0.998], N[(N[Sin[ky], $MachinePrecision] * N[(th * N[Sqrt[N[(1.0 / N[(0.5 + N[(-0.5 * t$95$1 + N[(-0.5 * N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 2.0], N[(N[Sin[th], $MachinePrecision] * N[(N[(kx * kx), $MachinePrecision] * N[(-0.5 / t$95$2), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[(ky * N[(-0.16666666666666666 * N[(ky * ky), $MachinePrecision]), $MachinePrecision] + ky), $MachinePrecision] / t$95$4), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \cos \left(ky \cdot -2\right)\\
t_2 := {\sin ky}^{2}\\
t_3 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + t\_2}}\\
t_4 := \mathsf{hypot}\left(\sin kx, ky\right)\\
\mathbf{if}\;t\_3 \leq -0.998:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sqrt{\mathsf{fma}\left(-0.5, t\_1, \mathsf{fma}\left(kx \cdot kx, \mathsf{fma}\left(kx \cdot kx, -0.3333333333333333, 1\right), 0.5\right)\right)}}\\
\mathbf{elif}\;t\_3 \leq -0.05:\\
\;\;\;\;\left(th \cdot \mathsf{fma}\left(-0.16666666666666666, th \cdot th, 1\right)\right) \cdot \left(\sin ky \cdot \sqrt{\frac{1}{\mathsf{fma}\left(1 - \cos \left(kx + kx\right), 0.5, 0.5 + -0.5 \cdot \cos \left(ky + ky\right)\right)}}\right)\\
\mathbf{elif}\;t\_3 \leq 0.002:\\
\;\;\;\;\sin th \cdot \frac{ky \cdot \mathsf{fma}\left(ky \cdot ky, \mathsf{fma}\left(ky \cdot ky, \mathsf{fma}\left(-0.0001984126984126984, ky \cdot ky, 0.008333333333333333\right), -0.16666666666666666\right), 1\right)}{t\_4}\\
\mathbf{elif}\;t\_3 \leq 0.998:\\
\;\;\;\;\sin ky \cdot \left(th \cdot \sqrt{\frac{1}{0.5 + \mathsf{fma}\left(-0.5, t\_1, \mathsf{fma}\left(-0.5, \cos \left(kx \cdot -2\right), 0.5\right)\right)}}\right)\\
\mathbf{elif}\;t\_3 \leq 2:\\
\;\;\;\;\sin th \cdot \mathsf{fma}\left(kx \cdot kx, \frac{-0.5}{t\_2}, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\mathsf{fma}\left(ky, -0.16666666666666666 \cdot \left(ky \cdot ky\right), ky\right)}{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.998Initial program 81.5%
Applied egg-rr64.9%
Taylor expanded in kx around 0
+-commutativeN/A
associate-+l+N/A
lower-fma.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6464.9
Simplified64.9%
if -0.998 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.050000000000000003Initial program 99.3%
Applied egg-rr96.0%
Taylor expanded in th around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6450.7
Simplified50.7%
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-3Initial program 98.8%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6497.6
Simplified97.6%
lift-sin.f64N/A
pow2N/A
lower-hypot.f6498.2
Applied egg-rr98.2%
Taylor expanded in ky around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6498.1
Simplified98.1%
if 2e-3 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.998Initial program 99.4%
Applied egg-rr99.3%
Taylor expanded in th around 0
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-+.f64N/A
sub-negN/A
metadata-evalN/A
distribute-lft-neg-inN/A
sub-negN/A
sub-negN/A
distribute-lft-inN/A
Simplified57.0%
if 0.998 < (/.f64 (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 100.0%
Taylor expanded in kx around 0
*-commutativeN/A
associate-*l/N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
associate-*r/N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
lower-/.f64N/A
lower-pow.f64N/A
lower-sin.f6499.4
Simplified99.4%
if 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 2.4%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f642.4
Simplified2.4%
lift-sin.f64N/A
pow2N/A
lower-hypot.f6499.7
Applied egg-rr99.7%
Taylor expanded in ky around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6499.7
Simplified99.7%
Final simplification79.8%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (cos (* ky -2.0)))
(t_2 (cos (* kx -2.0)))
(t_3 (hypot (sin kx) ky))
(t_4 (pow (sin ky) 2.0))
(t_5 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) t_4)))))
(if (<= t_5 -0.998)
(*
(sin ky)
(/
(sin th)
(sqrt
(fma
-0.5
t_1
(fma (* kx kx) (fma (* kx kx) -0.3333333333333333 1.0) 0.5)))))
(if (<= t_5 -0.05)
(*
(sqrt (/ 1.0 (fma 0.5 (- 1.0 t_2) (fma -0.5 t_1 0.5))))
(* (sin ky) th))
(if (<= t_5 0.002)
(*
(sin th)
(/
(*
ky
(fma
(* ky ky)
(fma
(* ky ky)
(fma -0.0001984126984126984 (* ky ky) 0.008333333333333333)
-0.16666666666666666)
1.0))
t_3))
(if (<= t_5 0.998)
(*
(sin ky)
(* th (sqrt (/ 1.0 (+ 0.5 (fma -0.5 t_1 (fma -0.5 t_2 0.5)))))))
(if (<= t_5 2.0)
(* (sin th) (fma (* kx kx) (/ -0.5 t_4) 1.0))
(*
(sin th)
(/ (fma ky (* -0.16666666666666666 (* ky ky)) ky) t_3)))))))))
double code(double kx, double ky, double th) {
double t_1 = cos((ky * -2.0));
double t_2 = cos((kx * -2.0));
double t_3 = hypot(sin(kx), ky);
double t_4 = pow(sin(ky), 2.0);
double t_5 = sin(ky) / sqrt((pow(sin(kx), 2.0) + t_4));
double tmp;
if (t_5 <= -0.998) {
tmp = sin(ky) * (sin(th) / sqrt(fma(-0.5, t_1, fma((kx * kx), fma((kx * kx), -0.3333333333333333, 1.0), 0.5))));
} else if (t_5 <= -0.05) {
tmp = sqrt((1.0 / fma(0.5, (1.0 - t_2), fma(-0.5, t_1, 0.5)))) * (sin(ky) * th);
} else if (t_5 <= 0.002) {
tmp = sin(th) * ((ky * fma((ky * ky), fma((ky * ky), fma(-0.0001984126984126984, (ky * ky), 0.008333333333333333), -0.16666666666666666), 1.0)) / t_3);
} else if (t_5 <= 0.998) {
tmp = sin(ky) * (th * sqrt((1.0 / (0.5 + fma(-0.5, t_1, fma(-0.5, t_2, 0.5))))));
} else if (t_5 <= 2.0) {
tmp = sin(th) * fma((kx * kx), (-0.5 / t_4), 1.0);
} else {
tmp = sin(th) * (fma(ky, (-0.16666666666666666 * (ky * ky)), ky) / t_3);
}
return tmp;
}
function code(kx, ky, th) t_1 = cos(Float64(ky * -2.0)) t_2 = cos(Float64(kx * -2.0)) t_3 = hypot(sin(kx), ky) t_4 = sin(ky) ^ 2.0 t_5 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + t_4))) tmp = 0.0 if (t_5 <= -0.998) tmp = Float64(sin(ky) * Float64(sin(th) / sqrt(fma(-0.5, t_1, fma(Float64(kx * kx), fma(Float64(kx * kx), -0.3333333333333333, 1.0), 0.5))))); elseif (t_5 <= -0.05) tmp = Float64(sqrt(Float64(1.0 / fma(0.5, Float64(1.0 - t_2), fma(-0.5, t_1, 0.5)))) * Float64(sin(ky) * th)); elseif (t_5 <= 0.002) tmp = Float64(sin(th) * Float64(Float64(ky * fma(Float64(ky * ky), fma(Float64(ky * ky), fma(-0.0001984126984126984, Float64(ky * ky), 0.008333333333333333), -0.16666666666666666), 1.0)) / t_3)); elseif (t_5 <= 0.998) tmp = Float64(sin(ky) * Float64(th * sqrt(Float64(1.0 / Float64(0.5 + fma(-0.5, t_1, fma(-0.5, t_2, 0.5))))))); elseif (t_5 <= 2.0) tmp = Float64(sin(th) * fma(Float64(kx * kx), Float64(-0.5 / t_4), 1.0)); else tmp = Float64(sin(th) * Float64(fma(ky, Float64(-0.16666666666666666 * Float64(ky * ky)), ky) / t_3)); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + ky ^ 2], $MachinePrecision]}, Block[{t$95$4 = N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$5 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + t$95$4), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$5, -0.998], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[(-0.5 * t$95$1 + N[(N[(kx * kx), $MachinePrecision] * N[(N[(kx * kx), $MachinePrecision] * -0.3333333333333333 + 1.0), $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$5, -0.05], N[(N[Sqrt[N[(1.0 / N[(0.5 * N[(1.0 - t$95$2), $MachinePrecision] + N[(-0.5 * t$95$1 + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$5, 0.002], N[(N[Sin[th], $MachinePrecision] * N[(N[(ky * N[(N[(ky * ky), $MachinePrecision] * N[(N[(ky * ky), $MachinePrecision] * N[(-0.0001984126984126984 * N[(ky * ky), $MachinePrecision] + 0.008333333333333333), $MachinePrecision] + -0.16666666666666666), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / t$95$3), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$5, 0.998], N[(N[Sin[ky], $MachinePrecision] * N[(th * N[Sqrt[N[(1.0 / N[(0.5 + N[(-0.5 * t$95$1 + N[(-0.5 * t$95$2 + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$5, 2.0], N[(N[Sin[th], $MachinePrecision] * N[(N[(kx * kx), $MachinePrecision] * N[(-0.5 / t$95$4), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[(ky * N[(-0.16666666666666666 * N[(ky * ky), $MachinePrecision]), $MachinePrecision] + ky), $MachinePrecision] / t$95$3), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \cos \left(ky \cdot -2\right)\\
t_2 := \cos \left(kx \cdot -2\right)\\
t_3 := \mathsf{hypot}\left(\sin kx, ky\right)\\
t_4 := {\sin ky}^{2}\\
t_5 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + t\_4}}\\
\mathbf{if}\;t\_5 \leq -0.998:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sqrt{\mathsf{fma}\left(-0.5, t\_1, \mathsf{fma}\left(kx \cdot kx, \mathsf{fma}\left(kx \cdot kx, -0.3333333333333333, 1\right), 0.5\right)\right)}}\\
\mathbf{elif}\;t\_5 \leq -0.05:\\
\;\;\;\;\sqrt{\frac{1}{\mathsf{fma}\left(0.5, 1 - t\_2, \mathsf{fma}\left(-0.5, t\_1, 0.5\right)\right)}} \cdot \left(\sin ky \cdot th\right)\\
\mathbf{elif}\;t\_5 \leq 0.002:\\
\;\;\;\;\sin th \cdot \frac{ky \cdot \mathsf{fma}\left(ky \cdot ky, \mathsf{fma}\left(ky \cdot ky, \mathsf{fma}\left(-0.0001984126984126984, ky \cdot ky, 0.008333333333333333\right), -0.16666666666666666\right), 1\right)}{t\_3}\\
\mathbf{elif}\;t\_5 \leq 0.998:\\
\;\;\;\;\sin ky \cdot \left(th \cdot \sqrt{\frac{1}{0.5 + \mathsf{fma}\left(-0.5, t\_1, \mathsf{fma}\left(-0.5, t\_2, 0.5\right)\right)}}\right)\\
\mathbf{elif}\;t\_5 \leq 2:\\
\;\;\;\;\sin th \cdot \mathsf{fma}\left(kx \cdot kx, \frac{-0.5}{t\_4}, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\mathsf{fma}\left(ky, -0.16666666666666666 \cdot \left(ky \cdot ky\right), ky\right)}{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.998Initial program 81.5%
Applied egg-rr64.9%
Taylor expanded in kx around 0
+-commutativeN/A
associate-+l+N/A
lower-fma.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6464.9
Simplified64.9%
if -0.998 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.050000000000000003Initial program 99.3%
Applied egg-rr96.0%
Taylor expanded in th around 0
lower-*.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
lower-fma.f64N/A
Simplified51.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-3Initial program 98.8%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6497.6
Simplified97.6%
lift-sin.f64N/A
pow2N/A
lower-hypot.f6498.2
Applied egg-rr98.2%
Taylor expanded in ky around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6498.1
Simplified98.1%
if 2e-3 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.998Initial program 99.4%
Applied egg-rr99.3%
Taylor expanded in th around 0
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-+.f64N/A
sub-negN/A
metadata-evalN/A
distribute-lft-neg-inN/A
sub-negN/A
sub-negN/A
distribute-lft-inN/A
Simplified57.0%
if 0.998 < (/.f64 (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 100.0%
Taylor expanded in kx around 0
*-commutativeN/A
associate-*l/N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
associate-*r/N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
lower-/.f64N/A
lower-pow.f64N/A
lower-sin.f6499.4
Simplified99.4%
if 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 2.4%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f642.4
Simplified2.4%
lift-sin.f64N/A
pow2N/A
lower-hypot.f6499.7
Applied egg-rr99.7%
Taylor expanded in ky around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6499.7
Simplified99.7%
Final simplification79.8%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (cos (* ky -2.0)))
(t_2 (pow (sin ky) 2.0))
(t_3 (cos (* kx -2.0)))
(t_4 (hypot (sin kx) ky))
(t_5 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) t_2))))
(t_6 (fma -0.5 t_1 0.5)))
(if (<= t_5 -1.0)
(* (sin ky) (/ (sin th) (sqrt t_6)))
(if (<= t_5 -0.05)
(* (sqrt (/ 1.0 (fma 0.5 (- 1.0 t_3) t_6))) (* (sin ky) th))
(if (<= t_5 0.002)
(*
(sin th)
(/
(*
ky
(fma
(* ky ky)
(fma
(* ky ky)
(fma -0.0001984126984126984 (* ky ky) 0.008333333333333333)
-0.16666666666666666)
1.0))
t_4))
(if (<= t_5 0.998)
(*
(sin ky)
(* th (sqrt (/ 1.0 (+ 0.5 (fma -0.5 t_1 (fma -0.5 t_3 0.5)))))))
(if (<= t_5 2.0)
(* (sin th) (fma (* kx kx) (/ -0.5 t_2) 1.0))
(*
(sin th)
(/ (fma ky (* -0.16666666666666666 (* ky ky)) ky) t_4)))))))))
double code(double kx, double ky, double th) {
double t_1 = cos((ky * -2.0));
double t_2 = pow(sin(ky), 2.0);
double t_3 = cos((kx * -2.0));
double t_4 = hypot(sin(kx), ky);
double t_5 = sin(ky) / sqrt((pow(sin(kx), 2.0) + t_2));
double t_6 = fma(-0.5, t_1, 0.5);
double tmp;
if (t_5 <= -1.0) {
tmp = sin(ky) * (sin(th) / sqrt(t_6));
} else if (t_5 <= -0.05) {
tmp = sqrt((1.0 / fma(0.5, (1.0 - t_3), t_6))) * (sin(ky) * th);
} else if (t_5 <= 0.002) {
tmp = sin(th) * ((ky * fma((ky * ky), fma((ky * ky), fma(-0.0001984126984126984, (ky * ky), 0.008333333333333333), -0.16666666666666666), 1.0)) / t_4);
} else if (t_5 <= 0.998) {
tmp = sin(ky) * (th * sqrt((1.0 / (0.5 + fma(-0.5, t_1, fma(-0.5, t_3, 0.5))))));
} else if (t_5 <= 2.0) {
tmp = sin(th) * fma((kx * kx), (-0.5 / t_2), 1.0);
} else {
tmp = sin(th) * (fma(ky, (-0.16666666666666666 * (ky * ky)), ky) / t_4);
}
return tmp;
}
function code(kx, ky, th) t_1 = cos(Float64(ky * -2.0)) t_2 = sin(ky) ^ 2.0 t_3 = cos(Float64(kx * -2.0)) t_4 = hypot(sin(kx), ky) t_5 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + t_2))) t_6 = fma(-0.5, t_1, 0.5) tmp = 0.0 if (t_5 <= -1.0) tmp = Float64(sin(ky) * Float64(sin(th) / sqrt(t_6))); elseif (t_5 <= -0.05) tmp = Float64(sqrt(Float64(1.0 / fma(0.5, Float64(1.0 - t_3), t_6))) * Float64(sin(ky) * th)); elseif (t_5 <= 0.002) tmp = Float64(sin(th) * Float64(Float64(ky * fma(Float64(ky * ky), fma(Float64(ky * ky), fma(-0.0001984126984126984, Float64(ky * ky), 0.008333333333333333), -0.16666666666666666), 1.0)) / t_4)); elseif (t_5 <= 0.998) tmp = Float64(sin(ky) * Float64(th * sqrt(Float64(1.0 / Float64(0.5 + fma(-0.5, t_1, fma(-0.5, t_3, 0.5))))))); elseif (t_5 <= 2.0) tmp = Float64(sin(th) * fma(Float64(kx * kx), Float64(-0.5 / t_2), 1.0)); else tmp = Float64(sin(th) * Float64(fma(ky, Float64(-0.16666666666666666 * Float64(ky * ky)), ky) / t_4)); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$3 = N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + ky ^ 2], $MachinePrecision]}, Block[{t$95$5 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + t$95$2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[(-0.5 * t$95$1 + 0.5), $MachinePrecision]}, If[LessEqual[t$95$5, -1.0], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[t$95$6], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$5, -0.05], N[(N[Sqrt[N[(1.0 / N[(0.5 * N[(1.0 - t$95$3), $MachinePrecision] + t$95$6), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$5, 0.002], N[(N[Sin[th], $MachinePrecision] * N[(N[(ky * N[(N[(ky * ky), $MachinePrecision] * N[(N[(ky * ky), $MachinePrecision] * N[(-0.0001984126984126984 * N[(ky * ky), $MachinePrecision] + 0.008333333333333333), $MachinePrecision] + -0.16666666666666666), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / t$95$4), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$5, 0.998], N[(N[Sin[ky], $MachinePrecision] * N[(th * N[Sqrt[N[(1.0 / N[(0.5 + N[(-0.5 * t$95$1 + N[(-0.5 * t$95$3 + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$5, 2.0], N[(N[Sin[th], $MachinePrecision] * N[(N[(kx * kx), $MachinePrecision] * N[(-0.5 / t$95$2), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[(ky * N[(-0.16666666666666666 * N[(ky * ky), $MachinePrecision]), $MachinePrecision] + ky), $MachinePrecision] / t$95$4), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \cos \left(ky \cdot -2\right)\\
t_2 := {\sin ky}^{2}\\
t_3 := \cos \left(kx \cdot -2\right)\\
t_4 := \mathsf{hypot}\left(\sin kx, ky\right)\\
t_5 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + t\_2}}\\
t_6 := \mathsf{fma}\left(-0.5, t\_1, 0.5\right)\\
\mathbf{if}\;t\_5 \leq -1:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sqrt{t\_6}}\\
\mathbf{elif}\;t\_5 \leq -0.05:\\
\;\;\;\;\sqrt{\frac{1}{\mathsf{fma}\left(0.5, 1 - t\_3, t\_6\right)}} \cdot \left(\sin ky \cdot th\right)\\
\mathbf{elif}\;t\_5 \leq 0.002:\\
\;\;\;\;\sin th \cdot \frac{ky \cdot \mathsf{fma}\left(ky \cdot ky, \mathsf{fma}\left(ky \cdot ky, \mathsf{fma}\left(-0.0001984126984126984, ky \cdot ky, 0.008333333333333333\right), -0.16666666666666666\right), 1\right)}{t\_4}\\
\mathbf{elif}\;t\_5 \leq 0.998:\\
\;\;\;\;\sin ky \cdot \left(th \cdot \sqrt{\frac{1}{0.5 + \mathsf{fma}\left(-0.5, t\_1, \mathsf{fma}\left(-0.5, t\_3, 0.5\right)\right)}}\right)\\
\mathbf{elif}\;t\_5 \leq 2:\\
\;\;\;\;\sin th \cdot \mathsf{fma}\left(kx \cdot kx, \frac{-0.5}{t\_2}, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\mathsf{fma}\left(ky, -0.16666666666666666 \cdot \left(ky \cdot ky\right), ky\right)}{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))))) < -1Initial program 81.5%
Applied egg-rr64.9%
Taylor expanded in kx around 0
+-commutativeN/A
lower-fma.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6464.9
Simplified64.9%
if -1 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.050000000000000003Initial program 99.3%
Applied egg-rr96.0%
Taylor expanded in th around 0
lower-*.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
lower-fma.f64N/A
Simplified51.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-3Initial program 98.8%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6497.6
Simplified97.6%
lift-sin.f64N/A
pow2N/A
lower-hypot.f6498.2
Applied egg-rr98.2%
Taylor expanded in ky around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6498.1
Simplified98.1%
if 2e-3 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.998Initial program 99.4%
Applied egg-rr99.3%
Taylor expanded in th around 0
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-+.f64N/A
sub-negN/A
metadata-evalN/A
distribute-lft-neg-inN/A
sub-negN/A
sub-negN/A
distribute-lft-inN/A
Simplified57.0%
if 0.998 < (/.f64 (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 100.0%
Taylor expanded in kx around 0
*-commutativeN/A
associate-*l/N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
associate-*r/N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
lower-/.f64N/A
lower-pow.f64N/A
lower-sin.f6499.4
Simplified99.4%
if 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 2.4%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f642.4
Simplified2.4%
lift-sin.f64N/A
pow2N/A
lower-hypot.f6499.7
Applied egg-rr99.7%
Taylor expanded in ky around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6499.7
Simplified99.7%
Final simplification79.8%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (hypot (sin kx) ky))
(t_2 (fma -0.5 (cos (* ky -2.0)) 0.5))
(t_3 (pow (sin ky) 2.0))
(t_4 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) t_3))))
(t_5
(*
(sqrt (/ 1.0 (fma 0.5 (- 1.0 (cos (* kx -2.0))) t_2)))
(* (sin ky) th))))
(if (<= t_4 -1.0)
(* (sin ky) (/ (sin th) (sqrt t_2)))
(if (<= t_4 -0.05)
t_5
(if (<= t_4 0.002)
(*
(sin th)
(/
(*
ky
(fma
(* ky ky)
(fma
(* ky ky)
(fma -0.0001984126984126984 (* ky ky) 0.008333333333333333)
-0.16666666666666666)
1.0))
t_1))
(if (<= t_4 0.998)
t_5
(if (<= t_4 2.0)
(* (sin th) (fma (* kx kx) (/ -0.5 t_3) 1.0))
(*
(sin th)
(/ (fma ky (* -0.16666666666666666 (* ky ky)) ky) t_1)))))))))
double code(double kx, double ky, double th) {
double t_1 = hypot(sin(kx), ky);
double t_2 = fma(-0.5, cos((ky * -2.0)), 0.5);
double t_3 = pow(sin(ky), 2.0);
double t_4 = sin(ky) / sqrt((pow(sin(kx), 2.0) + t_3));
double t_5 = sqrt((1.0 / fma(0.5, (1.0 - cos((kx * -2.0))), t_2))) * (sin(ky) * th);
double tmp;
if (t_4 <= -1.0) {
tmp = sin(ky) * (sin(th) / sqrt(t_2));
} else if (t_4 <= -0.05) {
tmp = t_5;
} else if (t_4 <= 0.002) {
tmp = sin(th) * ((ky * fma((ky * ky), fma((ky * ky), fma(-0.0001984126984126984, (ky * ky), 0.008333333333333333), -0.16666666666666666), 1.0)) / t_1);
} else if (t_4 <= 0.998) {
tmp = t_5;
} else if (t_4 <= 2.0) {
tmp = sin(th) * fma((kx * kx), (-0.5 / t_3), 1.0);
} else {
tmp = sin(th) * (fma(ky, (-0.16666666666666666 * (ky * ky)), ky) / t_1);
}
return tmp;
}
function code(kx, ky, th) t_1 = hypot(sin(kx), ky) t_2 = fma(-0.5, cos(Float64(ky * -2.0)), 0.5) t_3 = sin(ky) ^ 2.0 t_4 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + t_3))) t_5 = Float64(sqrt(Float64(1.0 / fma(0.5, Float64(1.0 - cos(Float64(kx * -2.0))), t_2))) * Float64(sin(ky) * th)) tmp = 0.0 if (t_4 <= -1.0) tmp = Float64(sin(ky) * Float64(sin(th) / sqrt(t_2))); elseif (t_4 <= -0.05) tmp = t_5; elseif (t_4 <= 0.002) tmp = Float64(sin(th) * Float64(Float64(ky * fma(Float64(ky * ky), fma(Float64(ky * ky), fma(-0.0001984126984126984, Float64(ky * ky), 0.008333333333333333), -0.16666666666666666), 1.0)) / t_1)); elseif (t_4 <= 0.998) tmp = t_5; elseif (t_4 <= 2.0) tmp = Float64(sin(th) * fma(Float64(kx * kx), Float64(-0.5 / t_3), 1.0)); else tmp = Float64(sin(th) * Float64(fma(ky, Float64(-0.16666666666666666 * Float64(ky * ky)), ky) / t_1)); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + ky ^ 2], $MachinePrecision]}, Block[{t$95$2 = N[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]}, Block[{t$95$3 = N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$4 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + t$95$3), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(N[Sqrt[N[(1.0 / N[(0.5 * N[(1.0 - N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$4, -1.0], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[t$95$2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, -0.05], t$95$5, If[LessEqual[t$95$4, 0.002], N[(N[Sin[th], $MachinePrecision] * N[(N[(ky * N[(N[(ky * ky), $MachinePrecision] * N[(N[(ky * ky), $MachinePrecision] * N[(-0.0001984126984126984 * N[(ky * ky), $MachinePrecision] + 0.008333333333333333), $MachinePrecision] + -0.16666666666666666), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 0.998], t$95$5, If[LessEqual[t$95$4, 2.0], N[(N[Sin[th], $MachinePrecision] * N[(N[(kx * kx), $MachinePrecision] * N[(-0.5 / t$95$3), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[(ky * N[(-0.16666666666666666 * N[(ky * ky), $MachinePrecision]), $MachinePrecision] + ky), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin kx, ky\right)\\
t_2 := \mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), 0.5\right)\\
t_3 := {\sin ky}^{2}\\
t_4 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + t\_3}}\\
t_5 := \sqrt{\frac{1}{\mathsf{fma}\left(0.5, 1 - \cos \left(kx \cdot -2\right), t\_2\right)}} \cdot \left(\sin ky \cdot th\right)\\
\mathbf{if}\;t\_4 \leq -1:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sqrt{t\_2}}\\
\mathbf{elif}\;t\_4 \leq -0.05:\\
\;\;\;\;t\_5\\
\mathbf{elif}\;t\_4 \leq 0.002:\\
\;\;\;\;\sin th \cdot \frac{ky \cdot \mathsf{fma}\left(ky \cdot ky, \mathsf{fma}\left(ky \cdot ky, \mathsf{fma}\left(-0.0001984126984126984, ky \cdot ky, 0.008333333333333333\right), -0.16666666666666666\right), 1\right)}{t\_1}\\
\mathbf{elif}\;t\_4 \leq 0.998:\\
\;\;\;\;t\_5\\
\mathbf{elif}\;t\_4 \leq 2:\\
\;\;\;\;\sin th \cdot \mathsf{fma}\left(kx \cdot kx, \frac{-0.5}{t\_3}, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\mathsf{fma}\left(ky, -0.16666666666666666 \cdot \left(ky \cdot ky\right), ky\right)}{t\_1}\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -1Initial program 81.5%
Applied egg-rr64.9%
Taylor expanded in kx around 0
+-commutativeN/A
lower-fma.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6464.9
Simplified64.9%
if -1 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.050000000000000003 or 2e-3 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.998Initial program 99.4%
Applied egg-rr97.6%
Taylor expanded in th around 0
lower-*.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
lower-fma.f64N/A
Simplified54.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-3Initial program 98.8%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6497.6
Simplified97.6%
lift-sin.f64N/A
pow2N/A
lower-hypot.f6498.2
Applied egg-rr98.2%
Taylor expanded in ky around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6498.1
Simplified98.1%
if 0.998 < (/.f64 (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 100.0%
Taylor expanded in kx around 0
*-commutativeN/A
associate-*l/N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
associate-*r/N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
lower-/.f64N/A
lower-pow.f64N/A
lower-sin.f6499.4
Simplified99.4%
if 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 2.4%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f642.4
Simplified2.4%
lift-sin.f64N/A
pow2N/A
lower-hypot.f6499.7
Applied egg-rr99.7%
Taylor expanded in ky around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6499.7
Simplified99.7%
Final simplification79.8%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1
(*
(sin th)
(/
(sin ky)
(hypot (sin ky) (* kx (fma -0.16666666666666666 (* kx kx) 1.0))))))
(t_2 (pow (sin kx) 2.0))
(t_3 (/ (sin ky) (sqrt (+ t_2 (pow (sin ky) 2.0)))))
(t_4 (hypot (sin ky) (sin kx))))
(if (<= t_3 -0.99)
t_1
(if (<= t_3 -0.05)
(* (/ (sin ky) t_4) (* th (fma -0.16666666666666666 (* th th) 1.0)))
(if (<= t_3 0.34)
(* (sin th) (/ (sin ky) (sqrt t_2)))
(if (<= t_3 0.998)
(* (sin ky) (/ (fma th (* -0.16666666666666666 (* th th)) th) t_4))
t_1))))))
double code(double kx, double ky, double th) {
double t_1 = sin(th) * (sin(ky) / hypot(sin(ky), (kx * fma(-0.16666666666666666, (kx * kx), 1.0))));
double t_2 = pow(sin(kx), 2.0);
double t_3 = sin(ky) / sqrt((t_2 + pow(sin(ky), 2.0)));
double t_4 = hypot(sin(ky), sin(kx));
double tmp;
if (t_3 <= -0.99) {
tmp = t_1;
} else if (t_3 <= -0.05) {
tmp = (sin(ky) / t_4) * (th * fma(-0.16666666666666666, (th * th), 1.0));
} else if (t_3 <= 0.34) {
tmp = sin(th) * (sin(ky) / sqrt(t_2));
} else if (t_3 <= 0.998) {
tmp = sin(ky) * (fma(th, (-0.16666666666666666 * (th * th)), th) / t_4);
} else {
tmp = t_1;
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), Float64(kx * fma(-0.16666666666666666, Float64(kx * kx), 1.0))))) t_2 = sin(kx) ^ 2.0 t_3 = Float64(sin(ky) / sqrt(Float64(t_2 + (sin(ky) ^ 2.0)))) t_4 = hypot(sin(ky), sin(kx)) tmp = 0.0 if (t_3 <= -0.99) tmp = t_1; elseif (t_3 <= -0.05) tmp = Float64(Float64(sin(ky) / t_4) * Float64(th * fma(-0.16666666666666666, Float64(th * th), 1.0))); elseif (t_3 <= 0.34) tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(t_2))); elseif (t_3 <= 0.998) tmp = Float64(sin(ky) * Float64(fma(th, Float64(-0.16666666666666666 * Float64(th * th)), th) / t_4)); else tmp = t_1; end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[(kx * N[(-0.16666666666666666 * N[(kx * kx), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$3 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$2 + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[t$95$3, -0.99], t$95$1, If[LessEqual[t$95$3, -0.05], N[(N[(N[Sin[ky], $MachinePrecision] / t$95$4), $MachinePrecision] * N[(th * N[(-0.16666666666666666 * N[(th * th), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 0.34], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[t$95$2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 0.998], N[(N[Sin[ky], $MachinePrecision] * N[(N[(th * N[(-0.16666666666666666 * N[(th * th), $MachinePrecision]), $MachinePrecision] + th), $MachinePrecision] / t$95$4), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, kx \cdot \mathsf{fma}\left(-0.16666666666666666, kx \cdot kx, 1\right)\right)}\\
t_2 := {\sin kx}^{2}\\
t_3 := \frac{\sin ky}{\sqrt{t\_2 + {\sin ky}^{2}}}\\
t_4 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\
\mathbf{if}\;t\_3 \leq -0.99:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_3 \leq -0.05:\\
\;\;\;\;\frac{\sin ky}{t\_4} \cdot \left(th \cdot \mathsf{fma}\left(-0.16666666666666666, th \cdot th, 1\right)\right)\\
\mathbf{elif}\;t\_3 \leq 0.34:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{t\_2}}\\
\mathbf{elif}\;t\_3 \leq 0.998:\\
\;\;\;\;\sin ky \cdot \frac{\mathsf{fma}\left(th, -0.16666666666666666 \cdot \left(th \cdot th\right), th\right)}{t\_4}\\
\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.98999999999999999 or 0.998 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 84.6%
lift-sin.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6499.9
Applied egg-rr99.9%
Taylor expanded in kx around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6499.0
Simplified99.0%
if -0.98999999999999999 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.050000000000000003Initial program 99.3%
lift-sin.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6499.4
Applied egg-rr99.4%
Taylor expanded in th around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6455.7
Simplified55.7%
if -0.050000000000000003 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.340000000000000024Initial program 98.8%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6492.4
Simplified92.4%
Taylor expanded in ky around 0
lower-pow.f64N/A
lower-sin.f6493.5
Simplified93.5%
if 0.340000000000000024 < (/.f64 (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.998Initial program 99.4%
Applied egg-rr99.3%
Applied egg-rr99.5%
Taylor expanded in th around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6456.2
Simplified56.2%
Final simplification87.3%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1
(*
(sin th)
(/
(sin ky)
(hypot (sin ky) (* kx (fma -0.16666666666666666 (* kx kx) 1.0))))))
(t_2 (pow (sin kx) 2.0))
(t_3 (/ (sin ky) (sqrt (+ t_2 (pow (sin ky) 2.0)))))
(t_4
(*
(/ (sin ky) (hypot (sin ky) (sin kx)))
(* th (fma -0.16666666666666666 (* th th) 1.0)))))
(if (<= t_3 -0.99)
t_1
(if (<= t_3 -0.05)
t_4
(if (<= t_3 0.34)
(* (sin th) (/ (sin ky) (sqrt t_2)))
(if (<= t_3 0.998) t_4 t_1))))))
double code(double kx, double ky, double th) {
double t_1 = sin(th) * (sin(ky) / hypot(sin(ky), (kx * fma(-0.16666666666666666, (kx * kx), 1.0))));
double t_2 = pow(sin(kx), 2.0);
double t_3 = sin(ky) / sqrt((t_2 + pow(sin(ky), 2.0)));
double t_4 = (sin(ky) / hypot(sin(ky), sin(kx))) * (th * fma(-0.16666666666666666, (th * th), 1.0));
double tmp;
if (t_3 <= -0.99) {
tmp = t_1;
} else if (t_3 <= -0.05) {
tmp = t_4;
} else if (t_3 <= 0.34) {
tmp = sin(th) * (sin(ky) / sqrt(t_2));
} else if (t_3 <= 0.998) {
tmp = t_4;
} else {
tmp = t_1;
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), Float64(kx * fma(-0.16666666666666666, Float64(kx * kx), 1.0))))) t_2 = sin(kx) ^ 2.0 t_3 = Float64(sin(ky) / sqrt(Float64(t_2 + (sin(ky) ^ 2.0)))) t_4 = Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * Float64(th * fma(-0.16666666666666666, Float64(th * th), 1.0))) tmp = 0.0 if (t_3 <= -0.99) tmp = t_1; elseif (t_3 <= -0.05) tmp = t_4; elseif (t_3 <= 0.34) tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(t_2))); elseif (t_3 <= 0.998) tmp = t_4; else tmp = t_1; end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[(kx * N[(-0.16666666666666666 * N[(kx * kx), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$3 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$2 + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[(th * N[(-0.16666666666666666 * N[(th * th), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, -0.99], t$95$1, If[LessEqual[t$95$3, -0.05], t$95$4, If[LessEqual[t$95$3, 0.34], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[t$95$2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 0.998], t$95$4, t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, kx \cdot \mathsf{fma}\left(-0.16666666666666666, kx \cdot kx, 1\right)\right)}\\
t_2 := {\sin kx}^{2}\\
t_3 := \frac{\sin ky}{\sqrt{t\_2 + {\sin ky}^{2}}}\\
t_4 := \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot \left(th \cdot \mathsf{fma}\left(-0.16666666666666666, th \cdot th, 1\right)\right)\\
\mathbf{if}\;t\_3 \leq -0.99:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_3 \leq -0.05:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;t\_3 \leq 0.34:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{t\_2}}\\
\mathbf{elif}\;t\_3 \leq 0.998:\\
\;\;\;\;t\_4\\
\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.98999999999999999 or 0.998 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 84.6%
lift-sin.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6499.9
Applied egg-rr99.9%
Taylor expanded in kx around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6499.0
Simplified99.0%
if -0.98999999999999999 < (/.f64 (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.050000000000000003 or 0.340000000000000024 < (/.f64 (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.998Initial program 99.4%
lift-sin.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6499.4
Applied egg-rr99.4%
Taylor expanded in th around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6455.9
Simplified55.9%
if -0.050000000000000003 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.340000000000000024Initial program 98.8%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6492.4
Simplified92.4%
Taylor expanded in ky around 0
lower-pow.f64N/A
lower-sin.f6493.5
Simplified93.5%
Final simplification87.3%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (fma ky (* -0.16666666666666666 (* ky ky)) ky))
(t_2 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
(if (<= t_2 -0.2)
(*
(* (sin ky) th)
(sqrt (/ 1.0 (fma -0.5 (cos (* ky -2.0)) (fma kx kx 0.5)))))
(if (<= t_2 4e-126)
(* t_1 (/ (sin th) (sqrt (fma -0.5 (cos (* kx -2.0)) 0.5))))
(if (<= t_2 1e-6)
(* (sin th) (/ t_1 (sin kx)))
(if (<= t_2 2.0) (sin th) (* (sin ky) (* (sin th) (/ 1.0 kx)))))))))
double code(double kx, double ky, double th) {
double t_1 = fma(ky, (-0.16666666666666666 * (ky * ky)), ky);
double t_2 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double tmp;
if (t_2 <= -0.2) {
tmp = (sin(ky) * th) * sqrt((1.0 / fma(-0.5, cos((ky * -2.0)), fma(kx, kx, 0.5))));
} else if (t_2 <= 4e-126) {
tmp = t_1 * (sin(th) / sqrt(fma(-0.5, cos((kx * -2.0)), 0.5)));
} else if (t_2 <= 1e-6) {
tmp = sin(th) * (t_1 / sin(kx));
} else if (t_2 <= 2.0) {
tmp = sin(th);
} else {
tmp = sin(ky) * (sin(th) * (1.0 / kx));
}
return tmp;
}
function code(kx, ky, th) t_1 = fma(ky, Float64(-0.16666666666666666 * Float64(ky * ky)), ky) t_2 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_2 <= -0.2) tmp = Float64(Float64(sin(ky) * th) * sqrt(Float64(1.0 / fma(-0.5, cos(Float64(ky * -2.0)), fma(kx, kx, 0.5))))); elseif (t_2 <= 4e-126) tmp = Float64(t_1 * Float64(sin(th) / sqrt(fma(-0.5, cos(Float64(kx * -2.0)), 0.5)))); elseif (t_2 <= 1e-6) tmp = Float64(sin(th) * Float64(t_1 / sin(kx))); elseif (t_2 <= 2.0) tmp = sin(th); else tmp = Float64(sin(ky) * Float64(sin(th) * Float64(1.0 / kx))); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(ky * N[(-0.16666666666666666 * N[(ky * ky), $MachinePrecision]), $MachinePrecision] + ky), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -0.2], N[(N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + N[(kx * kx + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 4e-126], N[(t$95$1 * 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$2, 1e-6], N[(N[Sin[th], $MachinePrecision] * N[(t$95$1 / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2.0], N[Sin[th], $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] * N[(1.0 / kx), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(ky, -0.16666666666666666 \cdot \left(ky \cdot ky\right), ky\right)\\
t_2 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_2 \leq -0.2:\\
\;\;\;\;\left(\sin ky \cdot th\right) \cdot \sqrt{\frac{1}{\mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), \mathsf{fma}\left(kx, kx, 0.5\right)\right)}}\\
\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{-126}:\\
\;\;\;\;t\_1 \cdot \frac{\sin th}{\sqrt{\mathsf{fma}\left(-0.5, \cos \left(kx \cdot -2\right), 0.5\right)}}\\
\mathbf{elif}\;t\_2 \leq 10^{-6}:\\
\;\;\;\;\sin th \cdot \frac{t\_1}{\sin kx}\\
\mathbf{elif}\;t\_2 \leq 2:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \left(\sin th \cdot \frac{1}{kx}\right)\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.20000000000000001Initial program 87.6%
Applied egg-rr75.4%
Taylor expanded in kx around 0
lower-*.f64N/A
unpow2N/A
lower-*.f6445.0
Simplified45.0%
Taylor expanded in th around 0
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
associate-+l+N/A
lower-fma.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-fma.f6423.4
Simplified23.4%
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))))) < 3.9999999999999998e-126Initial program 98.7%
Applied egg-rr70.6%
Taylor expanded in ky around 0
sub-negN/A
metadata-evalN/A
distribute-lft-neg-inN/A
distribute-lft-inN/A
metadata-evalN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
metadata-evalN/A
distribute-lft-neg-inN/A
metadata-evalN/A
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6467.6
Simplified67.6%
Taylor expanded in ky around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6466.5
Simplified66.5%
if 3.9999999999999998e-126 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 9.99999999999999955e-7Initial program 99.5%
Taylor expanded in ky around 0
lower-sin.f6451.4
Simplified51.4%
Taylor expanded in ky around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6451.4
Simplified51.4%
if 9.99999999999999955e-7 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2Initial program 99.7%
Taylor expanded in kx around 0
lower-sin.f6463.8
Simplified63.8%
if 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 2.4%
Applied egg-rr2.4%
Taylor expanded in kx around 0
lower-*.f64N/A
unpow2N/A
lower-*.f642.4
Simplified2.4%
Taylor expanded in kx around inf
lower-/.f6420.1
Simplified20.1%
lift-/.f64N/A
lift-sin.f64N/A
*-commutativeN/A
lift-sin.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6420.1
Applied egg-rr20.1%
Final simplification49.1%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
(if (<= t_1 -0.05)
(*
(* (sin ky) th)
(sqrt (/ 1.0 (fma -0.5 (cos (* ky -2.0)) (fma kx kx 0.5)))))
(if (<= t_1 4e-126)
(* (* ky (sin th)) (sqrt (/ 1.0 (fma -0.5 (cos (* kx -2.0)) 0.5))))
(if (<= t_1 1e-6)
(*
(sin th)
(/ (fma ky (* -0.16666666666666666 (* ky ky)) ky) (sin kx)))
(if (<= t_1 2.0) (sin th) (* (sin ky) (* (sin th) (/ 1.0 kx)))))))))
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 = (sin(ky) * th) * sqrt((1.0 / fma(-0.5, cos((ky * -2.0)), fma(kx, kx, 0.5))));
} else if (t_1 <= 4e-126) {
tmp = (ky * sin(th)) * sqrt((1.0 / fma(-0.5, cos((kx * -2.0)), 0.5)));
} else if (t_1 <= 1e-6) {
tmp = sin(th) * (fma(ky, (-0.16666666666666666 * (ky * ky)), ky) / sin(kx));
} else if (t_1 <= 2.0) {
tmp = sin(th);
} else {
tmp = sin(ky) * (sin(th) * (1.0 / kx));
}
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(Float64(sin(ky) * th) * sqrt(Float64(1.0 / fma(-0.5, cos(Float64(ky * -2.0)), fma(kx, kx, 0.5))))); elseif (t_1 <= 4e-126) tmp = Float64(Float64(ky * sin(th)) * sqrt(Float64(1.0 / fma(-0.5, cos(Float64(kx * -2.0)), 0.5)))); elseif (t_1 <= 1e-6) tmp = Float64(sin(th) * Float64(fma(ky, Float64(-0.16666666666666666 * Float64(ky * ky)), ky) / sin(kx))); elseif (t_1 <= 2.0) tmp = sin(th); else tmp = Float64(sin(ky) * Float64(sin(th) * Float64(1.0 / kx))); 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[(N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + N[(kx * kx + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 4e-126], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(-0.5 * N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e-6], N[(N[Sin[th], $MachinePrecision] * N[(N[(ky * N[(-0.16666666666666666 * N[(ky * ky), $MachinePrecision]), $MachinePrecision] + ky), $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2.0], N[Sin[th], $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] * N[(1.0 / kx), $MachinePrecision]), $MachinePrecision]), $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:\\
\;\;\;\;\left(\sin ky \cdot th\right) \cdot \sqrt{\frac{1}{\mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), \mathsf{fma}\left(kx, kx, 0.5\right)\right)}}\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{-126}:\\
\;\;\;\;\left(ky \cdot \sin th\right) \cdot \sqrt{\frac{1}{\mathsf{fma}\left(-0.5, \cos \left(kx \cdot -2\right), 0.5\right)}}\\
\mathbf{elif}\;t\_1 \leq 10^{-6}:\\
\;\;\;\;\sin th \cdot \frac{\mathsf{fma}\left(ky, -0.16666666666666666 \cdot \left(ky \cdot ky\right), ky\right)}{\sin kx}\\
\mathbf{elif}\;t\_1 \leq 2:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \left(\sin th \cdot \frac{1}{kx}\right)\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.050000000000000003Initial program 87.9%
Applied egg-rr75.9%
Taylor expanded in kx around 0
lower-*.f64N/A
unpow2N/A
lower-*.f6444.2
Simplified44.2%
Taylor expanded in th around 0
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
associate-+l+N/A
lower-fma.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-fma.f6422.9
Simplified22.9%
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))))) < 3.9999999999999998e-126Initial program 98.7%
Applied egg-rr69.8%
Taylor expanded in ky around 0
sub-negN/A
metadata-evalN/A
distribute-lft-neg-inN/A
distribute-lft-inN/A
metadata-evalN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
metadata-evalN/A
distribute-lft-neg-inN/A
metadata-evalN/A
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6468.7
Simplified68.7%
Taylor expanded in ky around 0
lower-*.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6468.2
Simplified68.2%
if 3.9999999999999998e-126 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 9.99999999999999955e-7Initial program 99.5%
Taylor expanded in ky around 0
lower-sin.f6451.4
Simplified51.4%
Taylor expanded in ky around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6451.4
Simplified51.4%
if 9.99999999999999955e-7 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2Initial program 99.7%
Taylor expanded in kx around 0
lower-sin.f6463.8
Simplified63.8%
if 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 2.4%
Applied egg-rr2.4%
Taylor expanded in kx around 0
lower-*.f64N/A
unpow2N/A
lower-*.f642.4
Simplified2.4%
Taylor expanded in kx around inf
lower-/.f6420.1
Simplified20.1%
lift-/.f64N/A
lift-sin.f64N/A
*-commutativeN/A
lift-sin.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6420.1
Applied egg-rr20.1%
Final simplification49.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.98)
(*
(* (sin ky) th)
(sqrt (/ 1.0 (fma -0.5 (cos (* ky -2.0)) (fma kx kx 0.5)))))
(if (<= t_1 0.15)
(* (sin ky) (/ (sin th) (sin kx)))
(if (<= t_1 2.0)
(sin th)
(* (sin ky) (* (sin th) (/ 1.0 (sin kx)))))))))
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.98) {
tmp = (sin(ky) * th) * sqrt((1.0 / fma(-0.5, cos((ky * -2.0)), fma(kx, kx, 0.5))));
} else if (t_1 <= 0.15) {
tmp = sin(ky) * (sin(th) / sin(kx));
} else if (t_1 <= 2.0) {
tmp = sin(th);
} else {
tmp = sin(ky) * (sin(th) * (1.0 / sin(kx)));
}
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.98) tmp = Float64(Float64(sin(ky) * th) * sqrt(Float64(1.0 / fma(-0.5, cos(Float64(ky * -2.0)), fma(kx, kx, 0.5))))); elseif (t_1 <= 0.15) tmp = Float64(sin(ky) * Float64(sin(th) / sin(kx))); elseif (t_1 <= 2.0) tmp = sin(th); else tmp = Float64(sin(ky) * Float64(sin(th) * Float64(1.0 / sin(kx)))); 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.98], N[(N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + N[(kx * kx + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.15], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2.0], N[Sin[th], $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] * N[(1.0 / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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.98:\\
\;\;\;\;\left(\sin ky \cdot th\right) \cdot \sqrt{\frac{1}{\mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), \mathsf{fma}\left(kx, kx, 0.5\right)\right)}}\\
\mathbf{elif}\;t\_1 \leq 0.15:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{elif}\;t\_1 \leq 2:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \left(\sin th \cdot \frac{1}{\sin kx}\right)\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.97999999999999998Initial program 82.1%
Applied egg-rr65.9%
Taylor expanded in kx around 0
lower-*.f64N/A
unpow2N/A
lower-*.f6462.9
Simplified62.9%
Taylor expanded in th around 0
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
associate-+l+N/A
lower-fma.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-fma.f6431.6
Simplified31.6%
if -0.97999999999999998 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.149999999999999994Initial program 98.9%
Taylor expanded in ky around 0
lower-sin.f6442.1
Simplified42.1%
lift-sin.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6442.1
Applied egg-rr42.1%
if 0.149999999999999994 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2Initial program 99.7%
Taylor expanded in kx around 0
lower-sin.f6466.5
Simplified66.5%
if 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 2.4%
Taylor expanded in ky around 0
lower-sin.f6420.1
Simplified20.1%
lift-sin.f64N/A
lift-sin.f64N/A
div-invN/A
lift-sin.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6420.1
Applied egg-rr20.1%
Final simplification46.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.98)
(*
(* (sin ky) th)
(sqrt (/ 1.0 (fma -0.5 (cos (* ky -2.0)) (fma kx kx 0.5)))))
(if (<= t_1 0.15)
(* (sin ky) (/ (sin th) (sin kx)))
(if (<= t_1 2.0) (sin th) (* (sin ky) (* (sin th) (/ 1.0 kx))))))))
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.98) {
tmp = (sin(ky) * th) * sqrt((1.0 / fma(-0.5, cos((ky * -2.0)), fma(kx, kx, 0.5))));
} else if (t_1 <= 0.15) {
tmp = sin(ky) * (sin(th) / sin(kx));
} else if (t_1 <= 2.0) {
tmp = sin(th);
} else {
tmp = sin(ky) * (sin(th) * (1.0 / kx));
}
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.98) tmp = Float64(Float64(sin(ky) * th) * sqrt(Float64(1.0 / fma(-0.5, cos(Float64(ky * -2.0)), fma(kx, kx, 0.5))))); elseif (t_1 <= 0.15) tmp = Float64(sin(ky) * Float64(sin(th) / sin(kx))); elseif (t_1 <= 2.0) tmp = sin(th); else tmp = Float64(sin(ky) * Float64(sin(th) * Float64(1.0 / kx))); 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.98], N[(N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + N[(kx * kx + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.15], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2.0], N[Sin[th], $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] * N[(1.0 / kx), $MachinePrecision]), $MachinePrecision]), $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.98:\\
\;\;\;\;\left(\sin ky \cdot th\right) \cdot \sqrt{\frac{1}{\mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), \mathsf{fma}\left(kx, kx, 0.5\right)\right)}}\\
\mathbf{elif}\;t\_1 \leq 0.15:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{elif}\;t\_1 \leq 2:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \left(\sin th \cdot \frac{1}{kx}\right)\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.97999999999999998Initial program 82.1%
Applied egg-rr65.9%
Taylor expanded in kx around 0
lower-*.f64N/A
unpow2N/A
lower-*.f6462.9
Simplified62.9%
Taylor expanded in th around 0
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
associate-+l+N/A
lower-fma.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-fma.f6431.6
Simplified31.6%
if -0.97999999999999998 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.149999999999999994Initial program 98.9%
Taylor expanded in ky around 0
lower-sin.f6442.1
Simplified42.1%
lift-sin.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6442.1
Applied egg-rr42.1%
if 0.149999999999999994 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2Initial program 99.7%
Taylor expanded in kx around 0
lower-sin.f6466.5
Simplified66.5%
if 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 2.4%
Applied egg-rr2.4%
Taylor expanded in kx around 0
lower-*.f64N/A
unpow2N/A
lower-*.f642.4
Simplified2.4%
Taylor expanded in kx around inf
lower-/.f6420.1
Simplified20.1%
lift-/.f64N/A
lift-sin.f64N/A
*-commutativeN/A
lift-sin.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6420.1
Applied egg-rr20.1%
Final simplification46.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 4e-126)
(* (* ky (sin th)) (sqrt (/ 1.0 (fma -0.5 (cos (* kx -2.0)) 0.5))))
(if (<= t_1 1e-6)
(* (sin th) (/ (fma ky (* -0.16666666666666666 (* ky ky)) ky) (sin kx)))
(if (<= t_1 2.0) (sin th) (* (sin ky) (* (sin th) (/ 1.0 kx))))))))
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 <= 4e-126) {
tmp = (ky * sin(th)) * sqrt((1.0 / fma(-0.5, cos((kx * -2.0)), 0.5)));
} else if (t_1 <= 1e-6) {
tmp = sin(th) * (fma(ky, (-0.16666666666666666 * (ky * ky)), ky) / sin(kx));
} else if (t_1 <= 2.0) {
tmp = sin(th);
} else {
tmp = sin(ky) * (sin(th) * (1.0 / kx));
}
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 <= 4e-126) tmp = Float64(Float64(ky * sin(th)) * sqrt(Float64(1.0 / fma(-0.5, cos(Float64(kx * -2.0)), 0.5)))); elseif (t_1 <= 1e-6) tmp = Float64(sin(th) * Float64(fma(ky, Float64(-0.16666666666666666 * Float64(ky * ky)), ky) / sin(kx))); elseif (t_1 <= 2.0) tmp = sin(th); else tmp = Float64(sin(ky) * Float64(sin(th) * Float64(1.0 / kx))); 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, 4e-126], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(-0.5 * N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e-6], N[(N[Sin[th], $MachinePrecision] * N[(N[(ky * N[(-0.16666666666666666 * N[(ky * ky), $MachinePrecision]), $MachinePrecision] + ky), $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2.0], N[Sin[th], $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] * N[(1.0 / kx), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_1 \leq 4 \cdot 10^{-126}:\\
\;\;\;\;\left(ky \cdot \sin th\right) \cdot \sqrt{\frac{1}{\mathsf{fma}\left(-0.5, \cos \left(kx \cdot -2\right), 0.5\right)}}\\
\mathbf{elif}\;t\_1 \leq 10^{-6}:\\
\;\;\;\;\sin th \cdot \frac{\mathsf{fma}\left(ky, -0.16666666666666666 \cdot \left(ky \cdot ky\right), ky\right)}{\sin kx}\\
\mathbf{elif}\;t\_1 \leq 2:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \left(\sin th \cdot \frac{1}{kx}\right)\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 3.9999999999999998e-126Initial program 92.7%
Applied egg-rr73.3%
Taylor expanded in ky around 0
sub-negN/A
metadata-evalN/A
distribute-lft-neg-inN/A
distribute-lft-inN/A
metadata-evalN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
metadata-evalN/A
distribute-lft-neg-inN/A
metadata-evalN/A
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6435.6
Simplified35.6%
Taylor expanded in ky around 0
lower-*.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6431.8
Simplified31.8%
if 3.9999999999999998e-126 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 9.99999999999999955e-7Initial program 99.5%
Taylor expanded in ky around 0
lower-sin.f6451.4
Simplified51.4%
Taylor expanded in ky around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6451.4
Simplified51.4%
if 9.99999999999999955e-7 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2Initial program 99.7%
Taylor expanded in kx around 0
lower-sin.f6463.8
Simplified63.8%
if 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 2.4%
Applied egg-rr2.4%
Taylor expanded in kx around 0
lower-*.f64N/A
unpow2N/A
lower-*.f642.4
Simplified2.4%
Taylor expanded in kx around inf
lower-/.f6420.1
Simplified20.1%
lift-/.f64N/A
lift-sin.f64N/A
*-commutativeN/A
lift-sin.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6420.1
Applied egg-rr20.1%
Final simplification41.9%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
(if (<= t_1 1e-6)
(* (sin th) (/ (fma ky (* -0.16666666666666666 (* ky ky)) ky) (sin kx)))
(if (<= t_1 2.0) (sin th) (* (sin ky) (* (sin th) (/ 1.0 kx)))))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double tmp;
if (t_1 <= 1e-6) {
tmp = sin(th) * (fma(ky, (-0.16666666666666666 * (ky * ky)), ky) / sin(kx));
} else if (t_1 <= 2.0) {
tmp = sin(th);
} else {
tmp = sin(ky) * (sin(th) * (1.0 / kx));
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_1 <= 1e-6) tmp = Float64(sin(th) * Float64(fma(ky, Float64(-0.16666666666666666 * Float64(ky * ky)), ky) / sin(kx))); elseif (t_1 <= 2.0) tmp = sin(th); else tmp = Float64(sin(ky) * Float64(sin(th) * Float64(1.0 / kx))); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 1e-6], N[(N[Sin[th], $MachinePrecision] * N[(N[(ky * N[(-0.16666666666666666 * N[(ky * ky), $MachinePrecision]), $MachinePrecision] + ky), $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2.0], N[Sin[th], $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] * N[(1.0 / kx), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_1 \leq 10^{-6}:\\
\;\;\;\;\sin th \cdot \frac{\mathsf{fma}\left(ky, -0.16666666666666666 \cdot \left(ky \cdot ky\right), ky\right)}{\sin kx}\\
\mathbf{elif}\;t\_1 \leq 2:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \left(\sin th \cdot \frac{1}{kx}\right)\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 9.99999999999999955e-7Initial program 93.1%
Taylor expanded in ky around 0
lower-sin.f6432.0
Simplified32.0%
Taylor expanded in ky around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6430.3
Simplified30.3%
if 9.99999999999999955e-7 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2Initial program 99.7%
Taylor expanded in kx around 0
lower-sin.f6463.8
Simplified63.8%
if 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 2.4%
Applied egg-rr2.4%
Taylor expanded in kx around 0
lower-*.f64N/A
unpow2N/A
lower-*.f642.4
Simplified2.4%
Taylor expanded in kx around inf
lower-/.f6420.1
Simplified20.1%
lift-/.f64N/A
lift-sin.f64N/A
*-commutativeN/A
lift-sin.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6420.1
Applied egg-rr20.1%
Final simplification40.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 1e-6)
(* (sin th) (/ ky (sin kx)))
(if (<= t_1 2.0) (sin th) (* (sin ky) (* (sin th) (/ 1.0 kx)))))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double tmp;
if (t_1 <= 1e-6) {
tmp = sin(th) * (ky / sin(kx));
} else if (t_1 <= 2.0) {
tmp = sin(th);
} else {
tmp = sin(ky) * (sin(th) * (1.0 / kx));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: t_1
real(8) :: tmp
t_1 = sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))
if (t_1 <= 1d-6) then
tmp = sin(th) * (ky / sin(kx))
else if (t_1 <= 2.0d0) then
tmp = sin(th)
else
tmp = sin(ky) * (sin(th) * (1.0d0 / kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)));
double tmp;
if (t_1 <= 1e-6) {
tmp = Math.sin(th) * (ky / Math.sin(kx));
} else if (t_1 <= 2.0) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(ky) * (Math.sin(th) * (1.0 / kx));
}
return tmp;
}
def code(kx, ky, th): t_1 = math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0))) tmp = 0 if t_1 <= 1e-6: tmp = math.sin(th) * (ky / math.sin(kx)) elif t_1 <= 2.0: tmp = math.sin(th) else: tmp = math.sin(ky) * (math.sin(th) * (1.0 / kx)) return tmp
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_1 <= 1e-6) tmp = Float64(sin(th) * Float64(ky / sin(kx))); elseif (t_1 <= 2.0) tmp = sin(th); else tmp = Float64(sin(ky) * Float64(sin(th) * Float64(1.0 / kx))); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0))); tmp = 0.0; if (t_1 <= 1e-6) tmp = sin(th) * (ky / sin(kx)); elseif (t_1 <= 2.0) tmp = sin(th); else tmp = sin(ky) * (sin(th) * (1.0 / kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 1e-6], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2.0], N[Sin[th], $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] * N[(1.0 / kx), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_1 \leq 10^{-6}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{elif}\;t\_1 \leq 2:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \left(\sin th \cdot \frac{1}{kx}\right)\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 9.99999999999999955e-7Initial program 93.1%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-sin.f6430.6
Simplified30.6%
if 9.99999999999999955e-7 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2Initial program 99.7%
Taylor expanded in kx around 0
lower-sin.f6463.8
Simplified63.8%
if 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 2.4%
Applied egg-rr2.4%
Taylor expanded in kx around 0
lower-*.f64N/A
unpow2N/A
lower-*.f642.4
Simplified2.4%
Taylor expanded in kx around inf
lower-/.f6420.1
Simplified20.1%
lift-/.f64N/A
lift-sin.f64N/A
*-commutativeN/A
lift-sin.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6420.1
Applied egg-rr20.1%
Final simplification40.2%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
(if (<= t_1 1e-6)
(* (sin th) (/ ky (sin kx)))
(if (<= t_1 2.0) (sin th) (* (sin th) (/ ky kx))))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double tmp;
if (t_1 <= 1e-6) {
tmp = sin(th) * (ky / sin(kx));
} else if (t_1 <= 2.0) {
tmp = sin(th);
} else {
tmp = sin(th) * (ky / kx);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: t_1
real(8) :: tmp
t_1 = sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))
if (t_1 <= 1d-6) then
tmp = sin(th) * (ky / sin(kx))
else if (t_1 <= 2.0d0) then
tmp = sin(th)
else
tmp = sin(th) * (ky / kx)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)));
double tmp;
if (t_1 <= 1e-6) {
tmp = Math.sin(th) * (ky / Math.sin(kx));
} else if (t_1 <= 2.0) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) * (ky / kx);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0))) tmp = 0 if t_1 <= 1e-6: tmp = math.sin(th) * (ky / math.sin(kx)) elif t_1 <= 2.0: tmp = math.sin(th) else: tmp = math.sin(th) * (ky / kx) return tmp
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_1 <= 1e-6) tmp = Float64(sin(th) * Float64(ky / sin(kx))); elseif (t_1 <= 2.0) tmp = sin(th); else tmp = Float64(sin(th) * Float64(ky / kx)); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0))); tmp = 0.0; if (t_1 <= 1e-6) tmp = sin(th) * (ky / sin(kx)); elseif (t_1 <= 2.0) tmp = sin(th); else tmp = sin(th) * (ky / kx); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 1e-6], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2.0], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(ky / kx), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_1 \leq 10^{-6}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{elif}\;t\_1 \leq 2:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{ky}{kx}\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 9.99999999999999955e-7Initial program 93.1%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-sin.f6430.6
Simplified30.6%
if 9.99999999999999955e-7 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2Initial program 99.7%
Taylor expanded in kx around 0
lower-sin.f6463.8
Simplified63.8%
if 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 2.4%
Applied egg-rr2.4%
Taylor expanded in kx around 0
lower-*.f64N/A
unpow2N/A
lower-*.f642.4
Simplified2.4%
Taylor expanded in ky around 0
lower-/.f6420.1
Simplified20.1%
Final simplification40.2%
(FPCore (kx ky th)
:precision binary64
(if (<= (pow (sin kx) 2.0) 2e-9)
(*
(sin th)
(/
(sin ky)
(hypot (sin ky) (* kx (fma -0.16666666666666666 (* kx kx) 1.0)))))
(*
(sin ky)
(/
(sin th)
(sqrt
(+
0.5
(fma -0.5 (cos (* ky -2.0)) (fma -0.5 (cos (* kx -2.0)) 0.5))))))))
double code(double kx, double ky, double th) {
double tmp;
if (pow(sin(kx), 2.0) <= 2e-9) {
tmp = sin(th) * (sin(ky) / hypot(sin(ky), (kx * fma(-0.16666666666666666, (kx * kx), 1.0))));
} else {
tmp = sin(ky) * (sin(th) / sqrt((0.5 + fma(-0.5, cos((ky * -2.0)), fma(-0.5, cos((kx * -2.0)), 0.5)))));
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if ((sin(kx) ^ 2.0) <= 2e-9) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), Float64(kx * fma(-0.16666666666666666, Float64(kx * kx), 1.0))))); else tmp = Float64(sin(ky) * Float64(sin(th) / sqrt(Float64(0.5 + fma(-0.5, cos(Float64(ky * -2.0)), fma(-0.5, cos(Float64(kx * -2.0)), 0.5)))))); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision], 2e-9], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[(kx * N[(-0.16666666666666666 * N[(kx * kx), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[(0.5 + N[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + N[(-0.5 * N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\sin kx}^{2} \leq 2 \cdot 10^{-9}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, kx \cdot \mathsf{fma}\left(-0.16666666666666666, kx \cdot kx, 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sqrt{0.5 + \mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), \mathsf{fma}\left(-0.5, \cos \left(kx \cdot -2\right), 0.5\right)\right)}}\\
\end{array}
\end{array}
if (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) < 2.00000000000000012e-9Initial program 86.9%
lift-sin.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6499.9
Applied egg-rr99.9%
Taylor expanded in kx around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6499.9
Simplified99.9%
if 2.00000000000000012e-9 < (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) Initial program 99.4%
Applied egg-rr99.0%
Taylor expanded in kx around inf
lower-+.f64N/A
sub-negN/A
metadata-evalN/A
distribute-lft-neg-inN/A
sub-negN/A
sub-negN/A
distribute-lft-inN/A
metadata-evalN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
metadata-evalN/A
distribute-lft-neg-inN/A
metadata-evalN/A
Simplified99.1%
Final simplification99.5%
(FPCore (kx ky th)
:precision binary64
(if (<= (pow (sin kx) 2.0) 2e-9)
(*
(sin th)
(/
(sin ky)
(hypot (sin ky) (* kx (fma -0.16666666666666666 (* kx kx) 1.0)))))
(*
(sin th)
(/
(sin ky)
(sqrt
(fma (- 1.0 (cos (+ kx kx))) 0.5 (+ 0.5 (* -0.5 (cos (+ ky ky))))))))))
double code(double kx, double ky, double th) {
double tmp;
if (pow(sin(kx), 2.0) <= 2e-9) {
tmp = sin(th) * (sin(ky) / hypot(sin(ky), (kx * fma(-0.16666666666666666, (kx * kx), 1.0))));
} else {
tmp = sin(th) * (sin(ky) / sqrt(fma((1.0 - cos((kx + kx))), 0.5, (0.5 + (-0.5 * cos((ky + ky)))))));
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if ((sin(kx) ^ 2.0) <= 2e-9) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), Float64(kx * fma(-0.16666666666666666, Float64(kx * kx), 1.0))))); else tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(fma(Float64(1.0 - cos(Float64(kx + kx))), 0.5, Float64(0.5 + Float64(-0.5 * cos(Float64(ky + ky)))))))); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision], 2e-9], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[(kx * N[(-0.16666666666666666 * N[(kx * kx), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[(1.0 - N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5 + N[(0.5 + N[(-0.5 * N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\sin kx}^{2} \leq 2 \cdot 10^{-9}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, kx \cdot \mathsf{fma}\left(-0.16666666666666666, kx \cdot kx, 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{\mathsf{fma}\left(1 - \cos \left(kx + kx\right), 0.5, 0.5 + -0.5 \cdot \cos \left(ky + ky\right)\right)}}\\
\end{array}
\end{array}
if (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) < 2.00000000000000012e-9Initial program 86.9%
lift-sin.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6499.9
Applied egg-rr99.9%
Taylor expanded in kx around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6499.9
Simplified99.9%
if 2.00000000000000012e-9 < (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) Initial program 99.4%
lift-sin.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-sqrt.f6499.4
lift-+.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
Applied egg-rr99.0%
Final simplification99.5%
(FPCore (kx ky th)
:precision binary64
(if (<=
(*
(sin th)
(/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))))
2e-308)
(* -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))))) <= 2e-308) {
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))))) <= 2d-308) 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))))) <= 2e-308) {
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))))) <= 2e-308: 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))))) <= 2e-308) 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))))) <= 2e-308) 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], 2e-308], 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 2 \cdot 10^{-308}:\\
\;\;\;\;-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)) < 1.9999999999999998e-308Initial program 93.8%
Taylor expanded in kx around 0
lower-sin.f6423.3
Simplified23.3%
Taylor expanded in th around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6411.7
Simplified11.7%
Taylor expanded in th around inf
lower-*.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6411.3
Simplified11.3%
if 1.9999999999999998e-308 < (*.f64 (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) (sin.f64 th)) Initial program 92.0%
Taylor expanded in kx around 0
lower-sin.f6421.4
Simplified21.4%
Taylor expanded in th around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6414.4
Simplified14.4%
Taylor expanded in th around 0
Simplified14.7%
*-rgt-identity14.7
Applied egg-rr14.7%
Final simplification12.9%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 3e-45) (* -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)))) <= 3e-45) {
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)))) <= 3d-45) 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)))) <= 3e-45) {
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)))) <= 3e-45: 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)))) <= 3e-45) 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)))) <= 3e-45) 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], 3e-45], 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 3 \cdot 10^{-45}:\\
\;\;\;\;-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.00000000000000011e-45Initial program 92.9%
Taylor expanded in kx around 0
lower-sin.f643.5
Simplified3.5%
Taylor expanded in th around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f643.4
Simplified3.4%
Taylor expanded in th around inf
lower-*.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6410.0
Simplified10.0%
if 3.00000000000000011e-45 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 93.0%
Taylor expanded in kx around 0
lower-sin.f6458.4
Simplified58.4%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.1)
(*
(* (sin ky) th)
(sqrt (/ 1.0 (fma -0.5 (cos (* ky -2.0)) (fma kx kx 0.5)))))
(if (<= (sin ky) 0.001)
(*
(sin th)
(/ (fma ky (* -0.16666666666666666 (* ky ky)) ky) (hypot (sin kx) ky)))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.1) {
tmp = (sin(ky) * th) * sqrt((1.0 / fma(-0.5, cos((ky * -2.0)), fma(kx, kx, 0.5))));
} else if (sin(ky) <= 0.001) {
tmp = sin(th) * (fma(ky, (-0.16666666666666666 * (ky * ky)), ky) / hypot(sin(kx), ky));
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.1) tmp = Float64(Float64(sin(ky) * th) * sqrt(Float64(1.0 / fma(-0.5, cos(Float64(ky * -2.0)), fma(kx, kx, 0.5))))); elseif (sin(ky) <= 0.001) tmp = Float64(sin(th) * Float64(fma(ky, Float64(-0.16666666666666666 * Float64(ky * ky)), ky) / hypot(sin(kx), ky))); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.1], N[(N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + N[(kx * kx + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 0.001], N[(N[Sin[th], $MachinePrecision] * N[(N[(ky * N[(-0.16666666666666666 * N[(ky * ky), $MachinePrecision]), $MachinePrecision] + ky), $MachinePrecision] / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + ky ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.1:\\
\;\;\;\;\left(\sin ky \cdot th\right) \cdot \sqrt{\frac{1}{\mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), \mathsf{fma}\left(kx, kx, 0.5\right)\right)}}\\
\mathbf{elif}\;\sin ky \leq 0.001:\\
\;\;\;\;\sin th \cdot \frac{\mathsf{fma}\left(ky, -0.16666666666666666 \cdot \left(ky \cdot ky\right), ky\right)}{\mathsf{hypot}\left(\sin kx, ky\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.10000000000000001Initial program 99.7%
Applied egg-rr99.2%
Taylor expanded in kx around 0
lower-*.f64N/A
unpow2N/A
lower-*.f6457.7
Simplified57.7%
Taylor expanded in th around 0
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
associate-+l+N/A
lower-fma.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-fma.f6429.8
Simplified29.8%
if -0.10000000000000001 < (sin.f64 ky) < 1e-3Initial program 85.9%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6483.9
Simplified83.9%
lift-sin.f64N/A
pow2N/A
lower-hypot.f6497.6
Applied egg-rr97.6%
Taylor expanded in ky around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6497.5
Simplified97.5%
if 1e-3 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0
lower-sin.f6458.4
Simplified58.4%
Final simplification70.0%
(FPCore (kx ky th)
:precision binary64
(if (<= ky 0.0066)
(*
(sin th)
(/
(*
ky
(fma
(* ky ky)
(fma
(* ky ky)
(fma -0.0001984126984126984 (* ky ky) 0.008333333333333333)
-0.16666666666666666)
1.0))
(hypot (sin kx) ky)))
(* (sin ky) (/ (sin th) (sqrt (fma -0.5 (cos (* ky -2.0)) 0.5))))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 0.0066) {
tmp = sin(th) * ((ky * fma((ky * ky), fma((ky * ky), fma(-0.0001984126984126984, (ky * ky), 0.008333333333333333), -0.16666666666666666), 1.0)) / hypot(sin(kx), ky));
} else {
tmp = sin(ky) * (sin(th) / sqrt(fma(-0.5, cos((ky * -2.0)), 0.5)));
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (ky <= 0.0066) tmp = Float64(sin(th) * Float64(Float64(ky * fma(Float64(ky * ky), fma(Float64(ky * ky), fma(-0.0001984126984126984, Float64(ky * ky), 0.008333333333333333), -0.16666666666666666), 1.0)) / hypot(sin(kx), ky))); else tmp = Float64(sin(ky) * Float64(sin(th) / sqrt(fma(-0.5, cos(Float64(ky * -2.0)), 0.5)))); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[ky, 0.0066], N[(N[Sin[th], $MachinePrecision] * N[(N[(ky * N[(N[(ky * ky), $MachinePrecision] * N[(N[(ky * ky), $MachinePrecision] * N[(-0.0001984126984126984 * N[(ky * ky), $MachinePrecision] + 0.008333333333333333), $MachinePrecision] + -0.16666666666666666), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + ky ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 0.0066:\\
\;\;\;\;\sin th \cdot \frac{ky \cdot \mathsf{fma}\left(ky \cdot ky, \mathsf{fma}\left(ky \cdot ky, \mathsf{fma}\left(-0.0001984126984126984, ky \cdot ky, 0.008333333333333333\right), -0.16666666666666666\right), 1\right)}{\mathsf{hypot}\left(\sin kx, ky\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sqrt{\mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), 0.5\right)}}\\
\end{array}
\end{array}
if ky < 0.0066Initial program 90.6%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6457.3
Simplified57.3%
lift-sin.f64N/A
pow2N/A
lower-hypot.f6466.4
Applied egg-rr66.4%
Taylor expanded in ky around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6464.8
Simplified64.8%
if 0.0066 < ky Initial program 99.8%
Applied egg-rr99.3%
Taylor expanded in kx around 0
+-commutativeN/A
lower-fma.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6460.5
Simplified60.5%
Final simplification63.7%
(FPCore (kx ky th)
:precision binary64
(if (<= ky 0.0066)
(*
(sin th)
(/ (fma ky (* -0.16666666666666666 (* ky ky)) ky) (hypot (sin kx) ky)))
(* (sin ky) (/ (sin th) (sqrt (fma -0.5 (cos (* ky -2.0)) 0.5))))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 0.0066) {
tmp = sin(th) * (fma(ky, (-0.16666666666666666 * (ky * ky)), ky) / hypot(sin(kx), ky));
} else {
tmp = sin(ky) * (sin(th) / sqrt(fma(-0.5, cos((ky * -2.0)), 0.5)));
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (ky <= 0.0066) tmp = Float64(sin(th) * Float64(fma(ky, Float64(-0.16666666666666666 * Float64(ky * ky)), ky) / hypot(sin(kx), ky))); else tmp = Float64(sin(ky) * Float64(sin(th) / sqrt(fma(-0.5, cos(Float64(ky * -2.0)), 0.5)))); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[ky, 0.0066], N[(N[Sin[th], $MachinePrecision] * N[(N[(ky * N[(-0.16666666666666666 * N[(ky * ky), $MachinePrecision]), $MachinePrecision] + ky), $MachinePrecision] / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + ky ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 0.0066:\\
\;\;\;\;\sin th \cdot \frac{\mathsf{fma}\left(ky, -0.16666666666666666 \cdot \left(ky \cdot ky\right), ky\right)}{\mathsf{hypot}\left(\sin kx, ky\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sqrt{\mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), 0.5\right)}}\\
\end{array}
\end{array}
if ky < 0.0066Initial program 90.6%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6457.3
Simplified57.3%
lift-sin.f64N/A
pow2N/A
lower-hypot.f6466.4
Applied egg-rr66.4%
Taylor expanded in ky around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6464.9
Simplified64.9%
if 0.0066 < ky Initial program 99.8%
Applied egg-rr99.3%
Taylor expanded in kx around 0
+-commutativeN/A
lower-fma.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6460.5
Simplified60.5%
Final simplification63.7%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 1.45e-114) (* (sin ky) (/ (sin th) kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 1.45e-114) {
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) <= 1.45d-114) 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) <= 1.45e-114) {
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) <= 1.45e-114: tmp = math.sin(ky) * (math.sin(th) / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 1.45e-114) 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) <= 1.45e-114) tmp = sin(ky) * (sin(th) / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 1.45e-114], 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}\;\sin ky \leq 1.45 \cdot 10^{-114}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 1.44999999999999998e-114Initial program 89.6%
Taylor expanded in ky around 0
lower-sin.f6430.5
Simplified30.5%
Taylor expanded in kx around 0
associate-/l*N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-/.f64N/A
lower-sin.f6420.6
Simplified20.6%
if 1.44999999999999998e-114 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0
lower-sin.f6457.3
Simplified57.3%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 1.45e-114) (* (sin th) (* (fma ky (* -0.16666666666666666 (* ky ky)) ky) (/ 1.0 kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 1.45e-114) {
tmp = sin(th) * (fma(ky, (-0.16666666666666666 * (ky * ky)), ky) * (1.0 / kx));
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 1.45e-114) tmp = Float64(sin(th) * Float64(fma(ky, Float64(-0.16666666666666666 * Float64(ky * ky)), ky) * Float64(1.0 / kx))); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 1.45e-114], N[(N[Sin[th], $MachinePrecision] * N[(N[(ky * N[(-0.16666666666666666 * N[(ky * ky), $MachinePrecision]), $MachinePrecision] + ky), $MachinePrecision] * N[(1.0 / kx), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 1.45 \cdot 10^{-114}:\\
\;\;\;\;\sin th \cdot \left(\mathsf{fma}\left(ky, -0.16666666666666666 \cdot \left(ky \cdot ky\right), ky\right) \cdot \frac{1}{kx}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 1.44999999999999998e-114Initial program 89.6%
Applied egg-rr69.8%
Taylor expanded in kx around 0
lower-*.f64N/A
unpow2N/A
lower-*.f6444.0
Simplified44.0%
Taylor expanded in kx around inf
lower-/.f6420.6
Simplified20.6%
Taylor expanded in ky around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6419.7
Simplified19.7%
if 1.44999999999999998e-114 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0
lower-sin.f6457.3
Simplified57.3%
Final simplification32.4%
(FPCore (kx ky th) :precision binary64 (if (<= ky 1.45e-114) (* (sin th) (/ ky kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 1.45e-114) {
tmp = sin(th) * (ky / kx);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= 1.45d-114) then
tmp = sin(th) * (ky / kx)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 1.45e-114) {
tmp = Math.sin(th) * (ky / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 1.45e-114: tmp = math.sin(th) * (ky / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 1.45e-114) tmp = Float64(sin(th) * Float64(ky / kx)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 1.45e-114) tmp = sin(th) * (ky / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 1.45e-114], N[(N[Sin[th], $MachinePrecision] * N[(ky / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 1.45 \cdot 10^{-114}:\\
\;\;\;\;\sin th \cdot \frac{ky}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 1.44999999999999998e-114Initial program 89.4%
Applied egg-rr69.4%
Taylor expanded in kx around 0
lower-*.f64N/A
unpow2N/A
lower-*.f6443.2
Simplified43.2%
Taylor expanded in ky around 0
lower-/.f6420.5
Simplified20.5%
if 1.44999999999999998e-114 < ky Initial program 99.8%
Taylor expanded in kx around 0
lower-sin.f6436.3
Simplified36.3%
Final simplification25.9%
(FPCore (kx ky th) :precision binary64 (if (<= ky 1.45e-114) (* ky (/ (sin th) kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 1.45e-114) {
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 (ky <= 1.45d-114) 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 (ky <= 1.45e-114) {
tmp = ky * (Math.sin(th) / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 1.45e-114: tmp = ky * (math.sin(th) / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 1.45e-114) tmp = Float64(ky * Float64(sin(th) / kx)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 1.45e-114) tmp = ky * (sin(th) / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 1.45e-114], N[(ky * N[(N[Sin[th], $MachinePrecision] / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 1.45 \cdot 10^{-114}:\\
\;\;\;\;ky \cdot \frac{\sin th}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 1.44999999999999998e-114Initial program 89.4%
Applied egg-rr69.4%
Taylor expanded in kx around 0
lower-*.f64N/A
unpow2N/A
lower-*.f6443.2
Simplified43.2%
Taylor expanded in ky around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-sin.f6420.6
Simplified20.6%
if 1.44999999999999998e-114 < ky Initial program 99.8%
Taylor expanded in kx around 0
lower-sin.f6436.3
Simplified36.3%
(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 93.0%
Taylor expanded in kx around 0
lower-sin.f6422.4
Simplified22.4%
Taylor expanded in th around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6413.0
Simplified13.0%
Taylor expanded in th around 0
Simplified13.4%
*-rgt-identity13.4
Applied egg-rr13.4%
herbie shell --seed 2024208
(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)))