
(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 ky) (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / hypot(sin(ky), sin(kx))) * sin(th);
}
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot \sin th
\end{array}
Initial program 92.9%
+-commutative92.9%
unpow292.9%
unpow292.9%
hypot-undefine99.7%
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.004)
(* (sin ky) (fabs (/ (sin th) (sin ky))))
(if (<= (sin ky) 0.001)
(* (sin th) (/ (sin ky) (hypot (sin kx) ky)))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.004) {
tmp = sin(ky) * fabs((sin(th) / sin(ky)));
} else if (sin(ky) <= 0.001) {
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.004) {
tmp = Math.sin(ky) * Math.abs((Math.sin(th) / Math.sin(ky)));
} else if (Math.sin(ky) <= 0.001) {
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.004: tmp = math.sin(ky) * math.fabs((math.sin(th) / math.sin(ky))) elif math.sin(ky) <= 0.001: 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.004) tmp = Float64(sin(ky) * abs(Float64(sin(th) / sin(ky)))); elseif (sin(ky) <= 0.001) 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.004) tmp = sin(ky) * abs((sin(th) / sin(ky))); elseif (sin(ky) <= 0.001) 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.004], N[(N[Sin[ky], $MachinePrecision] * N[Abs[N[(N[Sin[th], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 0.001], 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.004:\\
\;\;\;\;\sin ky \cdot \left|\frac{\sin th}{\sin ky}\right|\\
\mathbf{elif}\;\sin ky \leq 0.001:\\
\;\;\;\;\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.0040000000000000001Initial program 99.5%
associate-*l/99.6%
associate-/l*99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
sqr-neg99.5%
unpow299.5%
Simplified99.4%
Taylor expanded in kx around 0 2.9%
add-sqr-sqrt1.4%
sqrt-unprod26.7%
pow226.7%
Applied egg-rr26.7%
unpow226.7%
rem-sqrt-square38.1%
Simplified38.1%
if -0.0040000000000000001 < (sin.f64 ky) < 1e-3Initial program 86.2%
Taylor expanded in ky around 0 86.1%
unpow286.1%
unpow286.1%
hypot-define99.6%
Applied egg-rr99.6%
if 1e-3 < (sin.f64 ky) Initial program 99.7%
associate-*l/99.7%
associate-/l*99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
sqr-neg99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 68.9%
Final simplification76.3%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.004)
(/ (sin ky) (/ (hypot (sin kx) (sin ky)) th))
(if (<= (sin ky) 0.001)
(* (sin th) (/ (sin ky) (hypot (sin kx) ky)))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.004) {
tmp = sin(ky) / (hypot(sin(kx), sin(ky)) / th);
} else if (sin(ky) <= 0.001) {
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.004) {
tmp = Math.sin(ky) / (Math.hypot(Math.sin(kx), Math.sin(ky)) / th);
} else if (Math.sin(ky) <= 0.001) {
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.004: tmp = math.sin(ky) / (math.hypot(math.sin(kx), math.sin(ky)) / th) elif math.sin(ky) <= 0.001: 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.004) tmp = Float64(sin(ky) / Float64(hypot(sin(kx), sin(ky)) / th)); elseif (sin(ky) <= 0.001) 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.004) tmp = sin(ky) / (hypot(sin(kx), sin(ky)) / th); elseif (sin(ky) <= 0.001) 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.004], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 0.001], 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.004:\\
\;\;\;\;\frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{th}}\\
\mathbf{elif}\;\sin ky \leq 0.001:\\
\;\;\;\;\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.0040000000000000001Initial program 99.5%
associate-*l/99.6%
associate-/l*99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
sqr-neg99.5%
unpow299.5%
Simplified99.4%
clear-num99.2%
un-div-inv99.4%
Applied egg-rr99.4%
Taylor expanded in th around 0 64.1%
associate-*l/64.2%
+-commutative64.2%
unpow264.2%
unpow264.2%
hypot-undefine64.2%
*-lft-identity64.2%
hypot-undefine64.2%
unpow264.2%
unpow264.2%
+-commutative64.2%
unpow264.2%
unpow264.2%
hypot-define64.2%
Simplified64.2%
if -0.0040000000000000001 < (sin.f64 ky) < 1e-3Initial program 86.2%
Taylor expanded in ky around 0 86.1%
unpow286.1%
unpow286.1%
hypot-define99.6%
Applied egg-rr99.6%
if 1e-3 < (sin.f64 ky) Initial program 99.7%
associate-*l/99.7%
associate-/l*99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
sqr-neg99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 68.9%
Final simplification82.9%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.004)
(/ (* (sin ky) th) (hypot (sin ky) (sin kx)))
(if (<= (sin ky) 0.001)
(* (sin th) (/ (sin ky) (hypot (sin kx) ky)))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.004) {
tmp = (sin(ky) * th) / hypot(sin(ky), sin(kx));
} else if (sin(ky) <= 0.001) {
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.004) {
tmp = (Math.sin(ky) * th) / Math.hypot(Math.sin(ky), Math.sin(kx));
} else if (Math.sin(ky) <= 0.001) {
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.004: tmp = (math.sin(ky) * th) / math.hypot(math.sin(ky), math.sin(kx)) elif math.sin(ky) <= 0.001: 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.004) tmp = Float64(Float64(sin(ky) * th) / hypot(sin(ky), sin(kx))); elseif (sin(ky) <= 0.001) 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.004) tmp = (sin(ky) * th) / hypot(sin(ky), sin(kx)); elseif (sin(ky) <= 0.001) 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.004], N[(N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 0.001], 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.004:\\
\;\;\;\;\frac{\sin ky \cdot th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{elif}\;\sin ky \leq 0.001:\\
\;\;\;\;\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.0040000000000000001Initial program 99.5%
associate-*l/99.6%
associate-/l*99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
sqr-neg99.5%
unpow299.5%
Simplified99.4%
associate-*r/99.5%
Applied egg-rr99.5%
Taylor expanded in th around 0 64.2%
if -0.0040000000000000001 < (sin.f64 ky) < 1e-3Initial program 86.2%
Taylor expanded in ky around 0 86.1%
unpow286.1%
unpow286.1%
hypot-define99.6%
Applied egg-rr99.6%
if 1e-3 < (sin.f64 ky) Initial program 99.7%
associate-*l/99.7%
associate-/l*99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
sqr-neg99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 68.9%
Final simplification82.9%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.004)
(/
(sin ky)
(* (hypot (sin kx) (sin ky)) (+ (/ 1.0 th) (* th 0.16666666666666666))))
(if (<= (sin ky) 0.001)
(* (sin th) (/ (sin ky) (hypot (sin kx) ky)))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.004) {
tmp = sin(ky) / (hypot(sin(kx), sin(ky)) * ((1.0 / th) + (th * 0.16666666666666666)));
} else if (sin(ky) <= 0.001) {
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.004) {
tmp = Math.sin(ky) / (Math.hypot(Math.sin(kx), Math.sin(ky)) * ((1.0 / th) + (th * 0.16666666666666666)));
} else if (Math.sin(ky) <= 0.001) {
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.004: tmp = math.sin(ky) / (math.hypot(math.sin(kx), math.sin(ky)) * ((1.0 / th) + (th * 0.16666666666666666))) elif math.sin(ky) <= 0.001: 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.004) tmp = Float64(sin(ky) / Float64(hypot(sin(kx), sin(ky)) * Float64(Float64(1.0 / th) + Float64(th * 0.16666666666666666)))); elseif (sin(ky) <= 0.001) 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.004) tmp = sin(ky) / (hypot(sin(kx), sin(ky)) * ((1.0 / th) + (th * 0.16666666666666666))); elseif (sin(ky) <= 0.001) 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.004], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] * N[(N[(1.0 / th), $MachinePrecision] + N[(th * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 0.001], 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.004:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\sin kx, \sin ky\right) \cdot \left(\frac{1}{th} + th \cdot 0.16666666666666666\right)}\\
\mathbf{elif}\;\sin ky \leq 0.001:\\
\;\;\;\;\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.0040000000000000001Initial program 99.5%
associate-*l/99.6%
associate-/l*99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
sqr-neg99.5%
unpow299.5%
Simplified99.4%
clear-num99.2%
un-div-inv99.4%
Applied egg-rr99.4%
Taylor expanded in th around 0 64.5%
+-commutative64.5%
+-commutative64.5%
unpow264.5%
unpow264.5%
hypot-undefine64.5%
associate-*r*64.5%
+-commutative64.5%
unpow264.5%
unpow264.5%
hypot-undefine64.5%
distribute-rgt-out64.5%
Simplified64.5%
if -0.0040000000000000001 < (sin.f64 ky) < 1e-3Initial program 86.2%
Taylor expanded in ky around 0 86.1%
unpow286.1%
unpow286.1%
hypot-define99.6%
Applied egg-rr99.6%
if 1e-3 < (sin.f64 ky) Initial program 99.7%
associate-*l/99.7%
associate-/l*99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
sqr-neg99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 68.9%
Final simplification83.0%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.01) (fabs (sin th)) (if (<= (sin ky) 4e-31) (* (sin ky) (/ (sin th) (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.01) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 4e-31) {
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) <= (-0.01d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 4d-31) 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) <= -0.01) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 4e-31) {
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) <= -0.01: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 4e-31: 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) <= -0.01) tmp = abs(sin(th)); elseif (sin(ky) <= 4e-31) 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) <= -0.01) tmp = abs(sin(th)); elseif (sin(ky) <= 4e-31) 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], -0.01], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 4e-31], 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 -0.01:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 4 \cdot 10^{-31}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0100000000000000002Initial program 99.5%
associate-*l/99.6%
associate-/l*99.4%
unpow299.4%
sqr-neg99.4%
sin-neg99.4%
sin-neg99.4%
unpow299.4%
unpow299.4%
sin-neg99.4%
sin-neg99.4%
sqr-neg99.4%
unpow299.4%
Simplified99.4%
Taylor expanded in kx around 0 3.0%
add-sqr-sqrt1.5%
sqrt-unprod18.0%
pow218.0%
Applied egg-rr18.0%
unpow218.0%
rem-sqrt-square24.7%
associate-*r/24.7%
*-rgt-identity24.7%
times-frac24.8%
*-inverses24.8%
/-rgt-identity24.8%
*-lft-identity24.8%
Simplified24.8%
if -0.0100000000000000002 < (sin.f64 ky) < 4e-31Initial program 85.5%
associate-*l/83.1%
associate-/l*85.3%
unpow285.3%
sqr-neg85.3%
sin-neg85.3%
sin-neg85.3%
unpow285.3%
unpow285.3%
sin-neg85.3%
sin-neg85.3%
sqr-neg85.3%
unpow285.3%
Simplified99.5%
Taylor expanded in ky around 0 41.7%
if 4e-31 < (sin.f64 ky) Initial program 99.7%
associate-*l/99.6%
associate-/l*99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
sqr-neg99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 66.9%
Final simplification44.5%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.01) (fabs (sin th)) (if (<= (sin ky) 4e-31) (/ (sin ky) (/ (sin kx) (sin th))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.01) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 4e-31) {
tmp = sin(ky) / (sin(kx) / sin(th));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.01d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 4d-31) then
tmp = sin(ky) / (sin(kx) / sin(th))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.01) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 4e-31) {
tmp = Math.sin(ky) / (Math.sin(kx) / Math.sin(th));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.01: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 4e-31: tmp = math.sin(ky) / (math.sin(kx) / math.sin(th)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.01) tmp = abs(sin(th)); elseif (sin(ky) <= 4e-31) tmp = Float64(sin(ky) / Float64(sin(kx) / sin(th))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.01) tmp = abs(sin(th)); elseif (sin(ky) <= 4e-31) tmp = sin(ky) / (sin(kx) / sin(th)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.01], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 4e-31], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.01:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 4 \cdot 10^{-31}:\\
\;\;\;\;\frac{\sin ky}{\frac{\sin kx}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0100000000000000002Initial program 99.5%
associate-*l/99.6%
associate-/l*99.4%
unpow299.4%
sqr-neg99.4%
sin-neg99.4%
sin-neg99.4%
unpow299.4%
unpow299.4%
sin-neg99.4%
sin-neg99.4%
sqr-neg99.4%
unpow299.4%
Simplified99.4%
Taylor expanded in kx around 0 3.0%
add-sqr-sqrt1.5%
sqrt-unprod18.0%
pow218.0%
Applied egg-rr18.0%
unpow218.0%
rem-sqrt-square24.7%
associate-*r/24.7%
*-rgt-identity24.7%
times-frac24.8%
*-inverses24.8%
/-rgt-identity24.8%
*-lft-identity24.8%
Simplified24.8%
if -0.0100000000000000002 < (sin.f64 ky) < 4e-31Initial program 85.5%
associate-*l/83.1%
associate-/l*85.3%
unpow285.3%
sqr-neg85.3%
sin-neg85.3%
sin-neg85.3%
unpow285.3%
unpow285.3%
sin-neg85.3%
sin-neg85.3%
sqr-neg85.3%
unpow285.3%
Simplified99.5%
clear-num99.5%
un-div-inv99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 41.7%
if 4e-31 < (sin.f64 ky) Initial program 99.7%
associate-*l/99.6%
associate-/l*99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
sqr-neg99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 66.9%
Final simplification44.5%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.004) (* (sin ky) (fabs (/ (sin th) (sin ky)))) (if (<= (sin ky) 4e-31) (/ (sin ky) (/ (sin kx) (sin th))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.004) {
tmp = sin(ky) * fabs((sin(th) / sin(ky)));
} else if (sin(ky) <= 4e-31) {
tmp = sin(ky) / (sin(kx) / sin(th));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.004d0)) then
tmp = sin(ky) * abs((sin(th) / sin(ky)))
else if (sin(ky) <= 4d-31) then
tmp = sin(ky) / (sin(kx) / sin(th))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.004) {
tmp = Math.sin(ky) * Math.abs((Math.sin(th) / Math.sin(ky)));
} else if (Math.sin(ky) <= 4e-31) {
tmp = Math.sin(ky) / (Math.sin(kx) / Math.sin(th));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.004: tmp = math.sin(ky) * math.fabs((math.sin(th) / math.sin(ky))) elif math.sin(ky) <= 4e-31: tmp = math.sin(ky) / (math.sin(kx) / math.sin(th)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.004) tmp = Float64(sin(ky) * abs(Float64(sin(th) / sin(ky)))); elseif (sin(ky) <= 4e-31) tmp = Float64(sin(ky) / Float64(sin(kx) / sin(th))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.004) tmp = sin(ky) * abs((sin(th) / sin(ky))); elseif (sin(ky) <= 4e-31) tmp = sin(ky) / (sin(kx) / sin(th)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.004], N[(N[Sin[ky], $MachinePrecision] * N[Abs[N[(N[Sin[th], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 4e-31], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.004:\\
\;\;\;\;\sin ky \cdot \left|\frac{\sin th}{\sin ky}\right|\\
\mathbf{elif}\;\sin ky \leq 4 \cdot 10^{-31}:\\
\;\;\;\;\frac{\sin ky}{\frac{\sin kx}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0040000000000000001Initial program 99.5%
associate-*l/99.6%
associate-/l*99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
sqr-neg99.5%
unpow299.5%
Simplified99.4%
Taylor expanded in kx around 0 2.9%
add-sqr-sqrt1.4%
sqrt-unprod26.7%
pow226.7%
Applied egg-rr26.7%
unpow226.7%
rem-sqrt-square38.1%
Simplified38.1%
if -0.0040000000000000001 < (sin.f64 ky) < 4e-31Initial program 85.4%
associate-*l/83.0%
associate-/l*85.2%
unpow285.2%
sqr-neg85.2%
sin-neg85.2%
sin-neg85.2%
unpow285.2%
unpow285.2%
sin-neg85.2%
sin-neg85.2%
sqr-neg85.2%
unpow285.2%
Simplified99.5%
clear-num99.5%
un-div-inv99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 42.0%
if 4e-31 < (sin.f64 ky) Initial program 99.7%
associate-*l/99.6%
associate-/l*99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
sqr-neg99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 66.9%
Final simplification47.9%
(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/91.8%
associate-/l*92.8%
unpow292.8%
sqr-neg92.8%
sin-neg92.8%
sin-neg92.8%
unpow292.8%
unpow292.8%
sin-neg92.8%
sin-neg92.8%
sqr-neg92.8%
unpow292.8%
Simplified99.5%
Final simplification99.5%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.004) (fabs (sin th)) (if (<= (sin ky) 4e-31) (* ky (/ (sin th) (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.004) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 4e-31) {
tmp = ky * (sin(th) / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.004d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 4d-31) then
tmp = ky * (sin(th) / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.004) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 4e-31) {
tmp = ky * (Math.sin(th) / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.004: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 4e-31: tmp = 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) <= -0.004) tmp = abs(sin(th)); elseif (sin(ky) <= 4e-31) tmp = Float64(ky * Float64(sin(th) / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.004) tmp = abs(sin(th)); elseif (sin(ky) <= 4e-31) tmp = ky * (sin(th) / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.004], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 4e-31], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.004:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 4 \cdot 10^{-31}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0040000000000000001Initial program 99.5%
associate-*l/99.6%
associate-/l*99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
sqr-neg99.5%
unpow299.5%
Simplified99.4%
Taylor expanded in kx around 0 2.9%
add-sqr-sqrt1.6%
sqrt-unprod17.7%
pow217.7%
Applied egg-rr17.7%
unpow217.7%
rem-sqrt-square24.4%
associate-*r/24.4%
*-rgt-identity24.4%
times-frac24.4%
*-inverses24.4%
/-rgt-identity24.4%
*-lft-identity24.4%
Simplified24.4%
if -0.0040000000000000001 < (sin.f64 ky) < 4e-31Initial program 85.4%
associate-*l/83.0%
associate-/l*85.2%
unpow285.2%
sqr-neg85.2%
sin-neg85.2%
sin-neg85.2%
unpow285.2%
unpow285.2%
sin-neg85.2%
sin-neg85.2%
sqr-neg85.2%
unpow285.2%
Simplified99.5%
Taylor expanded in ky around 0 40.7%
associate-/l*42.0%
Simplified42.0%
if 4e-31 < (sin.f64 ky) Initial program 99.7%
associate-*l/99.6%
associate-/l*99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
sqr-neg99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 66.9%
Final simplification44.4%
(FPCore (kx ky th) :precision binary64 (if (<= kx 2.1e-5) (sin th) (/ ky (* (sin kx) (+ (/ 1.0 th) (* th 0.16666666666666666))))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 2.1e-5) {
tmp = sin(th);
} else {
tmp = ky / (sin(kx) * ((1.0 / th) + (th * 0.16666666666666666)));
}
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 <= 2.1d-5) then
tmp = sin(th)
else
tmp = ky / (sin(kx) * ((1.0d0 / th) + (th * 0.16666666666666666d0)))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 2.1e-5) {
tmp = Math.sin(th);
} else {
tmp = ky / (Math.sin(kx) * ((1.0 / th) + (th * 0.16666666666666666)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 2.1e-5: tmp = math.sin(th) else: tmp = ky / (math.sin(kx) * ((1.0 / th) + (th * 0.16666666666666666))) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 2.1e-5) tmp = sin(th); else tmp = Float64(ky / Float64(sin(kx) * Float64(Float64(1.0 / th) + Float64(th * 0.16666666666666666)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 2.1e-5) tmp = sin(th); else tmp = ky / (sin(kx) * ((1.0 / th) + (th * 0.16666666666666666))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 2.1e-5], N[Sin[th], $MachinePrecision], N[(ky / N[(N[Sin[kx], $MachinePrecision] * N[(N[(1.0 / th), $MachinePrecision] + N[(th * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 2.1 \cdot 10^{-5}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{ky}{\sin kx \cdot \left(\frac{1}{th} + th \cdot 0.16666666666666666\right)}\\
\end{array}
\end{array}
if kx < 2.09999999999999988e-5Initial program 90.7%
associate-*l/89.1%
associate-/l*90.6%
unpow290.6%
sqr-neg90.6%
sin-neg90.6%
sin-neg90.6%
unpow290.6%
unpow290.6%
sin-neg90.6%
sin-neg90.6%
sqr-neg90.6%
unpow290.6%
Simplified99.6%
Taylor expanded in kx around 0 31.8%
if 2.09999999999999988e-5 < kx Initial program 99.4%
associate-*l/99.6%
associate-/l*99.3%
unpow299.3%
sqr-neg99.3%
sin-neg99.3%
sin-neg99.3%
unpow299.3%
unpow299.3%
sin-neg99.3%
sin-neg99.3%
sqr-neg99.3%
unpow299.3%
Simplified99.3%
clear-num99.3%
un-div-inv99.4%
Applied egg-rr99.4%
Taylor expanded in th around 0 55.4%
+-commutative55.4%
+-commutative55.4%
unpow255.4%
unpow255.4%
hypot-undefine55.5%
associate-*r*55.5%
+-commutative55.5%
unpow255.5%
unpow255.5%
hypot-undefine55.5%
distribute-rgt-out55.5%
Simplified55.5%
Taylor expanded in ky around 0 25.7%
Final simplification30.3%
(FPCore (kx ky th) :precision binary64 (if (<= kx 390.0) (sin th) (+ 1.0 (+ (sin th) -1.0))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 390.0) {
tmp = sin(th);
} else {
tmp = 1.0 + (sin(th) + -1.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 <= 390.0d0) then
tmp = sin(th)
else
tmp = 1.0d0 + (sin(th) + (-1.0d0))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 390.0) {
tmp = Math.sin(th);
} else {
tmp = 1.0 + (Math.sin(th) + -1.0);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 390.0: tmp = math.sin(th) else: tmp = 1.0 + (math.sin(th) + -1.0) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 390.0) tmp = sin(th); else tmp = Float64(1.0 + Float64(sin(th) + -1.0)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 390.0) tmp = sin(th); else tmp = 1.0 + (sin(th) + -1.0); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 390.0], N[Sin[th], $MachinePrecision], N[(1.0 + N[(N[Sin[th], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 390:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\sin th + -1\right)\\
\end{array}
\end{array}
if kx < 390Initial program 90.7%
associate-*l/89.2%
associate-/l*90.6%
unpow290.6%
sqr-neg90.6%
sin-neg90.6%
sin-neg90.6%
unpow290.6%
unpow290.6%
sin-neg90.6%
sin-neg90.6%
sqr-neg90.6%
unpow290.6%
Simplified99.6%
Taylor expanded in kx around 0 31.7%
if 390 < kx Initial program 99.4%
associate-*l/99.6%
associate-/l*99.3%
unpow299.3%
sqr-neg99.3%
sin-neg99.3%
sin-neg99.3%
unpow299.3%
unpow299.3%
sin-neg99.3%
sin-neg99.3%
sqr-neg99.3%
unpow299.3%
Simplified99.3%
Taylor expanded in kx around 0 5.9%
expm1-log1p-u5.9%
expm1-undefine18.8%
Applied egg-rr18.8%
expm1-define5.9%
associate-*r/19.0%
*-rgt-identity19.0%
times-frac5.9%
*-inverses5.9%
/-rgt-identity5.9%
*-lft-identity5.9%
Simplified5.9%
expm1-undefine18.8%
log1p-undefine18.8%
rem-exp-log18.8%
+-commutative18.8%
Applied egg-rr18.8%
sub-neg18.8%
+-commutative18.8%
metadata-eval18.8%
associate-+l+18.8%
Applied egg-rr18.8%
Final simplification28.4%
(FPCore (kx ky th) :precision binary64 (if (<= kx 2.4e-182) (sin th) (/ (* ky (sin th)) ky)))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 2.4e-182) {
tmp = sin(th);
} else {
tmp = (ky * 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 (kx <= 2.4d-182) then
tmp = sin(th)
else
tmp = (ky * sin(th)) / ky
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 2.4e-182) {
tmp = Math.sin(th);
} else {
tmp = (ky * Math.sin(th)) / ky;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 2.4e-182: tmp = math.sin(th) else: tmp = (ky * math.sin(th)) / ky return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 2.4e-182) tmp = sin(th); else tmp = Float64(Float64(ky * sin(th)) / ky); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 2.4e-182) tmp = sin(th); else tmp = (ky * sin(th)) / ky; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 2.4e-182], N[Sin[th], $MachinePrecision], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] / ky), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 2.4 \cdot 10^{-182}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{ky \cdot \sin th}{ky}\\
\end{array}
\end{array}
if kx < 2.3999999999999998e-182Initial program 89.2%
associate-*l/88.0%
associate-/l*89.1%
unpow289.1%
sqr-neg89.1%
sin-neg89.1%
sin-neg89.1%
unpow289.1%
unpow289.1%
sin-neg89.1%
sin-neg89.1%
sqr-neg89.1%
unpow289.1%
Simplified99.6%
Taylor expanded in kx around 0 30.9%
if 2.3999999999999998e-182 < kx Initial program 99.6%
Taylor expanded in ky around 0 55.9%
*-commutative55.9%
clear-num55.8%
un-div-inv55.9%
+-commutative55.9%
unpow255.9%
unpow255.9%
hypot-define56.0%
Applied egg-rr56.0%
Taylor expanded in ky around inf 15.5%
*-commutative15.5%
Simplified15.5%
Taylor expanded in ky around 0 25.6%
Final simplification29.0%
(FPCore (kx ky th) :precision binary64 (if (<= kx 6.6e+24) (sin th) (+ (+ th 1.0) -1.0)))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 6.6e+24) {
tmp = sin(th);
} else {
tmp = (th + 1.0) + -1.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 <= 6.6d+24) then
tmp = sin(th)
else
tmp = (th + 1.0d0) + (-1.0d0)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 6.6e+24) {
tmp = Math.sin(th);
} else {
tmp = (th + 1.0) + -1.0;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 6.6e+24: tmp = math.sin(th) else: tmp = (th + 1.0) + -1.0 return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 6.6e+24) tmp = sin(th); else tmp = Float64(Float64(th + 1.0) + -1.0); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 6.6e+24) tmp = sin(th); else tmp = (th + 1.0) + -1.0; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 6.6e+24], N[Sin[th], $MachinePrecision], N[(N[(th + 1.0), $MachinePrecision] + -1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 6.6 \cdot 10^{+24}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\left(th + 1\right) + -1\\
\end{array}
\end{array}
if kx < 6.5999999999999998e24Initial program 90.9%
associate-*l/89.4%
associate-/l*90.8%
unpow290.8%
sqr-neg90.8%
sin-neg90.8%
sin-neg90.8%
unpow290.8%
unpow290.8%
sin-neg90.8%
sin-neg90.8%
sqr-neg90.8%
unpow290.8%
Simplified99.6%
Taylor expanded in kx around 0 31.0%
if 6.5999999999999998e24 < kx Initial program 99.5%
associate-*l/99.7%
associate-/l*99.3%
unpow299.3%
sqr-neg99.3%
sin-neg99.3%
sin-neg99.3%
unpow299.3%
unpow299.3%
sin-neg99.3%
sin-neg99.3%
sqr-neg99.3%
unpow299.3%
Simplified99.3%
Taylor expanded in kx around 0 5.9%
expm1-log1p-u5.9%
expm1-undefine20.1%
Applied egg-rr20.1%
expm1-define5.9%
associate-*r/20.1%
*-rgt-identity20.1%
times-frac5.9%
*-inverses5.9%
/-rgt-identity5.9%
*-lft-identity5.9%
Simplified5.9%
expm1-undefine20.1%
log1p-undefine20.1%
rem-exp-log20.1%
+-commutative20.1%
Applied egg-rr20.1%
Taylor expanded in th around 0 19.8%
+-commutative19.8%
Simplified19.8%
Final simplification28.4%
(FPCore (kx ky th) :precision binary64 (if (<= kx 1.9e+25) (/ 1.0 (+ (/ 1.0 th) (* th 0.16666666666666666))) (+ (+ th 1.0) -1.0)))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 1.9e+25) {
tmp = 1.0 / ((1.0 / th) + (th * 0.16666666666666666));
} else {
tmp = (th + 1.0) + -1.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 <= 1.9d+25) then
tmp = 1.0d0 / ((1.0d0 / th) + (th * 0.16666666666666666d0))
else
tmp = (th + 1.0d0) + (-1.0d0)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 1.9e+25) {
tmp = 1.0 / ((1.0 / th) + (th * 0.16666666666666666));
} else {
tmp = (th + 1.0) + -1.0;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 1.9e+25: tmp = 1.0 / ((1.0 / th) + (th * 0.16666666666666666)) else: tmp = (th + 1.0) + -1.0 return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 1.9e+25) tmp = Float64(1.0 / Float64(Float64(1.0 / th) + Float64(th * 0.16666666666666666))); else tmp = Float64(Float64(th + 1.0) + -1.0); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 1.9e+25) tmp = 1.0 / ((1.0 / th) + (th * 0.16666666666666666)); else tmp = (th + 1.0) + -1.0; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 1.9e+25], N[(1.0 / N[(N[(1.0 / th), $MachinePrecision] + N[(th * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(th + 1.0), $MachinePrecision] + -1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 1.9 \cdot 10^{+25}:\\
\;\;\;\;\frac{1}{\frac{1}{th} + th \cdot 0.16666666666666666}\\
\mathbf{else}:\\
\;\;\;\;\left(th + 1\right) + -1\\
\end{array}
\end{array}
if kx < 1.9e25Initial program 90.9%
associate-*l/89.4%
associate-/l*90.8%
unpow290.8%
sqr-neg90.8%
sin-neg90.8%
sin-neg90.8%
unpow290.8%
unpow290.8%
sin-neg90.8%
sin-neg90.8%
sqr-neg90.8%
unpow290.8%
Simplified99.6%
clear-num99.4%
un-div-inv99.6%
Applied egg-rr99.6%
Taylor expanded in th around 0 47.0%
+-commutative47.0%
+-commutative47.0%
unpow247.0%
unpow247.0%
hypot-undefine52.3%
associate-*r*52.3%
+-commutative52.3%
unpow252.3%
unpow252.3%
hypot-undefine52.6%
distribute-rgt-out52.6%
Simplified52.6%
Taylor expanded in kx around 0 15.8%
if 1.9e25 < kx Initial program 99.5%
associate-*l/99.7%
associate-/l*99.3%
unpow299.3%
sqr-neg99.3%
sin-neg99.3%
sin-neg99.3%
unpow299.3%
unpow299.3%
sin-neg99.3%
sin-neg99.3%
sqr-neg99.3%
unpow299.3%
Simplified99.3%
Taylor expanded in kx around 0 5.9%
expm1-log1p-u5.9%
expm1-undefine20.1%
Applied egg-rr20.1%
expm1-define5.9%
associate-*r/20.1%
*-rgt-identity20.1%
times-frac5.9%
*-inverses5.9%
/-rgt-identity5.9%
*-lft-identity5.9%
Simplified5.9%
expm1-undefine20.1%
log1p-undefine20.1%
rem-exp-log20.1%
+-commutative20.1%
Applied egg-rr20.1%
Taylor expanded in th around 0 19.8%
+-commutative19.8%
Simplified19.8%
Final simplification16.7%
(FPCore (kx ky th) :precision binary64 (if (<= kx 460.0) th (+ (+ th 1.0) -1.0)))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 460.0) {
tmp = th;
} else {
tmp = (th + 1.0) + -1.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 <= 460.0d0) then
tmp = th
else
tmp = (th + 1.0d0) + (-1.0d0)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 460.0) {
tmp = th;
} else {
tmp = (th + 1.0) + -1.0;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 460.0: tmp = th else: tmp = (th + 1.0) + -1.0 return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 460.0) tmp = th; else tmp = Float64(Float64(th + 1.0) + -1.0); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 460.0) tmp = th; else tmp = (th + 1.0) + -1.0; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 460.0], th, N[(N[(th + 1.0), $MachinePrecision] + -1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 460:\\
\;\;\;\;th\\
\mathbf{else}:\\
\;\;\;\;\left(th + 1\right) + -1\\
\end{array}
\end{array}
if kx < 460Initial program 90.7%
associate-*l/89.2%
associate-/l*90.6%
unpow290.6%
sqr-neg90.6%
sin-neg90.6%
sin-neg90.6%
unpow290.6%
unpow290.6%
sin-neg90.6%
sin-neg90.6%
sqr-neg90.6%
unpow290.6%
Simplified99.6%
Taylor expanded in kx around 0 31.7%
Taylor expanded in th around 0 15.4%
if 460 < kx Initial program 99.4%
associate-*l/99.6%
associate-/l*99.3%
unpow299.3%
sqr-neg99.3%
sin-neg99.3%
sin-neg99.3%
unpow299.3%
unpow299.3%
sin-neg99.3%
sin-neg99.3%
sqr-neg99.3%
unpow299.3%
Simplified99.3%
Taylor expanded in kx around 0 5.9%
expm1-log1p-u5.9%
expm1-undefine18.8%
Applied egg-rr18.8%
expm1-define5.9%
associate-*r/19.0%
*-rgt-identity19.0%
times-frac5.9%
*-inverses5.9%
/-rgt-identity5.9%
*-lft-identity5.9%
Simplified5.9%
expm1-undefine18.8%
log1p-undefine18.8%
rem-exp-log18.8%
+-commutative18.8%
Applied egg-rr18.8%
Taylor expanded in th around 0 18.6%
+-commutative18.6%
Simplified18.6%
Final simplification16.2%
(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.9%
associate-*l/91.8%
associate-/l*92.8%
unpow292.8%
sqr-neg92.8%
sin-neg92.8%
sin-neg92.8%
unpow292.8%
unpow292.8%
sin-neg92.8%
sin-neg92.8%
sqr-neg92.8%
unpow292.8%
Simplified99.5%
Taylor expanded in kx around 0 25.1%
Taylor expanded in th around 0 12.9%
Final simplification12.9%
herbie shell --seed 2024045
(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)))