
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 21 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\end{array}
(FPCore (kx ky th) :precision binary64 (/ (sin th) (/ (hypot (sin ky) (sin kx)) (sin ky))))
double code(double kx, double ky, double th) {
return sin(th) / (hypot(sin(ky), sin(kx)) / sin(ky));
}
public static double code(double kx, double ky, double th) {
return Math.sin(th) / (Math.hypot(Math.sin(ky), Math.sin(kx)) / Math.sin(ky));
}
def code(kx, ky, th): return math.sin(th) / (math.hypot(math.sin(ky), math.sin(kx)) / math.sin(ky))
function code(kx, ky, th) return Float64(sin(th) / Float64(hypot(sin(ky), sin(kx)) / sin(ky))) end
function tmp = code(kx, ky, th) tmp = sin(th) / (hypot(sin(ky), sin(kx)) / sin(ky)); end
code[kx_, ky_, th_] := N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{\sin ky}}
\end{array}
Initial program 92.8%
unpow292.8%
sqr-neg92.8%
sin-neg92.8%
sin-neg92.8%
unpow292.8%
associate-*l/91.0%
associate-/l*92.7%
+-commutative92.7%
unpow292.7%
sin-neg92.7%
sin-neg92.7%
Simplified99.6%
associate-*r/95.7%
hypot-undefine91.0%
unpow291.0%
unpow291.0%
+-commutative91.0%
associate-*l/92.8%
*-commutative92.8%
clear-num92.7%
un-div-inv92.8%
+-commutative92.8%
unpow292.8%
unpow292.8%
hypot-undefine99.7%
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.05)
(fabs (sin th))
(if (or (<= (sin ky) 5e-165)
(and (not (<= (sin ky) 4e-140)) (<= (sin ky) 5e-107)))
(* ky (/ (sin th) (sin kx)))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.05) {
tmp = fabs(sin(th));
} else if ((sin(ky) <= 5e-165) || (!(sin(ky) <= 4e-140) && (sin(ky) <= 5e-107))) {
tmp = ky * (sin(th) / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.05d0)) then
tmp = abs(sin(th))
else if ((sin(ky) <= 5d-165) .or. (.not. (sin(ky) <= 4d-140)) .and. (sin(ky) <= 5d-107)) then
tmp = ky * (sin(th) / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.05) {
tmp = Math.abs(Math.sin(th));
} else if ((Math.sin(ky) <= 5e-165) || (!(Math.sin(ky) <= 4e-140) && (Math.sin(ky) <= 5e-107))) {
tmp = ky * (Math.sin(th) / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.05: tmp = math.fabs(math.sin(th)) elif (math.sin(ky) <= 5e-165) or (not (math.sin(ky) <= 4e-140) and (math.sin(ky) <= 5e-107)): tmp = ky * (math.sin(th) / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.05) tmp = abs(sin(th)); elseif ((sin(ky) <= 5e-165) || (!(sin(ky) <= 4e-140) && (sin(ky) <= 5e-107))) tmp = Float64(ky * Float64(sin(th) / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.05) tmp = abs(sin(th)); elseif ((sin(ky) <= 5e-165) || (~((sin(ky) <= 4e-140)) && (sin(ky) <= 5e-107))) tmp = ky * (sin(th) / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.05], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[Or[LessEqual[N[Sin[ky], $MachinePrecision], 5e-165], And[N[Not[LessEqual[N[Sin[ky], $MachinePrecision], 4e-140]], $MachinePrecision], LessEqual[N[Sin[ky], $MachinePrecision], 5e-107]]], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.05:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-165} \lor \neg \left(\sin ky \leq 4 \cdot 10^{-140}\right) \land \sin ky \leq 5 \cdot 10^{-107}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.050000000000000003Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.4%
associate-/l*99.4%
+-commutative99.4%
unpow299.4%
sin-neg99.4%
sin-neg99.4%
Simplified99.6%
Taylor expanded in kx around 0 2.5%
add-sqr-sqrt1.6%
sqrt-unprod27.8%
pow227.8%
Applied egg-rr27.8%
unpow227.8%
rem-sqrt-square30.9%
associate-*r/31.0%
associate-*l/31.0%
*-inverses31.0%
*-lft-identity31.0%
Simplified31.0%
if -0.050000000000000003 < (sin.f64 ky) < 4.99999999999999981e-165 or 3.9999999999999999e-140 < (sin.f64 ky) < 4.99999999999999971e-107Initial program 82.8%
unpow282.8%
sqr-neg82.8%
sin-neg82.8%
sin-neg82.8%
unpow282.8%
associate-*l/80.1%
associate-/l*82.7%
+-commutative82.7%
unpow282.7%
sin-neg82.7%
sin-neg82.7%
Simplified99.7%
Taylor expanded in ky around 0 45.1%
associate-/l*47.8%
Simplified47.8%
if 4.99999999999999981e-165 < (sin.f64 ky) < 3.9999999999999999e-140 or 4.99999999999999971e-107 < (sin.f64 ky) Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/97.8%
associate-/l*99.6%
+-commutative99.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
Simplified99.6%
Taylor expanded in kx around 0 65.5%
Final simplification50.1%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.05)
(fabs (sin th))
(if (or (<= (sin ky) 5e-165)
(and (not (<= (sin ky) 4e-140)) (<= (sin ky) 5e-107)))
(/ (sin th) (/ (sin kx) ky))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.05) {
tmp = fabs(sin(th));
} else if ((sin(ky) <= 5e-165) || (!(sin(ky) <= 4e-140) && (sin(ky) <= 5e-107))) {
tmp = sin(th) / (sin(kx) / ky);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.05d0)) then
tmp = abs(sin(th))
else if ((sin(ky) <= 5d-165) .or. (.not. (sin(ky) <= 4d-140)) .and. (sin(ky) <= 5d-107)) then
tmp = sin(th) / (sin(kx) / ky)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.05) {
tmp = Math.abs(Math.sin(th));
} else if ((Math.sin(ky) <= 5e-165) || (!(Math.sin(ky) <= 4e-140) && (Math.sin(ky) <= 5e-107))) {
tmp = Math.sin(th) / (Math.sin(kx) / ky);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.05: tmp = math.fabs(math.sin(th)) elif (math.sin(ky) <= 5e-165) or (not (math.sin(ky) <= 4e-140) and (math.sin(ky) <= 5e-107)): tmp = math.sin(th) / (math.sin(kx) / ky) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.05) tmp = abs(sin(th)); elseif ((sin(ky) <= 5e-165) || (!(sin(ky) <= 4e-140) && (sin(ky) <= 5e-107))) tmp = Float64(sin(th) / Float64(sin(kx) / ky)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.05) tmp = abs(sin(th)); elseif ((sin(ky) <= 5e-165) || (~((sin(ky) <= 4e-140)) && (sin(ky) <= 5e-107))) tmp = sin(th) / (sin(kx) / ky); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.05], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[Or[LessEqual[N[Sin[ky], $MachinePrecision], 5e-165], And[N[Not[LessEqual[N[Sin[ky], $MachinePrecision], 4e-140]], $MachinePrecision], LessEqual[N[Sin[ky], $MachinePrecision], 5e-107]]], N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.05:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-165} \lor \neg \left(\sin ky \leq 4 \cdot 10^{-140}\right) \land \sin ky \leq 5 \cdot 10^{-107}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.050000000000000003Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.4%
associate-/l*99.4%
+-commutative99.4%
unpow299.4%
sin-neg99.4%
sin-neg99.4%
Simplified99.6%
Taylor expanded in kx around 0 2.5%
add-sqr-sqrt1.6%
sqrt-unprod27.8%
pow227.8%
Applied egg-rr27.8%
unpow227.8%
rem-sqrt-square30.9%
associate-*r/31.0%
associate-*l/31.0%
*-inverses31.0%
*-lft-identity31.0%
Simplified31.0%
if -0.050000000000000003 < (sin.f64 ky) < 4.99999999999999981e-165 or 3.9999999999999999e-140 < (sin.f64 ky) < 4.99999999999999971e-107Initial program 82.8%
unpow282.8%
sqr-neg82.8%
sin-neg82.8%
sin-neg82.8%
unpow282.8%
associate-*l/80.1%
associate-/l*82.7%
+-commutative82.7%
unpow282.7%
sin-neg82.7%
sin-neg82.7%
Simplified99.7%
associate-*r/91.7%
hypot-undefine80.1%
unpow280.1%
unpow280.1%
+-commutative80.1%
associate-*l/82.8%
*-commutative82.8%
clear-num82.7%
un-div-inv82.8%
+-commutative82.8%
unpow282.8%
unpow282.8%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 47.8%
if 4.99999999999999981e-165 < (sin.f64 ky) < 3.9999999999999999e-140 or 4.99999999999999971e-107 < (sin.f64 ky) Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/97.8%
associate-/l*99.6%
+-commutative99.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
Simplified99.6%
Taylor expanded in kx around 0 65.5%
Final simplification50.1%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.04)
(fabs (* ky (/ (sin th) (sin kx))))
(if (<= (sin kx) 2e-15)
(* (sin ky) (/ (sin th) (fabs (sin ky))))
(/ (sin th) (/ (sin kx) (sin ky))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.04) {
tmp = fabs((ky * (sin(th) / sin(kx))));
} else if (sin(kx) <= 2e-15) {
tmp = sin(ky) * (sin(th) / fabs(sin(ky)));
} else {
tmp = sin(th) / (sin(kx) / sin(ky));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(kx) <= (-0.04d0)) then
tmp = abs((ky * (sin(th) / sin(kx))))
else if (sin(kx) <= 2d-15) then
tmp = sin(ky) * (sin(th) / abs(sin(ky)))
else
tmp = sin(th) / (sin(kx) / sin(ky))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.04) {
tmp = Math.abs((ky * (Math.sin(th) / Math.sin(kx))));
} else if (Math.sin(kx) <= 2e-15) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.abs(Math.sin(ky)));
} else {
tmp = Math.sin(th) / (Math.sin(kx) / Math.sin(ky));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.04: tmp = math.fabs((ky * (math.sin(th) / math.sin(kx)))) elif math.sin(kx) <= 2e-15: tmp = math.sin(ky) * (math.sin(th) / math.fabs(math.sin(ky))) else: tmp = math.sin(th) / (math.sin(kx) / math.sin(ky)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.04) tmp = abs(Float64(ky * Float64(sin(th) / sin(kx)))); elseif (sin(kx) <= 2e-15) tmp = Float64(sin(ky) * Float64(sin(th) / abs(sin(ky)))); else tmp = Float64(sin(th) / Float64(sin(kx) / sin(ky))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.04) tmp = abs((ky * (sin(th) / sin(kx)))); elseif (sin(kx) <= 2e-15) tmp = sin(ky) * (sin(th) / abs(sin(ky))); else tmp = sin(th) / (sin(kx) / sin(ky)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.04], N[Abs[N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 2e-15], 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[kx], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.04:\\
\;\;\;\;\left|ky \cdot \frac{\sin th}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 2 \cdot 10^{-15}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\left|\sin ky\right|}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{\sin ky}}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0400000000000000008Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.5%
associate-/l*99.4%
+-commutative99.4%
unpow299.4%
sin-neg99.4%
sin-neg99.4%
Simplified99.5%
Taylor expanded in ky around 0 17.1%
add-sqr-sqrt15.4%
sqrt-unprod25.4%
pow225.4%
associate-/l*25.4%
Applied egg-rr25.4%
unpow225.4%
rem-sqrt-square34.1%
Simplified34.1%
if -0.0400000000000000008 < (sin.f64 kx) < 2.0000000000000002e-15Initial program 87.1%
unpow287.1%
sqr-neg87.1%
sin-neg87.1%
sin-neg87.1%
unpow287.1%
associate-*l/83.7%
associate-/l*86.9%
+-commutative86.9%
unpow286.9%
sin-neg86.9%
sin-neg86.9%
Simplified99.8%
Taylor expanded in kx around 0 43.7%
add-sqr-sqrt41.9%
sqrt-prod71.9%
rem-sqrt-square79.4%
Applied egg-rr79.4%
if 2.0000000000000002e-15 < (sin.f64 kx) Initial program 99.4%
unpow299.4%
sqr-neg99.4%
sin-neg99.4%
sin-neg99.4%
unpow299.4%
associate-*l/99.4%
associate-/l*99.4%
+-commutative99.4%
unpow299.4%
sin-neg99.4%
sin-neg99.4%
Simplified99.4%
associate-*r/99.4%
hypot-undefine99.4%
unpow299.4%
unpow299.4%
+-commutative99.4%
associate-*l/99.4%
*-commutative99.4%
clear-num99.4%
un-div-inv99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-undefine99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 58.1%
Final simplification64.0%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin th) (sin kx))))
(if (<= (sin kx) -0.04)
(fabs (* ky t_1))
(if (<= (sin kx) 2e-34) (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.04) {
tmp = fabs((ky * t_1));
} else if (sin(kx) <= 2e-34) {
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.04d0)) then
tmp = abs((ky * t_1))
else if (sin(kx) <= 2d-34) 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.04) {
tmp = Math.abs((ky * t_1));
} else if (Math.sin(kx) <= 2e-34) {
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.04: tmp = math.fabs((ky * t_1)) elif math.sin(kx) <= 2e-34: 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.04) tmp = abs(Float64(ky * t_1)); elseif (sin(kx) <= 2e-34) 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.04) tmp = abs((ky * t_1)); elseif (sin(kx) <= 2e-34) 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.04], N[Abs[N[(ky * t$95$1), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 2e-34], 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.04:\\
\;\;\;\;\left|ky \cdot t\_1\right|\\
\mathbf{elif}\;\sin kx \leq 2 \cdot 10^{-34}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot t\_1\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0400000000000000008Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.5%
associate-/l*99.4%
+-commutative99.4%
unpow299.4%
sin-neg99.4%
sin-neg99.4%
Simplified99.5%
Taylor expanded in ky around 0 17.1%
add-sqr-sqrt15.4%
sqrt-unprod25.4%
pow225.4%
associate-/l*25.4%
Applied egg-rr25.4%
unpow225.4%
rem-sqrt-square34.1%
Simplified34.1%
if -0.0400000000000000008 < (sin.f64 kx) < 1.99999999999999986e-34Initial program 86.8%
unpow286.8%
sqr-neg86.8%
sin-neg86.8%
sin-neg86.8%
unpow286.8%
associate-*l/83.3%
associate-/l*86.6%
+-commutative86.6%
unpow286.6%
sin-neg86.6%
sin-neg86.6%
Simplified99.8%
Taylor expanded in kx around 0 44.7%
if 1.99999999999999986e-34 < (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.4%
+-commutative99.4%
unpow299.4%
sin-neg99.4%
sin-neg99.4%
Simplified99.4%
Taylor expanded in ky around 0 58.7%
Final simplification45.7%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.04) (fabs (* ky (/ (sin th) (sin kx)))) (if (<= (sin kx) 2e-34) (sin th) (/ (sin ky) (/ (sin kx) (sin th))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.04) {
tmp = fabs((ky * (sin(th) / sin(kx))));
} else if (sin(kx) <= 2e-34) {
tmp = sin(th);
} else {
tmp = sin(ky) / (sin(kx) / 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(kx) <= (-0.04d0)) then
tmp = abs((ky * (sin(th) / sin(kx))))
else if (sin(kx) <= 2d-34) then
tmp = sin(th)
else
tmp = sin(ky) / (sin(kx) / sin(th))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.04) {
tmp = Math.abs((ky * (Math.sin(th) / Math.sin(kx))));
} else if (Math.sin(kx) <= 2e-34) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(ky) / (Math.sin(kx) / Math.sin(th));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.04: tmp = math.fabs((ky * (math.sin(th) / math.sin(kx)))) elif math.sin(kx) <= 2e-34: tmp = math.sin(th) else: tmp = math.sin(ky) / (math.sin(kx) / math.sin(th)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.04) tmp = abs(Float64(ky * Float64(sin(th) / sin(kx)))); elseif (sin(kx) <= 2e-34) tmp = sin(th); else tmp = Float64(sin(ky) / Float64(sin(kx) / sin(th))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.04) tmp = abs((ky * (sin(th) / sin(kx)))); elseif (sin(kx) <= 2e-34) tmp = sin(th); else tmp = sin(ky) / (sin(kx) / sin(th)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.04], N[Abs[N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 2e-34], N[Sin[th], $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.04:\\
\;\;\;\;\left|ky \cdot \frac{\sin th}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 2 \cdot 10^{-34}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky}{\frac{\sin kx}{\sin th}}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0400000000000000008Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.5%
associate-/l*99.4%
+-commutative99.4%
unpow299.4%
sin-neg99.4%
sin-neg99.4%
Simplified99.5%
Taylor expanded in ky around 0 17.1%
add-sqr-sqrt15.4%
sqrt-unprod25.4%
pow225.4%
associate-/l*25.4%
Applied egg-rr25.4%
unpow225.4%
rem-sqrt-square34.1%
Simplified34.1%
if -0.0400000000000000008 < (sin.f64 kx) < 1.99999999999999986e-34Initial program 86.8%
unpow286.8%
sqr-neg86.8%
sin-neg86.8%
sin-neg86.8%
unpow286.8%
associate-*l/83.3%
associate-/l*86.6%
+-commutative86.6%
unpow286.6%
sin-neg86.6%
sin-neg86.6%
Simplified99.8%
Taylor expanded in kx around 0 44.7%
if 1.99999999999999986e-34 < (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.4%
+-commutative99.4%
unpow299.4%
sin-neg99.4%
sin-neg99.4%
Simplified99.4%
clear-num99.4%
un-div-inv99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 58.7%
Final simplification45.7%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.04) (fabs (* ky (/ (sin th) (sin kx)))) (if (<= (sin kx) 2e-34) (sin th) (/ (sin th) (/ (sin kx) (sin ky))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.04) {
tmp = fabs((ky * (sin(th) / sin(kx))));
} else if (sin(kx) <= 2e-34) {
tmp = sin(th);
} else {
tmp = sin(th) / (sin(kx) / sin(ky));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(kx) <= (-0.04d0)) then
tmp = abs((ky * (sin(th) / sin(kx))))
else if (sin(kx) <= 2d-34) then
tmp = sin(th)
else
tmp = sin(th) / (sin(kx) / sin(ky))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.04) {
tmp = Math.abs((ky * (Math.sin(th) / Math.sin(kx))));
} else if (Math.sin(kx) <= 2e-34) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) / (Math.sin(kx) / Math.sin(ky));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.04: tmp = math.fabs((ky * (math.sin(th) / math.sin(kx)))) elif math.sin(kx) <= 2e-34: tmp = math.sin(th) else: tmp = math.sin(th) / (math.sin(kx) / math.sin(ky)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.04) tmp = abs(Float64(ky * Float64(sin(th) / sin(kx)))); elseif (sin(kx) <= 2e-34) tmp = sin(th); else tmp = Float64(sin(th) / Float64(sin(kx) / sin(ky))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.04) tmp = abs((ky * (sin(th) / sin(kx)))); elseif (sin(kx) <= 2e-34) tmp = sin(th); else tmp = sin(th) / (sin(kx) / sin(ky)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.04], N[Abs[N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 2e-34], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.04:\\
\;\;\;\;\left|ky \cdot \frac{\sin th}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 2 \cdot 10^{-34}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{\sin ky}}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0400000000000000008Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.5%
associate-/l*99.4%
+-commutative99.4%
unpow299.4%
sin-neg99.4%
sin-neg99.4%
Simplified99.5%
Taylor expanded in ky around 0 17.1%
add-sqr-sqrt15.4%
sqrt-unprod25.4%
pow225.4%
associate-/l*25.4%
Applied egg-rr25.4%
unpow225.4%
rem-sqrt-square34.1%
Simplified34.1%
if -0.0400000000000000008 < (sin.f64 kx) < 1.99999999999999986e-34Initial program 86.8%
unpow286.8%
sqr-neg86.8%
sin-neg86.8%
sin-neg86.8%
unpow286.8%
associate-*l/83.3%
associate-/l*86.6%
+-commutative86.6%
unpow286.6%
sin-neg86.6%
sin-neg86.6%
Simplified99.8%
Taylor expanded in kx around 0 44.7%
if 1.99999999999999986e-34 < (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.4%
+-commutative99.4%
unpow299.4%
sin-neg99.4%
sin-neg99.4%
Simplified99.4%
associate-*r/99.4%
hypot-undefine99.5%
unpow299.5%
unpow299.5%
+-commutative99.5%
associate-*l/99.4%
*-commutative99.4%
clear-num99.4%
un-div-inv99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-undefine99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 58.7%
Final simplification45.7%
(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.8%
unpow292.8%
sqr-neg92.8%
sin-neg92.8%
sin-neg92.8%
unpow292.8%
associate-*l/91.0%
associate-/l*92.7%
+-commutative92.7%
unpow292.7%
sin-neg92.7%
sin-neg92.7%
Simplified99.6%
Final simplification99.6%
(FPCore (kx ky th) :precision binary64 (* (sin th) (/ (sin ky) (hypot (sin ky) (sin kx)))))
double code(double kx, double ky, double th) {
return sin(th) * (sin(ky) / hypot(sin(ky), sin(kx)));
}
public static double code(double kx, double ky, double th) {
return Math.sin(th) * (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx)));
}
def code(kx, ky, th): return math.sin(th) * (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx)))
function code(kx, ky, th) return Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), sin(kx)))) end
function tmp = code(kx, ky, th) tmp = sin(th) * (sin(ky) / hypot(sin(ky), sin(kx))); end
code[kx_, ky_, th_] := N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}
\end{array}
Initial program 92.8%
+-commutative92.8%
unpow292.8%
unpow292.8%
hypot-undefine99.7%
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (kx ky th)
:precision binary64
(if (<= th 0.001)
(* th (/ (sin ky) (hypot (sin ky) (sin kx))))
(if (or (<= th 1.7e+205) (not (<= th 2.9e+252)))
(* (sin ky) (/ (sin th) (fabs (sin ky))))
(/ (sin th) (/ (sin kx) (sin ky))))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.001) {
tmp = th * (sin(ky) / hypot(sin(ky), sin(kx)));
} else if ((th <= 1.7e+205) || !(th <= 2.9e+252)) {
tmp = sin(ky) * (sin(th) / fabs(sin(ky)));
} else {
tmp = sin(th) / (sin(kx) / sin(ky));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.001) {
tmp = th * (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else if ((th <= 1.7e+205) || !(th <= 2.9e+252)) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.abs(Math.sin(ky)));
} else {
tmp = Math.sin(th) / (Math.sin(kx) / Math.sin(ky));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 0.001: tmp = th * (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx))) elif (th <= 1.7e+205) or not (th <= 2.9e+252): tmp = math.sin(ky) * (math.sin(th) / math.fabs(math.sin(ky))) else: tmp = math.sin(th) / (math.sin(kx) / math.sin(ky)) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 0.001) tmp = Float64(th * Float64(sin(ky) / hypot(sin(ky), sin(kx)))); elseif ((th <= 1.7e+205) || !(th <= 2.9e+252)) tmp = Float64(sin(ky) * Float64(sin(th) / abs(sin(ky)))); else tmp = Float64(sin(th) / Float64(sin(kx) / sin(ky))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 0.001) tmp = th * (sin(ky) / hypot(sin(ky), sin(kx))); elseif ((th <= 1.7e+205) || ~((th <= 2.9e+252))) tmp = sin(ky) * (sin(th) / abs(sin(ky))); else tmp = sin(th) / (sin(kx) / sin(ky)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 0.001], N[(th * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[th, 1.7e+205], N[Not[LessEqual[th, 2.9e+252]], $MachinePrecision]], 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[kx], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 0.001:\\
\;\;\;\;th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{elif}\;th \leq 1.7 \cdot 10^{+205} \lor \neg \left(th \leq 2.9 \cdot 10^{+252}\right):\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\left|\sin ky\right|}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{\sin ky}}\\
\end{array}
\end{array}
if th < 1e-3Initial program 93.8%
unpow293.8%
sqr-neg93.8%
sin-neg93.8%
sin-neg93.8%
unpow293.8%
associate-*l/91.4%
associate-/l*93.7%
+-commutative93.7%
unpow293.7%
sin-neg93.7%
sin-neg93.7%
Simplified99.7%
associate-*r/94.5%
Applied egg-rr94.5%
Taylor expanded in th around 0 57.9%
*-commutative57.9%
Simplified57.9%
*-commutative57.9%
associate-/l*63.1%
Applied egg-rr63.1%
if 1e-3 < th < 1.7e205 or 2.89999999999999996e252 < th Initial program 90.0%
unpow290.0%
sqr-neg90.0%
sin-neg90.0%
sin-neg90.0%
unpow290.0%
associate-*l/90.1%
associate-/l*89.9%
+-commutative89.9%
unpow289.9%
sin-neg89.9%
sin-neg89.9%
Simplified99.5%
Taylor expanded in kx around 0 32.2%
add-sqr-sqrt31.2%
sqrt-prod50.6%
rem-sqrt-square56.9%
Applied egg-rr56.9%
if 1.7e205 < th < 2.89999999999999996e252Initial program 85.6%
unpow285.6%
sqr-neg85.6%
sin-neg85.6%
sin-neg85.6%
unpow285.6%
associate-*l/85.8%
associate-/l*85.7%
+-commutative85.7%
unpow285.7%
sin-neg85.7%
sin-neg85.7%
Simplified99.4%
associate-*r/99.6%
hypot-undefine85.8%
unpow285.8%
unpow285.8%
+-commutative85.8%
associate-*l/85.6%
*-commutative85.6%
clear-num85.6%
un-div-inv85.9%
+-commutative85.9%
unpow285.9%
unpow285.9%
hypot-undefine99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 33.3%
Final simplification61.0%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.04) (fabs (* ky (/ (sin th) (sin kx)))) (if (<= (sin kx) 2e-31) (sin th) (/ (sin th) (/ (sin kx) ky)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.04) {
tmp = fabs((ky * (sin(th) / sin(kx))));
} else if (sin(kx) <= 2e-31) {
tmp = sin(th);
} else {
tmp = sin(th) / (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.04d0)) then
tmp = abs((ky * (sin(th) / sin(kx))))
else if (sin(kx) <= 2d-31) then
tmp = sin(th)
else
tmp = sin(th) / (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.04) {
tmp = Math.abs((ky * (Math.sin(th) / Math.sin(kx))));
} else if (Math.sin(kx) <= 2e-31) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) / (Math.sin(kx) / ky);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.04: tmp = math.fabs((ky * (math.sin(th) / math.sin(kx)))) elif math.sin(kx) <= 2e-31: tmp = math.sin(th) else: tmp = math.sin(th) / (math.sin(kx) / ky) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.04) tmp = abs(Float64(ky * Float64(sin(th) / sin(kx)))); elseif (sin(kx) <= 2e-31) tmp = sin(th); else tmp = Float64(sin(th) / Float64(sin(kx) / ky)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.04) tmp = abs((ky * (sin(th) / sin(kx)))); elseif (sin(kx) <= 2e-31) tmp = sin(th); else tmp = sin(th) / (sin(kx) / ky); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.04], N[Abs[N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 2e-31], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.04:\\
\;\;\;\;\left|ky \cdot \frac{\sin th}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 2 \cdot 10^{-31}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{ky}}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0400000000000000008Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.5%
associate-/l*99.4%
+-commutative99.4%
unpow299.4%
sin-neg99.4%
sin-neg99.4%
Simplified99.5%
Taylor expanded in ky around 0 17.1%
add-sqr-sqrt15.4%
sqrt-unprod25.4%
pow225.4%
associate-/l*25.4%
Applied egg-rr25.4%
unpow225.4%
rem-sqrt-square34.1%
Simplified34.1%
if -0.0400000000000000008 < (sin.f64 kx) < 2e-31Initial program 86.9%
unpow286.9%
sqr-neg86.9%
sin-neg86.9%
sin-neg86.9%
unpow286.9%
associate-*l/83.4%
associate-/l*86.7%
+-commutative86.7%
unpow286.7%
sin-neg86.7%
sin-neg86.7%
Simplified99.8%
Taylor expanded in kx around 0 44.3%
if 2e-31 < (sin.f64 kx) Initial program 99.4%
unpow299.4%
sqr-neg99.4%
sin-neg99.4%
sin-neg99.4%
unpow299.4%
associate-*l/99.4%
associate-/l*99.4%
+-commutative99.4%
unpow299.4%
sin-neg99.4%
sin-neg99.4%
Simplified99.4%
associate-*r/99.4%
hypot-undefine99.4%
unpow299.4%
unpow299.4%
+-commutative99.4%
associate-*l/99.4%
*-commutative99.4%
clear-num99.4%
un-div-inv99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-undefine99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 48.9%
Final simplification43.1%
(FPCore (kx ky th) :precision binary64 (if (<= ky 0.002) (* (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 <= 0.002) {
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 <= 0.002) {
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 <= 0.002: 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 <= 0.002) tmp = Float64(sin(ky) * Float64(sin(th) / hypot(ky, sin(kx)))); else tmp = Float64(sin(ky) * Float64(sin(th) / abs(sin(ky)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 0.002) 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, 0.002], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Abs[N[Sin[ky], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 0.002:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\left|\sin ky\right|}\\
\end{array}
\end{array}
if ky < 2e-3Initial program 90.0%
unpow290.0%
sqr-neg90.0%
sin-neg90.0%
sin-neg90.0%
unpow290.0%
associate-*l/87.6%
associate-/l*90.0%
+-commutative90.0%
unpow290.0%
sin-neg90.0%
sin-neg90.0%
Simplified99.6%
Taylor expanded in ky around 0 69.1%
if 2e-3 < ky Initial program 99.8%
unpow299.8%
sqr-neg99.8%
sin-neg99.8%
sin-neg99.8%
unpow299.8%
associate-*l/99.6%
associate-/l*99.5%
+-commutative99.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
Simplified99.6%
Taylor expanded in kx around 0 40.6%
add-sqr-sqrt39.3%
sqrt-prod68.3%
rem-sqrt-square68.3%
Applied egg-rr68.3%
Final simplification68.9%
(FPCore (kx ky th) :precision binary64 (if (<= ky 0.0056) (/ (sin th) (/ (hypot ky (sin kx)) (sin ky))) (* (sin ky) (/ (sin th) (fabs (sin ky))))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 0.0056) {
tmp = sin(th) / (hypot(ky, sin(kx)) / sin(ky));
} 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 <= 0.0056) {
tmp = Math.sin(th) / (Math.hypot(ky, Math.sin(kx)) / Math.sin(ky));
} else {
tmp = Math.sin(ky) * (Math.sin(th) / Math.abs(Math.sin(ky)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 0.0056: tmp = math.sin(th) / (math.hypot(ky, math.sin(kx)) / math.sin(ky)) 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 <= 0.0056) tmp = Float64(sin(th) / Float64(hypot(ky, sin(kx)) / sin(ky))); else tmp = Float64(sin(ky) * Float64(sin(th) / abs(sin(ky)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 0.0056) tmp = sin(th) / (hypot(ky, sin(kx)) / sin(ky)); else tmp = sin(ky) * (sin(th) / abs(sin(ky))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 0.0056], N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Abs[N[Sin[ky], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 0.0056:\\
\;\;\;\;\frac{\sin th}{\frac{\mathsf{hypot}\left(ky, \sin kx\right)}{\sin ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\left|\sin ky\right|}\\
\end{array}
\end{array}
if ky < 0.00559999999999999994Initial program 90.0%
unpow290.0%
sqr-neg90.0%
sin-neg90.0%
sin-neg90.0%
unpow290.0%
associate-*l/87.6%
associate-/l*90.0%
+-commutative90.0%
unpow290.0%
sin-neg90.0%
sin-neg90.0%
Simplified99.6%
associate-*r/94.1%
hypot-undefine87.6%
unpow287.6%
unpow287.6%
+-commutative87.6%
associate-*l/90.0%
*-commutative90.0%
clear-num89.9%
un-div-inv90.0%
+-commutative90.0%
unpow290.0%
unpow290.0%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 69.1%
if 0.00559999999999999994 < ky Initial program 99.8%
unpow299.8%
sqr-neg99.8%
sin-neg99.8%
sin-neg99.8%
unpow299.8%
associate-*l/99.6%
associate-/l*99.5%
+-commutative99.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
Simplified99.6%
Taylor expanded in kx around 0 40.6%
add-sqr-sqrt39.3%
sqrt-prod68.3%
rem-sqrt-square68.3%
Applied egg-rr68.3%
Final simplification68.9%
(FPCore (kx ky th)
:precision binary64
(if (<= ky 3.1e-159)
(* ky (/ (sin th) kx))
(if (<= ky 2.1e-139)
(sin th)
(if (<= ky 3.8e-105)
(/ (* th ky) (sin kx))
(if (<= ky 6.1e+19) (sin th) (fabs (sin th)))))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 3.1e-159) {
tmp = ky * (sin(th) / kx);
} else if (ky <= 2.1e-139) {
tmp = sin(th);
} else if (ky <= 3.8e-105) {
tmp = (th * ky) / sin(kx);
} else if (ky <= 6.1e+19) {
tmp = sin(th);
} 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 <= 3.1d-159) then
tmp = ky * (sin(th) / kx)
else if (ky <= 2.1d-139) then
tmp = sin(th)
else if (ky <= 3.8d-105) then
tmp = (th * ky) / sin(kx)
else if (ky <= 6.1d+19) then
tmp = sin(th)
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 <= 3.1e-159) {
tmp = ky * (Math.sin(th) / kx);
} else if (ky <= 2.1e-139) {
tmp = Math.sin(th);
} else if (ky <= 3.8e-105) {
tmp = (th * ky) / Math.sin(kx);
} else if (ky <= 6.1e+19) {
tmp = Math.sin(th);
} else {
tmp = Math.abs(Math.sin(th));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 3.1e-159: tmp = ky * (math.sin(th) / kx) elif ky <= 2.1e-139: tmp = math.sin(th) elif ky <= 3.8e-105: tmp = (th * ky) / math.sin(kx) elif ky <= 6.1e+19: tmp = math.sin(th) else: tmp = math.fabs(math.sin(th)) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 3.1e-159) tmp = Float64(ky * Float64(sin(th) / kx)); elseif (ky <= 2.1e-139) tmp = sin(th); elseif (ky <= 3.8e-105) tmp = Float64(Float64(th * ky) / sin(kx)); elseif (ky <= 6.1e+19) tmp = sin(th); else tmp = abs(sin(th)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 3.1e-159) tmp = ky * (sin(th) / kx); elseif (ky <= 2.1e-139) tmp = sin(th); elseif (ky <= 3.8e-105) tmp = (th * ky) / sin(kx); elseif (ky <= 6.1e+19) tmp = sin(th); else tmp = abs(sin(th)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 3.1e-159], N[(ky * N[(N[Sin[th], $MachinePrecision] / kx), $MachinePrecision]), $MachinePrecision], If[LessEqual[ky, 2.1e-139], N[Sin[th], $MachinePrecision], If[LessEqual[ky, 3.8e-105], N[(N[(th * ky), $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision], If[LessEqual[ky, 6.1e+19], N[Sin[th], $MachinePrecision], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 3.1 \cdot 10^{-159}:\\
\;\;\;\;ky \cdot \frac{\sin th}{kx}\\
\mathbf{elif}\;ky \leq 2.1 \cdot 10^{-139}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 3.8 \cdot 10^{-105}:\\
\;\;\;\;\frac{th \cdot ky}{\sin kx}\\
\mathbf{elif}\;ky \leq 6.1 \cdot 10^{+19}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\left|\sin th\right|\\
\end{array}
\end{array}
if ky < 3.1e-159Initial program 88.3%
unpow288.3%
sqr-neg88.3%
sin-neg88.3%
sin-neg88.3%
unpow288.3%
associate-*l/86.5%
associate-/l*88.3%
+-commutative88.3%
unpow288.3%
sin-neg88.3%
sin-neg88.3%
Simplified99.7%
Taylor expanded in ky around 0 28.6%
Taylor expanded in kx around 0 21.3%
associate-/l*23.1%
Simplified23.1%
if 3.1e-159 < ky < 2.10000000000000008e-139 or 3.7999999999999998e-105 < ky < 6.1e19Initial program 99.8%
unpow299.8%
sqr-neg99.8%
sin-neg99.8%
sin-neg99.8%
unpow299.8%
associate-*l/93.9%
associate-/l*99.7%
+-commutative99.7%
unpow299.7%
sin-neg99.7%
sin-neg99.7%
Simplified99.7%
Taylor expanded in kx around 0 63.3%
if 2.10000000000000008e-139 < ky < 3.7999999999999998e-105Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.7%
associate-/l*99.2%
+-commutative99.2%
unpow299.2%
sin-neg99.2%
sin-neg99.2%
Simplified99.2%
Taylor expanded in ky around 0 51.2%
Taylor expanded in th around 0 34.8%
if 6.1e19 < ky Initial program 99.8%
unpow299.8%
sqr-neg99.8%
sin-neg99.8%
sin-neg99.8%
unpow299.8%
associate-*l/99.6%
associate-/l*99.5%
+-commutative99.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
Simplified99.6%
Taylor expanded in kx around 0 37.5%
add-sqr-sqrt15.5%
sqrt-unprod22.7%
pow222.7%
Applied egg-rr22.7%
unpow222.7%
rem-sqrt-square28.5%
associate-*r/28.7%
associate-*l/28.7%
*-inverses28.7%
*-lft-identity28.7%
Simplified28.7%
Final simplification29.5%
(FPCore (kx ky th) :precision binary64 (if (<= kx 5e-28) (sin th) (* ky (fabs (/ th (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 5e-28) {
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 <= 5d-28) 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 <= 5e-28) {
tmp = Math.sin(th);
} else {
tmp = ky * Math.abs((th / Math.sin(kx)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 5e-28: 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 <= 5e-28) 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 <= 5e-28) tmp = sin(th); else tmp = ky * abs((th / sin(kx))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 5e-28], 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 5 \cdot 10^{-28}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;ky \cdot \left|\frac{th}{\sin kx}\right|\\
\end{array}
\end{array}
if kx < 5.0000000000000002e-28Initial program 90.7%
unpow290.7%
sqr-neg90.7%
sin-neg90.7%
sin-neg90.7%
unpow290.7%
associate-*l/88.3%
associate-/l*90.6%
+-commutative90.6%
unpow290.6%
sin-neg90.6%
sin-neg90.6%
Simplified99.7%
Taylor expanded in kx around 0 33.6%
if 5.0000000000000002e-28 < 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.4%
+-commutative99.4%
unpow299.4%
sin-neg99.4%
sin-neg99.4%
Simplified99.5%
Taylor expanded in ky around 0 35.0%
Taylor expanded in th around 0 20.4%
associate-/l*20.3%
Simplified20.3%
add-sqr-sqrt11.1%
sqrt-unprod20.1%
pow220.1%
Applied egg-rr20.1%
unpow220.1%
rem-sqrt-square22.3%
Simplified22.3%
Final simplification30.9%
(FPCore (kx ky th)
:precision binary64
(if (<= ky 1.02e-162)
(* ky (/ (sin th) kx))
(if (or (<= ky 3.4e-137) (not (<= ky 9e-107)))
(sin th)
(* ky (/ th (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 1.02e-162) {
tmp = ky * (sin(th) / kx);
} else if ((ky <= 3.4e-137) || !(ky <= 9e-107)) {
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 (ky <= 1.02d-162) then
tmp = ky * (sin(th) / kx)
else if ((ky <= 3.4d-137) .or. (.not. (ky <= 9d-107))) 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 (ky <= 1.02e-162) {
tmp = ky * (Math.sin(th) / kx);
} else if ((ky <= 3.4e-137) || !(ky <= 9e-107)) {
tmp = Math.sin(th);
} else {
tmp = ky * (th / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 1.02e-162: tmp = ky * (math.sin(th) / kx) elif (ky <= 3.4e-137) or not (ky <= 9e-107): tmp = math.sin(th) else: tmp = ky * (th / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 1.02e-162) tmp = Float64(ky * Float64(sin(th) / kx)); elseif ((ky <= 3.4e-137) || !(ky <= 9e-107)) 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 (ky <= 1.02e-162) tmp = ky * (sin(th) / kx); elseif ((ky <= 3.4e-137) || ~((ky <= 9e-107))) tmp = sin(th); else tmp = ky * (th / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 1.02e-162], N[(ky * N[(N[Sin[th], $MachinePrecision] / kx), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[ky, 3.4e-137], N[Not[LessEqual[ky, 9e-107]], $MachinePrecision]], N[Sin[th], $MachinePrecision], N[(ky * N[(th / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 1.02 \cdot 10^{-162}:\\
\;\;\;\;ky \cdot \frac{\sin th}{kx}\\
\mathbf{elif}\;ky \leq 3.4 \cdot 10^{-137} \lor \neg \left(ky \leq 9 \cdot 10^{-107}\right):\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;ky \cdot \frac{th}{\sin kx}\\
\end{array}
\end{array}
if ky < 1.01999999999999998e-162Initial program 88.3%
unpow288.3%
sqr-neg88.3%
sin-neg88.3%
sin-neg88.3%
unpow288.3%
associate-*l/86.5%
associate-/l*88.3%
+-commutative88.3%
unpow288.3%
sin-neg88.3%
sin-neg88.3%
Simplified99.7%
Taylor expanded in ky around 0 28.6%
Taylor expanded in kx around 0 21.3%
associate-/l*23.1%
Simplified23.1%
if 1.01999999999999998e-162 < ky < 3.40000000000000014e-137 or 9.00000000000000032e-107 < ky Initial program 99.8%
unpow299.8%
sqr-neg99.8%
sin-neg99.8%
sin-neg99.8%
unpow299.8%
associate-*l/97.8%
associate-/l*99.6%
+-commutative99.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
Simplified99.6%
Taylor expanded in kx around 0 45.7%
if 3.40000000000000014e-137 < ky < 9.00000000000000032e-107Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.7%
associate-/l*99.2%
+-commutative99.2%
unpow299.2%
sin-neg99.2%
sin-neg99.2%
Simplified99.2%
Taylor expanded in ky around 0 51.2%
Taylor expanded in th around 0 34.8%
associate-/l*34.6%
Simplified34.6%
Final simplification31.8%
(FPCore (kx ky th)
:precision binary64
(if (<= ky 1.85e-162)
(* ky (/ (sin th) kx))
(if (or (<= ky 4.3e-137) (not (<= ky 2.6e-107)))
(sin th)
(/ (* th ky) (sin kx)))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 1.85e-162) {
tmp = ky * (sin(th) / kx);
} else if ((ky <= 4.3e-137) || !(ky <= 2.6e-107)) {
tmp = sin(th);
} else {
tmp = (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 (ky <= 1.85d-162) then
tmp = ky * (sin(th) / kx)
else if ((ky <= 4.3d-137) .or. (.not. (ky <= 2.6d-107))) then
tmp = sin(th)
else
tmp = (th * ky) / sin(kx)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 1.85e-162) {
tmp = ky * (Math.sin(th) / kx);
} else if ((ky <= 4.3e-137) || !(ky <= 2.6e-107)) {
tmp = Math.sin(th);
} else {
tmp = (th * ky) / Math.sin(kx);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 1.85e-162: tmp = ky * (math.sin(th) / kx) elif (ky <= 4.3e-137) or not (ky <= 2.6e-107): tmp = math.sin(th) else: tmp = (th * ky) / math.sin(kx) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 1.85e-162) tmp = Float64(ky * Float64(sin(th) / kx)); elseif ((ky <= 4.3e-137) || !(ky <= 2.6e-107)) tmp = sin(th); else tmp = Float64(Float64(th * ky) / sin(kx)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 1.85e-162) tmp = ky * (sin(th) / kx); elseif ((ky <= 4.3e-137) || ~((ky <= 2.6e-107))) tmp = sin(th); else tmp = (th * ky) / sin(kx); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 1.85e-162], N[(ky * N[(N[Sin[th], $MachinePrecision] / kx), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[ky, 4.3e-137], N[Not[LessEqual[ky, 2.6e-107]], $MachinePrecision]], N[Sin[th], $MachinePrecision], N[(N[(th * ky), $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 1.85 \cdot 10^{-162}:\\
\;\;\;\;ky \cdot \frac{\sin th}{kx}\\
\mathbf{elif}\;ky \leq 4.3 \cdot 10^{-137} \lor \neg \left(ky \leq 2.6 \cdot 10^{-107}\right):\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{th \cdot ky}{\sin kx}\\
\end{array}
\end{array}
if ky < 1.8500000000000001e-162Initial program 88.3%
unpow288.3%
sqr-neg88.3%
sin-neg88.3%
sin-neg88.3%
unpow288.3%
associate-*l/86.5%
associate-/l*88.3%
+-commutative88.3%
unpow288.3%
sin-neg88.3%
sin-neg88.3%
Simplified99.7%
Taylor expanded in ky around 0 28.6%
Taylor expanded in kx around 0 21.3%
associate-/l*23.1%
Simplified23.1%
if 1.8500000000000001e-162 < ky < 4.2999999999999998e-137 or 2.6000000000000001e-107 < ky Initial program 99.8%
unpow299.8%
sqr-neg99.8%
sin-neg99.8%
sin-neg99.8%
unpow299.8%
associate-*l/97.8%
associate-/l*99.6%
+-commutative99.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
Simplified99.6%
Taylor expanded in kx around 0 45.7%
if 4.2999999999999998e-137 < ky < 2.6000000000000001e-107Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.7%
associate-/l*99.2%
+-commutative99.2%
unpow299.2%
sin-neg99.2%
sin-neg99.2%
Simplified99.2%
Taylor expanded in ky around 0 51.2%
Taylor expanded in th around 0 34.8%
Final simplification31.8%
(FPCore (kx ky th) :precision binary64 (if (<= kx 3.2e-28) (sin th) (* ky (/ th (sin kx)))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 3.2e-28) {
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 <= 3.2d-28) 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 <= 3.2e-28) {
tmp = Math.sin(th);
} else {
tmp = ky * (th / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 3.2e-28: tmp = math.sin(th) else: tmp = ky * (th / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 3.2e-28) 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 <= 3.2e-28) tmp = sin(th); else tmp = ky * (th / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 3.2e-28], N[Sin[th], $MachinePrecision], N[(ky * N[(th / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 3.2 \cdot 10^{-28}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;ky \cdot \frac{th}{\sin kx}\\
\end{array}
\end{array}
if kx < 3.19999999999999982e-28Initial program 90.7%
unpow290.7%
sqr-neg90.7%
sin-neg90.7%
sin-neg90.7%
unpow290.7%
associate-*l/88.3%
associate-/l*90.6%
+-commutative90.6%
unpow290.6%
sin-neg90.6%
sin-neg90.6%
Simplified99.7%
Taylor expanded in kx around 0 33.6%
if 3.19999999999999982e-28 < 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.4%
+-commutative99.4%
unpow299.4%
sin-neg99.4%
sin-neg99.4%
Simplified99.5%
Taylor expanded in ky around 0 35.0%
Taylor expanded in th around 0 20.4%
associate-/l*20.3%
Simplified20.3%
Final simplification30.4%
(FPCore (kx ky th) :precision binary64 (if (<= ky 3.7e-160) (* ky (/ th kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 3.7e-160) {
tmp = ky * (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 <= 3.7d-160) then
tmp = ky * (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 <= 3.7e-160) {
tmp = ky * (th / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 3.7e-160: tmp = ky * (th / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 3.7e-160) tmp = Float64(ky * Float64(th / kx)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 3.7e-160) tmp = ky * (th / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 3.7e-160], N[(ky * N[(th / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 3.7 \cdot 10^{-160}:\\
\;\;\;\;ky \cdot \frac{th}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 3.69999999999999977e-160Initial program 88.3%
unpow288.3%
sqr-neg88.3%
sin-neg88.3%
sin-neg88.3%
unpow288.3%
associate-*l/86.5%
associate-/l*88.3%
+-commutative88.3%
unpow288.3%
sin-neg88.3%
sin-neg88.3%
Simplified99.7%
Taylor expanded in ky around 0 28.6%
Taylor expanded in th around 0 19.0%
associate-/l*20.8%
Simplified20.8%
Taylor expanded in kx around 0 17.8%
associate-/l*19.6%
Simplified19.6%
if 3.69999999999999977e-160 < ky Initial program 99.8%
unpow299.8%
sqr-neg99.8%
sin-neg99.8%
sin-neg99.8%
unpow299.8%
associate-*l/97.9%
associate-/l*99.5%
+-commutative99.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
Simplified99.6%
Taylor expanded in kx around 0 44.3%
Final simplification29.3%
(FPCore (kx ky th) :precision binary64 (if (<= ky 6.5e-92) (* ky (/ th kx)) th))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 6.5e-92) {
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 <= 6.5d-92) 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 <= 6.5e-92) {
tmp = ky * (th / kx);
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 6.5e-92: tmp = ky * (th / kx) else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 6.5e-92) 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 <= 6.5e-92) tmp = ky * (th / kx); else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 6.5e-92], N[(ky * N[(th / kx), $MachinePrecision]), $MachinePrecision], th]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 6.5 \cdot 10^{-92}:\\
\;\;\;\;ky \cdot \frac{th}{kx}\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if ky < 6.50000000000000035e-92Initial program 89.0%
unpow289.0%
sqr-neg89.0%
sin-neg89.0%
sin-neg89.0%
unpow289.0%
associate-*l/86.7%
associate-/l*88.9%
+-commutative88.9%
unpow288.9%
sin-neg88.9%
sin-neg88.9%
Simplified99.6%
Taylor expanded in ky around 0 30.0%
Taylor expanded in th around 0 19.8%
associate-/l*21.5%
Simplified21.5%
Taylor expanded in kx around 0 17.5%
associate-/l*19.2%
Simplified19.2%
if 6.50000000000000035e-92 < ky Initial program 99.8%
unpow299.8%
sqr-neg99.8%
sin-neg99.8%
sin-neg99.8%
unpow299.8%
associate-*l/98.7%
associate-/l*99.6%
+-commutative99.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
Simplified99.6%
Taylor expanded in kx around 0 45.3%
Taylor expanded in th around 0 23.5%
Final simplification20.7%
(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.8%
unpow292.8%
sqr-neg92.8%
sin-neg92.8%
sin-neg92.8%
unpow292.8%
associate-*l/91.0%
associate-/l*92.7%
+-commutative92.7%
unpow292.7%
sin-neg92.7%
sin-neg92.7%
Simplified99.6%
Taylor expanded in kx around 0 27.0%
Taylor expanded in th around 0 15.0%
Final simplification15.0%
herbie shell --seed 2024131
(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)))