
(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 32 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 95.9%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6499.7
Applied rewrites99.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (pow (sin kx) 2.0))
(t_2 (pow (sin ky) 2.0))
(t_3 (* (sin th) (/ (sin ky) (sqrt (+ t_2 (* kx kx))))))
(t_4 (/ (sin ky) (sqrt (+ t_1 t_2)))))
(if (<= t_4 -0.9996)
t_3
(if (<= t_4 -0.3)
(*
(/ (sin ky) (hypot (sin ky) (sin kx)))
(fma th (* -0.16666666666666666 (* th th)) th))
(if (<= t_4 0.06)
(* (sin th) (/ (sin ky) (sqrt (+ t_1 (* ky ky)))))
(if (<= t_4 0.995)
(*
(*
(sin ky)
(fma
th
(*
(* th th)
(fma 0.008333333333333333 (* th th) -0.16666666666666666))
th))
(sqrt
(/
1.0
(fma
(- 1.0 (cos (+ kx kx)))
0.5
(+ 0.5 (* -0.5 (cos (+ ky ky))))))))
(if (<= t_4 2.0)
t_3
(*
(sin th)
(/
(sin ky)
(hypot
(fma ky (* (* ky ky) -0.16666666666666666) ky)
(sin kx)))))))))))
double code(double kx, double ky, double th) {
double t_1 = pow(sin(kx), 2.0);
double t_2 = pow(sin(ky), 2.0);
double t_3 = sin(th) * (sin(ky) / sqrt((t_2 + (kx * kx))));
double t_4 = sin(ky) / sqrt((t_1 + t_2));
double tmp;
if (t_4 <= -0.9996) {
tmp = t_3;
} else if (t_4 <= -0.3) {
tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * fma(th, (-0.16666666666666666 * (th * th)), th);
} else if (t_4 <= 0.06) {
tmp = sin(th) * (sin(ky) / sqrt((t_1 + (ky * ky))));
} else if (t_4 <= 0.995) {
tmp = (sin(ky) * fma(th, ((th * th) * fma(0.008333333333333333, (th * th), -0.16666666666666666)), th)) * sqrt((1.0 / fma((1.0 - cos((kx + kx))), 0.5, (0.5 + (-0.5 * cos((ky + ky)))))));
} else if (t_4 <= 2.0) {
tmp = t_3;
} else {
tmp = sin(th) * (sin(ky) / hypot(fma(ky, ((ky * ky) * -0.16666666666666666), ky), sin(kx)));
}
return tmp;
}
function code(kx, ky, th) t_1 = sin(kx) ^ 2.0 t_2 = sin(ky) ^ 2.0 t_3 = Float64(sin(th) * Float64(sin(ky) / sqrt(Float64(t_2 + Float64(kx * kx))))) t_4 = Float64(sin(ky) / sqrt(Float64(t_1 + t_2))) tmp = 0.0 if (t_4 <= -0.9996) tmp = t_3; elseif (t_4 <= -0.3) tmp = Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * fma(th, Float64(-0.16666666666666666 * Float64(th * th)), th)); elseif (t_4 <= 0.06) tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(Float64(t_1 + Float64(ky * ky))))); elseif (t_4 <= 0.995) tmp = Float64(Float64(sin(ky) * fma(th, Float64(Float64(th * th) * fma(0.008333333333333333, Float64(th * th), -0.16666666666666666)), th)) * 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 <= 2.0) tmp = t_3; else tmp = Float64(sin(th) * Float64(sin(ky) / hypot(fma(ky, Float64(Float64(ky * ky) * -0.16666666666666666), ky), sin(kx)))); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$3 = N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$2 + N[(kx * kx), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$1 + t$95$2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$4, -0.9996], t$95$3, If[LessEqual[t$95$4, -0.3], 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]), $MachinePrecision] + th), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 0.06], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$1 + N[(ky * ky), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 0.995], N[(N[(N[Sin[ky], $MachinePrecision] * N[(th * N[(N[(th * th), $MachinePrecision] * N[(0.008333333333333333 * N[(th * th), $MachinePrecision] + -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + th), $MachinePrecision]), $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], If[LessEqual[t$95$4, 2.0], t$95$3, N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(ky * N[(N[(ky * ky), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] + ky), $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := {\sin kx}^{2}\\
t_2 := {\sin ky}^{2}\\
t_3 := \sin th \cdot \frac{\sin ky}{\sqrt{t\_2 + kx \cdot kx}}\\
t_4 := \frac{\sin ky}{\sqrt{t\_1 + t\_2}}\\
\mathbf{if}\;t\_4 \leq -0.9996:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_4 \leq -0.3:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot \mathsf{fma}\left(th, -0.16666666666666666 \cdot \left(th \cdot th\right), th\right)\\
\mathbf{elif}\;t\_4 \leq 0.06:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{t\_1 + ky \cdot ky}}\\
\mathbf{elif}\;t\_4 \leq 0.995:\\
\;\;\;\;\left(\sin ky \cdot \mathsf{fma}\left(th, \left(th \cdot th\right) \cdot \mathsf{fma}\left(0.008333333333333333, th \cdot th, -0.16666666666666666\right), th\right)\right) \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)}}\\
\mathbf{elif}\;t\_4 \leq 2:\\
\;\;\;\;t\_3\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\mathsf{fma}\left(ky, \left(ky \cdot ky\right) \cdot -0.16666666666666666, ky\right), \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.99960000000000004 or 0.994999999999999996 < (/.f64 (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 95.8%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6494.7
Applied rewrites94.7%
if -0.99960000000000004 < (/.f64 (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.299999999999999989Initial program 99.2%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6499.3
Applied rewrites99.3%
Taylor expanded in th around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6449.0
Applied rewrites49.0%
if -0.299999999999999989 < (/.f64 (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.059999999999999998Initial program 99.5%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6496.1
Applied rewrites96.1%
if 0.059999999999999998 < (/.f64 (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.994999999999999996Initial program 99.6%
Applied rewrites99.3%
Taylor expanded in th around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6474.2
Applied rewrites74.2%
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.3%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6499.7
Applied rewrites99.7%
Taylor expanded in ky around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6499.7
Applied rewrites99.7%
Final simplification88.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1
(*
(sin th)
(/
(sin ky)
(hypot (fma ky (* (* ky ky) -0.16666666666666666) ky) (sin kx)))))
(t_2 (pow (sin ky) 2.0))
(t_3 (* (sin th) (/ (sin ky) (sqrt (+ t_2 (* kx kx))))))
(t_4 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) t_2)))))
(if (<= t_4 -0.9996)
t_3
(if (<= t_4 -0.3)
(*
(/ (sin ky) (hypot (sin ky) (sin kx)))
(fma th (* -0.16666666666666666 (* th th)) th))
(if (<= t_4 0.001)
t_1
(if (<= t_4 0.995)
(*
(*
(sin ky)
(fma
th
(*
(* th th)
(fma 0.008333333333333333 (* th th) -0.16666666666666666))
th))
(sqrt
(/
1.0
(fma
(- 1.0 (cos (+ kx kx)))
0.5
(+ 0.5 (* -0.5 (cos (+ ky ky))))))))
(if (<= t_4 2.0) t_3 t_1)))))))
double code(double kx, double ky, double th) {
double t_1 = sin(th) * (sin(ky) / hypot(fma(ky, ((ky * ky) * -0.16666666666666666), ky), sin(kx)));
double t_2 = pow(sin(ky), 2.0);
double t_3 = sin(th) * (sin(ky) / sqrt((t_2 + (kx * kx))));
double t_4 = sin(ky) / sqrt((pow(sin(kx), 2.0) + t_2));
double tmp;
if (t_4 <= -0.9996) {
tmp = t_3;
} else if (t_4 <= -0.3) {
tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * fma(th, (-0.16666666666666666 * (th * th)), th);
} else if (t_4 <= 0.001) {
tmp = t_1;
} else if (t_4 <= 0.995) {
tmp = (sin(ky) * fma(th, ((th * th) * fma(0.008333333333333333, (th * th), -0.16666666666666666)), th)) * sqrt((1.0 / fma((1.0 - cos((kx + kx))), 0.5, (0.5 + (-0.5 * cos((ky + ky)))))));
} else if (t_4 <= 2.0) {
tmp = t_3;
} else {
tmp = t_1;
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(th) * Float64(sin(ky) / hypot(fma(ky, Float64(Float64(ky * ky) * -0.16666666666666666), ky), sin(kx)))) t_2 = sin(ky) ^ 2.0 t_3 = Float64(sin(th) * Float64(sin(ky) / sqrt(Float64(t_2 + Float64(kx * kx))))) t_4 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + t_2))) tmp = 0.0 if (t_4 <= -0.9996) tmp = t_3; elseif (t_4 <= -0.3) tmp = Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * fma(th, Float64(-0.16666666666666666 * Float64(th * th)), th)); elseif (t_4 <= 0.001) tmp = t_1; elseif (t_4 <= 0.995) tmp = Float64(Float64(sin(ky) * fma(th, Float64(Float64(th * th) * fma(0.008333333333333333, Float64(th * th), -0.16666666666666666)), th)) * 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 <= 2.0) tmp = t_3; 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[(ky * N[(N[(ky * ky), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] + ky), $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$3 = N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$2 + N[(kx * kx), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + t$95$2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$4, -0.9996], t$95$3, If[LessEqual[t$95$4, -0.3], 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]), $MachinePrecision] + th), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 0.001], t$95$1, If[LessEqual[t$95$4, 0.995], N[(N[(N[Sin[ky], $MachinePrecision] * N[(th * N[(N[(th * th), $MachinePrecision] * N[(0.008333333333333333 * N[(th * th), $MachinePrecision] + -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + th), $MachinePrecision]), $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], If[LessEqual[t$95$4, 2.0], t$95$3, t$95$1]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\mathsf{fma}\left(ky, \left(ky \cdot ky\right) \cdot -0.16666666666666666, ky\right), \sin kx\right)}\\
t_2 := {\sin ky}^{2}\\
t_3 := \sin th \cdot \frac{\sin ky}{\sqrt{t\_2 + kx \cdot kx}}\\
t_4 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + t\_2}}\\
\mathbf{if}\;t\_4 \leq -0.9996:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_4 \leq -0.3:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot \mathsf{fma}\left(th, -0.16666666666666666 \cdot \left(th \cdot th\right), th\right)\\
\mathbf{elif}\;t\_4 \leq 0.001:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_4 \leq 0.995:\\
\;\;\;\;\left(\sin ky \cdot \mathsf{fma}\left(th, \left(th \cdot th\right) \cdot \mathsf{fma}\left(0.008333333333333333, th \cdot th, -0.16666666666666666\right), th\right)\right) \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)}}\\
\mathbf{elif}\;t\_4 \leq 2:\\
\;\;\;\;t\_3\\
\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.99960000000000004 or 0.994999999999999996 < (/.f64 (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 95.8%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6494.7
Applied rewrites94.7%
if -0.99960000000000004 < (/.f64 (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.299999999999999989Initial program 99.2%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6499.3
Applied rewrites99.3%
Taylor expanded in th around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6449.0
Applied rewrites49.0%
if -0.299999999999999989 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 1e-3 or 2 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 94.3%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6499.6
Applied rewrites99.6%
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-*.f6497.0
Applied rewrites97.0%
if 1e-3 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.994999999999999996Initial program 99.6%
Applied rewrites99.3%
Taylor expanded in th around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6475.2
Applied rewrites75.2%
Final simplification89.1%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1
(*
(sin th)
(/
(sin ky)
(hypot (fma ky (* (* ky ky) -0.16666666666666666) ky) (sin kx)))))
(t_2 (pow (sin ky) 2.0))
(t_3 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) t_2)))))
(if (<= t_3 -0.9996)
(* (* (sin ky) (sin th)) (sqrt (/ 1.0 (fma -0.5 (cos (* ky -2.0)) 0.5))))
(if (<= t_3 -0.3)
(*
(/ (sin ky) (hypot (sin ky) (sin kx)))
(fma th (* -0.16666666666666666 (* th th)) th))
(if (<= t_3 0.001)
t_1
(if (<= t_3 0.995)
(*
(*
(sin ky)
(fma
th
(*
(* th th)
(fma 0.008333333333333333 (* th th) -0.16666666666666666))
th))
(sqrt
(/
1.0
(fma
(- 1.0 (cos (+ kx kx)))
0.5
(+ 0.5 (* -0.5 (cos (+ ky ky))))))))
(if (<= t_3 2.0)
(* (sin th) (fma (* kx kx) (/ -0.5 t_2) 1.0))
t_1)))))))
double code(double kx, double ky, double th) {
double t_1 = sin(th) * (sin(ky) / hypot(fma(ky, ((ky * ky) * -0.16666666666666666), ky), sin(kx)));
double t_2 = pow(sin(ky), 2.0);
double t_3 = sin(ky) / sqrt((pow(sin(kx), 2.0) + t_2));
double tmp;
if (t_3 <= -0.9996) {
tmp = (sin(ky) * sin(th)) * sqrt((1.0 / fma(-0.5, cos((ky * -2.0)), 0.5)));
} else if (t_3 <= -0.3) {
tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * fma(th, (-0.16666666666666666 * (th * th)), th);
} else if (t_3 <= 0.001) {
tmp = t_1;
} else if (t_3 <= 0.995) {
tmp = (sin(ky) * fma(th, ((th * th) * fma(0.008333333333333333, (th * th), -0.16666666666666666)), th)) * sqrt((1.0 / fma((1.0 - cos((kx + kx))), 0.5, (0.5 + (-0.5 * cos((ky + ky)))))));
} else if (t_3 <= 2.0) {
tmp = sin(th) * fma((kx * kx), (-0.5 / t_2), 1.0);
} else {
tmp = t_1;
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(th) * Float64(sin(ky) / hypot(fma(ky, Float64(Float64(ky * ky) * -0.16666666666666666), ky), sin(kx)))) t_2 = sin(ky) ^ 2.0 t_3 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + t_2))) tmp = 0.0 if (t_3 <= -0.9996) tmp = Float64(Float64(sin(ky) * sin(th)) * sqrt(Float64(1.0 / fma(-0.5, cos(Float64(ky * -2.0)), 0.5)))); elseif (t_3 <= -0.3) tmp = Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * fma(th, Float64(-0.16666666666666666 * Float64(th * th)), th)); elseif (t_3 <= 0.001) tmp = t_1; elseif (t_3 <= 0.995) tmp = Float64(Float64(sin(ky) * fma(th, Float64(Float64(th * th) * fma(0.008333333333333333, Float64(th * th), -0.16666666666666666)), th)) * 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 <= 2.0) tmp = Float64(sin(th) * fma(Float64(kx * kx), Float64(-0.5 / t_2), 1.0)); else tmp = t_1; end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(ky * N[(N[(ky * ky), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] + ky), $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$3 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + t$95$2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, -0.9996], N[(N[(N[Sin[ky], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, -0.3], 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]), $MachinePrecision] + th), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 0.001], t$95$1, If[LessEqual[t$95$3, 0.995], N[(N[(N[Sin[ky], $MachinePrecision] * N[(th * N[(N[(th * th), $MachinePrecision] * N[(0.008333333333333333 * N[(th * th), $MachinePrecision] + -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + th), $MachinePrecision]), $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], 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], t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\mathsf{fma}\left(ky, \left(ky \cdot ky\right) \cdot -0.16666666666666666, ky\right), \sin kx\right)}\\
t_2 := {\sin ky}^{2}\\
t_3 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + t\_2}}\\
\mathbf{if}\;t\_3 \leq -0.9996:\\
\;\;\;\;\left(\sin ky \cdot \sin th\right) \cdot \sqrt{\frac{1}{\mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), 0.5\right)}}\\
\mathbf{elif}\;t\_3 \leq -0.3:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot \mathsf{fma}\left(th, -0.16666666666666666 \cdot \left(th \cdot th\right), th\right)\\
\mathbf{elif}\;t\_3 \leq 0.001:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_3 \leq 0.995:\\
\;\;\;\;\left(\sin ky \cdot \mathsf{fma}\left(th, \left(th \cdot th\right) \cdot \mathsf{fma}\left(0.008333333333333333, th \cdot th, -0.16666666666666666\right), th\right)\right) \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)}}\\
\mathbf{elif}\;t\_3 \leq 2:\\
\;\;\;\;\sin th \cdot \mathsf{fma}\left(kx \cdot kx, \frac{-0.5}{t\_2}, 1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.99960000000000004Initial program 90.2%
Applied rewrites55.2%
Taylor expanded in kx around 0
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6454.9
Applied rewrites54.9%
if -0.99960000000000004 < (/.f64 (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.299999999999999989Initial program 99.2%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6499.3
Applied rewrites99.3%
Taylor expanded in th around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6449.0
Applied rewrites49.0%
if -0.299999999999999989 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 1e-3 or 2 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 94.3%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6499.6
Applied rewrites99.6%
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-*.f6497.0
Applied rewrites97.0%
if 1e-3 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.994999999999999996Initial program 99.6%
Applied rewrites99.3%
Taylor expanded in th around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6475.2
Applied rewrites75.2%
if 0.994999999999999996 < (/.f64 (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.f6498.1
Applied rewrites98.1%
Final simplification83.6%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1
(*
(sin th)
(/
(sin ky)
(hypot (fma ky (* (* ky ky) -0.16666666666666666) ky) (sin kx)))))
(t_2 (- 1.0 (cos (+ kx kx))))
(t_3 (cos (+ ky ky)))
(t_4 (pow (sin ky) 2.0))
(t_5 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) t_4)))))
(if (<= t_5 -0.9996)
(* (* (sin ky) (sin th)) (sqrt (/ 1.0 (fma -0.5 (cos (* ky -2.0)) 0.5))))
(if (<= t_5 -0.3)
(*
(fma th (* -0.16666666666666666 (* th th)) th)
(* (sin ky) (sqrt (/ 1.0 (fma t_2 0.5 (fma t_3 -0.5 0.5))))))
(if (<= t_5 0.001)
t_1
(if (<= t_5 0.995)
(*
(*
(sin ky)
(fma
th
(*
(* th th)
(fma 0.008333333333333333 (* th th) -0.16666666666666666))
th))
(sqrt (/ 1.0 (fma t_2 0.5 (+ 0.5 (* -0.5 t_3))))))
(if (<= t_5 2.0)
(* (sin th) (fma (* kx kx) (/ -0.5 t_4) 1.0))
t_1)))))))
double code(double kx, double ky, double th) {
double t_1 = sin(th) * (sin(ky) / hypot(fma(ky, ((ky * ky) * -0.16666666666666666), ky), sin(kx)));
double t_2 = 1.0 - cos((kx + kx));
double t_3 = cos((ky + 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.9996) {
tmp = (sin(ky) * sin(th)) * sqrt((1.0 / fma(-0.5, cos((ky * -2.0)), 0.5)));
} else if (t_5 <= -0.3) {
tmp = fma(th, (-0.16666666666666666 * (th * th)), th) * (sin(ky) * sqrt((1.0 / fma(t_2, 0.5, fma(t_3, -0.5, 0.5)))));
} else if (t_5 <= 0.001) {
tmp = t_1;
} else if (t_5 <= 0.995) {
tmp = (sin(ky) * fma(th, ((th * th) * fma(0.008333333333333333, (th * th), -0.16666666666666666)), th)) * sqrt((1.0 / fma(t_2, 0.5, (0.5 + (-0.5 * t_3)))));
} else if (t_5 <= 2.0) {
tmp = sin(th) * fma((kx * kx), (-0.5 / t_4), 1.0);
} else {
tmp = t_1;
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(th) * Float64(sin(ky) / hypot(fma(ky, Float64(Float64(ky * ky) * -0.16666666666666666), ky), sin(kx)))) t_2 = Float64(1.0 - cos(Float64(kx + kx))) t_3 = cos(Float64(ky + 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.9996) tmp = Float64(Float64(sin(ky) * sin(th)) * sqrt(Float64(1.0 / fma(-0.5, cos(Float64(ky * -2.0)), 0.5)))); elseif (t_5 <= -0.3) tmp = Float64(fma(th, Float64(-0.16666666666666666 * Float64(th * th)), th) * Float64(sin(ky) * sqrt(Float64(1.0 / fma(t_2, 0.5, fma(t_3, -0.5, 0.5)))))); elseif (t_5 <= 0.001) tmp = t_1; elseif (t_5 <= 0.995) tmp = Float64(Float64(sin(ky) * fma(th, Float64(Float64(th * th) * fma(0.008333333333333333, Float64(th * th), -0.16666666666666666)), th)) * sqrt(Float64(1.0 / fma(t_2, 0.5, Float64(0.5 + Float64(-0.5 * t_3)))))); elseif (t_5 <= 2.0) tmp = Float64(sin(th) * fma(Float64(kx * kx), Float64(-0.5 / t_4), 1.0)); else tmp = t_1; end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(ky * N[(N[(ky * ky), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] + ky), $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 - N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[Power[N[Sin[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.9996], N[(N[(N[Sin[ky], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$5, -0.3], N[(N[(th * N[(-0.16666666666666666 * N[(th * th), $MachinePrecision]), $MachinePrecision] + th), $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] * N[Sqrt[N[(1.0 / N[(t$95$2 * 0.5 + N[(t$95$3 * -0.5 + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$5, 0.001], t$95$1, If[LessEqual[t$95$5, 0.995], N[(N[(N[Sin[ky], $MachinePrecision] * N[(th * N[(N[(th * th), $MachinePrecision] * N[(0.008333333333333333 * N[(th * th), $MachinePrecision] + -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + th), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(t$95$2 * 0.5 + N[(0.5 + N[(-0.5 * t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 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], t$95$1]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\mathsf{fma}\left(ky, \left(ky \cdot ky\right) \cdot -0.16666666666666666, ky\right), \sin kx\right)}\\
t_2 := 1 - \cos \left(kx + kx\right)\\
t_3 := \cos \left(ky + ky\right)\\
t_4 := {\sin ky}^{2}\\
t_5 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + t\_4}}\\
\mathbf{if}\;t\_5 \leq -0.9996:\\
\;\;\;\;\left(\sin ky \cdot \sin th\right) \cdot \sqrt{\frac{1}{\mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), 0.5\right)}}\\
\mathbf{elif}\;t\_5 \leq -0.3:\\
\;\;\;\;\mathsf{fma}\left(th, -0.16666666666666666 \cdot \left(th \cdot th\right), th\right) \cdot \left(\sin ky \cdot \sqrt{\frac{1}{\mathsf{fma}\left(t\_2, 0.5, \mathsf{fma}\left(t\_3, -0.5, 0.5\right)\right)}}\right)\\
\mathbf{elif}\;t\_5 \leq 0.001:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_5 \leq 0.995:\\
\;\;\;\;\left(\sin ky \cdot \mathsf{fma}\left(th, \left(th \cdot th\right) \cdot \mathsf{fma}\left(0.008333333333333333, th \cdot th, -0.16666666666666666\right), th\right)\right) \cdot \sqrt{\frac{1}{\mathsf{fma}\left(t\_2, 0.5, 0.5 + -0.5 \cdot t\_3\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}:\\
\;\;\;\;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.99960000000000004Initial program 90.2%
Applied rewrites55.2%
Taylor expanded in kx around 0
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6454.9
Applied rewrites54.9%
if -0.99960000000000004 < (/.f64 (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.299999999999999989Initial program 99.2%
Applied rewrites99.1%
Taylor expanded in th around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6448.9
Applied rewrites48.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
flip-+N/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
flip-+N/A
lift-+.f64N/A
lower-fma.f6410.8
lift-+.f64N/A
flip-+N/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
flip-+N/A
lift-+.f6448.9
Applied rewrites48.9%
if -0.299999999999999989 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 1e-3 or 2 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 94.3%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6499.6
Applied rewrites99.6%
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-*.f6497.0
Applied rewrites97.0%
if 1e-3 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.994999999999999996Initial program 99.6%
Applied rewrites99.3%
Taylor expanded in th around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6475.2
Applied rewrites75.2%
if 0.994999999999999996 < (/.f64 (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.f6498.1
Applied rewrites98.1%
Final simplification83.5%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (- 1.0 (cos (+ kx kx))))
(t_2 (pow (sin kx) 2.0))
(t_3 (/ (sin ky) (sqrt (+ t_2 (pow (sin ky) 2.0)))))
(t_4 (cos (+ ky ky))))
(if (<= t_3 -0.9996)
(* (* (sin ky) (sin th)) (sqrt (/ 1.0 (fma -0.5 (cos (* ky -2.0)) 0.5))))
(if (<= t_3 -0.2)
(*
(fma th (* -0.16666666666666666 (* th th)) th)
(* (sin ky) (sqrt (/ 1.0 (fma t_1 0.5 (fma t_4 -0.5 0.5))))))
(if (<= t_3 0.001)
(*
(sin th)
(/
(fma ky (* (* ky ky) -0.16666666666666666) ky)
(sqrt (+ t_2 (* ky ky)))))
(if (<= t_3 0.995)
(*
(*
(sin ky)
(fma
th
(*
(* th th)
(fma 0.008333333333333333 (* th th) -0.16666666666666666))
th))
(sqrt (/ 1.0 (fma t_1 0.5 (+ 0.5 (* -0.5 t_4))))))
(sin th)))))))
double code(double kx, double ky, double th) {
double t_1 = 1.0 - cos((kx + kx));
double t_2 = pow(sin(kx), 2.0);
double t_3 = sin(ky) / sqrt((t_2 + pow(sin(ky), 2.0)));
double t_4 = cos((ky + ky));
double tmp;
if (t_3 <= -0.9996) {
tmp = (sin(ky) * sin(th)) * sqrt((1.0 / fma(-0.5, cos((ky * -2.0)), 0.5)));
} else if (t_3 <= -0.2) {
tmp = fma(th, (-0.16666666666666666 * (th * th)), th) * (sin(ky) * sqrt((1.0 / fma(t_1, 0.5, fma(t_4, -0.5, 0.5)))));
} else if (t_3 <= 0.001) {
tmp = sin(th) * (fma(ky, ((ky * ky) * -0.16666666666666666), ky) / sqrt((t_2 + (ky * ky))));
} else if (t_3 <= 0.995) {
tmp = (sin(ky) * fma(th, ((th * th) * fma(0.008333333333333333, (th * th), -0.16666666666666666)), th)) * sqrt((1.0 / fma(t_1, 0.5, (0.5 + (-0.5 * t_4)))));
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(1.0 - cos(Float64(kx + kx))) t_2 = sin(kx) ^ 2.0 t_3 = Float64(sin(ky) / sqrt(Float64(t_2 + (sin(ky) ^ 2.0)))) t_4 = cos(Float64(ky + ky)) tmp = 0.0 if (t_3 <= -0.9996) tmp = Float64(Float64(sin(ky) * sin(th)) * sqrt(Float64(1.0 / fma(-0.5, cos(Float64(ky * -2.0)), 0.5)))); elseif (t_3 <= -0.2) tmp = Float64(fma(th, Float64(-0.16666666666666666 * Float64(th * th)), th) * Float64(sin(ky) * sqrt(Float64(1.0 / fma(t_1, 0.5, fma(t_4, -0.5, 0.5)))))); elseif (t_3 <= 0.001) tmp = Float64(sin(th) * Float64(fma(ky, Float64(Float64(ky * ky) * -0.16666666666666666), ky) / sqrt(Float64(t_2 + Float64(ky * ky))))); elseif (t_3 <= 0.995) tmp = Float64(Float64(sin(ky) * fma(th, Float64(Float64(th * th) * fma(0.008333333333333333, Float64(th * th), -0.16666666666666666)), th)) * sqrt(Float64(1.0 / fma(t_1, 0.5, Float64(0.5 + Float64(-0.5 * t_4)))))); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(1.0 - N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[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[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$3, -0.9996], N[(N[(N[Sin[ky], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, -0.2], N[(N[(th * N[(-0.16666666666666666 * N[(th * th), $MachinePrecision]), $MachinePrecision] + th), $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] * N[Sqrt[N[(1.0 / N[(t$95$1 * 0.5 + N[(t$95$4 * -0.5 + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 0.001], N[(N[Sin[th], $MachinePrecision] * N[(N[(ky * N[(N[(ky * ky), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] + ky), $MachinePrecision] / N[Sqrt[N[(t$95$2 + N[(ky * ky), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 0.995], N[(N[(N[Sin[ky], $MachinePrecision] * N[(th * N[(N[(th * th), $MachinePrecision] * N[(0.008333333333333333 * N[(th * th), $MachinePrecision] + -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + th), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(t$95$1 * 0.5 + N[(0.5 + N[(-0.5 * t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 1 - \cos \left(kx + kx\right)\\
t_2 := {\sin kx}^{2}\\
t_3 := \frac{\sin ky}{\sqrt{t\_2 + {\sin ky}^{2}}}\\
t_4 := \cos \left(ky + ky\right)\\
\mathbf{if}\;t\_3 \leq -0.9996:\\
\;\;\;\;\left(\sin ky \cdot \sin th\right) \cdot \sqrt{\frac{1}{\mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), 0.5\right)}}\\
\mathbf{elif}\;t\_3 \leq -0.2:\\
\;\;\;\;\mathsf{fma}\left(th, -0.16666666666666666 \cdot \left(th \cdot th\right), th\right) \cdot \left(\sin ky \cdot \sqrt{\frac{1}{\mathsf{fma}\left(t\_1, 0.5, \mathsf{fma}\left(t\_4, -0.5, 0.5\right)\right)}}\right)\\
\mathbf{elif}\;t\_3 \leq 0.001:\\
\;\;\;\;\sin th \cdot \frac{\mathsf{fma}\left(ky, \left(ky \cdot ky\right) \cdot -0.16666666666666666, ky\right)}{\sqrt{t\_2 + ky \cdot ky}}\\
\mathbf{elif}\;t\_3 \leq 0.995:\\
\;\;\;\;\left(\sin ky \cdot \mathsf{fma}\left(th, \left(th \cdot th\right) \cdot \mathsf{fma}\left(0.008333333333333333, th \cdot th, -0.16666666666666666\right), th\right)\right) \cdot \sqrt{\frac{1}{\mathsf{fma}\left(t\_1, 0.5, 0.5 + -0.5 \cdot t\_4\right)}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.99960000000000004Initial program 90.2%
Applied rewrites55.2%
Taylor expanded in kx around 0
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6454.9
Applied rewrites54.9%
if -0.99960000000000004 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.20000000000000001Initial program 99.2%
Applied rewrites99.1%
Taylor expanded in th around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6445.6
Applied rewrites45.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
flip-+N/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
flip-+N/A
lift-+.f64N/A
lower-fma.f6410.1
lift-+.f64N/A
flip-+N/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
flip-+N/A
lift-+.f6445.6
Applied rewrites45.6%
if -0.20000000000000001 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 1e-3Initial program 99.5%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6498.7
Applied rewrites98.7%
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-*.f6498.6
Applied rewrites98.6%
if 1e-3 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.994999999999999996Initial program 99.6%
Applied rewrites99.3%
Taylor expanded in th around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6475.2
Applied rewrites75.2%
if 0.994999999999999996 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 90.1%
Taylor expanded in kx around 0
lower-sin.f6492.1
Applied rewrites92.1%
Final simplification82.1%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (fma -0.5 (cos (* ky -2.0)) 0.5))
(t_2 (pow (sin kx) 2.0))
(t_3 (/ (sin ky) (sqrt (+ t_2 (pow (sin ky) 2.0))))))
(if (<= t_3 -0.9996)
(* (* (sin ky) (sin th)) (sqrt (/ 1.0 t_1)))
(if (<= t_3 -0.2)
(*
(fma th (* -0.16666666666666666 (* th th)) th)
(*
(sin ky)
(sqrt
(/
1.0
(fma (- 1.0 (cos (+ kx kx))) 0.5 (fma (cos (+ ky ky)) -0.5 0.5))))))
(if (<= t_3 0.001)
(*
(sin th)
(/
(fma ky (* (* ky ky) -0.16666666666666666) ky)
(sqrt (+ t_2 (* ky ky)))))
(if (<= t_3 0.995)
(*
(* (sin ky) th)
(sqrt (/ 1.0 (fma 0.5 (- 1.0 (cos (* kx -2.0))) t_1))))
(sin th)))))))
double code(double kx, double ky, double th) {
double t_1 = fma(-0.5, cos((ky * -2.0)), 0.5);
double t_2 = pow(sin(kx), 2.0);
double t_3 = sin(ky) / sqrt((t_2 + pow(sin(ky), 2.0)));
double tmp;
if (t_3 <= -0.9996) {
tmp = (sin(ky) * sin(th)) * sqrt((1.0 / t_1));
} else if (t_3 <= -0.2) {
tmp = fma(th, (-0.16666666666666666 * (th * th)), th) * (sin(ky) * sqrt((1.0 / fma((1.0 - cos((kx + kx))), 0.5, fma(cos((ky + ky)), -0.5, 0.5)))));
} else if (t_3 <= 0.001) {
tmp = sin(th) * (fma(ky, ((ky * ky) * -0.16666666666666666), ky) / sqrt((t_2 + (ky * ky))));
} else if (t_3 <= 0.995) {
tmp = (sin(ky) * th) * sqrt((1.0 / fma(0.5, (1.0 - cos((kx * -2.0))), t_1)));
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = fma(-0.5, cos(Float64(ky * -2.0)), 0.5) t_2 = sin(kx) ^ 2.0 t_3 = Float64(sin(ky) / sqrt(Float64(t_2 + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_3 <= -0.9996) tmp = Float64(Float64(sin(ky) * sin(th)) * sqrt(Float64(1.0 / t_1))); elseif (t_3 <= -0.2) tmp = Float64(fma(th, Float64(-0.16666666666666666 * Float64(th * th)), th) * Float64(sin(ky) * sqrt(Float64(1.0 / fma(Float64(1.0 - cos(Float64(kx + kx))), 0.5, fma(cos(Float64(ky + ky)), -0.5, 0.5)))))); elseif (t_3 <= 0.001) tmp = Float64(sin(th) * Float64(fma(ky, Float64(Float64(ky * ky) * -0.16666666666666666), ky) / sqrt(Float64(t_2 + Float64(ky * ky))))); elseif (t_3 <= 0.995) tmp = Float64(Float64(sin(ky) * th) * sqrt(Float64(1.0 / fma(0.5, Float64(1.0 - cos(Float64(kx * -2.0))), t_1)))); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $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]}, If[LessEqual[t$95$3, -0.9996], N[(N[(N[Sin[ky], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(1.0 / t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, -0.2], N[(N[(th * N[(-0.16666666666666666 * N[(th * th), $MachinePrecision]), $MachinePrecision] + th), $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] * N[Sqrt[N[(1.0 / N[(N[(1.0 - N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5 + N[(N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision] * -0.5 + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 0.001], N[(N[Sin[th], $MachinePrecision] * N[(N[(ky * N[(N[(ky * ky), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] + ky), $MachinePrecision] / N[Sqrt[N[(t$95$2 + N[(ky * ky), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 0.995], N[(N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(0.5 * N[(1.0 - N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), 0.5\right)\\
t_2 := {\sin kx}^{2}\\
t_3 := \frac{\sin ky}{\sqrt{t\_2 + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_3 \leq -0.9996:\\
\;\;\;\;\left(\sin ky \cdot \sin th\right) \cdot \sqrt{\frac{1}{t\_1}}\\
\mathbf{elif}\;t\_3 \leq -0.2:\\
\;\;\;\;\mathsf{fma}\left(th, -0.16666666666666666 \cdot \left(th \cdot th\right), th\right) \cdot \left(\sin ky \cdot \sqrt{\frac{1}{\mathsf{fma}\left(1 - \cos \left(kx + kx\right), 0.5, \mathsf{fma}\left(\cos \left(ky + ky\right), -0.5, 0.5\right)\right)}}\right)\\
\mathbf{elif}\;t\_3 \leq 0.001:\\
\;\;\;\;\sin th \cdot \frac{\mathsf{fma}\left(ky, \left(ky \cdot ky\right) \cdot -0.16666666666666666, ky\right)}{\sqrt{t\_2 + ky \cdot ky}}\\
\mathbf{elif}\;t\_3 \leq 0.995:\\
\;\;\;\;\left(\sin ky \cdot th\right) \cdot \sqrt{\frac{1}{\mathsf{fma}\left(0.5, 1 - \cos \left(kx \cdot -2\right), t\_1\right)}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.99960000000000004Initial program 90.2%
Applied rewrites55.2%
Taylor expanded in kx around 0
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6454.9
Applied rewrites54.9%
if -0.99960000000000004 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.20000000000000001Initial program 99.2%
Applied rewrites99.1%
Taylor expanded in th around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6445.6
Applied rewrites45.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
flip-+N/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
flip-+N/A
lift-+.f64N/A
lower-fma.f6410.1
lift-+.f64N/A
flip-+N/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
flip-+N/A
lift-+.f6445.6
Applied rewrites45.6%
if -0.20000000000000001 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 1e-3Initial program 99.5%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6498.7
Applied rewrites98.7%
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-*.f6498.6
Applied rewrites98.6%
if 1e-3 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.994999999999999996Initial program 99.6%
Applied rewrites99.1%
Taylor expanded in th around 0
lower-*.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
lower-fma.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
Applied rewrites75.7%
if 0.994999999999999996 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 90.1%
Taylor expanded in kx around 0
lower-sin.f6492.1
Applied rewrites92.1%
Final simplification82.1%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (fma -0.5 (cos (* ky -2.0)) 0.5))
(t_2
(*
(* (sin ky) th)
(sqrt (/ 1.0 (fma 0.5 (- 1.0 (cos (* kx -2.0))) t_1)))))
(t_3 (pow (sin kx) 2.0))
(t_4 (/ (sin ky) (sqrt (+ t_3 (pow (sin ky) 2.0))))))
(if (<= t_4 -0.9996)
(* (* (sin ky) (sin th)) (sqrt (/ 1.0 t_1)))
(if (<= t_4 -0.2)
t_2
(if (<= t_4 0.001)
(*
(sin th)
(/
(fma ky (* (* ky ky) -0.16666666666666666) ky)
(sqrt (+ t_3 (* ky ky)))))
(if (<= t_4 0.995) t_2 (sin th)))))))
double code(double kx, double ky, double th) {
double t_1 = fma(-0.5, cos((ky * -2.0)), 0.5);
double t_2 = (sin(ky) * th) * sqrt((1.0 / fma(0.5, (1.0 - cos((kx * -2.0))), t_1)));
double t_3 = pow(sin(kx), 2.0);
double t_4 = sin(ky) / sqrt((t_3 + pow(sin(ky), 2.0)));
double tmp;
if (t_4 <= -0.9996) {
tmp = (sin(ky) * sin(th)) * sqrt((1.0 / t_1));
} else if (t_4 <= -0.2) {
tmp = t_2;
} else if (t_4 <= 0.001) {
tmp = sin(th) * (fma(ky, ((ky * ky) * -0.16666666666666666), ky) / sqrt((t_3 + (ky * ky))));
} else if (t_4 <= 0.995) {
tmp = t_2;
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = fma(-0.5, cos(Float64(ky * -2.0)), 0.5) t_2 = Float64(Float64(sin(ky) * th) * sqrt(Float64(1.0 / fma(0.5, Float64(1.0 - cos(Float64(kx * -2.0))), t_1)))) t_3 = sin(kx) ^ 2.0 t_4 = Float64(sin(ky) / sqrt(Float64(t_3 + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_4 <= -0.9996) tmp = Float64(Float64(sin(ky) * sin(th)) * sqrt(Float64(1.0 / t_1))); elseif (t_4 <= -0.2) tmp = t_2; elseif (t_4 <= 0.001) tmp = Float64(sin(th) * Float64(fma(ky, Float64(Float64(ky * ky) * -0.16666666666666666), ky) / sqrt(Float64(t_3 + Float64(ky * ky))))); elseif (t_4 <= 0.995) tmp = t_2; else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(0.5 * N[(1.0 - N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$4 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$3 + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$4, -0.9996], N[(N[(N[Sin[ky], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(1.0 / t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, -0.2], t$95$2, If[LessEqual[t$95$4, 0.001], N[(N[Sin[th], $MachinePrecision] * N[(N[(ky * N[(N[(ky * ky), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] + ky), $MachinePrecision] / N[Sqrt[N[(t$95$3 + N[(ky * ky), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 0.995], t$95$2, N[Sin[th], $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), 0.5\right)\\
t_2 := \left(\sin ky \cdot th\right) \cdot \sqrt{\frac{1}{\mathsf{fma}\left(0.5, 1 - \cos \left(kx \cdot -2\right), t\_1\right)}}\\
t_3 := {\sin kx}^{2}\\
t_4 := \frac{\sin ky}{\sqrt{t\_3 + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_4 \leq -0.9996:\\
\;\;\;\;\left(\sin ky \cdot \sin th\right) \cdot \sqrt{\frac{1}{t\_1}}\\
\mathbf{elif}\;t\_4 \leq -0.2:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_4 \leq 0.001:\\
\;\;\;\;\sin th \cdot \frac{\mathsf{fma}\left(ky, \left(ky \cdot ky\right) \cdot -0.16666666666666666, ky\right)}{\sqrt{t\_3 + ky \cdot ky}}\\
\mathbf{elif}\;t\_4 \leq 0.995:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.99960000000000004Initial program 90.2%
Applied rewrites55.2%
Taylor expanded in kx around 0
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6454.9
Applied rewrites54.9%
if -0.99960000000000004 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.20000000000000001 or 1e-3 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.994999999999999996Initial program 99.4%
Applied rewrites99.1%
Taylor expanded in th around 0
lower-*.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
lower-fma.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
Applied rewrites58.8%
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))))) < 1e-3Initial program 99.5%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6498.7
Applied rewrites98.7%
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-*.f6498.6
Applied rewrites98.6%
if 0.994999999999999996 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 90.1%
Taylor expanded in kx around 0
lower-sin.f6492.1
Applied rewrites92.1%
Final simplification82.0%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (pow (sin ky) 2.0))
(t_2 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) t_1)))))
(if (<= t_2 -0.9)
(* (* (sin ky) th) (sqrt (/ 1.0 t_1)))
(if (<= t_2 2e-286)
(* (* (sin ky) (sin th)) (sqrt (/ 2.0 (- 1.0 (cos (* kx -2.0))))))
(if (<= t_2 4e-7) (* (sin th) (/ (sin ky) (sin kx))) (sin th))))))
double code(double kx, double ky, double th) {
double t_1 = pow(sin(ky), 2.0);
double t_2 = sin(ky) / sqrt((pow(sin(kx), 2.0) + t_1));
double tmp;
if (t_2 <= -0.9) {
tmp = (sin(ky) * th) * sqrt((1.0 / t_1));
} else if (t_2 <= 2e-286) {
tmp = (sin(ky) * sin(th)) * sqrt((2.0 / (1.0 - cos((kx * -2.0)))));
} else if (t_2 <= 4e-7) {
tmp = sin(th) * (sin(ky) / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sin(ky) ** 2.0d0
t_2 = sin(ky) / sqrt(((sin(kx) ** 2.0d0) + t_1))
if (t_2 <= (-0.9d0)) then
tmp = (sin(ky) * th) * sqrt((1.0d0 / t_1))
else if (t_2 <= 2d-286) then
tmp = (sin(ky) * sin(th)) * sqrt((2.0d0 / (1.0d0 - cos((kx * (-2.0d0))))))
else if (t_2 <= 4d-7) then
tmp = sin(th) * (sin(ky) / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double t_1 = Math.pow(Math.sin(ky), 2.0);
double t_2 = Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + t_1));
double tmp;
if (t_2 <= -0.9) {
tmp = (Math.sin(ky) * th) * Math.sqrt((1.0 / t_1));
} else if (t_2 <= 2e-286) {
tmp = (Math.sin(ky) * Math.sin(th)) * Math.sqrt((2.0 / (1.0 - Math.cos((kx * -2.0)))));
} else if (t_2 <= 4e-7) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.pow(math.sin(ky), 2.0) t_2 = math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + t_1)) tmp = 0 if t_2 <= -0.9: tmp = (math.sin(ky) * th) * math.sqrt((1.0 / t_1)) elif t_2 <= 2e-286: tmp = (math.sin(ky) * math.sin(th)) * math.sqrt((2.0 / (1.0 - math.cos((kx * -2.0))))) elif t_2 <= 4e-7: tmp = math.sin(th) * (math.sin(ky) / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = sin(ky) ^ 2.0 t_2 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + t_1))) tmp = 0.0 if (t_2 <= -0.9) tmp = Float64(Float64(sin(ky) * th) * sqrt(Float64(1.0 / t_1))); elseif (t_2 <= 2e-286) tmp = Float64(Float64(sin(ky) * sin(th)) * sqrt(Float64(2.0 / Float64(1.0 - cos(Float64(kx * -2.0)))))); elseif (t_2 <= 4e-7) tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = sin(ky) ^ 2.0; t_2 = sin(ky) / sqrt(((sin(kx) ^ 2.0) + t_1)); tmp = 0.0; if (t_2 <= -0.9) tmp = (sin(ky) * th) * sqrt((1.0 / t_1)); elseif (t_2 <= 2e-286) tmp = (sin(ky) * sin(th)) * sqrt((2.0 / (1.0 - cos((kx * -2.0))))); elseif (t_2 <= 4e-7) tmp = sin(th) * (sin(ky) / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -0.9], N[(N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision] * N[Sqrt[N[(1.0 / t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e-286], N[(N[(N[Sin[ky], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(2.0 / N[(1.0 - N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 4e-7], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := {\sin ky}^{2}\\
t_2 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + t\_1}}\\
\mathbf{if}\;t\_2 \leq -0.9:\\
\;\;\;\;\left(\sin ky \cdot th\right) \cdot \sqrt{\frac{1}{t\_1}}\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{-286}:\\
\;\;\;\;\left(\sin ky \cdot \sin th\right) \cdot \sqrt{\frac{2}{1 - \cos \left(kx \cdot -2\right)}}\\
\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{-7}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.900000000000000022Initial program 91.8%
Taylor expanded in th around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6449.1
Applied rewrites49.1%
Taylor expanded in kx around 0
Applied rewrites40.7%
if -0.900000000000000022 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2.0000000000000001e-286Initial program 99.4%
Applied rewrites81.8%
Taylor expanded in ky around 0
lower-/.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6459.1
Applied rewrites59.1%
if 2.0000000000000001e-286 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 3.9999999999999998e-7Initial program 99.6%
Taylor expanded in ky around 0
lower-sin.f6464.3
Applied rewrites64.3%
if 3.9999999999999998e-7 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 92.8%
Taylor expanded in kx around 0
lower-sin.f6471.4
Applied rewrites71.4%
Final simplification60.6%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (pow (sin kx) 2.0))
(t_2 (/ (sin ky) (sqrt (+ t_1 (pow (sin ky) 2.0))))))
(if (<= t_2 -0.2)
(* (* (sin ky) (sin th)) (sqrt (/ 1.0 (fma -0.5 (cos (* ky -2.0)) 0.5))))
(if (<= t_2 0.06)
(*
(sin th)
(/
(fma ky (* (* ky ky) -0.16666666666666666) ky)
(sqrt (+ t_1 (* ky ky)))))
(sin th)))))
double code(double kx, double ky, double th) {
double t_1 = pow(sin(kx), 2.0);
double t_2 = sin(ky) / sqrt((t_1 + pow(sin(ky), 2.0)));
double tmp;
if (t_2 <= -0.2) {
tmp = (sin(ky) * sin(th)) * sqrt((1.0 / fma(-0.5, cos((ky * -2.0)), 0.5)));
} else if (t_2 <= 0.06) {
tmp = sin(th) * (fma(ky, ((ky * ky) * -0.16666666666666666), ky) / sqrt((t_1 + (ky * ky))));
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = sin(kx) ^ 2.0 t_2 = Float64(sin(ky) / sqrt(Float64(t_1 + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_2 <= -0.2) tmp = Float64(Float64(sin(ky) * sin(th)) * sqrt(Float64(1.0 / fma(-0.5, cos(Float64(ky * -2.0)), 0.5)))); elseif (t_2 <= 0.06) tmp = Float64(sin(th) * Float64(fma(ky, Float64(Float64(ky * ky) * -0.16666666666666666), ky) / sqrt(Float64(t_1 + Float64(ky * ky))))); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$1 + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -0.2], N[(N[(N[Sin[ky], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.06], N[(N[Sin[th], $MachinePrecision] * N[(N[(ky * N[(N[(ky * ky), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] + ky), $MachinePrecision] / N[Sqrt[N[(t$95$1 + N[(ky * ky), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := {\sin kx}^{2}\\
t_2 := \frac{\sin ky}{\sqrt{t\_1 + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_2 \leq -0.2:\\
\;\;\;\;\left(\sin ky \cdot \sin th\right) \cdot \sqrt{\frac{1}{\mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), 0.5\right)}}\\
\mathbf{elif}\;t\_2 \leq 0.06:\\
\;\;\;\;\sin th \cdot \frac{\mathsf{fma}\left(ky, \left(ky \cdot ky\right) \cdot -0.16666666666666666, ky\right)}{\sqrt{t\_1 + ky \cdot ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.20000000000000001Initial program 94.0%
Applied rewrites73.7%
Taylor expanded in kx around 0
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6441.3
Applied rewrites41.3%
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.059999999999999998Initial program 99.6%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6497.8
Applied rewrites97.8%
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-*.f6497.7
Applied rewrites97.7%
if 0.059999999999999998 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 92.7%
Taylor expanded in kx around 0
lower-sin.f6472.1
Applied rewrites72.1%
Final simplification74.3%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
(if (<= t_1 -0.2)
(* (* (sin ky) (sin th)) (sqrt (/ 1.0 (fma -0.5 (cos (* ky -2.0)) 0.5))))
(if (<= t_1 4e-7) (* (sin ky) (/ (sin th) (sin kx))) (sin th)))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double tmp;
if (t_1 <= -0.2) {
tmp = (sin(ky) * sin(th)) * sqrt((1.0 / fma(-0.5, cos((ky * -2.0)), 0.5)));
} else if (t_1 <= 4e-7) {
tmp = sin(ky) * (sin(th) / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_1 <= -0.2) tmp = Float64(Float64(sin(ky) * sin(th)) * sqrt(Float64(1.0 / fma(-0.5, cos(Float64(ky * -2.0)), 0.5)))); elseif (t_1 <= 4e-7) tmp = Float64(sin(ky) * Float64(sin(th) / sin(kx))); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -0.2], N[(N[(N[Sin[ky], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 4e-7], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_1 \leq -0.2:\\
\;\;\;\;\left(\sin ky \cdot \sin th\right) \cdot \sqrt{\frac{1}{\mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), 0.5\right)}}\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{-7}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.20000000000000001Initial program 94.0%
Applied rewrites73.7%
Taylor expanded in kx around 0
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6441.3
Applied rewrites41.3%
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-7Initial program 99.5%
Taylor expanded in ky around 0
lower-sin.f6465.3
Applied rewrites65.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6465.3
Applied rewrites65.3%
if 3.9999999999999998e-7 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 92.8%
Taylor expanded in kx around 0
lower-sin.f6471.4
Applied rewrites71.4%
Final simplification60.8%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (pow (sin ky) 2.0))
(t_2 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) t_1)))))
(if (<= t_2 -0.9)
(* (* (sin ky) th) (sqrt (/ 1.0 t_1)))
(if (<= t_2 4e-7) (* (sin ky) (/ (sin th) (sin kx))) (sin th)))))
double code(double kx, double ky, double th) {
double t_1 = pow(sin(ky), 2.0);
double t_2 = sin(ky) / sqrt((pow(sin(kx), 2.0) + t_1));
double tmp;
if (t_2 <= -0.9) {
tmp = (sin(ky) * th) * sqrt((1.0 / t_1));
} else if (t_2 <= 4e-7) {
tmp = sin(ky) * (sin(th) / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sin(ky) ** 2.0d0
t_2 = sin(ky) / sqrt(((sin(kx) ** 2.0d0) + t_1))
if (t_2 <= (-0.9d0)) then
tmp = (sin(ky) * th) * sqrt((1.0d0 / t_1))
else if (t_2 <= 4d-7) then
tmp = sin(ky) * (sin(th) / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double t_1 = Math.pow(Math.sin(ky), 2.0);
double t_2 = Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + t_1));
double tmp;
if (t_2 <= -0.9) {
tmp = (Math.sin(ky) * th) * Math.sqrt((1.0 / t_1));
} else if (t_2 <= 4e-7) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.pow(math.sin(ky), 2.0) t_2 = math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + t_1)) tmp = 0 if t_2 <= -0.9: tmp = (math.sin(ky) * th) * math.sqrt((1.0 / t_1)) elif t_2 <= 4e-7: tmp = math.sin(ky) * (math.sin(th) / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = sin(ky) ^ 2.0 t_2 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + t_1))) tmp = 0.0 if (t_2 <= -0.9) tmp = Float64(Float64(sin(ky) * th) * sqrt(Float64(1.0 / t_1))); elseif (t_2 <= 4e-7) tmp = Float64(sin(ky) * Float64(sin(th) / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = sin(ky) ^ 2.0; t_2 = sin(ky) / sqrt(((sin(kx) ^ 2.0) + t_1)); tmp = 0.0; if (t_2 <= -0.9) tmp = (sin(ky) * th) * sqrt((1.0 / t_1)); elseif (t_2 <= 4e-7) tmp = sin(ky) * (sin(th) / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -0.9], N[(N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision] * N[Sqrt[N[(1.0 / t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 4e-7], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := {\sin ky}^{2}\\
t_2 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + t\_1}}\\
\mathbf{if}\;t\_2 \leq -0.9:\\
\;\;\;\;\left(\sin ky \cdot th\right) \cdot \sqrt{\frac{1}{t\_1}}\\
\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{-7}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.900000000000000022Initial program 91.8%
Taylor expanded in th around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6449.1
Applied rewrites49.1%
Taylor expanded in kx around 0
Applied rewrites40.7%
if -0.900000000000000022 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 3.9999999999999998e-7Initial program 99.5%
Taylor expanded in ky around 0
lower-sin.f6456.7
Applied rewrites56.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6456.7
Applied rewrites56.7%
if 3.9999999999999998e-7 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 92.8%
Taylor expanded in kx around 0
lower-sin.f6471.4
Applied rewrites71.4%
Final simplification58.4%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
(if (<= t_1 -0.9)
(*
(fma th (* -0.16666666666666666 (* th th)) th)
(* (sin ky) (sqrt (/ 1.0 (fma (cos (* ky -2.0)) -0.5 0.5)))))
(if (<= t_1 4e-7) (* (sin ky) (/ (sin th) (sin kx))) (sin th)))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double tmp;
if (t_1 <= -0.9) {
tmp = fma(th, (-0.16666666666666666 * (th * th)), th) * (sin(ky) * sqrt((1.0 / fma(cos((ky * -2.0)), -0.5, 0.5))));
} else if (t_1 <= 4e-7) {
tmp = sin(ky) * (sin(th) / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_1 <= -0.9) tmp = Float64(fma(th, Float64(-0.16666666666666666 * Float64(th * th)), th) * Float64(sin(ky) * sqrt(Float64(1.0 / fma(cos(Float64(ky * -2.0)), -0.5, 0.5))))); elseif (t_1 <= 4e-7) tmp = Float64(sin(ky) * Float64(sin(th) / sin(kx))); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -0.9], N[(N[(th * N[(-0.16666666666666666 * N[(th * th), $MachinePrecision]), $MachinePrecision] + th), $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] * N[Sqrt[N[(1.0 / N[(N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] * -0.5 + 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 4e-7], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_1 \leq -0.9:\\
\;\;\;\;\mathsf{fma}\left(th, -0.16666666666666666 \cdot \left(th \cdot th\right), th\right) \cdot \left(\sin ky \cdot \sqrt{\frac{1}{\mathsf{fma}\left(\cos \left(ky \cdot -2\right), -0.5, 0.5\right)}}\right)\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{-7}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.900000000000000022Initial program 91.8%
Applied rewrites63.3%
Taylor expanded in th around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6436.9
Applied rewrites36.9%
Taylor expanded in kx around 0
+-commutativeN/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-*.f6428.1
Applied rewrites28.1%
if -0.900000000000000022 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 3.9999999999999998e-7Initial program 99.5%
Taylor expanded in ky around 0
lower-sin.f6456.7
Applied rewrites56.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6456.7
Applied rewrites56.7%
if 3.9999999999999998e-7 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 92.8%
Taylor expanded in kx around 0
lower-sin.f6471.4
Applied rewrites71.4%
Final simplification56.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.3)
(*
(fma th (* -0.16666666666666666 (* th th)) th)
(* (sin ky) (sqrt (/ 1.0 (fma (cos (* ky -2.0)) -0.5 0.5)))))
(if (<= t_1 4e-7) (* (sin th) (/ ky (sin kx))) (sin th)))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double tmp;
if (t_1 <= -0.3) {
tmp = fma(th, (-0.16666666666666666 * (th * th)), th) * (sin(ky) * sqrt((1.0 / fma(cos((ky * -2.0)), -0.5, 0.5))));
} else if (t_1 <= 4e-7) {
tmp = sin(th) * (ky / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_1 <= -0.3) tmp = Float64(fma(th, Float64(-0.16666666666666666 * Float64(th * th)), th) * Float64(sin(ky) * sqrt(Float64(1.0 / fma(cos(Float64(ky * -2.0)), -0.5, 0.5))))); elseif (t_1 <= 4e-7) tmp = Float64(sin(th) * Float64(ky / sin(kx))); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -0.3], N[(N[(th * N[(-0.16666666666666666 * N[(th * th), $MachinePrecision]), $MachinePrecision] + th), $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] * N[Sqrt[N[(1.0 / N[(N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] * -0.5 + 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 4e-7], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_1 \leq -0.3:\\
\;\;\;\;\mathsf{fma}\left(th, -0.16666666666666666 \cdot \left(th \cdot th\right), th\right) \cdot \left(\sin ky \cdot \sqrt{\frac{1}{\mathsf{fma}\left(\cos \left(ky \cdot -2\right), -0.5, 0.5\right)}}\right)\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{-7}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.299999999999999989Initial program 93.8%
Applied rewrites72.9%
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-*.f6437.7
Applied rewrites37.7%
Taylor expanded in kx around 0
+-commutativeN/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-*.f6423.1
Applied rewrites23.1%
if -0.299999999999999989 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 3.9999999999999998e-7Initial program 99.5%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-sin.f6463.9
Applied rewrites63.9%
if 3.9999999999999998e-7 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 92.8%
Taylor expanded in kx around 0
lower-sin.f6471.4
Applied rewrites71.4%
Final simplification55.6%
(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.2)
(* (* (sin ky) th) (sqrt (/ 1.0 (- 1.0 (cos (* ky -2.0))))))
(if (<= t_1 4e-7) (* (sin th) (/ ky (sin kx))) (sin th)))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double tmp;
if (t_1 <= -0.2) {
tmp = (sin(ky) * th) * sqrt((1.0 / (1.0 - cos((ky * -2.0)))));
} else if (t_1 <= 4e-7) {
tmp = sin(th) * (ky / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: t_1
real(8) :: tmp
t_1 = sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))
if (t_1 <= (-0.2d0)) then
tmp = (sin(ky) * th) * sqrt((1.0d0 / (1.0d0 - cos((ky * (-2.0d0))))))
else if (t_1 <= 4d-7) then
tmp = sin(th) * (ky / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)));
double tmp;
if (t_1 <= -0.2) {
tmp = (Math.sin(ky) * th) * Math.sqrt((1.0 / (1.0 - Math.cos((ky * -2.0)))));
} else if (t_1 <= 4e-7) {
tmp = Math.sin(th) * (ky / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0))) tmp = 0 if t_1 <= -0.2: tmp = (math.sin(ky) * th) * math.sqrt((1.0 / (1.0 - math.cos((ky * -2.0))))) elif t_1 <= 4e-7: tmp = math.sin(th) * (ky / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_1 <= -0.2) tmp = Float64(Float64(sin(ky) * th) * sqrt(Float64(1.0 / Float64(1.0 - cos(Float64(ky * -2.0)))))); elseif (t_1 <= 4e-7) tmp = Float64(sin(th) * Float64(ky / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0))); tmp = 0.0; if (t_1 <= -0.2) tmp = (sin(ky) * th) * sqrt((1.0 / (1.0 - cos((ky * -2.0))))); elseif (t_1 <= 4e-7) tmp = sin(th) * (ky / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -0.2], N[(N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(1.0 - N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 4e-7], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_1 \leq -0.2:\\
\;\;\;\;\left(\sin ky \cdot th\right) \cdot \sqrt{\frac{1}{1 - \cos \left(ky \cdot -2\right)}}\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{-7}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.20000000000000001Initial program 94.0%
Taylor expanded in th around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6445.2
Applied rewrites45.2%
Applied rewrites9.6%
Taylor expanded in ky around inf
Applied rewrites9.5%
if -0.20000000000000001 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 3.9999999999999998e-7Initial program 99.5%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-sin.f6465.1
Applied rewrites65.1%
if 3.9999999999999998e-7 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 92.8%
Taylor expanded in kx around 0
lower-sin.f6471.4
Applied rewrites71.4%
Final simplification52.2%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 4e-7) (* (sin th) (/ ky (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) <= 4e-7) {
tmp = sin(th) * (ky / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if ((sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) <= 4d-7) then
tmp = sin(th) * (ky / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if ((Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) <= 4e-7) {
tmp = Math.sin(th) * (ky / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) <= 4e-7: tmp = math.sin(th) * (ky / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 4e-7) tmp = Float64(sin(th) * Float64(ky / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 4e-7) tmp = sin(th) * (ky / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 4e-7], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 4 \cdot 10^{-7}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 3.9999999999999998e-7Initial program 97.3%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-sin.f6440.9
Applied rewrites40.9%
if 3.9999999999999998e-7 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 92.8%
Taylor expanded in kx around 0
lower-sin.f6471.4
Applied rewrites71.4%
Final simplification50.8%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 4e-7) (/ (* ky (sin th)) (sin kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) <= 4e-7) {
tmp = (ky * sin(th)) / sin(kx);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if ((sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) <= 4d-7) then
tmp = (ky * sin(th)) / sin(kx)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if ((Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) <= 4e-7) {
tmp = (ky * Math.sin(th)) / Math.sin(kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) <= 4e-7: tmp = (ky * math.sin(th)) / math.sin(kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 4e-7) tmp = Float64(Float64(ky * sin(th)) / sin(kx)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 4e-7) tmp = (ky * sin(th)) / sin(kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 4e-7], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 4 \cdot 10^{-7}:\\
\;\;\;\;\frac{ky \cdot \sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 3.9999999999999998e-7Initial program 97.3%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f6440.0
Applied rewrites40.0%
if 3.9999999999999998e-7 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 92.8%
Taylor expanded in kx around 0
lower-sin.f6471.4
Applied rewrites71.4%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 2e-7) (* (sin th) (* (sqrt (/ 1.0 (* 2.0 (* kx kx)))) (* ky (sqrt 2.0)))) (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)))) <= 2e-7) {
tmp = sin(th) * (sqrt((1.0 / (2.0 * (kx * kx)))) * (ky * sqrt(2.0)));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if ((sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) <= 2d-7) then
tmp = sin(th) * (sqrt((1.0d0 / (2.0d0 * (kx * kx)))) * (ky * sqrt(2.0d0)))
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)))) <= 2e-7) {
tmp = Math.sin(th) * (Math.sqrt((1.0 / (2.0 * (kx * kx)))) * (ky * Math.sqrt(2.0)));
} 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)))) <= 2e-7: tmp = math.sin(th) * (math.sqrt((1.0 / (2.0 * (kx * kx)))) * (ky * math.sqrt(2.0))) 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)))) <= 2e-7) tmp = Float64(sin(th) * Float64(sqrt(Float64(1.0 / Float64(2.0 * Float64(kx * kx)))) * Float64(ky * sqrt(2.0)))); 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)))) <= 2e-7) tmp = sin(th) * (sqrt((1.0 / (2.0 * (kx * kx)))) * (ky * sqrt(2.0))); 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], 2e-7], N[(N[Sin[th], $MachinePrecision] * N[(N[Sqrt[N[(1.0 / N[(2.0 * N[(kx * kx), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(ky * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 2 \cdot 10^{-7}:\\
\;\;\;\;\sin th \cdot \left(\sqrt{\frac{1}{2 \cdot \left(kx \cdot kx\right)}} \cdot \left(ky \cdot \sqrt{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 1.9999999999999999e-7Initial program 97.3%
Applied rewrites74.8%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f6445.3
Applied rewrites45.3%
Taylor expanded in kx around 0
Applied rewrites29.0%
if 1.9999999999999999e-7 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 92.8%
Taylor expanded in kx around 0
lower-sin.f6471.4
Applied rewrites71.4%
Final simplification42.8%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 2e-7) (* (sin th) (* (* ky (sqrt 2.0)) (/ (sqrt 0.5) kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) <= 2e-7) {
tmp = sin(th) * ((ky * sqrt(2.0)) * (sqrt(0.5) / kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if ((sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) <= 2d-7) then
tmp = sin(th) * ((ky * sqrt(2.0d0)) * (sqrt(0.5d0) / kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if ((Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) <= 2e-7) {
tmp = Math.sin(th) * ((ky * Math.sqrt(2.0)) * (Math.sqrt(0.5) / kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) <= 2e-7: tmp = math.sin(th) * ((ky * math.sqrt(2.0)) * (math.sqrt(0.5) / kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 2e-7) tmp = Float64(sin(th) * Float64(Float64(ky * sqrt(2.0)) * Float64(sqrt(0.5) / kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 2e-7) tmp = sin(th) * ((ky * sqrt(2.0)) * (sqrt(0.5) / kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2e-7], N[(N[Sin[th], $MachinePrecision] * N[(N[(ky * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[0.5], $MachinePrecision] / kx), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 2 \cdot 10^{-7}:\\
\;\;\;\;\sin th \cdot \left(\left(ky \cdot \sqrt{2}\right) \cdot \frac{\sqrt{0.5}}{kx}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 1.9999999999999999e-7Initial program 97.3%
Applied rewrites74.8%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f6445.3
Applied rewrites45.3%
Taylor expanded in kx around 0
Applied rewrites26.1%
if 1.9999999999999999e-7 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 92.8%
Taylor expanded in kx around 0
lower-sin.f6471.4
Applied rewrites71.4%
Final simplification40.8%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 2e-7) (* (sin th) (* (* (sqrt 2.0) (sqrt 0.5)) (/ ky kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) <= 2e-7) {
tmp = sin(th) * ((sqrt(2.0) * sqrt(0.5)) * (ky / kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if ((sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) <= 2d-7) then
tmp = sin(th) * ((sqrt(2.0d0) * sqrt(0.5d0)) * (ky / kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if ((Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) <= 2e-7) {
tmp = Math.sin(th) * ((Math.sqrt(2.0) * Math.sqrt(0.5)) * (ky / kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) <= 2e-7: tmp = math.sin(th) * ((math.sqrt(2.0) * math.sqrt(0.5)) * (ky / kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 2e-7) tmp = Float64(sin(th) * Float64(Float64(sqrt(2.0) * sqrt(0.5)) * Float64(ky / kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 2e-7) tmp = sin(th) * ((sqrt(2.0) * sqrt(0.5)) * (ky / kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2e-7], N[(N[Sin[th], $MachinePrecision] * N[(N[(N[Sqrt[2.0], $MachinePrecision] * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision] * N[(ky / kx), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 2 \cdot 10^{-7}:\\
\;\;\;\;\sin th \cdot \left(\left(\sqrt{2} \cdot \sqrt{0.5}\right) \cdot \frac{ky}{kx}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 1.9999999999999999e-7Initial program 97.3%
Applied rewrites74.8%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f6445.3
Applied rewrites45.3%
Taylor expanded in kx around 0
Applied rewrites26.1%
if 1.9999999999999999e-7 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 92.8%
Taylor expanded in kx around 0
lower-sin.f6471.4
Applied rewrites71.4%
Final simplification40.8%
(FPCore (kx ky th)
:precision binary64
(if (<=
(*
(sin th)
(/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))))
1e-308)
(* -0.16666666666666666 (* th (* th th)))
(fma
th
(* (* th th) (fma 0.008333333333333333 (* th th) -0.16666666666666666))
th)))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(th) * (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0))))) <= 1e-308) {
tmp = -0.16666666666666666 * (th * (th * th));
} else {
tmp = fma(th, ((th * th) * fma(0.008333333333333333, (th * th), -0.16666666666666666)), th);
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(th) * Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0))))) <= 1e-308) tmp = Float64(-0.16666666666666666 * Float64(th * Float64(th * th))); else tmp = fma(th, Float64(Float64(th * th) * fma(0.008333333333333333, Float64(th * th), -0.16666666666666666)), th); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1e-308], N[(-0.16666666666666666 * N[(th * N[(th * th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(th * N[(N[(th * th), $MachinePrecision] * N[(0.008333333333333333 * N[(th * th), $MachinePrecision] + -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + th), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin th \cdot \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 10^{-308}:\\
\;\;\;\;-0.16666666666666666 \cdot \left(th \cdot \left(th \cdot th\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(th, \left(th \cdot th\right) \cdot \mathsf{fma}\left(0.008333333333333333, th \cdot th, -0.16666666666666666\right), th\right)\\
\end{array}
\end{array}
if (*.f64 (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) (sin.f64 th)) < 9.9999999999999991e-309Initial program 96.5%
Taylor expanded in kx around 0
lower-sin.f6424.3
Applied rewrites24.3%
Taylor expanded in th around 0
Applied rewrites16.4%
Taylor expanded in th around inf
Applied rewrites19.1%
if 9.9999999999999991e-309 < (*.f64 (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) (sin.f64 th)) Initial program 95.0%
Taylor expanded in kx around 0
lower-sin.f6428.1
Applied rewrites28.1%
Taylor expanded in th around 0
Applied rewrites14.1%
Final simplification17.0%
(FPCore (kx ky th)
:precision binary64
(if (<=
(*
(sin th)
(/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))))
1e-308)
(* -0.16666666666666666 (* th (* th th)))
(fma th (* -0.16666666666666666 (* th th)) th)))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(th) * (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0))))) <= 1e-308) {
tmp = -0.16666666666666666 * (th * (th * th));
} else {
tmp = fma(th, (-0.16666666666666666 * (th * th)), th);
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(th) * Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0))))) <= 1e-308) tmp = Float64(-0.16666666666666666 * Float64(th * Float64(th * th))); else tmp = fma(th, Float64(-0.16666666666666666 * Float64(th * th)), th); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1e-308], N[(-0.16666666666666666 * N[(th * N[(th * th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(th * N[(-0.16666666666666666 * N[(th * th), $MachinePrecision]), $MachinePrecision] + th), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin th \cdot \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 10^{-308}:\\
\;\;\;\;-0.16666666666666666 \cdot \left(th \cdot \left(th \cdot th\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(th, -0.16666666666666666 \cdot \left(th \cdot th\right), th\right)\\
\end{array}
\end{array}
if (*.f64 (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) (sin.f64 th)) < 9.9999999999999991e-309Initial program 96.5%
Taylor expanded in kx around 0
lower-sin.f6424.3
Applied rewrites24.3%
Taylor expanded in th around 0
Applied rewrites16.4%
Taylor expanded in th around inf
Applied rewrites19.1%
if 9.9999999999999991e-309 < (*.f64 (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) (sin.f64 th)) Initial program 95.0%
Taylor expanded in kx around 0
lower-sin.f6428.1
Applied rewrites28.1%
Taylor expanded in th around 0
Applied rewrites14.0%
Final simplification17.0%
(FPCore (kx ky th)
:precision binary64
(if (<=
(*
(sin th)
(/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))))
1e-308)
(* -0.16666666666666666 (* th (* th th)))
(* th (sqrt 0.5))))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(th) * (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0))))) <= 1e-308) {
tmp = -0.16666666666666666 * (th * (th * th));
} else {
tmp = th * sqrt(0.5);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if ((sin(th) * (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0))))) <= 1d-308) then
tmp = (-0.16666666666666666d0) * (th * (th * th))
else
tmp = th * sqrt(0.5d0)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if ((Math.sin(th) * (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0))))) <= 1e-308) {
tmp = -0.16666666666666666 * (th * (th * th));
} else {
tmp = th * Math.sqrt(0.5);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (math.sin(th) * (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0))))) <= 1e-308: tmp = -0.16666666666666666 * (th * (th * th)) else: tmp = th * math.sqrt(0.5) return tmp
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(th) * Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0))))) <= 1e-308) tmp = Float64(-0.16666666666666666 * Float64(th * Float64(th * th))); else tmp = Float64(th * sqrt(0.5)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((sin(th) * (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0))))) <= 1e-308) tmp = -0.16666666666666666 * (th * (th * th)); else tmp = th * sqrt(0.5); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1e-308], N[(-0.16666666666666666 * N[(th * N[(th * th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(th * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin th \cdot \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 10^{-308}:\\
\;\;\;\;-0.16666666666666666 \cdot \left(th \cdot \left(th \cdot th\right)\right)\\
\mathbf{else}:\\
\;\;\;\;th \cdot \sqrt{0.5}\\
\end{array}
\end{array}
if (*.f64 (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) (sin.f64 th)) < 9.9999999999999991e-309Initial program 96.5%
Taylor expanded in kx around 0
lower-sin.f6424.3
Applied rewrites24.3%
Taylor expanded in th around 0
Applied rewrites16.4%
Taylor expanded in th around inf
Applied rewrites19.1%
if 9.9999999999999991e-309 < (*.f64 (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) (sin.f64 th)) Initial program 95.0%
Taylor expanded in th around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6437.9
Applied rewrites37.9%
Applied rewrites6.7%
Taylor expanded in ky around 0
Applied rewrites7.0%
Final simplification14.1%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 4e-7) (* ky (/ th (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) <= 4e-7) {
tmp = ky * (th / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if ((sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) <= 4d-7) then
tmp = ky * (th / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if ((Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) <= 4e-7) {
tmp = ky * (th / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) <= 4e-7: tmp = ky * (th / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 4e-7) tmp = Float64(ky * Float64(th / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 4e-7) tmp = ky * (th / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 4e-7], N[(ky * N[(th / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 4 \cdot 10^{-7}:\\
\;\;\;\;ky \cdot \frac{th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 3.9999999999999998e-7Initial program 97.3%
Taylor expanded in th around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6447.2
Applied rewrites47.2%
Taylor expanded in ky around 0
Applied rewrites26.8%
if 3.9999999999999998e-7 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 92.8%
Taylor expanded in kx around 0
lower-sin.f6471.4
Applied rewrites71.4%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (sqrt (/ 1.0 kx))) (t_2 (* th (sqrt 0.5))))
(if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 1e-24)
(* ky (fma -0.16666666666666666 (* t_1 (* (* ky ky) t_2)) (* t_1 t_2)))
(sin th))))
double code(double kx, double ky, double th) {
double t_1 = sqrt((1.0 / kx));
double t_2 = th * sqrt(0.5);
double tmp;
if ((sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) <= 1e-24) {
tmp = ky * fma(-0.16666666666666666, (t_1 * ((ky * ky) * t_2)), (t_1 * t_2));
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = sqrt(Float64(1.0 / kx)) t_2 = Float64(th * sqrt(0.5)) tmp = 0.0 if (Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 1e-24) tmp = Float64(ky * fma(-0.16666666666666666, Float64(t_1 * Float64(Float64(ky * ky) * t_2)), Float64(t_1 * t_2))); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sqrt[N[(1.0 / kx), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(th * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 1e-24], N[(ky * N[(-0.16666666666666666 * N[(t$95$1 * N[(N[(ky * ky), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{\frac{1}{kx}}\\
t_2 := th \cdot \sqrt{0.5}\\
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 10^{-24}:\\
\;\;\;\;ky \cdot \mathsf{fma}\left(-0.16666666666666666, t\_1 \cdot \left(\left(ky \cdot ky\right) \cdot t\_2\right), t\_1 \cdot t\_2\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))))) < 9.99999999999999924e-25Initial program 97.3%
Taylor expanded in th around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6447.4
Applied rewrites47.4%
Applied rewrites5.1%
Applied rewrites13.3%
Taylor expanded in ky around 0
Applied rewrites12.7%
if 9.99999999999999924e-25 < (/.f64 (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.f6469.3
Applied rewrites69.3%
(FPCore (kx ky th)
:precision binary64
(if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 1e-24)
(*
(fma ky (* (* ky ky) -0.16666666666666666) ky)
(* th (sqrt (/ 1.0 (+ kx kx)))))
(sin th)))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) <= 1e-24) {
tmp = fma(ky, ((ky * ky) * -0.16666666666666666), ky) * (th * sqrt((1.0 / (kx + kx))));
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 1e-24) tmp = Float64(fma(ky, Float64(Float64(ky * ky) * -0.16666666666666666), ky) * Float64(th * sqrt(Float64(1.0 / Float64(kx + kx))))); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 1e-24], N[(N[(ky * N[(N[(ky * ky), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] + ky), $MachinePrecision] * N[(th * N[Sqrt[N[(1.0 / N[(kx + kx), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 10^{-24}:\\
\;\;\;\;\mathsf{fma}\left(ky, \left(ky \cdot ky\right) \cdot -0.16666666666666666, ky\right) \cdot \left(th \cdot \sqrt{\frac{1}{kx + kx}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 9.99999999999999924e-25Initial program 97.3%
Taylor expanded in th around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6447.4
Applied rewrites47.4%
Applied rewrites5.1%
Applied rewrites13.3%
Taylor expanded in ky around 0
Applied rewrites12.7%
if 9.99999999999999924e-25 < (/.f64 (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.f6469.3
Applied rewrites69.3%
Final simplification31.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 2e-7)
(*
(fma ky (* (* ky ky) -0.16666666666666666) ky)
(* th (sqrt (/ 1.0 (+ kx kx)))))
(fma
th
(* (* th th) (fma 0.008333333333333333 (* th th) -0.16666666666666666))
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)))) <= 2e-7) {
tmp = fma(ky, ((ky * ky) * -0.16666666666666666), ky) * (th * sqrt((1.0 / (kx + kx))));
} else {
tmp = fma(th, ((th * th) * fma(0.008333333333333333, (th * th), -0.16666666666666666)), th);
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 2e-7) tmp = Float64(fma(ky, Float64(Float64(ky * ky) * -0.16666666666666666), ky) * Float64(th * sqrt(Float64(1.0 / Float64(kx + kx))))); else tmp = fma(th, Float64(Float64(th * th) * fma(0.008333333333333333, Float64(th * th), -0.16666666666666666)), th); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[N[(N[Sin[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], 2e-7], N[(N[(ky * N[(N[(ky * ky), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] + ky), $MachinePrecision] * N[(th * N[Sqrt[N[(1.0 / N[(kx + kx), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(th * N[(N[(th * th), $MachinePrecision] * N[(0.008333333333333333 * N[(th * th), $MachinePrecision] + -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + th), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 2 \cdot 10^{-7}:\\
\;\;\;\;\mathsf{fma}\left(ky, \left(ky \cdot ky\right) \cdot -0.16666666666666666, ky\right) \cdot \left(th \cdot \sqrt{\frac{1}{kx + kx}}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(th, \left(th \cdot th\right) \cdot \mathsf{fma}\left(0.008333333333333333, th \cdot th, -0.16666666666666666\right), th\right)\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 1.9999999999999999e-7Initial program 97.3%
Taylor expanded in th around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6447.2
Applied rewrites47.2%
Applied rewrites5.0%
Applied rewrites13.2%
Taylor expanded in ky around 0
Applied rewrites12.6%
if 1.9999999999999999e-7 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 92.8%
Taylor expanded in kx around 0
lower-sin.f6471.4
Applied rewrites71.4%
Taylor expanded in th around 0
Applied rewrites39.8%
Final simplification21.4%
(FPCore (kx ky th)
:precision binary64
(if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 2e-7)
(* (sqrt (/ 1.0 kx)) (* ky (* th (sqrt 0.5))))
(fma
th
(* (* th th) (fma 0.008333333333333333 (* th th) -0.16666666666666666))
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)))) <= 2e-7) {
tmp = sqrt((1.0 / kx)) * (ky * (th * sqrt(0.5)));
} else {
tmp = fma(th, ((th * th) * fma(0.008333333333333333, (th * th), -0.16666666666666666)), th);
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 2e-7) tmp = Float64(sqrt(Float64(1.0 / kx)) * Float64(ky * Float64(th * sqrt(0.5)))); else tmp = fma(th, Float64(Float64(th * th) * fma(0.008333333333333333, Float64(th * th), -0.16666666666666666)), th); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[N[(N[Sin[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], 2e-7], N[(N[Sqrt[N[(1.0 / kx), $MachinePrecision]], $MachinePrecision] * N[(ky * N[(th * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(th * N[(N[(th * th), $MachinePrecision] * N[(0.008333333333333333 * N[(th * th), $MachinePrecision] + -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + th), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 2 \cdot 10^{-7}:\\
\;\;\;\;\sqrt{\frac{1}{kx}} \cdot \left(ky \cdot \left(th \cdot \sqrt{0.5}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(th, \left(th \cdot th\right) \cdot \mathsf{fma}\left(0.008333333333333333, th \cdot th, -0.16666666666666666\right), th\right)\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 1.9999999999999999e-7Initial program 97.3%
Taylor expanded in th around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6447.2
Applied rewrites47.2%
Applied rewrites5.0%
Applied rewrites13.2%
Taylor expanded in ky around 0
Applied rewrites12.7%
if 1.9999999999999999e-7 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 92.8%
Taylor expanded in kx around 0
lower-sin.f6471.4
Applied rewrites71.4%
Taylor expanded in th around 0
Applied rewrites39.8%
(FPCore (kx ky th)
:precision binary64
(if (<= ky 0.0034)
(*
(sin th)
(/
(sin ky)
(hypot (fma ky (* (* ky ky) -0.16666666666666666) ky) (sin kx))))
(/
(* (sin ky) (sin th))
(sqrt
(fma (- 1.0 (cos (+ kx kx))) 0.5 (+ 0.5 (* -0.5 (cos (+ ky ky)))))))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 0.0034) {
tmp = sin(th) * (sin(ky) / hypot(fma(ky, ((ky * ky) * -0.16666666666666666), ky), sin(kx)));
} else {
tmp = (sin(ky) * sin(th)) / sqrt(fma((1.0 - cos((kx + kx))), 0.5, (0.5 + (-0.5 * cos((ky + ky))))));
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (ky <= 0.0034) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(fma(ky, Float64(Float64(ky * ky) * -0.16666666666666666), ky), sin(kx)))); else tmp = Float64(Float64(sin(ky) * sin(th)) / sqrt(fma(Float64(1.0 - cos(Float64(kx + kx))), 0.5, Float64(0.5 + Float64(-0.5 * cos(Float64(ky + ky))))))); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[ky, 0.0034], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(ky * N[(N[(ky * ky), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] + ky), $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sin[ky], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $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]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 0.0034:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\mathsf{fma}\left(ky, \left(ky \cdot ky\right) \cdot -0.16666666666666666, ky\right), \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky \cdot \sin th}{\sqrt{\mathsf{fma}\left(1 - \cos \left(kx + kx\right), 0.5, 0.5 + -0.5 \cdot \cos \left(ky + ky\right)\right)}}\\
\end{array}
\end{array}
if ky < 0.00339999999999999981Initial program 94.7%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6499.7
Applied rewrites99.7%
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-*.f6472.2
Applied rewrites72.2%
if 0.00339999999999999981 < ky Initial program 99.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6499.7
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 rewrites99.1%
Final simplification78.5%
(FPCore (kx ky th)
:precision binary64
(if (<= ky 0.0034)
(*
(sin th)
(/
(sin ky)
(hypot (fma ky (* (* ky ky) -0.16666666666666666) ky) (sin kx))))
(*
(sin th)
(/
(sin ky)
(sqrt
(fma (- 1.0 (cos (+ kx kx))) 0.5 (+ 0.5 (* -0.5 (cos (+ ky ky))))))))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 0.0034) {
tmp = sin(th) * (sin(ky) / hypot(fma(ky, ((ky * ky) * -0.16666666666666666), ky), sin(kx)));
} else {
tmp = sin(th) * (sin(ky) / sqrt(fma((1.0 - cos((kx + kx))), 0.5, (0.5 + (-0.5 * cos((ky + ky)))))));
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (ky <= 0.0034) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(fma(ky, Float64(Float64(ky * ky) * -0.16666666666666666), ky), sin(kx)))); else tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(fma(Float64(1.0 - cos(Float64(kx + kx))), 0.5, Float64(0.5 + Float64(-0.5 * cos(Float64(ky + ky)))))))); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[ky, 0.0034], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(ky * N[(N[(ky * ky), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] + ky), $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[(1.0 - N[Cos[N[(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}\;ky \leq 0.0034:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\mathsf{fma}\left(ky, \left(ky \cdot ky\right) \cdot -0.16666666666666666, ky\right), \sin kx\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 ky < 0.00339999999999999981Initial program 94.7%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6499.7
Applied rewrites99.7%
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-*.f6472.2
Applied rewrites72.2%
if 0.00339999999999999981 < ky Initial program 99.7%
lift-+.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
count-2N/A
cos-diffN/A
cos-sin-sumN/A
lower--.f64N/A
count-2N/A
lower-cos.f64N/A
lower-+.f6499.6
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sqr-sin-aN/A
cancel-sign-sub-invN/A
Applied rewrites99.1%
Final simplification78.5%
(FPCore (kx ky th)
:precision binary64
(if (<= ky 4.6e-155)
(* (sin th) (/ ky (sin kx)))
(if (<= ky 0.00058)
(*
(sin th)
(* (sin ky) (sqrt (/ 1.0 (fma (- 1.0 (cos (+ kx kx))) 0.5 (* ky ky))))))
(*
(sin th)
(* (sin ky) (sqrt (/ 1.0 (fma -0.5 (cos (* ky -2.0)) 0.5))))))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 4.6e-155) {
tmp = sin(th) * (ky / sin(kx));
} else if (ky <= 0.00058) {
tmp = sin(th) * (sin(ky) * sqrt((1.0 / fma((1.0 - cos((kx + kx))), 0.5, (ky * ky)))));
} else {
tmp = sin(th) * (sin(ky) * sqrt((1.0 / fma(-0.5, cos((ky * -2.0)), 0.5))));
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (ky <= 4.6e-155) tmp = Float64(sin(th) * Float64(ky / sin(kx))); elseif (ky <= 0.00058) tmp = Float64(sin(th) * Float64(sin(ky) * sqrt(Float64(1.0 / fma(Float64(1.0 - cos(Float64(kx + kx))), 0.5, Float64(ky * ky)))))); else tmp = Float64(sin(th) * Float64(sin(ky) * sqrt(Float64(1.0 / fma(-0.5, cos(Float64(ky * -2.0)), 0.5))))); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[ky, 4.6e-155], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[ky, 0.00058], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] * N[Sqrt[N[(1.0 / N[(N[(1.0 - N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5 + N[(ky * ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] * N[Sqrt[N[(1.0 / N[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 4.6 \cdot 10^{-155}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{elif}\;ky \leq 0.00058:\\
\;\;\;\;\sin th \cdot \left(\sin ky \cdot \sqrt{\frac{1}{\mathsf{fma}\left(1 - \cos \left(kx + kx\right), 0.5, ky \cdot ky\right)}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \left(\sin ky \cdot \sqrt{\frac{1}{\mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), 0.5\right)}}\right)\\
\end{array}
\end{array}
if ky < 4.60000000000000011e-155Initial program 93.6%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-sin.f6437.0
Applied rewrites37.0%
if 4.60000000000000011e-155 < ky < 5.8e-4Initial program 99.6%
Applied rewrites52.2%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6486.3
Applied rewrites86.3%
if 5.8e-4 < ky Initial program 99.7%
Applied rewrites98.5%
Taylor expanded in kx around 0
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6465.9
Applied rewrites65.9%
Final simplification50.7%
(FPCore (kx ky th) :precision binary64 (* -0.16666666666666666 (* th (* th th))))
double code(double kx, double ky, double th) {
return -0.16666666666666666 * (th * (th * th));
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (-0.16666666666666666d0) * (th * (th * th))
end function
public static double code(double kx, double ky, double th) {
return -0.16666666666666666 * (th * (th * th));
}
def code(kx, ky, th): return -0.16666666666666666 * (th * (th * th))
function code(kx, ky, th) return Float64(-0.16666666666666666 * Float64(th * Float64(th * th))) end
function tmp = code(kx, ky, th) tmp = -0.16666666666666666 * (th * (th * th)); end
code[kx_, ky_, th_] := N[(-0.16666666666666666 * N[(th * N[(th * th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-0.16666666666666666 \cdot \left(th \cdot \left(th \cdot th\right)\right)
\end{array}
Initial program 95.9%
Taylor expanded in kx around 0
lower-sin.f6425.9
Applied rewrites25.9%
Taylor expanded in th around 0
Applied rewrites15.4%
Taylor expanded in th around inf
Applied rewrites13.1%
herbie shell --seed 2024232
(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)))