
(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 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.2%
lift-sin.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6499.6
Applied rewrites99.6%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (* ky (fma (* ky ky) -0.16666666666666666 1.0)))
(t_2 (cos (+ ky ky)))
(t_3 (* (sin th) (/ t_1 (hypot t_1 (sin kx)))))
(t_4 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))))
(t_5 (sqrt (fma (- 1.0 (cos (+ kx kx))) 0.5 (+ 0.5 (* -0.5 t_2))))))
(if (<= t_4 -0.9998)
(* (sin th) (/ (sin ky) (sqrt (fma kx kx (fma t_2 -0.5 0.5)))))
(if (<= t_4 -0.002)
(/ (* th (* (sin ky) (fma -0.16666666666666666 (* th th) 1.0))) t_5)
(if (<= t_4 1e-11)
t_3
(if (<= t_4 0.92)
(/ (* (sin ky) th) t_5)
(if (<= t_4 1.0) (sin th) t_3)))))))
double code(double kx, double ky, double th) {
double t_1 = ky * fma((ky * ky), -0.16666666666666666, 1.0);
double t_2 = cos((ky + ky));
double t_3 = sin(th) * (t_1 / hypot(t_1, sin(kx)));
double t_4 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double t_5 = sqrt(fma((1.0 - cos((kx + kx))), 0.5, (0.5 + (-0.5 * t_2))));
double tmp;
if (t_4 <= -0.9998) {
tmp = sin(th) * (sin(ky) / sqrt(fma(kx, kx, fma(t_2, -0.5, 0.5))));
} else if (t_4 <= -0.002) {
tmp = (th * (sin(ky) * fma(-0.16666666666666666, (th * th), 1.0))) / t_5;
} else if (t_4 <= 1e-11) {
tmp = t_3;
} else if (t_4 <= 0.92) {
tmp = (sin(ky) * th) / t_5;
} else if (t_4 <= 1.0) {
tmp = sin(th);
} else {
tmp = t_3;
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(ky * fma(Float64(ky * ky), -0.16666666666666666, 1.0)) t_2 = cos(Float64(ky + ky)) t_3 = Float64(sin(th) * Float64(t_1 / hypot(t_1, sin(kx)))) t_4 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) t_5 = sqrt(fma(Float64(1.0 - cos(Float64(kx + kx))), 0.5, Float64(0.5 + Float64(-0.5 * t_2)))) tmp = 0.0 if (t_4 <= -0.9998) tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(fma(kx, kx, fma(t_2, -0.5, 0.5))))); elseif (t_4 <= -0.002) tmp = Float64(Float64(th * Float64(sin(ky) * fma(-0.16666666666666666, Float64(th * th), 1.0))) / t_5); elseif (t_4 <= 1e-11) tmp = t_3; elseif (t_4 <= 0.92) tmp = Float64(Float64(sin(ky) * th) / t_5); elseif (t_4 <= 1.0) tmp = sin(th); else tmp = t_3; end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(ky * N[(N[(ky * ky), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[Sin[th], $MachinePrecision] * N[(t$95$1 / N[Sqrt[t$95$1 ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[Sqrt[N[(N[(1.0 - N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5 + N[(0.5 + N[(-0.5 * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$4, -0.9998], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(kx * kx + N[(t$95$2 * -0.5 + 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, -0.002], N[(N[(th * N[(N[Sin[ky], $MachinePrecision] * N[(-0.16666666666666666 * N[(th * th), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$5), $MachinePrecision], If[LessEqual[t$95$4, 1e-11], t$95$3, If[LessEqual[t$95$4, 0.92], N[(N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision] / t$95$5), $MachinePrecision], If[LessEqual[t$95$4, 1.0], N[Sin[th], $MachinePrecision], t$95$3]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := ky \cdot \mathsf{fma}\left(ky \cdot ky, -0.16666666666666666, 1\right)\\
t_2 := \cos \left(ky + ky\right)\\
t_3 := \sin th \cdot \frac{t\_1}{\mathsf{hypot}\left(t\_1, \sin kx\right)}\\
t_4 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
t_5 := \sqrt{\mathsf{fma}\left(1 - \cos \left(kx + kx\right), 0.5, 0.5 + -0.5 \cdot t\_2\right)}\\
\mathbf{if}\;t\_4 \leq -0.9998:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{\mathsf{fma}\left(kx, kx, \mathsf{fma}\left(t\_2, -0.5, 0.5\right)\right)}}\\
\mathbf{elif}\;t\_4 \leq -0.002:\\
\;\;\;\;\frac{th \cdot \left(\sin ky \cdot \mathsf{fma}\left(-0.16666666666666666, th \cdot th, 1\right)\right)}{t\_5}\\
\mathbf{elif}\;t\_4 \leq 10^{-11}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_4 \leq 0.92:\\
\;\;\;\;\frac{\sin ky \cdot th}{t\_5}\\
\mathbf{elif}\;t\_4 \leq 1:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.99980000000000002Initial program 84.8%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6484.8
Applied rewrites84.8%
Applied rewrites64.6%
if -0.99980000000000002 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -2e-3Initial program 99.2%
Applied rewrites99.4%
Taylor expanded in th around 0
lower-*.f64N/A
associate-*r*N/A
distribute-rgt1-inN/A
+-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
lower-sin.f6452.4
Applied rewrites52.4%
if -2e-3 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 9.99999999999999939e-12 or 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 95.1%
lift-sin.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6499.6
Applied rewrites99.6%
Taylor expanded in ky around 0
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6499.6
Applied rewrites99.6%
Taylor expanded in ky around 0
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6499.6
Applied rewrites99.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))))) < 0.92000000000000004Initial program 99.0%
Applied rewrites99.4%
Taylor expanded in th around 0
lower-*.f64N/A
lower-sin.f6462.5
Applied rewrites62.5%
if 0.92000000000000004 < (/.f64 (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 100.0%
Taylor expanded in kx around 0
lower-sin.f6493.9
Applied rewrites93.9%
Final simplification81.3%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (* ky (fma (* ky ky) -0.16666666666666666 1.0)))
(t_2 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))))
(t_3 (cos (+ ky ky)))
(t_4 (sqrt (fma (- 1.0 (cos (+ kx kx))) 0.5 (+ 0.5 (* -0.5 t_3)))))
(t_5 (* (sin th) (/ t_1 (hypot t_1 (sin kx))))))
(if (<= t_2 -0.9998)
(* (sin th) (/ (sin ky) (sqrt (fma kx kx (fma t_3 -0.5 0.5)))))
(if (<= t_2 -0.002)
(* (/ (sin ky) t_4) (fma th (* -0.16666666666666666 (* th th)) th))
(if (<= t_2 1e-11)
t_5
(if (<= t_2 0.92)
(/ (* (sin ky) th) t_4)
(if (<= t_2 1.0) (sin th) t_5)))))))
double code(double kx, double ky, double th) {
double t_1 = ky * fma((ky * ky), -0.16666666666666666, 1.0);
double t_2 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double t_3 = cos((ky + ky));
double t_4 = sqrt(fma((1.0 - cos((kx + kx))), 0.5, (0.5 + (-0.5 * t_3))));
double t_5 = sin(th) * (t_1 / hypot(t_1, sin(kx)));
double tmp;
if (t_2 <= -0.9998) {
tmp = sin(th) * (sin(ky) / sqrt(fma(kx, kx, fma(t_3, -0.5, 0.5))));
} else if (t_2 <= -0.002) {
tmp = (sin(ky) / t_4) * fma(th, (-0.16666666666666666 * (th * th)), th);
} else if (t_2 <= 1e-11) {
tmp = t_5;
} else if (t_2 <= 0.92) {
tmp = (sin(ky) * th) / t_4;
} else if (t_2 <= 1.0) {
tmp = sin(th);
} else {
tmp = t_5;
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(ky * fma(Float64(ky * ky), -0.16666666666666666, 1.0)) t_2 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) t_3 = cos(Float64(ky + ky)) t_4 = sqrt(fma(Float64(1.0 - cos(Float64(kx + kx))), 0.5, Float64(0.5 + Float64(-0.5 * t_3)))) t_5 = Float64(sin(th) * Float64(t_1 / hypot(t_1, sin(kx)))) tmp = 0.0 if (t_2 <= -0.9998) tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(fma(kx, kx, fma(t_3, -0.5, 0.5))))); elseif (t_2 <= -0.002) tmp = Float64(Float64(sin(ky) / t_4) * fma(th, Float64(-0.16666666666666666 * Float64(th * th)), th)); elseif (t_2 <= 1e-11) tmp = t_5; elseif (t_2 <= 0.92) tmp = Float64(Float64(sin(ky) * th) / t_4); elseif (t_2 <= 1.0) tmp = sin(th); else tmp = t_5; end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(ky * N[(N[(ky * ky), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[(N[(1.0 - N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5 + N[(0.5 + N[(-0.5 * t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$5 = N[(N[Sin[th], $MachinePrecision] * N[(t$95$1 / N[Sqrt[t$95$1 ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -0.9998], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(kx * kx + N[(t$95$3 * -0.5 + 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -0.002], N[(N[(N[Sin[ky], $MachinePrecision] / t$95$4), $MachinePrecision] * N[(th * N[(-0.16666666666666666 * N[(th * th), $MachinePrecision]), $MachinePrecision] + th), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e-11], t$95$5, If[LessEqual[t$95$2, 0.92], N[(N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision] / t$95$4), $MachinePrecision], If[LessEqual[t$95$2, 1.0], N[Sin[th], $MachinePrecision], t$95$5]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := ky \cdot \mathsf{fma}\left(ky \cdot ky, -0.16666666666666666, 1\right)\\
t_2 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
t_3 := \cos \left(ky + ky\right)\\
t_4 := \sqrt{\mathsf{fma}\left(1 - \cos \left(kx + kx\right), 0.5, 0.5 + -0.5 \cdot t\_3\right)}\\
t_5 := \sin th \cdot \frac{t\_1}{\mathsf{hypot}\left(t\_1, \sin kx\right)}\\
\mathbf{if}\;t\_2 \leq -0.9998:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{\mathsf{fma}\left(kx, kx, \mathsf{fma}\left(t\_3, -0.5, 0.5\right)\right)}}\\
\mathbf{elif}\;t\_2 \leq -0.002:\\
\;\;\;\;\frac{\sin ky}{t\_4} \cdot \mathsf{fma}\left(th, -0.16666666666666666 \cdot \left(th \cdot th\right), th\right)\\
\mathbf{elif}\;t\_2 \leq 10^{-11}:\\
\;\;\;\;t\_5\\
\mathbf{elif}\;t\_2 \leq 0.92:\\
\;\;\;\;\frac{\sin ky \cdot th}{t\_4}\\
\mathbf{elif}\;t\_2 \leq 1:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;t\_5\\
\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.99980000000000002Initial program 84.8%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6484.8
Applied rewrites84.8%
Applied rewrites64.6%
if -0.99980000000000002 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -2e-3Initial program 99.2%
lift-sin.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-sqrt.f6499.2
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.2%
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-*.f6452.2
Applied rewrites52.2%
if -2e-3 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 9.99999999999999939e-12 or 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 95.1%
lift-sin.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6499.6
Applied rewrites99.6%
Taylor expanded in ky around 0
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6499.6
Applied rewrites99.6%
Taylor expanded in ky around 0
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6499.6
Applied rewrites99.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))))) < 0.92000000000000004Initial program 99.0%
Applied rewrites99.4%
Taylor expanded in th around 0
lower-*.f64N/A
lower-sin.f6462.5
Applied rewrites62.5%
if 0.92000000000000004 < (/.f64 (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 100.0%
Taylor expanded in kx around 0
lower-sin.f6493.9
Applied rewrites93.9%
Final simplification81.3%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))))
(t_2 (cos (+ ky ky)))
(t_3 (* ky (fma (* ky ky) -0.16666666666666666 1.0)))
(t_4 (* (sin th) (/ t_3 (hypot t_3 (sin kx)))))
(t_5
(/
(* (sin ky) th)
(sqrt (fma (- 1.0 (cos (+ kx kx))) 0.5 (+ 0.5 (* -0.5 t_2)))))))
(if (<= t_1 -0.9998)
(* (sin th) (/ (sin ky) (sqrt (fma kx kx (fma t_2 -0.5 0.5)))))
(if (<= t_1 -0.002)
t_5
(if (<= t_1 1e-11)
t_4
(if (<= t_1 0.92) t_5 (if (<= t_1 1.0) (sin th) t_4)))))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double t_2 = cos((ky + ky));
double t_3 = ky * fma((ky * ky), -0.16666666666666666, 1.0);
double t_4 = sin(th) * (t_3 / hypot(t_3, sin(kx)));
double t_5 = (sin(ky) * th) / sqrt(fma((1.0 - cos((kx + kx))), 0.5, (0.5 + (-0.5 * t_2))));
double tmp;
if (t_1 <= -0.9998) {
tmp = sin(th) * (sin(ky) / sqrt(fma(kx, kx, fma(t_2, -0.5, 0.5))));
} else if (t_1 <= -0.002) {
tmp = t_5;
} else if (t_1 <= 1e-11) {
tmp = t_4;
} else if (t_1 <= 0.92) {
tmp = t_5;
} else if (t_1 <= 1.0) {
tmp = sin(th);
} else {
tmp = t_4;
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) t_2 = cos(Float64(ky + ky)) t_3 = Float64(ky * fma(Float64(ky * ky), -0.16666666666666666, 1.0)) t_4 = Float64(sin(th) * Float64(t_3 / hypot(t_3, sin(kx)))) t_5 = Float64(Float64(sin(ky) * th) / sqrt(fma(Float64(1.0 - cos(Float64(kx + kx))), 0.5, Float64(0.5 + Float64(-0.5 * t_2))))) tmp = 0.0 if (t_1 <= -0.9998) tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(fma(kx, kx, fma(t_2, -0.5, 0.5))))); elseif (t_1 <= -0.002) tmp = t_5; elseif (t_1 <= 1e-11) tmp = t_4; elseif (t_1 <= 0.92) tmp = t_5; elseif (t_1 <= 1.0) tmp = sin(th); else tmp = t_4; end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(ky * N[(N[(ky * ky), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[Sin[th], $MachinePrecision] * N[(t$95$3 / N[Sqrt[t$95$3 ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision] / N[Sqrt[N[(N[(1.0 - N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5 + N[(0.5 + N[(-0.5 * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -0.9998], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(kx * kx + N[(t$95$2 * -0.5 + 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -0.002], t$95$5, If[LessEqual[t$95$1, 1e-11], t$95$4, If[LessEqual[t$95$1, 0.92], t$95$5, If[LessEqual[t$95$1, 1.0], N[Sin[th], $MachinePrecision], t$95$4]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
t_2 := \cos \left(ky + ky\right)\\
t_3 := ky \cdot \mathsf{fma}\left(ky \cdot ky, -0.16666666666666666, 1\right)\\
t_4 := \sin th \cdot \frac{t\_3}{\mathsf{hypot}\left(t\_3, \sin kx\right)}\\
t_5 := \frac{\sin ky \cdot th}{\sqrt{\mathsf{fma}\left(1 - \cos \left(kx + kx\right), 0.5, 0.5 + -0.5 \cdot t\_2\right)}}\\
\mathbf{if}\;t\_1 \leq -0.9998:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{\mathsf{fma}\left(kx, kx, \mathsf{fma}\left(t\_2, -0.5, 0.5\right)\right)}}\\
\mathbf{elif}\;t\_1 \leq -0.002:\\
\;\;\;\;t\_5\\
\mathbf{elif}\;t\_1 \leq 10^{-11}:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;t\_1 \leq 0.92:\\
\;\;\;\;t\_5\\
\mathbf{elif}\;t\_1 \leq 1:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;t\_4\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.99980000000000002Initial program 84.8%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6484.8
Applied rewrites84.8%
Applied rewrites64.6%
if -0.99980000000000002 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -2e-3 or 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))))) < 0.92000000000000004Initial program 99.2%
Applied rewrites99.4%
Taylor expanded in th around 0
lower-*.f64N/A
lower-sin.f6455.9
Applied rewrites55.9%
if -2e-3 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 9.99999999999999939e-12 or 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 95.1%
lift-sin.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6499.6
Applied rewrites99.6%
Taylor expanded in ky around 0
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6499.6
Applied rewrites99.6%
Taylor expanded in ky around 0
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6499.6
Applied rewrites99.6%
if 0.92000000000000004 < (/.f64 (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 100.0%
Taylor expanded in kx around 0
lower-sin.f6493.9
Applied rewrites93.9%
Final simplification81.3%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (* (sin th) (/ (sin ky) (hypot (sin ky) kx))))
(t_2 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))))
(t_3
(sqrt
(fma (- 1.0 (cos (+ kx kx))) 0.5 (+ 0.5 (* -0.5 (cos (+ ky ky)))))))
(t_4 (* ky (fma (* ky ky) -0.16666666666666666 1.0))))
(if (<= t_2 -0.9998)
t_1
(if (<= t_2 -0.002)
(/ (* th (* (sin ky) (fma -0.16666666666666666 (* th th) 1.0))) t_3)
(if (<= t_2 1e-11)
(* (sin th) (/ t_4 (hypot t_4 (sin kx))))
(if (<= t_2 0.996) (/ (* (sin ky) th) t_3) t_1))))))
double code(double kx, double ky, double th) {
double t_1 = sin(th) * (sin(ky) / hypot(sin(ky), kx));
double t_2 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double t_3 = sqrt(fma((1.0 - cos((kx + kx))), 0.5, (0.5 + (-0.5 * cos((ky + ky))))));
double t_4 = ky * fma((ky * ky), -0.16666666666666666, 1.0);
double tmp;
if (t_2 <= -0.9998) {
tmp = t_1;
} else if (t_2 <= -0.002) {
tmp = (th * (sin(ky) * fma(-0.16666666666666666, (th * th), 1.0))) / t_3;
} else if (t_2 <= 1e-11) {
tmp = sin(th) * (t_4 / hypot(t_4, sin(kx)));
} else if (t_2 <= 0.996) {
tmp = (sin(ky) * th) / t_3;
} else {
tmp = t_1;
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), kx))) t_2 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) t_3 = sqrt(fma(Float64(1.0 - cos(Float64(kx + kx))), 0.5, Float64(0.5 + Float64(-0.5 * cos(Float64(ky + ky)))))) t_4 = Float64(ky * fma(Float64(ky * ky), -0.16666666666666666, 1.0)) tmp = 0.0 if (t_2 <= -0.9998) tmp = t_1; elseif (t_2 <= -0.002) tmp = Float64(Float64(th * Float64(sin(ky) * fma(-0.16666666666666666, Float64(th * th), 1.0))) / t_3); elseif (t_2 <= 1e-11) tmp = Float64(sin(th) * Float64(t_4 / hypot(t_4, sin(kx)))); elseif (t_2 <= 0.996) tmp = Float64(Float64(sin(ky) * th) / 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[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(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]}, Block[{t$95$4 = N[(ky * N[(N[(ky * ky), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -0.9998], t$95$1, If[LessEqual[t$95$2, -0.002], N[(N[(th * N[(N[Sin[ky], $MachinePrecision] * N[(-0.16666666666666666 * N[(th * th), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$3), $MachinePrecision], If[LessEqual[t$95$2, 1e-11], N[(N[Sin[th], $MachinePrecision] * N[(t$95$4 / N[Sqrt[t$95$4 ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.996], N[(N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision] / t$95$3), $MachinePrecision], t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, kx\right)}\\
t_2 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
t_3 := \sqrt{\mathsf{fma}\left(1 - \cos \left(kx + kx\right), 0.5, 0.5 + -0.5 \cdot \cos \left(ky + ky\right)\right)}\\
t_4 := ky \cdot \mathsf{fma}\left(ky \cdot ky, -0.16666666666666666, 1\right)\\
\mathbf{if}\;t\_2 \leq -0.9998:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq -0.002:\\
\;\;\;\;\frac{th \cdot \left(\sin ky \cdot \mathsf{fma}\left(-0.16666666666666666, th \cdot th, 1\right)\right)}{t\_3}\\
\mathbf{elif}\;t\_2 \leq 10^{-11}:\\
\;\;\;\;\sin th \cdot \frac{t\_4}{\mathsf{hypot}\left(t\_4, \sin kx\right)}\\
\mathbf{elif}\;t\_2 \leq 0.996:\\
\;\;\;\;\frac{\sin ky \cdot th}{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.99980000000000002 or 0.996 < (/.f64 (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 88.2%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6486.2
Applied rewrites86.2%
lift-*.f64N/A
lift-sin.f64N/A
pow2N/A
+-commutativeN/A
lift-*.f64N/A
lower-hypot.f6497.9
Applied rewrites97.9%
if -0.99980000000000002 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -2e-3Initial program 99.2%
Applied rewrites99.4%
Taylor expanded in th around 0
lower-*.f64N/A
associate-*r*N/A
distribute-rgt1-inN/A
+-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
lower-sin.f6452.4
Applied rewrites52.4%
if -2e-3 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 9.99999999999999939e-12Initial program 99.6%
lift-sin.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6499.6
Applied rewrites99.6%
Taylor expanded in ky around 0
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6499.6
Applied rewrites99.6%
Taylor expanded in ky around 0
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6499.6
Applied rewrites99.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))))) < 0.996Initial program 99.1%
Applied rewrites99.5%
Taylor expanded in th around 0
lower-*.f64N/A
lower-sin.f6461.6
Applied rewrites61.6%
Final simplification87.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.7)
(* (sin th) (/ (sin ky) (sqrt (fma -0.5 (cos (* ky -2.0)) 0.5))))
(if (<= t_1 4e-206)
(* (sin th) (/ (sin ky) (sqrt (* 0.5 (- 1.0 (cos (* kx -2.0)))))))
(if (<= t_1 7e-8) (* 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.7) {
tmp = sin(th) * (sin(ky) / sqrt(fma(-0.5, cos((ky * -2.0)), 0.5)));
} else if (t_1 <= 4e-206) {
tmp = sin(th) * (sin(ky) / sqrt((0.5 * (1.0 - cos((kx * -2.0))))));
} else if (t_1 <= 7e-8) {
tmp = 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.7) tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(fma(-0.5, cos(Float64(ky * -2.0)), 0.5)))); elseif (t_1 <= 4e-206) tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(Float64(0.5 * Float64(1.0 - cos(Float64(kx * -2.0))))))); elseif (t_1 <= 7e-8) tmp = Float64(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.7], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 4e-206], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(0.5 * N[(1.0 - N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 7e-8], N[(ky * 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.7:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{\mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), 0.5\right)}}\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{-206}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{0.5 \cdot \left(1 - \cos \left(kx \cdot -2\right)\right)}}\\
\mathbf{elif}\;t\_1 \leq 7 \cdot 10^{-8}:\\
\;\;\;\;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.69999999999999996Initial program 89.3%
lift-sin.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-sqrt.f6489.3
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 rewrites75.0%
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-*.f6451.2
Applied rewrites51.2%
if -0.69999999999999996 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 4.00000000000000011e-206Initial program 99.5%
lift-sin.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-sqrt.f6499.5
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 rewrites76.6%
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.0
Applied rewrites59.0%
if 4.00000000000000011e-206 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 7.00000000000000048e-8Initial program 99.6%
Taylor expanded in ky around 0
lower-*.f64N/A
distribute-lft-inN/A
associate-+l+N/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites55.0%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-sin.f64N/A
lower-sin.f6454.8
Applied rewrites54.8%
if 7.00000000000000048e-8 < (/.f64 (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.8%
Taylor expanded in kx around 0
lower-sin.f6467.7
Applied rewrites67.7%
Final simplification59.1%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
(if (<= t_1 -0.002)
(* (sin th) (/ (sin ky) (sqrt (fma -0.5 (cos (* ky -2.0)) 0.5))))
(if (<= t_1 4e-206)
(/ (* ky (sin th)) (sqrt (fma (- 1.0 (cos (+ kx kx))) 0.5 (* ky ky))))
(if (<= t_1 7e-8) (* 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.002) {
tmp = sin(th) * (sin(ky) / sqrt(fma(-0.5, cos((ky * -2.0)), 0.5)));
} else if (t_1 <= 4e-206) {
tmp = (ky * sin(th)) / sqrt(fma((1.0 - cos((kx + kx))), 0.5, (ky * ky)));
} else if (t_1 <= 7e-8) {
tmp = 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.002) tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(fma(-0.5, cos(Float64(ky * -2.0)), 0.5)))); elseif (t_1 <= 4e-206) tmp = Float64(Float64(ky * sin(th)) / sqrt(fma(Float64(1.0 - cos(Float64(kx + kx))), 0.5, Float64(ky * ky)))); elseif (t_1 <= 7e-8) tmp = Float64(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.002], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 4e-206], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(N[(1.0 - N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5 + N[(ky * ky), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 7e-8], N[(ky * 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.002:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{\mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), 0.5\right)}}\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{-206}:\\
\;\;\;\;\frac{ky \cdot \sin th}{\sqrt{\mathsf{fma}\left(1 - \cos \left(kx + kx\right), 0.5, ky \cdot ky\right)}}\\
\mathbf{elif}\;t\_1 \leq 7 \cdot 10^{-8}:\\
\;\;\;\;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))))) < -2e-3Initial program 91.7%
lift-sin.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-sqrt.f6491.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 rewrites80.9%
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-*.f6443.0
Applied rewrites43.0%
if -2e-3 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 4.00000000000000011e-206Initial program 99.6%
Applied rewrites69.1%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6470.5
Applied rewrites70.5%
Taylor expanded in ky around 0
lower-*.f64N/A
lower-sin.f6470.5
Applied rewrites70.5%
if 4.00000000000000011e-206 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 7.00000000000000048e-8Initial program 99.6%
Taylor expanded in ky around 0
lower-*.f64N/A
distribute-lft-inN/A
associate-+l+N/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites55.0%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-sin.f64N/A
lower-sin.f6454.8
Applied rewrites54.8%
if 7.00000000000000048e-8 < (/.f64 (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.8%
Taylor expanded in kx around 0
lower-sin.f6467.7
Applied rewrites67.7%
Final simplification58.7%
(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.002)
(/ (* (sin ky) th) (* (sqrt (- 1.0 (cos (* kx -2.0)))) (sqrt 0.5)))
(if (<= t_1 4e-206)
(/ (* ky (sin th)) (sqrt (fma (- 1.0 (cos (+ kx kx))) 0.5 (* ky ky))))
(if (<= t_1 7e-8) (* 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.002) {
tmp = (sin(ky) * th) / (sqrt((1.0 - cos((kx * -2.0)))) * sqrt(0.5));
} else if (t_1 <= 4e-206) {
tmp = (ky * sin(th)) / sqrt(fma((1.0 - cos((kx + kx))), 0.5, (ky * ky)));
} else if (t_1 <= 7e-8) {
tmp = 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.002) tmp = Float64(Float64(sin(ky) * th) / Float64(sqrt(Float64(1.0 - cos(Float64(kx * -2.0)))) * sqrt(0.5))); elseif (t_1 <= 4e-206) tmp = Float64(Float64(ky * sin(th)) / sqrt(fma(Float64(1.0 - cos(Float64(kx + kx))), 0.5, Float64(ky * ky)))); elseif (t_1 <= 7e-8) tmp = Float64(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.002], N[(N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision] / N[(N[Sqrt[N[(1.0 - N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 4e-206], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(N[(1.0 - N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5 + N[(ky * ky), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 7e-8], N[(ky * 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.002:\\
\;\;\;\;\frac{\sin ky \cdot th}{\sqrt{1 - \cos \left(kx \cdot -2\right)} \cdot \sqrt{0.5}}\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{-206}:\\
\;\;\;\;\frac{ky \cdot \sin th}{\sqrt{\mathsf{fma}\left(1 - \cos \left(kx + kx\right), 0.5, ky \cdot ky\right)}}\\
\mathbf{elif}\;t\_1 \leq 7 \cdot 10^{-8}:\\
\;\;\;\;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))))) < -2e-3Initial program 91.7%
Applied rewrites80.8%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower--.f64N/A
cos-negN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f6412.3
Applied rewrites12.3%
Taylor expanded in th around 0
lower-*.f64N/A
lower-sin.f647.6
Applied rewrites7.6%
if -2e-3 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 4.00000000000000011e-206Initial program 99.6%
Applied rewrites69.1%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6470.5
Applied rewrites70.5%
Taylor expanded in ky around 0
lower-*.f64N/A
lower-sin.f6470.5
Applied rewrites70.5%
if 4.00000000000000011e-206 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 7.00000000000000048e-8Initial program 99.6%
Taylor expanded in ky around 0
lower-*.f64N/A
distribute-lft-inN/A
associate-+l+N/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites55.0%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-sin.f64N/A
lower-sin.f6454.8
Applied rewrites54.8%
if 7.00000000000000048e-8 < (/.f64 (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.8%
Taylor expanded in kx around 0
lower-sin.f6467.7
Applied rewrites67.7%
Final simplification46.8%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
(if (<= t_1 4e-206)
(/ (* ky (sin th)) (sqrt (fma (- 1.0 (cos (+ kx kx))) 0.5 (* ky ky))))
(if (<= t_1 7e-8) (* 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 <= 4e-206) {
tmp = (ky * sin(th)) / sqrt(fma((1.0 - cos((kx + kx))), 0.5, (ky * ky)));
} else if (t_1 <= 7e-8) {
tmp = 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 <= 4e-206) tmp = Float64(Float64(ky * sin(th)) / sqrt(fma(Float64(1.0 - cos(Float64(kx + kx))), 0.5, Float64(ky * ky)))); elseif (t_1 <= 7e-8) tmp = Float64(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, 4e-206], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(N[(1.0 - N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5 + N[(ky * ky), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 7e-8], N[(ky * 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 4 \cdot 10^{-206}:\\
\;\;\;\;\frac{ky \cdot \sin th}{\sqrt{\mathsf{fma}\left(1 - \cos \left(kx + kx\right), 0.5, ky \cdot ky\right)}}\\
\mathbf{elif}\;t\_1 \leq 7 \cdot 10^{-8}:\\
\;\;\;\;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))))) < 4.00000000000000011e-206Initial program 95.1%
Applied rewrites75.8%
Taylor expanded in ky around 0
unpow2N/A
lower-*.f6438.7
Applied rewrites38.7%
Taylor expanded in ky around 0
lower-*.f64N/A
lower-sin.f6442.4
Applied rewrites42.4%
if 4.00000000000000011e-206 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 7.00000000000000048e-8Initial program 99.6%
Taylor expanded in ky around 0
lower-*.f64N/A
distribute-lft-inN/A
associate-+l+N/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites55.0%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-sin.f64N/A
lower-sin.f6454.8
Applied rewrites54.8%
if 7.00000000000000048e-8 < (/.f64 (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.8%
Taylor expanded in kx around 0
lower-sin.f6467.7
Applied rewrites67.7%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 0.1) (* (sin th) (/ (sin ky) (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) <= 0.1) {
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) :: tmp
if ((sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) <= 0.1d0) 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 tmp;
if ((Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) <= 0.1) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) <= 0.1: tmp = math.sin(th) * (math.sin(ky) / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 0.1) tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 0.1) tmp = sin(th) * (sin(ky) / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 0.1], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 0.1:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.10000000000000001Initial program 95.9%
Taylor expanded in ky around 0
lower-sin.f6436.7
Applied rewrites36.7%
if 0.10000000000000001 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 93.5%
Taylor expanded in kx around 0
lower-sin.f6471.4
Applied rewrites71.4%
Final simplification46.4%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (pow (sin kx) 2.0)))
(if (<= t_1 5e-311)
(sin th)
(if (<= t_1 5e-12)
(/
(sin th)
(/ (sqrt (fma kx kx (fma (cos (+ ky ky)) -0.5 0.5))) (sin ky)))
(* (sin th) (/ (sin ky) (sqrt (* 0.5 (- 1.0 (cos (* kx -2.0)))))))))))
double code(double kx, double ky, double th) {
double t_1 = pow(sin(kx), 2.0);
double tmp;
if (t_1 <= 5e-311) {
tmp = sin(th);
} else if (t_1 <= 5e-12) {
tmp = sin(th) / (sqrt(fma(kx, kx, fma(cos((ky + ky)), -0.5, 0.5))) / sin(ky));
} else {
tmp = sin(th) * (sin(ky) / sqrt((0.5 * (1.0 - cos((kx * -2.0))))));
}
return tmp;
}
function code(kx, ky, th) t_1 = sin(kx) ^ 2.0 tmp = 0.0 if (t_1 <= 5e-311) tmp = sin(th); elseif (t_1 <= 5e-12) tmp = Float64(sin(th) / Float64(sqrt(fma(kx, kx, fma(cos(Float64(ky + ky)), -0.5, 0.5))) / sin(ky))); else tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(Float64(0.5 * Float64(1.0 - cos(Float64(kx * -2.0))))))); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[t$95$1, 5e-311], N[Sin[th], $MachinePrecision], If[LessEqual[t$95$1, 5e-12], N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[N[(kx * kx + N[(N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision] * -0.5 + 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(0.5 * N[(1.0 - N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := {\sin kx}^{2}\\
\mathbf{if}\;t\_1 \leq 5 \cdot 10^{-311}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{-12}:\\
\;\;\;\;\frac{\sin th}{\frac{\sqrt{\mathsf{fma}\left(kx, kx, \mathsf{fma}\left(\cos \left(ky + ky\right), -0.5, 0.5\right)\right)}}{\sin ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{0.5 \cdot \left(1 - \cos \left(kx \cdot -2\right)\right)}}\\
\end{array}
\end{array}
if (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) < 5.00000000000023e-311Initial program 78.7%
Taylor expanded in kx around 0
lower-sin.f6454.4
Applied rewrites54.4%
if 5.00000000000023e-311 < (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) < 4.9999999999999997e-12Initial program 99.9%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6499.9
Applied rewrites99.9%
Applied rewrites91.2%
if 4.9999999999999997e-12 < (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) Initial program 99.3%
lift-sin.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-sqrt.f6499.3
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.0%
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-*.f6461.0
Applied rewrites61.0%
Final simplification67.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (pow (sin kx) 2.0)))
(if (<= t_1 5e-311)
(sin th)
(if (<= t_1 5e-12)
(*
(sin th)
(/ (sin ky) (sqrt (fma kx kx (fma (cos (+ ky ky)) -0.5 0.5)))))
(* (sin th) (/ (sin ky) (sqrt (* 0.5 (- 1.0 (cos (* kx -2.0)))))))))))
double code(double kx, double ky, double th) {
double t_1 = pow(sin(kx), 2.0);
double tmp;
if (t_1 <= 5e-311) {
tmp = sin(th);
} else if (t_1 <= 5e-12) {
tmp = sin(th) * (sin(ky) / sqrt(fma(kx, kx, fma(cos((ky + ky)), -0.5, 0.5))));
} else {
tmp = sin(th) * (sin(ky) / sqrt((0.5 * (1.0 - cos((kx * -2.0))))));
}
return tmp;
}
function code(kx, ky, th) t_1 = sin(kx) ^ 2.0 tmp = 0.0 if (t_1 <= 5e-311) tmp = sin(th); elseif (t_1 <= 5e-12) tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(fma(kx, kx, fma(cos(Float64(ky + ky)), -0.5, 0.5))))); else tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(Float64(0.5 * Float64(1.0 - cos(Float64(kx * -2.0))))))); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[t$95$1, 5e-311], N[Sin[th], $MachinePrecision], If[LessEqual[t$95$1, 5e-12], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(kx * kx + N[(N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision] * -0.5 + 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(0.5 * N[(1.0 - N[Cos[N[(kx * -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := {\sin kx}^{2}\\
\mathbf{if}\;t\_1 \leq 5 \cdot 10^{-311}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{-12}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{\mathsf{fma}\left(kx, kx, \mathsf{fma}\left(\cos \left(ky + ky\right), -0.5, 0.5\right)\right)}}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{0.5 \cdot \left(1 - \cos \left(kx \cdot -2\right)\right)}}\\
\end{array}
\end{array}
if (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) < 5.00000000000023e-311Initial program 78.7%
Taylor expanded in kx around 0
lower-sin.f6454.4
Applied rewrites54.4%
if 5.00000000000023e-311 < (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) < 4.9999999999999997e-12Initial program 99.9%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6499.9
Applied rewrites99.9%
Applied rewrites91.2%
if 4.9999999999999997e-12 < (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) Initial program 99.3%
lift-sin.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-sqrt.f6499.3
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.0%
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-*.f6461.0
Applied rewrites61.0%
Final simplification67.7%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 7e-8) (* 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)))) <= 7e-8) {
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)))) <= 7d-8) 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)))) <= 7e-8) {
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)))) <= 7e-8: 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)))) <= 7e-8) tmp = Float64(ky * Float64(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)))) <= 7e-8) 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], 7e-8], N[(ky * N[(N[Sin[th], $MachinePrecision] / 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 7 \cdot 10^{-8}:\\
\;\;\;\;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))))) < 7.00000000000000048e-8Initial program 95.8%
Taylor expanded in ky around 0
lower-*.f64N/A
distribute-lft-inN/A
associate-+l+N/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites30.7%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-sin.f64N/A
lower-sin.f6435.0
Applied rewrites35.0%
if 7.00000000000000048e-8 < (/.f64 (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.8%
Taylor expanded in kx around 0
lower-sin.f6467.7
Applied rewrites67.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (pow (sin kx) 2.0) 4e-14)
(* (sin th) (/ (sin ky) (hypot (sin ky) kx)))
(*
(sin th)
(/
(sin ky)
(sqrt
(fma (- 1.0 (cos (+ kx kx))) 0.5 (+ 0.5 (* -0.5 (cos (+ ky ky))))))))))
double code(double kx, double ky, double th) {
double tmp;
if (pow(sin(kx), 2.0) <= 4e-14) {
tmp = sin(th) * (sin(ky) / hypot(sin(ky), kx));
} else {
tmp = sin(th) * (sin(ky) / sqrt(fma((1.0 - cos((kx + kx))), 0.5, (0.5 + (-0.5 * cos((ky + ky)))))));
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if ((sin(kx) ^ 2.0) <= 4e-14) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), 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[N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision], 4e-14], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[(1.0 - N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5 + N[(0.5 + N[(-0.5 * N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\sin kx}^{2} \leq 4 \cdot 10^{-14}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, 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 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) < 4e-14Initial program 90.6%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6490.6
Applied rewrites90.6%
lift-*.f64N/A
lift-sin.f64N/A
pow2N/A
+-commutativeN/A
lift-*.f64N/A
lower-hypot.f6499.9
Applied rewrites99.9%
if 4e-14 < (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) Initial program 99.4%
lift-sin.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-sqrt.f6499.4
lift-+.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
Applied rewrites99.0%
Final simplification99.4%
(FPCore (kx ky th)
:precision binary64
(if (<= (pow (sin kx) 2.0) 5e-12)
(* (sin th) (/ (sin ky) (hypot (sin ky) kx)))
(/
(* (sin ky) (sin th))
(sqrt (fma (- 1.0 (cos (+ kx kx))) 0.5 (fma (cos (+ ky ky)) -0.5 0.5))))))
double code(double kx, double ky, double th) {
double tmp;
if (pow(sin(kx), 2.0) <= 5e-12) {
tmp = sin(th) * (sin(ky) / hypot(sin(ky), kx));
} else {
tmp = (sin(ky) * sin(th)) / sqrt(fma((1.0 - cos((kx + kx))), 0.5, fma(cos((ky + ky)), -0.5, 0.5)));
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if ((sin(kx) ^ 2.0) <= 5e-12) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), kx))); else tmp = Float64(Float64(sin(ky) * sin(th)) / sqrt(fma(Float64(1.0 - cos(Float64(kx + kx))), 0.5, fma(cos(Float64(ky + ky)), -0.5, 0.5)))); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision], 5e-12], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 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[(N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision] * -0.5 + 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\sin kx}^{2} \leq 5 \cdot 10^{-12}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky \cdot \sin th}{\sqrt{\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)}}\\
\end{array}
\end{array}
if (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) < 4.9999999999999997e-12Initial program 90.7%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6490.7
Applied rewrites90.7%
lift-*.f64N/A
lift-sin.f64N/A
pow2N/A
+-commutativeN/A
lift-*.f64N/A
lower-hypot.f6499.9
Applied rewrites99.9%
if 4.9999999999999997e-12 < (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) Initial program 99.3%
Applied rewrites99.0%
lift-+.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
flip-+N/A
lift-*.f64N/A
lift-*.f64N/A
+-inversesN/A
+-inversesN/A
lift-*.f64N/A
lift-*.f64N/A
+-inversesN/A
+-inversesN/A
flip-+N/A
lift-+.f64N/A
lower-fma.f6433.1
Applied rewrites99.0%
Final simplification99.4%
(FPCore (kx ky th)
:precision binary64
(if (<=
(*
(sin th)
(/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))))
1e-316)
(* 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-316) {
tmp = th * (-0.16666666666666666 * (th * th));
} else {
tmp = th;
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if ((sin(th) * (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0))))) <= 1d-316) then
tmp = th * ((-0.16666666666666666d0) * (th * th))
else
tmp = th
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if ((Math.sin(th) * (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0))))) <= 1e-316) {
tmp = th * (-0.16666666666666666 * (th * th));
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (math.sin(th) * (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0))))) <= 1e-316: tmp = th * (-0.16666666666666666 * (th * th)) else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(th) * Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0))))) <= 1e-316) tmp = Float64(th * Float64(-0.16666666666666666 * Float64(th * th))); else tmp = th; end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((sin(th) * (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0))))) <= 1e-316) tmp = th * (-0.16666666666666666 * (th * th)); else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1e-316], N[(th * N[(-0.16666666666666666 * N[(th * th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], th]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin th \cdot \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 10^{-316}:\\
\;\;\;\;th \cdot \left(-0.16666666666666666 \cdot \left(th \cdot th\right)\right)\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if (*.f64 (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) (sin.f64 th)) < 9.999999837e-317Initial program 96.2%
Taylor expanded in kx around 0
lower-sin.f6420.5
Applied rewrites20.5%
Taylor expanded in th around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6413.1
Applied rewrites13.1%
Taylor expanded in th around inf
lower-*.f64N/A
unpow2N/A
lower-*.f6421.3
Applied rewrites21.3%
if 9.999999837e-317 < (*.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 93.7%
Taylor expanded in kx around 0
lower-sin.f6426.1
Applied rewrites26.1%
Taylor expanded in th around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6413.9
Applied rewrites13.9%
Taylor expanded in th around 0
Applied rewrites14.4%
*-rgt-identity14.4
Applied rewrites14.4%
Final simplification18.6%
(FPCore (kx ky th)
:precision binary64
(if (<=
(*
(sin th)
(/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))))
1e-316)
(* -0.16666666666666666 (* th (* th th)))
th))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(th) * (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0))))) <= 1e-316) {
tmp = -0.16666666666666666 * (th * (th * th));
} else {
tmp = th;
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if ((sin(th) * (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0))))) <= 1d-316) then
tmp = (-0.16666666666666666d0) * (th * (th * th))
else
tmp = th
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if ((Math.sin(th) * (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0))))) <= 1e-316) {
tmp = -0.16666666666666666 * (th * (th * th));
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (math.sin(th) * (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0))))) <= 1e-316: tmp = -0.16666666666666666 * (th * (th * th)) else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(th) * Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0))))) <= 1e-316) tmp = Float64(-0.16666666666666666 * Float64(th * Float64(th * th))); else tmp = th; end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((sin(th) * (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0))))) <= 1e-316) tmp = -0.16666666666666666 * (th * (th * th)); else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1e-316], N[(-0.16666666666666666 * N[(th * N[(th * th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], th]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin th \cdot \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 10^{-316}:\\
\;\;\;\;-0.16666666666666666 \cdot \left(th \cdot \left(th \cdot th\right)\right)\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if (*.f64 (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) (sin.f64 th)) < 9.999999837e-317Initial program 96.2%
Taylor expanded in kx around 0
lower-sin.f6420.5
Applied rewrites20.5%
Taylor expanded in th around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6413.1
Applied rewrites13.1%
Taylor expanded in th around inf
lower-*.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6421.3
Applied rewrites21.3%
if 9.999999837e-317 < (*.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 93.7%
Taylor expanded in kx around 0
lower-sin.f6426.1
Applied rewrites26.1%
Taylor expanded in th around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6413.9
Applied rewrites13.9%
Taylor expanded in th around 0
Applied rewrites14.4%
*-rgt-identity14.4
Applied rewrites14.4%
Final simplification18.6%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 1e-11) (* (sin th) (/ 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)))) <= 1e-11) {
tmp = sin(th) * (ky / kx);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if ((sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) <= 1d-11) then
tmp = sin(th) * (ky / kx)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if ((Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) <= 1e-11) {
tmp = Math.sin(th) * (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)))) <= 1e-11: tmp = math.sin(th) * (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)))) <= 1e-11) tmp = Float64(sin(th) * Float64(ky / kx)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 1e-11) tmp = sin(th) * (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], 1e-11], N[(N[Sin[th], $MachinePrecision] * N[(ky / 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 10^{-11}:\\
\;\;\;\;\sin th \cdot \frac{ky}{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))))) < 9.99999999999999939e-12Initial program 95.8%
Taylor expanded in kx around 0
unpow2N/A
lower-*.f6451.5
Applied rewrites51.5%
Taylor expanded in ky around 0
lower-/.f6425.5
Applied rewrites25.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 93.9%
Taylor expanded in kx around 0
lower-sin.f6466.9
Applied rewrites66.9%
Final simplification38.0%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 7e-8) (* 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)))) <= 7e-8) {
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)))) <= 7d-8) 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)))) <= 7e-8) {
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)))) <= 7e-8: 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)))) <= 7e-8) 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)))) <= 7e-8) 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], 7e-8], 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 7 \cdot 10^{-8}:\\
\;\;\;\;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))))) < 7.00000000000000048e-8Initial program 95.8%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f6432.8
Applied rewrites32.8%
Taylor expanded in th around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-sin.f6426.7
Applied rewrites26.7%
if 7.00000000000000048e-8 < (/.f64 (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.8%
Taylor expanded in kx around 0
lower-sin.f6467.7
Applied rewrites67.7%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 2e-42) (* 0.16666666666666666 (* kx (* ky (sin th)))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) <= 2e-42) {
tmp = 0.16666666666666666 * (kx * (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) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) <= 2d-42) then
tmp = 0.16666666666666666d0 * (kx * (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) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) <= 2e-42) {
tmp = 0.16666666666666666 * (kx * (ky * 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(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) <= 2e-42: tmp = 0.16666666666666666 * (kx * (ky * 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(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 2e-42) tmp = Float64(0.16666666666666666 * Float64(kx * Float64(ky * 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(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 2e-42) tmp = 0.16666666666666666 * (kx * (ky * 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[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2e-42], N[(0.16666666666666666 * N[(kx * N[(ky * N[Sin[th], $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^{-42}:\\
\;\;\;\;0.16666666666666666 \cdot \left(kx \cdot \left(ky \cdot \sin th\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2.00000000000000008e-42Initial program 95.8%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f6432.8
Applied rewrites32.8%
Taylor expanded in kx around 0
lower-/.f64N/A
associate-*r*N/A
distribute-lft1-inN/A
lower-*.f64N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sin.f6416.2
Applied rewrites16.2%
Taylor expanded in kx around inf
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sin.f6419.3
Applied rewrites19.3%
if 2.00000000000000008e-42 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 94.0%
Taylor expanded in kx around 0
lower-sin.f6465.4
Applied rewrites65.4%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 2e-63) (* th (* -0.16666666666666666 (* th th))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) <= 2e-63) {
tmp = th * (-0.16666666666666666 * (th * th));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if ((sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) <= 2d-63) then
tmp = th * ((-0.16666666666666666d0) * (th * th))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if ((Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) <= 2e-63) {
tmp = th * (-0.16666666666666666 * (th * th));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) <= 2e-63: tmp = th * (-0.16666666666666666 * (th * th)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 2e-63) tmp = Float64(th * Float64(-0.16666666666666666 * Float64(th * th))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 2e-63) tmp = th * (-0.16666666666666666 * (th * th)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2e-63], N[(th * N[(-0.16666666666666666 * N[(th * th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 2 \cdot 10^{-63}:\\
\;\;\;\;th \cdot \left(-0.16666666666666666 \cdot \left(th \cdot th\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2.00000000000000013e-63Initial program 95.7%
Taylor expanded in kx around 0
lower-sin.f643.6
Applied rewrites3.6%
Taylor expanded in th around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f643.4
Applied rewrites3.4%
Taylor expanded in th around inf
lower-*.f64N/A
unpow2N/A
lower-*.f6418.8
Applied rewrites18.8%
if 2.00000000000000013e-63 < (/.f64 (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.2%
Taylor expanded in kx around 0
lower-sin.f6464.0
Applied rewrites64.0%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (* ky (fma (* ky ky) -0.16666666666666666 1.0))))
(if (<= ky 2.1)
(* (sin th) (/ t_1 (hypot t_1 (sin kx))))
(* (sin th) (/ (sin ky) (sqrt (fma -0.5 (cos (* ky -2.0)) 0.5)))))))
double code(double kx, double ky, double th) {
double t_1 = ky * fma((ky * ky), -0.16666666666666666, 1.0);
double tmp;
if (ky <= 2.1) {
tmp = sin(th) * (t_1 / hypot(t_1, sin(kx)));
} else {
tmp = sin(th) * (sin(ky) / sqrt(fma(-0.5, cos((ky * -2.0)), 0.5)));
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(ky * fma(Float64(ky * ky), -0.16666666666666666, 1.0)) tmp = 0.0 if (ky <= 2.1) tmp = Float64(sin(th) * Float64(t_1 / hypot(t_1, sin(kx)))); else tmp = Float64(sin(th) * Float64(sin(ky) / sqrt(fma(-0.5, cos(Float64(ky * -2.0)), 0.5)))); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(ky * N[(N[(ky * ky), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[ky, 2.1], N[(N[Sin[th], $MachinePrecision] * N[(t$95$1 / N[Sqrt[t$95$1 ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(-0.5 * N[Cos[N[(ky * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := ky \cdot \mathsf{fma}\left(ky \cdot ky, -0.16666666666666666, 1\right)\\
\mathbf{if}\;ky \leq 2.1:\\
\;\;\;\;\sin th \cdot \frac{t\_1}{\mathsf{hypot}\left(t\_1, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{\mathsf{fma}\left(-0.5, \cos \left(ky \cdot -2\right), 0.5\right)}}\\
\end{array}
\end{array}
if ky < 2.10000000000000009Initial program 93.8%
lift-sin.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6499.6
Applied rewrites99.6%
Taylor expanded in ky around 0
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6470.2
Applied rewrites70.2%
Taylor expanded in ky around 0
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6471.3
Applied rewrites71.3%
if 2.10000000000000009 < ky Initial program 99.6%
lift-sin.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-sqrt.f6499.6
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 rewrites98.8%
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-*.f6461.7
Applied rewrites61.7%
Final simplification68.9%
(FPCore (kx ky th) :precision binary64 th)
double code(double kx, double ky, double th) {
return th;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = th
end function
public static double code(double kx, double ky, double th) {
return th;
}
def code(kx, ky, th): return th
function code(kx, ky, th) return th end
function tmp = code(kx, ky, th) tmp = th; end
code[kx_, ky_, th_] := th
\begin{array}{l}
\\
th
\end{array}
Initial program 95.2%
Taylor expanded in kx around 0
lower-sin.f6422.7
Applied rewrites22.7%
Taylor expanded in th around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6413.4
Applied rewrites13.4%
Taylor expanded in th around 0
Applied rewrites13.8%
*-rgt-identity13.8
Applied rewrites13.8%
herbie shell --seed 2024216
(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)))