
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 23 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\end{array}
(FPCore (kx ky th) :precision binary64 (/ (sin 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.0%
+-commutative92.0%
unpow292.0%
unpow292.0%
hypot-def99.6%
Simplified99.6%
*-commutative99.6%
clear-num99.6%
un-div-inv99.7%
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (* (sin th) (fabs (/ (sin ky) (sin kx))))))
(if (<= (sin ky) -0.01)
(fabs (sin th))
(if (<= (sin ky) -5e-78)
(/ (* th ky) (hypot (sin ky) (sin kx)))
(if (<= (sin ky) -2e-101)
(/ 1.0 (sqrt (pow (sin th) -2.0)))
(if (<= (sin ky) -5e-306)
(fabs (* (sin ky) (/ (sin th) (sin kx))))
(if (<= (sin ky) 2e-115)
t_1
(if (<= (sin ky) 2e-55)
(/ (sin th) (+ 1.0 (/ (* 0.5 (* kx kx)) (pow (sin ky) 2.0))))
(if (<= (sin ky) 1e-22) t_1 (sin th))))))))))
double code(double kx, double ky, double th) {
double t_1 = sin(th) * fabs((sin(ky) / sin(kx)));
double tmp;
if (sin(ky) <= -0.01) {
tmp = fabs(sin(th));
} else if (sin(ky) <= -5e-78) {
tmp = (th * ky) / hypot(sin(ky), sin(kx));
} else if (sin(ky) <= -2e-101) {
tmp = 1.0 / sqrt(pow(sin(th), -2.0));
} else if (sin(ky) <= -5e-306) {
tmp = fabs((sin(ky) * (sin(th) / sin(kx))));
} else if (sin(ky) <= 2e-115) {
tmp = t_1;
} else if (sin(ky) <= 2e-55) {
tmp = sin(th) / (1.0 + ((0.5 * (kx * kx)) / pow(sin(ky), 2.0)));
} else if (sin(ky) <= 1e-22) {
tmp = t_1;
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(th) * Math.abs((Math.sin(ky) / Math.sin(kx)));
double tmp;
if (Math.sin(ky) <= -0.01) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= -5e-78) {
tmp = (th * ky) / Math.hypot(Math.sin(ky), Math.sin(kx));
} else if (Math.sin(ky) <= -2e-101) {
tmp = 1.0 / Math.sqrt(Math.pow(Math.sin(th), -2.0));
} else if (Math.sin(ky) <= -5e-306) {
tmp = Math.abs((Math.sin(ky) * (Math.sin(th) / Math.sin(kx))));
} else if (Math.sin(ky) <= 2e-115) {
tmp = t_1;
} else if (Math.sin(ky) <= 2e-55) {
tmp = Math.sin(th) / (1.0 + ((0.5 * (kx * kx)) / Math.pow(Math.sin(ky), 2.0)));
} else if (Math.sin(ky) <= 1e-22) {
tmp = t_1;
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.sin(th) * math.fabs((math.sin(ky) / math.sin(kx))) tmp = 0 if math.sin(ky) <= -0.01: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= -5e-78: tmp = (th * ky) / math.hypot(math.sin(ky), math.sin(kx)) elif math.sin(ky) <= -2e-101: tmp = 1.0 / math.sqrt(math.pow(math.sin(th), -2.0)) elif math.sin(ky) <= -5e-306: tmp = math.fabs((math.sin(ky) * (math.sin(th) / math.sin(kx)))) elif math.sin(ky) <= 2e-115: tmp = t_1 elif math.sin(ky) <= 2e-55: tmp = math.sin(th) / (1.0 + ((0.5 * (kx * kx)) / math.pow(math.sin(ky), 2.0))) elif math.sin(ky) <= 1e-22: tmp = t_1 else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = Float64(sin(th) * abs(Float64(sin(ky) / sin(kx)))) tmp = 0.0 if (sin(ky) <= -0.01) tmp = abs(sin(th)); elseif (sin(ky) <= -5e-78) tmp = Float64(Float64(th * ky) / hypot(sin(ky), sin(kx))); elseif (sin(ky) <= -2e-101) tmp = Float64(1.0 / sqrt((sin(th) ^ -2.0))); elseif (sin(ky) <= -5e-306) tmp = abs(Float64(sin(ky) * Float64(sin(th) / sin(kx)))); elseif (sin(ky) <= 2e-115) tmp = t_1; elseif (sin(ky) <= 2e-55) tmp = Float64(sin(th) / Float64(1.0 + Float64(Float64(0.5 * Float64(kx * kx)) / (sin(ky) ^ 2.0)))); elseif (sin(ky) <= 1e-22) tmp = t_1; else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = sin(th) * abs((sin(ky) / sin(kx))); tmp = 0.0; if (sin(ky) <= -0.01) tmp = abs(sin(th)); elseif (sin(ky) <= -5e-78) tmp = (th * ky) / hypot(sin(ky), sin(kx)); elseif (sin(ky) <= -2e-101) tmp = 1.0 / sqrt((sin(th) ^ -2.0)); elseif (sin(ky) <= -5e-306) tmp = abs((sin(ky) * (sin(th) / sin(kx)))); elseif (sin(ky) <= 2e-115) tmp = t_1; elseif (sin(ky) <= 2e-55) tmp = sin(th) / (1.0 + ((0.5 * (kx * kx)) / (sin(ky) ^ 2.0))); elseif (sin(ky) <= 1e-22) tmp = t_1; else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[th], $MachinePrecision] * N[Abs[N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Sin[ky], $MachinePrecision], -0.01], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], -5e-78], N[(N[(th * ky), $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], -2e-101], N[(1.0 / N[Sqrt[N[Power[N[Sin[th], $MachinePrecision], -2.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], -5e-306], N[Abs[N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-115], t$95$1, If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-55], N[(N[Sin[th], $MachinePrecision] / N[(1.0 + N[(N[(0.5 * N[(kx * kx), $MachinePrecision]), $MachinePrecision] / N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-22], t$95$1, N[Sin[th], $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sin th \cdot \left|\frac{\sin ky}{\sin kx}\right|\\
\mathbf{if}\;\sin ky \leq -0.01:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq -5 \cdot 10^{-78}:\\
\;\;\;\;\frac{th \cdot ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{elif}\;\sin ky \leq -2 \cdot 10^{-101}:\\
\;\;\;\;\frac{1}{\sqrt{{\sin th}^{-2}}}\\
\mathbf{elif}\;\sin ky \leq -5 \cdot 10^{-306}:\\
\;\;\;\;\left|\sin ky \cdot \frac{\sin th}{\sin kx}\right|\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-115}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-55}:\\
\;\;\;\;\frac{\sin th}{1 + \frac{0.5 \cdot \left(kx \cdot kx\right)}{{\sin ky}^{2}}}\\
\mathbf{elif}\;\sin ky \leq 10^{-22}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0100000000000000002Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.7%
Simplified99.7%
associate-*l/99.5%
clear-num99.4%
Applied egg-rr99.4%
Taylor expanded in kx around 0 2.7%
remove-double-div2.7%
add-sqr-sqrt1.1%
sqrt-unprod25.8%
pow225.8%
Applied egg-rr25.8%
unpow225.8%
rem-sqrt-square33.9%
Simplified33.9%
if -0.0100000000000000002 < (sin.f64 ky) < -4.9999999999999996e-78Initial program 99.8%
associate-*l/95.3%
+-commutative95.3%
unpow295.3%
unpow295.3%
hypot-def95.6%
Simplified95.6%
Taylor expanded in th around 0 53.2%
Taylor expanded in ky around 0 53.1%
if -4.9999999999999996e-78 < (sin.f64 ky) < -2.0000000000000001e-101Initial program 99.8%
+-commutative99.8%
unpow299.8%
unpow299.8%
hypot-def99.8%
Simplified99.8%
associate-*l/99.6%
clear-num99.1%
Applied egg-rr99.1%
Taylor expanded in kx around 0 2.4%
add-sqr-sqrt1.2%
sqrt-unprod71.8%
inv-pow71.8%
inv-pow71.8%
pow-prod-up71.8%
metadata-eval71.8%
Applied egg-rr71.8%
if -2.0000000000000001e-101 < (sin.f64 ky) < -4.99999999999999998e-306Initial program 76.5%
+-commutative76.5%
unpow276.5%
unpow276.5%
hypot-def99.3%
Simplified99.3%
Taylor expanded in ky around 0 57.9%
add-sqr-sqrt47.1%
sqrt-unprod50.9%
pow250.9%
*-commutative50.9%
Applied egg-rr50.9%
unpow250.9%
rem-sqrt-square67.1%
associate-*r/61.6%
associate-/l*67.3%
associate-/r/67.3%
Simplified67.3%
if -4.99999999999999998e-306 < (sin.f64 ky) < 2.0000000000000001e-115 or 1.99999999999999999e-55 < (sin.f64 ky) < 1e-22Initial program 76.5%
+-commutative76.5%
unpow276.5%
unpow276.5%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 59.9%
add-sqr-sqrt46.0%
sqrt-unprod57.3%
pow257.3%
Applied egg-rr57.3%
unpow257.3%
rem-sqrt-square77.5%
Simplified77.5%
if 2.0000000000000001e-115 < (sin.f64 ky) < 1.99999999999999999e-55Initial program 100.0%
+-commutative100.0%
unpow2100.0%
unpow2100.0%
hypot-def100.0%
Simplified100.0%
*-commutative100.0%
clear-num100.0%
un-div-inv100.0%
Applied egg-rr100.0%
Taylor expanded in kx around 0 78.7%
associate-*r/78.7%
unpow278.7%
Simplified78.7%
if 1e-22 < (sin.f64 ky) Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 65.1%
Final simplification58.5%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.01)
(fabs (sin th))
(if (<= (sin ky) -5e-78)
(/ (* th ky) (hypot (sin ky) (sin kx)))
(if (<= (sin ky) -2e-101)
(/ 1.0 (sqrt (pow (sin th) -2.0)))
(if (<= (sin ky) -1e-260)
(fabs (* (sin ky) (/ (sin th) (sin kx))))
(if (<= (sin ky) 2e-115) (/ (sin th) (/ (sin kx) ky)) (sin th)))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.01) {
tmp = fabs(sin(th));
} else if (sin(ky) <= -5e-78) {
tmp = (th * ky) / hypot(sin(ky), sin(kx));
} else if (sin(ky) <= -2e-101) {
tmp = 1.0 / sqrt(pow(sin(th), -2.0));
} else if (sin(ky) <= -1e-260) {
tmp = fabs((sin(ky) * (sin(th) / sin(kx))));
} else if (sin(ky) <= 2e-115) {
tmp = sin(th) / (sin(kx) / ky);
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.01) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= -5e-78) {
tmp = (th * ky) / Math.hypot(Math.sin(ky), Math.sin(kx));
} else if (Math.sin(ky) <= -2e-101) {
tmp = 1.0 / Math.sqrt(Math.pow(Math.sin(th), -2.0));
} else if (Math.sin(ky) <= -1e-260) {
tmp = Math.abs((Math.sin(ky) * (Math.sin(th) / Math.sin(kx))));
} else if (Math.sin(ky) <= 2e-115) {
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.01: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= -5e-78: tmp = (th * ky) / math.hypot(math.sin(ky), math.sin(kx)) elif math.sin(ky) <= -2e-101: tmp = 1.0 / math.sqrt(math.pow(math.sin(th), -2.0)) elif math.sin(ky) <= -1e-260: tmp = math.fabs((math.sin(ky) * (math.sin(th) / math.sin(kx)))) elif math.sin(ky) <= 2e-115: 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.01) tmp = abs(sin(th)); elseif (sin(ky) <= -5e-78) tmp = Float64(Float64(th * ky) / hypot(sin(ky), sin(kx))); elseif (sin(ky) <= -2e-101) tmp = Float64(1.0 / sqrt((sin(th) ^ -2.0))); elseif (sin(ky) <= -1e-260) tmp = abs(Float64(sin(ky) * Float64(sin(th) / sin(kx)))); elseif (sin(ky) <= 2e-115) 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.01) tmp = abs(sin(th)); elseif (sin(ky) <= -5e-78) tmp = (th * ky) / hypot(sin(ky), sin(kx)); elseif (sin(ky) <= -2e-101) tmp = 1.0 / sqrt((sin(th) ^ -2.0)); elseif (sin(ky) <= -1e-260) tmp = abs((sin(ky) * (sin(th) / sin(kx)))); elseif (sin(ky) <= 2e-115) 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.01], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], -5e-78], N[(N[(th * ky), $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], -2e-101], N[(1.0 / N[Sqrt[N[Power[N[Sin[th], $MachinePrecision], -2.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], -1e-260], N[Abs[N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-115], 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.01:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq -5 \cdot 10^{-78}:\\
\;\;\;\;\frac{th \cdot ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{elif}\;\sin ky \leq -2 \cdot 10^{-101}:\\
\;\;\;\;\frac{1}{\sqrt{{\sin th}^{-2}}}\\
\mathbf{elif}\;\sin ky \leq -1 \cdot 10^{-260}:\\
\;\;\;\;\left|\sin ky \cdot \frac{\sin th}{\sin kx}\right|\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-115}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0100000000000000002Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.7%
Simplified99.7%
associate-*l/99.5%
clear-num99.4%
Applied egg-rr99.4%
Taylor expanded in kx around 0 2.7%
remove-double-div2.7%
add-sqr-sqrt1.1%
sqrt-unprod25.8%
pow225.8%
Applied egg-rr25.8%
unpow225.8%
rem-sqrt-square33.9%
Simplified33.9%
if -0.0100000000000000002 < (sin.f64 ky) < -4.9999999999999996e-78Initial program 99.8%
associate-*l/95.3%
+-commutative95.3%
unpow295.3%
unpow295.3%
hypot-def95.6%
Simplified95.6%
Taylor expanded in th around 0 53.2%
Taylor expanded in ky around 0 53.1%
if -4.9999999999999996e-78 < (sin.f64 ky) < -2.0000000000000001e-101Initial program 99.8%
+-commutative99.8%
unpow299.8%
unpow299.8%
hypot-def99.8%
Simplified99.8%
associate-*l/99.6%
clear-num99.1%
Applied egg-rr99.1%
Taylor expanded in kx around 0 2.4%
add-sqr-sqrt1.2%
sqrt-unprod71.8%
inv-pow71.8%
inv-pow71.8%
pow-prod-up71.8%
metadata-eval71.8%
Applied egg-rr71.8%
if -2.0000000000000001e-101 < (sin.f64 ky) < -9.99999999999999961e-261Initial program 82.6%
+-commutative82.6%
unpow282.6%
unpow282.6%
hypot-def99.2%
Simplified99.2%
Taylor expanded in ky around 0 54.4%
add-sqr-sqrt47.0%
sqrt-unprod54.3%
pow254.3%
*-commutative54.3%
Applied egg-rr54.3%
unpow254.3%
rem-sqrt-square72.5%
associate-*r/66.1%
associate-/l*72.8%
associate-/r/72.8%
Simplified72.8%
if -9.99999999999999961e-261 < (sin.f64 ky) < 2.0000000000000001e-115Initial program 68.0%
+-commutative68.0%
unpow268.0%
unpow268.0%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 58.0%
associate-/l*62.5%
Simplified62.5%
if 2.0000000000000001e-115 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 62.1%
Final simplification54.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.01)
(fabs (sin th))
(if (<= (sin ky) -5e-78)
(/ (* th ky) (hypot (sin ky) (sin kx)))
(if (<= (sin ky) -2e-101)
(/ 1.0 (sqrt (pow (sin th) -2.0)))
(if (<= (sin ky) -4e-220)
(fabs (* (sin th) (/ ky (sin kx))))
(if (<= (sin ky) 2e-115) (/ (sin th) (/ (sin kx) ky)) (sin th)))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.01) {
tmp = fabs(sin(th));
} else if (sin(ky) <= -5e-78) {
tmp = (th * ky) / hypot(sin(ky), sin(kx));
} else if (sin(ky) <= -2e-101) {
tmp = 1.0 / sqrt(pow(sin(th), -2.0));
} else if (sin(ky) <= -4e-220) {
tmp = fabs((sin(th) * (ky / sin(kx))));
} else if (sin(ky) <= 2e-115) {
tmp = sin(th) / (sin(kx) / ky);
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.01) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= -5e-78) {
tmp = (th * ky) / Math.hypot(Math.sin(ky), Math.sin(kx));
} else if (Math.sin(ky) <= -2e-101) {
tmp = 1.0 / Math.sqrt(Math.pow(Math.sin(th), -2.0));
} else if (Math.sin(ky) <= -4e-220) {
tmp = Math.abs((Math.sin(th) * (ky / Math.sin(kx))));
} else if (Math.sin(ky) <= 2e-115) {
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.01: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= -5e-78: tmp = (th * ky) / math.hypot(math.sin(ky), math.sin(kx)) elif math.sin(ky) <= -2e-101: tmp = 1.0 / math.sqrt(math.pow(math.sin(th), -2.0)) elif math.sin(ky) <= -4e-220: tmp = math.fabs((math.sin(th) * (ky / math.sin(kx)))) elif math.sin(ky) <= 2e-115: 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.01) tmp = abs(sin(th)); elseif (sin(ky) <= -5e-78) tmp = Float64(Float64(th * ky) / hypot(sin(ky), sin(kx))); elseif (sin(ky) <= -2e-101) tmp = Float64(1.0 / sqrt((sin(th) ^ -2.0))); elseif (sin(ky) <= -4e-220) tmp = abs(Float64(sin(th) * Float64(ky / sin(kx)))); elseif (sin(ky) <= 2e-115) 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.01) tmp = abs(sin(th)); elseif (sin(ky) <= -5e-78) tmp = (th * ky) / hypot(sin(ky), sin(kx)); elseif (sin(ky) <= -2e-101) tmp = 1.0 / sqrt((sin(th) ^ -2.0)); elseif (sin(ky) <= -4e-220) tmp = abs((sin(th) * (ky / sin(kx)))); elseif (sin(ky) <= 2e-115) 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.01], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], -5e-78], N[(N[(th * ky), $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], -2e-101], N[(1.0 / N[Sqrt[N[Power[N[Sin[th], $MachinePrecision], -2.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], -4e-220], N[Abs[N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-115], 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.01:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq -5 \cdot 10^{-78}:\\
\;\;\;\;\frac{th \cdot ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{elif}\;\sin ky \leq -2 \cdot 10^{-101}:\\
\;\;\;\;\frac{1}{\sqrt{{\sin th}^{-2}}}\\
\mathbf{elif}\;\sin ky \leq -4 \cdot 10^{-220}:\\
\;\;\;\;\left|\sin th \cdot \frac{ky}{\sin kx}\right|\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-115}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0100000000000000002Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.7%
Simplified99.7%
associate-*l/99.5%
clear-num99.4%
Applied egg-rr99.4%
Taylor expanded in kx around 0 2.7%
remove-double-div2.7%
add-sqr-sqrt1.1%
sqrt-unprod25.8%
pow225.8%
Applied egg-rr25.8%
unpow225.8%
rem-sqrt-square33.9%
Simplified33.9%
if -0.0100000000000000002 < (sin.f64 ky) < -4.9999999999999996e-78Initial program 99.8%
associate-*l/95.3%
+-commutative95.3%
unpow295.3%
unpow295.3%
hypot-def95.6%
Simplified95.6%
Taylor expanded in th around 0 53.2%
Taylor expanded in ky around 0 53.1%
if -4.9999999999999996e-78 < (sin.f64 ky) < -2.0000000000000001e-101Initial program 99.8%
+-commutative99.8%
unpow299.8%
unpow299.8%
hypot-def99.8%
Simplified99.8%
associate-*l/99.6%
clear-num99.1%
Applied egg-rr99.1%
Taylor expanded in kx around 0 2.4%
add-sqr-sqrt1.2%
sqrt-unprod71.8%
inv-pow71.8%
inv-pow71.8%
pow-prod-up71.8%
metadata-eval71.8%
Applied egg-rr71.8%
if -2.0000000000000001e-101 < (sin.f64 ky) < -3.99999999999999997e-220Initial program 86.9%
+-commutative86.9%
unpow286.9%
unpow286.9%
hypot-def99.2%
Simplified99.2%
associate-*l/94.8%
clear-num94.8%
Applied egg-rr94.8%
Taylor expanded in ky around 0 48.8%
add-sqr-sqrt40.1%
sqrt-unprod53.1%
pow253.1%
clear-num53.1%
*-un-lft-identity53.1%
times-frac52.9%
/-rgt-identity52.9%
Applied egg-rr52.9%
unpow252.9%
rem-sqrt-square71.3%
Simplified71.3%
if -3.99999999999999997e-220 < (sin.f64 ky) < 2.0000000000000001e-115Initial program 67.3%
+-commutative67.3%
unpow267.3%
unpow267.3%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 58.3%
associate-/l*64.1%
Simplified64.1%
if 2.0000000000000001e-115 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 62.1%
Final simplification54.6%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (hypot (sin ky) (sin kx))))
(if (<= (sin ky) -0.01)
(/ th (/ t_1 (sin ky)))
(if (<= (sin ky) 0.002)
(/ (sin th) (* t_1 (+ (* ky 0.16666666666666666) (/ 1.0 ky))))
(sin th)))))
double code(double kx, double ky, double th) {
double t_1 = hypot(sin(ky), sin(kx));
double tmp;
if (sin(ky) <= -0.01) {
tmp = th / (t_1 / sin(ky));
} else if (sin(ky) <= 0.002) {
tmp = sin(th) / (t_1 * ((ky * 0.16666666666666666) + (1.0 / ky)));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.hypot(Math.sin(ky), Math.sin(kx));
double tmp;
if (Math.sin(ky) <= -0.01) {
tmp = th / (t_1 / Math.sin(ky));
} else if (Math.sin(ky) <= 0.002) {
tmp = Math.sin(th) / (t_1 * ((ky * 0.16666666666666666) + (1.0 / ky)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.hypot(math.sin(ky), math.sin(kx)) tmp = 0 if math.sin(ky) <= -0.01: tmp = th / (t_1 / math.sin(ky)) elif math.sin(ky) <= 0.002: tmp = math.sin(th) / (t_1 * ((ky * 0.16666666666666666) + (1.0 / ky))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)) tmp = 0.0 if (sin(ky) <= -0.01) tmp = Float64(th / Float64(t_1 / sin(ky))); elseif (sin(ky) <= 0.002) tmp = Float64(sin(th) / Float64(t_1 * Float64(Float64(ky * 0.16666666666666666) + Float64(1.0 / ky)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)); tmp = 0.0; if (sin(ky) <= -0.01) tmp = th / (t_1 / sin(ky)); elseif (sin(ky) <= 0.002) tmp = sin(th) / (t_1 * ((ky * 0.16666666666666666) + (1.0 / ky))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[N[Sin[ky], $MachinePrecision], -0.01], N[(th / N[(t$95$1 / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 0.002], N[(N[Sin[th], $MachinePrecision] / N[(t$95$1 * N[(N[(ky * 0.16666666666666666), $MachinePrecision] + N[(1.0 / ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\
\mathbf{if}\;\sin ky \leq -0.01:\\
\;\;\;\;\frac{th}{\frac{t_1}{\sin ky}}\\
\mathbf{elif}\;\sin ky \leq 0.002:\\
\;\;\;\;\frac{\sin th}{t_1 \cdot \left(ky \cdot 0.16666666666666666 + \frac{1}{ky}\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0100000000000000002Initial program 99.6%
associate-*l/99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.5%
Simplified99.5%
Taylor expanded in th around 0 57.1%
expm1-log1p-u56.4%
expm1-udef4.4%
div-inv4.4%
*-commutative4.4%
associate-*l*4.4%
div-inv4.4%
Applied egg-rr4.4%
expm1-def56.6%
expm1-log1p57.2%
*-commutative57.2%
associate-*l/57.1%
associate-*r/57.1%
Simplified57.1%
associate-*r/57.1%
*-commutative57.1%
associate-/l*57.2%
Applied egg-rr57.2%
if -0.0100000000000000002 < (sin.f64 ky) < 2e-3Initial program 84.1%
+-commutative84.1%
unpow284.1%
unpow284.1%
hypot-def99.6%
Simplified99.6%
*-commutative99.6%
clear-num99.6%
un-div-inv99.7%
Applied egg-rr99.7%
div-inv99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 99.4%
if 2e-3 < (sin.f64 ky) Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 64.4%
Final simplification79.5%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin th) -0.05)
(fabs (* (sin ky) (/ (sin th) (sin kx))))
(if (<= (sin th) 5e-23)
(* (sin ky) (/ th (hypot (sin ky) (sin kx))))
(if (<= (sin th) 0.985)
(sin th)
(/ 1.0 (/ (sin kx) (fabs (* (sin th) ky))))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(th) <= -0.05) {
tmp = fabs((sin(ky) * (sin(th) / sin(kx))));
} else if (sin(th) <= 5e-23) {
tmp = sin(ky) * (th / hypot(sin(ky), sin(kx)));
} else if (sin(th) <= 0.985) {
tmp = sin(th);
} else {
tmp = 1.0 / (sin(kx) / fabs((sin(th) * ky)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(th) <= -0.05) {
tmp = Math.abs((Math.sin(ky) * (Math.sin(th) / Math.sin(kx))));
} else if (Math.sin(th) <= 5e-23) {
tmp = Math.sin(ky) * (th / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else if (Math.sin(th) <= 0.985) {
tmp = Math.sin(th);
} else {
tmp = 1.0 / (Math.sin(kx) / Math.abs((Math.sin(th) * ky)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(th) <= -0.05: tmp = math.fabs((math.sin(ky) * (math.sin(th) / math.sin(kx)))) elif math.sin(th) <= 5e-23: tmp = math.sin(ky) * (th / math.hypot(math.sin(ky), math.sin(kx))) elif math.sin(th) <= 0.985: tmp = math.sin(th) else: tmp = 1.0 / (math.sin(kx) / math.fabs((math.sin(th) * ky))) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(th) <= -0.05) tmp = abs(Float64(sin(ky) * Float64(sin(th) / sin(kx)))); elseif (sin(th) <= 5e-23) tmp = Float64(sin(ky) * Float64(th / hypot(sin(ky), sin(kx)))); elseif (sin(th) <= 0.985) tmp = sin(th); else tmp = Float64(1.0 / Float64(sin(kx) / abs(Float64(sin(th) * ky)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(th) <= -0.05) tmp = abs((sin(ky) * (sin(th) / sin(kx)))); elseif (sin(th) <= 5e-23) tmp = sin(ky) * (th / hypot(sin(ky), sin(kx))); elseif (sin(th) <= 0.985) tmp = sin(th); else tmp = 1.0 / (sin(kx) / abs((sin(th) * ky))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[th], $MachinePrecision], -0.05], N[Abs[N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], 5e-23], N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], 0.985], N[Sin[th], $MachinePrecision], N[(1.0 / N[(N[Sin[kx], $MachinePrecision] / N[Abs[N[(N[Sin[th], $MachinePrecision] * ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin th \leq -0.05:\\
\;\;\;\;\left|\sin ky \cdot \frac{\sin th}{\sin kx}\right|\\
\mathbf{elif}\;\sin th \leq 5 \cdot 10^{-23}:\\
\;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{elif}\;\sin th \leq 0.985:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{\sin kx}{\left|\sin th \cdot ky\right|}}\\
\end{array}
\end{array}
if (sin.f64 th) < -0.050000000000000003Initial program 90.1%
+-commutative90.1%
unpow290.1%
unpow290.1%
hypot-def99.5%
Simplified99.5%
Taylor expanded in ky around 0 25.4%
add-sqr-sqrt15.7%
sqrt-unprod24.7%
pow224.7%
*-commutative24.7%
Applied egg-rr24.7%
unpow224.7%
rem-sqrt-square29.9%
associate-*r/30.0%
associate-/l*30.0%
associate-/r/30.0%
Simplified30.0%
if -0.050000000000000003 < (sin.f64 th) < 5.0000000000000002e-23Initial program 94.3%
associate-*l/89.2%
+-commutative89.2%
unpow289.2%
unpow289.2%
hypot-def91.1%
Simplified91.1%
Taylor expanded in th around 0 90.2%
expm1-log1p-u90.2%
expm1-udef20.5%
div-inv20.5%
*-commutative20.5%
associate-*l*20.5%
div-inv20.5%
Applied egg-rr20.5%
expm1-def98.8%
expm1-log1p98.8%
*-commutative98.8%
associate-*l/90.2%
associate-*r/98.8%
Simplified98.8%
if 5.0000000000000002e-23 < (sin.f64 th) < 0.984999999999999987Initial program 88.8%
+-commutative88.8%
unpow288.8%
unpow288.8%
hypot-def99.8%
Simplified99.8%
Taylor expanded in kx around 0 41.3%
if 0.984999999999999987 < (sin.f64 th) Initial program 91.3%
+-commutative91.3%
unpow291.3%
unpow291.3%
hypot-def99.5%
Simplified99.5%
associate-*l/99.5%
clear-num99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 42.3%
add-sqr-sqrt33.6%
sqrt-unprod27.1%
pow227.1%
*-commutative27.1%
Applied egg-rr27.1%
unpow227.1%
rem-sqrt-square51.4%
*-commutative51.4%
Simplified51.4%
Final simplification67.1%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin th) -0.05)
(fabs (* (sin ky) (/ (sin th) (sin kx))))
(if (<= (sin th) 5e-23)
(* th (/ (sin ky) (hypot (sin ky) (sin kx))))
(if (<= (sin th) 0.985)
(sin th)
(/ 1.0 (/ (sin kx) (fabs (* (sin th) ky))))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(th) <= -0.05) {
tmp = fabs((sin(ky) * (sin(th) / sin(kx))));
} else if (sin(th) <= 5e-23) {
tmp = th * (sin(ky) / hypot(sin(ky), sin(kx)));
} else if (sin(th) <= 0.985) {
tmp = sin(th);
} else {
tmp = 1.0 / (sin(kx) / fabs((sin(th) * ky)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(th) <= -0.05) {
tmp = Math.abs((Math.sin(ky) * (Math.sin(th) / Math.sin(kx))));
} else if (Math.sin(th) <= 5e-23) {
tmp = th * (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else if (Math.sin(th) <= 0.985) {
tmp = Math.sin(th);
} else {
tmp = 1.0 / (Math.sin(kx) / Math.abs((Math.sin(th) * ky)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(th) <= -0.05: tmp = math.fabs((math.sin(ky) * (math.sin(th) / math.sin(kx)))) elif math.sin(th) <= 5e-23: tmp = th * (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx))) elif math.sin(th) <= 0.985: tmp = math.sin(th) else: tmp = 1.0 / (math.sin(kx) / math.fabs((math.sin(th) * ky))) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(th) <= -0.05) tmp = abs(Float64(sin(ky) * Float64(sin(th) / sin(kx)))); elseif (sin(th) <= 5e-23) tmp = Float64(th * Float64(sin(ky) / hypot(sin(ky), sin(kx)))); elseif (sin(th) <= 0.985) tmp = sin(th); else tmp = Float64(1.0 / Float64(sin(kx) / abs(Float64(sin(th) * ky)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(th) <= -0.05) tmp = abs((sin(ky) * (sin(th) / sin(kx)))); elseif (sin(th) <= 5e-23) tmp = th * (sin(ky) / hypot(sin(ky), sin(kx))); elseif (sin(th) <= 0.985) tmp = sin(th); else tmp = 1.0 / (sin(kx) / abs((sin(th) * ky))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[th], $MachinePrecision], -0.05], N[Abs[N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], 5e-23], N[(th * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], 0.985], N[Sin[th], $MachinePrecision], N[(1.0 / N[(N[Sin[kx], $MachinePrecision] / N[Abs[N[(N[Sin[th], $MachinePrecision] * ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin th \leq -0.05:\\
\;\;\;\;\left|\sin ky \cdot \frac{\sin th}{\sin kx}\right|\\
\mathbf{elif}\;\sin th \leq 5 \cdot 10^{-23}:\\
\;\;\;\;th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{elif}\;\sin th \leq 0.985:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{\sin kx}{\left|\sin th \cdot ky\right|}}\\
\end{array}
\end{array}
if (sin.f64 th) < -0.050000000000000003Initial program 90.1%
+-commutative90.1%
unpow290.1%
unpow290.1%
hypot-def99.5%
Simplified99.5%
Taylor expanded in ky around 0 25.4%
add-sqr-sqrt15.7%
sqrt-unprod24.7%
pow224.7%
*-commutative24.7%
Applied egg-rr24.7%
unpow224.7%
rem-sqrt-square29.9%
associate-*r/30.0%
associate-/l*30.0%
associate-/r/30.0%
Simplified30.0%
if -0.050000000000000003 < (sin.f64 th) < 5.0000000000000002e-23Initial program 94.3%
associate-*l/89.2%
+-commutative89.2%
unpow289.2%
unpow289.2%
hypot-def91.1%
Simplified91.1%
Taylor expanded in th around 0 90.2%
associate-/l*98.8%
associate-/r/98.8%
Applied egg-rr98.8%
if 5.0000000000000002e-23 < (sin.f64 th) < 0.984999999999999987Initial program 88.8%
+-commutative88.8%
unpow288.8%
unpow288.8%
hypot-def99.8%
Simplified99.8%
Taylor expanded in kx around 0 41.3%
if 0.984999999999999987 < (sin.f64 th) Initial program 91.3%
+-commutative91.3%
unpow291.3%
unpow291.3%
hypot-def99.5%
Simplified99.5%
associate-*l/99.5%
clear-num99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 42.3%
add-sqr-sqrt33.6%
sqrt-unprod27.1%
pow227.1%
*-commutative27.1%
Applied egg-rr27.1%
unpow227.1%
rem-sqrt-square51.4%
*-commutative51.4%
Simplified51.4%
Final simplification67.2%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin th) -0.05)
(fabs (* (sin ky) (/ (sin th) (sin kx))))
(if (<= (sin th) 5e-23)
(/ th (/ (hypot (sin ky) (sin kx)) (sin ky)))
(if (<= (sin th) 0.985)
(sin th)
(/ 1.0 (/ (sin kx) (fabs (* (sin th) ky))))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(th) <= -0.05) {
tmp = fabs((sin(ky) * (sin(th) / sin(kx))));
} else if (sin(th) <= 5e-23) {
tmp = th / (hypot(sin(ky), sin(kx)) / sin(ky));
} else if (sin(th) <= 0.985) {
tmp = sin(th);
} else {
tmp = 1.0 / (sin(kx) / fabs((sin(th) * ky)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(th) <= -0.05) {
tmp = Math.abs((Math.sin(ky) * (Math.sin(th) / Math.sin(kx))));
} else if (Math.sin(th) <= 5e-23) {
tmp = th / (Math.hypot(Math.sin(ky), Math.sin(kx)) / Math.sin(ky));
} else if (Math.sin(th) <= 0.985) {
tmp = Math.sin(th);
} else {
tmp = 1.0 / (Math.sin(kx) / Math.abs((Math.sin(th) * ky)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(th) <= -0.05: tmp = math.fabs((math.sin(ky) * (math.sin(th) / math.sin(kx)))) elif math.sin(th) <= 5e-23: tmp = th / (math.hypot(math.sin(ky), math.sin(kx)) / math.sin(ky)) elif math.sin(th) <= 0.985: tmp = math.sin(th) else: tmp = 1.0 / (math.sin(kx) / math.fabs((math.sin(th) * ky))) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(th) <= -0.05) tmp = abs(Float64(sin(ky) * Float64(sin(th) / sin(kx)))); elseif (sin(th) <= 5e-23) tmp = Float64(th / Float64(hypot(sin(ky), sin(kx)) / sin(ky))); elseif (sin(th) <= 0.985) tmp = sin(th); else tmp = Float64(1.0 / Float64(sin(kx) / abs(Float64(sin(th) * ky)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(th) <= -0.05) tmp = abs((sin(ky) * (sin(th) / sin(kx)))); elseif (sin(th) <= 5e-23) tmp = th / (hypot(sin(ky), sin(kx)) / sin(ky)); elseif (sin(th) <= 0.985) tmp = sin(th); else tmp = 1.0 / (sin(kx) / abs((sin(th) * ky))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[th], $MachinePrecision], -0.05], N[Abs[N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], 5e-23], N[(th / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], 0.985], N[Sin[th], $MachinePrecision], N[(1.0 / N[(N[Sin[kx], $MachinePrecision] / N[Abs[N[(N[Sin[th], $MachinePrecision] * ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin th \leq -0.05:\\
\;\;\;\;\left|\sin ky \cdot \frac{\sin th}{\sin kx}\right|\\
\mathbf{elif}\;\sin th \leq 5 \cdot 10^{-23}:\\
\;\;\;\;\frac{th}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{\sin ky}}\\
\mathbf{elif}\;\sin th \leq 0.985:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{\sin kx}{\left|\sin th \cdot ky\right|}}\\
\end{array}
\end{array}
if (sin.f64 th) < -0.050000000000000003Initial program 90.1%
+-commutative90.1%
unpow290.1%
unpow290.1%
hypot-def99.5%
Simplified99.5%
Taylor expanded in ky around 0 25.4%
add-sqr-sqrt15.7%
sqrt-unprod24.7%
pow224.7%
*-commutative24.7%
Applied egg-rr24.7%
unpow224.7%
rem-sqrt-square29.9%
associate-*r/30.0%
associate-/l*30.0%
associate-/r/30.0%
Simplified30.0%
if -0.050000000000000003 < (sin.f64 th) < 5.0000000000000002e-23Initial program 94.3%
associate-*l/89.2%
+-commutative89.2%
unpow289.2%
unpow289.2%
hypot-def91.1%
Simplified91.1%
Taylor expanded in th around 0 90.2%
expm1-log1p-u90.2%
expm1-udef20.5%
div-inv20.5%
*-commutative20.5%
associate-*l*20.5%
div-inv20.5%
Applied egg-rr20.5%
expm1-def98.8%
expm1-log1p98.8%
*-commutative98.8%
associate-*l/90.2%
associate-*r/98.8%
Simplified98.8%
associate-*r/90.2%
*-commutative90.2%
associate-/l*98.8%
Applied egg-rr98.8%
if 5.0000000000000002e-23 < (sin.f64 th) < 0.984999999999999987Initial program 88.8%
+-commutative88.8%
unpow288.8%
unpow288.8%
hypot-def99.8%
Simplified99.8%
Taylor expanded in kx around 0 41.3%
if 0.984999999999999987 < (sin.f64 th) Initial program 91.3%
+-commutative91.3%
unpow291.3%
unpow291.3%
hypot-def99.5%
Simplified99.5%
associate-*l/99.5%
clear-num99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 42.3%
add-sqr-sqrt33.6%
sqrt-unprod27.1%
pow227.1%
*-commutative27.1%
Applied egg-rr27.1%
unpow227.1%
rem-sqrt-square51.4%
*-commutative51.4%
Simplified51.4%
Final simplification67.2%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (hypot (sin ky) (sin kx))))
(if (<= (sin ky) -0.01)
(/ th (/ t_1 (sin ky)))
(if (<= (sin ky) 0.002) (/ (sin th) (* t_1 (/ 1.0 ky))) (sin th)))))
double code(double kx, double ky, double th) {
double t_1 = hypot(sin(ky), sin(kx));
double tmp;
if (sin(ky) <= -0.01) {
tmp = th / (t_1 / sin(ky));
} else if (sin(ky) <= 0.002) {
tmp = sin(th) / (t_1 * (1.0 / ky));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.hypot(Math.sin(ky), Math.sin(kx));
double tmp;
if (Math.sin(ky) <= -0.01) {
tmp = th / (t_1 / Math.sin(ky));
} else if (Math.sin(ky) <= 0.002) {
tmp = Math.sin(th) / (t_1 * (1.0 / ky));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.hypot(math.sin(ky), math.sin(kx)) tmp = 0 if math.sin(ky) <= -0.01: tmp = th / (t_1 / math.sin(ky)) elif math.sin(ky) <= 0.002: tmp = math.sin(th) / (t_1 * (1.0 / ky)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)) tmp = 0.0 if (sin(ky) <= -0.01) tmp = Float64(th / Float64(t_1 / sin(ky))); elseif (sin(ky) <= 0.002) tmp = Float64(sin(th) / Float64(t_1 * Float64(1.0 / ky))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)); tmp = 0.0; if (sin(ky) <= -0.01) tmp = th / (t_1 / sin(ky)); elseif (sin(ky) <= 0.002) tmp = sin(th) / (t_1 * (1.0 / ky)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[N[Sin[ky], $MachinePrecision], -0.01], N[(th / N[(t$95$1 / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 0.002], N[(N[Sin[th], $MachinePrecision] / N[(t$95$1 * N[(1.0 / ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\
\mathbf{if}\;\sin ky \leq -0.01:\\
\;\;\;\;\frac{th}{\frac{t_1}{\sin ky}}\\
\mathbf{elif}\;\sin ky \leq 0.002:\\
\;\;\;\;\frac{\sin th}{t_1 \cdot \frac{1}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0100000000000000002Initial program 99.6%
associate-*l/99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.5%
Simplified99.5%
Taylor expanded in th around 0 57.1%
expm1-log1p-u56.4%
expm1-udef4.4%
div-inv4.4%
*-commutative4.4%
associate-*l*4.4%
div-inv4.4%
Applied egg-rr4.4%
expm1-def56.6%
expm1-log1p57.2%
*-commutative57.2%
associate-*l/57.1%
associate-*r/57.1%
Simplified57.1%
associate-*r/57.1%
*-commutative57.1%
associate-/l*57.2%
Applied egg-rr57.2%
if -0.0100000000000000002 < (sin.f64 ky) < 2e-3Initial program 84.1%
+-commutative84.1%
unpow284.1%
unpow284.1%
hypot-def99.6%
Simplified99.6%
*-commutative99.6%
clear-num99.6%
un-div-inv99.7%
Applied egg-rr99.7%
div-inv99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 98.6%
if 2e-3 < (sin.f64 ky) Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 64.4%
Final simplification79.1%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (hypot (sin ky) (sin kx))))
(if (<= (sin ky) -0.01)
(/ th (/ t_1 (sin ky)))
(if (<= (sin ky) 0.002) (/ (* (sin th) ky) t_1) (sin th)))))
double code(double kx, double ky, double th) {
double t_1 = hypot(sin(ky), sin(kx));
double tmp;
if (sin(ky) <= -0.01) {
tmp = th / (t_1 / sin(ky));
} else if (sin(ky) <= 0.002) {
tmp = (sin(th) * ky) / t_1;
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.hypot(Math.sin(ky), Math.sin(kx));
double tmp;
if (Math.sin(ky) <= -0.01) {
tmp = th / (t_1 / Math.sin(ky));
} else if (Math.sin(ky) <= 0.002) {
tmp = (Math.sin(th) * ky) / t_1;
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.hypot(math.sin(ky), math.sin(kx)) tmp = 0 if math.sin(ky) <= -0.01: tmp = th / (t_1 / math.sin(ky)) elif math.sin(ky) <= 0.002: tmp = (math.sin(th) * ky) / t_1 else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)) tmp = 0.0 if (sin(ky) <= -0.01) tmp = Float64(th / Float64(t_1 / sin(ky))); elseif (sin(ky) <= 0.002) tmp = Float64(Float64(sin(th) * ky) / t_1); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)); tmp = 0.0; if (sin(ky) <= -0.01) tmp = th / (t_1 / sin(ky)); elseif (sin(ky) <= 0.002) tmp = (sin(th) * ky) / t_1; else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[N[Sin[ky], $MachinePrecision], -0.01], N[(th / N[(t$95$1 / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 0.002], N[(N[(N[Sin[th], $MachinePrecision] * ky), $MachinePrecision] / t$95$1), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\
\mathbf{if}\;\sin ky \leq -0.01:\\
\;\;\;\;\frac{th}{\frac{t_1}{\sin ky}}\\
\mathbf{elif}\;\sin ky \leq 0.002:\\
\;\;\;\;\frac{\sin th \cdot ky}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0100000000000000002Initial program 99.6%
associate-*l/99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.5%
Simplified99.5%
Taylor expanded in th around 0 57.1%
expm1-log1p-u56.4%
expm1-udef4.4%
div-inv4.4%
*-commutative4.4%
associate-*l*4.4%
div-inv4.4%
Applied egg-rr4.4%
expm1-def56.6%
expm1-log1p57.2%
*-commutative57.2%
associate-*l/57.1%
associate-*r/57.1%
Simplified57.1%
associate-*r/57.1%
*-commutative57.1%
associate-/l*57.2%
Applied egg-rr57.2%
if -0.0100000000000000002 < (sin.f64 ky) < 2e-3Initial program 84.1%
associate-*l/78.9%
+-commutative78.9%
unpow278.9%
unpow278.9%
hypot-def91.0%
Simplified91.0%
Taylor expanded in ky around 0 90.0%
if 2e-3 < (sin.f64 ky) Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 64.4%
Final simplification74.9%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.01)
(fabs (sin th))
(if (<= (sin ky) -4e-220)
(fabs (* (sin th) (/ ky (sin kx))))
(if (<= (sin ky) 2e-115) (/ (sin th) (/ (sin kx) ky)) (sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.01) {
tmp = fabs(sin(th));
} else if (sin(ky) <= -4e-220) {
tmp = fabs((sin(th) * (ky / sin(kx))));
} else if (sin(ky) <= 2e-115) {
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.01d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= (-4d-220)) then
tmp = abs((sin(th) * (ky / sin(kx))))
else if (sin(ky) <= 2d-115) 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.01) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= -4e-220) {
tmp = Math.abs((Math.sin(th) * (ky / Math.sin(kx))));
} else if (Math.sin(ky) <= 2e-115) {
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.01: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= -4e-220: tmp = math.fabs((math.sin(th) * (ky / math.sin(kx)))) elif math.sin(ky) <= 2e-115: 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.01) tmp = abs(sin(th)); elseif (sin(ky) <= -4e-220) tmp = abs(Float64(sin(th) * Float64(ky / sin(kx)))); elseif (sin(ky) <= 2e-115) 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.01) tmp = abs(sin(th)); elseif (sin(ky) <= -4e-220) tmp = abs((sin(th) * (ky / sin(kx)))); elseif (sin(ky) <= 2e-115) 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.01], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], -4e-220], N[Abs[N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-115], 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.01:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq -4 \cdot 10^{-220}:\\
\;\;\;\;\left|\sin th \cdot \frac{ky}{\sin kx}\right|\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-115}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0100000000000000002Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.7%
Simplified99.7%
associate-*l/99.5%
clear-num99.4%
Applied egg-rr99.4%
Taylor expanded in kx around 0 2.7%
remove-double-div2.7%
add-sqr-sqrt1.1%
sqrt-unprod25.8%
pow225.8%
Applied egg-rr25.8%
unpow225.8%
rem-sqrt-square33.9%
Simplified33.9%
if -0.0100000000000000002 < (sin.f64 ky) < -3.99999999999999997e-220Initial program 92.9%
+-commutative92.9%
unpow292.9%
unpow292.9%
hypot-def99.5%
Simplified99.5%
associate-*l/95.7%
clear-num94.8%
Applied egg-rr94.8%
Taylor expanded in ky around 0 39.5%
add-sqr-sqrt30.3%
sqrt-unprod45.1%
pow245.1%
clear-num45.0%
*-un-lft-identity45.0%
times-frac45.0%
/-rgt-identity45.0%
Applied egg-rr45.0%
unpow245.0%
rem-sqrt-square56.1%
Simplified56.1%
if -3.99999999999999997e-220 < (sin.f64 ky) < 2.0000000000000001e-115Initial program 67.3%
+-commutative67.3%
unpow267.3%
unpow267.3%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 58.3%
associate-/l*64.1%
Simplified64.1%
if 2.0000000000000001e-115 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 62.1%
Final simplification52.9%
(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.0%
associate-*l/89.4%
associate-*r/91.9%
+-commutative91.9%
unpow291.9%
unpow291.9%
hypot-def99.6%
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.0%
+-commutative92.0%
unpow292.0%
unpow292.0%
hypot-def99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -1e-31) (fabs (sin th)) (if (<= (sin ky) 2e-115) (* (sin th) (/ ky (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -1e-31) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 2e-115) {
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) <= (-1d-31)) then
tmp = abs(sin(th))
else if (sin(ky) <= 2d-115) 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) <= -1e-31) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 2e-115) {
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) <= -1e-31: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 2e-115: 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) <= -1e-31) tmp = abs(sin(th)); elseif (sin(ky) <= 2e-115) 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) <= -1e-31) tmp = abs(sin(th)); elseif (sin(ky) <= 2e-115) 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], -1e-31], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-115], 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 -1 \cdot 10^{-31}:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-115}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -1e-31Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.7%
Simplified99.7%
associate-*l/99.5%
clear-num99.4%
Applied egg-rr99.4%
Taylor expanded in kx around 0 2.7%
remove-double-div2.7%
add-sqr-sqrt1.2%
sqrt-unprod25.7%
pow225.7%
Applied egg-rr25.7%
unpow225.7%
rem-sqrt-square33.2%
Simplified33.2%
if -1e-31 < (sin.f64 ky) < 2.0000000000000001e-115Initial program 78.3%
+-commutative78.3%
unpow278.3%
unpow278.3%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 55.1%
if 2.0000000000000001e-115 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 62.1%
Final simplification50.2%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -1e-31) (fabs (sin th)) (if (<= (sin ky) 2e-115) (/ (sin th) (/ (sin kx) ky)) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -1e-31) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 2e-115) {
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) <= (-1d-31)) then
tmp = abs(sin(th))
else if (sin(ky) <= 2d-115) 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) <= -1e-31) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 2e-115) {
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) <= -1e-31: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 2e-115: 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) <= -1e-31) tmp = abs(sin(th)); elseif (sin(ky) <= 2e-115) 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) <= -1e-31) tmp = abs(sin(th)); elseif (sin(ky) <= 2e-115) 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], -1e-31], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-115], 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 -1 \cdot 10^{-31}:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-115}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -1e-31Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.7%
Simplified99.7%
associate-*l/99.5%
clear-num99.4%
Applied egg-rr99.4%
Taylor expanded in kx around 0 2.7%
remove-double-div2.7%
add-sqr-sqrt1.2%
sqrt-unprod25.7%
pow225.7%
Applied egg-rr25.7%
unpow225.7%
rem-sqrt-square33.2%
Simplified33.2%
if -1e-31 < (sin.f64 ky) < 2.0000000000000001e-115Initial program 78.3%
+-commutative78.3%
unpow278.3%
unpow278.3%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 51.8%
associate-/l*55.2%
Simplified55.2%
if 2.0000000000000001e-115 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 62.1%
Final simplification50.2%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (fabs (sin th))))
(if (<= ky -1e-121)
t_1
(if (<= ky 5e-134)
(/ (sin th) (/ kx ky))
(if (<= ky 2.15e+112) (sin th) t_1)))))
double code(double kx, double ky, double th) {
double t_1 = fabs(sin(th));
double tmp;
if (ky <= -1e-121) {
tmp = t_1;
} else if (ky <= 5e-134) {
tmp = sin(th) / (kx / ky);
} else if (ky <= 2.15e+112) {
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 = abs(sin(th))
if (ky <= (-1d-121)) then
tmp = t_1
else if (ky <= 5d-134) then
tmp = sin(th) / (kx / ky)
else if (ky <= 2.15d+112) 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.abs(Math.sin(th));
double tmp;
if (ky <= -1e-121) {
tmp = t_1;
} else if (ky <= 5e-134) {
tmp = Math.sin(th) / (kx / ky);
} else if (ky <= 2.15e+112) {
tmp = Math.sin(th);
} else {
tmp = t_1;
}
return tmp;
}
def code(kx, ky, th): t_1 = math.fabs(math.sin(th)) tmp = 0 if ky <= -1e-121: tmp = t_1 elif ky <= 5e-134: tmp = math.sin(th) / (kx / ky) elif ky <= 2.15e+112: tmp = math.sin(th) else: tmp = t_1 return tmp
function code(kx, ky, th) t_1 = abs(sin(th)) tmp = 0.0 if (ky <= -1e-121) tmp = t_1; elseif (ky <= 5e-134) tmp = Float64(sin(th) / Float64(kx / ky)); elseif (ky <= 2.15e+112) tmp = sin(th); else tmp = t_1; end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = abs(sin(th)); tmp = 0.0; if (ky <= -1e-121) tmp = t_1; elseif (ky <= 5e-134) tmp = sin(th) / (kx / ky); elseif (ky <= 2.15e+112) tmp = sin(th); else tmp = t_1; end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[ky, -1e-121], t$95$1, If[LessEqual[ky, 5e-134], N[(N[Sin[th], $MachinePrecision] / N[(kx / ky), $MachinePrecision]), $MachinePrecision], If[LessEqual[ky, 2.15e+112], N[Sin[th], $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|\sin th\right|\\
\mathbf{if}\;ky \leq -1 \cdot 10^{-121}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;ky \leq 5 \cdot 10^{-134}:\\
\;\;\;\;\frac{\sin th}{\frac{kx}{ky}}\\
\mathbf{elif}\;ky \leq 2.15 \cdot 10^{+112}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if ky < -9.9999999999999998e-122 or 2.14999999999999991e112 < ky Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.7%
Simplified99.7%
associate-*l/98.4%
clear-num98.0%
Applied egg-rr98.0%
Taylor expanded in kx around 0 20.0%
remove-double-div20.0%
add-sqr-sqrt12.4%
sqrt-unprod29.3%
pow229.3%
Applied egg-rr29.3%
unpow229.3%
rem-sqrt-square35.5%
Simplified35.5%
if -9.9999999999999998e-122 < ky < 5.0000000000000003e-134Initial program 71.6%
+-commutative71.6%
unpow271.6%
unpow271.6%
hypot-def99.5%
Simplified99.5%
associate-*l/88.9%
clear-num88.9%
Applied egg-rr88.9%
Taylor expanded in ky around 0 55.5%
Taylor expanded in kx around 0 38.4%
associate-/l*43.0%
Simplified43.0%
if 5.0000000000000003e-134 < ky < 2.14999999999999991e112Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 52.4%
Final simplification41.0%
(FPCore (kx ky th) :precision binary64 (if (<= ky -1.25e-32) (sin th) (if (<= ky 3.5e-145) (/ ky (/ (sin kx) th)) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -1.25e-32) {
tmp = sin(th);
} else if (ky <= 3.5e-145) {
tmp = ky / (sin(kx) / th);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= (-1.25d-32)) then
tmp = sin(th)
else if (ky <= 3.5d-145) then
tmp = ky / (sin(kx) / th)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= -1.25e-32) {
tmp = Math.sin(th);
} else if (ky <= 3.5e-145) {
tmp = ky / (Math.sin(kx) / th);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -1.25e-32: tmp = math.sin(th) elif ky <= 3.5e-145: tmp = ky / (math.sin(kx) / th) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -1.25e-32) tmp = sin(th); elseif (ky <= 3.5e-145) tmp = Float64(ky / Float64(sin(kx) / th)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -1.25e-32) tmp = sin(th); elseif (ky <= 3.5e-145) tmp = ky / (sin(kx) / th); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -1.25e-32], N[Sin[th], $MachinePrecision], If[LessEqual[ky, 3.5e-145], N[(ky / N[(N[Sin[kx], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -1.25 \cdot 10^{-32}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 3.5 \cdot 10^{-145}:\\
\;\;\;\;\frac{ky}{\frac{\sin kx}{th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -1.25e-32 or 3.49999999999999997e-145 < ky Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 31.9%
if -1.25e-32 < ky < 3.49999999999999997e-145Initial program 76.3%
associate-*l/70.8%
+-commutative70.8%
unpow270.8%
unpow270.8%
hypot-def88.9%
Simplified88.9%
Taylor expanded in th around 0 41.0%
Taylor expanded in ky around 0 30.5%
associate-/l*34.1%
Simplified34.1%
Final simplification32.6%
(FPCore (kx ky th) :precision binary64 (if (<= ky -1.25e-32) (sin th) (if (<= ky 3.8e-145) (/ th (/ (sin kx) ky)) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -1.25e-32) {
tmp = sin(th);
} else if (ky <= 3.8e-145) {
tmp = 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 (ky <= (-1.25d-32)) then
tmp = sin(th)
else if (ky <= 3.8d-145) then
tmp = 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 (ky <= -1.25e-32) {
tmp = Math.sin(th);
} else if (ky <= 3.8e-145) {
tmp = th / (Math.sin(kx) / ky);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -1.25e-32: tmp = math.sin(th) elif ky <= 3.8e-145: tmp = th / (math.sin(kx) / ky) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -1.25e-32) tmp = sin(th); elseif (ky <= 3.8e-145) tmp = Float64(th / Float64(sin(kx) / ky)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -1.25e-32) tmp = sin(th); elseif (ky <= 3.8e-145) tmp = th / (sin(kx) / ky); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -1.25e-32], N[Sin[th], $MachinePrecision], If[LessEqual[ky, 3.8e-145], N[(th / N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -1.25 \cdot 10^{-32}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 3.8 \cdot 10^{-145}:\\
\;\;\;\;\frac{th}{\frac{\sin kx}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -1.25e-32 or 3.8000000000000002e-145 < ky Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 31.9%
if -1.25e-32 < ky < 3.8000000000000002e-145Initial program 76.3%
+-commutative76.3%
unpow276.3%
unpow276.3%
hypot-def99.6%
Simplified99.6%
associate-*l/88.9%
clear-num88.4%
Applied egg-rr88.4%
Taylor expanded in ky around 0 50.3%
Taylor expanded in th around 0 30.5%
associate-/l*34.2%
Simplified34.2%
Final simplification32.7%
(FPCore (kx ky th) :precision binary64 (if (<= ky -53000000000.0) (sin th) (if (<= ky 4.2e-134) (/ (sin th) (/ kx ky)) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -53000000000.0) {
tmp = sin(th);
} else if (ky <= 4.2e-134) {
tmp = sin(th) / (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 (ky <= (-53000000000.0d0)) then
tmp = sin(th)
else if (ky <= 4.2d-134) then
tmp = sin(th) / (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 (ky <= -53000000000.0) {
tmp = Math.sin(th);
} else if (ky <= 4.2e-134) {
tmp = Math.sin(th) / (kx / ky);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -53000000000.0: tmp = math.sin(th) elif ky <= 4.2e-134: tmp = math.sin(th) / (kx / ky) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -53000000000.0) tmp = sin(th); elseif (ky <= 4.2e-134) tmp = Float64(sin(th) / Float64(kx / ky)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -53000000000.0) tmp = sin(th); elseif (ky <= 4.2e-134) tmp = sin(th) / (kx / ky); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -53000000000.0], N[Sin[th], $MachinePrecision], If[LessEqual[ky, 4.2e-134], N[(N[Sin[th], $MachinePrecision] / N[(kx / ky), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -53000000000:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 4.2 \cdot 10^{-134}:\\
\;\;\;\;\frac{\sin th}{\frac{kx}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -5.3e10 or 4.1999999999999998e-134 < ky Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 33.0%
if -5.3e10 < ky < 4.1999999999999998e-134Initial program 78.8%
+-commutative78.8%
unpow278.8%
unpow278.8%
hypot-def99.6%
Simplified99.6%
associate-*l/90.0%
clear-num89.6%
Applied egg-rr89.6%
Taylor expanded in ky around 0 48.2%
Taylor expanded in kx around 0 32.9%
associate-/l*36.2%
Simplified36.2%
Final simplification34.2%
(FPCore (kx ky th) :precision binary64 (if (or (<= kx -3.4e-111) (not (<= kx 6.2e-47))) (sqrt (* th th)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if ((kx <= -3.4e-111) || !(kx <= 6.2e-47)) {
tmp = sqrt((th * th));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if ((kx <= (-3.4d-111)) .or. (.not. (kx <= 6.2d-47))) then
tmp = sqrt((th * th))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if ((kx <= -3.4e-111) || !(kx <= 6.2e-47)) {
tmp = Math.sqrt((th * th));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (kx <= -3.4e-111) or not (kx <= 6.2e-47): tmp = math.sqrt((th * th)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if ((kx <= -3.4e-111) || !(kx <= 6.2e-47)) tmp = sqrt(Float64(th * th)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((kx <= -3.4e-111) || ~((kx <= 6.2e-47))) tmp = sqrt((th * th)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[Or[LessEqual[kx, -3.4e-111], N[Not[LessEqual[kx, 6.2e-47]], $MachinePrecision]], N[Sqrt[N[(th * th), $MachinePrecision]], $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq -3.4 \cdot 10^{-111} \lor \neg \left(kx \leq 6.2 \cdot 10^{-47}\right):\\
\;\;\;\;\sqrt{th \cdot th}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if kx < -3.39999999999999997e-111 or 6.1999999999999996e-47 < kx Initial program 99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.5%
Simplified99.5%
associate-*l/98.3%
clear-num98.0%
Applied egg-rr98.0%
Taylor expanded in kx around 0 10.3%
Taylor expanded in th around 0 5.6%
remove-double-div5.6%
add-sqr-sqrt3.5%
sqrt-unprod18.2%
Applied egg-rr18.2%
if -3.39999999999999997e-111 < kx < 6.1999999999999996e-47Initial program 82.2%
+-commutative82.2%
unpow282.2%
unpow282.2%
hypot-def99.8%
Simplified99.8%
Taylor expanded in kx around 0 44.4%
Final simplification29.6%
(FPCore (kx ky th) :precision binary64 (sin th))
double code(double kx, double ky, double th) {
return sin(th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = sin(th)
end function
public static double code(double kx, double ky, double th) {
return Math.sin(th);
}
def code(kx, ky, th): return math.sin(th)
function code(kx, ky, th) return sin(th) end
function tmp = code(kx, ky, th) tmp = sin(th); end
code[kx_, ky_, th_] := N[Sin[th], $MachinePrecision]
\begin{array}{l}
\\
\sin th
\end{array}
Initial program 92.0%
+-commutative92.0%
unpow292.0%
unpow292.0%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 25.1%
Final simplification25.1%
(FPCore (kx ky th) :precision binary64 (/ 1.0 (+ (/ 1.0 th) (* th 0.16666666666666666))))
double code(double kx, double ky, double th) {
return 1.0 / ((1.0 / th) + (th * 0.16666666666666666));
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = 1.0d0 / ((1.0d0 / th) + (th * 0.16666666666666666d0))
end function
public static double code(double kx, double ky, double th) {
return 1.0 / ((1.0 / th) + (th * 0.16666666666666666));
}
def code(kx, ky, th): return 1.0 / ((1.0 / th) + (th * 0.16666666666666666))
function code(kx, ky, th) return Float64(1.0 / Float64(Float64(1.0 / th) + Float64(th * 0.16666666666666666))) end
function tmp = code(kx, ky, th) tmp = 1.0 / ((1.0 / th) + (th * 0.16666666666666666)); end
code[kx_, ky_, th_] := N[(1.0 / N[(N[(1.0 / th), $MachinePrecision] + N[(th * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\frac{1}{th} + th \cdot 0.16666666666666666}
\end{array}
Initial program 92.0%
+-commutative92.0%
unpow292.0%
unpow292.0%
hypot-def99.6%
Simplified99.6%
associate-*l/95.4%
clear-num95.1%
Applied egg-rr95.1%
Taylor expanded in kx around 0 25.1%
Taylor expanded in th around 0 13.6%
*-commutative13.6%
Simplified13.6%
Final simplification13.6%
(FPCore (kx ky th) :precision binary64 th)
double code(double kx, double ky, double th) {
return th;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = th
end function
public static double code(double kx, double ky, double th) {
return th;
}
def code(kx, ky, th): return th
function code(kx, ky, th) return th end
function tmp = code(kx, ky, th) tmp = th; end
code[kx_, ky_, th_] := th
\begin{array}{l}
\\
th
\end{array}
Initial program 92.0%
associate-*l/89.4%
+-commutative89.4%
unpow289.4%
unpow289.4%
hypot-def95.4%
Simplified95.4%
Taylor expanded in th around 0 46.7%
Taylor expanded in kx around 0 13.1%
Final simplification13.1%
herbie shell --seed 2023194
(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)))