
(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 17 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 kx) (sin ky))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / hypot(sin(kx), sin(ky))) * sin(th);
}
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.hypot(Math.sin(kx), Math.sin(ky))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.hypot(math.sin(kx), math.sin(ky))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / hypot(sin(kx), sin(ky))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / hypot(sin(kx), sin(ky))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\mathsf{hypot}\left(\sin kx, \sin ky\right)} \cdot \sin th
\end{array}
Initial program 92.9%
Taylor expanded in kx around inf
unpow2N/A
unpow2N/A
hypot-defineN/A
hypot-lowering-hypot.f64N/A
sin-lowering-sin.f64N/A
sin-lowering-sin.f6499.6%
Simplified99.6%
(FPCore (kx ky th) :precision binary64 (* (sin ky) (/ (sin th) (hypot (sin ky) (sin kx)))))
double code(double kx, double ky, double th) {
return sin(ky) * (sin(th) / hypot(sin(ky), sin(kx)));
}
public static double code(double kx, double ky, double th) {
return Math.sin(ky) * (Math.sin(th) / Math.hypot(Math.sin(ky), Math.sin(kx)));
}
def code(kx, ky, th): return math.sin(ky) * (math.sin(th) / math.hypot(math.sin(ky), math.sin(kx)))
function code(kx, ky, th) return Float64(sin(ky) * Float64(sin(th) / hypot(sin(ky), sin(kx)))) end
function tmp = code(kx, ky, th) tmp = sin(ky) * (sin(th) / hypot(sin(ky), sin(kx))); end
code[kx_, ky_, th_] := N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}
\end{array}
Initial program 92.9%
associate-*l/N/A
associate-/l*N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
/-lowering-/.f64N/A
sin-lowering-sin.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
hypot-defineN/A
hypot-lowering-hypot.f64N/A
sin-lowering-sin.f64N/A
sin-lowering-sin.f6499.6%
Simplified99.6%
(FPCore (kx ky th)
:precision binary64
(if (<= th 0.0069)
(*
(/ (sin ky) (hypot (sin kx) (sin ky)))
(* th (+ 1.0 (* th (* th -0.16666666666666666)))))
(* ky (/ (sin th) (hypot ky (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.0069) {
tmp = (sin(ky) / hypot(sin(kx), sin(ky))) * (th * (1.0 + (th * (th * -0.16666666666666666))));
} else {
tmp = ky * (sin(th) / hypot(ky, sin(kx)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.0069) {
tmp = (Math.sin(ky) / Math.hypot(Math.sin(kx), Math.sin(ky))) * (th * (1.0 + (th * (th * -0.16666666666666666))));
} else {
tmp = ky * (Math.sin(th) / Math.hypot(ky, Math.sin(kx)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 0.0069: tmp = (math.sin(ky) / math.hypot(math.sin(kx), math.sin(ky))) * (th * (1.0 + (th * (th * -0.16666666666666666)))) else: tmp = ky * (math.sin(th) / math.hypot(ky, math.sin(kx))) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 0.0069) tmp = Float64(Float64(sin(ky) / hypot(sin(kx), sin(ky))) * Float64(th * Float64(1.0 + Float64(th * Float64(th * -0.16666666666666666))))); else tmp = Float64(ky * Float64(sin(th) / hypot(ky, sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 0.0069) tmp = (sin(ky) / hypot(sin(kx), sin(ky))) * (th * (1.0 + (th * (th * -0.16666666666666666)))); else tmp = ky * (sin(th) / hypot(ky, sin(kx))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 0.0069], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[(th * N[(1.0 + N[(th * N[(th * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 0.0069:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\sin kx, \sin ky\right)} \cdot \left(th \cdot \left(1 + th \cdot \left(th \cdot -0.16666666666666666\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\end{array}
\end{array}
if th < 0.0068999999999999999Initial program 93.4%
Taylor expanded in kx around inf
unpow2N/A
unpow2N/A
hypot-defineN/A
hypot-lowering-hypot.f64N/A
sin-lowering-sin.f64N/A
sin-lowering-sin.f6499.7%
Simplified99.7%
Taylor expanded in th around 0
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f6461.8%
Simplified61.8%
if 0.0068999999999999999 < th Initial program 91.4%
associate-*l/N/A
associate-/l*N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
/-lowering-/.f64N/A
sin-lowering-sin.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
hypot-defineN/A
hypot-lowering-hypot.f64N/A
sin-lowering-sin.f64N/A
sin-lowering-sin.f6499.4%
Simplified99.4%
Taylor expanded in ky around 0
Simplified67.5%
Taylor expanded in ky around 0
Simplified75.4%
(FPCore (kx ky th)
:precision binary64
(if (<= th 0.0057)
(*
(sin ky)
(/
(* th (+ 1.0 (* th (* th -0.16666666666666666))))
(hypot (sin ky) (sin kx))))
(* ky (/ (sin th) (hypot ky (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.0057) {
tmp = sin(ky) * ((th * (1.0 + (th * (th * -0.16666666666666666)))) / hypot(sin(ky), sin(kx)));
} else {
tmp = ky * (sin(th) / hypot(ky, sin(kx)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.0057) {
tmp = Math.sin(ky) * ((th * (1.0 + (th * (th * -0.16666666666666666)))) / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else {
tmp = ky * (Math.sin(th) / Math.hypot(ky, Math.sin(kx)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 0.0057: tmp = math.sin(ky) * ((th * (1.0 + (th * (th * -0.16666666666666666)))) / math.hypot(math.sin(ky), math.sin(kx))) else: tmp = ky * (math.sin(th) / math.hypot(ky, math.sin(kx))) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 0.0057) tmp = Float64(sin(ky) * Float64(Float64(th * Float64(1.0 + Float64(th * Float64(th * -0.16666666666666666)))) / hypot(sin(ky), sin(kx)))); else tmp = Float64(ky * Float64(sin(th) / hypot(ky, sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 0.0057) tmp = sin(ky) * ((th * (1.0 + (th * (th * -0.16666666666666666)))) / hypot(sin(ky), sin(kx))); else tmp = ky * (sin(th) / hypot(ky, sin(kx))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 0.0057], N[(N[Sin[ky], $MachinePrecision] * N[(N[(th * N[(1.0 + N[(th * N[(th * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 0.0057:\\
\;\;\;\;\sin ky \cdot \frac{th \cdot \left(1 + th \cdot \left(th \cdot -0.16666666666666666\right)\right)}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\end{array}
\end{array}
if th < 0.0057000000000000002Initial program 93.4%
associate-*l/N/A
associate-/l*N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
/-lowering-/.f64N/A
sin-lowering-sin.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
hypot-defineN/A
hypot-lowering-hypot.f64N/A
sin-lowering-sin.f64N/A
sin-lowering-sin.f6499.6%
Simplified99.6%
Taylor expanded in th around 0
*-lowering-*.f64N/A
+-lowering-+.f64N/A
unpow2N/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f6461.7%
Simplified61.7%
if 0.0057000000000000002 < th Initial program 91.4%
associate-*l/N/A
associate-/l*N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
/-lowering-/.f64N/A
sin-lowering-sin.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
hypot-defineN/A
hypot-lowering-hypot.f64N/A
sin-lowering-sin.f64N/A
sin-lowering-sin.f6499.4%
Simplified99.4%
Taylor expanded in ky around 0
Simplified67.5%
Taylor expanded in ky around 0
Simplified75.4%
Final simplification65.4%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.05) (* th (/ (/ 1.0 (/ 1.0 (sin ky))) (hypot kx (sin ky)))) (* ky (/ (sin th) (hypot ky (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.05) {
tmp = th * ((1.0 / (1.0 / sin(ky))) / hypot(kx, sin(ky)));
} else {
tmp = ky * (sin(th) / hypot(ky, sin(kx)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.05) {
tmp = th * ((1.0 / (1.0 / Math.sin(ky))) / Math.hypot(kx, Math.sin(ky)));
} else {
tmp = ky * (Math.sin(th) / Math.hypot(ky, Math.sin(kx)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.05: tmp = th * ((1.0 / (1.0 / math.sin(ky))) / math.hypot(kx, math.sin(ky))) else: tmp = ky * (math.sin(th) / math.hypot(ky, math.sin(kx))) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.05) tmp = Float64(th * Float64(Float64(1.0 / Float64(1.0 / sin(ky))) / hypot(kx, sin(ky)))); else tmp = Float64(ky * Float64(sin(th) / hypot(ky, sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.05) tmp = th * ((1.0 / (1.0 / sin(ky))) / hypot(kx, sin(ky))); else tmp = ky * (sin(th) / hypot(ky, sin(kx))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.05], N[(th * N[(N[(1.0 / N[(1.0 / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[kx ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.05:\\
\;\;\;\;th \cdot \frac{\frac{1}{\frac{1}{\sin ky}}}{\mathsf{hypot}\left(kx, \sin ky\right)}\\
\mathbf{else}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.050000000000000003Initial program 99.6%
Taylor expanded in kx around inf
unpow2N/A
unpow2N/A
hypot-defineN/A
hypot-lowering-hypot.f64N/A
sin-lowering-sin.f64N/A
sin-lowering-sin.f6499.6%
Simplified99.6%
/-rgt-identityN/A
clear-numN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
sin-lowering-sin.f6499.3%
Applied egg-rr99.3%
Taylor expanded in th around 0
Simplified36.7%
Taylor expanded in kx around 0
Simplified15.0%
if -0.050000000000000003 < (sin.f64 ky) Initial program 91.0%
associate-*l/N/A
associate-/l*N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
/-lowering-/.f64N/A
sin-lowering-sin.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
hypot-defineN/A
hypot-lowering-hypot.f64N/A
sin-lowering-sin.f64N/A
sin-lowering-sin.f6499.6%
Simplified99.6%
Taylor expanded in ky around 0
Simplified78.2%
Taylor expanded in ky around 0
Simplified83.5%
Final simplification68.3%
(FPCore (kx ky th) :precision binary64 (if (<= th 0.00235) (* (/ (sin ky) (hypot (sin kx) (sin ky))) th) (* ky (/ (sin th) (hypot ky (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.00235) {
tmp = (sin(ky) / hypot(sin(kx), sin(ky))) * th;
} else {
tmp = ky * (sin(th) / hypot(ky, sin(kx)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.00235) {
tmp = (Math.sin(ky) / Math.hypot(Math.sin(kx), Math.sin(ky))) * th;
} else {
tmp = ky * (Math.sin(th) / Math.hypot(ky, Math.sin(kx)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 0.00235: tmp = (math.sin(ky) / math.hypot(math.sin(kx), math.sin(ky))) * th else: tmp = ky * (math.sin(th) / math.hypot(ky, math.sin(kx))) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 0.00235) tmp = Float64(Float64(sin(ky) / hypot(sin(kx), sin(ky))) * th); else tmp = Float64(ky * Float64(sin(th) / hypot(ky, sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 0.00235) tmp = (sin(ky) / hypot(sin(kx), sin(ky))) * th; else tmp = ky * (sin(th) / hypot(ky, sin(kx))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 0.00235], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * th), $MachinePrecision], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 0.00235:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\sin kx, \sin ky\right)} \cdot th\\
\mathbf{else}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\end{array}
\end{array}
if th < 0.00235000000000000009Initial program 93.4%
Taylor expanded in kx around inf
unpow2N/A
unpow2N/A
hypot-defineN/A
hypot-lowering-hypot.f64N/A
sin-lowering-sin.f64N/A
sin-lowering-sin.f6499.7%
Simplified99.7%
Taylor expanded in th around 0
Simplified62.2%
if 0.00235000000000000009 < th Initial program 91.4%
associate-*l/N/A
associate-/l*N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
/-lowering-/.f64N/A
sin-lowering-sin.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
hypot-defineN/A
hypot-lowering-hypot.f64N/A
sin-lowering-sin.f64N/A
sin-lowering-sin.f6499.4%
Simplified99.4%
Taylor expanded in ky around 0
Simplified67.5%
Taylor expanded in ky around 0
Simplified75.4%
(FPCore (kx ky th) :precision binary64 (if (<= th 0.000122) (* (sin ky) (/ th (hypot (sin ky) (sin kx)))) (* ky (/ (sin th) (hypot ky (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.000122) {
tmp = sin(ky) * (th / hypot(sin(ky), sin(kx)));
} else {
tmp = ky * (sin(th) / hypot(ky, sin(kx)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.000122) {
tmp = Math.sin(ky) * (th / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else {
tmp = ky * (Math.sin(th) / Math.hypot(ky, Math.sin(kx)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 0.000122: tmp = math.sin(ky) * (th / math.hypot(math.sin(ky), math.sin(kx))) else: tmp = ky * (math.sin(th) / math.hypot(ky, math.sin(kx))) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 0.000122) tmp = Float64(sin(ky) * Float64(th / hypot(sin(ky), sin(kx)))); else tmp = Float64(ky * Float64(sin(th) / hypot(ky, sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 0.000122) tmp = sin(ky) * (th / hypot(sin(ky), sin(kx))); else tmp = ky * (sin(th) / hypot(ky, sin(kx))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 0.000122], N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 0.000122:\\
\;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\end{array}
\end{array}
if th < 1.21999999999999997e-4Initial program 93.4%
associate-*l/N/A
associate-/l*N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
/-lowering-/.f64N/A
sin-lowering-sin.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
hypot-defineN/A
hypot-lowering-hypot.f64N/A
sin-lowering-sin.f64N/A
sin-lowering-sin.f6499.6%
Simplified99.6%
Taylor expanded in th around 0
Simplified62.1%
if 1.21999999999999997e-4 < th Initial program 91.4%
associate-*l/N/A
associate-/l*N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
/-lowering-/.f64N/A
sin-lowering-sin.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
hypot-defineN/A
hypot-lowering-hypot.f64N/A
sin-lowering-sin.f64N/A
sin-lowering-sin.f6499.4%
Simplified99.4%
Taylor expanded in ky around 0
Simplified67.5%
Taylor expanded in ky around 0
Simplified75.4%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) 1e-104) (* 0.5 (/ (* ky (+ (sin th) (sin th))) ky)) (* (sin th) (/ (sin ky) (sin kx)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= 1e-104) {
tmp = 0.5 * ((ky * (sin(th) + sin(th))) / ky);
} else {
tmp = sin(th) * (sin(ky) / sin(kx));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(kx) <= 1d-104) then
tmp = 0.5d0 * ((ky * (sin(th) + sin(th))) / ky)
else
tmp = sin(th) * (sin(ky) / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= 1e-104) {
tmp = 0.5 * ((ky * (Math.sin(th) + Math.sin(th))) / ky);
} else {
tmp = Math.sin(th) * (Math.sin(ky) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= 1e-104: tmp = 0.5 * ((ky * (math.sin(th) + math.sin(th))) / ky) else: tmp = math.sin(th) * (math.sin(ky) / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= 1e-104) tmp = Float64(0.5 * Float64(Float64(ky * Float64(sin(th) + sin(th))) / ky)); else tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= 1e-104) tmp = 0.5 * ((ky * (sin(th) + sin(th))) / ky); else tmp = sin(th) * (sin(ky) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-104], N[(0.5 * N[(N[(ky * N[(N[Sin[th], $MachinePrecision] + N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq 10^{-104}:\\
\;\;\;\;0.5 \cdot \frac{ky \cdot \left(\sin th + \sin th\right)}{ky}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < 9.99999999999999927e-105Initial program 89.9%
associate-*l/N/A
associate-/l*N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
/-lowering-/.f64N/A
sin-lowering-sin.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
hypot-defineN/A
hypot-lowering-hypot.f64N/A
sin-lowering-sin.f64N/A
sin-lowering-sin.f6499.6%
Simplified99.6%
Taylor expanded in kx around 0
sin-lowering-sin.f6426.8%
Simplified26.8%
*-rgt-identityN/A
lft-mult-inverseN/A
associate-*l*N/A
div-invN/A
*-commutativeN/A
associate-*r/N/A
div-invN/A
sin-multN/A
frac-timesN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
cos-lowering-cos.f64N/A
--lowering--.f64N/A
cos-lowering-cos.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f6410.8%
Applied egg-rr10.8%
Taylor expanded in ky around 0
distribute-lft-outN/A
associate-/l*N/A
*-lowering-*.f64N/A
cos-negN/A
+-inversesN/A
/-lowering-/.f64N/A
Simplified31.6%
if 9.99999999999999927e-105 < (sin.f64 kx) Initial program 99.4%
Taylor expanded in ky around 0
sin-lowering-sin.f6462.2%
Simplified62.2%
Final simplification41.3%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) 1e-104) (* 0.5 (/ (* ky (+ (sin th) (sin th))) ky)) (* (sin ky) (/ (sin th) (sin kx)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= 1e-104) {
tmp = 0.5 * ((ky * (sin(th) + sin(th))) / ky);
} else {
tmp = sin(ky) * (sin(th) / sin(kx));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(kx) <= 1d-104) then
tmp = 0.5d0 * ((ky * (sin(th) + sin(th))) / ky)
else
tmp = sin(ky) * (sin(th) / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= 1e-104) {
tmp = 0.5 * ((ky * (Math.sin(th) + Math.sin(th))) / ky);
} else {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= 1e-104: tmp = 0.5 * ((ky * (math.sin(th) + math.sin(th))) / ky) else: tmp = math.sin(ky) * (math.sin(th) / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= 1e-104) tmp = Float64(0.5 * Float64(Float64(ky * Float64(sin(th) + sin(th))) / ky)); else tmp = Float64(sin(ky) * Float64(sin(th) / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= 1e-104) tmp = 0.5 * ((ky * (sin(th) + sin(th))) / ky); else tmp = sin(ky) * (sin(th) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-104], N[(0.5 * N[(N[(ky * N[(N[Sin[th], $MachinePrecision] + N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq 10^{-104}:\\
\;\;\;\;0.5 \cdot \frac{ky \cdot \left(\sin th + \sin th\right)}{ky}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < 9.99999999999999927e-105Initial program 89.9%
associate-*l/N/A
associate-/l*N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
/-lowering-/.f64N/A
sin-lowering-sin.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
hypot-defineN/A
hypot-lowering-hypot.f64N/A
sin-lowering-sin.f64N/A
sin-lowering-sin.f6499.6%
Simplified99.6%
Taylor expanded in kx around 0
sin-lowering-sin.f6426.8%
Simplified26.8%
*-rgt-identityN/A
lft-mult-inverseN/A
associate-*l*N/A
div-invN/A
*-commutativeN/A
associate-*r/N/A
div-invN/A
sin-multN/A
frac-timesN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
cos-lowering-cos.f64N/A
--lowering--.f64N/A
cos-lowering-cos.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f6410.8%
Applied egg-rr10.8%
Taylor expanded in ky around 0
distribute-lft-outN/A
associate-/l*N/A
*-lowering-*.f64N/A
cos-negN/A
+-inversesN/A
/-lowering-/.f64N/A
Simplified31.6%
if 9.99999999999999927e-105 < (sin.f64 kx) Initial program 99.4%
associate-*l/N/A
associate-/l*N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
/-lowering-/.f64N/A
sin-lowering-sin.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
hypot-defineN/A
hypot-lowering-hypot.f64N/A
sin-lowering-sin.f64N/A
sin-lowering-sin.f6499.5%
Simplified99.5%
Taylor expanded in ky around 0
/-lowering-/.f64N/A
sin-lowering-sin.f64N/A
sin-lowering-sin.f6462.2%
Simplified62.2%
Final simplification41.3%
(FPCore (kx ky th) :precision binary64 (* ky (/ (sin th) (hypot ky (sin kx)))))
double code(double kx, double ky, double th) {
return ky * (sin(th) / hypot(ky, sin(kx)));
}
public static double code(double kx, double ky, double th) {
return ky * (Math.sin(th) / Math.hypot(ky, Math.sin(kx)));
}
def code(kx, ky, th): return ky * (math.sin(th) / math.hypot(ky, math.sin(kx)))
function code(kx, ky, th) return Float64(ky * Float64(sin(th) / hypot(ky, sin(kx)))) end
function tmp = code(kx, ky, th) tmp = ky * (sin(th) / hypot(ky, sin(kx))); end
code[kx_, ky_, th_] := N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
ky \cdot \frac{\sin th}{\mathsf{hypot}\left(ky, \sin kx\right)}
\end{array}
Initial program 92.9%
associate-*l/N/A
associate-/l*N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
/-lowering-/.f64N/A
sin-lowering-sin.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
hypot-defineN/A
hypot-lowering-hypot.f64N/A
sin-lowering-sin.f64N/A
sin-lowering-sin.f6499.6%
Simplified99.6%
Taylor expanded in ky around 0
Simplified62.1%
Taylor expanded in ky around 0
Simplified70.3%
(FPCore (kx ky th) :precision binary64 (if (<= ky 4.2e-97) (/ (sin th) (/ (sin kx) ky)) (* 0.5 (/ (* ky (+ (sin th) (sin th))) ky))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 4.2e-97) {
tmp = sin(th) / (sin(kx) / ky);
} else {
tmp = 0.5 * ((ky * (sin(th) + sin(th))) / ky);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= 4.2d-97) then
tmp = sin(th) / (sin(kx) / ky)
else
tmp = 0.5d0 * ((ky * (sin(th) + sin(th))) / ky)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 4.2e-97) {
tmp = Math.sin(th) / (Math.sin(kx) / ky);
} else {
tmp = 0.5 * ((ky * (Math.sin(th) + Math.sin(th))) / ky);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 4.2e-97: tmp = math.sin(th) / (math.sin(kx) / ky) else: tmp = 0.5 * ((ky * (math.sin(th) + math.sin(th))) / ky) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 4.2e-97) tmp = Float64(sin(th) / Float64(sin(kx) / ky)); else tmp = Float64(0.5 * Float64(Float64(ky * Float64(sin(th) + sin(th))) / ky)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 4.2e-97) tmp = sin(th) / (sin(kx) / ky); else tmp = 0.5 * ((ky * (sin(th) + sin(th))) / ky); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 4.2e-97], N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(ky * N[(N[Sin[th], $MachinePrecision] + N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 4.2 \cdot 10^{-97}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{ky}}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{ky \cdot \left(\sin th + \sin th\right)}{ky}\\
\end{array}
\end{array}
if ky < 4.2000000000000002e-97Initial program 89.9%
Taylor expanded in kx around inf
unpow2N/A
unpow2N/A
hypot-defineN/A
hypot-lowering-hypot.f64N/A
sin-lowering-sin.f64N/A
sin-lowering-sin.f6499.6%
Simplified99.6%
/-rgt-identityN/A
clear-numN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
sin-lowering-sin.f6499.5%
Applied egg-rr99.5%
*-commutativeN/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
sin-lowering-sin.f64N/A
hypot-defineN/A
remove-double-divN/A
hypot-defineN/A
/-lowering-/.f64N/A
Applied egg-rr99.6%
Taylor expanded in ky around 0
/-lowering-/.f64N/A
sin-lowering-sin.f6433.4%
Simplified33.4%
if 4.2000000000000002e-97 < ky Initial program 99.7%
associate-*l/N/A
associate-/l*N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
/-lowering-/.f64N/A
sin-lowering-sin.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
hypot-defineN/A
hypot-lowering-hypot.f64N/A
sin-lowering-sin.f64N/A
sin-lowering-sin.f6499.6%
Simplified99.6%
Taylor expanded in kx around 0
sin-lowering-sin.f6436.0%
Simplified36.0%
*-rgt-identityN/A
lft-mult-inverseN/A
associate-*l*N/A
div-invN/A
*-commutativeN/A
associate-*r/N/A
div-invN/A
sin-multN/A
frac-timesN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
cos-lowering-cos.f64N/A
--lowering--.f64N/A
cos-lowering-cos.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f6410.1%
Applied egg-rr10.1%
Taylor expanded in ky around 0
distribute-lft-outN/A
associate-/l*N/A
*-lowering-*.f64N/A
cos-negN/A
+-inversesN/A
/-lowering-/.f64N/A
Simplified40.5%
Final simplification35.6%
(FPCore (kx ky th) :precision binary64 (if (<= kx 1.65e-104) (sin th) (* (sin th) (/ ky (sin kx)))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 1.65e-104) {
tmp = sin(th);
} else {
tmp = sin(th) * (ky / sin(kx));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (kx <= 1.65d-104) then
tmp = sin(th)
else
tmp = sin(th) * (ky / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 1.65e-104) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) * (ky / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 1.65e-104: tmp = math.sin(th) else: tmp = math.sin(th) * (ky / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 1.65e-104) tmp = sin(th); else tmp = Float64(sin(th) * Float64(ky / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 1.65e-104) tmp = sin(th); else tmp = sin(th) * (ky / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 1.65e-104], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 1.65 \cdot 10^{-104}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\end{array}
\end{array}
if kx < 1.65000000000000001e-104Initial program 89.4%
associate-*l/N/A
associate-/l*N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
/-lowering-/.f64N/A
sin-lowering-sin.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
hypot-defineN/A
hypot-lowering-hypot.f64N/A
sin-lowering-sin.f64N/A
sin-lowering-sin.f6499.6%
Simplified99.6%
Taylor expanded in kx around 0
sin-lowering-sin.f6427.8%
Simplified27.8%
if 1.65000000000000001e-104 < kx Initial program 99.5%
Taylor expanded in ky around 0
/-lowering-/.f64N/A
sin-lowering-sin.f6442.4%
Simplified42.4%
Final simplification32.9%
(FPCore (kx ky th) :precision binary64 (if (<= kx 380000.0) (sin th) (* th (/ ky (sin kx)))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 380000.0) {
tmp = sin(th);
} else {
tmp = th * (ky / sin(kx));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (kx <= 380000.0d0) then
tmp = sin(th)
else
tmp = th * (ky / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 380000.0) {
tmp = Math.sin(th);
} else {
tmp = th * (ky / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 380000.0: tmp = math.sin(th) else: tmp = th * (ky / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 380000.0) tmp = sin(th); else tmp = Float64(th * Float64(ky / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 380000.0) tmp = sin(th); else tmp = th * (ky / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 380000.0], N[Sin[th], $MachinePrecision], N[(th * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 380000:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;th \cdot \frac{ky}{\sin kx}\\
\end{array}
\end{array}
if kx < 3.8e5Initial program 90.4%
associate-*l/N/A
associate-/l*N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
/-lowering-/.f64N/A
sin-lowering-sin.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
hypot-defineN/A
hypot-lowering-hypot.f64N/A
sin-lowering-sin.f64N/A
sin-lowering-sin.f6499.6%
Simplified99.6%
Taylor expanded in kx around 0
sin-lowering-sin.f6427.6%
Simplified27.6%
if 3.8e5 < kx Initial program 99.4%
Taylor expanded in th around 0
Simplified47.8%
Taylor expanded in ky around 0
/-lowering-/.f64N/A
sin-lowering-sin.f6422.4%
Simplified22.4%
Final simplification26.1%
(FPCore (kx ky th) :precision binary64 (if (<= kx 180000.0) (sin th) (* ky (/ th (sin kx)))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 180000.0) {
tmp = sin(th);
} else {
tmp = ky * (th / sin(kx));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (kx <= 180000.0d0) then
tmp = sin(th)
else
tmp = ky * (th / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 180000.0) {
tmp = Math.sin(th);
} else {
tmp = ky * (th / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 180000.0: tmp = math.sin(th) else: tmp = ky * (th / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 180000.0) tmp = sin(th); else tmp = Float64(ky * Float64(th / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 180000.0) tmp = sin(th); else tmp = ky * (th / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 180000.0], N[Sin[th], $MachinePrecision], N[(ky * N[(th / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 180000:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;ky \cdot \frac{th}{\sin kx}\\
\end{array}
\end{array}
if kx < 1.8e5Initial program 90.4%
associate-*l/N/A
associate-/l*N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
/-lowering-/.f64N/A
sin-lowering-sin.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
hypot-defineN/A
hypot-lowering-hypot.f64N/A
sin-lowering-sin.f64N/A
sin-lowering-sin.f6499.6%
Simplified99.6%
Taylor expanded in kx around 0
sin-lowering-sin.f6427.6%
Simplified27.6%
if 1.8e5 < kx Initial program 99.4%
Taylor expanded in th around 0
Simplified47.8%
Taylor expanded in ky around 0
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
sin-lowering-sin.f6422.4%
Simplified22.4%
(FPCore (kx ky th) :precision binary64 (if (<= kx 3.15e+25) (sin th) 0.0))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 3.15e+25) {
tmp = sin(th);
} else {
tmp = 0.0;
}
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 (kx <= 3.15d+25) then
tmp = sin(th)
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 3.15e+25) {
tmp = Math.sin(th);
} else {
tmp = 0.0;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 3.15e+25: tmp = math.sin(th) else: tmp = 0.0 return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 3.15e+25) tmp = sin(th); else tmp = 0.0; end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 3.15e+25) tmp = sin(th); else tmp = 0.0; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 3.15e+25], N[Sin[th], $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 3.15 \cdot 10^{+25}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if kx < 3.14999999999999987e25Initial program 90.6%
associate-*l/N/A
associate-/l*N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
/-lowering-/.f64N/A
sin-lowering-sin.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
hypot-defineN/A
hypot-lowering-hypot.f64N/A
sin-lowering-sin.f64N/A
sin-lowering-sin.f6499.6%
Simplified99.6%
Taylor expanded in kx around 0
sin-lowering-sin.f6427.0%
Simplified27.0%
if 3.14999999999999987e25 < kx Initial program 99.4%
associate-*l/N/A
associate-/l*N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
/-lowering-/.f64N/A
sin-lowering-sin.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
hypot-defineN/A
hypot-lowering-hypot.f64N/A
sin-lowering-sin.f64N/A
sin-lowering-sin.f6499.5%
Simplified99.5%
Taylor expanded in kx around 0
sin-lowering-sin.f646.8%
Simplified6.8%
*-rgt-identityN/A
lft-mult-inverseN/A
associate-*l*N/A
div-invN/A
*-commutativeN/A
associate-*r/N/A
div-invN/A
sin-multN/A
frac-timesN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
cos-lowering-cos.f64N/A
--lowering--.f64N/A
cos-lowering-cos.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f6421.7%
Applied egg-rr21.7%
Taylor expanded in ky around 0
cos-negN/A
div-subN/A
+-inversesN/A
metadata-eval21.5%
Simplified21.5%
(FPCore (kx ky th) :precision binary64 (if (<= kx 7e-38) th 0.0))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 7e-38) {
tmp = th;
} else {
tmp = 0.0;
}
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 (kx <= 7d-38) then
tmp = th
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 7e-38) {
tmp = th;
} else {
tmp = 0.0;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 7e-38: tmp = th else: tmp = 0.0 return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 7e-38) tmp = th; else tmp = 0.0; end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 7e-38) tmp = th; else tmp = 0.0; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 7e-38], th, 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 7 \cdot 10^{-38}:\\
\;\;\;\;th\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if kx < 7.0000000000000003e-38Initial program 89.9%
associate-*l/N/A
associate-/l*N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
/-lowering-/.f64N/A
sin-lowering-sin.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
hypot-defineN/A
hypot-lowering-hypot.f64N/A
sin-lowering-sin.f64N/A
sin-lowering-sin.f6499.6%
Simplified99.6%
Taylor expanded in kx around 0
sin-lowering-sin.f6428.3%
Simplified28.3%
Taylor expanded in th around 0
Simplified19.8%
if 7.0000000000000003e-38 < kx Initial program 99.4%
associate-*l/N/A
associate-/l*N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
/-lowering-/.f64N/A
sin-lowering-sin.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
hypot-defineN/A
hypot-lowering-hypot.f64N/A
sin-lowering-sin.f64N/A
sin-lowering-sin.f6499.5%
Simplified99.5%
Taylor expanded in kx around 0
sin-lowering-sin.f647.6%
Simplified7.6%
*-rgt-identityN/A
lft-mult-inverseN/A
associate-*l*N/A
div-invN/A
*-commutativeN/A
associate-*r/N/A
div-invN/A
sin-multN/A
frac-timesN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
cos-lowering-cos.f64N/A
--lowering--.f64N/A
cos-lowering-cos.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f6420.0%
Applied egg-rr20.0%
Taylor expanded in ky around 0
cos-negN/A
div-subN/A
+-inversesN/A
metadata-eval19.8%
Simplified19.8%
(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.9%
associate-*l/N/A
associate-/l*N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
/-lowering-/.f64N/A
sin-lowering-sin.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
hypot-defineN/A
hypot-lowering-hypot.f64N/A
sin-lowering-sin.f64N/A
sin-lowering-sin.f6499.6%
Simplified99.6%
Taylor expanded in kx around 0
sin-lowering-sin.f6421.7%
Simplified21.7%
*-rgt-identityN/A
lft-mult-inverseN/A
associate-*l*N/A
div-invN/A
*-commutativeN/A
associate-*r/N/A
div-invN/A
sin-multN/A
frac-timesN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
cos-lowering-cos.f64N/A
--lowering--.f64N/A
cos-lowering-cos.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f6412.6%
Applied egg-rr12.6%
Taylor expanded in ky around 0
cos-negN/A
div-subN/A
+-inversesN/A
metadata-eval12.5%
Simplified12.5%
herbie shell --seed 2024138
(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)))