
(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 23 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 th) (/ (sin ky) (hypot (sin ky) (sin kx)))))
double code(double kx, double ky, double th) {
return sin(th) * (sin(ky) / hypot(sin(ky), sin(kx)));
}
public static double code(double kx, double ky, double th) {
return Math.sin(th) * (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx)));
}
def code(kx, ky, th): return math.sin(th) * (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx)))
function code(kx, ky, th) return Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), sin(kx)))) end
function tmp = code(kx, ky, th) tmp = sin(th) * (sin(ky) / hypot(sin(ky), sin(kx))); end
code[kx_, ky_, th_] := N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}
\end{array}
Initial program 92.8%
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%
Final simplification99.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (pow (sin ky) 2.0))
(t_2 (/ (sin ky) (sqrt (+ t_1 (pow (sin kx) 2.0)))))
(t_3 (hypot (sin kx) (sin ky))))
(if (<= t_2 -1.0)
(* (/ (sin ky) (sqrt (+ (* kx kx) t_1))) (sin th))
(if (<= t_2 -0.04)
(* (/ th t_3) (sin ky))
(if (<= t_2 0.4)
(* (/ (sin th) (sqrt (fma (sin kx) (sin kx) (* ky ky)))) (sin ky))
(if (<= t_2 0.965)
(* (/ (sin ky) t_3) th)
(if (<= t_2 1.0)
(sin th)
(*
(/
1.0
(/
(hypot (sin ky) (sin kx))
(* (fma (* ky ky) -0.16666666666666666 1.0) ky)))
(sin th)))))))))
double code(double kx, double ky, double th) {
double t_1 = pow(sin(ky), 2.0);
double t_2 = sin(ky) / sqrt((t_1 + pow(sin(kx), 2.0)));
double t_3 = hypot(sin(kx), sin(ky));
double tmp;
if (t_2 <= -1.0) {
tmp = (sin(ky) / sqrt(((kx * kx) + t_1))) * sin(th);
} else if (t_2 <= -0.04) {
tmp = (th / t_3) * sin(ky);
} else if (t_2 <= 0.4) {
tmp = (sin(th) / sqrt(fma(sin(kx), sin(kx), (ky * ky)))) * sin(ky);
} else if (t_2 <= 0.965) {
tmp = (sin(ky) / t_3) * th;
} else if (t_2 <= 1.0) {
tmp = sin(th);
} else {
tmp = (1.0 / (hypot(sin(ky), sin(kx)) / (fma((ky * ky), -0.16666666666666666, 1.0) * ky))) * sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = sin(ky) ^ 2.0 t_2 = Float64(sin(ky) / sqrt(Float64(t_1 + (sin(kx) ^ 2.0)))) t_3 = hypot(sin(kx), sin(ky)) tmp = 0.0 if (t_2 <= -1.0) tmp = Float64(Float64(sin(ky) / sqrt(Float64(Float64(kx * kx) + t_1))) * sin(th)); elseif (t_2 <= -0.04) tmp = Float64(Float64(th / t_3) * sin(ky)); elseif (t_2 <= 0.4) tmp = Float64(Float64(sin(th) / sqrt(fma(sin(kx), sin(kx), Float64(ky * ky)))) * sin(ky)); elseif (t_2 <= 0.965) tmp = Float64(Float64(sin(ky) / t_3) * th); elseif (t_2 <= 1.0) tmp = sin(th); else tmp = Float64(Float64(1.0 / Float64(hypot(sin(ky), sin(kx)) / Float64(fma(Float64(ky * ky), -0.16666666666666666, 1.0) * ky))) * sin(th)); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$1 + N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[t$95$2, -1.0], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[(kx * kx), $MachinePrecision] + t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -0.04], N[(N[(th / t$95$3), $MachinePrecision] * N[Sin[ky], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.4], N[(N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[(N[Sin[kx], $MachinePrecision] * N[Sin[kx], $MachinePrecision] + N[(ky * ky), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[ky], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.965], N[(N[(N[Sin[ky], $MachinePrecision] / t$95$3), $MachinePrecision] * th), $MachinePrecision], If[LessEqual[t$95$2, 1.0], N[Sin[th], $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[(N[(N[(ky * ky), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := {\sin ky}^{2}\\
t_2 := \frac{\sin ky}{\sqrt{t\_1 + {\sin kx}^{2}}}\\
t_3 := \mathsf{hypot}\left(\sin kx, \sin ky\right)\\
\mathbf{if}\;t\_2 \leq -1:\\
\;\;\;\;\frac{\sin ky}{\sqrt{kx \cdot kx + t\_1}} \cdot \sin th\\
\mathbf{elif}\;t\_2 \leq -0.04:\\
\;\;\;\;\frac{th}{t\_3} \cdot \sin ky\\
\mathbf{elif}\;t\_2 \leq 0.4:\\
\;\;\;\;\frac{\sin th}{\sqrt{\mathsf{fma}\left(\sin kx, \sin kx, ky \cdot ky\right)}} \cdot \sin ky\\
\mathbf{elif}\;t\_2 \leq 0.965:\\
\;\;\;\;\frac{\sin ky}{t\_3} \cdot th\\
\mathbf{elif}\;t\_2 \leq 1:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{\mathsf{fma}\left(ky \cdot ky, -0.16666666666666666, 1\right) \cdot ky}} \cdot \sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -1Initial program 82.0%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6482.0
Applied rewrites82.0%
if -1 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.0400000000000000008Initial program 97.4%
Taylor expanded in th around 0
lower-*.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
unpow2N/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-pow.f64N/A
lower-sin.f6438.6
Applied rewrites38.6%
Applied rewrites38.7%
if -0.0400000000000000008 < (/.f64 (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.40000000000000002Initial program 99.6%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6496.3
Applied rewrites96.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6496.4
lift-+.f64N/A
lift-pow.f64N/A
pow2N/A
lower-fma.f6496.4
Applied rewrites96.4%
if 0.40000000000000002 < (/.f64 (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.964999999999999969Initial program 99.2%
Taylor expanded in th around 0
lower-*.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
unpow2N/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-pow.f64N/A
lower-sin.f6443.8
Applied rewrites43.8%
Applied rewrites43.9%
if 0.964999999999999969 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 1Initial program 99.9%
Taylor expanded in kx around 0
lower-sin.f6492.8
Applied rewrites92.8%
if 1 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 2.2%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f642.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 ky around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6499.3
Applied rewrites99.3%
Final simplification79.4%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (pow (sin ky) 2.0))
(t_2 (/ (sin ky) (sqrt (+ t_1 (pow (sin kx) 2.0)))))
(t_3 (hypot (sin kx) (sin ky))))
(if (<= t_2 -1.0)
(* (/ (sin ky) (sqrt (+ (* kx kx) t_1))) (sin th))
(if (<= t_2 -0.04)
(* (/ th t_3) (sin ky))
(if (<= t_2 0.4)
(* (/ (sin th) (sqrt (fma (sin kx) (sin kx) (* ky ky)))) (sin ky))
(if (<= t_2 0.965)
(* (/ (sin ky) t_3) th)
(*
(/ (sin ky) (fma (* 0.5 kx) (/ kx (sin ky)) (sin ky)))
(sin th))))))))
double code(double kx, double ky, double th) {
double t_1 = pow(sin(ky), 2.0);
double t_2 = sin(ky) / sqrt((t_1 + pow(sin(kx), 2.0)));
double t_3 = hypot(sin(kx), sin(ky));
double tmp;
if (t_2 <= -1.0) {
tmp = (sin(ky) / sqrt(((kx * kx) + t_1))) * sin(th);
} else if (t_2 <= -0.04) {
tmp = (th / t_3) * sin(ky);
} else if (t_2 <= 0.4) {
tmp = (sin(th) / sqrt(fma(sin(kx), sin(kx), (ky * ky)))) * sin(ky);
} else if (t_2 <= 0.965) {
tmp = (sin(ky) / t_3) * th;
} else {
tmp = (sin(ky) / fma((0.5 * kx), (kx / sin(ky)), sin(ky))) * sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = sin(ky) ^ 2.0 t_2 = Float64(sin(ky) / sqrt(Float64(t_1 + (sin(kx) ^ 2.0)))) t_3 = hypot(sin(kx), sin(ky)) tmp = 0.0 if (t_2 <= -1.0) tmp = Float64(Float64(sin(ky) / sqrt(Float64(Float64(kx * kx) + t_1))) * sin(th)); elseif (t_2 <= -0.04) tmp = Float64(Float64(th / t_3) * sin(ky)); elseif (t_2 <= 0.4) tmp = Float64(Float64(sin(th) / sqrt(fma(sin(kx), sin(kx), Float64(ky * ky)))) * sin(ky)); elseif (t_2 <= 0.965) tmp = Float64(Float64(sin(ky) / t_3) * th); else tmp = Float64(Float64(sin(ky) / fma(Float64(0.5 * kx), Float64(kx / sin(ky)), sin(ky))) * sin(th)); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$1 + N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[t$95$2, -1.0], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[(kx * kx), $MachinePrecision] + t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -0.04], N[(N[(th / t$95$3), $MachinePrecision] * N[Sin[ky], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.4], N[(N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[(N[Sin[kx], $MachinePrecision] * N[Sin[kx], $MachinePrecision] + N[(ky * ky), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[ky], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.965], N[(N[(N[Sin[ky], $MachinePrecision] / t$95$3), $MachinePrecision] * th), $MachinePrecision], N[(N[(N[Sin[ky], $MachinePrecision] / N[(N[(0.5 * kx), $MachinePrecision] * N[(kx / N[Sin[ky], $MachinePrecision]), $MachinePrecision] + N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := {\sin ky}^{2}\\
t_2 := \frac{\sin ky}{\sqrt{t\_1 + {\sin kx}^{2}}}\\
t_3 := \mathsf{hypot}\left(\sin kx, \sin ky\right)\\
\mathbf{if}\;t\_2 \leq -1:\\
\;\;\;\;\frac{\sin ky}{\sqrt{kx \cdot kx + t\_1}} \cdot \sin th\\
\mathbf{elif}\;t\_2 \leq -0.04:\\
\;\;\;\;\frac{th}{t\_3} \cdot \sin ky\\
\mathbf{elif}\;t\_2 \leq 0.4:\\
\;\;\;\;\frac{\sin th}{\sqrt{\mathsf{fma}\left(\sin kx, \sin kx, ky \cdot ky\right)}} \cdot \sin ky\\
\mathbf{elif}\;t\_2 \leq 0.965:\\
\;\;\;\;\frac{\sin ky}{t\_3} \cdot th\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky}{\mathsf{fma}\left(0.5 \cdot kx, \frac{kx}{\sin ky}, \sin ky\right)} \cdot \sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -1Initial program 82.0%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6482.0
Applied rewrites82.0%
if -1 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.0400000000000000008Initial program 97.4%
Taylor expanded in th around 0
lower-*.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
unpow2N/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-pow.f64N/A
lower-sin.f6438.6
Applied rewrites38.6%
Applied rewrites38.7%
if -0.0400000000000000008 < (/.f64 (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.40000000000000002Initial program 99.6%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6496.3
Applied rewrites96.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6496.4
lift-+.f64N/A
lift-pow.f64N/A
pow2N/A
lower-fma.f6496.4
Applied rewrites96.4%
if 0.40000000000000002 < (/.f64 (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.964999999999999969Initial program 99.2%
Taylor expanded in th around 0
lower-*.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
unpow2N/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-pow.f64N/A
lower-sin.f6443.8
Applied rewrites43.8%
Applied rewrites43.9%
if 0.964999999999999969 < (/.f64 (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 85.0%
Taylor expanded in kx around 0
+-commutativeN/A
*-commutativeN/A
associate-*l/N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-/l*N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-sin.f64N/A
lower-sin.f6484.1
Applied rewrites84.1%
Final simplification77.1%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (pow (sin ky) 2.0))
(t_2 (/ (sin ky) (sqrt (+ t_1 (pow (sin kx) 2.0)))))
(t_3 (hypot (sin kx) (sin ky))))
(if (<= t_2 -1.0)
(* (/ (sin ky) (sqrt (+ (* kx kx) t_1))) (sin th))
(if (<= t_2 -0.04)
(* (/ th t_3) (sin ky))
(if (<= t_2 0.4)
(* (/ (sin th) (sqrt (fma (sin kx) (sin kx) (* ky ky)))) (sin ky))
(if (<= t_2 0.965) (* (/ (sin ky) t_3) th) (sin th)))))))
double code(double kx, double ky, double th) {
double t_1 = pow(sin(ky), 2.0);
double t_2 = sin(ky) / sqrt((t_1 + pow(sin(kx), 2.0)));
double t_3 = hypot(sin(kx), sin(ky));
double tmp;
if (t_2 <= -1.0) {
tmp = (sin(ky) / sqrt(((kx * kx) + t_1))) * sin(th);
} else if (t_2 <= -0.04) {
tmp = (th / t_3) * sin(ky);
} else if (t_2 <= 0.4) {
tmp = (sin(th) / sqrt(fma(sin(kx), sin(kx), (ky * ky)))) * sin(ky);
} else if (t_2 <= 0.965) {
tmp = (sin(ky) / t_3) * th;
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = sin(ky) ^ 2.0 t_2 = Float64(sin(ky) / sqrt(Float64(t_1 + (sin(kx) ^ 2.0)))) t_3 = hypot(sin(kx), sin(ky)) tmp = 0.0 if (t_2 <= -1.0) tmp = Float64(Float64(sin(ky) / sqrt(Float64(Float64(kx * kx) + t_1))) * sin(th)); elseif (t_2 <= -0.04) tmp = Float64(Float64(th / t_3) * sin(ky)); elseif (t_2 <= 0.4) tmp = Float64(Float64(sin(th) / sqrt(fma(sin(kx), sin(kx), Float64(ky * ky)))) * sin(ky)); elseif (t_2 <= 0.965) tmp = Float64(Float64(sin(ky) / t_3) * th); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$1 + N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[t$95$2, -1.0], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[(kx * kx), $MachinePrecision] + t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -0.04], N[(N[(th / t$95$3), $MachinePrecision] * N[Sin[ky], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.4], N[(N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[(N[Sin[kx], $MachinePrecision] * N[Sin[kx], $MachinePrecision] + N[(ky * ky), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[ky], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.965], N[(N[(N[Sin[ky], $MachinePrecision] / t$95$3), $MachinePrecision] * th), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := {\sin ky}^{2}\\
t_2 := \frac{\sin ky}{\sqrt{t\_1 + {\sin kx}^{2}}}\\
t_3 := \mathsf{hypot}\left(\sin kx, \sin ky\right)\\
\mathbf{if}\;t\_2 \leq -1:\\
\;\;\;\;\frac{\sin ky}{\sqrt{kx \cdot kx + t\_1}} \cdot \sin th\\
\mathbf{elif}\;t\_2 \leq -0.04:\\
\;\;\;\;\frac{th}{t\_3} \cdot \sin ky\\
\mathbf{elif}\;t\_2 \leq 0.4:\\
\;\;\;\;\frac{\sin th}{\sqrt{\mathsf{fma}\left(\sin kx, \sin kx, ky \cdot ky\right)}} \cdot \sin ky\\
\mathbf{elif}\;t\_2 \leq 0.965:\\
\;\;\;\;\frac{\sin ky}{t\_3} \cdot th\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -1Initial program 82.0%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6482.0
Applied rewrites82.0%
if -1 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.0400000000000000008Initial program 97.4%
Taylor expanded in th around 0
lower-*.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
unpow2N/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-pow.f64N/A
lower-sin.f6438.6
Applied rewrites38.6%
Applied rewrites38.7%
if -0.0400000000000000008 < (/.f64 (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.40000000000000002Initial program 99.6%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6496.3
Applied rewrites96.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6496.4
lift-+.f64N/A
lift-pow.f64N/A
pow2N/A
lower-fma.f6496.4
Applied rewrites96.4%
if 0.40000000000000002 < (/.f64 (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.964999999999999969Initial program 99.2%
Taylor expanded in th around 0
lower-*.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
unpow2N/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-pow.f64N/A
lower-sin.f6443.8
Applied rewrites43.8%
Applied rewrites43.9%
if 0.964999999999999969 < (/.f64 (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 85.0%
Taylor expanded in kx around 0
lower-sin.f6484.0
Applied rewrites84.0%
Final simplification77.1%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (pow (sin ky) 2.0))
(t_2 (pow (sin kx) 2.0))
(t_3 (/ (sin ky) (sqrt (+ t_1 t_2))))
(t_4 (hypot (sin kx) (sin ky))))
(if (<= t_3 -1.0)
(* (/ (sin ky) (sqrt (+ (* kx kx) t_1))) (sin th))
(if (<= t_3 -0.04)
(* (/ th t_4) (sin ky))
(if (<= t_3 0.4)
(* (/ (sin ky) (sqrt (+ (* ky ky) t_2))) (sin th))
(if (<= t_3 0.965) (* (/ (sin ky) t_4) th) (sin th)))))))
double code(double kx, double ky, double th) {
double t_1 = pow(sin(ky), 2.0);
double t_2 = pow(sin(kx), 2.0);
double t_3 = sin(ky) / sqrt((t_1 + t_2));
double t_4 = hypot(sin(kx), sin(ky));
double tmp;
if (t_3 <= -1.0) {
tmp = (sin(ky) / sqrt(((kx * kx) + t_1))) * sin(th);
} else if (t_3 <= -0.04) {
tmp = (th / t_4) * sin(ky);
} else if (t_3 <= 0.4) {
tmp = (sin(ky) / sqrt(((ky * ky) + t_2))) * sin(th);
} else if (t_3 <= 0.965) {
tmp = (sin(ky) / t_4) * th;
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.pow(Math.sin(ky), 2.0);
double t_2 = Math.pow(Math.sin(kx), 2.0);
double t_3 = Math.sin(ky) / Math.sqrt((t_1 + t_2));
double t_4 = Math.hypot(Math.sin(kx), Math.sin(ky));
double tmp;
if (t_3 <= -1.0) {
tmp = (Math.sin(ky) / Math.sqrt(((kx * kx) + t_1))) * Math.sin(th);
} else if (t_3 <= -0.04) {
tmp = (th / t_4) * Math.sin(ky);
} else if (t_3 <= 0.4) {
tmp = (Math.sin(ky) / Math.sqrt(((ky * ky) + t_2))) * Math.sin(th);
} else if (t_3 <= 0.965) {
tmp = (Math.sin(ky) / t_4) * th;
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.pow(math.sin(ky), 2.0) t_2 = math.pow(math.sin(kx), 2.0) t_3 = math.sin(ky) / math.sqrt((t_1 + t_2)) t_4 = math.hypot(math.sin(kx), math.sin(ky)) tmp = 0 if t_3 <= -1.0: tmp = (math.sin(ky) / math.sqrt(((kx * kx) + t_1))) * math.sin(th) elif t_3 <= -0.04: tmp = (th / t_4) * math.sin(ky) elif t_3 <= 0.4: tmp = (math.sin(ky) / math.sqrt(((ky * ky) + t_2))) * math.sin(th) elif t_3 <= 0.965: tmp = (math.sin(ky) / t_4) * th else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = sin(ky) ^ 2.0 t_2 = sin(kx) ^ 2.0 t_3 = Float64(sin(ky) / sqrt(Float64(t_1 + t_2))) t_4 = hypot(sin(kx), sin(ky)) tmp = 0.0 if (t_3 <= -1.0) tmp = Float64(Float64(sin(ky) / sqrt(Float64(Float64(kx * kx) + t_1))) * sin(th)); elseif (t_3 <= -0.04) tmp = Float64(Float64(th / t_4) * sin(ky)); elseif (t_3 <= 0.4) tmp = Float64(Float64(sin(ky) / sqrt(Float64(Float64(ky * ky) + t_2))) * sin(th)); elseif (t_3 <= 0.965) tmp = Float64(Float64(sin(ky) / t_4) * th); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = sin(ky) ^ 2.0; t_2 = sin(kx) ^ 2.0; t_3 = sin(ky) / sqrt((t_1 + t_2)); t_4 = hypot(sin(kx), sin(ky)); tmp = 0.0; if (t_3 <= -1.0) tmp = (sin(ky) / sqrt(((kx * kx) + t_1))) * sin(th); elseif (t_3 <= -0.04) tmp = (th / t_4) * sin(ky); elseif (t_3 <= 0.4) tmp = (sin(ky) / sqrt(((ky * ky) + t_2))) * sin(th); elseif (t_3 <= 0.965) tmp = (sin(ky) / t_4) * th; 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[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$3 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$1 + t$95$2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[t$95$3, -1.0], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[(kx * kx), $MachinePrecision] + t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, -0.04], N[(N[(th / t$95$4), $MachinePrecision] * N[Sin[ky], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 0.4], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[(ky * ky), $MachinePrecision] + t$95$2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 0.965], N[(N[(N[Sin[ky], $MachinePrecision] / t$95$4), $MachinePrecision] * th), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := {\sin ky}^{2}\\
t_2 := {\sin kx}^{2}\\
t_3 := \frac{\sin ky}{\sqrt{t\_1 + t\_2}}\\
t_4 := \mathsf{hypot}\left(\sin kx, \sin ky\right)\\
\mathbf{if}\;t\_3 \leq -1:\\
\;\;\;\;\frac{\sin ky}{\sqrt{kx \cdot kx + t\_1}} \cdot \sin th\\
\mathbf{elif}\;t\_3 \leq -0.04:\\
\;\;\;\;\frac{th}{t\_4} \cdot \sin ky\\
\mathbf{elif}\;t\_3 \leq 0.4:\\
\;\;\;\;\frac{\sin ky}{\sqrt{ky \cdot ky + t\_2}} \cdot \sin th\\
\mathbf{elif}\;t\_3 \leq 0.965:\\
\;\;\;\;\frac{\sin ky}{t\_4} \cdot th\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -1Initial program 82.0%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6482.0
Applied rewrites82.0%
if -1 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.0400000000000000008Initial program 97.4%
Taylor expanded in th around 0
lower-*.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
unpow2N/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-pow.f64N/A
lower-sin.f6438.6
Applied rewrites38.6%
Applied rewrites38.7%
if -0.0400000000000000008 < (/.f64 (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.40000000000000002Initial program 99.6%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6496.3
Applied rewrites96.3%
if 0.40000000000000002 < (/.f64 (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.964999999999999969Initial program 99.2%
Taylor expanded in th around 0
lower-*.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
unpow2N/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-pow.f64N/A
lower-sin.f6443.8
Applied rewrites43.8%
Applied rewrites43.9%
if 0.964999999999999969 < (/.f64 (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 85.0%
Taylor expanded in kx around 0
lower-sin.f6484.0
Applied rewrites84.0%
Final simplification77.1%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (pow (sin ky) 2.0))
(t_2 (/ (sin ky) (sqrt (+ t_1 (pow (sin kx) 2.0)))))
(t_3 (hypot (sin kx) (sin ky))))
(if (<= t_2 -1.0)
(* (/ (sin ky) (sqrt (+ (* kx kx) t_1))) (sin th))
(if (<= t_2 -0.04)
(* (/ th t_3) (sin ky))
(if (<= t_2 0.4)
(/ (* (sin th) ky) (hypot (sin ky) (sin kx)))
(if (<= t_2 0.965) (* (/ (sin ky) t_3) th) (sin th)))))))
double code(double kx, double ky, double th) {
double t_1 = pow(sin(ky), 2.0);
double t_2 = sin(ky) / sqrt((t_1 + pow(sin(kx), 2.0)));
double t_3 = hypot(sin(kx), sin(ky));
double tmp;
if (t_2 <= -1.0) {
tmp = (sin(ky) / sqrt(((kx * kx) + t_1))) * sin(th);
} else if (t_2 <= -0.04) {
tmp = (th / t_3) * sin(ky);
} else if (t_2 <= 0.4) {
tmp = (sin(th) * ky) / hypot(sin(ky), sin(kx));
} else if (t_2 <= 0.965) {
tmp = (sin(ky) / t_3) * th;
} else {
tmp = sin(th);
}
return tmp;
}
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((t_1 + Math.pow(Math.sin(kx), 2.0)));
double t_3 = Math.hypot(Math.sin(kx), Math.sin(ky));
double tmp;
if (t_2 <= -1.0) {
tmp = (Math.sin(ky) / Math.sqrt(((kx * kx) + t_1))) * Math.sin(th);
} else if (t_2 <= -0.04) {
tmp = (th / t_3) * Math.sin(ky);
} else if (t_2 <= 0.4) {
tmp = (Math.sin(th) * ky) / Math.hypot(Math.sin(ky), Math.sin(kx));
} else if (t_2 <= 0.965) {
tmp = (Math.sin(ky) / t_3) * th;
} 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((t_1 + math.pow(math.sin(kx), 2.0))) t_3 = math.hypot(math.sin(kx), math.sin(ky)) tmp = 0 if t_2 <= -1.0: tmp = (math.sin(ky) / math.sqrt(((kx * kx) + t_1))) * math.sin(th) elif t_2 <= -0.04: tmp = (th / t_3) * math.sin(ky) elif t_2 <= 0.4: tmp = (math.sin(th) * ky) / math.hypot(math.sin(ky), math.sin(kx)) elif t_2 <= 0.965: tmp = (math.sin(ky) / t_3) * th 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(t_1 + (sin(kx) ^ 2.0)))) t_3 = hypot(sin(kx), sin(ky)) tmp = 0.0 if (t_2 <= -1.0) tmp = Float64(Float64(sin(ky) / sqrt(Float64(Float64(kx * kx) + t_1))) * sin(th)); elseif (t_2 <= -0.04) tmp = Float64(Float64(th / t_3) * sin(ky)); elseif (t_2 <= 0.4) tmp = Float64(Float64(sin(th) * ky) / hypot(sin(ky), sin(kx))); elseif (t_2 <= 0.965) tmp = Float64(Float64(sin(ky) / t_3) * th); 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((t_1 + (sin(kx) ^ 2.0))); t_3 = hypot(sin(kx), sin(ky)); tmp = 0.0; if (t_2 <= -1.0) tmp = (sin(ky) / sqrt(((kx * kx) + t_1))) * sin(th); elseif (t_2 <= -0.04) tmp = (th / t_3) * sin(ky); elseif (t_2 <= 0.4) tmp = (sin(th) * ky) / hypot(sin(ky), sin(kx)); elseif (t_2 <= 0.965) tmp = (sin(ky) / t_3) * th; 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[(t$95$1 + N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[t$95$2, -1.0], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[(kx * kx), $MachinePrecision] + t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -0.04], N[(N[(th / t$95$3), $MachinePrecision] * N[Sin[ky], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.4], N[(N[(N[Sin[th], $MachinePrecision] * ky), $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.965], N[(N[(N[Sin[ky], $MachinePrecision] / t$95$3), $MachinePrecision] * th), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := {\sin ky}^{2}\\
t_2 := \frac{\sin ky}{\sqrt{t\_1 + {\sin kx}^{2}}}\\
t_3 := \mathsf{hypot}\left(\sin kx, \sin ky\right)\\
\mathbf{if}\;t\_2 \leq -1:\\
\;\;\;\;\frac{\sin ky}{\sqrt{kx \cdot kx + t\_1}} \cdot \sin th\\
\mathbf{elif}\;t\_2 \leq -0.04:\\
\;\;\;\;\frac{th}{t\_3} \cdot \sin ky\\
\mathbf{elif}\;t\_2 \leq 0.4:\\
\;\;\;\;\frac{\sin th \cdot ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{elif}\;t\_2 \leq 0.965:\\
\;\;\;\;\frac{\sin ky}{t\_3} \cdot th\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -1Initial program 82.0%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6482.0
Applied rewrites82.0%
if -1 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.0400000000000000008Initial program 97.4%
Taylor expanded in th around 0
lower-*.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
unpow2N/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-pow.f64N/A
lower-sin.f6438.6
Applied rewrites38.6%
Applied rewrites38.7%
if -0.0400000000000000008 < (/.f64 (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.40000000000000002Initial program 99.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6494.9
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6494.9
Applied rewrites94.9%
Taylor expanded in ky around 0
lower-*.f64N/A
lower-sin.f6491.6
Applied rewrites91.6%
if 0.40000000000000002 < (/.f64 (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.964999999999999969Initial program 99.2%
Taylor expanded in th around 0
lower-*.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
unpow2N/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-pow.f64N/A
lower-sin.f6443.8
Applied rewrites43.8%
Applied rewrites43.9%
if 0.964999999999999969 < (/.f64 (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 85.0%
Taylor expanded in kx around 0
lower-sin.f6484.0
Applied rewrites84.0%
Final simplification75.5%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin ky) 2.0) (pow (sin kx) 2.0)))) 1e-11) (* (/ (sin th) (sin kx)) (sin ky)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(ky) / sqrt((pow(sin(ky), 2.0) + pow(sin(kx), 2.0)))) <= 1e-11) {
tmp = (sin(th) / sin(kx)) * sin(ky);
} 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(ky) ** 2.0d0) + (sin(kx) ** 2.0d0)))) <= 1d-11) then
tmp = (sin(th) / sin(kx)) * sin(ky)
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(ky), 2.0) + Math.pow(Math.sin(kx), 2.0)))) <= 1e-11) {
tmp = (Math.sin(th) / Math.sin(kx)) * Math.sin(ky);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (math.sin(ky) / math.sqrt((math.pow(math.sin(ky), 2.0) + math.pow(math.sin(kx), 2.0)))) <= 1e-11: tmp = (math.sin(th) / math.sin(kx)) * math.sin(ky) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(ky) / sqrt(Float64((sin(ky) ^ 2.0) + (sin(kx) ^ 2.0)))) <= 1e-11) tmp = Float64(Float64(sin(th) / sin(kx)) * sin(ky)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((sin(ky) / sqrt(((sin(ky) ^ 2.0) + (sin(kx) ^ 2.0)))) <= 1e-11) tmp = (sin(th) / sin(kx)) * sin(ky); 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[ky], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 1e-11], N[(N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision] * N[Sin[ky], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin ky}^{2} + {\sin kx}^{2}}} \leq 10^{-11}:\\
\;\;\;\;\frac{\sin th}{\sin kx} \cdot \sin 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))))) < 9.99999999999999939e-12Initial program 94.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6494.4
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
lower-sin.f6433.6
Applied rewrites33.6%
if 9.99999999999999939e-12 < (/.f64 (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 89.8%
Taylor expanded in kx around 0
lower-sin.f6462.6
Applied rewrites62.6%
Final simplification43.7%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin ky) 2.0) (pow (sin kx) 2.0)))) 1e-11) (* (/ (sin ky) (sin kx)) (sin th)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(ky) / sqrt((pow(sin(ky), 2.0) + pow(sin(kx), 2.0)))) <= 1e-11) {
tmp = (sin(ky) / sin(kx)) * sin(th);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if ((sin(ky) / sqrt(((sin(ky) ** 2.0d0) + (sin(kx) ** 2.0d0)))) <= 1d-11) then
tmp = (sin(ky) / sin(kx)) * sin(th)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if ((Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(ky), 2.0) + Math.pow(Math.sin(kx), 2.0)))) <= 1e-11) {
tmp = (Math.sin(ky) / Math.sin(kx)) * Math.sin(th);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (math.sin(ky) / math.sqrt((math.pow(math.sin(ky), 2.0) + math.pow(math.sin(kx), 2.0)))) <= 1e-11: tmp = (math.sin(ky) / math.sin(kx)) * math.sin(th) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(ky) / sqrt(Float64((sin(ky) ^ 2.0) + (sin(kx) ^ 2.0)))) <= 1e-11) tmp = Float64(Float64(sin(ky) / sin(kx)) * sin(th)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((sin(ky) / sqrt(((sin(ky) ^ 2.0) + (sin(kx) ^ 2.0)))) <= 1e-11) tmp = (sin(ky) / sin(kx)) * sin(th); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 1e-11], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin ky}^{2} + {\sin kx}^{2}}} \leq 10^{-11}:\\
\;\;\;\;\frac{\sin ky}{\sin kx} \cdot \sin th\\
\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.99999999999999939e-12Initial program 94.3%
Taylor expanded in ky around 0
lower-sin.f6433.6
Applied rewrites33.6%
if 9.99999999999999939e-12 < (/.f64 (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 89.8%
Taylor expanded in kx around 0
lower-sin.f6462.6
Applied rewrites62.6%
Final simplification43.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (/ (sin ky) (sqrt (+ (pow (sin ky) 2.0) (pow (sin kx) 2.0)))) 1e-11)
(/
1.0
(/ (/ (sin kx) (sin th)) (* (fma (* ky ky) -0.16666666666666666 1.0) ky)))
(sin th)))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(ky) / sqrt((pow(sin(ky), 2.0) + pow(sin(kx), 2.0)))) <= 1e-11) {
tmp = 1.0 / ((sin(kx) / sin(th)) / (fma((ky * ky), -0.16666666666666666, 1.0) * ky));
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(ky) / sqrt(Float64((sin(ky) ^ 2.0) + (sin(kx) ^ 2.0)))) <= 1e-11) tmp = Float64(1.0 / Float64(Float64(sin(kx) / sin(th)) / Float64(fma(Float64(ky * ky), -0.16666666666666666, 1.0) * ky))); 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[ky], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 1e-11], N[(1.0 / N[(N[(N[Sin[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision] / N[(N[(N[(ky * ky), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin ky}^{2} + {\sin kx}^{2}}} \leq 10^{-11}:\\
\;\;\;\;\frac{1}{\frac{\frac{\sin kx}{\sin th}}{\mathsf{fma}\left(ky \cdot ky, -0.16666666666666666, 1\right) \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))))) < 9.99999999999999939e-12Initial program 94.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6491.2
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6495.4
Applied rewrites95.4%
Taylor expanded in ky around 0
lower-sin.f6432.2
Applied rewrites32.2%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6433.6
Applied rewrites33.6%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6431.5
Applied rewrites31.5%
if 9.99999999999999939e-12 < (/.f64 (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 89.8%
Taylor expanded in kx around 0
lower-sin.f6462.6
Applied rewrites62.6%
Final simplification42.3%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin ky) 2.0) (pow (sin kx) 2.0)))) 1e-11) (/ (sin th) (/ (sin kx) ky)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(ky) / sqrt((pow(sin(ky), 2.0) + pow(sin(kx), 2.0)))) <= 1e-11) {
tmp = sin(th) / (sin(kx) / ky);
} 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(ky) ** 2.0d0) + (sin(kx) ** 2.0d0)))) <= 1d-11) then
tmp = sin(th) / (sin(kx) / ky)
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(ky), 2.0) + Math.pow(Math.sin(kx), 2.0)))) <= 1e-11) {
tmp = Math.sin(th) / (Math.sin(kx) / ky);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (math.sin(ky) / math.sqrt((math.pow(math.sin(ky), 2.0) + math.pow(math.sin(kx), 2.0)))) <= 1e-11: tmp = math.sin(th) / (math.sin(kx) / ky) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(ky) / sqrt(Float64((sin(ky) ^ 2.0) + (sin(kx) ^ 2.0)))) <= 1e-11) tmp = Float64(sin(th) / Float64(sin(kx) / ky)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((sin(ky) / sqrt(((sin(ky) ^ 2.0) + (sin(kx) ^ 2.0)))) <= 1e-11) tmp = sin(th) / (sin(kx) / ky); 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[ky], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 1e-11], N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin ky}^{2} + {\sin kx}^{2}}} \leq 10^{-11}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{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))))) < 9.99999999999999939e-12Initial program 94.3%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6494.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
lower-/.f64N/A
lower-sin.f6432.0
Applied rewrites32.0%
if 9.99999999999999939e-12 < (/.f64 (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 89.8%
Taylor expanded in kx around 0
lower-sin.f6462.6
Applied rewrites62.6%
Final simplification42.6%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin ky) 2.0) (pow (sin kx) 2.0)))) 1e-11) (* (/ ky (sin kx)) (sin th)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(ky) / sqrt((pow(sin(ky), 2.0) + pow(sin(kx), 2.0)))) <= 1e-11) {
tmp = (ky / sin(kx)) * sin(th);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if ((sin(ky) / sqrt(((sin(ky) ** 2.0d0) + (sin(kx) ** 2.0d0)))) <= 1d-11) then
tmp = (ky / sin(kx)) * sin(th)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if ((Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(ky), 2.0) + Math.pow(Math.sin(kx), 2.0)))) <= 1e-11) {
tmp = (ky / Math.sin(kx)) * Math.sin(th);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (math.sin(ky) / math.sqrt((math.pow(math.sin(ky), 2.0) + math.pow(math.sin(kx), 2.0)))) <= 1e-11: tmp = (ky / math.sin(kx)) * math.sin(th) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(ky) / sqrt(Float64((sin(ky) ^ 2.0) + (sin(kx) ^ 2.0)))) <= 1e-11) tmp = Float64(Float64(ky / sin(kx)) * sin(th)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((sin(ky) / sqrt(((sin(ky) ^ 2.0) + (sin(kx) ^ 2.0)))) <= 1e-11) tmp = (ky / sin(kx)) * sin(th); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 1e-11], N[(N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin ky}^{2} + {\sin kx}^{2}}} \leq 10^{-11}:\\
\;\;\;\;\frac{ky}{\sin kx} \cdot \sin th\\
\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.99999999999999939e-12Initial program 94.3%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-sin.f6432.0
Applied rewrites32.0%
if 9.99999999999999939e-12 < (/.f64 (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 89.8%
Taylor expanded in kx around 0
lower-sin.f6462.6
Applied rewrites62.6%
Final simplification42.6%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.02)
(* (pow (pow (sin ky) 2.0) -0.5) (* th (sin ky)))
(if (<= (sin ky) 1e-169)
(* (/ (sin th) (sin kx)) (sin ky))
(if (<= (sin ky) 5e-10)
(*
(/ (sin ky) (sqrt (+ (- 0.5 (* 0.5 (cos (* 2.0 kx)))) (* ky ky))))
(sin th))
(sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.02) {
tmp = pow(pow(sin(ky), 2.0), -0.5) * (th * sin(ky));
} else if (sin(ky) <= 1e-169) {
tmp = (sin(th) / sin(kx)) * sin(ky);
} else if (sin(ky) <= 5e-10) {
tmp = (sin(ky) / sqrt(((0.5 - (0.5 * cos((2.0 * kx)))) + (ky * ky)))) * sin(th);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.02d0)) then
tmp = ((sin(ky) ** 2.0d0) ** (-0.5d0)) * (th * sin(ky))
else if (sin(ky) <= 1d-169) then
tmp = (sin(th) / sin(kx)) * sin(ky)
else if (sin(ky) <= 5d-10) then
tmp = (sin(ky) / sqrt(((0.5d0 - (0.5d0 * cos((2.0d0 * kx)))) + (ky * ky)))) * sin(th)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.02) {
tmp = Math.pow(Math.pow(Math.sin(ky), 2.0), -0.5) * (th * Math.sin(ky));
} else if (Math.sin(ky) <= 1e-169) {
tmp = (Math.sin(th) / Math.sin(kx)) * Math.sin(ky);
} else if (Math.sin(ky) <= 5e-10) {
tmp = (Math.sin(ky) / Math.sqrt(((0.5 - (0.5 * Math.cos((2.0 * kx)))) + (ky * ky)))) * Math.sin(th);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.02: tmp = math.pow(math.pow(math.sin(ky), 2.0), -0.5) * (th * math.sin(ky)) elif math.sin(ky) <= 1e-169: tmp = (math.sin(th) / math.sin(kx)) * math.sin(ky) elif math.sin(ky) <= 5e-10: tmp = (math.sin(ky) / math.sqrt(((0.5 - (0.5 * math.cos((2.0 * kx)))) + (ky * ky)))) * math.sin(th) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.02) tmp = Float64(((sin(ky) ^ 2.0) ^ -0.5) * Float64(th * sin(ky))); elseif (sin(ky) <= 1e-169) tmp = Float64(Float64(sin(th) / sin(kx)) * sin(ky)); elseif (sin(ky) <= 5e-10) tmp = Float64(Float64(sin(ky) / sqrt(Float64(Float64(0.5 - Float64(0.5 * cos(Float64(2.0 * kx)))) + Float64(ky * ky)))) * sin(th)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.02) tmp = ((sin(ky) ^ 2.0) ^ -0.5) * (th * sin(ky)); elseif (sin(ky) <= 1e-169) tmp = (sin(th) / sin(kx)) * sin(ky); elseif (sin(ky) <= 5e-10) tmp = (sin(ky) / sqrt(((0.5 - (0.5 * cos((2.0 * kx)))) + (ky * ky)))) * sin(th); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.02], N[(N[Power[N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision], -0.5], $MachinePrecision] * N[(th * N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-169], N[(N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision] * N[Sin[ky], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-10], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[(0.5 - N[(0.5 * N[Cos[N[(2.0 * kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(ky * ky), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.02:\\
\;\;\;\;{\left({\sin ky}^{2}\right)}^{-0.5} \cdot \left(th \cdot \sin ky\right)\\
\mathbf{elif}\;\sin ky \leq 10^{-169}:\\
\;\;\;\;\frac{\sin th}{\sin kx} \cdot \sin ky\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-10}:\\
\;\;\;\;\frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right) + ky \cdot ky}} \cdot \sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0200000000000000004Initial program 99.6%
Taylor expanded in th around 0
lower-*.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
unpow2N/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-pow.f64N/A
lower-sin.f6448.0
Applied rewrites48.0%
Applied rewrites48.0%
Taylor expanded in kx around 0
Applied rewrites3.3%
Applied rewrites30.4%
if -0.0200000000000000004 < (sin.f64 ky) < 1.00000000000000002e-169Initial program 81.5%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6481.5
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
lower-sin.f6447.4
Applied rewrites47.4%
if 1.00000000000000002e-169 < (sin.f64 ky) < 5.00000000000000031e-10Initial program 99.8%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6499.8
Applied rewrites99.8%
lift-pow.f64N/A
pow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sqr-sin-aN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
count-2N/A
lower-cos.f64N/A
count-2N/A
lower-*.f6493.7
Applied rewrites93.7%
if 5.00000000000000031e-10 < (sin.f64 ky) Initial program 99.6%
Taylor expanded in kx around 0
lower-sin.f6462.6
Applied rewrites62.6%
Final simplification52.2%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin ky) 2.0) (pow (sin kx) 2.0)))) 1e-11) (* (/ th (sin kx)) ky) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(ky) / sqrt((pow(sin(ky), 2.0) + pow(sin(kx), 2.0)))) <= 1e-11) {
tmp = (th / sin(kx)) * ky;
} 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(ky) ** 2.0d0) + (sin(kx) ** 2.0d0)))) <= 1d-11) then
tmp = (th / sin(kx)) * ky
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(ky), 2.0) + Math.pow(Math.sin(kx), 2.0)))) <= 1e-11) {
tmp = (th / Math.sin(kx)) * ky;
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (math.sin(ky) / math.sqrt((math.pow(math.sin(ky), 2.0) + math.pow(math.sin(kx), 2.0)))) <= 1e-11: tmp = (th / math.sin(kx)) * ky else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(ky) / sqrt(Float64((sin(ky) ^ 2.0) + (sin(kx) ^ 2.0)))) <= 1e-11) tmp = Float64(Float64(th / sin(kx)) * ky); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((sin(ky) / sqrt(((sin(ky) ^ 2.0) + (sin(kx) ^ 2.0)))) <= 1e-11) tmp = (th / sin(kx)) * ky; 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[ky], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 1e-11], N[(N[(th / N[Sin[kx], $MachinePrecision]), $MachinePrecision] * ky), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin ky}^{2} + {\sin kx}^{2}}} \leq 10^{-11}:\\
\;\;\;\;\frac{th}{\sin kx} \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))))) < 9.99999999999999939e-12Initial program 94.3%
Taylor expanded in th around 0
lower-*.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
unpow2N/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-pow.f64N/A
lower-sin.f6443.9
Applied rewrites43.9%
Taylor expanded in ky around 0
Applied rewrites20.9%
if 9.99999999999999939e-12 < (/.f64 (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 89.8%
Taylor expanded in kx around 0
lower-sin.f6462.6
Applied rewrites62.6%
Final simplification35.4%
(FPCore (kx ky th)
:precision binary64
(if (<=
(/ (sin ky) (sqrt (+ (pow (sin ky) 2.0) (pow (sin kx) 2.0))))
1.75e-117)
0.0
(sin th)))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(ky) / sqrt((pow(sin(ky), 2.0) + pow(sin(kx), 2.0)))) <= 1.75e-117) {
tmp = 0.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(ky) ** 2.0d0) + (sin(kx) ** 2.0d0)))) <= 1.75d-117) then
tmp = 0.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(ky), 2.0) + Math.pow(Math.sin(kx), 2.0)))) <= 1.75e-117) {
tmp = 0.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(ky), 2.0) + math.pow(math.sin(kx), 2.0)))) <= 1.75e-117: tmp = 0.0 else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(ky) / sqrt(Float64((sin(ky) ^ 2.0) + (sin(kx) ^ 2.0)))) <= 1.75e-117) tmp = 0.0; else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((sin(ky) / sqrt(((sin(ky) ^ 2.0) + (sin(kx) ^ 2.0)))) <= 1.75e-117) tmp = 0.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[ky], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 1.75e-117], 0.0, N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin ky}^{2} + {\sin kx}^{2}}} \leq 1.75 \cdot 10^{-117}:\\
\;\;\;\;0\\
\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.7499999999999999e-117Initial program 93.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6492.2
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6496.8
Applied rewrites96.8%
Taylor expanded in ky around 0
lower-sin.f6431.6
Applied rewrites31.6%
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-subN/A
div-subN/A
lower--.f64N/A
Applied rewrites17.0%
Taylor expanded in th around 0
cos-negN/A
+-inverses16.8
Applied rewrites16.8%
if 1.7499999999999999e-117 < (/.f64 (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 91.4%
Taylor expanded in kx around 0
lower-sin.f6453.7
Applied rewrites53.7%
Final simplification32.1%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) 1e-169)
(* (/ (sin th) (sin kx)) (sin ky))
(if (<= (sin ky) 5e-10)
(*
(/ (sin ky) (sqrt (+ (- 0.5 (* 0.5 (cos (* 2.0 kx)))) (* ky ky))))
(sin th))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 1e-169) {
tmp = (sin(th) / sin(kx)) * sin(ky);
} else if (sin(ky) <= 5e-10) {
tmp = (sin(ky) / sqrt(((0.5 - (0.5 * cos((2.0 * kx)))) + (ky * ky)))) * sin(th);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= 1d-169) then
tmp = (sin(th) / sin(kx)) * sin(ky)
else if (sin(ky) <= 5d-10) then
tmp = (sin(ky) / sqrt(((0.5d0 - (0.5d0 * cos((2.0d0 * kx)))) + (ky * ky)))) * sin(th)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= 1e-169) {
tmp = (Math.sin(th) / Math.sin(kx)) * Math.sin(ky);
} else if (Math.sin(ky) <= 5e-10) {
tmp = (Math.sin(ky) / Math.sqrt(((0.5 - (0.5 * Math.cos((2.0 * kx)))) + (ky * ky)))) * Math.sin(th);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 1e-169: tmp = (math.sin(th) / math.sin(kx)) * math.sin(ky) elif math.sin(ky) <= 5e-10: tmp = (math.sin(ky) / math.sqrt(((0.5 - (0.5 * math.cos((2.0 * kx)))) + (ky * ky)))) * math.sin(th) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 1e-169) tmp = Float64(Float64(sin(th) / sin(kx)) * sin(ky)); elseif (sin(ky) <= 5e-10) tmp = Float64(Float64(sin(ky) / sqrt(Float64(Float64(0.5 - Float64(0.5 * cos(Float64(2.0 * kx)))) + Float64(ky * ky)))) * sin(th)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= 1e-169) tmp = (sin(th) / sin(kx)) * sin(ky); elseif (sin(ky) <= 5e-10) tmp = (sin(ky) / sqrt(((0.5 - (0.5 * cos((2.0 * kx)))) + (ky * ky)))) * sin(th); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-169], N[(N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision] * N[Sin[ky], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-10], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[(0.5 - N[(0.5 * N[Cos[N[(2.0 * kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(ky * ky), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 10^{-169}:\\
\;\;\;\;\frac{\sin th}{\sin kx} \cdot \sin ky\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-10}:\\
\;\;\;\;\frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right) + ky \cdot ky}} \cdot \sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 1.00000000000000002e-169Initial program 88.5%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6488.6
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
lower-sin.f6431.8
Applied rewrites31.8%
if 1.00000000000000002e-169 < (sin.f64 ky) < 5.00000000000000031e-10Initial program 99.8%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6499.8
Applied rewrites99.8%
lift-pow.f64N/A
pow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sqr-sin-aN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
count-2N/A
lower-cos.f64N/A
count-2N/A
lower-*.f6493.7
Applied rewrites93.7%
if 5.00000000000000031e-10 < (sin.f64 ky) Initial program 99.6%
Taylor expanded in kx around 0
lower-sin.f6462.6
Applied rewrites62.6%
Final simplification46.6%
(FPCore (kx ky th)
:precision binary64
(if (<= (/ (sin ky) (sqrt (+ (pow (sin ky) 2.0) (pow (sin kx) 2.0)))) 6e-64)
0.0
(*
(fma
(fma 0.008333333333333333 (* th th) -0.16666666666666666)
(* th th)
1.0)
th)))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(ky) / sqrt((pow(sin(ky), 2.0) + pow(sin(kx), 2.0)))) <= 6e-64) {
tmp = 0.0;
} else {
tmp = fma(fma(0.008333333333333333, (th * th), -0.16666666666666666), (th * th), 1.0) * th;
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(ky) / sqrt(Float64((sin(ky) ^ 2.0) + (sin(kx) ^ 2.0)))) <= 6e-64) tmp = 0.0; else tmp = Float64(fma(fma(0.008333333333333333, Float64(th * th), -0.16666666666666666), Float64(th * th), 1.0) * th); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 6e-64], 0.0, N[(N[(N[(0.008333333333333333 * N[(th * th), $MachinePrecision] + -0.16666666666666666), $MachinePrecision] * N[(th * th), $MachinePrecision] + 1.0), $MachinePrecision] * th), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin ky}^{2} + {\sin kx}^{2}}} \leq 6 \cdot 10^{-64}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.008333333333333333, th \cdot th, -0.16666666666666666\right), th \cdot th, 1\right) \cdot th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 6.0000000000000001e-64Initial program 94.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6491.3
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6495.7
Applied rewrites95.7%
Taylor expanded in ky around 0
lower-sin.f6431.6
Applied rewrites31.6%
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-subN/A
div-subN/A
lower--.f64N/A
Applied rewrites16.5%
Taylor expanded in th around 0
cos-negN/A
+-inverses16.2
Applied rewrites16.2%
if 6.0000000000000001e-64 < (/.f64 (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.8%
Taylor expanded in kx around 0
lower-sin.f6457.1
Applied rewrites57.1%
Taylor expanded in th around 0
Applied rewrites26.9%
Applied rewrites26.9%
Taylor expanded in th around 0
Applied rewrites27.1%
Final simplification20.4%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin ky) 2.0) (pow (sin kx) 2.0)))) 4e-49) 0.0 (fma (* (* th th) -0.16666666666666666) th th)))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(ky) / sqrt((pow(sin(ky), 2.0) + pow(sin(kx), 2.0)))) <= 4e-49) {
tmp = 0.0;
} else {
tmp = fma(((th * th) * -0.16666666666666666), th, th);
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(ky) / sqrt(Float64((sin(ky) ^ 2.0) + (sin(kx) ^ 2.0)))) <= 4e-49) tmp = 0.0; else tmp = fma(Float64(Float64(th * th) * -0.16666666666666666), th, th); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 4e-49], 0.0, N[(N[(N[(th * th), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] * th + th), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin ky}^{2} + {\sin kx}^{2}}} \leq 4 \cdot 10^{-49}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(th \cdot th\right) \cdot -0.16666666666666666, th, 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))))) < 3.99999999999999975e-49Initial program 94.1%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6490.9
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6495.2
Applied rewrites95.2%
Taylor expanded in ky around 0
lower-sin.f6432.7
Applied rewrites32.7%
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-subN/A
div-subN/A
lower--.f64N/A
Applied rewrites16.2%
Taylor expanded in th around 0
cos-negN/A
+-inverses16.0
Applied rewrites16.0%
if 3.99999999999999975e-49 < (/.f64 (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.4%
Taylor expanded in kx around 0
lower-sin.f6459.2
Applied rewrites59.2%
Taylor expanded in th around 0
Applied rewrites27.8%
Applied rewrites27.8%
Final simplification20.4%
(FPCore (kx ky th)
:precision binary64
(if (<= ky 0.0013)
(*
(/
1.0
(/
(hypot (sin ky) (sin kx))
(* (fma (* ky ky) -0.16666666666666666 1.0) ky)))
(sin th))
(/
(sin th)
(/
(/
(sqrt
(fma (- 1.0 (cos (* 2.0 ky))) 2.0 (* (- 1.0 (cos (* 2.0 kx))) 2.0)))
2.0)
(sin ky)))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 0.0013) {
tmp = (1.0 / (hypot(sin(ky), sin(kx)) / (fma((ky * ky), -0.16666666666666666, 1.0) * ky))) * sin(th);
} else {
tmp = sin(th) / ((sqrt(fma((1.0 - cos((2.0 * ky))), 2.0, ((1.0 - cos((2.0 * kx))) * 2.0))) / 2.0) / sin(ky));
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (ky <= 0.0013) tmp = Float64(Float64(1.0 / Float64(hypot(sin(ky), sin(kx)) / Float64(fma(Float64(ky * ky), -0.16666666666666666, 1.0) * ky))) * sin(th)); else tmp = Float64(sin(th) / Float64(Float64(sqrt(fma(Float64(1.0 - cos(Float64(2.0 * ky))), 2.0, Float64(Float64(1.0 - cos(Float64(2.0 * kx))) * 2.0))) / 2.0) / sin(ky))); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[ky, 0.0013], N[(N[(1.0 / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[(N[(N[(ky * ky), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] / N[(N[(N[Sqrt[N[(N[(1.0 - N[Cos[N[(2.0 * ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 2.0 + N[(N[(1.0 - N[Cos[N[(2.0 * kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 0.0013:\\
\;\;\;\;\frac{1}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{\mathsf{fma}\left(ky \cdot ky, -0.16666666666666666, 1\right) \cdot ky}} \cdot \sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th}{\frac{\frac{\sqrt{\mathsf{fma}\left(1 - \cos \left(2 \cdot ky\right), 2, \left(1 - \cos \left(2 \cdot kx\right)\right) \cdot 2\right)}}{2}}{\sin ky}}\\
\end{array}
\end{array}
if ky < 0.0012999999999999999Initial program 90.4%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6490.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
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6465.9
Applied rewrites65.9%
if 0.0012999999999999999 < ky Initial program 99.6%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6499.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.6
Applied rewrites99.6%
lift-hypot.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
sin-multN/A
frac-addN/A
metadata-evalN/A
metadata-evalN/A
sqrt-divN/A
metadata-evalN/A
metadata-evalN/A
Applied rewrites99.3%
Final simplification74.5%
(FPCore (kx ky th)
:precision binary64
(if (<= ky 0.0013)
(*
(/
1.0
(/
(hypot (sin ky) (sin kx))
(* (fma (* ky ky) -0.16666666666666666 1.0) ky)))
(sin th))
(*
(/
(sin ky)
(/
(sqrt
(fma (- 1.0 (cos (* 2.0 ky))) 2.0 (* (- 1.0 (cos (* 2.0 kx))) 2.0)))
2.0))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 0.0013) {
tmp = (1.0 / (hypot(sin(ky), sin(kx)) / (fma((ky * ky), -0.16666666666666666, 1.0) * ky))) * sin(th);
} else {
tmp = (sin(ky) / (sqrt(fma((1.0 - cos((2.0 * ky))), 2.0, ((1.0 - cos((2.0 * kx))) * 2.0))) / 2.0)) * sin(th);
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (ky <= 0.0013) tmp = Float64(Float64(1.0 / Float64(hypot(sin(ky), sin(kx)) / Float64(fma(Float64(ky * ky), -0.16666666666666666, 1.0) * ky))) * sin(th)); else tmp = Float64(Float64(sin(ky) / Float64(sqrt(fma(Float64(1.0 - cos(Float64(2.0 * ky))), 2.0, Float64(Float64(1.0 - cos(Float64(2.0 * kx))) * 2.0))) / 2.0)) * sin(th)); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[ky, 0.0013], N[(N[(1.0 / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[(N[(N[(ky * ky), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], N[(N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[(N[(1.0 - N[Cos[N[(2.0 * ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 2.0 + N[(N[(1.0 - N[Cos[N[(2.0 * kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 0.0013:\\
\;\;\;\;\frac{1}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{\mathsf{fma}\left(ky \cdot ky, -0.16666666666666666, 1\right) \cdot ky}} \cdot \sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky}{\frac{\sqrt{\mathsf{fma}\left(1 - \cos \left(2 \cdot ky\right), 2, \left(1 - \cos \left(2 \cdot kx\right)\right) \cdot 2\right)}}{2}} \cdot \sin th\\
\end{array}
\end{array}
if ky < 0.0012999999999999999Initial program 90.4%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6490.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
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6465.9
Applied rewrites65.9%
if 0.0012999999999999999 < ky Initial program 99.6%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
frac-addN/A
metadata-evalN/A
metadata-evalN/A
sqrt-divN/A
Applied rewrites99.3%
Final simplification74.5%
(FPCore (kx ky th) :precision binary64 (if (<= th 0.004) (* (/ (sin ky) (hypot (sin kx) (sin ky))) th) (/ (* (sin th) ky) (hypot (sin ky) (sin kx)))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.004) {
tmp = (sin(ky) / hypot(sin(kx), sin(ky))) * th;
} else {
tmp = (sin(th) * ky) / hypot(sin(ky), sin(kx));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.004) {
tmp = (Math.sin(ky) / Math.hypot(Math.sin(kx), Math.sin(ky))) * th;
} else {
tmp = (Math.sin(th) * ky) / Math.hypot(Math.sin(ky), Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 0.004: tmp = (math.sin(ky) / math.hypot(math.sin(kx), math.sin(ky))) * th else: tmp = (math.sin(th) * ky) / math.hypot(math.sin(ky), math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 0.004) tmp = Float64(Float64(sin(ky) / hypot(sin(kx), sin(ky))) * th); else tmp = Float64(Float64(sin(th) * ky) / hypot(sin(ky), sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 0.004) tmp = (sin(ky) / hypot(sin(kx), sin(ky))) * th; else tmp = (sin(th) * ky) / hypot(sin(ky), sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 0.004], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * th), $MachinePrecision], N[(N[(N[Sin[th], $MachinePrecision] * ky), $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 0.004:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\sin kx, \sin ky\right)} \cdot th\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th \cdot ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\end{array}
\end{array}
if th < 0.0040000000000000001Initial program 92.8%
Taylor expanded in th around 0
lower-*.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
unpow2N/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-pow.f64N/A
lower-sin.f6456.8
Applied rewrites56.8%
Applied rewrites64.5%
if 0.0040000000000000001 < th Initial program 92.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6492.6
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6499.5
Applied rewrites99.5%
Taylor expanded in ky around 0
lower-*.f64N/A
lower-sin.f6449.6
Applied rewrites49.6%
Final simplification60.4%
(FPCore (kx ky th)
:precision binary64
(if (<= th 0.235)
(* (/ (sin ky) (hypot (sin kx) (sin ky))) th)
(*
(/ (sin ky) (sqrt (+ (- 0.5 (* 0.5 (cos (* 2.0 kx)))) (* ky ky))))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.235) {
tmp = (sin(ky) / hypot(sin(kx), sin(ky))) * th;
} else {
tmp = (sin(ky) / sqrt(((0.5 - (0.5 * cos((2.0 * kx)))) + (ky * ky)))) * sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.235) {
tmp = (Math.sin(ky) / Math.hypot(Math.sin(kx), Math.sin(ky))) * th;
} else {
tmp = (Math.sin(ky) / Math.sqrt(((0.5 - (0.5 * Math.cos((2.0 * kx)))) + (ky * ky)))) * Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 0.235: tmp = (math.sin(ky) / math.hypot(math.sin(kx), math.sin(ky))) * th else: tmp = (math.sin(ky) / math.sqrt(((0.5 - (0.5 * math.cos((2.0 * kx)))) + (ky * ky)))) * math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 0.235) tmp = Float64(Float64(sin(ky) / hypot(sin(kx), sin(ky))) * th); else tmp = Float64(Float64(sin(ky) / sqrt(Float64(Float64(0.5 - Float64(0.5 * cos(Float64(2.0 * kx)))) + Float64(ky * ky)))) * sin(th)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 0.235) tmp = (sin(ky) / hypot(sin(kx), sin(ky))) * th; else tmp = (sin(ky) / sqrt(((0.5 - (0.5 * cos((2.0 * kx)))) + (ky * ky)))) * sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 0.235], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * th), $MachinePrecision], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[(0.5 - N[(0.5 * N[Cos[N[(2.0 * kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(ky * ky), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 0.235:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\sin kx, \sin ky\right)} \cdot th\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right) + ky \cdot ky}} \cdot \sin th\\
\end{array}
\end{array}
if th < 0.23499999999999999Initial program 92.8%
Taylor expanded in th around 0
lower-*.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
unpow2N/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-pow.f64N/A
lower-sin.f6456.8
Applied rewrites56.8%
Applied rewrites64.5%
if 0.23499999999999999 < th Initial program 92.7%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6443.7
Applied rewrites43.7%
lift-pow.f64N/A
pow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sqr-sin-aN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
count-2N/A
lower-cos.f64N/A
count-2N/A
lower-*.f6438.2
Applied rewrites38.2%
Final simplification57.2%
(FPCore (kx ky th)
:precision binary64
(if (<= th 0.235)
(* (/ th (hypot (sin kx) (sin ky))) (sin ky))
(*
(/ (sin ky) (sqrt (+ (- 0.5 (* 0.5 (cos (* 2.0 kx)))) (* ky ky))))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.235) {
tmp = (th / hypot(sin(kx), sin(ky))) * sin(ky);
} else {
tmp = (sin(ky) / sqrt(((0.5 - (0.5 * cos((2.0 * kx)))) + (ky * ky)))) * sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.235) {
tmp = (th / Math.hypot(Math.sin(kx), Math.sin(ky))) * Math.sin(ky);
} else {
tmp = (Math.sin(ky) / Math.sqrt(((0.5 - (0.5 * Math.cos((2.0 * kx)))) + (ky * ky)))) * Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 0.235: tmp = (th / math.hypot(math.sin(kx), math.sin(ky))) * math.sin(ky) else: tmp = (math.sin(ky) / math.sqrt(((0.5 - (0.5 * math.cos((2.0 * kx)))) + (ky * ky)))) * math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 0.235) tmp = Float64(Float64(th / hypot(sin(kx), sin(ky))) * sin(ky)); else tmp = Float64(Float64(sin(ky) / sqrt(Float64(Float64(0.5 - Float64(0.5 * cos(Float64(2.0 * kx)))) + Float64(ky * ky)))) * sin(th)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 0.235) tmp = (th / hypot(sin(kx), sin(ky))) * sin(ky); else tmp = (sin(ky) / sqrt(((0.5 - (0.5 * cos((2.0 * kx)))) + (ky * ky)))) * sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 0.235], N[(N[(th / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[ky], $MachinePrecision]), $MachinePrecision], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[(0.5 - N[(0.5 * N[Cos[N[(2.0 * kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(ky * ky), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 0.235:\\
\;\;\;\;\frac{th}{\mathsf{hypot}\left(\sin kx, \sin ky\right)} \cdot \sin ky\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right) + ky \cdot ky}} \cdot \sin th\\
\end{array}
\end{array}
if th < 0.23499999999999999Initial program 92.8%
Taylor expanded in th around 0
lower-*.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
unpow2N/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-pow.f64N/A
lower-sin.f6456.8
Applied rewrites56.8%
Applied rewrites64.4%
if 0.23499999999999999 < th Initial program 92.7%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6443.7
Applied rewrites43.7%
lift-pow.f64N/A
pow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sqr-sin-aN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
count-2N/A
lower-cos.f64N/A
count-2N/A
lower-*.f6438.2
Applied rewrites38.2%
Final simplification57.1%
(FPCore (kx ky th) :precision binary64 0.0)
double code(double kx, double ky, double th) {
return 0.0;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = 0.0d0
end function
public static double code(double kx, double ky, double th) {
return 0.0;
}
def code(kx, ky, th): return 0.0
function code(kx, ky, th) return 0.0 end
function tmp = code(kx, ky, th) tmp = 0.0; end
code[kx_, ky_, th_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 92.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6490.3
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6494.7
Applied rewrites94.7%
Taylor expanded in ky around 0
lower-sin.f6424.7
Applied rewrites24.7%
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-subN/A
div-subN/A
lower--.f64N/A
Applied rewrites12.5%
Taylor expanded in th around 0
cos-negN/A
+-inverses12.1
Applied rewrites12.1%
herbie shell --seed 2024273
(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)))