
(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 ky) (hypot (sin ky) (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / hypot(sin(ky), sin(kx))) * sin(th);
}
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot \sin th
\end{array}
Initial program 92.5%
+-commutative92.5%
unpow292.5%
unpow292.5%
hypot-undefine99.6%
Applied egg-rr99.6%
Final simplification99.6%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.05)
(fabs (* ky (/ (sin th) (sin kx))))
(if (<= (sin kx) 5e-29)
(* (sin ky) (/ (sin th) (fabs (sin ky))))
(* (sin th) (/ (sin ky) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.05) {
tmp = fabs((ky * (sin(th) / sin(kx))));
} else if (sin(kx) <= 5e-29) {
tmp = sin(ky) * (sin(th) / fabs(sin(ky)));
} else {
tmp = sin(th) * (sin(ky) / sin(kx));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(kx) <= (-0.05d0)) then
tmp = abs((ky * (sin(th) / sin(kx))))
else if (sin(kx) <= 5d-29) then
tmp = sin(ky) * (sin(th) / abs(sin(ky)))
else
tmp = sin(th) * (sin(ky) / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.05) {
tmp = Math.abs((ky * (Math.sin(th) / Math.sin(kx))));
} else if (Math.sin(kx) <= 5e-29) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.abs(Math.sin(ky)));
} else {
tmp = Math.sin(th) * (Math.sin(ky) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.05: tmp = math.fabs((ky * (math.sin(th) / math.sin(kx)))) elif math.sin(kx) <= 5e-29: tmp = math.sin(ky) * (math.sin(th) / math.fabs(math.sin(ky))) else: tmp = math.sin(th) * (math.sin(ky) / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.05) tmp = abs(Float64(ky * Float64(sin(th) / sin(kx)))); elseif (sin(kx) <= 5e-29) tmp = Float64(sin(ky) * Float64(sin(th) / abs(sin(ky)))); else tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.05) tmp = abs((ky * (sin(th) / sin(kx)))); elseif (sin(kx) <= 5e-29) tmp = sin(ky) * (sin(th) / abs(sin(ky))); else tmp = sin(th) * (sin(ky) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.05], N[Abs[N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 5e-29], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Abs[N[Sin[ky], $MachinePrecision]], $MachinePrecision]), $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.05:\\
\;\;\;\;\left|ky \cdot \frac{\sin th}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 5 \cdot 10^{-29}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\left|\sin ky\right|}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.050000000000000003Initial program 99.3%
unpow299.3%
sqr-neg99.3%
sin-neg99.3%
sin-neg99.3%
unpow299.3%
associate-*l/99.3%
associate-/l*99.3%
unpow299.3%
Simplified99.4%
Taylor expanded in ky around 0 13.6%
add-sqr-sqrt12.3%
sqrt-unprod15.4%
pow215.4%
*-commutative15.4%
associate-/l*15.4%
Applied egg-rr15.4%
unpow215.4%
rem-sqrt-square24.7%
associate-*r/24.7%
associate-*l/24.8%
*-commutative24.8%
Simplified24.8%
if -0.050000000000000003 < (sin.f64 kx) < 4.99999999999999986e-29Initial program 85.0%
unpow285.0%
sqr-neg85.0%
sin-neg85.0%
sin-neg85.0%
unpow285.0%
associate-*l/81.3%
associate-/l*84.8%
unpow284.8%
Simplified99.7%
Taylor expanded in kx around 0 43.5%
add-sqr-sqrt41.8%
sqrt-prod70.8%
rem-sqrt-square80.5%
Applied egg-rr80.5%
if 4.99999999999999986e-29 < (sin.f64 kx) Initial program 99.4%
+-commutative99.4%
unpow299.4%
unpow299.4%
hypot-undefine99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 58.6%
Final simplification61.4%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin th) (sin kx))))
(if (<= (sin kx) -0.05)
(fabs (* ky t_1))
(if (<= (sin kx) 1e-44) (sin th) (* (sin ky) t_1)))))
double code(double kx, double ky, double th) {
double t_1 = sin(th) / sin(kx);
double tmp;
if (sin(kx) <= -0.05) {
tmp = fabs((ky * t_1));
} else if (sin(kx) <= 1e-44) {
tmp = sin(th);
} else {
tmp = sin(ky) * t_1;
}
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) / sin(kx)
if (sin(kx) <= (-0.05d0)) then
tmp = abs((ky * t_1))
else if (sin(kx) <= 1d-44) then
tmp = sin(th)
else
tmp = sin(ky) * t_1
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(th) / Math.sin(kx);
double tmp;
if (Math.sin(kx) <= -0.05) {
tmp = Math.abs((ky * t_1));
} else if (Math.sin(kx) <= 1e-44) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(ky) * t_1;
}
return tmp;
}
def code(kx, ky, th): t_1 = math.sin(th) / math.sin(kx) tmp = 0 if math.sin(kx) <= -0.05: tmp = math.fabs((ky * t_1)) elif math.sin(kx) <= 1e-44: tmp = math.sin(th) else: tmp = math.sin(ky) * t_1 return tmp
function code(kx, ky, th) t_1 = Float64(sin(th) / sin(kx)) tmp = 0.0 if (sin(kx) <= -0.05) tmp = abs(Float64(ky * t_1)); elseif (sin(kx) <= 1e-44) tmp = sin(th); else tmp = Float64(sin(ky) * t_1); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = sin(th) / sin(kx); tmp = 0.0; if (sin(kx) <= -0.05) tmp = abs((ky * t_1)); elseif (sin(kx) <= 1e-44) tmp = sin(th); else tmp = sin(ky) * t_1; end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Sin[kx], $MachinePrecision], -0.05], N[Abs[N[(ky * t$95$1), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-44], N[Sin[th], $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * t$95$1), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin th}{\sin kx}\\
\mathbf{if}\;\sin kx \leq -0.05:\\
\;\;\;\;\left|ky \cdot t\_1\right|\\
\mathbf{elif}\;\sin kx \leq 10^{-44}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot t\_1\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.050000000000000003Initial program 99.3%
unpow299.3%
sqr-neg99.3%
sin-neg99.3%
sin-neg99.3%
unpow299.3%
associate-*l/99.3%
associate-/l*99.3%
unpow299.3%
Simplified99.4%
Taylor expanded in ky around 0 13.6%
add-sqr-sqrt12.3%
sqrt-unprod15.4%
pow215.4%
*-commutative15.4%
associate-/l*15.4%
Applied egg-rr15.4%
unpow215.4%
rem-sqrt-square24.7%
associate-*r/24.7%
associate-*l/24.8%
*-commutative24.8%
Simplified24.8%
if -0.050000000000000003 < (sin.f64 kx) < 9.99999999999999953e-45Initial program 84.9%
unpow284.9%
sqr-neg84.9%
sin-neg84.9%
sin-neg84.9%
unpow284.9%
associate-*l/81.1%
associate-/l*84.7%
unpow284.7%
Simplified99.7%
Taylor expanded in kx around 0 43.9%
if 9.99999999999999953e-45 < (sin.f64 kx) Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.5%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in ky around 0 57.9%
Final simplification43.6%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.05) (fabs (* ky (/ (sin th) (sin kx)))) (if (<= (sin kx) 1e-44) (sin th) (* (sin th) (/ (sin ky) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.05) {
tmp = fabs((ky * (sin(th) / sin(kx))));
} else if (sin(kx) <= 1e-44) {
tmp = 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.05d0)) then
tmp = abs((ky * (sin(th) / sin(kx))))
else if (sin(kx) <= 1d-44) then
tmp = 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.05) {
tmp = Math.abs((ky * (Math.sin(th) / Math.sin(kx))));
} else if (Math.sin(kx) <= 1e-44) {
tmp = 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.05: tmp = math.fabs((ky * (math.sin(th) / math.sin(kx)))) elif math.sin(kx) <= 1e-44: tmp = 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.05) tmp = abs(Float64(ky * Float64(sin(th) / sin(kx)))); elseif (sin(kx) <= 1e-44) tmp = 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.05) tmp = abs((ky * (sin(th) / sin(kx)))); elseif (sin(kx) <= 1e-44) tmp = 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.05], N[Abs[N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-44], N[Sin[th], $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.05:\\
\;\;\;\;\left|ky \cdot \frac{\sin th}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 10^{-44}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.050000000000000003Initial program 99.3%
unpow299.3%
sqr-neg99.3%
sin-neg99.3%
sin-neg99.3%
unpow299.3%
associate-*l/99.3%
associate-/l*99.3%
unpow299.3%
Simplified99.4%
Taylor expanded in ky around 0 13.6%
add-sqr-sqrt12.3%
sqrt-unprod15.4%
pow215.4%
*-commutative15.4%
associate-/l*15.4%
Applied egg-rr15.4%
unpow215.4%
rem-sqrt-square24.7%
associate-*r/24.7%
associate-*l/24.8%
*-commutative24.8%
Simplified24.8%
if -0.050000000000000003 < (sin.f64 kx) < 9.99999999999999953e-45Initial program 84.9%
unpow284.9%
sqr-neg84.9%
sin-neg84.9%
sin-neg84.9%
unpow284.9%
associate-*l/81.1%
associate-/l*84.7%
unpow284.7%
Simplified99.7%
Taylor expanded in kx around 0 43.9%
if 9.99999999999999953e-45 < (sin.f64 kx) Initial program 99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-undefine99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 58.0%
Final simplification43.6%
(FPCore (kx ky th) :precision binary64 (* (sin ky) (/ (sin th) (hypot (sin ky) (sin kx)))))
double code(double kx, double ky, double th) {
return sin(ky) * (sin(th) / hypot(sin(ky), sin(kx)));
}
public static double code(double kx, double ky, double th) {
return Math.sin(ky) * (Math.sin(th) / Math.hypot(Math.sin(ky), Math.sin(kx)));
}
def code(kx, ky, th): return math.sin(ky) * (math.sin(th) / math.hypot(math.sin(ky), math.sin(kx)))
function code(kx, ky, th) return Float64(sin(ky) * Float64(sin(th) / hypot(sin(ky), sin(kx)))) end
function tmp = code(kx, ky, th) tmp = sin(ky) * (sin(th) / hypot(sin(ky), sin(kx))); end
code[kx_, ky_, th_] := N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}
\end{array}
Initial program 92.5%
unpow292.5%
sqr-neg92.5%
sin-neg92.5%
sin-neg92.5%
unpow292.5%
associate-*l/90.7%
associate-/l*92.4%
unpow292.4%
Simplified99.6%
Final simplification99.6%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.42) (* ky (fabs (/ th (sin kx)))) (if (<= (sin kx) 5e-29) (sin th) (* (sin th) (/ 1.0 (/ (sin kx) ky))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.42) {
tmp = ky * fabs((th / sin(kx)));
} else if (sin(kx) <= 5e-29) {
tmp = sin(th);
} else {
tmp = sin(th) * (1.0 / (sin(kx) / 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 (sin(kx) <= (-0.42d0)) then
tmp = ky * abs((th / sin(kx)))
else if (sin(kx) <= 5d-29) then
tmp = sin(th)
else
tmp = sin(th) * (1.0d0 / (sin(kx) / ky))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.42) {
tmp = ky * Math.abs((th / Math.sin(kx)));
} else if (Math.sin(kx) <= 5e-29) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) * (1.0 / (Math.sin(kx) / ky));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.42: tmp = ky * math.fabs((th / math.sin(kx))) elif math.sin(kx) <= 5e-29: tmp = math.sin(th) else: tmp = math.sin(th) * (1.0 / (math.sin(kx) / ky)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.42) tmp = Float64(ky * abs(Float64(th / sin(kx)))); elseif (sin(kx) <= 5e-29) tmp = sin(th); else tmp = Float64(sin(th) * Float64(1.0 / Float64(sin(kx) / ky))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.42) tmp = ky * abs((th / sin(kx))); elseif (sin(kx) <= 5e-29) tmp = sin(th); else tmp = sin(th) * (1.0 / (sin(kx) / ky)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.42], N[(ky * N[Abs[N[(th / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 5e-29], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(1.0 / N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.42:\\
\;\;\;\;ky \cdot \left|\frac{th}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 5 \cdot 10^{-29}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{1}{\frac{\sin kx}{ky}}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.419999999999999984Initial program 99.2%
unpow299.2%
sqr-neg99.2%
sin-neg99.2%
sin-neg99.2%
unpow299.2%
associate-*l/99.4%
associate-/l*99.4%
unpow299.4%
Simplified99.4%
Taylor expanded in th around 0 51.3%
Taylor expanded in ky around 0 16.2%
associate-/l*16.2%
Simplified16.2%
add-sqr-sqrt12.6%
sqrt-unprod17.1%
pow217.1%
Applied egg-rr17.1%
unpow217.1%
rem-sqrt-square19.4%
Simplified19.4%
if -0.419999999999999984 < (sin.f64 kx) < 4.99999999999999986e-29Initial program 86.5%
unpow286.5%
sqr-neg86.5%
sin-neg86.5%
sin-neg86.5%
unpow286.5%
associate-*l/83.1%
associate-/l*86.3%
unpow286.3%
Simplified99.7%
Taylor expanded in kx around 0 39.8%
if 4.99999999999999986e-29 < (sin.f64 kx) Initial program 99.4%
+-commutative99.4%
unpow299.4%
unpow299.4%
hypot-undefine99.5%
Applied egg-rr99.5%
clear-num99.3%
inv-pow99.3%
Applied egg-rr99.3%
unpow-199.3%
Simplified99.3%
Taylor expanded in ky around 0 49.6%
Final simplification39.1%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.05) (fabs (* ky (/ (sin th) (sin kx)))) (if (<= (sin kx) 5e-29) (sin th) (* (sin th) (/ 1.0 (/ (sin kx) ky))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.05) {
tmp = fabs((ky * (sin(th) / sin(kx))));
} else if (sin(kx) <= 5e-29) {
tmp = sin(th);
} else {
tmp = sin(th) * (1.0 / (sin(kx) / 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 (sin(kx) <= (-0.05d0)) then
tmp = abs((ky * (sin(th) / sin(kx))))
else if (sin(kx) <= 5d-29) then
tmp = sin(th)
else
tmp = sin(th) * (1.0d0 / (sin(kx) / ky))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.05) {
tmp = Math.abs((ky * (Math.sin(th) / Math.sin(kx))));
} else if (Math.sin(kx) <= 5e-29) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) * (1.0 / (Math.sin(kx) / ky));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.05: tmp = math.fabs((ky * (math.sin(th) / math.sin(kx)))) elif math.sin(kx) <= 5e-29: tmp = math.sin(th) else: tmp = math.sin(th) * (1.0 / (math.sin(kx) / ky)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.05) tmp = abs(Float64(ky * Float64(sin(th) / sin(kx)))); elseif (sin(kx) <= 5e-29) tmp = sin(th); else tmp = Float64(sin(th) * Float64(1.0 / Float64(sin(kx) / ky))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.05) tmp = abs((ky * (sin(th) / sin(kx)))); elseif (sin(kx) <= 5e-29) tmp = sin(th); else tmp = sin(th) * (1.0 / (sin(kx) / ky)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.05], N[Abs[N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 5e-29], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(1.0 / N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.05:\\
\;\;\;\;\left|ky \cdot \frac{\sin th}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 5 \cdot 10^{-29}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{1}{\frac{\sin kx}{ky}}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.050000000000000003Initial program 99.3%
unpow299.3%
sqr-neg99.3%
sin-neg99.3%
sin-neg99.3%
unpow299.3%
associate-*l/99.3%
associate-/l*99.3%
unpow299.3%
Simplified99.4%
Taylor expanded in ky around 0 13.6%
add-sqr-sqrt12.3%
sqrt-unprod15.4%
pow215.4%
*-commutative15.4%
associate-/l*15.4%
Applied egg-rr15.4%
unpow215.4%
rem-sqrt-square24.7%
associate-*r/24.7%
associate-*l/24.8%
*-commutative24.8%
Simplified24.8%
if -0.050000000000000003 < (sin.f64 kx) < 4.99999999999999986e-29Initial program 85.0%
unpow285.0%
sqr-neg85.0%
sin-neg85.0%
sin-neg85.0%
unpow285.0%
associate-*l/81.3%
associate-/l*84.8%
unpow284.8%
Simplified99.7%
Taylor expanded in kx around 0 43.6%
if 4.99999999999999986e-29 < (sin.f64 kx) Initial program 99.4%
+-commutative99.4%
unpow299.4%
unpow299.4%
hypot-undefine99.5%
Applied egg-rr99.5%
clear-num99.3%
inv-pow99.3%
Applied egg-rr99.3%
unpow-199.3%
Simplified99.3%
Taylor expanded in ky around 0 49.6%
Final simplification41.0%
(FPCore (kx ky th)
:precision binary64
(if (<= ky 7.6e-5)
(* (sin ky) (/ (sin th) (hypot ky (sin kx))))
(if (<= ky 1.66e+112)
(/ (* (sin ky) (sin th)) (fabs (sin ky)))
(* (sin ky) (/ th (hypot (sin ky) (sin kx)))))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 7.6e-5) {
tmp = sin(ky) * (sin(th) / hypot(ky, sin(kx)));
} else if (ky <= 1.66e+112) {
tmp = (sin(ky) * sin(th)) / fabs(sin(ky));
} else {
tmp = sin(ky) * (th / hypot(sin(ky), sin(kx)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 7.6e-5) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.hypot(ky, Math.sin(kx)));
} else if (ky <= 1.66e+112) {
tmp = (Math.sin(ky) * Math.sin(th)) / Math.abs(Math.sin(ky));
} else {
tmp = Math.sin(ky) * (th / Math.hypot(Math.sin(ky), Math.sin(kx)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 7.6e-5: tmp = math.sin(ky) * (math.sin(th) / math.hypot(ky, math.sin(kx))) elif ky <= 1.66e+112: tmp = (math.sin(ky) * math.sin(th)) / math.fabs(math.sin(ky)) else: tmp = math.sin(ky) * (th / math.hypot(math.sin(ky), math.sin(kx))) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 7.6e-5) tmp = Float64(sin(ky) * Float64(sin(th) / hypot(ky, sin(kx)))); elseif (ky <= 1.66e+112) tmp = Float64(Float64(sin(ky) * sin(th)) / abs(sin(ky))); else tmp = Float64(sin(ky) * Float64(th / hypot(sin(ky), sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 7.6e-5) tmp = sin(ky) * (sin(th) / hypot(ky, sin(kx))); elseif (ky <= 1.66e+112) tmp = (sin(ky) * sin(th)) / abs(sin(ky)); else tmp = sin(ky) * (th / hypot(sin(ky), sin(kx))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 7.6e-5], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[ky, 1.66e+112], N[(N[(N[Sin[ky], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision] / N[Abs[N[Sin[ky], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 7.6 \cdot 10^{-5}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\mathbf{elif}\;ky \leq 1.66 \cdot 10^{+112}:\\
\;\;\;\;\frac{\sin ky \cdot \sin th}{\left|\sin ky\right|}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\end{array}
\end{array}
if ky < 7.6000000000000004e-5Initial program 90.2%
unpow290.2%
sqr-neg90.2%
sin-neg90.2%
sin-neg90.2%
unpow290.2%
associate-*l/87.9%
associate-/l*90.2%
unpow290.2%
Simplified99.6%
Taylor expanded in ky around 0 68.2%
if 7.6000000000000004e-5 < ky < 1.65999999999999995e112Initial program 99.9%
unpow299.9%
sqr-neg99.9%
sin-neg99.9%
sin-neg99.9%
unpow299.9%
associate-*l/99.8%
associate-/l*99.4%
unpow299.4%
Simplified99.4%
Taylor expanded in kx around 0 33.3%
add-sqr-sqrt32.0%
sqrt-prod65.0%
rem-sqrt-square65.0%
Applied egg-rr65.0%
Taylor expanded in ky around inf 65.3%
if 1.65999999999999995e112 < ky Initial program 99.3%
unpow299.3%
sqr-neg99.3%
sin-neg99.3%
sin-neg99.3%
unpow299.3%
associate-*l/99.4%
associate-/l*99.3%
unpow299.3%
Simplified99.4%
Taylor expanded in th around 0 65.0%
associate-*l*64.9%
sqrt-div64.9%
metadata-eval64.9%
+-commutative64.9%
unpow264.9%
unpow264.9%
hypot-undefine64.9%
div-inv64.9%
clear-num64.9%
un-div-inv64.9%
Applied egg-rr64.9%
associate-/r/64.8%
Simplified64.8%
Final simplification67.5%
(FPCore (kx ky th)
:precision binary64
(if (<= ky 7.6e-5)
(* (sin th) (/ (sin ky) (hypot ky (sin kx))))
(if (<= ky 8.6e+113)
(/ (* (sin ky) (sin th)) (fabs (sin ky)))
(* (sin ky) (/ th (hypot (sin ky) (sin kx)))))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 7.6e-5) {
tmp = sin(th) * (sin(ky) / hypot(ky, sin(kx)));
} else if (ky <= 8.6e+113) {
tmp = (sin(ky) * sin(th)) / fabs(sin(ky));
} else {
tmp = sin(ky) * (th / hypot(sin(ky), sin(kx)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 7.6e-5) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.hypot(ky, Math.sin(kx)));
} else if (ky <= 8.6e+113) {
tmp = (Math.sin(ky) * Math.sin(th)) / Math.abs(Math.sin(ky));
} else {
tmp = Math.sin(ky) * (th / Math.hypot(Math.sin(ky), Math.sin(kx)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 7.6e-5: tmp = math.sin(th) * (math.sin(ky) / math.hypot(ky, math.sin(kx))) elif ky <= 8.6e+113: tmp = (math.sin(ky) * math.sin(th)) / math.fabs(math.sin(ky)) else: tmp = math.sin(ky) * (th / math.hypot(math.sin(ky), math.sin(kx))) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 7.6e-5) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(ky, sin(kx)))); elseif (ky <= 8.6e+113) tmp = Float64(Float64(sin(ky) * sin(th)) / abs(sin(ky))); else tmp = Float64(sin(ky) * Float64(th / hypot(sin(ky), sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 7.6e-5) tmp = sin(th) * (sin(ky) / hypot(ky, sin(kx))); elseif (ky <= 8.6e+113) tmp = (sin(ky) * sin(th)) / abs(sin(ky)); else tmp = sin(ky) * (th / hypot(sin(ky), sin(kx))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 7.6e-5], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[ky, 8.6e+113], N[(N[(N[Sin[ky], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision] / N[Abs[N[Sin[ky], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 7.6 \cdot 10^{-5}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\mathbf{elif}\;ky \leq 8.6 \cdot 10^{+113}:\\
\;\;\;\;\frac{\sin ky \cdot \sin th}{\left|\sin ky\right|}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\end{array}
\end{array}
if ky < 7.6000000000000004e-5Initial program 90.2%
+-commutative90.2%
unpow290.2%
unpow290.2%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 68.3%
if 7.6000000000000004e-5 < ky < 8.6000000000000007e113Initial program 99.9%
unpow299.9%
sqr-neg99.9%
sin-neg99.9%
sin-neg99.9%
unpow299.9%
associate-*l/99.8%
associate-/l*99.4%
unpow299.4%
Simplified99.4%
Taylor expanded in kx around 0 33.3%
add-sqr-sqrt32.0%
sqrt-prod65.0%
rem-sqrt-square65.0%
Applied egg-rr65.0%
Taylor expanded in ky around inf 65.3%
if 8.6000000000000007e113 < ky Initial program 99.3%
unpow299.3%
sqr-neg99.3%
sin-neg99.3%
sin-neg99.3%
unpow299.3%
associate-*l/99.4%
associate-/l*99.3%
unpow299.3%
Simplified99.4%
Taylor expanded in th around 0 65.0%
associate-*l*64.9%
sqrt-div64.9%
metadata-eval64.9%
+-commutative64.9%
unpow264.9%
unpow264.9%
hypot-undefine64.9%
div-inv64.9%
clear-num64.9%
un-div-inv64.9%
Applied egg-rr64.9%
associate-/r/64.8%
Simplified64.8%
Final simplification67.5%
(FPCore (kx ky th)
:precision binary64
(if (<= ky 7.6e-5)
(* (sin th) (/ (sin ky) (hypot ky (sin kx))))
(if (<= ky 7.2e+114)
(/ (* (sin ky) (sin th)) (fabs (sin ky)))
(/ (* (sin ky) th) (hypot (sin ky) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 7.6e-5) {
tmp = sin(th) * (sin(ky) / hypot(ky, sin(kx)));
} else if (ky <= 7.2e+114) {
tmp = (sin(ky) * sin(th)) / fabs(sin(ky));
} else {
tmp = (sin(ky) * th) / hypot(sin(ky), sin(kx));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 7.6e-5) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.hypot(ky, Math.sin(kx)));
} else if (ky <= 7.2e+114) {
tmp = (Math.sin(ky) * Math.sin(th)) / Math.abs(Math.sin(ky));
} else {
tmp = (Math.sin(ky) * th) / Math.hypot(Math.sin(ky), Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 7.6e-5: tmp = math.sin(th) * (math.sin(ky) / math.hypot(ky, math.sin(kx))) elif ky <= 7.2e+114: tmp = (math.sin(ky) * math.sin(th)) / math.fabs(math.sin(ky)) else: tmp = (math.sin(ky) * th) / math.hypot(math.sin(ky), math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 7.6e-5) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(ky, sin(kx)))); elseif (ky <= 7.2e+114) tmp = Float64(Float64(sin(ky) * sin(th)) / abs(sin(ky))); else tmp = Float64(Float64(sin(ky) * th) / hypot(sin(ky), sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 7.6e-5) tmp = sin(th) * (sin(ky) / hypot(ky, sin(kx))); elseif (ky <= 7.2e+114) tmp = (sin(ky) * sin(th)) / abs(sin(ky)); else tmp = (sin(ky) * th) / hypot(sin(ky), sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 7.6e-5], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[ky, 7.2e+114], N[(N[(N[Sin[ky], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision] / N[Abs[N[Sin[ky], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 7.6 \cdot 10^{-5}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\mathbf{elif}\;ky \leq 7.2 \cdot 10^{+114}:\\
\;\;\;\;\frac{\sin ky \cdot \sin th}{\left|\sin ky\right|}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky \cdot th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\end{array}
\end{array}
if ky < 7.6000000000000004e-5Initial program 90.2%
+-commutative90.2%
unpow290.2%
unpow290.2%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 68.3%
if 7.6000000000000004e-5 < ky < 7.2000000000000001e114Initial program 99.9%
unpow299.9%
sqr-neg99.9%
sin-neg99.9%
sin-neg99.9%
unpow299.9%
associate-*l/99.8%
associate-/l*99.4%
unpow299.4%
Simplified99.4%
Taylor expanded in kx around 0 33.3%
add-sqr-sqrt32.0%
sqrt-prod65.0%
rem-sqrt-square65.0%
Applied egg-rr65.0%
Taylor expanded in ky around inf 65.3%
if 7.2000000000000001e114 < ky Initial program 99.3%
unpow299.3%
sqr-neg99.3%
sin-neg99.3%
sin-neg99.3%
unpow299.3%
associate-*l/99.4%
associate-/l*99.3%
unpow299.3%
Simplified99.4%
Taylor expanded in th around 0 65.0%
sqrt-div64.8%
metadata-eval64.8%
+-commutative64.8%
unpow264.8%
unpow264.8%
hypot-undefine64.9%
un-div-inv65.0%
*-commutative65.0%
Applied egg-rr65.0%
Final simplification67.5%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.42) (* ky (fabs (/ th (sin kx)))) (if (<= (sin kx) 5e-29) (sin th) (* ky (/ (sin th) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.42) {
tmp = ky * fabs((th / sin(kx)));
} else if (sin(kx) <= 5e-29) {
tmp = sin(th);
} else {
tmp = ky * (sin(th) / sin(kx));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(kx) <= (-0.42d0)) then
tmp = ky * abs((th / sin(kx)))
else if (sin(kx) <= 5d-29) then
tmp = sin(th)
else
tmp = ky * (sin(th) / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.42) {
tmp = ky * Math.abs((th / Math.sin(kx)));
} else if (Math.sin(kx) <= 5e-29) {
tmp = Math.sin(th);
} else {
tmp = ky * (Math.sin(th) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.42: tmp = ky * math.fabs((th / math.sin(kx))) elif math.sin(kx) <= 5e-29: tmp = math.sin(th) else: tmp = ky * (math.sin(th) / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.42) tmp = Float64(ky * abs(Float64(th / sin(kx)))); elseif (sin(kx) <= 5e-29) tmp = sin(th); else tmp = Float64(ky * Float64(sin(th) / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.42) tmp = ky * abs((th / sin(kx))); elseif (sin(kx) <= 5e-29) tmp = sin(th); else tmp = ky * (sin(th) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.42], N[(ky * N[Abs[N[(th / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 5e-29], N[Sin[th], $MachinePrecision], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.42:\\
\;\;\;\;ky \cdot \left|\frac{th}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 5 \cdot 10^{-29}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.419999999999999984Initial program 99.2%
unpow299.2%
sqr-neg99.2%
sin-neg99.2%
sin-neg99.2%
unpow299.2%
associate-*l/99.4%
associate-/l*99.4%
unpow299.4%
Simplified99.4%
Taylor expanded in th around 0 51.3%
Taylor expanded in ky around 0 16.2%
associate-/l*16.2%
Simplified16.2%
add-sqr-sqrt12.6%
sqrt-unprod17.1%
pow217.1%
Applied egg-rr17.1%
unpow217.1%
rem-sqrt-square19.4%
Simplified19.4%
if -0.419999999999999984 < (sin.f64 kx) < 4.99999999999999986e-29Initial program 86.5%
unpow286.5%
sqr-neg86.5%
sin-neg86.5%
sin-neg86.5%
unpow286.5%
associate-*l/83.1%
associate-/l*86.3%
unpow286.3%
Simplified99.7%
Taylor expanded in kx around 0 39.8%
if 4.99999999999999986e-29 < (sin.f64 kx) Initial program 99.4%
unpow299.4%
sqr-neg99.4%
sin-neg99.4%
sin-neg99.4%
unpow299.4%
associate-*l/99.5%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in ky around 0 49.6%
associate-/l*49.6%
Simplified49.6%
Final simplification39.1%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.42) (* ky (fabs (/ th (sin kx)))) (if (<= (sin kx) 5e-29) (sin th) (* (sin th) (/ ky (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.42) {
tmp = ky * fabs((th / sin(kx)));
} else if (sin(kx) <= 5e-29) {
tmp = sin(th);
} else {
tmp = sin(th) * (ky / sin(kx));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(kx) <= (-0.42d0)) then
tmp = ky * abs((th / sin(kx)))
else if (sin(kx) <= 5d-29) then
tmp = sin(th)
else
tmp = sin(th) * (ky / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.42) {
tmp = ky * Math.abs((th / Math.sin(kx)));
} else if (Math.sin(kx) <= 5e-29) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) * (ky / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.42: tmp = ky * math.fabs((th / math.sin(kx))) elif math.sin(kx) <= 5e-29: tmp = math.sin(th) else: tmp = math.sin(th) * (ky / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.42) tmp = Float64(ky * abs(Float64(th / sin(kx)))); elseif (sin(kx) <= 5e-29) tmp = sin(th); else tmp = Float64(sin(th) * Float64(ky / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.42) tmp = ky * abs((th / sin(kx))); elseif (sin(kx) <= 5e-29) tmp = sin(th); else tmp = sin(th) * (ky / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.42], N[(ky * N[Abs[N[(th / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 5e-29], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.42:\\
\;\;\;\;ky \cdot \left|\frac{th}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 5 \cdot 10^{-29}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.419999999999999984Initial program 99.2%
unpow299.2%
sqr-neg99.2%
sin-neg99.2%
sin-neg99.2%
unpow299.2%
associate-*l/99.4%
associate-/l*99.4%
unpow299.4%
Simplified99.4%
Taylor expanded in th around 0 51.3%
Taylor expanded in ky around 0 16.2%
associate-/l*16.2%
Simplified16.2%
add-sqr-sqrt12.6%
sqrt-unprod17.1%
pow217.1%
Applied egg-rr17.1%
unpow217.1%
rem-sqrt-square19.4%
Simplified19.4%
if -0.419999999999999984 < (sin.f64 kx) < 4.99999999999999986e-29Initial program 86.5%
unpow286.5%
sqr-neg86.5%
sin-neg86.5%
sin-neg86.5%
unpow286.5%
associate-*l/83.1%
associate-/l*86.3%
unpow286.3%
Simplified99.7%
Taylor expanded in kx around 0 39.8%
if 4.99999999999999986e-29 < (sin.f64 kx) Initial program 99.4%
Taylor expanded in ky around 0 49.6%
Final simplification39.1%
(FPCore (kx ky th) :precision binary64 (if (<= ky 5.5e-5) (* (sin ky) (/ (sin th) (hypot ky (sin kx)))) (/ (* (sin ky) (sin th)) (fabs (sin ky)))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 5.5e-5) {
tmp = sin(ky) * (sin(th) / hypot(ky, sin(kx)));
} else {
tmp = (sin(ky) * sin(th)) / fabs(sin(ky));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 5.5e-5) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.hypot(ky, Math.sin(kx)));
} else {
tmp = (Math.sin(ky) * Math.sin(th)) / Math.abs(Math.sin(ky));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 5.5e-5: tmp = math.sin(ky) * (math.sin(th) / math.hypot(ky, math.sin(kx))) else: tmp = (math.sin(ky) * math.sin(th)) / math.fabs(math.sin(ky)) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 5.5e-5) tmp = Float64(sin(ky) * Float64(sin(th) / hypot(ky, sin(kx)))); else tmp = Float64(Float64(sin(ky) * sin(th)) / abs(sin(ky))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 5.5e-5) tmp = sin(ky) * (sin(th) / hypot(ky, sin(kx))); else tmp = (sin(ky) * sin(th)) / abs(sin(ky)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 5.5e-5], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sin[ky], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision] / N[Abs[N[Sin[ky], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 5.5 \cdot 10^{-5}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky \cdot \sin th}{\left|\sin ky\right|}\\
\end{array}
\end{array}
if ky < 5.5000000000000002e-5Initial program 90.2%
unpow290.2%
sqr-neg90.2%
sin-neg90.2%
sin-neg90.2%
unpow290.2%
associate-*l/87.9%
associate-/l*90.2%
unpow290.2%
Simplified99.6%
Taylor expanded in ky around 0 68.2%
if 5.5000000000000002e-5 < ky Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.6%
associate-/l*99.3%
unpow299.3%
Simplified99.4%
Taylor expanded in kx around 0 28.6%
add-sqr-sqrt27.2%
sqrt-prod56.7%
rem-sqrt-square56.7%
Applied egg-rr56.7%
Taylor expanded in ky around inf 57.0%
Final simplification65.6%
(FPCore (kx ky th) :precision binary64 (if (<= ky 1.22e-179) (* ky (/ (sin th) kx)) (if (<= ky 166.0) (/ (* ky (sin th)) ky) (fabs (sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 1.22e-179) {
tmp = ky * (sin(th) / kx);
} else if (ky <= 166.0) {
tmp = (ky * sin(th)) / ky;
} else {
tmp = fabs(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.22d-179) then
tmp = ky * (sin(th) / kx)
else if (ky <= 166.0d0) then
tmp = (ky * sin(th)) / ky
else
tmp = abs(sin(th))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 1.22e-179) {
tmp = ky * (Math.sin(th) / kx);
} else if (ky <= 166.0) {
tmp = (ky * Math.sin(th)) / ky;
} else {
tmp = Math.abs(Math.sin(th));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 1.22e-179: tmp = ky * (math.sin(th) / kx) elif ky <= 166.0: tmp = (ky * math.sin(th)) / ky else: tmp = math.fabs(math.sin(th)) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 1.22e-179) tmp = Float64(ky * Float64(sin(th) / kx)); elseif (ky <= 166.0) tmp = Float64(Float64(ky * sin(th)) / ky); else tmp = abs(sin(th)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 1.22e-179) tmp = ky * (sin(th) / kx); elseif (ky <= 166.0) tmp = (ky * sin(th)) / ky; else tmp = abs(sin(th)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 1.22e-179], N[(ky * N[(N[Sin[th], $MachinePrecision] / kx), $MachinePrecision]), $MachinePrecision], If[LessEqual[ky, 166.0], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] / ky), $MachinePrecision], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 1.22 \cdot 10^{-179}:\\
\;\;\;\;ky \cdot \frac{\sin th}{kx}\\
\mathbf{elif}\;ky \leq 166:\\
\;\;\;\;\frac{ky \cdot \sin th}{ky}\\
\mathbf{else}:\\
\;\;\;\;\left|\sin th\right|\\
\end{array}
\end{array}
if ky < 1.22e-179Initial program 89.4%
unpow289.4%
sqr-neg89.4%
sin-neg89.4%
sin-neg89.4%
unpow289.4%
associate-*l/88.3%
associate-/l*89.4%
unpow289.4%
Simplified99.6%
Taylor expanded in ky around 0 26.9%
Taylor expanded in kx around 0 16.2%
associate-/l*17.3%
Simplified17.3%
if 1.22e-179 < ky < 166Initial program 95.5%
unpow295.5%
sqr-neg95.5%
sin-neg95.5%
sin-neg95.5%
unpow295.5%
associate-*l/87.5%
associate-/l*95.5%
unpow295.5%
Simplified99.7%
Taylor expanded in kx around 0 49.5%
add-sqr-sqrt49.2%
sqrt-prod44.9%
rem-sqrt-square49.5%
Applied egg-rr49.5%
Taylor expanded in ky around 0 48.5%
rem-square-sqrt48.3%
fabs-sqr48.3%
rem-square-sqrt48.5%
Simplified48.5%
Taylor expanded in ky around 0 52.3%
if 166 < ky Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.6%
associate-/l*99.3%
unpow299.3%
Simplified99.4%
Taylor expanded in kx around 0 26.5%
add-sqr-sqrt14.1%
sqrt-unprod30.5%
pow230.5%
Applied egg-rr30.5%
unpow230.5%
rem-sqrt-square34.4%
associate-*r/34.6%
associate-*l/34.6%
*-inverses34.6%
*-lft-identity34.6%
Simplified34.6%
Final simplification25.8%
(FPCore (kx ky th) :precision binary64 (if (<= kx 0.58) (sin th) (* ky (fabs (/ th (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.58) {
tmp = sin(th);
} else {
tmp = ky * fabs((th / sin(kx)));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (kx <= 0.58d0) then
tmp = sin(th)
else
tmp = ky * abs((th / sin(kx)))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.58) {
tmp = Math.sin(th);
} else {
tmp = ky * Math.abs((th / Math.sin(kx)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 0.58: tmp = math.sin(th) else: tmp = ky * math.fabs((th / math.sin(kx))) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 0.58) tmp = sin(th); else tmp = Float64(ky * abs(Float64(th / sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 0.58) tmp = sin(th); else tmp = ky * abs((th / sin(kx))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 0.58], N[Sin[th], $MachinePrecision], N[(ky * N[Abs[N[(th / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 0.58:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;ky \cdot \left|\frac{th}{\sin kx}\right|\\
\end{array}
\end{array}
if kx < 0.57999999999999996Initial program 90.5%
unpow290.5%
sqr-neg90.5%
sin-neg90.5%
sin-neg90.5%
unpow290.5%
associate-*l/88.2%
associate-/l*90.4%
unpow290.4%
Simplified99.6%
Taylor expanded in kx around 0 30.5%
if 0.57999999999999996 < kx Initial program 99.4%
unpow299.4%
sqr-neg99.4%
sin-neg99.4%
sin-neg99.4%
unpow299.4%
associate-*l/99.6%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in th around 0 59.0%
Taylor expanded in ky around 0 17.0%
associate-/l*17.0%
Simplified17.0%
add-sqr-sqrt10.9%
sqrt-unprod17.8%
pow217.8%
Applied egg-rr17.8%
unpow217.8%
rem-sqrt-square17.3%
Simplified17.3%
Final simplification27.6%
(FPCore (kx ky th) :precision binary64 (if (<= kx 0.52) (sin th) (* ky (/ th (sin kx)))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.52) {
tmp = sin(th);
} else {
tmp = ky * (th / sin(kx));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (kx <= 0.52d0) then
tmp = sin(th)
else
tmp = ky * (th / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.52) {
tmp = Math.sin(th);
} else {
tmp = ky * (th / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 0.52: tmp = math.sin(th) else: tmp = ky * (th / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 0.52) tmp = sin(th); else tmp = Float64(ky * Float64(th / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 0.52) tmp = sin(th); else tmp = ky * (th / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 0.52], N[Sin[th], $MachinePrecision], N[(ky * N[(th / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 0.52:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;ky \cdot \frac{th}{\sin kx}\\
\end{array}
\end{array}
if kx < 0.52000000000000002Initial program 90.5%
unpow290.5%
sqr-neg90.5%
sin-neg90.5%
sin-neg90.5%
unpow290.5%
associate-*l/88.2%
associate-/l*90.4%
unpow290.4%
Simplified99.6%
Taylor expanded in kx around 0 30.5%
if 0.52000000000000002 < kx Initial program 99.4%
unpow299.4%
sqr-neg99.4%
sin-neg99.4%
sin-neg99.4%
unpow299.4%
associate-*l/99.6%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in th around 0 59.0%
Taylor expanded in ky around 0 17.0%
associate-/l*17.0%
Simplified17.0%
Final simplification27.5%
(FPCore (kx ky th) :precision binary64 (if (<= ky 4.2e-161) (* ky (/ (sin th) kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 4.2e-161) {
tmp = ky * (sin(th) / kx);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= 4.2d-161) then
tmp = ky * (sin(th) / kx)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 4.2e-161) {
tmp = ky * (Math.sin(th) / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 4.2e-161: tmp = ky * (math.sin(th) / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 4.2e-161) tmp = Float64(ky * Float64(sin(th) / kx)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 4.2e-161) tmp = ky * (sin(th) / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 4.2e-161], N[(ky * N[(N[Sin[th], $MachinePrecision] / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 4.2 \cdot 10^{-161}:\\
\;\;\;\;ky \cdot \frac{\sin th}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 4.2000000000000001e-161Initial program 89.2%
unpow289.2%
sqr-neg89.2%
sin-neg89.2%
sin-neg89.2%
unpow289.2%
associate-*l/88.1%
associate-/l*89.2%
unpow289.2%
Simplified99.6%
Taylor expanded in ky around 0 28.3%
Taylor expanded in kx around 0 17.5%
associate-/l*18.5%
Simplified18.5%
if 4.2000000000000001e-161 < ky Initial program 99.1%
unpow299.1%
sqr-neg99.1%
sin-neg99.1%
sin-neg99.1%
unpow299.1%
associate-*l/95.9%
associate-/l*98.9%
unpow298.9%
Simplified99.5%
Taylor expanded in kx around 0 36.2%
Final simplification24.4%
(FPCore (kx ky th) :precision binary64 (if (<= ky 1.35e-179) (* ky (/ (sin th) kx)) (/ (* ky (sin th)) ky)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 1.35e-179) {
tmp = ky * (sin(th) / kx);
} else {
tmp = (ky * sin(th)) / ky;
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= 1.35d-179) then
tmp = ky * (sin(th) / kx)
else
tmp = (ky * sin(th)) / ky
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 1.35e-179) {
tmp = ky * (Math.sin(th) / kx);
} else {
tmp = (ky * Math.sin(th)) / ky;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 1.35e-179: tmp = ky * (math.sin(th) / kx) else: tmp = (ky * math.sin(th)) / ky return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 1.35e-179) tmp = Float64(ky * Float64(sin(th) / kx)); else tmp = Float64(Float64(ky * sin(th)) / ky); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 1.35e-179) tmp = ky * (sin(th) / kx); else tmp = (ky * sin(th)) / ky; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 1.35e-179], N[(ky * N[(N[Sin[th], $MachinePrecision] / kx), $MachinePrecision]), $MachinePrecision], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] / ky), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 1.35 \cdot 10^{-179}:\\
\;\;\;\;ky \cdot \frac{\sin th}{kx}\\
\mathbf{else}:\\
\;\;\;\;\frac{ky \cdot \sin th}{ky}\\
\end{array}
\end{array}
if ky < 1.34999999999999994e-179Initial program 89.4%
unpow289.4%
sqr-neg89.4%
sin-neg89.4%
sin-neg89.4%
unpow289.4%
associate-*l/88.3%
associate-/l*89.4%
unpow289.4%
Simplified99.6%
Taylor expanded in ky around 0 26.9%
Taylor expanded in kx around 0 16.2%
associate-/l*17.3%
Simplified17.3%
if 1.34999999999999994e-179 < ky Initial program 98.1%
unpow298.1%
sqr-neg98.1%
sin-neg98.1%
sin-neg98.1%
unpow298.1%
associate-*l/95.1%
associate-/l*97.9%
unpow297.9%
Simplified99.5%
Taylor expanded in kx around 0 35.1%
add-sqr-sqrt34.0%
sqrt-prod52.2%
rem-sqrt-square53.9%
Applied egg-rr53.9%
Taylor expanded in ky around 0 20.1%
rem-square-sqrt19.4%
fabs-sqr19.4%
rem-square-sqrt21.6%
Simplified21.6%
Taylor expanded in ky around 0 36.2%
Final simplification24.0%
(FPCore (kx ky th) :precision binary64 (if (<= kx 6.5) (sin th) (/ (* ky th) kx)))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 6.5) {
tmp = sin(th);
} else {
tmp = (ky * th) / 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 <= 6.5d0) then
tmp = sin(th)
else
tmp = (ky * th) / kx
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 6.5) {
tmp = Math.sin(th);
} else {
tmp = (ky * th) / kx;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 6.5: tmp = math.sin(th) else: tmp = (ky * th) / kx return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 6.5) tmp = sin(th); else tmp = Float64(Float64(ky * th) / kx); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 6.5) tmp = sin(th); else tmp = (ky * th) / kx; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 6.5], N[Sin[th], $MachinePrecision], N[(N[(ky * th), $MachinePrecision] / kx), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 6.5:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{ky \cdot th}{kx}\\
\end{array}
\end{array}
if kx < 6.5Initial program 90.5%
unpow290.5%
sqr-neg90.5%
sin-neg90.5%
sin-neg90.5%
unpow290.5%
associate-*l/88.2%
associate-/l*90.4%
unpow290.4%
Simplified99.6%
Taylor expanded in kx around 0 30.5%
if 6.5 < kx Initial program 99.4%
unpow299.4%
sqr-neg99.4%
sin-neg99.4%
sin-neg99.4%
unpow299.4%
associate-*l/99.6%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in th around 0 59.0%
Taylor expanded in ky around 0 17.0%
associate-/l*17.0%
Simplified17.0%
Taylor expanded in kx around 0 17.0%
Final simplification27.5%
(FPCore (kx ky th) :precision binary64 (if (<= ky 1.5e-106) (* ky (/ th kx)) th))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 1.5e-106) {
tmp = ky * (th / 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 <= 1.5d-106) then
tmp = ky * (th / kx)
else
tmp = th
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 1.5e-106) {
tmp = ky * (th / kx);
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 1.5e-106: tmp = ky * (th / kx) else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 1.5e-106) tmp = Float64(ky * Float64(th / kx)); else tmp = th; end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 1.5e-106) tmp = ky * (th / kx); else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 1.5e-106], N[(ky * N[(th / kx), $MachinePrecision]), $MachinePrecision], th]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 1.5 \cdot 10^{-106}:\\
\;\;\;\;ky \cdot \frac{th}{kx}\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if ky < 1.50000000000000009e-106Initial program 89.6%
unpow289.6%
sqr-neg89.6%
sin-neg89.6%
sin-neg89.6%
unpow289.6%
associate-*l/87.1%
associate-/l*89.6%
unpow289.6%
Simplified99.6%
Taylor expanded in th around 0 41.3%
Taylor expanded in ky around 0 15.4%
associate-/l*16.3%
Simplified16.3%
Taylor expanded in kx around 0 13.1%
associate-/l*14.0%
Simplified14.0%
if 1.50000000000000009e-106 < ky Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.6%
associate-/l*99.4%
unpow299.4%
Simplified99.5%
Taylor expanded in kx around 0 33.6%
Taylor expanded in th around 0 12.6%
Final simplification13.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 92.5%
unpow292.5%
sqr-neg92.5%
sin-neg92.5%
sin-neg92.5%
unpow292.5%
associate-*l/90.7%
associate-/l*92.4%
unpow292.4%
Simplified99.6%
Taylor expanded in kx around 0 25.1%
Taylor expanded in th around 0 10.4%
Final simplification10.4%
herbie shell --seed 2024085
(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)))