
(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 23 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 94.1%
+-commutative94.1%
unpow294.1%
unpow294.1%
hypot-def99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -2e-49)
(fabs (sin th))
(if (or (<= (sin ky) 2e-179)
(and (not (<= (sin ky) 4e-156))
(or (<= (sin ky) 5e-61)
(and (not (<= (sin ky) 5e-48)) (<= (sin ky) 2e-10)))))
(* (sin th) (/ ky (sin kx)))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -2e-49) {
tmp = fabs(sin(th));
} else if ((sin(ky) <= 2e-179) || (!(sin(ky) <= 4e-156) && ((sin(ky) <= 5e-61) || (!(sin(ky) <= 5e-48) && (sin(ky) <= 2e-10))))) {
tmp = sin(th) * (ky / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-2d-49)) then
tmp = abs(sin(th))
else if ((sin(ky) <= 2d-179) .or. (.not. (sin(ky) <= 4d-156)) .and. (sin(ky) <= 5d-61) .or. (.not. (sin(ky) <= 5d-48)) .and. (sin(ky) <= 2d-10)) then
tmp = sin(th) * (ky / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -2e-49) {
tmp = Math.abs(Math.sin(th));
} else if ((Math.sin(ky) <= 2e-179) || (!(Math.sin(ky) <= 4e-156) && ((Math.sin(ky) <= 5e-61) || (!(Math.sin(ky) <= 5e-48) && (Math.sin(ky) <= 2e-10))))) {
tmp = Math.sin(th) * (ky / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -2e-49: tmp = math.fabs(math.sin(th)) elif (math.sin(ky) <= 2e-179) or (not (math.sin(ky) <= 4e-156) and ((math.sin(ky) <= 5e-61) or (not (math.sin(ky) <= 5e-48) and (math.sin(ky) <= 2e-10)))): tmp = math.sin(th) * (ky / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -2e-49) tmp = abs(sin(th)); elseif ((sin(ky) <= 2e-179) || (!(sin(ky) <= 4e-156) && ((sin(ky) <= 5e-61) || (!(sin(ky) <= 5e-48) && (sin(ky) <= 2e-10))))) tmp = Float64(sin(th) * Float64(ky / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -2e-49) tmp = abs(sin(th)); elseif ((sin(ky) <= 2e-179) || (~((sin(ky) <= 4e-156)) && ((sin(ky) <= 5e-61) || (~((sin(ky) <= 5e-48)) && (sin(ky) <= 2e-10))))) tmp = sin(th) * (ky / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -2e-49], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[Or[LessEqual[N[Sin[ky], $MachinePrecision], 2e-179], And[N[Not[LessEqual[N[Sin[ky], $MachinePrecision], 4e-156]], $MachinePrecision], Or[LessEqual[N[Sin[ky], $MachinePrecision], 5e-61], And[N[Not[LessEqual[N[Sin[ky], $MachinePrecision], 5e-48]], $MachinePrecision], LessEqual[N[Sin[ky], $MachinePrecision], 2e-10]]]]], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -2 \cdot 10^{-49}:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-179} \lor \neg \left(\sin ky \leq 4 \cdot 10^{-156}\right) \land \left(\sin ky \leq 5 \cdot 10^{-61} \lor \neg \left(\sin ky \leq 5 \cdot 10^{-48}\right) \land \sin ky \leq 2 \cdot 10^{-10}\right):\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -1.99999999999999987e-49Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.7%
Simplified99.7%
associate-/r/99.5%
div-inv99.3%
associate-/r*99.5%
Applied egg-rr99.5%
Taylor expanded in kx around 0 2.6%
remove-double-div2.6%
add-sqr-sqrt1.2%
sqrt-unprod27.7%
pow227.7%
Applied egg-rr27.7%
unpow227.7%
rem-sqrt-square35.3%
Simplified35.3%
if -1.99999999999999987e-49 < (sin.f64 ky) < 2e-179 or 4.00000000000000016e-156 < (sin.f64 ky) < 4.9999999999999999e-61 or 4.9999999999999999e-48 < (sin.f64 ky) < 2.00000000000000007e-10Initial program 87.0%
+-commutative87.0%
unpow287.0%
unpow287.0%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 62.6%
if 2e-179 < (sin.f64 ky) < 4.00000000000000016e-156 or 4.9999999999999999e-61 < (sin.f64 ky) < 4.9999999999999999e-48 or 2.00000000000000007e-10 < (sin.f64 ky) Initial program 95.9%
+-commutative95.9%
unpow295.9%
unpow295.9%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 63.4%
Final simplification53.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin th) (/ (sin kx) ky))))
(if (<= (sin ky) -2e-49)
(fabs (sin th))
(if (<= (sin ky) 2e-179)
t_1
(if (<= (sin ky) 4e-156)
(sin th)
(if (<= (sin ky) 5e-61)
t_1
(if (<= (sin ky) 5e-48)
(sin th)
(if (<= (sin ky) 2e-10)
(* (sin th) (/ ky (sin kx)))
(sin th)))))))))
double code(double kx, double ky, double th) {
double t_1 = sin(th) / (sin(kx) / ky);
double tmp;
if (sin(ky) <= -2e-49) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 2e-179) {
tmp = t_1;
} else if (sin(ky) <= 4e-156) {
tmp = sin(th);
} else if (sin(ky) <= 5e-61) {
tmp = t_1;
} else if (sin(ky) <= 5e-48) {
tmp = sin(th);
} else if (sin(ky) <= 2e-10) {
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) :: t_1
real(8) :: tmp
t_1 = sin(th) / (sin(kx) / ky)
if (sin(ky) <= (-2d-49)) then
tmp = abs(sin(th))
else if (sin(ky) <= 2d-179) then
tmp = t_1
else if (sin(ky) <= 4d-156) then
tmp = sin(th)
else if (sin(ky) <= 5d-61) then
tmp = t_1
else if (sin(ky) <= 5d-48) then
tmp = sin(th)
else if (sin(ky) <= 2d-10) 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 t_1 = Math.sin(th) / (Math.sin(kx) / ky);
double tmp;
if (Math.sin(ky) <= -2e-49) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 2e-179) {
tmp = t_1;
} else if (Math.sin(ky) <= 4e-156) {
tmp = Math.sin(th);
} else if (Math.sin(ky) <= 5e-61) {
tmp = t_1;
} else if (Math.sin(ky) <= 5e-48) {
tmp = Math.sin(th);
} else if (Math.sin(ky) <= 2e-10) {
tmp = Math.sin(th) * (ky / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.sin(th) / (math.sin(kx) / ky) tmp = 0 if math.sin(ky) <= -2e-49: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 2e-179: tmp = t_1 elif math.sin(ky) <= 4e-156: tmp = math.sin(th) elif math.sin(ky) <= 5e-61: tmp = t_1 elif math.sin(ky) <= 5e-48: tmp = math.sin(th) elif math.sin(ky) <= 2e-10: tmp = math.sin(th) * (ky / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = Float64(sin(th) / Float64(sin(kx) / ky)) tmp = 0.0 if (sin(ky) <= -2e-49) tmp = abs(sin(th)); elseif (sin(ky) <= 2e-179) tmp = t_1; elseif (sin(ky) <= 4e-156) tmp = sin(th); elseif (sin(ky) <= 5e-61) tmp = t_1; elseif (sin(ky) <= 5e-48) tmp = sin(th); elseif (sin(ky) <= 2e-10) tmp = Float64(sin(th) * Float64(ky / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = sin(th) / (sin(kx) / ky); tmp = 0.0; if (sin(ky) <= -2e-49) tmp = abs(sin(th)); elseif (sin(ky) <= 2e-179) tmp = t_1; elseif (sin(ky) <= 4e-156) tmp = sin(th); elseif (sin(ky) <= 5e-61) tmp = t_1; elseif (sin(ky) <= 5e-48) tmp = sin(th); elseif (sin(ky) <= 2e-10) tmp = sin(th) * (ky / sin(kx)); 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[kx], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Sin[ky], $MachinePrecision], -2e-49], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-179], t$95$1, If[LessEqual[N[Sin[ky], $MachinePrecision], 4e-156], N[Sin[th], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-61], t$95$1, If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-48], N[Sin[th], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-10], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin th}{\frac{\sin kx}{ky}}\\
\mathbf{if}\;\sin ky \leq -2 \cdot 10^{-49}:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-179}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\sin ky \leq 4 \cdot 10^{-156}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-61}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-48}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-10}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -1.99999999999999987e-49Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.7%
Simplified99.7%
associate-/r/99.5%
div-inv99.3%
associate-/r*99.5%
Applied egg-rr99.5%
Taylor expanded in kx around 0 2.6%
remove-double-div2.6%
add-sqr-sqrt1.2%
sqrt-unprod27.7%
pow227.7%
Applied egg-rr27.7%
unpow227.7%
rem-sqrt-square35.3%
Simplified35.3%
if -1.99999999999999987e-49 < (sin.f64 ky) < 2e-179 or 4.00000000000000016e-156 < (sin.f64 ky) < 4.9999999999999999e-61Initial program 85.9%
+-commutative85.9%
unpow285.9%
unpow285.9%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 58.0%
associate-/l*61.7%
Simplified61.7%
if 2e-179 < (sin.f64 ky) < 4.00000000000000016e-156 or 4.9999999999999999e-61 < (sin.f64 ky) < 4.9999999999999999e-48 or 2.00000000000000007e-10 < (sin.f64 ky) Initial program 95.9%
+-commutative95.9%
unpow295.9%
unpow295.9%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 63.4%
if 4.9999999999999999e-48 < (sin.f64 ky) < 2.00000000000000007e-10Initial program 99.8%
+-commutative99.8%
unpow299.8%
unpow299.8%
hypot-def99.8%
Simplified99.8%
Taylor expanded in ky around 0 73.7%
Final simplification53.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.005)
(fabs (sin th))
(if (<= (sin ky) -4e-170)
(/ (* ky th) (hypot (sin ky) (sin kx)))
(if (<= (sin ky) 2e-293)
(* (sin ky) (/ (sin th) (sin kx)))
(if (<= (sin ky) 2e-10)
(* (sin th) (fabs (/ ky (sin kx))))
(sin th))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.005) {
tmp = fabs(sin(th));
} else if (sin(ky) <= -4e-170) {
tmp = (ky * th) / hypot(sin(ky), sin(kx));
} else if (sin(ky) <= 2e-293) {
tmp = sin(ky) * (sin(th) / sin(kx));
} else if (sin(ky) <= 2e-10) {
tmp = sin(th) * fabs((ky / sin(kx)));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.005) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= -4e-170) {
tmp = (ky * th) / Math.hypot(Math.sin(ky), Math.sin(kx));
} else if (Math.sin(ky) <= 2e-293) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
} else if (Math.sin(ky) <= 2e-10) {
tmp = Math.sin(th) * Math.abs((ky / Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.005: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= -4e-170: tmp = (ky * th) / math.hypot(math.sin(ky), math.sin(kx)) elif math.sin(ky) <= 2e-293: tmp = math.sin(ky) * (math.sin(th) / math.sin(kx)) elif math.sin(ky) <= 2e-10: tmp = math.sin(th) * math.fabs((ky / math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.005) tmp = abs(sin(th)); elseif (sin(ky) <= -4e-170) tmp = Float64(Float64(ky * th) / hypot(sin(ky), sin(kx))); elseif (sin(ky) <= 2e-293) tmp = Float64(sin(ky) * Float64(sin(th) / sin(kx))); elseif (sin(ky) <= 2e-10) tmp = Float64(sin(th) * abs(Float64(ky / sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.005) tmp = abs(sin(th)); elseif (sin(ky) <= -4e-170) tmp = (ky * th) / hypot(sin(ky), sin(kx)); elseif (sin(ky) <= 2e-293) tmp = sin(ky) * (sin(th) / sin(kx)); elseif (sin(ky) <= 2e-10) tmp = sin(th) * abs((ky / sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.005], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], -4e-170], N[(N[(ky * th), $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-293], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-10], N[(N[Sin[th], $MachinePrecision] * N[Abs[N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.005:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq -4 \cdot 10^{-170}:\\
\;\;\;\;\frac{ky \cdot th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-293}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-10}:\\
\;\;\;\;\sin th \cdot \left|\frac{ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0050000000000000001Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
associate-/r/99.5%
div-inv99.3%
associate-/r*99.5%
Applied egg-rr99.5%
Taylor expanded in kx around 0 2.6%
remove-double-div2.6%
add-sqr-sqrt1.2%
sqrt-unprod29.9%
pow229.9%
Applied egg-rr29.9%
unpow229.9%
rem-sqrt-square36.8%
Simplified36.8%
if -0.0050000000000000001 < (sin.f64 ky) < -3.99999999999999993e-170Initial program 98.8%
associate-*l/94.5%
+-commutative94.5%
unpow294.5%
unpow294.5%
hypot-def94.7%
Simplified94.7%
Taylor expanded in ky around 0 93.1%
Taylor expanded in th around 0 48.9%
if -3.99999999999999993e-170 < (sin.f64 ky) < 2.0000000000000001e-293Initial program 79.5%
associate-*l/73.4%
associate-*r/79.4%
+-commutative79.4%
unpow279.4%
unpow279.4%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 71.7%
if 2.0000000000000001e-293 < (sin.f64 ky) < 2.00000000000000007e-10Initial program 84.1%
+-commutative84.1%
unpow284.1%
unpow284.1%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 50.8%
add-sqr-sqrt46.6%
sqrt-unprod53.8%
pow253.8%
Applied egg-rr53.8%
unpow253.8%
rem-sqrt-square73.3%
Simplified73.3%
Taylor expanded in ky around 0 73.3%
if 2.00000000000000007e-10 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 63.0%
Final simplification57.0%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.005)
(fabs (sin th))
(if (<= (sin ky) -2e-125)
(/ (* ky th) (hypot (sin ky) (sin kx)))
(if (<= (sin ky) 2e-293)
(fabs (* (sin ky) (/ (sin th) (sin kx))))
(if (<= (sin ky) 2e-10)
(* (sin th) (fabs (/ ky (sin kx))))
(sin th))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.005) {
tmp = fabs(sin(th));
} else if (sin(ky) <= -2e-125) {
tmp = (ky * th) / hypot(sin(ky), sin(kx));
} else if (sin(ky) <= 2e-293) {
tmp = fabs((sin(ky) * (sin(th) / sin(kx))));
} else if (sin(ky) <= 2e-10) {
tmp = sin(th) * fabs((ky / sin(kx)));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.005) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= -2e-125) {
tmp = (ky * th) / Math.hypot(Math.sin(ky), Math.sin(kx));
} else if (Math.sin(ky) <= 2e-293) {
tmp = Math.abs((Math.sin(ky) * (Math.sin(th) / Math.sin(kx))));
} else if (Math.sin(ky) <= 2e-10) {
tmp = Math.sin(th) * Math.abs((ky / Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.005: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= -2e-125: tmp = (ky * th) / math.hypot(math.sin(ky), math.sin(kx)) elif math.sin(ky) <= 2e-293: tmp = math.fabs((math.sin(ky) * (math.sin(th) / math.sin(kx)))) elif math.sin(ky) <= 2e-10: tmp = math.sin(th) * math.fabs((ky / math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.005) tmp = abs(sin(th)); elseif (sin(ky) <= -2e-125) tmp = Float64(Float64(ky * th) / hypot(sin(ky), sin(kx))); elseif (sin(ky) <= 2e-293) tmp = abs(Float64(sin(ky) * Float64(sin(th) / sin(kx)))); elseif (sin(ky) <= 2e-10) tmp = Float64(sin(th) * abs(Float64(ky / sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.005) tmp = abs(sin(th)); elseif (sin(ky) <= -2e-125) tmp = (ky * th) / hypot(sin(ky), sin(kx)); elseif (sin(ky) <= 2e-293) tmp = abs((sin(ky) * (sin(th) / sin(kx)))); elseif (sin(ky) <= 2e-10) tmp = sin(th) * abs((ky / sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.005], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], -2e-125], N[(N[(ky * th), $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-293], N[Abs[N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-10], N[(N[Sin[th], $MachinePrecision] * N[Abs[N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.005:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq -2 \cdot 10^{-125}:\\
\;\;\;\;\frac{ky \cdot th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-293}:\\
\;\;\;\;\left|\sin ky \cdot \frac{\sin th}{\sin kx}\right|\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-10}:\\
\;\;\;\;\sin th \cdot \left|\frac{ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0050000000000000001Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
associate-/r/99.5%
div-inv99.3%
associate-/r*99.5%
Applied egg-rr99.5%
Taylor expanded in kx around 0 2.6%
remove-double-div2.6%
add-sqr-sqrt1.2%
sqrt-unprod29.9%
pow229.9%
Applied egg-rr29.9%
unpow229.9%
rem-sqrt-square36.8%
Simplified36.8%
if -0.0050000000000000001 < (sin.f64 ky) < -2.00000000000000002e-125Initial program 99.6%
associate-*l/99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 97.8%
Taylor expanded in th around 0 48.4%
if -2.00000000000000002e-125 < (sin.f64 ky) < 2.0000000000000001e-293Initial program 82.6%
+-commutative82.6%
unpow282.6%
unpow282.6%
hypot-def99.8%
Simplified99.8%
Taylor expanded in ky around 0 64.4%
add-sqr-sqrt53.7%
sqrt-unprod49.5%
pow249.5%
*-commutative49.5%
Applied egg-rr49.5%
unpow249.5%
rem-sqrt-square71.1%
associate-*r/65.0%
associate-*l/71.1%
Simplified71.1%
if 2.0000000000000001e-293 < (sin.f64 ky) < 2.00000000000000007e-10Initial program 84.1%
+-commutative84.1%
unpow284.1%
unpow284.1%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 50.8%
add-sqr-sqrt46.6%
sqrt-unprod53.8%
pow253.8%
Applied egg-rr53.8%
unpow253.8%
rem-sqrt-square73.3%
Simplified73.3%
Taylor expanded in ky around 0 73.3%
if 2.00000000000000007e-10 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 63.0%
Final simplification57.4%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ ky (sin kx))))
(if (<= (sin ky) -2e-49)
(fabs (sin th))
(if (<= (sin ky) -1.5e-255)
(* (sin th) t_1)
(if (<= (sin ky) 2e-10) (* (sin th) (fabs t_1)) (sin th))))))
double code(double kx, double ky, double th) {
double t_1 = ky / sin(kx);
double tmp;
if (sin(ky) <= -2e-49) {
tmp = fabs(sin(th));
} else if (sin(ky) <= -1.5e-255) {
tmp = sin(th) * t_1;
} else if (sin(ky) <= 2e-10) {
tmp = sin(th) * fabs(t_1);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: t_1
real(8) :: tmp
t_1 = ky / sin(kx)
if (sin(ky) <= (-2d-49)) then
tmp = abs(sin(th))
else if (sin(ky) <= (-1.5d-255)) then
tmp = sin(th) * t_1
else if (sin(ky) <= 2d-10) then
tmp = sin(th) * abs(t_1)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double t_1 = ky / Math.sin(kx);
double tmp;
if (Math.sin(ky) <= -2e-49) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= -1.5e-255) {
tmp = Math.sin(th) * t_1;
} else if (Math.sin(ky) <= 2e-10) {
tmp = Math.sin(th) * Math.abs(t_1);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = ky / math.sin(kx) tmp = 0 if math.sin(ky) <= -2e-49: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= -1.5e-255: tmp = math.sin(th) * t_1 elif math.sin(ky) <= 2e-10: tmp = math.sin(th) * math.fabs(t_1) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = Float64(ky / sin(kx)) tmp = 0.0 if (sin(ky) <= -2e-49) tmp = abs(sin(th)); elseif (sin(ky) <= -1.5e-255) tmp = Float64(sin(th) * t_1); elseif (sin(ky) <= 2e-10) tmp = Float64(sin(th) * abs(t_1)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = ky / sin(kx); tmp = 0.0; if (sin(ky) <= -2e-49) tmp = abs(sin(th)); elseif (sin(ky) <= -1.5e-255) tmp = sin(th) * t_1; elseif (sin(ky) <= 2e-10) tmp = sin(th) * abs(t_1); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Sin[ky], $MachinePrecision], -2e-49], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], -1.5e-255], N[(N[Sin[th], $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-10], N[(N[Sin[th], $MachinePrecision] * N[Abs[t$95$1], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{ky}{\sin kx}\\
\mathbf{if}\;\sin ky \leq -2 \cdot 10^{-49}:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq -1.5 \cdot 10^{-255}:\\
\;\;\;\;\sin th \cdot t_1\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-10}:\\
\;\;\;\;\sin th \cdot \left|t_1\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -1.99999999999999987e-49Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.7%
Simplified99.7%
associate-/r/99.5%
div-inv99.3%
associate-/r*99.5%
Applied egg-rr99.5%
Taylor expanded in kx around 0 2.6%
remove-double-div2.6%
add-sqr-sqrt1.2%
sqrt-unprod27.7%
pow227.7%
Applied egg-rr27.7%
unpow227.7%
rem-sqrt-square35.3%
Simplified35.3%
if -1.99999999999999987e-49 < (sin.f64 ky) < -1.50000000000000001e-255Initial program 88.1%
+-commutative88.1%
unpow288.1%
unpow288.1%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 46.4%
if -1.50000000000000001e-255 < (sin.f64 ky) < 2.00000000000000007e-10Initial program 84.8%
+-commutative84.8%
unpow284.8%
unpow284.8%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 57.4%
add-sqr-sqrt46.3%
sqrt-unprod58.6%
pow258.6%
Applied egg-rr58.6%
unpow258.6%
rem-sqrt-square76.8%
Simplified76.8%
Taylor expanded in ky around 0 76.8%
if 2.00000000000000007e-10 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 63.0%
Final simplification55.0%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -2e-49)
(fabs (sin th))
(if (<= (sin ky) 2e-293)
(* (sin ky) (/ (sin th) (sin kx)))
(if (<= (sin ky) 2e-10) (* (sin th) (fabs (/ ky (sin kx)))) (sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -2e-49) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 2e-293) {
tmp = sin(ky) * (sin(th) / sin(kx));
} else if (sin(ky) <= 2e-10) {
tmp = sin(th) * fabs((ky / sin(kx)));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-2d-49)) then
tmp = abs(sin(th))
else if (sin(ky) <= 2d-293) then
tmp = sin(ky) * (sin(th) / sin(kx))
else if (sin(ky) <= 2d-10) then
tmp = sin(th) * abs((ky / sin(kx)))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -2e-49) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 2e-293) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
} else if (Math.sin(ky) <= 2e-10) {
tmp = Math.sin(th) * Math.abs((ky / Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -2e-49: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 2e-293: tmp = math.sin(ky) * (math.sin(th) / math.sin(kx)) elif math.sin(ky) <= 2e-10: tmp = math.sin(th) * math.fabs((ky / math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -2e-49) tmp = abs(sin(th)); elseif (sin(ky) <= 2e-293) tmp = Float64(sin(ky) * Float64(sin(th) / sin(kx))); elseif (sin(ky) <= 2e-10) tmp = Float64(sin(th) * abs(Float64(ky / sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -2e-49) tmp = abs(sin(th)); elseif (sin(ky) <= 2e-293) tmp = sin(ky) * (sin(th) / sin(kx)); elseif (sin(ky) <= 2e-10) tmp = sin(th) * abs((ky / sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -2e-49], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-293], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-10], N[(N[Sin[th], $MachinePrecision] * N[Abs[N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -2 \cdot 10^{-49}:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-293}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-10}:\\
\;\;\;\;\sin th \cdot \left|\frac{ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -1.99999999999999987e-49Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.7%
Simplified99.7%
associate-/r/99.5%
div-inv99.3%
associate-/r*99.5%
Applied egg-rr99.5%
Taylor expanded in kx around 0 2.6%
remove-double-div2.6%
add-sqr-sqrt1.2%
sqrt-unprod27.7%
pow227.7%
Applied egg-rr27.7%
unpow227.7%
rem-sqrt-square35.3%
Simplified35.3%
if -1.99999999999999987e-49 < (sin.f64 ky) < 2.0000000000000001e-293Initial program 88.3%
associate-*l/81.5%
associate-*r/88.2%
+-commutative88.2%
unpow288.2%
unpow288.2%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 57.1%
if 2.0000000000000001e-293 < (sin.f64 ky) < 2.00000000000000007e-10Initial program 84.1%
+-commutative84.1%
unpow284.1%
unpow284.1%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 50.8%
add-sqr-sqrt46.6%
sqrt-unprod53.8%
pow253.8%
Applied egg-rr53.8%
unpow253.8%
rem-sqrt-square73.3%
Simplified73.3%
Taylor expanded in ky around 0 73.3%
if 2.00000000000000007e-10 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 63.0%
Final simplification55.0%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -2e-49)
(fabs (sin th))
(if (<= (sin ky) -1.5e-255)
(* (sin th) (/ (sin ky) (sin kx)))
(if (<= (sin ky) 2e-10) (* (sin th) (fabs (/ ky (sin kx)))) (sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -2e-49) {
tmp = fabs(sin(th));
} else if (sin(ky) <= -1.5e-255) {
tmp = sin(th) * (sin(ky) / sin(kx));
} else if (sin(ky) <= 2e-10) {
tmp = sin(th) * fabs((ky / sin(kx)));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-2d-49)) then
tmp = abs(sin(th))
else if (sin(ky) <= (-1.5d-255)) then
tmp = sin(th) * (sin(ky) / sin(kx))
else if (sin(ky) <= 2d-10) then
tmp = sin(th) * abs((ky / sin(kx)))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -2e-49) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= -1.5e-255) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.sin(kx));
} else if (Math.sin(ky) <= 2e-10) {
tmp = Math.sin(th) * Math.abs((ky / Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -2e-49: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= -1.5e-255: tmp = math.sin(th) * (math.sin(ky) / math.sin(kx)) elif math.sin(ky) <= 2e-10: tmp = math.sin(th) * math.fabs((ky / math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -2e-49) tmp = abs(sin(th)); elseif (sin(ky) <= -1.5e-255) tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); elseif (sin(ky) <= 2e-10) tmp = Float64(sin(th) * abs(Float64(ky / sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -2e-49) tmp = abs(sin(th)); elseif (sin(ky) <= -1.5e-255) tmp = sin(th) * (sin(ky) / sin(kx)); elseif (sin(ky) <= 2e-10) tmp = sin(th) * abs((ky / sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -2e-49], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], -1.5e-255], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-10], N[(N[Sin[th], $MachinePrecision] * N[Abs[N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -2 \cdot 10^{-49}:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq -1.5 \cdot 10^{-255}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-10}:\\
\;\;\;\;\sin th \cdot \left|\frac{ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -1.99999999999999987e-49Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.7%
Simplified99.7%
associate-/r/99.5%
div-inv99.3%
associate-/r*99.5%
Applied egg-rr99.5%
Taylor expanded in kx around 0 2.6%
remove-double-div2.6%
add-sqr-sqrt1.2%
sqrt-unprod27.7%
pow227.7%
Applied egg-rr27.7%
unpow227.7%
rem-sqrt-square35.3%
Simplified35.3%
if -1.99999999999999987e-49 < (sin.f64 ky) < -1.50000000000000001e-255Initial program 88.1%
+-commutative88.1%
unpow288.1%
unpow288.1%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 46.4%
if -1.50000000000000001e-255 < (sin.f64 ky) < 2.00000000000000007e-10Initial program 84.8%
+-commutative84.8%
unpow284.8%
unpow284.8%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 57.4%
add-sqr-sqrt46.3%
sqrt-unprod58.6%
pow258.6%
Applied egg-rr58.6%
unpow258.6%
rem-sqrt-square76.8%
Simplified76.8%
Taylor expanded in ky around 0 76.8%
if 2.00000000000000007e-10 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 63.0%
Final simplification55.0%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.005)
(fabs (sin th))
(if (<= (sin ky) 2e-10)
(* (sin th) (/ ky (hypot (sin ky) (sin kx))))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.005) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 2e-10) {
tmp = sin(th) * (ky / hypot(sin(ky), sin(kx)));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.005) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 2e-10) {
tmp = Math.sin(th) * (ky / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.005: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 2e-10: tmp = math.sin(th) * (ky / math.hypot(math.sin(ky), math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.005) tmp = abs(sin(th)); elseif (sin(ky) <= 2e-10) tmp = Float64(sin(th) * Float64(ky / hypot(sin(ky), sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.005) tmp = abs(sin(th)); elseif (sin(ky) <= 2e-10) tmp = sin(th) * (ky / hypot(sin(ky), sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.005], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-10], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.005:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-10}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0050000000000000001Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
associate-/r/99.5%
div-inv99.3%
associate-/r*99.5%
Applied egg-rr99.5%
Taylor expanded in kx around 0 2.6%
remove-double-div2.6%
add-sqr-sqrt1.2%
sqrt-unprod29.9%
pow229.9%
Applied egg-rr29.9%
unpow229.9%
rem-sqrt-square36.8%
Simplified36.8%
if -0.0050000000000000001 < (sin.f64 ky) < 2.00000000000000007e-10Initial program 87.8%
associate-*l/83.5%
+-commutative83.5%
unpow283.5%
unpow283.5%
hypot-def91.4%
Simplified91.4%
Taylor expanded in ky around 0 90.9%
*-un-lft-identity90.9%
times-frac99.2%
/-rgt-identity99.2%
Applied egg-rr99.2%
if 2.00000000000000007e-10 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 63.0%
Final simplification72.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -1e-5)
(/ (sin ky) (/ (hypot (sin kx) (sin ky)) th))
(if (<= (sin ky) 2e-10)
(* (sin th) (/ ky (hypot (sin ky) (sin kx))))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -1e-5) {
tmp = sin(ky) / (hypot(sin(kx), sin(ky)) / th);
} else if (sin(ky) <= 2e-10) {
tmp = sin(th) * (ky / hypot(sin(ky), sin(kx)));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -1e-5) {
tmp = Math.sin(ky) / (Math.hypot(Math.sin(kx), Math.sin(ky)) / th);
} else if (Math.sin(ky) <= 2e-10) {
tmp = Math.sin(th) * (ky / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -1e-5: tmp = math.sin(ky) / (math.hypot(math.sin(kx), math.sin(ky)) / th) elif math.sin(ky) <= 2e-10: tmp = math.sin(th) * (ky / math.hypot(math.sin(ky), math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -1e-5) tmp = Float64(sin(ky) / Float64(hypot(sin(kx), sin(ky)) / th)); elseif (sin(ky) <= 2e-10) tmp = Float64(sin(th) * Float64(ky / hypot(sin(ky), sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -1e-5) tmp = sin(ky) / (hypot(sin(kx), sin(ky)) / th); elseif (sin(ky) <= 2e-10) tmp = sin(th) * (ky / hypot(sin(ky), sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -1e-5], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-10], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -1 \cdot 10^{-5}:\\
\;\;\;\;\frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{th}}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-10}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -1.00000000000000008e-5Initial program 99.6%
associate-/r/99.4%
+-commutative99.4%
unpow299.4%
unpow299.4%
hypot-def99.5%
Simplified99.5%
Taylor expanded in th around 0 46.7%
associate-*r/46.7%
unpow246.7%
unpow246.7%
hypot-def46.8%
*-rgt-identity46.8%
hypot-def46.7%
unpow246.7%
unpow246.7%
+-commutative46.7%
unpow246.7%
unpow246.7%
hypot-def46.8%
Simplified46.8%
if -1.00000000000000008e-5 < (sin.f64 ky) < 2.00000000000000007e-10Initial program 87.6%
associate-*l/83.3%
+-commutative83.3%
unpow283.3%
unpow283.3%
hypot-def91.2%
Simplified91.2%
Taylor expanded in ky around 0 91.2%
*-un-lft-identity91.2%
times-frac99.7%
/-rgt-identity99.7%
Applied egg-rr99.7%
if 2.00000000000000007e-10 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 63.0%
Final simplification75.2%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -1e-5)
(/ (sin ky) (/ (hypot (sin kx) (sin ky)) th))
(if (<= (sin ky) 2e-10)
(/ (sin th) (/ (hypot (sin ky) (sin kx)) ky))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -1e-5) {
tmp = sin(ky) / (hypot(sin(kx), sin(ky)) / th);
} else if (sin(ky) <= 2e-10) {
tmp = sin(th) / (hypot(sin(ky), sin(kx)) / ky);
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -1e-5) {
tmp = Math.sin(ky) / (Math.hypot(Math.sin(kx), Math.sin(ky)) / th);
} else if (Math.sin(ky) <= 2e-10) {
tmp = Math.sin(th) / (Math.hypot(Math.sin(ky), Math.sin(kx)) / ky);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -1e-5: tmp = math.sin(ky) / (math.hypot(math.sin(kx), math.sin(ky)) / th) elif math.sin(ky) <= 2e-10: tmp = math.sin(th) / (math.hypot(math.sin(ky), math.sin(kx)) / ky) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -1e-5) tmp = Float64(sin(ky) / Float64(hypot(sin(kx), sin(ky)) / th)); elseif (sin(ky) <= 2e-10) tmp = Float64(sin(th) / Float64(hypot(sin(ky), sin(kx)) / ky)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -1e-5) tmp = sin(ky) / (hypot(sin(kx), sin(ky)) / th); elseif (sin(ky) <= 2e-10) tmp = sin(th) / (hypot(sin(ky), sin(kx)) / ky); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -1e-5], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-10], N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -1 \cdot 10^{-5}:\\
\;\;\;\;\frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{th}}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-10}:\\
\;\;\;\;\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -1.00000000000000008e-5Initial program 99.6%
associate-/r/99.4%
+-commutative99.4%
unpow299.4%
unpow299.4%
hypot-def99.5%
Simplified99.5%
Taylor expanded in th around 0 46.7%
associate-*r/46.7%
unpow246.7%
unpow246.7%
hypot-def46.8%
*-rgt-identity46.8%
hypot-def46.7%
unpow246.7%
unpow246.7%
+-commutative46.7%
unpow246.7%
unpow246.7%
hypot-def46.8%
Simplified46.8%
if -1.00000000000000008e-5 < (sin.f64 ky) < 2.00000000000000007e-10Initial program 87.6%
associate-*l/83.3%
+-commutative83.3%
unpow283.3%
unpow283.3%
hypot-def91.2%
Simplified91.2%
Taylor expanded in ky around 0 91.2%
expm1-log1p-u91.2%
expm1-udef30.5%
*-un-lft-identity30.5%
times-frac30.5%
/-rgt-identity30.5%
Applied egg-rr30.5%
expm1-def99.7%
expm1-log1p99.7%
*-rgt-identity99.7%
associate-*l/99.7%
associate-*r/99.6%
*-commutative99.6%
associate-/r/99.5%
associate-*r/99.7%
*-rgt-identity99.7%
Simplified99.7%
if 2.00000000000000007e-10 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 63.0%
Final simplification75.2%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (hypot (sin ky) (sin kx))))
(if (<= (sin ky) -1e-5)
(/ (* (sin ky) th) t_1)
(if (<= (sin ky) 2e-10) (/ (sin th) (/ t_1 ky)) (sin th)))))
double code(double kx, double ky, double th) {
double t_1 = hypot(sin(ky), sin(kx));
double tmp;
if (sin(ky) <= -1e-5) {
tmp = (sin(ky) * th) / t_1;
} else if (sin(ky) <= 2e-10) {
tmp = sin(th) / (t_1 / ky);
} else {
tmp = sin(th);
}
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 (Math.sin(ky) <= -1e-5) {
tmp = (Math.sin(ky) * th) / t_1;
} else if (Math.sin(ky) <= 2e-10) {
tmp = Math.sin(th) / (t_1 / ky);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.hypot(math.sin(ky), math.sin(kx)) tmp = 0 if math.sin(ky) <= -1e-5: tmp = (math.sin(ky) * th) / t_1 elif math.sin(ky) <= 2e-10: tmp = math.sin(th) / (t_1 / ky) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)) tmp = 0.0 if (sin(ky) <= -1e-5) tmp = Float64(Float64(sin(ky) * th) / t_1); elseif (sin(ky) <= 2e-10) tmp = Float64(sin(th) / Float64(t_1 / ky)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)); tmp = 0.0; if (sin(ky) <= -1e-5) tmp = (sin(ky) * th) / t_1; elseif (sin(ky) <= 2e-10) tmp = sin(th) / (t_1 / ky); else tmp = sin(th); 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[N[Sin[ky], $MachinePrecision], -1e-5], N[(N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-10], N[(N[Sin[th], $MachinePrecision] / N[(t$95$1 / ky), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\
\mathbf{if}\;\sin ky \leq -1 \cdot 10^{-5}:\\
\;\;\;\;\frac{\sin ky \cdot th}{t_1}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-10}:\\
\;\;\;\;\frac{\sin th}{\frac{t_1}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -1.00000000000000008e-5Initial program 99.6%
associate-*l/99.4%
+-commutative99.4%
unpow299.4%
unpow299.4%
hypot-def99.5%
Simplified99.5%
Taylor expanded in th around 0 46.9%
if -1.00000000000000008e-5 < (sin.f64 ky) < 2.00000000000000007e-10Initial program 87.6%
associate-*l/83.3%
+-commutative83.3%
unpow283.3%
unpow283.3%
hypot-def91.2%
Simplified91.2%
Taylor expanded in ky around 0 91.2%
expm1-log1p-u91.2%
expm1-udef30.5%
*-un-lft-identity30.5%
times-frac30.5%
/-rgt-identity30.5%
Applied egg-rr30.5%
expm1-def99.7%
expm1-log1p99.7%
*-rgt-identity99.7%
associate-*l/99.7%
associate-*r/99.6%
*-commutative99.6%
associate-/r/99.5%
associate-*r/99.7%
*-rgt-identity99.7%
Simplified99.7%
if 2.00000000000000007e-10 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 63.0%
Final simplification75.2%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (hypot (sin ky) (sin kx))))
(if (<= (sin ky) -1e-5)
(/ (/ (sin ky) t_1) (+ (/ 1.0 th) (* th 0.16666666666666666)))
(if (<= (sin ky) 2e-10) (/ (sin th) (/ t_1 ky)) (sin th)))))
double code(double kx, double ky, double th) {
double t_1 = hypot(sin(ky), sin(kx));
double tmp;
if (sin(ky) <= -1e-5) {
tmp = (sin(ky) / t_1) / ((1.0 / th) + (th * 0.16666666666666666));
} else if (sin(ky) <= 2e-10) {
tmp = sin(th) / (t_1 / ky);
} else {
tmp = sin(th);
}
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 (Math.sin(ky) <= -1e-5) {
tmp = (Math.sin(ky) / t_1) / ((1.0 / th) + (th * 0.16666666666666666));
} else if (Math.sin(ky) <= 2e-10) {
tmp = Math.sin(th) / (t_1 / ky);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.hypot(math.sin(ky), math.sin(kx)) tmp = 0 if math.sin(ky) <= -1e-5: tmp = (math.sin(ky) / t_1) / ((1.0 / th) + (th * 0.16666666666666666)) elif math.sin(ky) <= 2e-10: tmp = math.sin(th) / (t_1 / ky) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)) tmp = 0.0 if (sin(ky) <= -1e-5) tmp = Float64(Float64(sin(ky) / t_1) / Float64(Float64(1.0 / th) + Float64(th * 0.16666666666666666))); elseif (sin(ky) <= 2e-10) tmp = Float64(sin(th) / Float64(t_1 / ky)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)); tmp = 0.0; if (sin(ky) <= -1e-5) tmp = (sin(ky) / t_1) / ((1.0 / th) + (th * 0.16666666666666666)); elseif (sin(ky) <= 2e-10) tmp = sin(th) / (t_1 / ky); else tmp = sin(th); 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[N[Sin[ky], $MachinePrecision], -1e-5], N[(N[(N[Sin[ky], $MachinePrecision] / t$95$1), $MachinePrecision] / N[(N[(1.0 / th), $MachinePrecision] + N[(th * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-10], N[(N[Sin[th], $MachinePrecision] / N[(t$95$1 / ky), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\
\mathbf{if}\;\sin ky \leq -1 \cdot 10^{-5}:\\
\;\;\;\;\frac{\frac{\sin ky}{t_1}}{\frac{1}{th} + th \cdot 0.16666666666666666}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-10}:\\
\;\;\;\;\frac{\sin th}{\frac{t_1}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -1.00000000000000008e-5Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.7%
Simplified99.7%
associate-/r/99.5%
div-inv99.3%
associate-/r*99.5%
Applied egg-rr99.5%
Taylor expanded in th around 0 47.6%
*-commutative3.7%
Simplified47.6%
if -1.00000000000000008e-5 < (sin.f64 ky) < 2.00000000000000007e-10Initial program 87.6%
associate-*l/83.3%
+-commutative83.3%
unpow283.3%
unpow283.3%
hypot-def91.2%
Simplified91.2%
Taylor expanded in ky around 0 91.2%
expm1-log1p-u91.2%
expm1-udef30.5%
*-un-lft-identity30.5%
times-frac30.5%
/-rgt-identity30.5%
Applied egg-rr30.5%
expm1-def99.7%
expm1-log1p99.7%
*-rgt-identity99.7%
associate-*l/99.7%
associate-*r/99.6%
*-commutative99.6%
associate-/r/99.5%
associate-*r/99.7%
*-rgt-identity99.7%
Simplified99.7%
if 2.00000000000000007e-10 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 63.0%
Final simplification75.5%
(FPCore (kx ky th) :precision binary64 (* (sin ky) (/ (sin th) (hypot (sin ky) (sin kx)))))
double code(double kx, double ky, double th) {
return sin(ky) * (sin(th) / hypot(sin(ky), sin(kx)));
}
public static double code(double kx, double ky, double th) {
return Math.sin(ky) * (Math.sin(th) / Math.hypot(Math.sin(ky), Math.sin(kx)));
}
def code(kx, ky, th): return math.sin(ky) * (math.sin(th) / math.hypot(math.sin(ky), math.sin(kx)))
function code(kx, ky, th) return Float64(sin(ky) * Float64(sin(th) / hypot(sin(ky), sin(kx)))) end
function tmp = code(kx, ky, th) tmp = sin(ky) * (sin(th) / hypot(sin(ky), sin(kx))); end
code[kx_, ky_, th_] := N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}
\end{array}
Initial program 94.1%
associate-*l/92.1%
associate-*r/94.0%
+-commutative94.0%
unpow294.0%
unpow294.0%
hypot-def99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (fabs (sin th))))
(if (<= th -4e+189)
t_1
(if (<= th -9.5e-126)
(sin th)
(if (or (<= th -1.8e-204) (not (<= th 2e+154)))
t_1
(/ (sin th) (+ 1.0 (/ (* 0.5 (* kx kx)) (* ky ky)))))))))
double code(double kx, double ky, double th) {
double t_1 = fabs(sin(th));
double tmp;
if (th <= -4e+189) {
tmp = t_1;
} else if (th <= -9.5e-126) {
tmp = sin(th);
} else if ((th <= -1.8e-204) || !(th <= 2e+154)) {
tmp = t_1;
} else {
tmp = sin(th) / (1.0 + ((0.5 * (kx * kx)) / (ky * 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) :: t_1
real(8) :: tmp
t_1 = abs(sin(th))
if (th <= (-4d+189)) then
tmp = t_1
else if (th <= (-9.5d-126)) then
tmp = sin(th)
else if ((th <= (-1.8d-204)) .or. (.not. (th <= 2d+154))) then
tmp = t_1
else
tmp = sin(th) / (1.0d0 + ((0.5d0 * (kx * kx)) / (ky * ky)))
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 (th <= -4e+189) {
tmp = t_1;
} else if (th <= -9.5e-126) {
tmp = Math.sin(th);
} else if ((th <= -1.8e-204) || !(th <= 2e+154)) {
tmp = t_1;
} else {
tmp = Math.sin(th) / (1.0 + ((0.5 * (kx * kx)) / (ky * ky)));
}
return tmp;
}
def code(kx, ky, th): t_1 = math.fabs(math.sin(th)) tmp = 0 if th <= -4e+189: tmp = t_1 elif th <= -9.5e-126: tmp = math.sin(th) elif (th <= -1.8e-204) or not (th <= 2e+154): tmp = t_1 else: tmp = math.sin(th) / (1.0 + ((0.5 * (kx * kx)) / (ky * ky))) return tmp
function code(kx, ky, th) t_1 = abs(sin(th)) tmp = 0.0 if (th <= -4e+189) tmp = t_1; elseif (th <= -9.5e-126) tmp = sin(th); elseif ((th <= -1.8e-204) || !(th <= 2e+154)) tmp = t_1; else tmp = Float64(sin(th) / Float64(1.0 + Float64(Float64(0.5 * Float64(kx * kx)) / Float64(ky * ky)))); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = abs(sin(th)); tmp = 0.0; if (th <= -4e+189) tmp = t_1; elseif (th <= -9.5e-126) tmp = sin(th); elseif ((th <= -1.8e-204) || ~((th <= 2e+154))) tmp = t_1; else tmp = sin(th) / (1.0 + ((0.5 * (kx * kx)) / (ky * ky))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[th, -4e+189], t$95$1, If[LessEqual[th, -9.5e-126], N[Sin[th], $MachinePrecision], If[Or[LessEqual[th, -1.8e-204], N[Not[LessEqual[th, 2e+154]], $MachinePrecision]], t$95$1, N[(N[Sin[th], $MachinePrecision] / N[(1.0 + N[(N[(0.5 * N[(kx * kx), $MachinePrecision]), $MachinePrecision] / N[(ky * ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|\sin th\right|\\
\mathbf{if}\;th \leq -4 \cdot 10^{+189}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;th \leq -9.5 \cdot 10^{-126}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;th \leq -1.8 \cdot 10^{-204} \lor \neg \left(th \leq 2 \cdot 10^{+154}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th}{1 + \frac{0.5 \cdot \left(kx \cdot kx\right)}{ky \cdot ky}}\\
\end{array}
\end{array}
if th < -4.0000000000000001e189 or -9.5000000000000003e-126 < th < -1.79999999999999982e-204 or 2.00000000000000007e154 < th Initial program 96.2%
+-commutative96.2%
unpow296.2%
unpow296.2%
hypot-def99.7%
Simplified99.7%
associate-/r/99.5%
div-inv99.4%
associate-/r*99.6%
Applied egg-rr99.6%
Taylor expanded in kx around 0 14.2%
remove-double-div14.2%
add-sqr-sqrt6.0%
sqrt-unprod28.7%
pow228.7%
Applied egg-rr28.7%
unpow228.7%
rem-sqrt-square34.8%
Simplified34.8%
if -4.0000000000000001e189 < th < -9.5000000000000003e-126Initial program 89.5%
+-commutative89.5%
unpow289.5%
unpow289.5%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 39.9%
if -1.79999999999999982e-204 < th < 2.00000000000000007e154Initial program 95.4%
+-commutative95.4%
unpow295.4%
unpow295.4%
hypot-def99.7%
Simplified99.7%
associate-*l/92.8%
associate-*r/99.5%
expm1-log1p-u99.5%
expm1-udef34.5%
Applied egg-rr34.5%
expm1-def99.5%
expm1-log1p99.5%
*-commutative99.5%
associate-/r/99.7%
Simplified99.7%
Taylor expanded in kx around 0 31.3%
associate-*r/31.3%
unpow231.3%
Simplified31.3%
Taylor expanded in ky around 0 31.4%
associate-*r/31.4%
unpow231.4%
unpow231.4%
Simplified31.4%
Final simplification34.8%
(FPCore (kx ky th)
:precision binary64
(if (<= ky -0.047)
(sin th)
(if (<= ky 1.92e-227)
(* 2.0 (/ (sin th) (/ (* kx kx) (* ky ky))))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -0.047) {
tmp = sin(th);
} else if (ky <= 1.92e-227) {
tmp = 2.0 * (sin(th) / ((kx * kx) / (ky * ky)));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= (-0.047d0)) then
tmp = sin(th)
else if (ky <= 1.92d-227) then
tmp = 2.0d0 * (sin(th) / ((kx * kx) / (ky * ky)))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= -0.047) {
tmp = Math.sin(th);
} else if (ky <= 1.92e-227) {
tmp = 2.0 * (Math.sin(th) / ((kx * kx) / (ky * ky)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -0.047: tmp = math.sin(th) elif ky <= 1.92e-227: tmp = 2.0 * (math.sin(th) / ((kx * kx) / (ky * ky))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -0.047) tmp = sin(th); elseif (ky <= 1.92e-227) tmp = Float64(2.0 * Float64(sin(th) / Float64(Float64(kx * kx) / Float64(ky * ky)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -0.047) tmp = sin(th); elseif (ky <= 1.92e-227) tmp = 2.0 * (sin(th) / ((kx * kx) / (ky * ky))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -0.047], N[Sin[th], $MachinePrecision], If[LessEqual[ky, 1.92e-227], N[(2.0 * N[(N[Sin[th], $MachinePrecision] / N[(N[(kx * kx), $MachinePrecision] / N[(ky * ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -0.047:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 1.92 \cdot 10^{-227}:\\
\;\;\;\;2 \cdot \frac{\sin th}{\frac{kx \cdot kx}{ky \cdot ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -0.047 or 1.92000000000000002e-227 < ky Initial program 95.3%
+-commutative95.3%
unpow295.3%
unpow295.3%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 32.5%
if -0.047 < ky < 1.92000000000000002e-227Initial program 91.4%
+-commutative91.4%
unpow291.4%
unpow291.4%
hypot-def99.7%
Simplified99.7%
associate-*l/92.3%
associate-*r/99.7%
expm1-log1p-u99.7%
expm1-udef35.2%
Applied egg-rr35.2%
expm1-def99.7%
expm1-log1p99.7%
*-commutative99.7%
associate-/r/99.7%
Simplified99.7%
Taylor expanded in kx around 0 21.1%
associate-*r/21.1%
unpow221.1%
Simplified21.1%
Taylor expanded in ky around 0 20.9%
associate-/l*20.9%
unpow220.9%
unpow220.9%
Simplified20.9%
Final simplification29.2%
(FPCore (kx ky th)
:precision binary64
(if (<= ky -0.00122)
(sin th)
(if (<= ky 2.3e-223)
(* (/ 2.0 kx) (/ (* (sin th) (* ky ky)) kx))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -0.00122) {
tmp = sin(th);
} else if (ky <= 2.3e-223) {
tmp = (2.0 / kx) * ((sin(th) * (ky * ky)) / 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 <= (-0.00122d0)) then
tmp = sin(th)
else if (ky <= 2.3d-223) then
tmp = (2.0d0 / kx) * ((sin(th) * (ky * ky)) / 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 <= -0.00122) {
tmp = Math.sin(th);
} else if (ky <= 2.3e-223) {
tmp = (2.0 / kx) * ((Math.sin(th) * (ky * ky)) / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -0.00122: tmp = math.sin(th) elif ky <= 2.3e-223: tmp = (2.0 / kx) * ((math.sin(th) * (ky * ky)) / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -0.00122) tmp = sin(th); elseif (ky <= 2.3e-223) tmp = Float64(Float64(2.0 / kx) * Float64(Float64(sin(th) * Float64(ky * ky)) / kx)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -0.00122) tmp = sin(th); elseif (ky <= 2.3e-223) tmp = (2.0 / kx) * ((sin(th) * (ky * ky)) / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -0.00122], N[Sin[th], $MachinePrecision], If[LessEqual[ky, 2.3e-223], N[(N[(2.0 / kx), $MachinePrecision] * N[(N[(N[Sin[th], $MachinePrecision] * N[(ky * ky), $MachinePrecision]), $MachinePrecision] / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -0.00122:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 2.3 \cdot 10^{-223}:\\
\;\;\;\;\frac{2}{kx} \cdot \frac{\sin th \cdot \left(ky \cdot ky\right)}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -0.00121999999999999995 or 2.3e-223 < ky Initial program 95.3%
+-commutative95.3%
unpow295.3%
unpow295.3%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 32.5%
if -0.00121999999999999995 < ky < 2.3e-223Initial program 91.4%
+-commutative91.4%
unpow291.4%
unpow291.4%
hypot-def99.7%
Simplified99.7%
associate-*l/92.3%
associate-*r/99.7%
expm1-log1p-u99.7%
expm1-udef35.2%
Applied egg-rr35.2%
expm1-def99.7%
expm1-log1p99.7%
*-commutative99.7%
associate-/r/99.7%
Simplified99.7%
Taylor expanded in kx around 0 21.1%
associate-*r/21.1%
unpow221.1%
Simplified21.1%
Taylor expanded in ky around 0 20.9%
associate-*r/20.9%
unpow220.9%
times-frac21.4%
*-commutative21.4%
unpow221.4%
Simplified21.4%
Final simplification29.3%
(FPCore (kx ky th) :precision binary64 (if (<= ky 4e-221) (/ (sin th) (+ 1.0 (/ (* 0.5 (* kx kx)) (* ky ky)))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 4e-221) {
tmp = sin(th) / (1.0 + ((0.5 * (kx * kx)) / (ky * ky)));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= 4d-221) then
tmp = sin(th) / (1.0d0 + ((0.5d0 * (kx * kx)) / (ky * ky)))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 4e-221) {
tmp = Math.sin(th) / (1.0 + ((0.5 * (kx * kx)) / (ky * ky)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 4e-221: tmp = math.sin(th) / (1.0 + ((0.5 * (kx * kx)) / (ky * ky))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 4e-221) tmp = Float64(sin(th) / Float64(1.0 + Float64(Float64(0.5 * Float64(kx * kx)) / Float64(ky * ky)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 4e-221) tmp = sin(th) / (1.0 + ((0.5 * (kx * kx)) / (ky * ky))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 4e-221], N[(N[Sin[th], $MachinePrecision] / N[(1.0 + N[(N[(0.5 * N[(kx * kx), $MachinePrecision]), $MachinePrecision] / N[(ky * ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 4 \cdot 10^{-221}:\\
\;\;\;\;\frac{\sin th}{1 + \frac{0.5 \cdot \left(kx \cdot kx\right)}{ky \cdot ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 4.00000000000000007e-221Initial program 95.6%
+-commutative95.6%
unpow295.6%
unpow295.6%
hypot-def99.7%
Simplified99.7%
associate-*l/96.0%
associate-*r/99.6%
expm1-log1p-u99.5%
expm1-udef49.5%
Applied egg-rr49.5%
expm1-def99.5%
expm1-log1p99.6%
*-commutative99.6%
associate-/r/99.7%
Simplified99.7%
Taylor expanded in kx around 0 25.2%
associate-*r/25.2%
unpow225.2%
Simplified25.2%
Taylor expanded in ky around 0 25.7%
associate-*r/25.7%
unpow225.7%
unpow225.7%
Simplified25.7%
if 4.00000000000000007e-221 < ky Initial program 92.1%
+-commutative92.1%
unpow292.1%
unpow292.1%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 32.9%
Final simplification28.7%
(FPCore (kx ky th) :precision binary64 (if (<= ky -5e-24) (sin th) (if (<= ky 1.15e-193) (/ (* ky th) (sin ky)) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -5e-24) {
tmp = sin(th);
} else if (ky <= 1.15e-193) {
tmp = (ky * th) / sin(ky);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= (-5d-24)) then
tmp = sin(th)
else if (ky <= 1.15d-193) then
tmp = (ky * th) / sin(ky)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= -5e-24) {
tmp = Math.sin(th);
} else if (ky <= 1.15e-193) {
tmp = (ky * th) / Math.sin(ky);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -5e-24: tmp = math.sin(th) elif ky <= 1.15e-193: tmp = (ky * th) / math.sin(ky) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -5e-24) tmp = sin(th); elseif (ky <= 1.15e-193) tmp = Float64(Float64(ky * th) / sin(ky)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -5e-24) tmp = sin(th); elseif (ky <= 1.15e-193) tmp = (ky * th) / sin(ky); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -5e-24], N[Sin[th], $MachinePrecision], If[LessEqual[ky, 1.15e-193], N[(N[(ky * th), $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -5 \cdot 10^{-24}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 1.15 \cdot 10^{-193}:\\
\;\;\;\;\frac{ky \cdot th}{\sin ky}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -4.9999999999999998e-24 or 1.15000000000000004e-193 < ky Initial program 96.9%
+-commutative96.9%
unpow296.9%
unpow296.9%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 31.0%
if -4.9999999999999998e-24 < ky < 1.15000000000000004e-193Initial program 86.8%
associate-*l/82.0%
+-commutative82.0%
unpow282.0%
unpow282.0%
hypot-def89.7%
Simplified89.7%
Taylor expanded in ky around 0 89.7%
Taylor expanded in kx around 0 24.7%
Taylor expanded in th around 0 23.5%
Final simplification29.0%
(FPCore (kx ky th) :precision binary64 (if (<= ky -8000000000.0) (sin th) (if (<= ky 1.55e-294) (sqrt (* th th)) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -8000000000.0) {
tmp = sin(th);
} else if (ky <= 1.55e-294) {
tmp = sqrt((th * 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 <= (-8000000000.0d0)) then
tmp = sin(th)
else if (ky <= 1.55d-294) then
tmp = sqrt((th * 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 <= -8000000000.0) {
tmp = Math.sin(th);
} else if (ky <= 1.55e-294) {
tmp = Math.sqrt((th * th));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -8000000000.0: tmp = math.sin(th) elif ky <= 1.55e-294: tmp = math.sqrt((th * th)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -8000000000.0) tmp = sin(th); elseif (ky <= 1.55e-294) tmp = sqrt(Float64(th * th)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -8000000000.0) tmp = sin(th); elseif (ky <= 1.55e-294) tmp = sqrt((th * th)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -8000000000.0], N[Sin[th], $MachinePrecision], If[LessEqual[ky, 1.55e-294], N[Sqrt[N[(th * th), $MachinePrecision]], $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -8000000000:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 1.55 \cdot 10^{-294}:\\
\;\;\;\;\sqrt{th \cdot th}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -8e9 or 1.55000000000000002e-294 < ky Initial program 94.6%
+-commutative94.6%
unpow294.6%
unpow294.6%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 31.0%
if -8e9 < ky < 1.55000000000000002e-294Initial program 92.7%
+-commutative92.7%
unpow292.7%
unpow292.7%
hypot-def99.8%
Simplified99.8%
associate-/r/99.7%
div-inv99.4%
associate-/r*99.6%
Applied egg-rr99.6%
Taylor expanded in kx around 0 3.6%
Taylor expanded in th around 0 3.8%
remove-double-div3.8%
add-sqr-sqrt1.5%
sqrt-unprod19.1%
Applied egg-rr19.1%
Final simplification28.2%
(FPCore (kx ky th) :precision binary64 (sin th))
double code(double kx, double ky, double th) {
return sin(th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = sin(th)
end function
public static double code(double kx, double ky, double th) {
return Math.sin(th);
}
def code(kx, ky, th): return math.sin(th)
function code(kx, ky, th) return sin(th) end
function tmp = code(kx, ky, th) tmp = sin(th); end
code[kx_, ky_, th_] := N[Sin[th], $MachinePrecision]
\begin{array}{l}
\\
\sin th
\end{array}
Initial program 94.1%
+-commutative94.1%
unpow294.1%
unpow294.1%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 24.6%
Final simplification24.6%
(FPCore (kx ky th) :precision binary64 (/ 1.0 (+ (/ 1.0 th) (* th 0.16666666666666666))))
double code(double kx, double ky, double th) {
return 1.0 / ((1.0 / th) + (th * 0.16666666666666666));
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = 1.0d0 / ((1.0d0 / th) + (th * 0.16666666666666666d0))
end function
public static double code(double kx, double ky, double th) {
return 1.0 / ((1.0 / th) + (th * 0.16666666666666666));
}
def code(kx, ky, th): return 1.0 / ((1.0 / th) + (th * 0.16666666666666666))
function code(kx, ky, th) return Float64(1.0 / Float64(Float64(1.0 / th) + Float64(th * 0.16666666666666666))) end
function tmp = code(kx, ky, th) tmp = 1.0 / ((1.0 / th) + (th * 0.16666666666666666)); end
code[kx_, ky_, th_] := N[(1.0 / N[(N[(1.0 / th), $MachinePrecision] + N[(th * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\frac{1}{th} + th \cdot 0.16666666666666666}
\end{array}
Initial program 94.1%
+-commutative94.1%
unpow294.1%
unpow294.1%
hypot-def99.7%
Simplified99.7%
associate-/r/99.5%
div-inv99.4%
associate-/r*99.5%
Applied egg-rr99.5%
Taylor expanded in kx around 0 24.5%
Taylor expanded in th around 0 15.0%
*-commutative15.0%
Simplified15.0%
Final simplification15.0%
(FPCore (kx ky th) :precision binary64 th)
double code(double kx, double ky, double th) {
return th;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = th
end function
public static double code(double kx, double ky, double th) {
return th;
}
def code(kx, ky, th): return th
function code(kx, ky, th) return th end
function tmp = code(kx, ky, th) tmp = th; end
code[kx_, ky_, th_] := th
\begin{array}{l}
\\
th
\end{array}
Initial program 94.1%
+-commutative94.1%
unpow294.1%
unpow294.1%
hypot-def99.7%
Simplified99.7%
associate-/r/99.5%
div-inv99.4%
associate-/r*99.5%
Applied egg-rr99.5%
Taylor expanded in kx around 0 24.5%
Taylor expanded in th around 0 14.6%
Final simplification14.6%
herbie shell --seed 2023187
(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)))