
(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 25 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\end{array}
(FPCore (kx ky th) :precision binary64 (/ (sin th) (/ (hypot (sin kx) (sin ky)) (sin ky))))
double code(double kx, double ky, double th) {
return sin(th) / (hypot(sin(kx), sin(ky)) / sin(ky));
}
public static double code(double kx, double ky, double th) {
return Math.sin(th) / (Math.hypot(Math.sin(kx), Math.sin(ky)) / Math.sin(ky));
}
def code(kx, ky, th): return math.sin(th) / (math.hypot(math.sin(kx), math.sin(ky)) / math.sin(ky))
function code(kx, ky, th) return Float64(sin(th) / Float64(hypot(sin(kx), sin(ky)) / sin(ky))) end
function tmp = code(kx, ky, th) tmp = sin(th) / (hypot(sin(kx), sin(ky)) / sin(ky)); end
code[kx_, ky_, th_] := N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{\sin ky}}
\end{array}
Initial program 92.6%
remove-double-neg92.6%
sin-neg92.6%
neg-mul-192.6%
*-commutative92.6%
associate-*l*92.6%
associate-*l/89.5%
associate-/r/89.5%
associate-*l/92.6%
associate-/r/92.6%
sin-neg92.6%
neg-mul-192.6%
associate-/r*92.6%
associate-/r/92.6%
Simplified99.6%
*-commutative99.6%
clear-num99.6%
un-div-inv99.6%
hypot-udef92.6%
unpow292.6%
unpow292.6%
+-commutative92.6%
unpow292.6%
unpow292.6%
hypot-def99.6%
Applied egg-rr99.6%
Final simplification99.6%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (hypot (sin kx) (sin ky))) (t_2 (/ (* (sin th) ky) t_1)))
(if (<= (sin th) -0.05)
t_2
(if (<= (sin th) 2e-7)
(/ th (/ t_1 (sin ky)))
(if (or (<= (sin th) 0.32) (not (<= (sin th) 0.88))) t_2 (sin th))))))
double code(double kx, double ky, double th) {
double t_1 = hypot(sin(kx), sin(ky));
double t_2 = (sin(th) * ky) / t_1;
double tmp;
if (sin(th) <= -0.05) {
tmp = t_2;
} else if (sin(th) <= 2e-7) {
tmp = th / (t_1 / sin(ky));
} else if ((sin(th) <= 0.32) || !(sin(th) <= 0.88)) {
tmp = t_2;
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.hypot(Math.sin(kx), Math.sin(ky));
double t_2 = (Math.sin(th) * ky) / t_1;
double tmp;
if (Math.sin(th) <= -0.05) {
tmp = t_2;
} else if (Math.sin(th) <= 2e-7) {
tmp = th / (t_1 / Math.sin(ky));
} else if ((Math.sin(th) <= 0.32) || !(Math.sin(th) <= 0.88)) {
tmp = t_2;
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.hypot(math.sin(kx), math.sin(ky)) t_2 = (math.sin(th) * ky) / t_1 tmp = 0 if math.sin(th) <= -0.05: tmp = t_2 elif math.sin(th) <= 2e-7: tmp = th / (t_1 / math.sin(ky)) elif (math.sin(th) <= 0.32) or not (math.sin(th) <= 0.88): tmp = t_2 else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = hypot(sin(kx), sin(ky)) t_2 = Float64(Float64(sin(th) * ky) / t_1) tmp = 0.0 if (sin(th) <= -0.05) tmp = t_2; elseif (sin(th) <= 2e-7) tmp = Float64(th / Float64(t_1 / sin(ky))); elseif ((sin(th) <= 0.32) || !(sin(th) <= 0.88)) tmp = t_2; else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = hypot(sin(kx), sin(ky)); t_2 = (sin(th) * ky) / t_1; tmp = 0.0; if (sin(th) <= -0.05) tmp = t_2; elseif (sin(th) <= 2e-7) tmp = th / (t_1 / sin(ky)); elseif ((sin(th) <= 0.32) || ~((sin(th) <= 0.88))) tmp = t_2; else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Sin[th], $MachinePrecision] * ky), $MachinePrecision] / t$95$1), $MachinePrecision]}, If[LessEqual[N[Sin[th], $MachinePrecision], -0.05], t$95$2, If[LessEqual[N[Sin[th], $MachinePrecision], 2e-7], N[(th / N[(t$95$1 / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[N[Sin[th], $MachinePrecision], 0.32], N[Not[LessEqual[N[Sin[th], $MachinePrecision], 0.88]], $MachinePrecision]], t$95$2, N[Sin[th], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin kx, \sin ky\right)\\
t_2 := \frac{\sin th \cdot ky}{t_1}\\
\mathbf{if}\;\sin th \leq -0.05:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\sin th \leq 2 \cdot 10^{-7}:\\
\;\;\;\;\frac{th}{\frac{t_1}{\sin ky}}\\
\mathbf{elif}\;\sin th \leq 0.32 \lor \neg \left(\sin th \leq 0.88\right):\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 th) < -0.050000000000000003 or 1.9999999999999999e-7 < (sin.f64 th) < 0.320000000000000007 or 0.880000000000000004 < (sin.f64 th) Initial program 91.0%
remove-double-neg91.0%
sin-neg91.0%
neg-mul-191.0%
*-commutative91.0%
associate-*l*91.0%
associate-*l/91.0%
associate-/r/91.0%
associate-*l/91.0%
associate-/r/91.0%
sin-neg91.0%
neg-mul-191.0%
associate-/r*91.0%
associate-/r/91.0%
Simplified99.6%
associate-*l/99.6%
hypot-udef91.0%
unpow291.0%
unpow291.0%
+-commutative91.0%
unpow291.0%
unpow291.0%
hypot-def99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 57.3%
if -0.050000000000000003 < (sin.f64 th) < 1.9999999999999999e-7Initial program 92.1%
remove-double-neg92.1%
sin-neg92.1%
neg-mul-192.1%
*-commutative92.1%
associate-*l*92.1%
associate-*l/86.3%
associate-/r/86.3%
associate-*l/92.1%
associate-/r/92.0%
sin-neg92.0%
neg-mul-192.0%
associate-/r*92.0%
associate-/r/92.1%
Simplified99.6%
*-commutative99.6%
clear-num99.6%
un-div-inv99.7%
hypot-udef92.1%
unpow292.1%
unpow292.1%
+-commutative92.1%
unpow292.1%
unpow292.1%
hypot-def99.7%
Applied egg-rr99.7%
Taylor expanded in th around 0 97.1%
if 0.320000000000000007 < (sin.f64 th) < 0.880000000000000004Initial program 99.8%
remove-double-neg99.8%
sin-neg99.8%
neg-mul-199.8%
*-commutative99.8%
associate-*l*99.8%
associate-*l/99.6%
associate-/r/99.6%
associate-*l/99.8%
associate-/r/99.7%
sin-neg99.7%
neg-mul-199.7%
associate-/r*99.7%
associate-/r/99.8%
Simplified99.8%
Taylor expanded in kx around 0 33.5%
Final simplification75.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (* (sin th) ky))
(t_2 (hypot (sin kx) (sin ky)))
(t_3 (/ t_1 t_2)))
(if (<= (sin th) -0.05)
t_3
(if (<= (sin th) 2e-7)
(/ th (/ t_2 (sin ky)))
(if (<= (sin th) 0.32)
(/ 1.0 (/ (hypot (sin ky) (sin kx)) t_1))
(if (<= (sin th) 0.88) (sin th) t_3))))))
double code(double kx, double ky, double th) {
double t_1 = sin(th) * ky;
double t_2 = hypot(sin(kx), sin(ky));
double t_3 = t_1 / t_2;
double tmp;
if (sin(th) <= -0.05) {
tmp = t_3;
} else if (sin(th) <= 2e-7) {
tmp = th / (t_2 / sin(ky));
} else if (sin(th) <= 0.32) {
tmp = 1.0 / (hypot(sin(ky), sin(kx)) / t_1);
} else if (sin(th) <= 0.88) {
tmp = sin(th);
} else {
tmp = t_3;
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(th) * ky;
double t_2 = Math.hypot(Math.sin(kx), Math.sin(ky));
double t_3 = t_1 / t_2;
double tmp;
if (Math.sin(th) <= -0.05) {
tmp = t_3;
} else if (Math.sin(th) <= 2e-7) {
tmp = th / (t_2 / Math.sin(ky));
} else if (Math.sin(th) <= 0.32) {
tmp = 1.0 / (Math.hypot(Math.sin(ky), Math.sin(kx)) / t_1);
} else if (Math.sin(th) <= 0.88) {
tmp = Math.sin(th);
} else {
tmp = t_3;
}
return tmp;
}
def code(kx, ky, th): t_1 = math.sin(th) * ky t_2 = math.hypot(math.sin(kx), math.sin(ky)) t_3 = t_1 / t_2 tmp = 0 if math.sin(th) <= -0.05: tmp = t_3 elif math.sin(th) <= 2e-7: tmp = th / (t_2 / math.sin(ky)) elif math.sin(th) <= 0.32: tmp = 1.0 / (math.hypot(math.sin(ky), math.sin(kx)) / t_1) elif math.sin(th) <= 0.88: tmp = math.sin(th) else: tmp = t_3 return tmp
function code(kx, ky, th) t_1 = Float64(sin(th) * ky) t_2 = hypot(sin(kx), sin(ky)) t_3 = Float64(t_1 / t_2) tmp = 0.0 if (sin(th) <= -0.05) tmp = t_3; elseif (sin(th) <= 2e-7) tmp = Float64(th / Float64(t_2 / sin(ky))); elseif (sin(th) <= 0.32) tmp = Float64(1.0 / Float64(hypot(sin(ky), sin(kx)) / t_1)); elseif (sin(th) <= 0.88) tmp = sin(th); else tmp = t_3; end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = sin(th) * ky; t_2 = hypot(sin(kx), sin(ky)); t_3 = t_1 / t_2; tmp = 0.0; if (sin(th) <= -0.05) tmp = t_3; elseif (sin(th) <= 2e-7) tmp = th / (t_2 / sin(ky)); elseif (sin(th) <= 0.32) tmp = 1.0 / (hypot(sin(ky), sin(kx)) / t_1); elseif (sin(th) <= 0.88) tmp = sin(th); else tmp = t_3; end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[th], $MachinePrecision] * ky), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]}, Block[{t$95$3 = N[(t$95$1 / t$95$2), $MachinePrecision]}, If[LessEqual[N[Sin[th], $MachinePrecision], -0.05], t$95$3, If[LessEqual[N[Sin[th], $MachinePrecision], 2e-7], N[(th / N[(t$95$2 / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], 0.32], N[(1.0 / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], 0.88], N[Sin[th], $MachinePrecision], t$95$3]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sin th \cdot ky\\
t_2 := \mathsf{hypot}\left(\sin kx, \sin ky\right)\\
t_3 := \frac{t_1}{t_2}\\
\mathbf{if}\;\sin th \leq -0.05:\\
\;\;\;\;t_3\\
\mathbf{elif}\;\sin th \leq 2 \cdot 10^{-7}:\\
\;\;\;\;\frac{th}{\frac{t_2}{\sin ky}}\\
\mathbf{elif}\;\sin th \leq 0.32:\\
\;\;\;\;\frac{1}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{t_1}}\\
\mathbf{elif}\;\sin th \leq 0.88:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;t_3\\
\end{array}
\end{array}
if (sin.f64 th) < -0.050000000000000003 or 0.880000000000000004 < (sin.f64 th) Initial program 91.4%
remove-double-neg91.4%
sin-neg91.4%
neg-mul-191.4%
*-commutative91.4%
associate-*l*91.4%
associate-*l/91.4%
associate-/r/91.4%
associate-*l/91.4%
associate-/r/91.4%
sin-neg91.4%
neg-mul-191.4%
associate-/r*91.4%
associate-/r/91.4%
Simplified99.6%
associate-*l/99.6%
hypot-udef91.4%
unpow291.4%
unpow291.4%
+-commutative91.4%
unpow291.4%
unpow291.4%
hypot-def99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 54.9%
if -0.050000000000000003 < (sin.f64 th) < 1.9999999999999999e-7Initial program 92.1%
remove-double-neg92.1%
sin-neg92.1%
neg-mul-192.1%
*-commutative92.1%
associate-*l*92.1%
associate-*l/86.3%
associate-/r/86.3%
associate-*l/92.1%
associate-/r/92.0%
sin-neg92.0%
neg-mul-192.0%
associate-/r*92.0%
associate-/r/92.1%
Simplified99.6%
*-commutative99.6%
clear-num99.6%
un-div-inv99.7%
hypot-udef92.1%
unpow292.1%
unpow292.1%
+-commutative92.1%
unpow292.1%
unpow292.1%
hypot-def99.7%
Applied egg-rr99.7%
Taylor expanded in th around 0 97.1%
if 1.9999999999999999e-7 < (sin.f64 th) < 0.320000000000000007Initial program 85.5%
remove-double-neg85.5%
sin-neg85.5%
neg-mul-185.5%
*-commutative85.5%
associate-*l*85.5%
associate-*l/85.7%
associate-/r/85.7%
associate-*l/85.5%
associate-/r/85.7%
sin-neg85.7%
neg-mul-185.7%
associate-/r*85.7%
associate-/r/85.5%
Simplified99.3%
associate-*l/99.6%
hypot-udef85.7%
unpow285.7%
unpow285.7%
+-commutative85.7%
unpow285.7%
unpow285.7%
hypot-def99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 85.7%
clear-num85.9%
inv-pow85.9%
hypot-udef72.0%
+-commutative72.0%
hypot-udef85.9%
*-commutative85.9%
Applied egg-rr85.9%
unpow-185.9%
*-commutative85.9%
Simplified85.9%
if 0.320000000000000007 < (sin.f64 th) < 0.880000000000000004Initial program 99.8%
remove-double-neg99.8%
sin-neg99.8%
neg-mul-199.8%
*-commutative99.8%
associate-*l*99.8%
associate-*l/99.6%
associate-/r/99.6%
associate-*l/99.8%
associate-/r/99.7%
sin-neg99.7%
neg-mul-199.7%
associate-/r*99.7%
associate-/r/99.8%
Simplified99.8%
Taylor expanded in kx around 0 33.5%
Final simplification75.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.04)
(fabs (sin th))
(if (or (<= (sin ky) 5e-192)
(and (not (<= (sin ky) 4e-150)) (<= (sin ky) 1e-95)))
(* (sin th) (/ ky kx))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.04) {
tmp = fabs(sin(th));
} else if ((sin(ky) <= 5e-192) || (!(sin(ky) <= 4e-150) && (sin(ky) <= 1e-95))) {
tmp = sin(th) * (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 (sin(ky) <= (-0.04d0)) then
tmp = abs(sin(th))
else if ((sin(ky) <= 5d-192) .or. (.not. (sin(ky) <= 4d-150)) .and. (sin(ky) <= 1d-95)) then
tmp = sin(th) * (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 (Math.sin(ky) <= -0.04) {
tmp = Math.abs(Math.sin(th));
} else if ((Math.sin(ky) <= 5e-192) || (!(Math.sin(ky) <= 4e-150) && (Math.sin(ky) <= 1e-95))) {
tmp = Math.sin(th) * (ky / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.04: tmp = math.fabs(math.sin(th)) elif (math.sin(ky) <= 5e-192) or (not (math.sin(ky) <= 4e-150) and (math.sin(ky) <= 1e-95)): tmp = math.sin(th) * (ky / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.04) tmp = abs(sin(th)); elseif ((sin(ky) <= 5e-192) || (!(sin(ky) <= 4e-150) && (sin(ky) <= 1e-95))) tmp = Float64(sin(th) * Float64(ky / kx)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.04) tmp = abs(sin(th)); elseif ((sin(ky) <= 5e-192) || (~((sin(ky) <= 4e-150)) && (sin(ky) <= 1e-95))) tmp = sin(th) * (ky / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.04], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[Or[LessEqual[N[Sin[ky], $MachinePrecision], 5e-192], And[N[Not[LessEqual[N[Sin[ky], $MachinePrecision], 4e-150]], $MachinePrecision], LessEqual[N[Sin[ky], $MachinePrecision], 1e-95]]], N[(N[Sin[th], $MachinePrecision] * N[(ky / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.04:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-192} \lor \neg \left(\sin ky \leq 4 \cdot 10^{-150}\right) \land \sin ky \leq 10^{-95}:\\
\;\;\;\;\sin th \cdot \frac{ky}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0400000000000000008Initial program 99.7%
remove-double-neg99.7%
sin-neg99.7%
neg-mul-199.7%
*-commutative99.7%
associate-*l*99.7%
associate-*l/99.6%
associate-/r/99.6%
associate-*l/99.7%
associate-/r/99.6%
sin-neg99.6%
neg-mul-199.6%
associate-/r*99.6%
associate-/r/99.7%
Simplified99.7%
Taylor expanded in kx around 0 2.6%
add-sqr-sqrt1.6%
sqrt-unprod26.6%
pow226.6%
Applied egg-rr26.6%
unpow226.6%
rem-sqrt-square30.0%
Simplified30.0%
if -0.0400000000000000008 < (sin.f64 ky) < 5.0000000000000001e-192 or 4.00000000000000003e-150 < (sin.f64 ky) < 9.99999999999999989e-96Initial program 82.1%
Taylor expanded in ky around 0 51.8%
Taylor expanded in kx around 0 34.7%
Taylor expanded in ky around 0 34.7%
if 5.0000000000000001e-192 < (sin.f64 ky) < 4.00000000000000003e-150 or 9.99999999999999989e-96 < (sin.f64 ky) Initial program 97.1%
remove-double-neg97.1%
sin-neg97.1%
neg-mul-197.1%
*-commutative97.1%
associate-*l*97.1%
associate-*l/95.2%
associate-/r/95.2%
associate-*l/97.1%
associate-/r/97.1%
sin-neg97.1%
neg-mul-197.1%
associate-/r*97.1%
associate-/r/97.1%
Simplified99.6%
Taylor expanded in kx around 0 57.7%
Final simplification42.2%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.25) (fabs (* (sin ky) (/ th (sin kx)))) (if (<= (sin kx) 2e-62) (sin th) (* (sin th) (/ (sin ky) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.25) {
tmp = fabs((sin(ky) * (th / sin(kx))));
} else if (sin(kx) <= 2e-62) {
tmp = sin(th);
} else {
tmp = sin(th) * (sin(ky) / sin(kx));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(kx) <= (-0.25d0)) then
tmp = abs((sin(ky) * (th / sin(kx))))
else if (sin(kx) <= 2d-62) then
tmp = sin(th)
else
tmp = sin(th) * (sin(ky) / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.25) {
tmp = Math.abs((Math.sin(ky) * (th / Math.sin(kx))));
} else if (Math.sin(kx) <= 2e-62) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) * (Math.sin(ky) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.25: tmp = math.fabs((math.sin(ky) * (th / math.sin(kx)))) elif math.sin(kx) <= 2e-62: tmp = math.sin(th) else: tmp = math.sin(th) * (math.sin(ky) / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.25) tmp = abs(Float64(sin(ky) * Float64(th / sin(kx)))); elseif (sin(kx) <= 2e-62) tmp = sin(th); else tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.25) tmp = abs((sin(ky) * (th / sin(kx)))); elseif (sin(kx) <= 2e-62) tmp = sin(th); else tmp = sin(th) * (sin(ky) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.25], N[Abs[N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 2e-62], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.25:\\
\;\;\;\;\left|\sin ky \cdot \frac{th}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 2 \cdot 10^{-62}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.25Initial program 99.5%
remove-double-neg99.5%
sin-neg99.5%
neg-mul-199.5%
*-commutative99.5%
associate-*l*99.5%
associate-*l/99.4%
associate-/r/99.4%
associate-*l/99.5%
associate-/r/99.6%
sin-neg99.6%
neg-mul-199.6%
associate-/r*99.6%
associate-/r/99.5%
Simplified99.5%
Taylor expanded in th around 0 67.9%
Taylor expanded in ky around 0 10.8%
add-sqr-sqrt8.9%
sqrt-unprod16.0%
pow216.0%
*-commutative16.0%
associate-*l*16.0%
div-inv16.0%
Applied egg-rr16.0%
unpow216.0%
rem-sqrt-square28.6%
Simplified28.6%
if -0.25 < (sin.f64 kx) < 2.0000000000000001e-62Initial program 85.8%
remove-double-neg85.8%
sin-neg85.8%
neg-mul-185.8%
*-commutative85.8%
associate-*l*85.8%
associate-*l/79.8%
associate-/r/79.8%
associate-*l/85.8%
associate-/r/85.8%
sin-neg85.8%
neg-mul-185.8%
associate-/r*85.8%
associate-/r/85.8%
Simplified99.8%
Taylor expanded in kx around 0 38.8%
if 2.0000000000000001e-62 < (sin.f64 kx) Initial program 99.4%
Taylor expanded in ky around 0 51.7%
Final simplification41.7%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.25) (fabs (* (sin ky) (/ th (sin kx)))) (if (<= (sin kx) 2e-62) (sin th) (* (sin ky) (/ (sin th) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.25) {
tmp = fabs((sin(ky) * (th / sin(kx))));
} else if (sin(kx) <= 2e-62) {
tmp = sin(th);
} else {
tmp = sin(ky) * (sin(th) / sin(kx));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(kx) <= (-0.25d0)) then
tmp = abs((sin(ky) * (th / sin(kx))))
else if (sin(kx) <= 2d-62) then
tmp = sin(th)
else
tmp = sin(ky) * (sin(th) / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.25) {
tmp = Math.abs((Math.sin(ky) * (th / Math.sin(kx))));
} else if (Math.sin(kx) <= 2e-62) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.25: tmp = math.fabs((math.sin(ky) * (th / math.sin(kx)))) elif math.sin(kx) <= 2e-62: tmp = math.sin(th) else: tmp = math.sin(ky) * (math.sin(th) / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.25) tmp = abs(Float64(sin(ky) * Float64(th / sin(kx)))); elseif (sin(kx) <= 2e-62) tmp = sin(th); else tmp = Float64(sin(ky) * Float64(sin(th) / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.25) tmp = abs((sin(ky) * (th / sin(kx)))); elseif (sin(kx) <= 2e-62) tmp = sin(th); else tmp = sin(ky) * (sin(th) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.25], N[Abs[N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 2e-62], N[Sin[th], $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.25:\\
\;\;\;\;\left|\sin ky \cdot \frac{th}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 2 \cdot 10^{-62}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.25Initial program 99.5%
remove-double-neg99.5%
sin-neg99.5%
neg-mul-199.5%
*-commutative99.5%
associate-*l*99.5%
associate-*l/99.4%
associate-/r/99.4%
associate-*l/99.5%
associate-/r/99.6%
sin-neg99.6%
neg-mul-199.6%
associate-/r*99.6%
associate-/r/99.5%
Simplified99.5%
Taylor expanded in th around 0 67.9%
Taylor expanded in ky around 0 10.8%
add-sqr-sqrt8.9%
sqrt-unprod16.0%
pow216.0%
*-commutative16.0%
associate-*l*16.0%
div-inv16.0%
Applied egg-rr16.0%
unpow216.0%
rem-sqrt-square28.6%
Simplified28.6%
if -0.25 < (sin.f64 kx) < 2.0000000000000001e-62Initial program 85.8%
remove-double-neg85.8%
sin-neg85.8%
neg-mul-185.8%
*-commutative85.8%
associate-*l*85.8%
associate-*l/79.8%
associate-/r/79.8%
associate-*l/85.8%
associate-/r/85.8%
sin-neg85.8%
neg-mul-185.8%
associate-/r*85.8%
associate-/r/85.8%
Simplified99.8%
Taylor expanded in kx around 0 38.8%
if 2.0000000000000001e-62 < (sin.f64 kx) Initial program 99.4%
Taylor expanded in ky around 0 51.7%
Taylor expanded in ky around inf 51.7%
*-commutative51.7%
associate-*l/51.8%
Simplified51.8%
Final simplification41.7%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.1) (fabs (* (sin th) (/ (sin ky) (sin kx)))) (if (<= (sin kx) 2e-62) (sin th) (* (sin ky) (/ (sin th) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.1) {
tmp = fabs((sin(th) * (sin(ky) / sin(kx))));
} else if (sin(kx) <= 2e-62) {
tmp = sin(th);
} else {
tmp = sin(ky) * (sin(th) / sin(kx));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(kx) <= (-0.1d0)) then
tmp = abs((sin(th) * (sin(ky) / sin(kx))))
else if (sin(kx) <= 2d-62) then
tmp = sin(th)
else
tmp = sin(ky) * (sin(th) / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.1) {
tmp = Math.abs((Math.sin(th) * (Math.sin(ky) / Math.sin(kx))));
} else if (Math.sin(kx) <= 2e-62) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.1: tmp = math.fabs((math.sin(th) * (math.sin(ky) / math.sin(kx)))) elif math.sin(kx) <= 2e-62: tmp = math.sin(th) else: tmp = math.sin(ky) * (math.sin(th) / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.1) tmp = abs(Float64(sin(th) * Float64(sin(ky) / sin(kx)))); elseif (sin(kx) <= 2e-62) tmp = sin(th); else tmp = Float64(sin(ky) * Float64(sin(th) / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.1) tmp = abs((sin(th) * (sin(ky) / sin(kx)))); elseif (sin(kx) <= 2e-62) tmp = sin(th); else tmp = sin(ky) * (sin(th) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.1], N[Abs[N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 2e-62], N[Sin[th], $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.1:\\
\;\;\;\;\left|\sin th \cdot \frac{\sin ky}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 2 \cdot 10^{-62}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.10000000000000001Initial program 99.5%
Taylor expanded in ky around 0 9.7%
associate-*l/9.7%
*-commutative9.7%
Applied egg-rr9.7%
add-sqr-sqrt7.6%
sqrt-unprod23.6%
pow223.6%
associate-/l*23.6%
associate-/r/23.6%
Applied egg-rr23.6%
unpow223.6%
rem-sqrt-square39.9%
associate-*l/39.8%
associate-*r/39.9%
Simplified39.9%
if -0.10000000000000001 < (sin.f64 kx) < 2.0000000000000001e-62Initial program 85.0%
remove-double-neg85.0%
sin-neg85.0%
neg-mul-185.0%
*-commutative85.0%
associate-*l*85.0%
associate-*l/78.5%
associate-/r/78.5%
associate-*l/85.0%
associate-/r/84.9%
sin-neg84.9%
neg-mul-184.9%
associate-/r*84.9%
associate-/r/85.0%
Simplified99.9%
Taylor expanded in kx around 0 40.6%
if 2.0000000000000001e-62 < (sin.f64 kx) Initial program 99.4%
Taylor expanded in ky around 0 51.7%
Taylor expanded in ky around inf 51.7%
*-commutative51.7%
associate-*l/51.8%
Simplified51.8%
Final simplification44.3%
(FPCore (kx ky th) :precision binary64 (let* ((t_1 (* (sin ky) (/ (sin th) (sin kx))))) (if (<= (sin kx) -0.1) (fabs t_1) (if (<= (sin kx) 2e-62) (sin th) t_1))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) * (sin(th) / sin(kx));
double tmp;
if (sin(kx) <= -0.1) {
tmp = fabs(t_1);
} else if (sin(kx) <= 2e-62) {
tmp = sin(th);
} else {
tmp = 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(ky) * (sin(th) / sin(kx))
if (sin(kx) <= (-0.1d0)) then
tmp = abs(t_1)
else if (sin(kx) <= 2d-62) then
tmp = sin(th)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
double tmp;
if (Math.sin(kx) <= -0.1) {
tmp = Math.abs(t_1);
} else if (Math.sin(kx) <= 2e-62) {
tmp = Math.sin(th);
} else {
tmp = t_1;
}
return tmp;
}
def code(kx, ky, th): t_1 = math.sin(ky) * (math.sin(th) / math.sin(kx)) tmp = 0 if math.sin(kx) <= -0.1: tmp = math.fabs(t_1) elif math.sin(kx) <= 2e-62: tmp = math.sin(th) else: tmp = t_1 return tmp
function code(kx, ky, th) t_1 = Float64(sin(ky) * Float64(sin(th) / sin(kx))) tmp = 0.0 if (sin(kx) <= -0.1) tmp = abs(t_1); elseif (sin(kx) <= 2e-62) tmp = sin(th); else tmp = t_1; end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = sin(ky) * (sin(th) / sin(kx)); tmp = 0.0; if (sin(kx) <= -0.1) tmp = abs(t_1); elseif (sin(kx) <= 2e-62) tmp = sin(th); else tmp = t_1; end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Sin[kx], $MachinePrecision], -0.1], N[Abs[t$95$1], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 2e-62], N[Sin[th], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sin ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{if}\;\sin kx \leq -0.1:\\
\;\;\;\;\left|t_1\right|\\
\mathbf{elif}\;\sin kx \leq 2 \cdot 10^{-62}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.10000000000000001Initial program 99.5%
Taylor expanded in ky around 0 9.7%
add-sqr-sqrt7.6%
sqrt-unprod23.6%
pow223.6%
*-commutative23.6%
Applied egg-rr23.6%
unpow223.6%
rem-sqrt-square39.9%
associate-*r/39.8%
associate-*l/39.9%
Simplified39.9%
if -0.10000000000000001 < (sin.f64 kx) < 2.0000000000000001e-62Initial program 85.0%
remove-double-neg85.0%
sin-neg85.0%
neg-mul-185.0%
*-commutative85.0%
associate-*l*85.0%
associate-*l/78.5%
associate-/r/78.5%
associate-*l/85.0%
associate-/r/84.9%
sin-neg84.9%
neg-mul-184.9%
associate-/r*84.9%
associate-/r/85.0%
Simplified99.9%
Taylor expanded in kx around 0 40.6%
if 2.0000000000000001e-62 < (sin.f64 kx) Initial program 99.4%
Taylor expanded in ky around 0 51.7%
Taylor expanded in ky around inf 51.7%
*-commutative51.7%
associate-*l/51.8%
Simplified51.8%
Final simplification44.3%
(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.6%
remove-double-neg92.6%
sin-neg92.6%
neg-mul-192.6%
*-commutative92.6%
associate-*l*92.6%
associate-*l/89.5%
associate-/r/89.5%
associate-*l/92.6%
associate-/r/92.6%
sin-neg92.6%
neg-mul-192.6%
associate-/r*92.6%
associate-/r/92.6%
Simplified99.6%
Final simplification99.6%
(FPCore (kx ky th)
:precision binary64
(if (<= th 0.061)
(* (sin ky) (/ th (hypot (sin ky) (sin kx))))
(if (<= th 6e+162)
(sin th)
(if (or (<= th 7e+244) (not (<= th 2.1e+264)))
(* (sin th) (fabs (/ (sin ky) (sin kx))))
(fabs (sin th))))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.061) {
tmp = sin(ky) * (th / hypot(sin(ky), sin(kx)));
} else if (th <= 6e+162) {
tmp = sin(th);
} else if ((th <= 7e+244) || !(th <= 2.1e+264)) {
tmp = sin(th) * fabs((sin(ky) / sin(kx)));
} else {
tmp = fabs(sin(th));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.061) {
tmp = Math.sin(ky) * (th / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else if (th <= 6e+162) {
tmp = Math.sin(th);
} else if ((th <= 7e+244) || !(th <= 2.1e+264)) {
tmp = Math.sin(th) * Math.abs((Math.sin(ky) / Math.sin(kx)));
} else {
tmp = Math.abs(Math.sin(th));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 0.061: tmp = math.sin(ky) * (th / math.hypot(math.sin(ky), math.sin(kx))) elif th <= 6e+162: tmp = math.sin(th) elif (th <= 7e+244) or not (th <= 2.1e+264): tmp = math.sin(th) * math.fabs((math.sin(ky) / math.sin(kx))) else: tmp = math.fabs(math.sin(th)) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 0.061) tmp = Float64(sin(ky) * Float64(th / hypot(sin(ky), sin(kx)))); elseif (th <= 6e+162) tmp = sin(th); elseif ((th <= 7e+244) || !(th <= 2.1e+264)) tmp = Float64(sin(th) * abs(Float64(sin(ky) / sin(kx)))); else tmp = abs(sin(th)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 0.061) tmp = sin(ky) * (th / hypot(sin(ky), sin(kx))); elseif (th <= 6e+162) tmp = sin(th); elseif ((th <= 7e+244) || ~((th <= 2.1e+264))) tmp = sin(th) * abs((sin(ky) / sin(kx))); else tmp = abs(sin(th)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 0.061], N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[th, 6e+162], N[Sin[th], $MachinePrecision], If[Or[LessEqual[th, 7e+244], N[Not[LessEqual[th, 2.1e+264]], $MachinePrecision]], N[(N[Sin[th], $MachinePrecision] * N[Abs[N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 0.061:\\
\;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{elif}\;th \leq 6 \cdot 10^{+162}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;th \leq 7 \cdot 10^{+244} \lor \neg \left(th \leq 2.1 \cdot 10^{+264}\right):\\
\;\;\;\;\sin th \cdot \left|\frac{\sin ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\sin th\right|\\
\end{array}
\end{array}
if th < 0.060999999999999999Initial program 92.1%
remove-double-neg92.1%
sin-neg92.1%
neg-mul-192.1%
*-commutative92.1%
associate-*l*92.1%
associate-*l/88.0%
associate-/r/88.0%
associate-*l/92.1%
associate-/r/92.1%
sin-neg92.1%
neg-mul-192.1%
associate-/r*92.1%
associate-/r/92.1%
Simplified99.6%
Taylor expanded in th around 0 61.3%
expm1-log1p-u61.0%
expm1-udef9.6%
Applied egg-rr10.0%
expm1-def70.4%
expm1-log1p70.7%
associate-*r/64.6%
*-commutative64.6%
*-lft-identity64.6%
times-frac70.6%
/-rgt-identity70.6%
hypot-def65.7%
unpow265.7%
unpow265.7%
+-commutative65.7%
unpow265.7%
unpow265.7%
hypot-def70.6%
Simplified70.6%
if 0.060999999999999999 < th < 5.9999999999999996e162Initial program 95.3%
remove-double-neg95.3%
sin-neg95.3%
neg-mul-195.3%
*-commutative95.3%
associate-*l*95.3%
associate-*l/95.3%
associate-/r/95.3%
associate-*l/95.3%
associate-/r/95.2%
sin-neg95.2%
neg-mul-195.2%
associate-/r*95.2%
associate-/r/95.3%
Simplified99.7%
Taylor expanded in kx around 0 22.2%
if 5.9999999999999996e162 < th < 6.99999999999999946e244 or 2.1000000000000001e264 < th Initial program 94.1%
Taylor expanded in ky around 0 35.6%
add-sqr-sqrt26.9%
sqrt-unprod29.2%
pow229.2%
Applied egg-rr29.2%
unpow229.2%
rem-sqrt-square39.0%
Simplified39.0%
if 6.99999999999999946e244 < th < 2.1000000000000001e264Initial program 80.6%
remove-double-neg80.6%
sin-neg80.6%
neg-mul-180.6%
*-commutative80.6%
associate-*l*80.6%
associate-*l/80.6%
associate-/r/80.6%
associate-*l/80.6%
associate-/r/80.6%
sin-neg80.6%
neg-mul-180.6%
associate-/r*80.6%
associate-/r/80.6%
Simplified100.0%
Taylor expanded in kx around 0 40.9%
add-sqr-sqrt20.3%
sqrt-unprod40.9%
pow240.9%
Applied egg-rr40.9%
unpow240.9%
rem-sqrt-square40.9%
Simplified40.9%
Final simplification59.6%
(FPCore (kx ky th)
:precision binary64
(if (<= th 0.122)
(* th (/ (sin ky) (hypot (sin ky) (sin kx))))
(if (<= th 5.6e+162)
(sin th)
(if (or (<= th 3.4e+244) (not (<= th 1.65e+265)))
(* (sin th) (fabs (/ (sin ky) (sin kx))))
(fabs (sin th))))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.122) {
tmp = th * (sin(ky) / hypot(sin(ky), sin(kx)));
} else if (th <= 5.6e+162) {
tmp = sin(th);
} else if ((th <= 3.4e+244) || !(th <= 1.65e+265)) {
tmp = sin(th) * fabs((sin(ky) / sin(kx)));
} else {
tmp = fabs(sin(th));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.122) {
tmp = th * (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else if (th <= 5.6e+162) {
tmp = Math.sin(th);
} else if ((th <= 3.4e+244) || !(th <= 1.65e+265)) {
tmp = Math.sin(th) * Math.abs((Math.sin(ky) / Math.sin(kx)));
} else {
tmp = Math.abs(Math.sin(th));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 0.122: tmp = th * (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx))) elif th <= 5.6e+162: tmp = math.sin(th) elif (th <= 3.4e+244) or not (th <= 1.65e+265): tmp = math.sin(th) * math.fabs((math.sin(ky) / math.sin(kx))) else: tmp = math.fabs(math.sin(th)) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 0.122) tmp = Float64(th * Float64(sin(ky) / hypot(sin(ky), sin(kx)))); elseif (th <= 5.6e+162) tmp = sin(th); elseif ((th <= 3.4e+244) || !(th <= 1.65e+265)) tmp = Float64(sin(th) * abs(Float64(sin(ky) / sin(kx)))); else tmp = abs(sin(th)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 0.122) tmp = th * (sin(ky) / hypot(sin(ky), sin(kx))); elseif (th <= 5.6e+162) tmp = sin(th); elseif ((th <= 3.4e+244) || ~((th <= 1.65e+265))) tmp = sin(th) * abs((sin(ky) / sin(kx))); else tmp = abs(sin(th)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 0.122], N[(th * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[th, 5.6e+162], N[Sin[th], $MachinePrecision], If[Or[LessEqual[th, 3.4e+244], N[Not[LessEqual[th, 1.65e+265]], $MachinePrecision]], N[(N[Sin[th], $MachinePrecision] * N[Abs[N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 0.122:\\
\;\;\;\;th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{elif}\;th \leq 5.6 \cdot 10^{+162}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;th \leq 3.4 \cdot 10^{+244} \lor \neg \left(th \leq 1.65 \cdot 10^{+265}\right):\\
\;\;\;\;\sin th \cdot \left|\frac{\sin ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\sin th\right|\\
\end{array}
\end{array}
if th < 0.122Initial program 92.1%
remove-double-neg92.1%
sin-neg92.1%
neg-mul-192.1%
*-commutative92.1%
associate-*l*92.1%
associate-*l/88.0%
associate-/r/88.0%
associate-*l/92.1%
associate-/r/92.1%
sin-neg92.1%
neg-mul-192.1%
associate-/r*92.1%
associate-/r/92.1%
Simplified99.6%
Taylor expanded in th around 0 70.7%
if 0.122 < th < 5.59999999999999981e162Initial program 95.3%
remove-double-neg95.3%
sin-neg95.3%
neg-mul-195.3%
*-commutative95.3%
associate-*l*95.3%
associate-*l/95.3%
associate-/r/95.3%
associate-*l/95.3%
associate-/r/95.2%
sin-neg95.2%
neg-mul-195.2%
associate-/r*95.2%
associate-/r/95.3%
Simplified99.7%
Taylor expanded in kx around 0 22.2%
if 5.59999999999999981e162 < th < 3.4000000000000001e244 or 1.6499999999999999e265 < th Initial program 94.1%
Taylor expanded in ky around 0 35.6%
add-sqr-sqrt26.9%
sqrt-unprod29.2%
pow229.2%
Applied egg-rr29.2%
unpow229.2%
rem-sqrt-square39.0%
Simplified39.0%
if 3.4000000000000001e244 < th < 1.6499999999999999e265Initial program 80.6%
remove-double-neg80.6%
sin-neg80.6%
neg-mul-180.6%
*-commutative80.6%
associate-*l*80.6%
associate-*l/80.6%
associate-/r/80.6%
associate-*l/80.6%
associate-/r/80.6%
sin-neg80.6%
neg-mul-180.6%
associate-/r*80.6%
associate-/r/80.6%
Simplified100.0%
Taylor expanded in kx around 0 40.9%
add-sqr-sqrt20.3%
sqrt-unprod40.9%
pow240.9%
Applied egg-rr40.9%
unpow240.9%
rem-sqrt-square40.9%
Simplified40.9%
Final simplification59.6%
(FPCore (kx ky th)
:precision binary64
(if (<= th 0.009)
(/ th (/ (hypot (sin kx) (sin ky)) (sin ky)))
(if (<= th 2e+162)
(sin th)
(if (or (<= th 1.7e+246) (not (<= th 8.5e+264)))
(* (sin th) (fabs (/ (sin ky) (sin kx))))
(fabs (sin th))))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.009) {
tmp = th / (hypot(sin(kx), sin(ky)) / sin(ky));
} else if (th <= 2e+162) {
tmp = sin(th);
} else if ((th <= 1.7e+246) || !(th <= 8.5e+264)) {
tmp = sin(th) * fabs((sin(ky) / sin(kx)));
} else {
tmp = fabs(sin(th));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.009) {
tmp = th / (Math.hypot(Math.sin(kx), Math.sin(ky)) / Math.sin(ky));
} else if (th <= 2e+162) {
tmp = Math.sin(th);
} else if ((th <= 1.7e+246) || !(th <= 8.5e+264)) {
tmp = Math.sin(th) * Math.abs((Math.sin(ky) / Math.sin(kx)));
} else {
tmp = Math.abs(Math.sin(th));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 0.009: tmp = th / (math.hypot(math.sin(kx), math.sin(ky)) / math.sin(ky)) elif th <= 2e+162: tmp = math.sin(th) elif (th <= 1.7e+246) or not (th <= 8.5e+264): tmp = math.sin(th) * math.fabs((math.sin(ky) / math.sin(kx))) else: tmp = math.fabs(math.sin(th)) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 0.009) tmp = Float64(th / Float64(hypot(sin(kx), sin(ky)) / sin(ky))); elseif (th <= 2e+162) tmp = sin(th); elseif ((th <= 1.7e+246) || !(th <= 8.5e+264)) tmp = Float64(sin(th) * abs(Float64(sin(ky) / sin(kx)))); else tmp = abs(sin(th)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 0.009) tmp = th / (hypot(sin(kx), sin(ky)) / sin(ky)); elseif (th <= 2e+162) tmp = sin(th); elseif ((th <= 1.7e+246) || ~((th <= 8.5e+264))) tmp = sin(th) * abs((sin(ky) / sin(kx))); else tmp = abs(sin(th)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 0.009], N[(th / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[th, 2e+162], N[Sin[th], $MachinePrecision], If[Or[LessEqual[th, 1.7e+246], N[Not[LessEqual[th, 8.5e+264]], $MachinePrecision]], N[(N[Sin[th], $MachinePrecision] * N[Abs[N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 0.009:\\
\;\;\;\;\frac{th}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{\sin ky}}\\
\mathbf{elif}\;th \leq 2 \cdot 10^{+162}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;th \leq 1.7 \cdot 10^{+246} \lor \neg \left(th \leq 8.5 \cdot 10^{+264}\right):\\
\;\;\;\;\sin th \cdot \left|\frac{\sin ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\sin th\right|\\
\end{array}
\end{array}
if th < 0.00899999999999999932Initial program 92.1%
remove-double-neg92.1%
sin-neg92.1%
neg-mul-192.1%
*-commutative92.1%
associate-*l*92.1%
associate-*l/88.0%
associate-/r/88.0%
associate-*l/92.1%
associate-/r/92.1%
sin-neg92.1%
neg-mul-192.1%
associate-/r*92.1%
associate-/r/92.1%
Simplified99.6%
*-commutative99.6%
clear-num99.5%
un-div-inv99.6%
hypot-udef92.2%
unpow292.2%
unpow292.2%
+-commutative92.2%
unpow292.2%
unpow292.2%
hypot-def99.6%
Applied egg-rr99.6%
Taylor expanded in th around 0 70.7%
if 0.00899999999999999932 < th < 1.9999999999999999e162Initial program 95.3%
remove-double-neg95.3%
sin-neg95.3%
neg-mul-195.3%
*-commutative95.3%
associate-*l*95.3%
associate-*l/95.3%
associate-/r/95.3%
associate-*l/95.3%
associate-/r/95.2%
sin-neg95.2%
neg-mul-195.2%
associate-/r*95.2%
associate-/r/95.3%
Simplified99.7%
Taylor expanded in kx around 0 22.2%
if 1.9999999999999999e162 < th < 1.69999999999999994e246 or 8.49999999999999976e264 < th Initial program 94.1%
Taylor expanded in ky around 0 35.6%
add-sqr-sqrt26.9%
sqrt-unprod29.2%
pow229.2%
Applied egg-rr29.2%
unpow229.2%
rem-sqrt-square39.0%
Simplified39.0%
if 1.69999999999999994e246 < th < 8.49999999999999976e264Initial program 80.6%
remove-double-neg80.6%
sin-neg80.6%
neg-mul-180.6%
*-commutative80.6%
associate-*l*80.6%
associate-*l/80.6%
associate-/r/80.6%
associate-*l/80.6%
associate-/r/80.6%
sin-neg80.6%
neg-mul-180.6%
associate-/r*80.6%
associate-/r/80.6%
Simplified100.0%
Taylor expanded in kx around 0 40.9%
add-sqr-sqrt20.3%
sqrt-unprod40.9%
pow240.9%
Applied egg-rr40.9%
unpow240.9%
rem-sqrt-square40.9%
Simplified40.9%
Final simplification59.7%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.06) (fabs (sin th)) (if (<= (sin ky) 1e-59) (* (sin th) (/ ky (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.06) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 1e-59) {
tmp = sin(th) * (ky / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.06d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 1d-59) then
tmp = sin(th) * (ky / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.06) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 1e-59) {
tmp = Math.sin(th) * (ky / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.06: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 1e-59: tmp = math.sin(th) * (ky / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.06) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-59) tmp = Float64(sin(th) * Float64(ky / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.06) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-59) tmp = sin(th) * (ky / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.06], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-59], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.06:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 10^{-59}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.059999999999999998Initial program 99.7%
remove-double-neg99.7%
sin-neg99.7%
neg-mul-199.7%
*-commutative99.7%
associate-*l*99.7%
associate-*l/99.6%
associate-/r/99.6%
associate-*l/99.7%
associate-/r/99.6%
sin-neg99.6%
neg-mul-199.6%
associate-/r*99.6%
associate-/r/99.7%
Simplified99.7%
Taylor expanded in kx around 0 2.6%
add-sqr-sqrt1.6%
sqrt-unprod27.0%
pow227.0%
Applied egg-rr27.0%
unpow227.0%
rem-sqrt-square30.4%
Simplified30.4%
if -0.059999999999999998 < (sin.f64 ky) < 1e-59Initial program 82.7%
Taylor expanded in ky around 0 47.2%
if 1e-59 < (sin.f64 ky) Initial program 99.7%
remove-double-neg99.7%
sin-neg99.7%
neg-mul-199.7%
*-commutative99.7%
associate-*l*99.7%
associate-*l/98.5%
associate-/r/98.5%
associate-*l/99.7%
associate-/r/99.6%
sin-neg99.6%
neg-mul-199.6%
associate-/r*99.6%
associate-/r/99.7%
Simplified99.7%
Taylor expanded in kx around 0 59.5%
Final simplification46.7%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.06) (fabs (sin th)) (if (<= (sin ky) 1e-59) (/ ky (/ (sin kx) (sin th))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.06) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 1e-59) {
tmp = ky / (sin(kx) / sin(th));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.06d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 1d-59) then
tmp = ky / (sin(kx) / sin(th))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.06) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 1e-59) {
tmp = ky / (Math.sin(kx) / Math.sin(th));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.06: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 1e-59: tmp = ky / (math.sin(kx) / math.sin(th)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.06) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-59) tmp = Float64(ky / Float64(sin(kx) / sin(th))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.06) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-59) tmp = ky / (sin(kx) / sin(th)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.06], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-59], N[(ky / N[(N[Sin[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.06:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 10^{-59}:\\
\;\;\;\;\frac{ky}{\frac{\sin kx}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.059999999999999998Initial program 99.7%
remove-double-neg99.7%
sin-neg99.7%
neg-mul-199.7%
*-commutative99.7%
associate-*l*99.7%
associate-*l/99.6%
associate-/r/99.6%
associate-*l/99.7%
associate-/r/99.6%
sin-neg99.6%
neg-mul-199.6%
associate-/r*99.6%
associate-/r/99.7%
Simplified99.7%
Taylor expanded in kx around 0 2.6%
add-sqr-sqrt1.6%
sqrt-unprod27.0%
pow227.0%
Applied egg-rr27.0%
unpow227.0%
rem-sqrt-square30.4%
Simplified30.4%
if -0.059999999999999998 < (sin.f64 ky) < 1e-59Initial program 82.7%
remove-double-neg82.7%
sin-neg82.7%
neg-mul-182.7%
*-commutative82.7%
associate-*l*82.7%
associate-*l/76.3%
associate-/r/76.3%
associate-*l/82.7%
associate-/r/82.8%
sin-neg82.8%
neg-mul-182.8%
associate-/r*82.8%
associate-/r/82.7%
Simplified99.6%
Taylor expanded in ky around 0 44.4%
associate-/l*47.3%
Simplified47.3%
if 1e-59 < (sin.f64 ky) Initial program 99.7%
remove-double-neg99.7%
sin-neg99.7%
neg-mul-199.7%
*-commutative99.7%
associate-*l*99.7%
associate-*l/98.5%
associate-/r/98.5%
associate-*l/99.7%
associate-/r/99.6%
sin-neg99.6%
neg-mul-199.6%
associate-/r*99.6%
associate-/r/99.7%
Simplified99.7%
Taylor expanded in kx around 0 59.5%
Final simplification46.7%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.06) (sqrt (pow (sin th) 2.0)) (if (<= (sin ky) 1e-59) (/ ky (/ (sin kx) (sin th))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.06) {
tmp = sqrt(pow(sin(th), 2.0));
} else if (sin(ky) <= 1e-59) {
tmp = ky / (sin(kx) / sin(th));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.06d0)) then
tmp = sqrt((sin(th) ** 2.0d0))
else if (sin(ky) <= 1d-59) then
tmp = ky / (sin(kx) / sin(th))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.06) {
tmp = Math.sqrt(Math.pow(Math.sin(th), 2.0));
} else if (Math.sin(ky) <= 1e-59) {
tmp = ky / (Math.sin(kx) / Math.sin(th));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.06: tmp = math.sqrt(math.pow(math.sin(th), 2.0)) elif math.sin(ky) <= 1e-59: tmp = ky / (math.sin(kx) / math.sin(th)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.06) tmp = sqrt((sin(th) ^ 2.0)); elseif (sin(ky) <= 1e-59) tmp = Float64(ky / Float64(sin(kx) / sin(th))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.06) tmp = sqrt((sin(th) ^ 2.0)); elseif (sin(ky) <= 1e-59) tmp = ky / (sin(kx) / sin(th)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.06], N[Sqrt[N[Power[N[Sin[th], $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-59], N[(ky / N[(N[Sin[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.06:\\
\;\;\;\;\sqrt{{\sin th}^{2}}\\
\mathbf{elif}\;\sin ky \leq 10^{-59}:\\
\;\;\;\;\frac{ky}{\frac{\sin kx}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.059999999999999998Initial program 99.7%
remove-double-neg99.7%
sin-neg99.7%
neg-mul-199.7%
*-commutative99.7%
associate-*l*99.7%
associate-*l/99.6%
associate-/r/99.6%
associate-*l/99.7%
associate-/r/99.6%
sin-neg99.6%
neg-mul-199.6%
associate-/r*99.6%
associate-/r/99.7%
Simplified99.7%
Taylor expanded in kx around 0 2.6%
add-sqr-sqrt1.6%
sqrt-unprod27.0%
pow227.0%
Applied egg-rr27.0%
if -0.059999999999999998 < (sin.f64 ky) < 1e-59Initial program 82.7%
remove-double-neg82.7%
sin-neg82.7%
neg-mul-182.7%
*-commutative82.7%
associate-*l*82.7%
associate-*l/76.3%
associate-/r/76.3%
associate-*l/82.7%
associate-/r/82.8%
sin-neg82.8%
neg-mul-182.8%
associate-/r*82.8%
associate-/r/82.7%
Simplified99.6%
Taylor expanded in ky around 0 44.4%
associate-/l*47.3%
Simplified47.3%
if 1e-59 < (sin.f64 ky) Initial program 99.7%
remove-double-neg99.7%
sin-neg99.7%
neg-mul-199.7%
*-commutative99.7%
associate-*l*99.7%
associate-*l/98.5%
associate-/r/98.5%
associate-*l/99.7%
associate-/r/99.6%
sin-neg99.6%
neg-mul-199.6%
associate-/r*99.6%
associate-/r/99.7%
Simplified99.7%
Taylor expanded in kx around 0 59.5%
Final simplification45.8%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.25) (fabs (* (sin ky) (/ th (sin kx)))) (if (<= (sin kx) 2e-62) (sin th) (/ (sin th) (/ (sin kx) ky)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.25) {
tmp = fabs((sin(ky) * (th / sin(kx))));
} else if (sin(kx) <= 2e-62) {
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.25d0)) then
tmp = abs((sin(ky) * (th / sin(kx))))
else if (sin(kx) <= 2d-62) 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.25) {
tmp = Math.abs((Math.sin(ky) * (th / Math.sin(kx))));
} else if (Math.sin(kx) <= 2e-62) {
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.25: tmp = math.fabs((math.sin(ky) * (th / math.sin(kx)))) elif math.sin(kx) <= 2e-62: 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.25) tmp = abs(Float64(sin(ky) * Float64(th / sin(kx)))); elseif (sin(kx) <= 2e-62) 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.25) tmp = abs((sin(ky) * (th / sin(kx)))); elseif (sin(kx) <= 2e-62) 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.25], N[Abs[N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 2e-62], 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.25:\\
\;\;\;\;\left|\sin ky \cdot \frac{th}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 2 \cdot 10^{-62}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{ky}}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.25Initial program 99.5%
remove-double-neg99.5%
sin-neg99.5%
neg-mul-199.5%
*-commutative99.5%
associate-*l*99.5%
associate-*l/99.4%
associate-/r/99.4%
associate-*l/99.5%
associate-/r/99.6%
sin-neg99.6%
neg-mul-199.6%
associate-/r*99.6%
associate-/r/99.5%
Simplified99.5%
Taylor expanded in th around 0 67.9%
Taylor expanded in ky around 0 10.8%
add-sqr-sqrt8.9%
sqrt-unprod16.0%
pow216.0%
*-commutative16.0%
associate-*l*16.0%
div-inv16.0%
Applied egg-rr16.0%
unpow216.0%
rem-sqrt-square28.6%
Simplified28.6%
if -0.25 < (sin.f64 kx) < 2.0000000000000001e-62Initial program 85.8%
remove-double-neg85.8%
sin-neg85.8%
neg-mul-185.8%
*-commutative85.8%
associate-*l*85.8%
associate-*l/79.8%
associate-/r/79.8%
associate-*l/85.8%
associate-/r/85.8%
sin-neg85.8%
neg-mul-185.8%
associate-/r*85.8%
associate-/r/85.8%
Simplified99.8%
Taylor expanded in kx around 0 38.8%
if 2.0000000000000001e-62 < (sin.f64 kx) Initial program 99.4%
remove-double-neg99.4%
sin-neg99.4%
neg-mul-199.4%
*-commutative99.4%
associate-*l*99.4%
associate-*l/99.3%
associate-/r/99.3%
associate-*l/99.4%
associate-/r/99.4%
sin-neg99.4%
neg-mul-199.4%
associate-/r*99.4%
associate-/r/99.4%
Simplified99.4%
*-commutative99.4%
clear-num99.4%
un-div-inv99.5%
hypot-udef99.4%
unpow299.4%
unpow299.4%
+-commutative99.4%
unpow299.4%
unpow299.4%
hypot-def99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 43.3%
Final simplification38.8%
(FPCore (kx ky th) :precision binary64 (if (<= kx 5.8e-62) (sin th) (* (sin th) (fabs (/ (sin ky) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 5.8e-62) {
tmp = sin(th);
} else {
tmp = sin(th) * fabs((sin(ky) / sin(kx)));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (kx <= 5.8d-62) then
tmp = sin(th)
else
tmp = sin(th) * abs((sin(ky) / sin(kx)))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 5.8e-62) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) * Math.abs((Math.sin(ky) / Math.sin(kx)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 5.8e-62: tmp = math.sin(th) else: tmp = math.sin(th) * math.fabs((math.sin(ky) / math.sin(kx))) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 5.8e-62) tmp = sin(th); else tmp = Float64(sin(th) * abs(Float64(sin(ky) / sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 5.8e-62) tmp = sin(th); else tmp = sin(th) * abs((sin(ky) / sin(kx))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 5.8e-62], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[Abs[N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 5.8 \cdot 10^{-62}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \left|\frac{\sin ky}{\sin kx}\right|\\
\end{array}
\end{array}
if kx < 5.79999999999999971e-62Initial program 89.5%
remove-double-neg89.5%
sin-neg89.5%
neg-mul-189.5%
*-commutative89.5%
associate-*l*89.5%
associate-*l/85.1%
associate-/r/85.1%
associate-*l/89.5%
associate-/r/89.5%
sin-neg89.5%
neg-mul-189.5%
associate-/r*89.5%
associate-/r/89.5%
Simplified99.7%
Taylor expanded in kx around 0 29.9%
if 5.79999999999999971e-62 < kx Initial program 99.4%
Taylor expanded in ky around 0 38.3%
add-sqr-sqrt17.5%
sqrt-unprod24.0%
pow224.0%
Applied egg-rr24.0%
unpow224.0%
rem-sqrt-square29.8%
Simplified29.8%
Final simplification29.8%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) 2e-62) (sin th) (if (<= (sin kx) 8e-6) (* (sin th) (/ ky kx)) (* th (/ ky (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= 2e-62) {
tmp = sin(th);
} else if (sin(kx) <= 8e-6) {
tmp = sin(th) * (ky / kx);
} 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 (sin(kx) <= 2d-62) then
tmp = sin(th)
else if (sin(kx) <= 8d-6) then
tmp = sin(th) * (ky / kx)
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 (Math.sin(kx) <= 2e-62) {
tmp = Math.sin(th);
} else if (Math.sin(kx) <= 8e-6) {
tmp = Math.sin(th) * (ky / kx);
} else {
tmp = th * (ky / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= 2e-62: tmp = math.sin(th) elif math.sin(kx) <= 8e-6: tmp = math.sin(th) * (ky / kx) else: tmp = th * (ky / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= 2e-62) tmp = sin(th); elseif (sin(kx) <= 8e-6) tmp = Float64(sin(th) * Float64(ky / kx)); else tmp = Float64(th * Float64(ky / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= 2e-62) tmp = sin(th); elseif (sin(kx) <= 8e-6) tmp = sin(th) * (ky / kx); else tmp = th * (ky / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], 2e-62], N[Sin[th], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 8e-6], N[(N[Sin[th], $MachinePrecision] * N[(ky / kx), $MachinePrecision]), $MachinePrecision], N[(th * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq 2 \cdot 10^{-62}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;\sin kx \leq 8 \cdot 10^{-6}:\\
\;\;\;\;\sin th \cdot \frac{ky}{kx}\\
\mathbf{else}:\\
\;\;\;\;th \cdot \frac{ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < 2.0000000000000001e-62Initial program 89.0%
remove-double-neg89.0%
sin-neg89.0%
neg-mul-189.0%
*-commutative89.0%
associate-*l*89.0%
associate-*l/84.4%
associate-/r/84.4%
associate-*l/89.0%
associate-/r/89.0%
sin-neg89.0%
neg-mul-189.0%
associate-/r*89.0%
associate-/r/89.0%
Simplified99.7%
Taylor expanded in kx around 0 31.8%
if 2.0000000000000001e-62 < (sin.f64 kx) < 7.99999999999999964e-6Initial program 99.5%
Taylor expanded in ky around 0 52.0%
Taylor expanded in kx around 0 50.7%
Taylor expanded in ky around 0 48.2%
if 7.99999999999999964e-6 < (sin.f64 kx) Initial program 99.4%
remove-double-neg99.4%
sin-neg99.4%
neg-mul-199.4%
*-commutative99.4%
associate-*l*99.4%
associate-*l/99.3%
associate-/r/99.3%
associate-*l/99.4%
associate-/r/99.3%
sin-neg99.3%
neg-mul-199.3%
associate-/r*99.3%
associate-/r/99.4%
Simplified99.4%
Taylor expanded in th around 0 49.3%
Taylor expanded in ky around 0 21.1%
associate-/l*21.1%
Simplified21.1%
associate-/r/21.1%
Applied egg-rr21.1%
Final simplification30.1%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) 2e-62) (sin th) (if (<= (sin kx) 8e-6) (* (sin th) (/ ky kx)) (* ky (/ th (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= 2e-62) {
tmp = sin(th);
} else if (sin(kx) <= 8e-6) {
tmp = sin(th) * (ky / kx);
} 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 (sin(kx) <= 2d-62) then
tmp = sin(th)
else if (sin(kx) <= 8d-6) then
tmp = sin(th) * (ky / kx)
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 (Math.sin(kx) <= 2e-62) {
tmp = Math.sin(th);
} else if (Math.sin(kx) <= 8e-6) {
tmp = Math.sin(th) * (ky / kx);
} else {
tmp = ky * (th / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= 2e-62: tmp = math.sin(th) elif math.sin(kx) <= 8e-6: tmp = math.sin(th) * (ky / kx) else: tmp = ky * (th / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= 2e-62) tmp = sin(th); elseif (sin(kx) <= 8e-6) tmp = Float64(sin(th) * Float64(ky / kx)); else tmp = Float64(ky * Float64(th / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= 2e-62) tmp = sin(th); elseif (sin(kx) <= 8e-6) tmp = sin(th) * (ky / kx); else tmp = ky * (th / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], 2e-62], N[Sin[th], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 8e-6], N[(N[Sin[th], $MachinePrecision] * N[(ky / kx), $MachinePrecision]), $MachinePrecision], N[(ky * N[(th / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq 2 \cdot 10^{-62}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;\sin kx \leq 8 \cdot 10^{-6}:\\
\;\;\;\;\sin th \cdot \frac{ky}{kx}\\
\mathbf{else}:\\
\;\;\;\;ky \cdot \frac{th}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < 2.0000000000000001e-62Initial program 89.0%
remove-double-neg89.0%
sin-neg89.0%
neg-mul-189.0%
*-commutative89.0%
associate-*l*89.0%
associate-*l/84.4%
associate-/r/84.4%
associate-*l/89.0%
associate-/r/89.0%
sin-neg89.0%
neg-mul-189.0%
associate-/r*89.0%
associate-/r/89.0%
Simplified99.7%
Taylor expanded in kx around 0 31.8%
if 2.0000000000000001e-62 < (sin.f64 kx) < 7.99999999999999964e-6Initial program 99.5%
Taylor expanded in ky around 0 52.0%
Taylor expanded in kx around 0 50.7%
Taylor expanded in ky around 0 48.2%
if 7.99999999999999964e-6 < (sin.f64 kx) Initial program 99.4%
remove-double-neg99.4%
sin-neg99.4%
neg-mul-199.4%
*-commutative99.4%
associate-*l*99.4%
associate-*l/99.3%
associate-/r/99.3%
associate-*l/99.4%
associate-/r/99.3%
sin-neg99.3%
neg-mul-199.3%
associate-/r*99.3%
associate-/r/99.4%
Simplified99.4%
Taylor expanded in th around 0 49.3%
Taylor expanded in ky around 0 21.1%
associate-/l*21.1%
Simplified21.1%
clear-num21.2%
associate-/r/21.2%
clear-num21.2%
Applied egg-rr21.2%
Final simplification30.1%
(FPCore (kx ky th) :precision binary64 (if (<= kx 5.8e-62) (sin th) (if (<= kx 9.5e-6) (* (sin th) (/ ky kx)) (fabs (* th (/ ky (sin kx)))))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 5.8e-62) {
tmp = sin(th);
} else if (kx <= 9.5e-6) {
tmp = sin(th) * (ky / kx);
} else {
tmp = fabs((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 (kx <= 5.8d-62) then
tmp = sin(th)
else if (kx <= 9.5d-6) then
tmp = sin(th) * (ky / kx)
else
tmp = abs((th * (ky / sin(kx))))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 5.8e-62) {
tmp = Math.sin(th);
} else if (kx <= 9.5e-6) {
tmp = Math.sin(th) * (ky / kx);
} else {
tmp = Math.abs((th * (ky / Math.sin(kx))));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 5.8e-62: tmp = math.sin(th) elif kx <= 9.5e-6: tmp = math.sin(th) * (ky / kx) else: tmp = math.fabs((th * (ky / math.sin(kx)))) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 5.8e-62) tmp = sin(th); elseif (kx <= 9.5e-6) tmp = Float64(sin(th) * Float64(ky / kx)); else tmp = abs(Float64(th * Float64(ky / sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 5.8e-62) tmp = sin(th); elseif (kx <= 9.5e-6) tmp = sin(th) * (ky / kx); else tmp = abs((th * (ky / sin(kx)))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 5.8e-62], N[Sin[th], $MachinePrecision], If[LessEqual[kx, 9.5e-6], N[(N[Sin[th], $MachinePrecision] * N[(ky / kx), $MachinePrecision]), $MachinePrecision], N[Abs[N[(th * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 5.8 \cdot 10^{-62}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;kx \leq 9.5 \cdot 10^{-6}:\\
\;\;\;\;\sin th \cdot \frac{ky}{kx}\\
\mathbf{else}:\\
\;\;\;\;\left|th \cdot \frac{ky}{\sin kx}\right|\\
\end{array}
\end{array}
if kx < 5.79999999999999971e-62Initial program 89.5%
remove-double-neg89.5%
sin-neg89.5%
neg-mul-189.5%
*-commutative89.5%
associate-*l*89.5%
associate-*l/85.1%
associate-/r/85.1%
associate-*l/89.5%
associate-/r/89.5%
sin-neg89.5%
neg-mul-189.5%
associate-/r*89.5%
associate-/r/89.5%
Simplified99.7%
Taylor expanded in kx around 0 29.9%
if 5.79999999999999971e-62 < kx < 9.5000000000000005e-6Initial program 99.5%
Taylor expanded in ky around 0 52.0%
Taylor expanded in kx around 0 50.7%
Taylor expanded in ky around 0 48.2%
if 9.5000000000000005e-6 < kx Initial program 99.4%
remove-double-neg99.4%
sin-neg99.4%
neg-mul-199.4%
*-commutative99.4%
associate-*l*99.4%
associate-*l/99.3%
associate-/r/99.3%
associate-*l/99.4%
associate-/r/99.4%
sin-neg99.4%
neg-mul-199.4%
associate-/r*99.4%
associate-/r/99.4%
Simplified99.5%
Taylor expanded in th around 0 53.4%
Taylor expanded in ky around 0 13.1%
associate-/l*13.1%
Simplified13.1%
add-sqr-sqrt6.4%
sqrt-unprod8.7%
pow28.7%
associate-/r/8.7%
*-commutative8.7%
Applied egg-rr8.7%
unpow28.7%
rem-sqrt-square11.7%
Simplified11.7%
Final simplification27.0%
(FPCore (kx ky th) :precision binary64 (if (<= kx 6.8e-62) (sin th) (if (<= kx 9e-6) (* (sin th) (/ ky kx)) (fabs (/ (* th ky) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 6.8e-62) {
tmp = sin(th);
} else if (kx <= 9e-6) {
tmp = sin(th) * (ky / kx);
} else {
tmp = fabs(((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 (kx <= 6.8d-62) then
tmp = sin(th)
else if (kx <= 9d-6) then
tmp = sin(th) * (ky / kx)
else
tmp = abs(((th * ky) / sin(kx)))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 6.8e-62) {
tmp = Math.sin(th);
} else if (kx <= 9e-6) {
tmp = Math.sin(th) * (ky / kx);
} else {
tmp = Math.abs(((th * ky) / Math.sin(kx)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 6.8e-62: tmp = math.sin(th) elif kx <= 9e-6: tmp = math.sin(th) * (ky / kx) else: tmp = math.fabs(((th * ky) / math.sin(kx))) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 6.8e-62) tmp = sin(th); elseif (kx <= 9e-6) tmp = Float64(sin(th) * Float64(ky / kx)); else tmp = abs(Float64(Float64(th * ky) / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 6.8e-62) tmp = sin(th); elseif (kx <= 9e-6) tmp = sin(th) * (ky / kx); else tmp = abs(((th * ky) / sin(kx))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 6.8e-62], N[Sin[th], $MachinePrecision], If[LessEqual[kx, 9e-6], N[(N[Sin[th], $MachinePrecision] * N[(ky / kx), $MachinePrecision]), $MachinePrecision], N[Abs[N[(N[(th * ky), $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 6.8 \cdot 10^{-62}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;kx \leq 9 \cdot 10^{-6}:\\
\;\;\;\;\sin th \cdot \frac{ky}{kx}\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{th \cdot ky}{\sin kx}\right|\\
\end{array}
\end{array}
if kx < 6.79999999999999975e-62Initial program 89.5%
remove-double-neg89.5%
sin-neg89.5%
neg-mul-189.5%
*-commutative89.5%
associate-*l*89.5%
associate-*l/85.1%
associate-/r/85.1%
associate-*l/89.5%
associate-/r/89.5%
sin-neg89.5%
neg-mul-189.5%
associate-/r*89.5%
associate-/r/89.5%
Simplified99.7%
Taylor expanded in kx around 0 29.9%
if 6.79999999999999975e-62 < kx < 9.00000000000000023e-6Initial program 99.5%
Taylor expanded in ky around 0 52.0%
Taylor expanded in kx around 0 50.7%
Taylor expanded in ky around 0 48.2%
if 9.00000000000000023e-6 < kx Initial program 99.4%
remove-double-neg99.4%
sin-neg99.4%
neg-mul-199.4%
*-commutative99.4%
associate-*l*99.4%
associate-*l/99.3%
associate-/r/99.3%
associate-*l/99.4%
associate-/r/99.4%
sin-neg99.4%
neg-mul-199.4%
associate-/r*99.4%
associate-/r/99.4%
Simplified99.5%
Taylor expanded in th around 0 53.4%
Taylor expanded in ky around 0 15.5%
add-sqr-sqrt7.3%
sqrt-unprod10.2%
pow210.2%
*-commutative10.2%
associate-*l*10.3%
div-inv10.2%
Applied egg-rr10.2%
unpow210.2%
rem-sqrt-square14.0%
Simplified14.0%
Taylor expanded in ky around 0 11.7%
Final simplification27.0%
(FPCore (kx ky th) :precision binary64 (if (or (<= ky 8e-191) (and (not (<= ky 4.15e-150)) (<= ky 1e-95))) (* (sin th) (/ ky kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if ((ky <= 8e-191) || (!(ky <= 4.15e-150) && (ky <= 1e-95))) {
tmp = sin(th) * (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 <= 8d-191) .or. (.not. (ky <= 4.15d-150)) .and. (ky <= 1d-95)) then
tmp = sin(th) * (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 <= 8e-191) || (!(ky <= 4.15e-150) && (ky <= 1e-95))) {
tmp = Math.sin(th) * (ky / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (ky <= 8e-191) or (not (ky <= 4.15e-150) and (ky <= 1e-95)): tmp = math.sin(th) * (ky / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if ((ky <= 8e-191) || (!(ky <= 4.15e-150) && (ky <= 1e-95))) tmp = Float64(sin(th) * Float64(ky / kx)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((ky <= 8e-191) || (~((ky <= 4.15e-150)) && (ky <= 1e-95))) tmp = sin(th) * (ky / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[Or[LessEqual[ky, 8e-191], And[N[Not[LessEqual[ky, 4.15e-150]], $MachinePrecision], LessEqual[ky, 1e-95]]], N[(N[Sin[th], $MachinePrecision] * N[(ky / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 8 \cdot 10^{-191} \lor \neg \left(ky \leq 4.15 \cdot 10^{-150}\right) \land ky \leq 10^{-95}:\\
\;\;\;\;\sin th \cdot \frac{ky}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 8.0000000000000002e-191 or 4.15000000000000003e-150 < ky < 9.99999999999999989e-96Initial program 90.2%
Taylor expanded in ky around 0 32.0%
Taylor expanded in kx around 0 20.7%
Taylor expanded in ky around 0 20.3%
if 8.0000000000000002e-191 < ky < 4.15000000000000003e-150 or 9.99999999999999989e-96 < ky Initial program 96.9%
remove-double-neg96.9%
sin-neg96.9%
neg-mul-196.9%
*-commutative96.9%
associate-*l*96.9%
associate-*l/94.8%
associate-/r/94.8%
associate-*l/96.9%
associate-/r/96.9%
sin-neg96.9%
neg-mul-196.9%
associate-/r*96.9%
associate-/r/96.9%
Simplified99.6%
Taylor expanded in kx around 0 37.7%
Final simplification26.5%
(FPCore (kx ky th) :precision binary64 (if (<= ky 7.5e-242) (* th (/ ky kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 7.5e-242) {
tmp = th * (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 <= 7.5d-242) then
tmp = th * (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 <= 7.5e-242) {
tmp = th * (ky / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 7.5e-242: tmp = th * (ky / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 7.5e-242) tmp = Float64(th * Float64(ky / kx)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 7.5e-242) tmp = th * (ky / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 7.5e-242], N[(th * N[(ky / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 7.5 \cdot 10^{-242}:\\
\;\;\;\;th \cdot \frac{ky}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 7.4999999999999998e-242Initial program 90.3%
remove-double-neg90.3%
sin-neg90.3%
neg-mul-190.3%
*-commutative90.3%
associate-*l*90.3%
associate-*l/86.9%
associate-/r/86.9%
associate-*l/90.3%
associate-/r/90.3%
sin-neg90.3%
neg-mul-190.3%
associate-/r*90.3%
associate-/r/90.3%
Simplified99.6%
Taylor expanded in th around 0 39.7%
Taylor expanded in ky around 0 10.5%
associate-/l*12.0%
Simplified12.0%
Taylor expanded in kx around 0 9.8%
associate-/l*11.3%
Simplified11.3%
associate-/r/11.3%
Applied egg-rr11.3%
if 7.4999999999999998e-242 < ky Initial program 95.6%
remove-double-neg95.6%
sin-neg95.6%
neg-mul-195.6%
*-commutative95.6%
associate-*l*95.6%
associate-*l/92.9%
associate-/r/92.9%
associate-*l/95.6%
associate-/r/95.6%
sin-neg95.6%
neg-mul-195.6%
associate-/r*95.6%
associate-/r/95.6%
Simplified99.6%
Taylor expanded in kx around 0 33.6%
Final simplification20.9%
(FPCore (kx ky th) :precision binary64 (if (<= ky 7.2e-174) (* th (/ ky kx)) th))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 7.2e-174) {
tmp = th * (ky / kx);
} else {
tmp = th;
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= 7.2d-174) then
tmp = th * (ky / kx)
else
tmp = th
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 7.2e-174) {
tmp = th * (ky / kx);
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 7.2e-174: tmp = th * (ky / kx) else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 7.2e-174) tmp = Float64(th * Float64(ky / kx)); else tmp = th; end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 7.2e-174) tmp = th * (ky / kx); else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 7.2e-174], N[(th * N[(ky / kx), $MachinePrecision]), $MachinePrecision], th]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 7.2 \cdot 10^{-174}:\\
\;\;\;\;th \cdot \frac{ky}{kx}\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if ky < 7.19999999999999997e-174Initial program 89.7%
remove-double-neg89.7%
sin-neg89.7%
neg-mul-189.7%
*-commutative89.7%
associate-*l*89.7%
associate-*l/85.9%
associate-/r/85.9%
associate-*l/89.7%
associate-/r/89.7%
sin-neg89.7%
neg-mul-189.7%
associate-/r*89.7%
associate-/r/89.7%
Simplified99.6%
Taylor expanded in th around 0 39.8%
Taylor expanded in ky around 0 11.4%
associate-/l*13.3%
Simplified13.3%
Taylor expanded in kx around 0 10.2%
associate-/l*12.2%
Simplified12.2%
associate-/r/12.1%
Applied egg-rr12.1%
if 7.19999999999999997e-174 < ky Initial program 97.1%
remove-double-neg97.1%
sin-neg97.1%
neg-mul-197.1%
*-commutative97.1%
associate-*l*97.1%
associate-*l/95.1%
associate-/r/95.1%
associate-*l/97.1%
associate-/r/97.1%
sin-neg97.1%
neg-mul-197.1%
associate-/r*97.1%
associate-/r/97.1%
Simplified99.6%
Taylor expanded in th around 0 57.0%
Taylor expanded in kx around 0 23.8%
Final simplification16.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.6%
remove-double-neg92.6%
sin-neg92.6%
neg-mul-192.6%
*-commutative92.6%
associate-*l*92.6%
associate-*l/89.5%
associate-/r/89.5%
associate-*l/92.6%
associate-/r/92.6%
sin-neg92.6%
neg-mul-192.6%
associate-/r*92.6%
associate-/r/92.6%
Simplified99.6%
Taylor expanded in th around 0 46.5%
Taylor expanded in kx around 0 15.4%
Final simplification15.4%
herbie shell --seed 2024021
(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)))