
(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 18 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.8%
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%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.05)
(/ th (/ (hypot (sin ky) (sin kx)) (sin ky)))
(if (<= (sin ky) 2e-7)
(* (sin th) (/ (sin ky) (hypot (sin kx) ky)))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.05) {
tmp = th / (hypot(sin(ky), sin(kx)) / sin(ky));
} else if (sin(ky) <= 2e-7) {
tmp = sin(th) * (sin(ky) / hypot(sin(kx), ky));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.05) {
tmp = th / (Math.hypot(Math.sin(ky), Math.sin(kx)) / Math.sin(ky));
} else if (Math.sin(ky) <= 2e-7) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.hypot(Math.sin(kx), ky));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.05: tmp = th / (math.hypot(math.sin(ky), math.sin(kx)) / math.sin(ky)) elif math.sin(ky) <= 2e-7: tmp = math.sin(th) * (math.sin(ky) / math.hypot(math.sin(kx), ky)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.05) tmp = Float64(th / Float64(hypot(sin(ky), sin(kx)) / sin(ky))); elseif (sin(ky) <= 2e-7) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(sin(kx), ky))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.05) tmp = th / (hypot(sin(ky), sin(kx)) / sin(ky)); elseif (sin(ky) <= 2e-7) tmp = sin(th) * (sin(ky) / hypot(sin(kx), ky)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.05], N[(th / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-7], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + ky ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.05:\\
\;\;\;\;\frac{th}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{\sin ky}}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-7}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin kx, ky\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.050000000000000003Initial program 99.7%
Taylor expanded in th around 0
Simplified50.5%
*-commutativeN/A
clear-numN/A
pow2N/A
pow2N/A
un-div-invN/A
/-lowering-/.f64N/A
+-commutativeN/A
/-lowering-/.f64N/A
Applied egg-rr50.4%
if -0.050000000000000003 < (sin.f64 ky) < 1.9999999999999999e-7Initial program 85.0%
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.8%
Simplified99.8%
Taylor expanded in ky around 0
Simplified99.8%
if 1.9999999999999999e-7 < (sin.f64 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.f6461.9%
Simplified61.9%
Final simplification77.0%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.05)
(* (sin ky) (/ th (hypot (sin ky) (sin kx))))
(if (<= (sin ky) 2e-7)
(* (sin th) (/ (sin ky) (hypot (sin kx) ky)))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.05) {
tmp = sin(ky) * (th / hypot(sin(ky), sin(kx)));
} else if (sin(ky) <= 2e-7) {
tmp = sin(th) * (sin(ky) / hypot(sin(kx), ky));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.05) {
tmp = Math.sin(ky) * (th / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else if (Math.sin(ky) <= 2e-7) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.hypot(Math.sin(kx), ky));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.05: tmp = math.sin(ky) * (th / math.hypot(math.sin(ky), math.sin(kx))) elif math.sin(ky) <= 2e-7: tmp = math.sin(th) * (math.sin(ky) / math.hypot(math.sin(kx), ky)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.05) tmp = Float64(sin(ky) * Float64(th / hypot(sin(ky), sin(kx)))); elseif (sin(ky) <= 2e-7) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(sin(kx), ky))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.05) tmp = sin(ky) * (th / hypot(sin(ky), sin(kx))); elseif (sin(ky) <= 2e-7) tmp = sin(th) * (sin(ky) / hypot(sin(kx), ky)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.05], N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-7], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + ky ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.05:\\
\;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-7}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin kx, ky\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.050000000000000003Initial 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.7%
Simplified99.7%
Taylor expanded in th around 0
Simplified50.5%
if -0.050000000000000003 < (sin.f64 ky) < 1.9999999999999999e-7Initial program 85.0%
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.8%
Simplified99.8%
Taylor expanded in ky around 0
Simplified99.8%
if 1.9999999999999999e-7 < (sin.f64 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.f6461.9%
Simplified61.9%
Final simplification77.0%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.05)
(* (sin ky) (/ th (hypot (sin ky) (sin kx))))
(if (<= (sin ky) 2e-7)
(* (sin ky) (/ (sin th) (hypot ky (sin kx))))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.05) {
tmp = sin(ky) * (th / hypot(sin(ky), sin(kx)));
} else if (sin(ky) <= 2e-7) {
tmp = sin(ky) * (sin(th) / hypot(ky, sin(kx)));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.05) {
tmp = Math.sin(ky) * (th / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else if (Math.sin(ky) <= 2e-7) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.hypot(ky, Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.05: tmp = math.sin(ky) * (th / math.hypot(math.sin(ky), math.sin(kx))) elif math.sin(ky) <= 2e-7: tmp = math.sin(ky) * (math.sin(th) / math.hypot(ky, math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.05) tmp = Float64(sin(ky) * Float64(th / hypot(sin(ky), sin(kx)))); elseif (sin(ky) <= 2e-7) tmp = Float64(sin(ky) * Float64(sin(th) / hypot(ky, sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.05) tmp = sin(ky) * (th / hypot(sin(ky), sin(kx))); elseif (sin(ky) <= 2e-7) tmp = sin(ky) * (sin(th) / hypot(ky, sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.05], N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-7], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.05:\\
\;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-7}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.050000000000000003Initial 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.7%
Simplified99.7%
Taylor expanded in th around 0
Simplified50.5%
if -0.050000000000000003 < (sin.f64 ky) < 1.9999999999999999e-7Initial program 85.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.7%
Simplified99.7%
Taylor expanded in ky around 0
Simplified99.7%
if 1.9999999999999999e-7 < (sin.f64 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.f6461.9%
Simplified61.9%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.15)
(*
(sin ky)
(/ (* th (+ 1.0 (* -0.16666666666666666 (* th th)))) (hypot (sin ky) kx)))
(if (<= (sin ky) 4e-59) (* (sin th) (/ (sin ky) (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.15) {
tmp = sin(ky) * ((th * (1.0 + (-0.16666666666666666 * (th * th)))) / hypot(sin(ky), kx));
} else if (sin(ky) <= 4e-59) {
tmp = sin(th) * (sin(ky) / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.15) {
tmp = Math.sin(ky) * ((th * (1.0 + (-0.16666666666666666 * (th * th)))) / Math.hypot(Math.sin(ky), kx));
} else if (Math.sin(ky) <= 4e-59) {
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) <= -0.15: tmp = math.sin(ky) * ((th * (1.0 + (-0.16666666666666666 * (th * th)))) / math.hypot(math.sin(ky), kx)) elif math.sin(ky) <= 4e-59: 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 (sin(ky) <= -0.15) tmp = Float64(sin(ky) * Float64(Float64(th * Float64(1.0 + Float64(-0.16666666666666666 * Float64(th * th)))) / hypot(sin(ky), kx))); elseif (sin(ky) <= 4e-59) 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) <= -0.15) tmp = sin(ky) * ((th * (1.0 + (-0.16666666666666666 * (th * th)))) / hypot(sin(ky), kx)); elseif (sin(ky) <= 4e-59) tmp = sin(th) * (sin(ky) / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.15], N[(N[Sin[ky], $MachinePrecision] * N[(N[(th * N[(1.0 + N[(-0.16666666666666666 * N[(th * th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 4e-59], 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}\;\sin ky \leq -0.15:\\
\;\;\;\;\sin ky \cdot \frac{th \cdot \left(1 + -0.16666666666666666 \cdot \left(th \cdot th\right)\right)}{\mathsf{hypot}\left(\sin ky, kx\right)}\\
\mathbf{elif}\;\sin ky \leq 4 \cdot 10^{-59}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.149999999999999994Initial program 99.8%
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
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6451.3%
Simplified51.3%
Taylor expanded in kx around 0
Simplified32.1%
if -0.149999999999999994 < (sin.f64 ky) < 4.0000000000000001e-59Initial program 84.1%
Taylor expanded in ky around 0
sin-lowering-sin.f6440.1%
Simplified40.1%
if 4.0000000000000001e-59 < (sin.f64 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.f6458.1%
Simplified58.1%
Final simplification44.3%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.15) (/ th (/ (hypot (sin ky) kx) (sin ky))) (if (<= (sin ky) 4e-59) (* (sin th) (/ (sin ky) (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.15) {
tmp = th / (hypot(sin(ky), kx) / sin(ky));
} else if (sin(ky) <= 4e-59) {
tmp = sin(th) * (sin(ky) / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.15) {
tmp = th / (Math.hypot(Math.sin(ky), kx) / Math.sin(ky));
} else if (Math.sin(ky) <= 4e-59) {
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) <= -0.15: tmp = th / (math.hypot(math.sin(ky), kx) / math.sin(ky)) elif math.sin(ky) <= 4e-59: 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 (sin(ky) <= -0.15) tmp = Float64(th / Float64(hypot(sin(ky), kx) / sin(ky))); elseif (sin(ky) <= 4e-59) 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) <= -0.15) tmp = th / (hypot(sin(ky), kx) / sin(ky)); elseif (sin(ky) <= 4e-59) tmp = sin(th) * (sin(ky) / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.15], N[(th / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 4e-59], 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}\;\sin ky \leq -0.15:\\
\;\;\;\;\frac{th}{\frac{\mathsf{hypot}\left(\sin ky, kx\right)}{\sin ky}}\\
\mathbf{elif}\;\sin ky \leq 4 \cdot 10^{-59}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.149999999999999994Initial program 99.8%
Taylor expanded in th around 0
Simplified51.0%
*-commutativeN/A
clear-numN/A
pow2N/A
pow2N/A
un-div-invN/A
/-lowering-/.f64N/A
+-commutativeN/A
/-lowering-/.f64N/A
Applied egg-rr51.0%
Taylor expanded in kx around 0
Simplified32.1%
if -0.149999999999999994 < (sin.f64 ky) < 4.0000000000000001e-59Initial program 84.1%
Taylor expanded in ky around 0
sin-lowering-sin.f6440.1%
Simplified40.1%
if 4.0000000000000001e-59 < (sin.f64 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.f6458.1%
Simplified58.1%
Final simplification44.3%
(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.8%
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 (<= kx 0.012) (* (sin th) (/ (sin ky) (hypot kx (sin ky)))) (* (sin th) (/ (sin ky) (pow (+ 0.5 (* -0.5 (cos (* kx 2.0)))) 0.5)))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.012) {
tmp = sin(th) * (sin(ky) / hypot(kx, sin(ky)));
} else {
tmp = sin(th) * (sin(ky) / pow((0.5 + (-0.5 * cos((kx * 2.0)))), 0.5));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.012) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.hypot(kx, Math.sin(ky)));
} else {
tmp = Math.sin(th) * (Math.sin(ky) / Math.pow((0.5 + (-0.5 * Math.cos((kx * 2.0)))), 0.5));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 0.012: tmp = math.sin(th) * (math.sin(ky) / math.hypot(kx, math.sin(ky))) else: tmp = math.sin(th) * (math.sin(ky) / math.pow((0.5 + (-0.5 * math.cos((kx * 2.0)))), 0.5)) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 0.012) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(kx, sin(ky)))); else tmp = Float64(sin(th) * Float64(sin(ky) / (Float64(0.5 + Float64(-0.5 * cos(Float64(kx * 2.0)))) ^ 0.5))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 0.012) tmp = sin(th) * (sin(ky) / hypot(kx, sin(ky))); else tmp = sin(th) * (sin(ky) / ((0.5 + (-0.5 * cos((kx * 2.0)))) ^ 0.5)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 0.012], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[kx ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Power[N[(0.5 + N[(-0.5 * N[Cos[N[(kx * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 0.012:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(kx, \sin ky\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{{\left(0.5 + -0.5 \cdot \cos \left(kx \cdot 2\right)\right)}^{0.5}}\\
\end{array}
\end{array}
if kx < 0.012Initial program 91.1%
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.8%
Simplified99.8%
Taylor expanded in kx around 0
Simplified72.0%
if 0.012 < kx Initial program 99.6%
Taylor expanded in ky around 0
sin-lowering-sin.f6427.0%
Simplified27.0%
unpow1N/A
metadata-evalN/A
pow-prod-upN/A
pow-prod-downN/A
pow-lowering-pow.f64N/A
sqr-sin-aN/A
cancel-sign-sub-invN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
count-2N/A
cos-lowering-cos.f64N/A
count-2N/A
*-commutativeN/A
*-lowering-*.f6461.1%
Applied egg-rr61.1%
Final simplification69.8%
(FPCore (kx ky th) :precision binary64 (if (<= th 0.38) (* (sin ky) (/ th (hypot (sin ky) (sin kx)))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.38) {
tmp = sin(ky) * (th / hypot(sin(ky), sin(kx)));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.38) {
tmp = Math.sin(ky) * (th / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 0.38: tmp = math.sin(ky) * (th / math.hypot(math.sin(ky), math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 0.38) tmp = Float64(sin(ky) * Float64(th / hypot(sin(ky), sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 0.38) tmp = sin(ky) * (th / hypot(sin(ky), sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 0.38], N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 0.38:\\
\;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if th < 0.38Initial program 92.5%
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
Simplified65.1%
if 0.38 < th Initial program 94.3%
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.f6422.1%
Simplified22.1%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 4e-59) (* (sin th) (/ (sin ky) (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 4e-59) {
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) <= 4d-59) 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) <= 4e-59) {
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) <= 4e-59: 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 (sin(ky) <= 4e-59) 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) <= 4e-59) tmp = sin(th) * (sin(ky) / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 4e-59], 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}\;\sin ky \leq 4 \cdot 10^{-59}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 4.0000000000000001e-59Initial program 89.4%
Taylor expanded in ky around 0
sin-lowering-sin.f6428.8%
Simplified28.8%
if 4.0000000000000001e-59 < (sin.f64 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.f6458.1%
Simplified58.1%
Final simplification38.5%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 4e-59) (* (sin ky) (/ (sin th) (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 4e-59) {
tmp = sin(ky) * (sin(th) / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= 4d-59) then
tmp = sin(ky) * (sin(th) / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= 4e-59) {
tmp = Math.sin(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) <= 4e-59: tmp = math.sin(ky) * (math.sin(th) / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 4e-59) tmp = Float64(sin(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) <= 4e-59) tmp = sin(ky) * (sin(th) / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 4e-59], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 4 \cdot 10^{-59}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 4.0000000000000001e-59Initial 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.7%
Simplified99.7%
Taylor expanded in ky around 0
/-lowering-/.f64N/A
sin-lowering-sin.f64N/A
sin-lowering-sin.f6428.7%
Simplified28.7%
if 4.0000000000000001e-59 < (sin.f64 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.f6458.1%
Simplified58.1%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 2e-81) (* (sin ky) (/ (sin th) kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 2e-81) {
tmp = sin(ky) * (sin(th) / kx);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= 2d-81) then
tmp = sin(ky) * (sin(th) / kx)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= 2e-81) {
tmp = Math.sin(ky) * (Math.sin(th) / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 2e-81: tmp = math.sin(ky) * (math.sin(th) / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 2e-81) tmp = Float64(sin(ky) * Float64(sin(th) / kx)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= 2e-81) tmp = sin(ky) * (sin(th) / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-81], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 2 \cdot 10^{-81}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 1.9999999999999999e-81Initial program 89.2%
Taylor expanded in ky around 0
sin-lowering-sin.f6428.2%
Simplified28.2%
Taylor expanded in kx around 0
/-lowering-/.f64N/A
associate-*r*N/A
distribute-lft1-inN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
sin-lowering-sin.f6414.6%
Simplified14.6%
Taylor expanded in kx around 0
associate-/l*N/A
*-lowering-*.f64N/A
sin-lowering-sin.f64N/A
/-lowering-/.f64N/A
sin-lowering-sin.f6419.8%
Simplified19.8%
if 1.9999999999999999e-81 < (sin.f64 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.f6456.9%
Simplified56.9%
(FPCore (kx ky th) :precision binary64 (if (<= ky 2.3e-59) (* (sin th) (/ ky (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 2.3e-59) {
tmp = sin(th) * (ky / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= 2.3d-59) then
tmp = sin(th) * (ky / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 2.3e-59) {
tmp = Math.sin(th) * (ky / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 2.3e-59: tmp = math.sin(th) * (ky / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 2.3e-59) tmp = Float64(sin(th) * Float64(ky / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 2.3e-59) tmp = sin(th) * (ky / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 2.3e-59], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 2.3 \cdot 10^{-59}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 2.29999999999999979e-59Initial program 89.3%
Taylor expanded in ky around 0
/-lowering-/.f64N/A
sin-lowering-sin.f6427.7%
Simplified27.7%
if 2.29999999999999979e-59 < ky Initial program 99.8%
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.7%
Simplified99.7%
Taylor expanded in kx around 0
sin-lowering-sin.f6438.4%
Simplified38.4%
Final simplification31.3%
(FPCore (kx ky th) :precision binary64 (if (<= ky 3.5e-81) (* th (/ ky (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 3.5e-81) {
tmp = th * (ky / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= 3.5d-81) then
tmp = th * (ky / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 3.5e-81) {
tmp = th * (ky / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 3.5e-81: tmp = th * (ky / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 3.5e-81) tmp = Float64(th * Float64(ky / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 3.5e-81) tmp = th * (ky / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 3.5e-81], N[(th * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 3.5 \cdot 10^{-81}:\\
\;\;\;\;th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 3.49999999999999986e-81Initial program 89.1%
Taylor expanded in th around 0
Simplified45.0%
Taylor expanded in ky around 0
/-lowering-/.f64N/A
sin-lowering-sin.f6416.5%
Simplified16.5%
if 3.49999999999999986e-81 < ky Initial program 99.8%
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.7%
Simplified99.7%
Taylor expanded in kx around 0
sin-lowering-sin.f6438.0%
Simplified38.0%
Final simplification24.1%
(FPCore (kx ky th)
:precision binary64
(if (<= kx 0.38)
(sin th)
(/
(* 2.0 (* (+ 1.0 (* -0.16666666666666666 (* th th))) (* th (* ky ky))))
(* kx kx))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.38) {
tmp = sin(th);
} else {
tmp = (2.0 * ((1.0 + (-0.16666666666666666 * (th * th))) * (th * (ky * ky)))) / (kx * 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 <= 0.38d0) then
tmp = sin(th)
else
tmp = (2.0d0 * ((1.0d0 + ((-0.16666666666666666d0) * (th * th))) * (th * (ky * ky)))) / (kx * kx)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.38) {
tmp = Math.sin(th);
} else {
tmp = (2.0 * ((1.0 + (-0.16666666666666666 * (th * th))) * (th * (ky * ky)))) / (kx * kx);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 0.38: tmp = math.sin(th) else: tmp = (2.0 * ((1.0 + (-0.16666666666666666 * (th * th))) * (th * (ky * ky)))) / (kx * kx) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 0.38) tmp = sin(th); else tmp = Float64(Float64(2.0 * Float64(Float64(1.0 + Float64(-0.16666666666666666 * Float64(th * th))) * Float64(th * Float64(ky * ky)))) / Float64(kx * kx)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 0.38) tmp = sin(th); else tmp = (2.0 * ((1.0 + (-0.16666666666666666 * (th * th))) * (th * (ky * ky)))) / (kx * kx); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 0.38], N[Sin[th], $MachinePrecision], N[(N[(2.0 * N[(N[(1.0 + N[(-0.16666666666666666 * N[(th * th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(th * N[(ky * ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(kx * kx), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 0.38:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot \left(\left(1 + -0.16666666666666666 \cdot \left(th \cdot th\right)\right) \cdot \left(th \cdot \left(ky \cdot ky\right)\right)\right)}{kx \cdot kx}\\
\end{array}
\end{array}
if kx < 0.38Initial program 91.2%
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.7%
Simplified99.7%
Taylor expanded in kx around 0
sin-lowering-sin.f6429.1%
Simplified29.1%
if 0.38 < kx Initial program 99.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.4%
Simplified99.4%
Taylor expanded in th around 0
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6446.4%
Simplified46.4%
Taylor expanded in kx around 0
associate-*r/N/A
associate-*l/N/A
metadata-evalN/A
associate-*r/N/A
+-lowering-+.f64N/A
sin-lowering-sin.f64N/A
associate-*r/N/A
metadata-evalN/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sin-lowering-sin.f649.5%
Simplified9.5%
Taylor expanded in ky around 0
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f649.2%
Simplified9.2%
Final simplification25.2%
(FPCore (kx ky th)
:precision binary64
(if (<= kx 0.35)
th
(/
(* 2.0 (* (+ 1.0 (* -0.16666666666666666 (* th th))) (* th (* ky ky))))
(* kx kx))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.35) {
tmp = th;
} else {
tmp = (2.0 * ((1.0 + (-0.16666666666666666 * (th * th))) * (th * (ky * ky)))) / (kx * 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 <= 0.35d0) then
tmp = th
else
tmp = (2.0d0 * ((1.0d0 + ((-0.16666666666666666d0) * (th * th))) * (th * (ky * ky)))) / (kx * kx)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.35) {
tmp = th;
} else {
tmp = (2.0 * ((1.0 + (-0.16666666666666666 * (th * th))) * (th * (ky * ky)))) / (kx * kx);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 0.35: tmp = th else: tmp = (2.0 * ((1.0 + (-0.16666666666666666 * (th * th))) * (th * (ky * ky)))) / (kx * kx) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 0.35) tmp = th; else tmp = Float64(Float64(2.0 * Float64(Float64(1.0 + Float64(-0.16666666666666666 * Float64(th * th))) * Float64(th * Float64(ky * ky)))) / Float64(kx * kx)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 0.35) tmp = th; else tmp = (2.0 * ((1.0 + (-0.16666666666666666 * (th * th))) * (th * (ky * ky)))) / (kx * kx); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 0.35], th, N[(N[(2.0 * N[(N[(1.0 + N[(-0.16666666666666666 * N[(th * th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(th * N[(ky * ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(kx * kx), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 0.35:\\
\;\;\;\;th\\
\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot \left(\left(1 + -0.16666666666666666 \cdot \left(th \cdot th\right)\right) \cdot \left(th \cdot \left(ky \cdot ky\right)\right)\right)}{kx \cdot kx}\\
\end{array}
\end{array}
if kx < 0.34999999999999998Initial program 91.2%
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.7%
Simplified99.7%
Taylor expanded in kx around 0
sin-lowering-sin.f6429.1%
Simplified29.1%
Taylor expanded in th around 0
Simplified17.8%
if 0.34999999999999998 < kx Initial program 99.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.4%
Simplified99.4%
Taylor expanded in th around 0
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6446.4%
Simplified46.4%
Taylor expanded in kx around 0
associate-*r/N/A
associate-*l/N/A
metadata-evalN/A
associate-*r/N/A
+-lowering-+.f64N/A
sin-lowering-sin.f64N/A
associate-*r/N/A
metadata-evalN/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sin-lowering-sin.f649.5%
Simplified9.5%
Taylor expanded in ky around 0
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f649.2%
Simplified9.2%
Final simplification16.2%
(FPCore (kx ky th) :precision binary64 (if (<= kx 0.35) th (* th (* -0.16666666666666666 (* th th)))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.35) {
tmp = th;
} else {
tmp = th * (-0.16666666666666666 * (th * 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 (kx <= 0.35d0) then
tmp = th
else
tmp = th * ((-0.16666666666666666d0) * (th * th))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.35) {
tmp = th;
} else {
tmp = th * (-0.16666666666666666 * (th * th));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 0.35: tmp = th else: tmp = th * (-0.16666666666666666 * (th * th)) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 0.35) tmp = th; else tmp = Float64(th * Float64(-0.16666666666666666 * Float64(th * th))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 0.35) tmp = th; else tmp = th * (-0.16666666666666666 * (th * th)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 0.35], th, N[(th * N[(-0.16666666666666666 * N[(th * th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 0.35:\\
\;\;\;\;th\\
\mathbf{else}:\\
\;\;\;\;th \cdot \left(-0.16666666666666666 \cdot \left(th \cdot th\right)\right)\\
\end{array}
\end{array}
if kx < 0.34999999999999998Initial program 91.2%
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.7%
Simplified99.7%
Taylor expanded in kx around 0
sin-lowering-sin.f6429.1%
Simplified29.1%
Taylor expanded in th around 0
Simplified17.8%
if 0.34999999999999998 < kx Initial program 99.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.4%
Simplified99.4%
Taylor expanded in kx around 0
sin-lowering-sin.f649.7%
Simplified9.7%
Taylor expanded in th around 0
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f646.7%
Simplified6.7%
Taylor expanded in th around inf
*-commutativeN/A
cube-multN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f647.7%
Simplified7.7%
(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 92.8%
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.f6425.3%
Simplified25.3%
Taylor expanded in th around 0
Simplified15.8%
herbie shell --seed 2024144
(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)))