
(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 20 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
(let* ((t_1 (hypot (sin ky) (sin kx))))
(if (<= ky -2.6)
(fabs (/ (sin th) (/ t_1 (sin ky))))
(if (<= ky 75000000.0)
(/ (* (sin ky) (fabs (sin th))) t_1)
(* (sin th) (/ (fabs (sin ky)) t_1))))))
double code(double kx, double ky, double th) {
double t_1 = hypot(sin(ky), sin(kx));
double tmp;
if (ky <= -2.6) {
tmp = fabs((sin(th) / (t_1 / sin(ky))));
} else if (ky <= 75000000.0) {
tmp = (sin(ky) * fabs(sin(th))) / t_1;
} else {
tmp = sin(th) * (fabs(sin(ky)) / t_1);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.hypot(Math.sin(ky), Math.sin(kx));
double tmp;
if (ky <= -2.6) {
tmp = Math.abs((Math.sin(th) / (t_1 / Math.sin(ky))));
} else if (ky <= 75000000.0) {
tmp = (Math.sin(ky) * Math.abs(Math.sin(th))) / t_1;
} else {
tmp = Math.sin(th) * (Math.abs(Math.sin(ky)) / t_1);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.hypot(math.sin(ky), math.sin(kx)) tmp = 0 if ky <= -2.6: tmp = math.fabs((math.sin(th) / (t_1 / math.sin(ky)))) elif ky <= 75000000.0: tmp = (math.sin(ky) * math.fabs(math.sin(th))) / t_1 else: tmp = math.sin(th) * (math.fabs(math.sin(ky)) / t_1) return tmp
function code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)) tmp = 0.0 if (ky <= -2.6) tmp = abs(Float64(sin(th) / Float64(t_1 / sin(ky)))); elseif (ky <= 75000000.0) tmp = Float64(Float64(sin(ky) * abs(sin(th))) / t_1); else tmp = Float64(sin(th) * Float64(abs(sin(ky)) / t_1)); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)); tmp = 0.0; if (ky <= -2.6) tmp = abs((sin(th) / (t_1 / sin(ky)))); elseif (ky <= 75000000.0) tmp = (sin(ky) * abs(sin(th))) / t_1; else tmp = sin(th) * (abs(sin(ky)) / t_1); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[ky, -2.6], N[Abs[N[(N[Sin[th], $MachinePrecision] / N[(t$95$1 / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[ky, 75000000.0], N[(N[(N[Sin[ky], $MachinePrecision] * N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Abs[N[Sin[ky], $MachinePrecision]], $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\
\mathbf{if}\;ky \leq -2.6:\\
\;\;\;\;\left|\frac{\sin th}{\frac{t_1}{\sin ky}}\right|\\
\mathbf{elif}\;ky \leq 75000000:\\
\;\;\;\;\frac{\sin ky \cdot \left|\sin th\right|}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\left|\sin ky\right|}{t_1}\\
\end{array}
\end{array}
if ky < -2.60000000000000009Initial program 50.2%
+-commutative50.2%
unpow250.2%
unpow250.2%
hypot-def50.2%
Simplified50.2%
add-sqr-sqrt42.8%
sqrt-unprod63.0%
pow263.0%
associate-/r/63.0%
div-inv62.9%
clear-num63.1%
Applied egg-rr63.1%
unpow263.1%
rem-sqrt-square80.0%
*-commutative80.0%
associate-/r/80.0%
Simplified80.0%
if -2.60000000000000009 < ky < 7.5e7Initial program 71.3%
associate-*l/68.9%
+-commutative68.9%
unpow268.9%
unpow268.9%
hypot-def70.8%
Simplified70.8%
add-sqr-sqrt50.9%
sqrt-unprod82.4%
pow282.4%
Applied egg-rr82.4%
unpow282.4%
rem-sqrt-square83.1%
Simplified83.1%
if 7.5e7 < ky Initial program 44.1%
+-commutative44.1%
unpow244.1%
unpow244.1%
hypot-def44.1%
Simplified44.1%
add-sqr-sqrt32.4%
sqrt-prod82.6%
rem-sqrt-square82.6%
Applied egg-rr82.6%
Final simplification82.2%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (hypot (sin ky) (sin kx))) (t_2 (fabs (sin ky))))
(if (<= (sin th) -0.86)
(* (sin th) (/ t_2 (hypot ky (sin kx))))
(if (<= (sin th) -0.02)
(fabs (sin th))
(if (<= (sin th) 3.2e-139)
(* th (/ t_2 t_1))
(* (sin ky) (/ (sin th) t_1)))))))
double code(double kx, double ky, double th) {
double t_1 = hypot(sin(ky), sin(kx));
double t_2 = fabs(sin(ky));
double tmp;
if (sin(th) <= -0.86) {
tmp = sin(th) * (t_2 / hypot(ky, sin(kx)));
} else if (sin(th) <= -0.02) {
tmp = fabs(sin(th));
} else if (sin(th) <= 3.2e-139) {
tmp = th * (t_2 / t_1);
} else {
tmp = sin(ky) * (sin(th) / t_1);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.hypot(Math.sin(ky), Math.sin(kx));
double t_2 = Math.abs(Math.sin(ky));
double tmp;
if (Math.sin(th) <= -0.86) {
tmp = Math.sin(th) * (t_2 / Math.hypot(ky, Math.sin(kx)));
} else if (Math.sin(th) <= -0.02) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(th) <= 3.2e-139) {
tmp = th * (t_2 / t_1);
} else {
tmp = Math.sin(ky) * (Math.sin(th) / t_1);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.hypot(math.sin(ky), math.sin(kx)) t_2 = math.fabs(math.sin(ky)) tmp = 0 if math.sin(th) <= -0.86: tmp = math.sin(th) * (t_2 / math.hypot(ky, math.sin(kx))) elif math.sin(th) <= -0.02: tmp = math.fabs(math.sin(th)) elif math.sin(th) <= 3.2e-139: tmp = th * (t_2 / t_1) else: tmp = math.sin(ky) * (math.sin(th) / t_1) return tmp
function code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)) t_2 = abs(sin(ky)) tmp = 0.0 if (sin(th) <= -0.86) tmp = Float64(sin(th) * Float64(t_2 / hypot(ky, sin(kx)))); elseif (sin(th) <= -0.02) tmp = abs(sin(th)); elseif (sin(th) <= 3.2e-139) tmp = Float64(th * Float64(t_2 / t_1)); else tmp = Float64(sin(ky) * Float64(sin(th) / t_1)); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)); t_2 = abs(sin(ky)); tmp = 0.0; if (sin(th) <= -0.86) tmp = sin(th) * (t_2 / hypot(ky, sin(kx))); elseif (sin(th) <= -0.02) tmp = abs(sin(th)); elseif (sin(th) <= 3.2e-139) tmp = th * (t_2 / t_1); else tmp = sin(ky) * (sin(th) / t_1); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]}, Block[{t$95$2 = N[Abs[N[Sin[ky], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[Sin[th], $MachinePrecision], -0.86], N[(N[Sin[th], $MachinePrecision] * N[(t$95$2 / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], -0.02], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], 3.2e-139], N[(th * N[(t$95$2 / t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\
t_2 := \left|\sin ky\right|\\
\mathbf{if}\;\sin th \leq -0.86:\\
\;\;\;\;\sin th \cdot \frac{t_2}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\mathbf{elif}\;\sin th \leq -0.02:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin th \leq 3.2 \cdot 10^{-139}:\\
\;\;\;\;th \cdot \frac{t_2}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{t_1}\\
\end{array}
\end{array}
if (sin.f64 th) < -0.859999999999999987Initial program 26.7%
+-commutative26.7%
unpow226.7%
unpow226.7%
hypot-def26.7%
Simplified26.7%
add-sqr-sqrt0.5%
sqrt-prod23.7%
rem-sqrt-square47.0%
Applied egg-rr47.0%
Taylor expanded in ky around 0 44.0%
if -0.859999999999999987 < (sin.f64 th) < -0.0200000000000000004Initial program 39.0%
associate-*l/39.0%
+-commutative39.0%
unpow239.0%
unpow239.0%
hypot-def39.1%
Simplified39.1%
add-sqr-sqrt0.0%
sqrt-unprod62.4%
pow262.4%
Applied egg-rr62.4%
unpow262.4%
rem-sqrt-square62.4%
Simplified62.4%
Taylor expanded in kx around 0 42.2%
if -0.0200000000000000004 < (sin.f64 th) < 3.1999999999999999e-139Initial program 62.4%
+-commutative62.4%
unpow262.4%
unpow262.4%
hypot-def64.4%
Simplified64.4%
add-sqr-sqrt43.7%
sqrt-prod88.0%
rem-sqrt-square89.8%
Applied egg-rr89.8%
Taylor expanded in th around 0 89.5%
if 3.1999999999999999e-139 < (sin.f64 th) Initial program 69.4%
associate-*l/69.4%
+-commutative69.4%
unpow269.4%
unpow269.4%
hypot-def71.5%
Simplified71.5%
associate-/l*71.5%
div-inv71.4%
clear-num71.6%
Applied egg-rr71.6%
Final simplification71.3%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (hypot (sin ky) (sin kx)))
(t_2 (fabs (/ (sin th) (/ t_1 (sin ky))))))
(if (<= th -102000000.0)
t_2
(if (<= th 3.2e-139)
(* th (/ (fabs (sin ky)) t_1))
(if (<= th 1.32e+66) (* (sin ky) (/ (sin th) t_1)) t_2)))))
double code(double kx, double ky, double th) {
double t_1 = hypot(sin(ky), sin(kx));
double t_2 = fabs((sin(th) / (t_1 / sin(ky))));
double tmp;
if (th <= -102000000.0) {
tmp = t_2;
} else if (th <= 3.2e-139) {
tmp = th * (fabs(sin(ky)) / t_1);
} else if (th <= 1.32e+66) {
tmp = sin(ky) * (sin(th) / t_1);
} else {
tmp = t_2;
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.hypot(Math.sin(ky), Math.sin(kx));
double t_2 = Math.abs((Math.sin(th) / (t_1 / Math.sin(ky))));
double tmp;
if (th <= -102000000.0) {
tmp = t_2;
} else if (th <= 3.2e-139) {
tmp = th * (Math.abs(Math.sin(ky)) / t_1);
} else if (th <= 1.32e+66) {
tmp = Math.sin(ky) * (Math.sin(th) / t_1);
} else {
tmp = t_2;
}
return tmp;
}
def code(kx, ky, th): t_1 = math.hypot(math.sin(ky), math.sin(kx)) t_2 = math.fabs((math.sin(th) / (t_1 / math.sin(ky)))) tmp = 0 if th <= -102000000.0: tmp = t_2 elif th <= 3.2e-139: tmp = th * (math.fabs(math.sin(ky)) / t_1) elif th <= 1.32e+66: tmp = math.sin(ky) * (math.sin(th) / t_1) else: tmp = t_2 return tmp
function code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)) t_2 = abs(Float64(sin(th) / Float64(t_1 / sin(ky)))) tmp = 0.0 if (th <= -102000000.0) tmp = t_2; elseif (th <= 3.2e-139) tmp = Float64(th * Float64(abs(sin(ky)) / t_1)); elseif (th <= 1.32e+66) tmp = Float64(sin(ky) * Float64(sin(th) / t_1)); else tmp = t_2; end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)); t_2 = abs((sin(th) / (t_1 / sin(ky)))); tmp = 0.0; if (th <= -102000000.0) tmp = t_2; elseif (th <= 3.2e-139) tmp = th * (abs(sin(ky)) / t_1); elseif (th <= 1.32e+66) tmp = sin(ky) * (sin(th) / t_1); else tmp = t_2; end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]}, Block[{t$95$2 = N[Abs[N[(N[Sin[th], $MachinePrecision] / N[(t$95$1 / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[th, -102000000.0], t$95$2, If[LessEqual[th, 3.2e-139], N[(th * N[(N[Abs[N[Sin[ky], $MachinePrecision]], $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[th, 1.32e+66], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\
t_2 := \left|\frac{\sin th}{\frac{t_1}{\sin ky}}\right|\\
\mathbf{if}\;th \leq -102000000:\\
\;\;\;\;t_2\\
\mathbf{elif}\;th \leq 3.2 \cdot 10^{-139}:\\
\;\;\;\;th \cdot \frac{\left|\sin ky\right|}{t_1}\\
\mathbf{elif}\;th \leq 1.32 \cdot 10^{+66}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{t_1}\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if th < -1.02e8 or 1.32000000000000009e66 < th Initial program 47.5%
+-commutative47.5%
unpow247.5%
unpow247.5%
hypot-def48.4%
Simplified48.4%
add-sqr-sqrt33.2%
sqrt-unprod63.2%
pow263.2%
associate-/r/63.1%
div-inv63.1%
clear-num63.2%
Applied egg-rr63.2%
unpow263.2%
rem-sqrt-square67.8%
*-commutative67.8%
associate-/r/67.8%
Simplified67.8%
if -1.02e8 < th < 3.1999999999999999e-139Initial program 62.2%
+-commutative62.2%
unpow262.2%
unpow262.2%
hypot-def64.1%
Simplified64.1%
add-sqr-sqrt43.8%
sqrt-prod88.2%
rem-sqrt-square89.9%
Applied egg-rr89.9%
Taylor expanded in th around 0 87.9%
if 3.1999999999999999e-139 < th < 1.32000000000000009e66Initial program 77.8%
associate-*l/77.8%
+-commutative77.8%
unpow277.8%
unpow277.8%
hypot-def80.5%
Simplified80.5%
associate-/l*80.5%
div-inv80.4%
clear-num80.7%
Applied egg-rr80.7%
Final simplification77.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (hypot (sin ky) (sin kx))) (t_2 (/ (sin th) t_1)))
(if (<= ky -3.2e+15)
(fabs (/ (sin th) (/ t_1 (sin ky))))
(if (<= ky -1.6e-233) (* (sin ky) t_2) (* (fabs (sin ky)) t_2)))))
double code(double kx, double ky, double th) {
double t_1 = hypot(sin(ky), sin(kx));
double t_2 = sin(th) / t_1;
double tmp;
if (ky <= -3.2e+15) {
tmp = fabs((sin(th) / (t_1 / sin(ky))));
} else if (ky <= -1.6e-233) {
tmp = sin(ky) * t_2;
} else {
tmp = fabs(sin(ky)) * t_2;
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.hypot(Math.sin(ky), Math.sin(kx));
double t_2 = Math.sin(th) / t_1;
double tmp;
if (ky <= -3.2e+15) {
tmp = Math.abs((Math.sin(th) / (t_1 / Math.sin(ky))));
} else if (ky <= -1.6e-233) {
tmp = Math.sin(ky) * t_2;
} else {
tmp = Math.abs(Math.sin(ky)) * t_2;
}
return tmp;
}
def code(kx, ky, th): t_1 = math.hypot(math.sin(ky), math.sin(kx)) t_2 = math.sin(th) / t_1 tmp = 0 if ky <= -3.2e+15: tmp = math.fabs((math.sin(th) / (t_1 / math.sin(ky)))) elif ky <= -1.6e-233: tmp = math.sin(ky) * t_2 else: tmp = math.fabs(math.sin(ky)) * t_2 return tmp
function code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)) t_2 = Float64(sin(th) / t_1) tmp = 0.0 if (ky <= -3.2e+15) tmp = abs(Float64(sin(th) / Float64(t_1 / sin(ky)))); elseif (ky <= -1.6e-233) tmp = Float64(sin(ky) * t_2); else tmp = Float64(abs(sin(ky)) * t_2); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)); t_2 = sin(th) / t_1; tmp = 0.0; if (ky <= -3.2e+15) tmp = abs((sin(th) / (t_1 / sin(ky)))); elseif (ky <= -1.6e-233) tmp = sin(ky) * t_2; else tmp = abs(sin(ky)) * t_2; end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[th], $MachinePrecision] / t$95$1), $MachinePrecision]}, If[LessEqual[ky, -3.2e+15], N[Abs[N[(N[Sin[th], $MachinePrecision] / N[(t$95$1 / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[ky, -1.6e-233], N[(N[Sin[ky], $MachinePrecision] * t$95$2), $MachinePrecision], N[(N[Abs[N[Sin[ky], $MachinePrecision]], $MachinePrecision] * t$95$2), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\
t_2 := \frac{\sin th}{t_1}\\
\mathbf{if}\;ky \leq -3.2 \cdot 10^{+15}:\\
\;\;\;\;\left|\frac{\sin th}{\frac{t_1}{\sin ky}}\right|\\
\mathbf{elif}\;ky \leq -1.6 \cdot 10^{-233}:\\
\;\;\;\;\sin ky \cdot t_2\\
\mathbf{else}:\\
\;\;\;\;\left|\sin ky\right| \cdot t_2\\
\end{array}
\end{array}
if ky < -3.2e15Initial program 47.7%
+-commutative47.7%
unpow247.7%
unpow247.7%
hypot-def47.7%
Simplified47.7%
add-sqr-sqrt40.0%
sqrt-unprod64.3%
pow264.3%
associate-/r/64.2%
div-inv64.2%
clear-num64.4%
Applied egg-rr64.4%
unpow264.4%
rem-sqrt-square79.0%
*-commutative79.0%
associate-/r/78.9%
Simplified78.9%
if -3.2e15 < ky < -1.5999999999999999e-233Initial program 72.9%
associate-*l/71.2%
+-commutative71.2%
unpow271.2%
unpow271.2%
hypot-def74.5%
Simplified74.5%
associate-/l*76.2%
div-inv75.9%
clear-num76.2%
Applied egg-rr76.2%
if -1.5999999999999999e-233 < ky Initial program 55.5%
associate-*l/54.2%
+-commutative54.2%
unpow254.2%
unpow254.2%
hypot-def54.4%
Simplified54.4%
associate-/l*56.9%
div-inv56.9%
clear-num57.0%
Applied egg-rr57.0%
add-sqr-sqrt41.9%
sqrt-prod70.0%
rem-sqrt-square80.1%
Applied egg-rr80.0%
Final simplification78.9%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (hypot (sin ky) (sin kx))))
(if (<= ky -3.2e+15)
(fabs (/ (sin th) (/ t_1 (sin ky))))
(if (<= ky -1.6e-233)
(* (sin ky) (/ (sin th) t_1))
(* (sin th) (/ (fabs (sin ky)) t_1))))))
double code(double kx, double ky, double th) {
double t_1 = hypot(sin(ky), sin(kx));
double tmp;
if (ky <= -3.2e+15) {
tmp = fabs((sin(th) / (t_1 / sin(ky))));
} else if (ky <= -1.6e-233) {
tmp = sin(ky) * (sin(th) / t_1);
} else {
tmp = sin(th) * (fabs(sin(ky)) / t_1);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.hypot(Math.sin(ky), Math.sin(kx));
double tmp;
if (ky <= -3.2e+15) {
tmp = Math.abs((Math.sin(th) / (t_1 / Math.sin(ky))));
} else if (ky <= -1.6e-233) {
tmp = Math.sin(ky) * (Math.sin(th) / t_1);
} else {
tmp = Math.sin(th) * (Math.abs(Math.sin(ky)) / t_1);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.hypot(math.sin(ky), math.sin(kx)) tmp = 0 if ky <= -3.2e+15: tmp = math.fabs((math.sin(th) / (t_1 / math.sin(ky)))) elif ky <= -1.6e-233: tmp = math.sin(ky) * (math.sin(th) / t_1) else: tmp = math.sin(th) * (math.fabs(math.sin(ky)) / t_1) return tmp
function code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)) tmp = 0.0 if (ky <= -3.2e+15) tmp = abs(Float64(sin(th) / Float64(t_1 / sin(ky)))); elseif (ky <= -1.6e-233) tmp = Float64(sin(ky) * Float64(sin(th) / t_1)); else tmp = Float64(sin(th) * Float64(abs(sin(ky)) / t_1)); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)); tmp = 0.0; if (ky <= -3.2e+15) tmp = abs((sin(th) / (t_1 / sin(ky)))); elseif (ky <= -1.6e-233) tmp = sin(ky) * (sin(th) / t_1); else tmp = sin(th) * (abs(sin(ky)) / t_1); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[ky, -3.2e+15], N[Abs[N[(N[Sin[th], $MachinePrecision] / N[(t$95$1 / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[ky, -1.6e-233], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Abs[N[Sin[ky], $MachinePrecision]], $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\
\mathbf{if}\;ky \leq -3.2 \cdot 10^{+15}:\\
\;\;\;\;\left|\frac{\sin th}{\frac{t_1}{\sin ky}}\right|\\
\mathbf{elif}\;ky \leq -1.6 \cdot 10^{-233}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\left|\sin ky\right|}{t_1}\\
\end{array}
\end{array}
if ky < -3.2e15Initial program 47.7%
+-commutative47.7%
unpow247.7%
unpow247.7%
hypot-def47.7%
Simplified47.7%
add-sqr-sqrt40.0%
sqrt-unprod64.3%
pow264.3%
associate-/r/64.2%
div-inv64.2%
clear-num64.4%
Applied egg-rr64.4%
unpow264.4%
rem-sqrt-square79.0%
*-commutative79.0%
associate-/r/78.9%
Simplified78.9%
if -3.2e15 < ky < -1.5999999999999999e-233Initial program 72.9%
associate-*l/71.2%
+-commutative71.2%
unpow271.2%
unpow271.2%
hypot-def74.5%
Simplified74.5%
associate-/l*76.2%
div-inv75.9%
clear-num76.2%
Applied egg-rr76.2%
if -1.5999999999999999e-233 < ky Initial program 55.5%
+-commutative55.5%
unpow255.5%
unpow255.5%
hypot-def57.0%
Simplified57.0%
add-sqr-sqrt41.9%
sqrt-prod70.0%
rem-sqrt-square80.1%
Applied egg-rr80.1%
Final simplification78.9%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (hypot (sin ky) (sin kx))))
(if (<= ky -2.6)
(fabs (/ (sin th) (/ t_1 (sin ky))))
(if (<= ky 170000000.0)
(* (fabs (sin th)) (/ (sin ky) t_1))
(* (sin th) (/ (fabs (sin ky)) t_1))))))
double code(double kx, double ky, double th) {
double t_1 = hypot(sin(ky), sin(kx));
double tmp;
if (ky <= -2.6) {
tmp = fabs((sin(th) / (t_1 / sin(ky))));
} else if (ky <= 170000000.0) {
tmp = fabs(sin(th)) * (sin(ky) / t_1);
} else {
tmp = sin(th) * (fabs(sin(ky)) / t_1);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.hypot(Math.sin(ky), Math.sin(kx));
double tmp;
if (ky <= -2.6) {
tmp = Math.abs((Math.sin(th) / (t_1 / Math.sin(ky))));
} else if (ky <= 170000000.0) {
tmp = Math.abs(Math.sin(th)) * (Math.sin(ky) / t_1);
} else {
tmp = Math.sin(th) * (Math.abs(Math.sin(ky)) / t_1);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.hypot(math.sin(ky), math.sin(kx)) tmp = 0 if ky <= -2.6: tmp = math.fabs((math.sin(th) / (t_1 / math.sin(ky)))) elif ky <= 170000000.0: tmp = math.fabs(math.sin(th)) * (math.sin(ky) / t_1) else: tmp = math.sin(th) * (math.fabs(math.sin(ky)) / t_1) return tmp
function code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)) tmp = 0.0 if (ky <= -2.6) tmp = abs(Float64(sin(th) / Float64(t_1 / sin(ky)))); elseif (ky <= 170000000.0) tmp = Float64(abs(sin(th)) * Float64(sin(ky) / t_1)); else tmp = Float64(sin(th) * Float64(abs(sin(ky)) / t_1)); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)); tmp = 0.0; if (ky <= -2.6) tmp = abs((sin(th) / (t_1 / sin(ky)))); elseif (ky <= 170000000.0) tmp = abs(sin(th)) * (sin(ky) / t_1); else tmp = sin(th) * (abs(sin(ky)) / t_1); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[ky, -2.6], N[Abs[N[(N[Sin[th], $MachinePrecision] / N[(t$95$1 / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[ky, 170000000.0], N[(N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Abs[N[Sin[ky], $MachinePrecision]], $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\
\mathbf{if}\;ky \leq -2.6:\\
\;\;\;\;\left|\frac{\sin th}{\frac{t_1}{\sin ky}}\right|\\
\mathbf{elif}\;ky \leq 170000000:\\
\;\;\;\;\left|\sin th\right| \cdot \frac{\sin ky}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\left|\sin ky\right|}{t_1}\\
\end{array}
\end{array}
if ky < -2.60000000000000009Initial program 50.2%
+-commutative50.2%
unpow250.2%
unpow250.2%
hypot-def50.2%
Simplified50.2%
add-sqr-sqrt42.8%
sqrt-unprod63.0%
pow263.0%
associate-/r/63.0%
div-inv62.9%
clear-num63.1%
Applied egg-rr63.1%
unpow263.1%
rem-sqrt-square80.0%
*-commutative80.0%
associate-/r/80.0%
Simplified80.0%
if -2.60000000000000009 < ky < 1.7e8Initial program 71.3%
+-commutative71.3%
unpow271.3%
unpow271.3%
hypot-def74.8%
Simplified74.8%
add-sqr-sqrt50.9%
sqrt-unprod82.4%
pow282.4%
Applied egg-rr82.5%
unpow282.4%
rem-sqrt-square83.1%
Simplified83.1%
if 1.7e8 < ky Initial program 44.1%
+-commutative44.1%
unpow244.1%
unpow244.1%
hypot-def44.1%
Simplified44.1%
add-sqr-sqrt32.4%
sqrt-prod82.6%
rem-sqrt-square82.6%
Applied egg-rr82.6%
Final simplification82.2%
(FPCore (kx ky th) :precision binary64 (if (<= kx 1.05e-80) (* (sin th) (/ (sin ky) (+ (sin ky) (* 0.5 (/ (* kx kx) (sin ky)))))) (* (sin ky) (/ (sin th) (hypot (sin ky) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 1.05e-80) {
tmp = sin(th) * (sin(ky) / (sin(ky) + (0.5 * ((kx * kx) / sin(ky)))));
} else {
tmp = sin(ky) * (sin(th) / hypot(sin(ky), sin(kx)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 1.05e-80) {
tmp = Math.sin(th) * (Math.sin(ky) / (Math.sin(ky) + (0.5 * ((kx * kx) / Math.sin(ky)))));
} else {
tmp = Math.sin(ky) * (Math.sin(th) / Math.hypot(Math.sin(ky), Math.sin(kx)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 1.05e-80: tmp = math.sin(th) * (math.sin(ky) / (math.sin(ky) + (0.5 * ((kx * kx) / math.sin(ky))))) else: tmp = math.sin(ky) * (math.sin(th) / math.hypot(math.sin(ky), math.sin(kx))) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 1.05e-80) tmp = Float64(sin(th) * Float64(sin(ky) / Float64(sin(ky) + Float64(0.5 * Float64(Float64(kx * kx) / sin(ky)))))); else tmp = Float64(sin(ky) * Float64(sin(th) / hypot(sin(ky), sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 1.05e-80) tmp = sin(th) * (sin(ky) / (sin(ky) + (0.5 * ((kx * kx) / sin(ky))))); else tmp = sin(ky) * (sin(th) / hypot(sin(ky), sin(kx))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 1.05e-80], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[(N[Sin[ky], $MachinePrecision] + N[(0.5 * N[(N[(kx * kx), $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 1.05 \cdot 10^{-80}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin ky + 0.5 \cdot \frac{kx \cdot kx}{\sin ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\end{array}
\end{array}
if kx < 1.05000000000000001e-80Initial program 56.0%
Taylor expanded in kx around 0 45.4%
unpow245.4%
Simplified45.4%
if 1.05000000000000001e-80 < kx Initial program 61.5%
associate-*l/61.5%
+-commutative61.5%
unpow261.5%
unpow261.5%
hypot-def61.5%
Simplified61.5%
associate-/l*61.4%
div-inv61.4%
clear-num61.5%
Applied egg-rr61.5%
Final simplification50.0%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (* (sin th) (/ (sin ky) (fabs (sin kx))))))
(if (<= ky -0.029)
(fabs (sin th))
(if (<= ky -1.85e-79)
t_1
(if (<= ky -3e-274)
(* (sin ky) (/ (sin th) (sin kx)))
(if (<= ky 3.8e-162)
t_1
(if (<= ky 1.8e-87)
(/ ky (/ (hypot (sin ky) kx) (sin th)))
(if (<= ky 1.76e-16) t_1 (sin th)))))))))
double code(double kx, double ky, double th) {
double t_1 = sin(th) * (sin(ky) / fabs(sin(kx)));
double tmp;
if (ky <= -0.029) {
tmp = fabs(sin(th));
} else if (ky <= -1.85e-79) {
tmp = t_1;
} else if (ky <= -3e-274) {
tmp = sin(ky) * (sin(th) / sin(kx));
} else if (ky <= 3.8e-162) {
tmp = t_1;
} else if (ky <= 1.8e-87) {
tmp = ky / (hypot(sin(ky), kx) / sin(th));
} else if (ky <= 1.76e-16) {
tmp = t_1;
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(th) * (Math.sin(ky) / Math.abs(Math.sin(kx)));
double tmp;
if (ky <= -0.029) {
tmp = Math.abs(Math.sin(th));
} else if (ky <= -1.85e-79) {
tmp = t_1;
} else if (ky <= -3e-274) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
} else if (ky <= 3.8e-162) {
tmp = t_1;
} else if (ky <= 1.8e-87) {
tmp = ky / (Math.hypot(Math.sin(ky), kx) / Math.sin(th));
} else if (ky <= 1.76e-16) {
tmp = t_1;
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.sin(th) * (math.sin(ky) / math.fabs(math.sin(kx))) tmp = 0 if ky <= -0.029: tmp = math.fabs(math.sin(th)) elif ky <= -1.85e-79: tmp = t_1 elif ky <= -3e-274: tmp = math.sin(ky) * (math.sin(th) / math.sin(kx)) elif ky <= 3.8e-162: tmp = t_1 elif ky <= 1.8e-87: tmp = ky / (math.hypot(math.sin(ky), kx) / math.sin(th)) elif ky <= 1.76e-16: tmp = t_1 else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = Float64(sin(th) * Float64(sin(ky) / abs(sin(kx)))) tmp = 0.0 if (ky <= -0.029) tmp = abs(sin(th)); elseif (ky <= -1.85e-79) tmp = t_1; elseif (ky <= -3e-274) tmp = Float64(sin(ky) * Float64(sin(th) / sin(kx))); elseif (ky <= 3.8e-162) tmp = t_1; elseif (ky <= 1.8e-87) tmp = Float64(ky / Float64(hypot(sin(ky), kx) / sin(th))); elseif (ky <= 1.76e-16) tmp = t_1; else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = sin(th) * (sin(ky) / abs(sin(kx))); tmp = 0.0; if (ky <= -0.029) tmp = abs(sin(th)); elseif (ky <= -1.85e-79) tmp = t_1; elseif (ky <= -3e-274) tmp = sin(ky) * (sin(th) / sin(kx)); elseif (ky <= 3.8e-162) tmp = t_1; elseif (ky <= 1.8e-87) tmp = ky / (hypot(sin(ky), kx) / sin(th)); elseif (ky <= 1.76e-16) 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[(N[Sin[ky], $MachinePrecision] / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[ky, -0.029], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[ky, -1.85e-79], t$95$1, If[LessEqual[ky, -3e-274], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[ky, 3.8e-162], t$95$1, If[LessEqual[ky, 1.8e-87], N[(ky / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[ky, 1.76e-16], t$95$1, N[Sin[th], $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sin th \cdot \frac{\sin ky}{\left|\sin kx\right|}\\
\mathbf{if}\;ky \leq -0.029:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;ky \leq -1.85 \cdot 10^{-79}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;ky \leq -3 \cdot 10^{-274}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{elif}\;ky \leq 3.8 \cdot 10^{-162}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;ky \leq 1.8 \cdot 10^{-87}:\\
\;\;\;\;\frac{ky}{\frac{\mathsf{hypot}\left(\sin ky, kx\right)}{\sin th}}\\
\mathbf{elif}\;ky \leq 1.76 \cdot 10^{-16}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -0.0290000000000000015Initial program 50.2%
associate-*l/50.2%
+-commutative50.2%
unpow250.2%
unpow250.2%
hypot-def50.2%
Simplified50.2%
add-sqr-sqrt25.9%
sqrt-unprod33.3%
pow233.3%
Applied egg-rr33.3%
unpow233.3%
rem-sqrt-square50.2%
Simplified50.2%
Taylor expanded in kx around 0 56.7%
if -0.0290000000000000015 < ky < -1.85000000000000009e-79 or -2.99999999999999977e-274 < ky < 3.80000000000000005e-162 or 1.79999999999999996e-87 < ky < 1.76e-16Initial program 78.3%
Taylor expanded in ky around 0 48.2%
add-sqr-sqrt26.8%
sqrt-prod65.5%
rem-sqrt-square69.2%
Applied egg-rr69.2%
if -1.85000000000000009e-79 < ky < -2.99999999999999977e-274Initial program 58.9%
associate-*l/58.9%
+-commutative58.9%
unpow258.9%
unpow258.9%
hypot-def63.2%
Simplified63.2%
associate-/l*63.3%
div-inv63.2%
clear-num63.4%
Applied egg-rr63.4%
Taylor expanded in ky around 0 61.8%
if 3.80000000000000005e-162 < ky < 1.79999999999999996e-87Initial program 80.1%
associate-/r/80.0%
+-commutative80.0%
unpow280.0%
sqr-neg80.0%
sin-neg80.0%
sin-neg80.0%
unpow280.0%
+-commutative80.0%
Simplified80.1%
Taylor expanded in kx around 0 70.9%
Taylor expanded in ky around 0 70.9%
if 1.76e-16 < ky Initial program 46.1%
+-commutative46.1%
unpow246.1%
unpow246.1%
hypot-def46.1%
Simplified46.1%
Taylor expanded in kx around 0 53.5%
Final simplification59.8%
(FPCore (kx ky th)
:precision binary64
(if (<= ky -2.1)
(fabs (sin th))
(if (<= ky 21000000.0)
(* (sin ky) (/ (sin th) (hypot ky (sin kx))))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -2.1) {
tmp = fabs(sin(th));
} else if (ky <= 21000000.0) {
tmp = sin(ky) * (sin(th) / hypot(ky, sin(kx)));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= -2.1) {
tmp = Math.abs(Math.sin(th));
} else if (ky <= 21000000.0) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.hypot(ky, Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -2.1: tmp = math.fabs(math.sin(th)) elif ky <= 21000000.0: tmp = math.sin(ky) * (math.sin(th) / math.hypot(ky, math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -2.1) tmp = abs(sin(th)); elseif (ky <= 21000000.0) tmp = Float64(sin(ky) * Float64(sin(th) / hypot(ky, sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -2.1) tmp = abs(sin(th)); elseif (ky <= 21000000.0) tmp = sin(ky) * (sin(th) / hypot(ky, sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -2.1], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[ky, 21000000.0], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -2.1:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;ky \leq 21000000:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -2.10000000000000009Initial program 50.2%
associate-*l/50.2%
+-commutative50.2%
unpow250.2%
unpow250.2%
hypot-def50.2%
Simplified50.2%
add-sqr-sqrt25.9%
sqrt-unprod33.3%
pow233.3%
Applied egg-rr33.3%
unpow233.3%
rem-sqrt-square50.2%
Simplified50.2%
Taylor expanded in kx around 0 56.7%
if -2.10000000000000009 < ky < 2.1e7Initial program 71.3%
associate-*l/68.9%
+-commutative68.9%
unpow268.9%
unpow268.9%
hypot-def70.8%
Simplified70.8%
associate-/l*74.8%
div-inv74.7%
clear-num74.8%
Applied egg-rr74.8%
Taylor expanded in ky around 0 73.0%
if 2.1e7 < ky Initial program 44.1%
+-commutative44.1%
unpow244.1%
unpow244.1%
hypot-def44.1%
Simplified44.1%
Taylor expanded in kx around 0 54.1%
Final simplification63.1%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (fabs (sin th))))
(if (<= ky -0.25)
t_1
(if (<= ky -4e-70)
(/ ky (/ (sin kx) t_1))
(if (<= ky -7e-74)
(fabs th)
(if (<= ky 6.6e-155) (* (sin ky) (/ (sin th) (sin kx))) (sin th)))))))
double code(double kx, double ky, double th) {
double t_1 = fabs(sin(th));
double tmp;
if (ky <= -0.25) {
tmp = t_1;
} else if (ky <= -4e-70) {
tmp = ky / (sin(kx) / t_1);
} else if (ky <= -7e-74) {
tmp = fabs(th);
} else if (ky <= 6.6e-155) {
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) :: t_1
real(8) :: tmp
t_1 = abs(sin(th))
if (ky <= (-0.25d0)) then
tmp = t_1
else if (ky <= (-4d-70)) then
tmp = ky / (sin(kx) / t_1)
else if (ky <= (-7d-74)) then
tmp = abs(th)
else if (ky <= 6.6d-155) 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 t_1 = Math.abs(Math.sin(th));
double tmp;
if (ky <= -0.25) {
tmp = t_1;
} else if (ky <= -4e-70) {
tmp = ky / (Math.sin(kx) / t_1);
} else if (ky <= -7e-74) {
tmp = Math.abs(th);
} else if (ky <= 6.6e-155) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.fabs(math.sin(th)) tmp = 0 if ky <= -0.25: tmp = t_1 elif ky <= -4e-70: tmp = ky / (math.sin(kx) / t_1) elif ky <= -7e-74: tmp = math.fabs(th) elif ky <= 6.6e-155: tmp = math.sin(ky) * (math.sin(th) / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = abs(sin(th)) tmp = 0.0 if (ky <= -0.25) tmp = t_1; elseif (ky <= -4e-70) tmp = Float64(ky / Float64(sin(kx) / t_1)); elseif (ky <= -7e-74) tmp = abs(th); elseif (ky <= 6.6e-155) tmp = Float64(sin(ky) * Float64(sin(th) / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = abs(sin(th)); tmp = 0.0; if (ky <= -0.25) tmp = t_1; elseif (ky <= -4e-70) tmp = ky / (sin(kx) / t_1); elseif (ky <= -7e-74) tmp = abs(th); elseif (ky <= 6.6e-155) tmp = sin(ky) * (sin(th) / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[ky, -0.25], t$95$1, If[LessEqual[ky, -4e-70], N[(ky / N[(N[Sin[kx], $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[ky, -7e-74], N[Abs[th], $MachinePrecision], If[LessEqual[ky, 6.6e-155], 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}
t_1 := \left|\sin th\right|\\
\mathbf{if}\;ky \leq -0.25:\\
\;\;\;\;t_1\\
\mathbf{elif}\;ky \leq -4 \cdot 10^{-70}:\\
\;\;\;\;\frac{ky}{\frac{\sin kx}{t_1}}\\
\mathbf{elif}\;ky \leq -7 \cdot 10^{-74}:\\
\;\;\;\;\left|th\right|\\
\mathbf{elif}\;ky \leq 6.6 \cdot 10^{-155}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -0.25Initial program 50.2%
associate-*l/50.2%
+-commutative50.2%
unpow250.2%
unpow250.2%
hypot-def50.2%
Simplified50.2%
add-sqr-sqrt25.9%
sqrt-unprod33.3%
pow233.3%
Applied egg-rr33.3%
unpow233.3%
rem-sqrt-square50.2%
Simplified50.2%
Taylor expanded in kx around 0 56.7%
if -0.25 < ky < -3.99999999999999998e-70Initial program 83.3%
associate-*l/82.9%
+-commutative82.9%
unpow282.9%
unpow282.9%
hypot-def82.9%
Simplified82.9%
add-sqr-sqrt74.2%
sqrt-unprod91.7%
pow291.7%
Applied egg-rr91.7%
unpow291.7%
rem-sqrt-square91.6%
Simplified91.6%
Taylor expanded in ky around 0 18.8%
associate-/l*18.9%
Simplified18.9%
if -3.99999999999999998e-70 < ky < -7.00000000000000029e-74Initial program 100.0%
associate-*l/78.0%
+-commutative78.0%
unpow278.0%
unpow278.0%
hypot-def78.0%
Simplified78.0%
add-sqr-sqrt24.6%
sqrt-unprod31.0%
pow231.0%
Applied egg-rr31.0%
unpow231.0%
rem-sqrt-square30.2%
Simplified30.2%
Taylor expanded in th around 0 30.2%
Taylor expanded in kx around 0 75.8%
if -7.00000000000000029e-74 < ky < 6.59999999999999972e-155Initial program 65.1%
associate-*l/65.1%
+-commutative65.1%
unpow265.1%
unpow265.1%
hypot-def68.0%
Simplified68.0%
associate-/l*70.6%
div-inv70.5%
clear-num70.6%
Applied egg-rr70.6%
Taylor expanded in ky around 0 60.7%
if 6.59999999999999972e-155 < ky Initial program 52.2%
+-commutative52.2%
unpow252.2%
unpow252.2%
hypot-def52.2%
Simplified52.2%
Taylor expanded in kx around 0 50.4%
Final simplification53.8%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (fabs (sin th))))
(if (<= ky -0.03)
t_1
(if (<= ky -3.7e-66)
(/ ky (/ (sin kx) t_1))
(if (<= ky -6e-74)
(* th (/ (sin ky) (hypot (sin ky) kx)))
(if (<= ky 7.5e-155) (* (sin ky) (/ (sin th) (sin kx))) (sin th)))))))
double code(double kx, double ky, double th) {
double t_1 = fabs(sin(th));
double tmp;
if (ky <= -0.03) {
tmp = t_1;
} else if (ky <= -3.7e-66) {
tmp = ky / (sin(kx) / t_1);
} else if (ky <= -6e-74) {
tmp = th * (sin(ky) / hypot(sin(ky), kx));
} else if (ky <= 7.5e-155) {
tmp = sin(ky) * (sin(th) / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.abs(Math.sin(th));
double tmp;
if (ky <= -0.03) {
tmp = t_1;
} else if (ky <= -3.7e-66) {
tmp = ky / (Math.sin(kx) / t_1);
} else if (ky <= -6e-74) {
tmp = th * (Math.sin(ky) / Math.hypot(Math.sin(ky), kx));
} else if (ky <= 7.5e-155) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.fabs(math.sin(th)) tmp = 0 if ky <= -0.03: tmp = t_1 elif ky <= -3.7e-66: tmp = ky / (math.sin(kx) / t_1) elif ky <= -6e-74: tmp = th * (math.sin(ky) / math.hypot(math.sin(ky), kx)) elif ky <= 7.5e-155: tmp = math.sin(ky) * (math.sin(th) / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = abs(sin(th)) tmp = 0.0 if (ky <= -0.03) tmp = t_1; elseif (ky <= -3.7e-66) tmp = Float64(ky / Float64(sin(kx) / t_1)); elseif (ky <= -6e-74) tmp = Float64(th * Float64(sin(ky) / hypot(sin(ky), kx))); elseif (ky <= 7.5e-155) tmp = Float64(sin(ky) * Float64(sin(th) / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = abs(sin(th)); tmp = 0.0; if (ky <= -0.03) tmp = t_1; elseif (ky <= -3.7e-66) tmp = ky / (sin(kx) / t_1); elseif (ky <= -6e-74) tmp = th * (sin(ky) / hypot(sin(ky), kx)); elseif (ky <= 7.5e-155) tmp = sin(ky) * (sin(th) / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[ky, -0.03], t$95$1, If[LessEqual[ky, -3.7e-66], N[(ky / N[(N[Sin[kx], $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[ky, -6e-74], N[(th * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[ky, 7.5e-155], 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}
t_1 := \left|\sin th\right|\\
\mathbf{if}\;ky \leq -0.03:\\
\;\;\;\;t_1\\
\mathbf{elif}\;ky \leq -3.7 \cdot 10^{-66}:\\
\;\;\;\;\frac{ky}{\frac{\sin kx}{t_1}}\\
\mathbf{elif}\;ky \leq -6 \cdot 10^{-74}:\\
\;\;\;\;th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, kx\right)}\\
\mathbf{elif}\;ky \leq 7.5 \cdot 10^{-155}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -0.029999999999999999Initial program 50.2%
associate-*l/50.2%
+-commutative50.2%
unpow250.2%
unpow250.2%
hypot-def50.2%
Simplified50.2%
add-sqr-sqrt25.9%
sqrt-unprod33.3%
pow233.3%
Applied egg-rr33.3%
unpow233.3%
rem-sqrt-square50.2%
Simplified50.2%
Taylor expanded in kx around 0 56.7%
if -0.029999999999999999 < ky < -3.7000000000000002e-66Initial program 83.3%
associate-*l/82.9%
+-commutative82.9%
unpow282.9%
unpow282.9%
hypot-def82.9%
Simplified82.9%
add-sqr-sqrt74.2%
sqrt-unprod91.7%
pow291.7%
Applied egg-rr91.7%
unpow291.7%
rem-sqrt-square91.6%
Simplified91.6%
Taylor expanded in ky around 0 18.8%
associate-/l*18.9%
Simplified18.9%
if -3.7000000000000002e-66 < ky < -6.00000000000000014e-74Initial program 100.0%
associate-/r/98.8%
+-commutative98.8%
unpow298.8%
sqr-neg98.8%
sin-neg98.8%
sin-neg98.8%
unpow298.8%
+-commutative98.8%
Simplified98.8%
Taylor expanded in kx around 0 75.6%
Taylor expanded in th around 0 75.6%
associate-*l/75.6%
+-commutative75.6%
unpow275.6%
unpow275.6%
hypot-def75.6%
*-lft-identity75.6%
Simplified75.6%
associate-/r/76.3%
Applied egg-rr76.3%
if -6.00000000000000014e-74 < ky < 7.5000000000000006e-155Initial program 65.1%
associate-*l/65.1%
+-commutative65.1%
unpow265.1%
unpow265.1%
hypot-def68.0%
Simplified68.0%
associate-/l*70.6%
div-inv70.5%
clear-num70.6%
Applied egg-rr70.6%
Taylor expanded in ky around 0 60.7%
if 7.5000000000000006e-155 < ky Initial program 52.2%
+-commutative52.2%
unpow252.2%
unpow252.2%
hypot-def52.2%
Simplified52.2%
Taylor expanded in kx around 0 50.4%
Final simplification53.8%
(FPCore (kx ky th) :precision binary64 (if (<= ky -5.5e-5) (fabs (sin th)) (if (<= ky 7.5e-155) (* (sin ky) (/ (sin th) (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -5.5e-5) {
tmp = fabs(sin(th));
} else if (ky <= 7.5e-155) {
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 (ky <= (-5.5d-5)) then
tmp = abs(sin(th))
else if (ky <= 7.5d-155) 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 (ky <= -5.5e-5) {
tmp = Math.abs(Math.sin(th));
} else if (ky <= 7.5e-155) {
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 ky <= -5.5e-5: tmp = math.fabs(math.sin(th)) elif ky <= 7.5e-155: 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 (ky <= -5.5e-5) tmp = abs(sin(th)); elseif (ky <= 7.5e-155) 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 (ky <= -5.5e-5) tmp = abs(sin(th)); elseif (ky <= 7.5e-155) tmp = sin(ky) * (sin(th) / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -5.5e-5], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[ky, 7.5e-155], 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}\;ky \leq -5.5 \cdot 10^{-5}:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;ky \leq 7.5 \cdot 10^{-155}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -5.5000000000000002e-5Initial program 51.7%
associate-*l/51.8%
+-commutative51.8%
unpow251.8%
unpow251.8%
hypot-def51.8%
Simplified51.8%
add-sqr-sqrt26.6%
sqrt-unprod34.0%
pow234.0%
Applied egg-rr34.0%
unpow234.0%
rem-sqrt-square50.3%
Simplified50.3%
Taylor expanded in kx around 0 55.1%
if -5.5000000000000002e-5 < ky < 7.5000000000000006e-155Initial program 68.5%
associate-*l/67.4%
+-commutative67.4%
unpow267.4%
unpow267.4%
hypot-def69.8%
Simplified69.8%
associate-/l*73.0%
div-inv72.9%
clear-num73.0%
Applied egg-rr73.0%
Taylor expanded in ky around 0 54.7%
if 7.5000000000000006e-155 < ky Initial program 52.2%
+-commutative52.2%
unpow252.2%
unpow252.2%
hypot-def52.2%
Simplified52.2%
Taylor expanded in kx around 0 50.4%
Final simplification53.0%
(FPCore (kx ky th) :precision binary64 (if (<= ky -8e-5) (fabs (sin th)) (if (<= ky 7.5e-155) (* (sin th) (/ ky (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -8e-5) {
tmp = fabs(sin(th));
} else if (ky <= 7.5e-155) {
tmp = sin(th) * (ky / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= (-8d-5)) then
tmp = abs(sin(th))
else if (ky <= 7.5d-155) then
tmp = sin(th) * (ky / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= -8e-5) {
tmp = Math.abs(Math.sin(th));
} else if (ky <= 7.5e-155) {
tmp = Math.sin(th) * (ky / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -8e-5: tmp = math.fabs(math.sin(th)) elif ky <= 7.5e-155: tmp = math.sin(th) * (ky / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -8e-5) tmp = abs(sin(th)); elseif (ky <= 7.5e-155) tmp = Float64(sin(th) * Float64(ky / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -8e-5) tmp = abs(sin(th)); elseif (ky <= 7.5e-155) tmp = sin(th) * (ky / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -8e-5], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[ky, 7.5e-155], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -8 \cdot 10^{-5}:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;ky \leq 7.5 \cdot 10^{-155}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -8.00000000000000065e-5Initial program 51.7%
associate-*l/51.8%
+-commutative51.8%
unpow251.8%
unpow251.8%
hypot-def51.8%
Simplified51.8%
add-sqr-sqrt26.6%
sqrt-unprod34.0%
pow234.0%
Applied egg-rr34.0%
unpow234.0%
rem-sqrt-square50.3%
Simplified50.3%
Taylor expanded in kx around 0 55.1%
if -8.00000000000000065e-5 < ky < 7.5000000000000006e-155Initial program 68.5%
Taylor expanded in ky around 0 54.6%
Taylor expanded in ky around 0 54.6%
if 7.5000000000000006e-155 < ky Initial program 52.2%
+-commutative52.2%
unpow252.2%
unpow252.2%
hypot-def52.2%
Simplified52.2%
Taylor expanded in kx around 0 50.4%
Final simplification53.0%
(FPCore (kx ky th) :precision binary64 (if (<= ky -8e-5) (fabs (sin th)) (if (<= ky 7.5e-155) (/ ky (/ (sin kx) (sin th))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -8e-5) {
tmp = fabs(sin(th));
} else if (ky <= 7.5e-155) {
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 (ky <= (-8d-5)) then
tmp = abs(sin(th))
else if (ky <= 7.5d-155) 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 (ky <= -8e-5) {
tmp = Math.abs(Math.sin(th));
} else if (ky <= 7.5e-155) {
tmp = ky / (Math.sin(kx) / Math.sin(th));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -8e-5: tmp = math.fabs(math.sin(th)) elif ky <= 7.5e-155: tmp = ky / (math.sin(kx) / math.sin(th)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -8e-5) tmp = abs(sin(th)); elseif (ky <= 7.5e-155) 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 (ky <= -8e-5) tmp = abs(sin(th)); elseif (ky <= 7.5e-155) tmp = ky / (sin(kx) / sin(th)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -8e-5], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[ky, 7.5e-155], 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}\;ky \leq -8 \cdot 10^{-5}:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;ky \leq 7.5 \cdot 10^{-155}:\\
\;\;\;\;\frac{ky}{\frac{\sin kx}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -8.00000000000000065e-5Initial program 51.7%
associate-*l/51.8%
+-commutative51.8%
unpow251.8%
unpow251.8%
hypot-def51.8%
Simplified51.8%
add-sqr-sqrt26.6%
sqrt-unprod34.0%
pow234.0%
Applied egg-rr34.0%
unpow234.0%
rem-sqrt-square50.3%
Simplified50.3%
Taylor expanded in kx around 0 55.1%
if -8.00000000000000065e-5 < ky < 7.5000000000000006e-155Initial program 68.5%
+-commutative68.5%
unpow268.5%
unpow268.5%
hypot-def73.0%
Simplified73.0%
Taylor expanded in ky around 0 53.6%
associate-/l*54.6%
Simplified54.6%
if 7.5000000000000006e-155 < ky Initial program 52.2%
+-commutative52.2%
unpow252.2%
unpow252.2%
hypot-def52.2%
Simplified52.2%
Taylor expanded in kx around 0 50.4%
Final simplification53.0%
(FPCore (kx ky th) :precision binary64 (if (<= ky -5.7e-5) (fabs (sin th)) (if (<= ky 2.5e-176) (* ky (/ th (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -5.7e-5) {
tmp = fabs(sin(th));
} else if (ky <= 2.5e-176) {
tmp = ky * (th / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= (-5.7d-5)) then
tmp = abs(sin(th))
else if (ky <= 2.5d-176) then
tmp = ky * (th / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= -5.7e-5) {
tmp = Math.abs(Math.sin(th));
} else if (ky <= 2.5e-176) {
tmp = ky * (th / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -5.7e-5: tmp = math.fabs(math.sin(th)) elif ky <= 2.5e-176: tmp = ky * (th / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -5.7e-5) tmp = abs(sin(th)); elseif (ky <= 2.5e-176) tmp = Float64(ky * Float64(th / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -5.7e-5) tmp = abs(sin(th)); elseif (ky <= 2.5e-176) tmp = ky * (th / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -5.7e-5], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[ky, 2.5e-176], N[(ky * N[(th / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -5.7 \cdot 10^{-5}:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;ky \leq 2.5 \cdot 10^{-176}:\\
\;\;\;\;ky \cdot \frac{th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -5.7000000000000003e-5Initial program 51.7%
associate-*l/51.8%
+-commutative51.8%
unpow251.8%
unpow251.8%
hypot-def51.8%
Simplified51.8%
add-sqr-sqrt26.6%
sqrt-unprod34.0%
pow234.0%
Applied egg-rr34.0%
unpow234.0%
rem-sqrt-square50.3%
Simplified50.3%
Taylor expanded in kx around 0 55.1%
if -5.7000000000000003e-5 < ky < 2.5e-176Initial program 68.5%
associate-*l/67.4%
+-commutative67.4%
unpow267.4%
unpow267.4%
hypot-def69.9%
Simplified69.9%
add-sqr-sqrt50.7%
sqrt-unprod85.4%
pow285.4%
Applied egg-rr85.4%
unpow285.4%
rem-sqrt-square85.3%
Simplified85.3%
Taylor expanded in th around 0 33.4%
Taylor expanded in ky around 0 26.0%
associate-/l*26.9%
Simplified26.9%
clear-num26.9%
associate-/r/26.9%
clear-num26.9%
remove-double-div26.9%
add-sqr-sqrt15.6%
fabs-sqr15.6%
add-sqr-sqrt29.9%
Applied egg-rr29.9%
if 2.5e-176 < ky Initial program 52.6%
+-commutative52.6%
unpow252.6%
unpow252.6%
hypot-def52.6%
Simplified52.6%
Taylor expanded in kx around 0 49.0%
Final simplification44.3%
(FPCore (kx ky th) :precision binary64 (if (<= ky -1.14e-41) (sin th) (if (<= ky 2.6e-176) (* ky (/ th (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -1.14e-41) {
tmp = sin(th);
} else if (ky <= 2.6e-176) {
tmp = ky * (th / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= (-1.14d-41)) then
tmp = sin(th)
else if (ky <= 2.6d-176) then
tmp = ky * (th / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= -1.14e-41) {
tmp = Math.sin(th);
} else if (ky <= 2.6e-176) {
tmp = ky * (th / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -1.14e-41: tmp = math.sin(th) elif ky <= 2.6e-176: tmp = ky * (th / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -1.14e-41) tmp = sin(th); elseif (ky <= 2.6e-176) tmp = Float64(ky * Float64(th / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -1.14e-41) tmp = sin(th); elseif (ky <= 2.6e-176) tmp = ky * (th / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -1.14e-41], N[Sin[th], $MachinePrecision], If[LessEqual[ky, 2.6e-176], N[(ky * N[(th / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -1.14 \cdot 10^{-41}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 2.6 \cdot 10^{-176}:\\
\;\;\;\;ky \cdot \frac{th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -1.14e-41 or 2.59999999999999992e-176 < ky Initial program 52.5%
+-commutative52.5%
unpow252.5%
unpow252.5%
hypot-def52.5%
Simplified52.5%
Taylor expanded in kx around 0 48.1%
if -1.14e-41 < ky < 2.59999999999999992e-176Initial program 69.0%
associate-*l/67.9%
+-commutative67.9%
unpow267.9%
unpow267.9%
hypot-def70.6%
Simplified70.6%
add-sqr-sqrt50.2%
sqrt-unprod84.5%
pow284.5%
Applied egg-rr84.5%
unpow284.5%
rem-sqrt-square84.4%
Simplified84.4%
Taylor expanded in th around 0 35.2%
Taylor expanded in ky around 0 27.5%
associate-/l*28.5%
Simplified28.5%
clear-num28.5%
associate-/r/28.5%
clear-num28.5%
remove-double-div28.5%
add-sqr-sqrt16.6%
fabs-sqr16.6%
add-sqr-sqrt31.7%
Applied egg-rr31.7%
Final simplification43.0%
(FPCore (kx ky th)
:precision binary64
(if (<= ky -1.15e-36)
(sin th)
(if (<= ky 2.95e-157)
(/ ky (+ (* 0.16666666666666666 (* th kx)) (/ kx th)))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -1.15e-36) {
tmp = sin(th);
} else if (ky <= 2.95e-157) {
tmp = ky / ((0.16666666666666666 * (th * kx)) + (kx / 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 (ky <= (-1.15d-36)) then
tmp = sin(th)
else if (ky <= 2.95d-157) then
tmp = ky / ((0.16666666666666666d0 * (th * kx)) + (kx / th))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= -1.15e-36) {
tmp = Math.sin(th);
} else if (ky <= 2.95e-157) {
tmp = ky / ((0.16666666666666666 * (th * kx)) + (kx / th));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -1.15e-36: tmp = math.sin(th) elif ky <= 2.95e-157: tmp = ky / ((0.16666666666666666 * (th * kx)) + (kx / th)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -1.15e-36) tmp = sin(th); elseif (ky <= 2.95e-157) tmp = Float64(ky / Float64(Float64(0.16666666666666666 * Float64(th * kx)) + Float64(kx / th))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -1.15e-36) tmp = sin(th); elseif (ky <= 2.95e-157) tmp = ky / ((0.16666666666666666 * (th * kx)) + (kx / th)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -1.15e-36], N[Sin[th], $MachinePrecision], If[LessEqual[ky, 2.95e-157], N[(ky / N[(N[(0.16666666666666666 * N[(th * kx), $MachinePrecision]), $MachinePrecision] + N[(kx / th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -1.15 \cdot 10^{-36}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 2.95 \cdot 10^{-157}:\\
\;\;\;\;\frac{ky}{0.16666666666666666 \cdot \left(th \cdot kx\right) + \frac{kx}{th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -1.14999999999999998e-36 or 2.9500000000000001e-157 < ky Initial program 52.0%
+-commutative52.0%
unpow252.0%
unpow252.0%
hypot-def52.0%
Simplified52.0%
Taylor expanded in kx around 0 49.2%
if -1.14999999999999998e-36 < ky < 2.9500000000000001e-157Initial program 69.3%
associate-/r/69.3%
+-commutative69.3%
unpow269.3%
sqr-neg69.3%
sin-neg69.3%
sin-neg69.3%
unpow269.3%
+-commutative69.3%
Simplified74.1%
Taylor expanded in kx around 0 45.1%
Taylor expanded in ky around 0 28.7%
associate-/l*29.6%
Simplified29.6%
Taylor expanded in th around 0 25.8%
Final simplification41.6%
(FPCore (kx ky th)
:precision binary64
(if (<= ky -0.82)
th
(if (<= ky 7.5e-155)
(/ ky (+ (* 0.16666666666666666 (* th kx)) (/ kx th)))
th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -0.82) {
tmp = th;
} else if (ky <= 7.5e-155) {
tmp = ky / ((0.16666666666666666 * (th * kx)) + (kx / th));
} else {
tmp = th;
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= (-0.82d0)) then
tmp = th
else if (ky <= 7.5d-155) then
tmp = ky / ((0.16666666666666666d0 * (th * kx)) + (kx / th))
else
tmp = th
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= -0.82) {
tmp = th;
} else if (ky <= 7.5e-155) {
tmp = ky / ((0.16666666666666666 * (th * kx)) + (kx / th));
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -0.82: tmp = th elif ky <= 7.5e-155: tmp = ky / ((0.16666666666666666 * (th * kx)) + (kx / th)) else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -0.82) tmp = th; elseif (ky <= 7.5e-155) tmp = Float64(ky / Float64(Float64(0.16666666666666666 * Float64(th * kx)) + Float64(kx / th))); else tmp = th; end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -0.82) tmp = th; elseif (ky <= 7.5e-155) tmp = ky / ((0.16666666666666666 * (th * kx)) + (kx / th)); else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -0.82], th, If[LessEqual[ky, 7.5e-155], N[(ky / N[(N[(0.16666666666666666 * N[(th * kx), $MachinePrecision]), $MachinePrecision] + N[(kx / th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], th]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -0.82:\\
\;\;\;\;th\\
\mathbf{elif}\;ky \leq 7.5 \cdot 10^{-155}:\\
\;\;\;\;\frac{ky}{0.16666666666666666 \cdot \left(th \cdot kx\right) + \frac{kx}{th}}\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if ky < -0.819999999999999951 or 7.5000000000000006e-155 < ky Initial program 51.5%
+-commutative51.5%
unpow251.5%
unpow251.5%
hypot-def51.5%
Simplified51.5%
Taylor expanded in kx around 0 50.2%
Taylor expanded in th around 0 35.7%
if -0.819999999999999951 < ky < 7.5000000000000006e-155Initial program 69.2%
associate-/r/69.2%
+-commutative69.2%
unpow269.2%
sqr-neg69.2%
sin-neg69.2%
sin-neg69.2%
unpow269.2%
+-commutative69.2%
Simplified73.6%
Taylor expanded in kx around 0 44.6%
Taylor expanded in ky around 0 26.9%
associate-/l*27.8%
Simplified27.8%
Taylor expanded in th around 0 24.3%
Final simplification31.7%
(FPCore (kx ky th) :precision binary64 (if (<= ky -5.5e-28) th (if (<= ky 7.3e-155) (* th (/ ky kx)) th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -5.5e-28) {
tmp = th;
} else if (ky <= 7.3e-155) {
tmp = th * (ky / kx);
} else {
tmp = th;
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= (-5.5d-28)) then
tmp = th
else if (ky <= 7.3d-155) then
tmp = th * (ky / kx)
else
tmp = th
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= -5.5e-28) {
tmp = th;
} else if (ky <= 7.3e-155) {
tmp = th * (ky / kx);
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -5.5e-28: tmp = th elif ky <= 7.3e-155: tmp = th * (ky / kx) else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -5.5e-28) tmp = th; elseif (ky <= 7.3e-155) tmp = Float64(th * Float64(ky / kx)); else tmp = th; end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -5.5e-28) tmp = th; elseif (ky <= 7.3e-155) tmp = th * (ky / kx); else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -5.5e-28], th, If[LessEqual[ky, 7.3e-155], N[(th * N[(ky / kx), $MachinePrecision]), $MachinePrecision], th]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -5.5 \cdot 10^{-28}:\\
\;\;\;\;th\\
\mathbf{elif}\;ky \leq 7.3 \cdot 10^{-155}:\\
\;\;\;\;th \cdot \frac{ky}{kx}\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if ky < -5.49999999999999967e-28 or 7.30000000000000033e-155 < ky Initial program 52.0%
+-commutative52.0%
unpow252.0%
unpow252.0%
hypot-def52.0%
Simplified52.0%
Taylor expanded in kx around 0 49.2%
Taylor expanded in th around 0 34.6%
if -5.49999999999999967e-28 < ky < 7.30000000000000033e-155Initial program 69.3%
associate-/r/69.3%
+-commutative69.3%
unpow269.3%
sqr-neg69.3%
sin-neg69.3%
sin-neg69.3%
unpow269.3%
+-commutative69.3%
Simplified74.1%
Taylor expanded in kx around 0 45.1%
Taylor expanded in ky around 0 28.7%
associate-/l*29.6%
Simplified29.6%
Taylor expanded in th around 0 24.6%
associate-/l*25.6%
Simplified25.6%
associate-/r/25.5%
Applied egg-rr25.5%
Final simplification31.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 57.6%
+-commutative57.6%
unpow257.6%
unpow257.6%
hypot-def59.2%
Simplified59.2%
Taylor expanded in kx around 0 34.6%
Taylor expanded in th around 0 24.5%
Final simplification24.5%
herbie shell --seed 2023292
(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)))