
(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 21 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\end{array}
(FPCore (kx ky th) :precision binary64 (/ (sin th) (/ (hypot (sin kx) (sin ky)) (sin ky))))
double code(double kx, double ky, double th) {
return sin(th) / (hypot(sin(kx), sin(ky)) / sin(ky));
}
public static double code(double kx, double ky, double th) {
return Math.sin(th) / (Math.hypot(Math.sin(kx), Math.sin(ky)) / Math.sin(ky));
}
def code(kx, ky, th): return math.sin(th) / (math.hypot(math.sin(kx), math.sin(ky)) / math.sin(ky))
function code(kx, ky, th) return Float64(sin(th) / Float64(hypot(sin(kx), sin(ky)) / sin(ky))) end
function tmp = code(kx, ky, th) tmp = sin(th) / (hypot(sin(kx), sin(ky)) / sin(ky)); end
code[kx_, ky_, th_] := N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{\sin ky}}
\end{array}
Initial program 94.7%
clear-num94.8%
associate-*l/94.8%
*-un-lft-identity94.8%
unpow294.8%
unpow294.8%
hypot-def99.7%
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin th) (fabs (/ (sin kx) ky)))))
(if (<= (sin ky) -0.001)
(/ 1.0 (sqrt (pow (sin th) -2.0)))
(if (<= (sin ky) 2e-150)
t_1
(if (<= (sin ky) 1e-118)
(/ 1.0 (/ (sin ky) (* (sin th) (sin ky))))
(if (<= (sin ky) 2e-21) t_1 (sin th)))))))
double code(double kx, double ky, double th) {
double t_1 = sin(th) / fabs((sin(kx) / ky));
double tmp;
if (sin(ky) <= -0.001) {
tmp = 1.0 / sqrt(pow(sin(th), -2.0));
} else if (sin(ky) <= 2e-150) {
tmp = t_1;
} else if (sin(ky) <= 1e-118) {
tmp = 1.0 / (sin(ky) / (sin(th) * sin(ky)));
} else if (sin(ky) <= 2e-21) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = sin(th) / abs((sin(kx) / ky))
if (sin(ky) <= (-0.001d0)) then
tmp = 1.0d0 / sqrt((sin(th) ** (-2.0d0)))
else if (sin(ky) <= 2d-150) then
tmp = t_1
else if (sin(ky) <= 1d-118) then
tmp = 1.0d0 / (sin(ky) / (sin(th) * sin(ky)))
else if (sin(ky) <= 2d-21) then
tmp = t_1
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(th) / Math.abs((Math.sin(kx) / ky));
double tmp;
if (Math.sin(ky) <= -0.001) {
tmp = 1.0 / Math.sqrt(Math.pow(Math.sin(th), -2.0));
} else if (Math.sin(ky) <= 2e-150) {
tmp = t_1;
} else if (Math.sin(ky) <= 1e-118) {
tmp = 1.0 / (Math.sin(ky) / (Math.sin(th) * Math.sin(ky)));
} else if (Math.sin(ky) <= 2e-21) {
tmp = t_1;
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.sin(th) / math.fabs((math.sin(kx) / ky)) tmp = 0 if math.sin(ky) <= -0.001: tmp = 1.0 / math.sqrt(math.pow(math.sin(th), -2.0)) elif math.sin(ky) <= 2e-150: tmp = t_1 elif math.sin(ky) <= 1e-118: tmp = 1.0 / (math.sin(ky) / (math.sin(th) * math.sin(ky))) elif math.sin(ky) <= 2e-21: tmp = t_1 else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = Float64(sin(th) / abs(Float64(sin(kx) / ky))) tmp = 0.0 if (sin(ky) <= -0.001) tmp = Float64(1.0 / sqrt((sin(th) ^ -2.0))); elseif (sin(ky) <= 2e-150) tmp = t_1; elseif (sin(ky) <= 1e-118) tmp = Float64(1.0 / Float64(sin(ky) / Float64(sin(th) * sin(ky)))); elseif (sin(ky) <= 2e-21) tmp = t_1; else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = sin(th) / abs((sin(kx) / ky)); tmp = 0.0; if (sin(ky) <= -0.001) tmp = 1.0 / sqrt((sin(th) ^ -2.0)); elseif (sin(ky) <= 2e-150) tmp = t_1; elseif (sin(ky) <= 1e-118) tmp = 1.0 / (sin(ky) / (sin(th) * sin(ky))); elseif (sin(ky) <= 2e-21) tmp = t_1; else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[th], $MachinePrecision] / N[Abs[N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Sin[ky], $MachinePrecision], -0.001], N[(1.0 / N[Sqrt[N[Power[N[Sin[th], $MachinePrecision], -2.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-150], t$95$1, If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-118], N[(1.0 / N[(N[Sin[ky], $MachinePrecision] / N[(N[Sin[th], $MachinePrecision] * N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-21], t$95$1, N[Sin[th], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin th}{\left|\frac{\sin kx}{ky}\right|}\\
\mathbf{if}\;\sin ky \leq -0.001:\\
\;\;\;\;\frac{1}{\sqrt{{\sin th}^{-2}}}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-150}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\sin ky \leq 10^{-118}:\\
\;\;\;\;\frac{1}{\frac{\sin ky}{\sin th \cdot \sin ky}}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-21}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -1e-3Initial program 99.8%
associate-*l/99.7%
clear-num99.4%
unpow299.4%
unpow299.4%
hypot-def99.4%
Applied egg-rr99.4%
Taylor expanded in kx around 0 3.1%
add-sqr-sqrt1.8%
sqrt-unprod22.4%
inv-pow22.4%
inv-pow22.4%
pow-prod-up22.4%
metadata-eval22.4%
Applied egg-rr22.4%
if -1e-3 < (sin.f64 ky) < 2.00000000000000001e-150 or 9.99999999999999985e-119 < (sin.f64 ky) < 1.99999999999999982e-21Initial program 88.2%
clear-num88.3%
associate-*l/88.3%
*-un-lft-identity88.3%
unpow288.3%
unpow288.3%
hypot-def99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 51.2%
add-sqr-sqrt25.5%
sqrt-unprod46.1%
pow246.1%
Applied egg-rr46.1%
unpow246.1%
rem-sqrt-square55.1%
Simplified55.1%
if 2.00000000000000001e-150 < (sin.f64 ky) < 9.99999999999999985e-119Initial program 100.0%
associate-*l/80.5%
clear-num80.7%
unpow280.7%
unpow280.7%
hypot-def80.7%
Applied egg-rr80.7%
Taylor expanded in kx around 0 80.7%
if 1.99999999999999982e-21 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 63.9%
Final simplification49.0%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.38)
(fabs (* ky (/ (sin th) (sin kx))))
(if (<= (sin kx) 1e-166)
(sin th)
(if (<= (sin kx) 2e-60)
(fabs (sin th))
(* (sin th) (/ (sin ky) (sin kx)))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.38) {
tmp = fabs((ky * (sin(th) / sin(kx))));
} else if (sin(kx) <= 1e-166) {
tmp = sin(th);
} else if (sin(kx) <= 2e-60) {
tmp = fabs(sin(th));
} else {
tmp = sin(th) * (sin(ky) / sin(kx));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(kx) <= (-0.38d0)) then
tmp = abs((ky * (sin(th) / sin(kx))))
else if (sin(kx) <= 1d-166) then
tmp = sin(th)
else if (sin(kx) <= 2d-60) then
tmp = abs(sin(th))
else
tmp = sin(th) * (sin(ky) / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.38) {
tmp = Math.abs((ky * (Math.sin(th) / Math.sin(kx))));
} else if (Math.sin(kx) <= 1e-166) {
tmp = Math.sin(th);
} else if (Math.sin(kx) <= 2e-60) {
tmp = Math.abs(Math.sin(th));
} else {
tmp = Math.sin(th) * (Math.sin(ky) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.38: tmp = math.fabs((ky * (math.sin(th) / math.sin(kx)))) elif math.sin(kx) <= 1e-166: tmp = math.sin(th) elif math.sin(kx) <= 2e-60: tmp = math.fabs(math.sin(th)) else: tmp = math.sin(th) * (math.sin(ky) / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.38) tmp = abs(Float64(ky * Float64(sin(th) / sin(kx)))); elseif (sin(kx) <= 1e-166) tmp = sin(th); elseif (sin(kx) <= 2e-60) tmp = abs(sin(th)); else tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.38) tmp = abs((ky * (sin(th) / sin(kx)))); elseif (sin(kx) <= 1e-166) tmp = sin(th); elseif (sin(kx) <= 2e-60) tmp = abs(sin(th)); else tmp = sin(th) * (sin(ky) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.38], N[Abs[N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-166], N[Sin[th], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 2e-60], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.38:\\
\;\;\;\;\left|ky \cdot \frac{\sin th}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 10^{-166}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;\sin kx \leq 2 \cdot 10^{-60}:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.38Initial program 99.3%
clear-num99.4%
associate-*l/99.5%
*-un-lft-identity99.5%
unpow299.5%
unpow299.5%
hypot-def99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 15.0%
add-sqr-sqrt13.2%
sqrt-unprod22.7%
pow222.7%
associate-/r/22.7%
*-commutative22.7%
Applied egg-rr22.7%
unpow222.7%
rem-sqrt-square33.3%
Simplified33.3%
if -0.38 < (sin.f64 kx) < 1.00000000000000004e-166Initial program 88.8%
Taylor expanded in kx around 0 41.7%
if 1.00000000000000004e-166 < (sin.f64 kx) < 1.9999999999999999e-60Initial program 99.9%
associate-*l/95.7%
clear-num95.4%
unpow295.4%
unpow295.4%
hypot-def95.4%
Applied egg-rr95.4%
Taylor expanded in kx around 0 34.4%
remove-double-div34.4%
add-sqr-sqrt28.9%
sqrt-unprod22.3%
pow222.3%
Applied egg-rr22.3%
unpow222.3%
rem-sqrt-square43.2%
Simplified43.2%
if 1.9999999999999999e-60 < (sin.f64 kx) Initial program 99.4%
Taylor expanded in ky around 0 60.7%
Final simplification45.2%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.001)
(/ 1.0 (sqrt (pow (sin th) -2.0)))
(if (<= (sin ky) 2e-21)
(/ 1.0 (/ (hypot (sin kx) (sin ky)) (* (sin th) ky)))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.001) {
tmp = 1.0 / sqrt(pow(sin(th), -2.0));
} else if (sin(ky) <= 2e-21) {
tmp = 1.0 / (hypot(sin(kx), sin(ky)) / (sin(th) * ky));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.001) {
tmp = 1.0 / Math.sqrt(Math.pow(Math.sin(th), -2.0));
} else if (Math.sin(ky) <= 2e-21) {
tmp = 1.0 / (Math.hypot(Math.sin(kx), Math.sin(ky)) / (Math.sin(th) * ky));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.001: tmp = 1.0 / math.sqrt(math.pow(math.sin(th), -2.0)) elif math.sin(ky) <= 2e-21: tmp = 1.0 / (math.hypot(math.sin(kx), math.sin(ky)) / (math.sin(th) * ky)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.001) tmp = Float64(1.0 / sqrt((sin(th) ^ -2.0))); elseif (sin(ky) <= 2e-21) tmp = Float64(1.0 / Float64(hypot(sin(kx), sin(ky)) / Float64(sin(th) * ky))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.001) tmp = 1.0 / sqrt((sin(th) ^ -2.0)); elseif (sin(ky) <= 2e-21) tmp = 1.0 / (hypot(sin(kx), sin(ky)) / (sin(th) * ky)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.001], N[(1.0 / N[Sqrt[N[Power[N[Sin[th], $MachinePrecision], -2.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-21], N[(1.0 / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] / N[(N[Sin[th], $MachinePrecision] * ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.001:\\
\;\;\;\;\frac{1}{\sqrt{{\sin th}^{-2}}}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-21}:\\
\;\;\;\;\frac{1}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{\sin th \cdot ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -1e-3Initial program 99.8%
associate-*l/99.7%
clear-num99.4%
unpow299.4%
unpow299.4%
hypot-def99.4%
Applied egg-rr99.4%
Taylor expanded in kx around 0 3.1%
add-sqr-sqrt1.8%
sqrt-unprod22.4%
inv-pow22.4%
inv-pow22.4%
pow-prod-up22.4%
metadata-eval22.4%
Applied egg-rr22.4%
if -1e-3 < (sin.f64 ky) < 1.99999999999999982e-21Initial program 88.8%
associate-*l/86.5%
clear-num85.8%
unpow285.8%
unpow285.8%
hypot-def94.3%
Applied egg-rr94.3%
Taylor expanded in ky around 0 94.3%
if 1.99999999999999982e-21 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 63.9%
Final simplification66.3%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.001)
(/ 1.0 (/ (hypot (sin ky) (sin kx)) (* th (sin ky))))
(if (<= (sin ky) 2e-21)
(/ 1.0 (/ (hypot (sin kx) (sin ky)) (* (sin th) ky)))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.001) {
tmp = 1.0 / (hypot(sin(ky), sin(kx)) / (th * sin(ky)));
} else if (sin(ky) <= 2e-21) {
tmp = 1.0 / (hypot(sin(kx), sin(ky)) / (sin(th) * ky));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.001) {
tmp = 1.0 / (Math.hypot(Math.sin(ky), Math.sin(kx)) / (th * Math.sin(ky)));
} else if (Math.sin(ky) <= 2e-21) {
tmp = 1.0 / (Math.hypot(Math.sin(kx), Math.sin(ky)) / (Math.sin(th) * ky));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.001: tmp = 1.0 / (math.hypot(math.sin(ky), math.sin(kx)) / (th * math.sin(ky))) elif math.sin(ky) <= 2e-21: tmp = 1.0 / (math.hypot(math.sin(kx), math.sin(ky)) / (math.sin(th) * ky)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.001) tmp = Float64(1.0 / Float64(hypot(sin(ky), sin(kx)) / Float64(th * sin(ky)))); elseif (sin(ky) <= 2e-21) tmp = Float64(1.0 / Float64(hypot(sin(kx), sin(ky)) / Float64(sin(th) * ky))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.001) tmp = 1.0 / (hypot(sin(ky), sin(kx)) / (th * sin(ky))); elseif (sin(ky) <= 2e-21) tmp = 1.0 / (hypot(sin(kx), sin(ky)) / (sin(th) * ky)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.001], N[(1.0 / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[(th * N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-21], N[(1.0 / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] / N[(N[Sin[th], $MachinePrecision] * ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.001:\\
\;\;\;\;\frac{1}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{th \cdot \sin ky}}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-21}:\\
\;\;\;\;\frac{1}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{\sin th \cdot ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -1e-3Initial program 99.8%
associate-*l/99.7%
clear-num99.4%
unpow299.4%
unpow299.4%
hypot-def99.4%
Applied egg-rr99.4%
Taylor expanded in th around 0 62.3%
associate-*l/62.4%
unpow262.4%
unpow262.4%
hypot-def62.4%
*-lft-identity62.4%
hypot-def62.4%
unpow262.4%
unpow262.4%
+-commutative62.4%
unpow262.4%
unpow262.4%
hypot-def62.4%
Simplified62.4%
if -1e-3 < (sin.f64 ky) < 1.99999999999999982e-21Initial program 88.8%
associate-*l/86.5%
clear-num85.8%
unpow285.8%
unpow285.8%
hypot-def94.3%
Applied egg-rr94.3%
Taylor expanded in ky around 0 94.3%
if 1.99999999999999982e-21 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 63.9%
Final simplification77.4%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.001)
(/ 1.0 (/ (hypot (sin ky) (sin kx)) (* th (sin ky))))
(if (<= (sin ky) 2e-21)
(/ (sin th) (* (hypot (sin kx) (sin ky)) (/ 1.0 ky)))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.001) {
tmp = 1.0 / (hypot(sin(ky), sin(kx)) / (th * sin(ky)));
} else if (sin(ky) <= 2e-21) {
tmp = sin(th) / (hypot(sin(kx), sin(ky)) * (1.0 / ky));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.001) {
tmp = 1.0 / (Math.hypot(Math.sin(ky), Math.sin(kx)) / (th * Math.sin(ky)));
} else if (Math.sin(ky) <= 2e-21) {
tmp = Math.sin(th) / (Math.hypot(Math.sin(kx), Math.sin(ky)) * (1.0 / ky));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.001: tmp = 1.0 / (math.hypot(math.sin(ky), math.sin(kx)) / (th * math.sin(ky))) elif math.sin(ky) <= 2e-21: tmp = math.sin(th) / (math.hypot(math.sin(kx), math.sin(ky)) * (1.0 / ky)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.001) tmp = Float64(1.0 / Float64(hypot(sin(ky), sin(kx)) / Float64(th * sin(ky)))); elseif (sin(ky) <= 2e-21) tmp = Float64(sin(th) / Float64(hypot(sin(kx), sin(ky)) * Float64(1.0 / ky))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.001) tmp = 1.0 / (hypot(sin(ky), sin(kx)) / (th * sin(ky))); elseif (sin(ky) <= 2e-21) tmp = sin(th) / (hypot(sin(kx), sin(ky)) * (1.0 / ky)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.001], N[(1.0 / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[(th * N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-21], N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] * N[(1.0 / ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.001:\\
\;\;\;\;\frac{1}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{th \cdot \sin ky}}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-21}:\\
\;\;\;\;\frac{\sin th}{\mathsf{hypot}\left(\sin kx, \sin ky\right) \cdot \frac{1}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -1e-3Initial program 99.8%
associate-*l/99.7%
clear-num99.4%
unpow299.4%
unpow299.4%
hypot-def99.4%
Applied egg-rr99.4%
Taylor expanded in th around 0 62.3%
associate-*l/62.4%
unpow262.4%
unpow262.4%
hypot-def62.4%
*-lft-identity62.4%
hypot-def62.4%
unpow262.4%
unpow262.4%
+-commutative62.4%
unpow262.4%
unpow262.4%
hypot-def62.4%
Simplified62.4%
if -1e-3 < (sin.f64 ky) < 1.99999999999999982e-21Initial program 88.8%
clear-num88.9%
associate-*l/88.9%
*-un-lft-identity88.9%
unpow288.9%
unpow288.9%
hypot-def99.7%
Applied egg-rr99.7%
div-inv99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 99.6%
if 1.99999999999999982e-21 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 63.9%
Final simplification79.8%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.001) (/ 1.0 (sqrt (pow (sin th) -2.0))) (if (<= (sin ky) 2e-21) (/ (sin th) (fabs (/ (sin kx) ky))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.001) {
tmp = 1.0 / sqrt(pow(sin(th), -2.0));
} else if (sin(ky) <= 2e-21) {
tmp = sin(th) / fabs((sin(kx) / ky));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.001d0)) then
tmp = 1.0d0 / sqrt((sin(th) ** (-2.0d0)))
else if (sin(ky) <= 2d-21) then
tmp = sin(th) / abs((sin(kx) / ky))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.001) {
tmp = 1.0 / Math.sqrt(Math.pow(Math.sin(th), -2.0));
} else if (Math.sin(ky) <= 2e-21) {
tmp = Math.sin(th) / Math.abs((Math.sin(kx) / ky));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.001: tmp = 1.0 / math.sqrt(math.pow(math.sin(th), -2.0)) elif math.sin(ky) <= 2e-21: tmp = math.sin(th) / math.fabs((math.sin(kx) / ky)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.001) tmp = Float64(1.0 / sqrt((sin(th) ^ -2.0))); elseif (sin(ky) <= 2e-21) tmp = Float64(sin(th) / abs(Float64(sin(kx) / ky))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.001) tmp = 1.0 / sqrt((sin(th) ^ -2.0)); elseif (sin(ky) <= 2e-21) tmp = sin(th) / abs((sin(kx) / ky)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.001], N[(1.0 / N[Sqrt[N[Power[N[Sin[th], $MachinePrecision], -2.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-21], N[(N[Sin[th], $MachinePrecision] / N[Abs[N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.001:\\
\;\;\;\;\frac{1}{\sqrt{{\sin th}^{-2}}}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-21}:\\
\;\;\;\;\frac{\sin th}{\left|\frac{\sin kx}{ky}\right|}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -1e-3Initial program 99.8%
associate-*l/99.7%
clear-num99.4%
unpow299.4%
unpow299.4%
hypot-def99.4%
Applied egg-rr99.4%
Taylor expanded in kx around 0 3.1%
add-sqr-sqrt1.8%
sqrt-unprod22.4%
inv-pow22.4%
inv-pow22.4%
pow-prod-up22.4%
metadata-eval22.4%
Applied egg-rr22.4%
if -1e-3 < (sin.f64 ky) < 1.99999999999999982e-21Initial program 88.8%
clear-num88.9%
associate-*l/88.9%
*-un-lft-identity88.9%
unpow288.9%
unpow288.9%
hypot-def99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 49.6%
add-sqr-sqrt25.3%
sqrt-unprod44.9%
pow244.9%
Applied egg-rr44.9%
unpow244.9%
rem-sqrt-square53.5%
Simplified53.5%
if 1.99999999999999982e-21 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 63.9%
Final simplification47.6%
(FPCore (kx ky th) :precision binary64 (* (sin ky) (/ (sin th) (hypot (sin ky) (sin kx)))))
double code(double kx, double ky, double th) {
return sin(ky) * (sin(th) / hypot(sin(ky), sin(kx)));
}
public static double code(double kx, double ky, double th) {
return Math.sin(ky) * (Math.sin(th) / Math.hypot(Math.sin(ky), Math.sin(kx)));
}
def code(kx, ky, th): return math.sin(ky) * (math.sin(th) / math.hypot(math.sin(ky), math.sin(kx)))
function code(kx, ky, th) return Float64(sin(ky) * Float64(sin(th) / hypot(sin(ky), sin(kx)))) end
function tmp = code(kx, ky, th) tmp = sin(ky) * (sin(th) / hypot(sin(ky), sin(kx))); end
code[kx_, ky_, th_] := N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}
\end{array}
Initial program 94.7%
expm1-log1p-u94.6%
expm1-udef42.1%
Applied egg-rr43.7%
expm1-def99.6%
expm1-log1p99.7%
*-commutative99.7%
associate-*r/97.5%
associate-*l/99.6%
*-commutative99.6%
hypot-def94.6%
unpow294.6%
unpow294.6%
+-commutative94.6%
unpow294.6%
unpow294.6%
hypot-def99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (kx ky th) :precision binary64 (* (sin th) (/ (sin ky) (hypot (sin ky) (sin kx)))))
double code(double kx, double ky, double th) {
return sin(th) * (sin(ky) / hypot(sin(ky), sin(kx)));
}
public static double code(double kx, double ky, double th) {
return Math.sin(th) * (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx)));
}
def code(kx, ky, th): return math.sin(th) * (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx)))
function code(kx, ky, th) return Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), sin(kx)))) end
function tmp = code(kx, ky, th) tmp = sin(th) * (sin(ky) / hypot(sin(ky), sin(kx))); end
code[kx_, ky_, th_] := N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}
\end{array}
Initial program 94.7%
remove-double-neg94.7%
sin-neg94.7%
neg-mul-194.7%
*-commutative94.7%
associate-*l*94.7%
associate-*l/93.6%
associate-/r/93.6%
associate-*l/94.7%
associate-/r/94.7%
sin-neg94.7%
neg-mul-194.7%
associate-/r*94.7%
associate-/r/94.7%
Simplified99.7%
Final simplification99.7%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.178) (fabs (sin th)) (if (<= (sin ky) 5e-91) (* (sin th) (/ ky (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.178) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 5e-91) {
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 (sin(ky) <= (-0.178d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 5d-91) 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 (Math.sin(ky) <= -0.178) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 5e-91) {
tmp = Math.sin(th) * (ky / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.178: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 5e-91: tmp = math.sin(th) * (ky / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.178) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-91) 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 (sin(ky) <= -0.178) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-91) tmp = sin(th) * (ky / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.178], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-91], 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}\;\sin ky \leq -0.178:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-91}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.17799999999999999Initial program 99.8%
associate-*l/99.7%
clear-num99.4%
unpow299.4%
unpow299.4%
hypot-def99.4%
Applied egg-rr99.4%
Taylor expanded in kx around 0 3.1%
remove-double-div3.1%
add-sqr-sqrt1.8%
sqrt-unprod22.2%
pow222.2%
Applied egg-rr22.2%
unpow222.2%
rem-sqrt-square29.7%
Simplified29.7%
if -0.17799999999999999 < (sin.f64 ky) < 4.99999999999999997e-91Initial program 88.1%
Taylor expanded in ky around 0 50.1%
associate-/l*50.0%
associate-/r/49.9%
Simplified49.9%
if 4.99999999999999997e-91 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 62.8%
Final simplification48.9%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.178) (fabs (sin th)) (if (<= (sin ky) 5e-91) (/ ky (/ (sin kx) (sin th))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.178) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 5e-91) {
tmp = ky / (sin(kx) / sin(th));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.178d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 5d-91) then
tmp = ky / (sin(kx) / sin(th))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.178) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 5e-91) {
tmp = ky / (Math.sin(kx) / Math.sin(th));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.178: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 5e-91: tmp = 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.178) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-91) tmp = Float64(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.178) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-91) tmp = 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.178], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-91], N[(ky / 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.178:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-91}:\\
\;\;\;\;\frac{ky}{\frac{\sin kx}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.17799999999999999Initial program 99.8%
associate-*l/99.7%
clear-num99.4%
unpow299.4%
unpow299.4%
hypot-def99.4%
Applied egg-rr99.4%
Taylor expanded in kx around 0 3.1%
remove-double-div3.1%
add-sqr-sqrt1.8%
sqrt-unprod22.2%
pow222.2%
Applied egg-rr22.2%
unpow222.2%
rem-sqrt-square29.7%
Simplified29.7%
if -0.17799999999999999 < (sin.f64 ky) < 4.99999999999999997e-91Initial program 88.1%
Taylor expanded in ky around 0 50.1%
associate-/l*50.0%
Simplified50.0%
if 4.99999999999999997e-91 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 62.8%
Final simplification48.9%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.178) (fabs (sin th)) (if (<= (sin ky) 5e-91) (/ (sin th) (/ (sin kx) ky)) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.178) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 5e-91) {
tmp = sin(th) / (sin(kx) / ky);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.178d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 5d-91) then
tmp = sin(th) / (sin(kx) / ky)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.178) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 5e-91) {
tmp = Math.sin(th) / (Math.sin(kx) / ky);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.178: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 5e-91: tmp = math.sin(th) / (math.sin(kx) / ky) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.178) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-91) tmp = Float64(sin(th) / Float64(sin(kx) / ky)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.178) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-91) tmp = sin(th) / (sin(kx) / ky); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.178], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-91], N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.178:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-91}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.17799999999999999Initial program 99.8%
associate-*l/99.7%
clear-num99.4%
unpow299.4%
unpow299.4%
hypot-def99.4%
Applied egg-rr99.4%
Taylor expanded in kx around 0 3.1%
remove-double-div3.1%
add-sqr-sqrt1.8%
sqrt-unprod22.2%
pow222.2%
Applied egg-rr22.2%
unpow222.2%
rem-sqrt-square29.7%
Simplified29.7%
if -0.17799999999999999 < (sin.f64 ky) < 4.99999999999999997e-91Initial program 88.1%
clear-num88.2%
associate-*l/88.2%
*-un-lft-identity88.2%
unpow288.2%
unpow288.2%
hypot-def99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 50.0%
if 4.99999999999999997e-91 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 62.8%
Final simplification48.9%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.02) (/ 1.0 (sqrt (pow (sin th) -2.0))) (if (<= (sin ky) 5e-91) (/ (sin th) (/ (sin kx) ky)) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.02) {
tmp = 1.0 / sqrt(pow(sin(th), -2.0));
} else if (sin(ky) <= 5e-91) {
tmp = sin(th) / (sin(kx) / ky);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.02d0)) then
tmp = 1.0d0 / sqrt((sin(th) ** (-2.0d0)))
else if (sin(ky) <= 5d-91) then
tmp = sin(th) / (sin(kx) / ky)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.02) {
tmp = 1.0 / Math.sqrt(Math.pow(Math.sin(th), -2.0));
} else if (Math.sin(ky) <= 5e-91) {
tmp = Math.sin(th) / (Math.sin(kx) / ky);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.02: tmp = 1.0 / math.sqrt(math.pow(math.sin(th), -2.0)) elif math.sin(ky) <= 5e-91: tmp = math.sin(th) / (math.sin(kx) / ky) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.02) tmp = Float64(1.0 / sqrt((sin(th) ^ -2.0))); elseif (sin(ky) <= 5e-91) tmp = Float64(sin(th) / Float64(sin(kx) / ky)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.02) tmp = 1.0 / sqrt((sin(th) ^ -2.0)); elseif (sin(ky) <= 5e-91) tmp = sin(th) / (sin(kx) / ky); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.02], N[(1.0 / N[Sqrt[N[Power[N[Sin[th], $MachinePrecision], -2.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-91], N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.02:\\
\;\;\;\;\frac{1}{\sqrt{{\sin th}^{-2}}}\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-91}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0200000000000000004Initial program 99.8%
associate-*l/99.7%
clear-num99.4%
unpow299.4%
unpow299.4%
hypot-def99.4%
Applied egg-rr99.4%
Taylor expanded in kx around 0 3.1%
add-sqr-sqrt1.8%
sqrt-unprod22.7%
inv-pow22.7%
inv-pow22.7%
pow-prod-up22.7%
metadata-eval22.7%
Applied egg-rr22.7%
if -0.0200000000000000004 < (sin.f64 ky) < 4.99999999999999997e-91Initial program 87.5%
clear-num87.6%
associate-*l/87.7%
*-un-lft-identity87.7%
unpow287.7%
unpow287.7%
hypot-def99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 52.2%
if 4.99999999999999997e-91 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 62.8%
Final simplification47.5%
(FPCore (kx ky th)
:precision binary64
(if (<= kx 2.4e-162)
(sin th)
(if (<= kx 1.2e-55)
(fabs (sin th))
(* (sin th) (fabs (/ (sin ky) (sin kx)))))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 2.4e-162) {
tmp = sin(th);
} else if (kx <= 1.2e-55) {
tmp = fabs(sin(th));
} else {
tmp = sin(th) * fabs((sin(ky) / sin(kx)));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (kx <= 2.4d-162) then
tmp = sin(th)
else if (kx <= 1.2d-55) then
tmp = abs(sin(th))
else
tmp = sin(th) * abs((sin(ky) / sin(kx)))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 2.4e-162) {
tmp = Math.sin(th);
} else if (kx <= 1.2e-55) {
tmp = Math.abs(Math.sin(th));
} else {
tmp = Math.sin(th) * Math.abs((Math.sin(ky) / Math.sin(kx)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 2.4e-162: tmp = math.sin(th) elif kx <= 1.2e-55: tmp = math.fabs(math.sin(th)) else: tmp = math.sin(th) * math.fabs((math.sin(ky) / math.sin(kx))) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 2.4e-162) tmp = sin(th); elseif (kx <= 1.2e-55) tmp = abs(sin(th)); else tmp = Float64(sin(th) * abs(Float64(sin(ky) / sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 2.4e-162) tmp = sin(th); elseif (kx <= 1.2e-55) tmp = abs(sin(th)); else tmp = sin(th) * abs((sin(ky) / sin(kx))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 2.4e-162], N[Sin[th], $MachinePrecision], If[LessEqual[kx, 1.2e-55], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[Abs[N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 2.4 \cdot 10^{-162}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;kx \leq 1.2 \cdot 10^{-55}:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \left|\frac{\sin ky}{\sin kx}\right|\\
\end{array}
\end{array}
if kx < 2.4000000000000002e-162Initial program 92.0%
Taylor expanded in kx around 0 31.5%
if 2.4000000000000002e-162 < kx < 1.19999999999999996e-55Initial program 99.9%
associate-*l/95.5%
clear-num95.2%
unpow295.2%
unpow295.2%
hypot-def95.2%
Applied egg-rr95.2%
Taylor expanded in kx around 0 36.0%
remove-double-div36.1%
add-sqr-sqrt30.2%
sqrt-unprod23.4%
pow223.4%
Applied egg-rr23.4%
unpow223.4%
rem-sqrt-square45.3%
Simplified45.3%
if 1.19999999999999996e-55 < kx Initial program 99.4%
Taylor expanded in ky around 0 45.6%
add-sqr-sqrt25.0%
sqrt-unprod33.7%
pow233.7%
Applied egg-rr33.7%
unpow233.7%
rem-sqrt-square39.1%
Simplified39.1%
Final simplification34.7%
(FPCore (kx ky th)
:precision binary64
(if (<= kx 4.7e-163)
(sin th)
(if (<= kx 5e-57)
(fabs (sin th))
(/ (sin th) (fabs (/ (sin kx) (sin ky)))))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 4.7e-163) {
tmp = sin(th);
} else if (kx <= 5e-57) {
tmp = fabs(sin(th));
} else {
tmp = sin(th) / fabs((sin(kx) / sin(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 <= 4.7d-163) then
tmp = sin(th)
else if (kx <= 5d-57) then
tmp = abs(sin(th))
else
tmp = sin(th) / abs((sin(kx) / sin(ky)))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 4.7e-163) {
tmp = Math.sin(th);
} else if (kx <= 5e-57) {
tmp = Math.abs(Math.sin(th));
} else {
tmp = Math.sin(th) / Math.abs((Math.sin(kx) / Math.sin(ky)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 4.7e-163: tmp = math.sin(th) elif kx <= 5e-57: tmp = math.fabs(math.sin(th)) else: tmp = math.sin(th) / math.fabs((math.sin(kx) / math.sin(ky))) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 4.7e-163) tmp = sin(th); elseif (kx <= 5e-57) tmp = abs(sin(th)); else tmp = Float64(sin(th) / abs(Float64(sin(kx) / sin(ky)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 4.7e-163) tmp = sin(th); elseif (kx <= 5e-57) tmp = abs(sin(th)); else tmp = sin(th) / abs((sin(kx) / sin(ky))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 4.7e-163], N[Sin[th], $MachinePrecision], If[LessEqual[kx, 5e-57], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] / N[Abs[N[(N[Sin[kx], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 4.7 \cdot 10^{-163}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;kx \leq 5 \cdot 10^{-57}:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th}{\left|\frac{\sin kx}{\sin ky}\right|}\\
\end{array}
\end{array}
if kx < 4.7e-163Initial program 92.0%
Taylor expanded in kx around 0 31.5%
if 4.7e-163 < kx < 5.0000000000000002e-57Initial program 99.9%
associate-*l/95.5%
clear-num95.2%
unpow295.2%
unpow295.2%
hypot-def95.2%
Applied egg-rr95.2%
Taylor expanded in kx around 0 36.0%
remove-double-div36.1%
add-sqr-sqrt30.2%
sqrt-unprod23.4%
pow223.4%
Applied egg-rr23.4%
unpow223.4%
rem-sqrt-square45.3%
Simplified45.3%
if 5.0000000000000002e-57 < kx Initial program 99.4%
clear-num99.4%
associate-*l/99.6%
*-un-lft-identity99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 45.7%
add-sqr-sqrt25.1%
sqrt-unprod32.8%
pow232.8%
Applied egg-rr32.8%
unpow232.8%
rem-sqrt-square39.1%
Simplified39.1%
Final simplification34.7%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.02) (fabs (sin th)) (if (<= (sin ky) 5e-151) (/ ky (/ kx (sin th))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.02) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 5e-151) {
tmp = ky / (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.02d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 5d-151) then
tmp = ky / (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.02) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 5e-151) {
tmp = ky / (kx / Math.sin(th));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.02: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 5e-151: tmp = ky / (kx / math.sin(th)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.02) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-151) tmp = Float64(ky / Float64(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.02) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-151) tmp = ky / (kx / sin(th)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.02], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-151], N[(ky / N[(kx / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.02:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-151}:\\
\;\;\;\;\frac{ky}{\frac{kx}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0200000000000000004Initial program 99.8%
associate-*l/99.7%
clear-num99.4%
unpow299.4%
unpow299.4%
hypot-def99.4%
Applied egg-rr99.4%
Taylor expanded in kx around 0 3.1%
remove-double-div3.1%
add-sqr-sqrt1.8%
sqrt-unprod22.6%
pow222.6%
Applied egg-rr22.6%
unpow222.6%
rem-sqrt-square31.0%
Simplified31.0%
if -0.0200000000000000004 < (sin.f64 ky) < 5.00000000000000003e-151Initial program 85.2%
Taylor expanded in ky around 0 54.9%
Taylor expanded in kx around 0 38.6%
Taylor expanded in ky around 0 38.6%
associate-/l*38.4%
Simplified38.4%
if 5.00000000000000003e-151 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 58.7%
Final simplification44.2%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 5e-151) (/ ky (/ kx (sin th))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 5e-151) {
tmp = ky / (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) <= 5d-151) then
tmp = ky / (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) <= 5e-151) {
tmp = ky / (kx / Math.sin(th));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 5e-151: tmp = ky / (kx / math.sin(th)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 5e-151) tmp = Float64(ky / Float64(kx / sin(th))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= 5e-151) tmp = ky / (kx / sin(th)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-151], N[(ky / N[(kx / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 5 \cdot 10^{-151}:\\
\;\;\;\;\frac{ky}{\frac{kx}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 5.00000000000000003e-151Initial program 91.7%
Taylor expanded in ky around 0 33.3%
Taylor expanded in kx around 0 23.5%
Taylor expanded in ky around 0 22.9%
associate-/l*22.9%
Simplified22.9%
if 5.00000000000000003e-151 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 58.7%
Final simplification36.6%
(FPCore (kx ky th) :precision binary64 (if (<= ky 3e-152) (/ 0.0 (* (sin kx) 2.0)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 3e-152) {
tmp = 0.0 / (sin(kx) * 2.0);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= 3d-152) then
tmp = 0.0d0 / (sin(kx) * 2.0d0)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 3e-152) {
tmp = 0.0 / (Math.sin(kx) * 2.0);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 3e-152: tmp = 0.0 / (math.sin(kx) * 2.0) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 3e-152) tmp = Float64(0.0 / Float64(sin(kx) * 2.0)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 3e-152) tmp = 0.0 / (sin(kx) * 2.0); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 3e-152], N[(0.0 / N[(N[Sin[kx], $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 3 \cdot 10^{-152}:\\
\;\;\;\;\frac{0}{\sin kx \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 3e-152Initial program 91.5%
Taylor expanded in ky around 0 34.2%
associate-*l/34.3%
sin-mult17.7%
associate-/l/17.7%
+-commutative17.7%
Applied egg-rr17.7%
Taylor expanded in ky around 0 17.6%
cos-neg17.6%
+-inverses17.6%
Simplified17.6%
if 3e-152 < ky Initial program 99.7%
Taylor expanded in kx around 0 38.2%
Final simplification25.7%
(FPCore (kx ky th) :precision binary64 (sin th))
double code(double kx, double ky, double th) {
return 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(th)
end function
public static double code(double kx, double ky, double th) {
return Math.sin(th);
}
def code(kx, ky, th): return math.sin(th)
function code(kx, ky, th) return sin(th) end
function tmp = code(kx, ky, th) tmp = sin(th); end
code[kx_, ky_, th_] := N[Sin[th], $MachinePrecision]
\begin{array}{l}
\\
\sin th
\end{array}
Initial program 94.7%
Taylor expanded in kx around 0 25.9%
Final simplification25.9%
(FPCore (kx ky th) :precision binary64 (/ 1.0 (+ (* th 0.16666666666666666) (/ 1.0 th))))
double code(double kx, double ky, double th) {
return 1.0 / ((th * 0.16666666666666666) + (1.0 / th));
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = 1.0d0 / ((th * 0.16666666666666666d0) + (1.0d0 / th))
end function
public static double code(double kx, double ky, double th) {
return 1.0 / ((th * 0.16666666666666666) + (1.0 / th));
}
def code(kx, ky, th): return 1.0 / ((th * 0.16666666666666666) + (1.0 / th))
function code(kx, ky, th) return Float64(1.0 / Float64(Float64(th * 0.16666666666666666) + Float64(1.0 / th))) end
function tmp = code(kx, ky, th) tmp = 1.0 / ((th * 0.16666666666666666) + (1.0 / th)); end
code[kx_, ky_, th_] := N[(1.0 / N[(N[(th * 0.16666666666666666), $MachinePrecision] + N[(1.0 / th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{th \cdot 0.16666666666666666 + \frac{1}{th}}
\end{array}
Initial program 94.7%
associate-*l/93.6%
clear-num93.2%
unpow293.2%
unpow293.2%
hypot-def97.1%
Applied egg-rr97.1%
Taylor expanded in kx around 0 25.9%
Taylor expanded in th around 0 15.6%
Final simplification15.6%
(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 94.7%
associate-*l/93.6%
clear-num93.2%
unpow293.2%
unpow293.2%
hypot-def97.1%
Applied egg-rr97.1%
Taylor expanded in kx around 0 25.9%
Taylor expanded in th around 0 14.9%
Final simplification14.9%
herbie shell --seed 2024014
(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)))