
(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%
unpow292.0%
sqr-neg92.0%
sin-neg92.0%
sin-neg92.0%
unpow292.0%
associate-*l/90.9%
associate-/l*92.0%
+-commutative92.0%
unpow292.0%
sin-neg92.0%
sin-neg92.0%
Simplified99.6%
associate-*r/96.1%
hypot-undefine90.9%
unpow290.9%
unpow290.9%
+-commutative90.9%
associate-*l/92.0%
*-commutative92.0%
clear-num92.0%
un-div-inv92.1%
+-commutative92.1%
unpow292.1%
unpow292.1%
hypot-undefine99.7%
Applied egg-rr99.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.022)
(* (sin ky) (fabs (/ (sin th) (sin kx))))
(if (<= (sin kx) 1.05e-117)
(sin th)
(if (<= (sin kx) 1e-27)
(/ (* th (sin ky)) (hypot (sin ky) kx))
(/ 1.0 (/ (sin kx) (* (sin th) (sin ky))))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.022) {
tmp = sin(ky) * fabs((sin(th) / sin(kx)));
} else if (sin(kx) <= 1.05e-117) {
tmp = sin(th);
} else if (sin(kx) <= 1e-27) {
tmp = (th * sin(ky)) / hypot(sin(ky), kx);
} else {
tmp = 1.0 / (sin(kx) / (sin(th) * sin(ky)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.022) {
tmp = Math.sin(ky) * Math.abs((Math.sin(th) / Math.sin(kx)));
} else if (Math.sin(kx) <= 1.05e-117) {
tmp = Math.sin(th);
} else if (Math.sin(kx) <= 1e-27) {
tmp = (th * Math.sin(ky)) / Math.hypot(Math.sin(ky), kx);
} else {
tmp = 1.0 / (Math.sin(kx) / (Math.sin(th) * Math.sin(ky)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.022: tmp = math.sin(ky) * math.fabs((math.sin(th) / math.sin(kx))) elif math.sin(kx) <= 1.05e-117: tmp = math.sin(th) elif math.sin(kx) <= 1e-27: tmp = (th * math.sin(ky)) / math.hypot(math.sin(ky), kx) else: tmp = 1.0 / (math.sin(kx) / (math.sin(th) * math.sin(ky))) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.022) tmp = Float64(sin(ky) * abs(Float64(sin(th) / sin(kx)))); elseif (sin(kx) <= 1.05e-117) tmp = sin(th); elseif (sin(kx) <= 1e-27) tmp = Float64(Float64(th * sin(ky)) / hypot(sin(ky), kx)); else tmp = Float64(1.0 / Float64(sin(kx) / Float64(sin(th) * sin(ky)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.022) tmp = sin(ky) * abs((sin(th) / sin(kx))); elseif (sin(kx) <= 1.05e-117) tmp = sin(th); elseif (sin(kx) <= 1e-27) tmp = (th * sin(ky)) / hypot(sin(ky), kx); else tmp = 1.0 / (sin(kx) / (sin(th) * sin(ky))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.022], N[(N[Sin[ky], $MachinePrecision] * N[Abs[N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1.05e-117], N[Sin[th], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-27], N[(N[(th * N[Sin[ky], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sin[kx], $MachinePrecision] / N[(N[Sin[th], $MachinePrecision] * N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.022:\\
\;\;\;\;\sin ky \cdot \left|\frac{\sin th}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 1.05 \cdot 10^{-117}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;\sin kx \leq 10^{-27}:\\
\;\;\;\;\frac{th \cdot \sin ky}{\mathsf{hypot}\left(\sin ky, kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{\sin kx}{\sin th \cdot \sin ky}}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.021999999999999999Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.6%
associate-/l*99.5%
+-commutative99.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
Simplified99.5%
add-log-exp66.5%
Applied egg-rr66.5%
Taylor expanded in ky around 0 12.8%
add-sqr-sqrt12.2%
sqrt-unprod27.4%
pow227.4%
rem-log-exp32.8%
Applied egg-rr32.8%
unpow232.8%
rem-sqrt-square34.3%
Simplified34.3%
if -0.021999999999999999 < (sin.f64 kx) < 1.05e-117Initial program 83.1%
unpow283.1%
sqr-neg83.1%
sin-neg83.1%
sin-neg83.1%
unpow283.1%
associate-*l/81.3%
associate-/l*83.0%
+-commutative83.0%
unpow283.0%
sin-neg83.0%
sin-neg83.0%
Simplified99.7%
Taylor expanded in kx around 0 41.8%
if 1.05e-117 < (sin.f64 kx) < 1e-27Initial program 99.8%
unpow299.8%
sqr-neg99.8%
sin-neg99.8%
sin-neg99.8%
unpow299.8%
associate-*l/93.3%
associate-/l*99.9%
+-commutative99.9%
unpow299.9%
sin-neg99.9%
sin-neg99.9%
Simplified100.0%
associate-*r/93.4%
Applied egg-rr93.4%
Taylor expanded in th around 0 67.8%
Taylor expanded in kx around 0 67.8%
if 1e-27 < (sin.f64 kx) Initial program 99.3%
Taylor expanded in ky around 0 62.5%
associate-*l/62.5%
clear-num62.1%
*-commutative62.1%
Applied egg-rr62.1%
Final simplification46.5%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.022)
(fabs (* (sin ky) (/ (sin th) (sin kx))))
(if (<= (sin kx) 1.05e-117)
(sin th)
(if (<= (sin kx) 1e-27)
(/ (* th (sin ky)) (hypot (sin ky) kx))
(/ 1.0 (/ (sin kx) (* (sin th) (sin ky))))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.022) {
tmp = fabs((sin(ky) * (sin(th) / sin(kx))));
} else if (sin(kx) <= 1.05e-117) {
tmp = sin(th);
} else if (sin(kx) <= 1e-27) {
tmp = (th * sin(ky)) / hypot(sin(ky), kx);
} else {
tmp = 1.0 / (sin(kx) / (sin(th) * sin(ky)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.022) {
tmp = Math.abs((Math.sin(ky) * (Math.sin(th) / Math.sin(kx))));
} else if (Math.sin(kx) <= 1.05e-117) {
tmp = Math.sin(th);
} else if (Math.sin(kx) <= 1e-27) {
tmp = (th * Math.sin(ky)) / Math.hypot(Math.sin(ky), kx);
} else {
tmp = 1.0 / (Math.sin(kx) / (Math.sin(th) * Math.sin(ky)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.022: tmp = math.fabs((math.sin(ky) * (math.sin(th) / math.sin(kx)))) elif math.sin(kx) <= 1.05e-117: tmp = math.sin(th) elif math.sin(kx) <= 1e-27: tmp = (th * math.sin(ky)) / math.hypot(math.sin(ky), kx) else: tmp = 1.0 / (math.sin(kx) / (math.sin(th) * math.sin(ky))) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.022) tmp = abs(Float64(sin(ky) * Float64(sin(th) / sin(kx)))); elseif (sin(kx) <= 1.05e-117) tmp = sin(th); elseif (sin(kx) <= 1e-27) tmp = Float64(Float64(th * sin(ky)) / hypot(sin(ky), kx)); else tmp = Float64(1.0 / Float64(sin(kx) / Float64(sin(th) * sin(ky)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.022) tmp = abs((sin(ky) * (sin(th) / sin(kx)))); elseif (sin(kx) <= 1.05e-117) tmp = sin(th); elseif (sin(kx) <= 1e-27) tmp = (th * sin(ky)) / hypot(sin(ky), kx); else tmp = 1.0 / (sin(kx) / (sin(th) * sin(ky))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.022], N[Abs[N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1.05e-117], N[Sin[th], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-27], N[(N[(th * N[Sin[ky], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sin[kx], $MachinePrecision] / N[(N[Sin[th], $MachinePrecision] * N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.022:\\
\;\;\;\;\left|\sin ky \cdot \frac{\sin th}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 1.05 \cdot 10^{-117}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;\sin kx \leq 10^{-27}:\\
\;\;\;\;\frac{th \cdot \sin ky}{\mathsf{hypot}\left(\sin ky, kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{\sin kx}{\sin th \cdot \sin ky}}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.021999999999999999Initial program 99.5%
Taylor expanded in ky around 0 12.3%
add-sqr-sqrt11.4%
sqrt-unprod20.4%
pow220.4%
*-commutative20.4%
Applied egg-rr20.4%
unpow220.4%
rem-sqrt-square28.3%
associate-*r/28.4%
*-commutative28.4%
associate-/l*28.4%
Simplified28.4%
if -0.021999999999999999 < (sin.f64 kx) < 1.05e-117Initial program 83.1%
unpow283.1%
sqr-neg83.1%
sin-neg83.1%
sin-neg83.1%
unpow283.1%
associate-*l/81.3%
associate-/l*83.0%
+-commutative83.0%
unpow283.0%
sin-neg83.0%
sin-neg83.0%
Simplified99.7%
Taylor expanded in kx around 0 41.8%
if 1.05e-117 < (sin.f64 kx) < 1e-27Initial program 99.8%
unpow299.8%
sqr-neg99.8%
sin-neg99.8%
sin-neg99.8%
unpow299.8%
associate-*l/93.3%
associate-/l*99.9%
+-commutative99.9%
unpow299.9%
sin-neg99.9%
sin-neg99.9%
Simplified100.0%
associate-*r/93.4%
Applied egg-rr93.4%
Taylor expanded in th around 0 67.8%
Taylor expanded in kx around 0 67.8%
if 1e-27 < (sin.f64 kx) Initial program 99.3%
Taylor expanded in ky around 0 62.5%
associate-*l/62.5%
clear-num62.1%
*-commutative62.1%
Applied egg-rr62.1%
Final simplification45.1%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (* th (sin ky))))
(if (<= (sin kx) -0.04)
(/ 1.0 (/ (fabs (sin kx)) t_1))
(if (<= (sin kx) 1.05e-117)
(sin th)
(if (<= (sin kx) 1e-27)
(/ t_1 (hypot (sin ky) kx))
(/ 1.0 (/ (sin kx) (* (sin th) (sin ky)))))))))
double code(double kx, double ky, double th) {
double t_1 = th * sin(ky);
double tmp;
if (sin(kx) <= -0.04) {
tmp = 1.0 / (fabs(sin(kx)) / t_1);
} else if (sin(kx) <= 1.05e-117) {
tmp = sin(th);
} else if (sin(kx) <= 1e-27) {
tmp = t_1 / hypot(sin(ky), kx);
} else {
tmp = 1.0 / (sin(kx) / (sin(th) * sin(ky)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = th * Math.sin(ky);
double tmp;
if (Math.sin(kx) <= -0.04) {
tmp = 1.0 / (Math.abs(Math.sin(kx)) / t_1);
} else if (Math.sin(kx) <= 1.05e-117) {
tmp = Math.sin(th);
} else if (Math.sin(kx) <= 1e-27) {
tmp = t_1 / Math.hypot(Math.sin(ky), kx);
} else {
tmp = 1.0 / (Math.sin(kx) / (Math.sin(th) * Math.sin(ky)));
}
return tmp;
}
def code(kx, ky, th): t_1 = th * math.sin(ky) tmp = 0 if math.sin(kx) <= -0.04: tmp = 1.0 / (math.fabs(math.sin(kx)) / t_1) elif math.sin(kx) <= 1.05e-117: tmp = math.sin(th) elif math.sin(kx) <= 1e-27: tmp = t_1 / math.hypot(math.sin(ky), kx) else: tmp = 1.0 / (math.sin(kx) / (math.sin(th) * math.sin(ky))) return tmp
function code(kx, ky, th) t_1 = Float64(th * sin(ky)) tmp = 0.0 if (sin(kx) <= -0.04) tmp = Float64(1.0 / Float64(abs(sin(kx)) / t_1)); elseif (sin(kx) <= 1.05e-117) tmp = sin(th); elseif (sin(kx) <= 1e-27) tmp = Float64(t_1 / hypot(sin(ky), kx)); else tmp = Float64(1.0 / Float64(sin(kx) / Float64(sin(th) * sin(ky)))); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = th * sin(ky); tmp = 0.0; if (sin(kx) <= -0.04) tmp = 1.0 / (abs(sin(kx)) / t_1); elseif (sin(kx) <= 1.05e-117) tmp = sin(th); elseif (sin(kx) <= 1e-27) tmp = t_1 / hypot(sin(ky), kx); else tmp = 1.0 / (sin(kx) / (sin(th) * sin(ky))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(th * N[Sin[ky], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Sin[kx], $MachinePrecision], -0.04], N[(1.0 / N[(N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1.05e-117], N[Sin[th], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-27], N[(t$95$1 / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sin[kx], $MachinePrecision] / N[(N[Sin[th], $MachinePrecision] * N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := th \cdot \sin ky\\
\mathbf{if}\;\sin kx \leq -0.04:\\
\;\;\;\;\frac{1}{\frac{\left|\sin kx\right|}{t\_1}}\\
\mathbf{elif}\;\sin kx \leq 1.05 \cdot 10^{-117}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;\sin kx \leq 10^{-27}:\\
\;\;\;\;\frac{t\_1}{\mathsf{hypot}\left(\sin ky, kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{\sin kx}{\sin th \cdot \sin ky}}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0400000000000000008Initial program 99.5%
Taylor expanded in ky around 0 12.6%
associate-*l/12.6%
clear-num12.6%
*-commutative12.6%
Applied egg-rr12.6%
Taylor expanded in th around 0 13.4%
add-sqr-sqrt0.0%
sqrt-prod56.3%
rem-sqrt-square56.3%
Applied egg-rr28.5%
if -0.0400000000000000008 < (sin.f64 kx) < 1.05e-117Initial program 83.4%
unpow283.4%
sqr-neg83.4%
sin-neg83.4%
sin-neg83.4%
unpow283.4%
associate-*l/81.6%
associate-/l*83.3%
+-commutative83.3%
unpow283.3%
sin-neg83.3%
sin-neg83.3%
Simplified99.7%
Taylor expanded in kx around 0 41.4%
if 1.05e-117 < (sin.f64 kx) < 1e-27Initial program 99.8%
unpow299.8%
sqr-neg99.8%
sin-neg99.8%
sin-neg99.8%
unpow299.8%
associate-*l/93.3%
associate-/l*99.9%
+-commutative99.9%
unpow299.9%
sin-neg99.9%
sin-neg99.9%
Simplified100.0%
associate-*r/93.4%
Applied egg-rr93.4%
Taylor expanded in th around 0 67.8%
Taylor expanded in kx around 0 67.8%
if 1e-27 < (sin.f64 kx) Initial program 99.3%
Taylor expanded in ky around 0 62.5%
associate-*l/62.5%
clear-num62.1%
*-commutative62.1%
Applied egg-rr62.1%
Final simplification45.0%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (* th (sin ky))))
(if (<= (sin kx) -0.04)
(/ 1.0 (/ (fabs (sin kx)) t_1))
(if (<= (sin kx) 1.05e-117)
(sin th)
(if (<= (sin kx) 1e-27)
(/ t_1 (hypot (sin ky) kx))
(* (sin th) (/ 1.0 (/ (sin kx) (sin ky)))))))))
double code(double kx, double ky, double th) {
double t_1 = th * sin(ky);
double tmp;
if (sin(kx) <= -0.04) {
tmp = 1.0 / (fabs(sin(kx)) / t_1);
} else if (sin(kx) <= 1.05e-117) {
tmp = sin(th);
} else if (sin(kx) <= 1e-27) {
tmp = t_1 / hypot(sin(ky), kx);
} else {
tmp = sin(th) * (1.0 / (sin(kx) / sin(ky)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = th * Math.sin(ky);
double tmp;
if (Math.sin(kx) <= -0.04) {
tmp = 1.0 / (Math.abs(Math.sin(kx)) / t_1);
} else if (Math.sin(kx) <= 1.05e-117) {
tmp = Math.sin(th);
} else if (Math.sin(kx) <= 1e-27) {
tmp = t_1 / Math.hypot(Math.sin(ky), kx);
} else {
tmp = Math.sin(th) * (1.0 / (Math.sin(kx) / Math.sin(ky)));
}
return tmp;
}
def code(kx, ky, th): t_1 = th * math.sin(ky) tmp = 0 if math.sin(kx) <= -0.04: tmp = 1.0 / (math.fabs(math.sin(kx)) / t_1) elif math.sin(kx) <= 1.05e-117: tmp = math.sin(th) elif math.sin(kx) <= 1e-27: tmp = t_1 / math.hypot(math.sin(ky), kx) else: tmp = math.sin(th) * (1.0 / (math.sin(kx) / math.sin(ky))) return tmp
function code(kx, ky, th) t_1 = Float64(th * sin(ky)) tmp = 0.0 if (sin(kx) <= -0.04) tmp = Float64(1.0 / Float64(abs(sin(kx)) / t_1)); elseif (sin(kx) <= 1.05e-117) tmp = sin(th); elseif (sin(kx) <= 1e-27) tmp = Float64(t_1 / hypot(sin(ky), kx)); else tmp = Float64(sin(th) * Float64(1.0 / Float64(sin(kx) / sin(ky)))); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = th * sin(ky); tmp = 0.0; if (sin(kx) <= -0.04) tmp = 1.0 / (abs(sin(kx)) / t_1); elseif (sin(kx) <= 1.05e-117) tmp = sin(th); elseif (sin(kx) <= 1e-27) tmp = t_1 / hypot(sin(ky), kx); else tmp = sin(th) * (1.0 / (sin(kx) / sin(ky))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(th * N[Sin[ky], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Sin[kx], $MachinePrecision], -0.04], N[(1.0 / N[(N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1.05e-117], N[Sin[th], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-27], N[(t$95$1 / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(1.0 / N[(N[Sin[kx], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := th \cdot \sin ky\\
\mathbf{if}\;\sin kx \leq -0.04:\\
\;\;\;\;\frac{1}{\frac{\left|\sin kx\right|}{t\_1}}\\
\mathbf{elif}\;\sin kx \leq 1.05 \cdot 10^{-117}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;\sin kx \leq 10^{-27}:\\
\;\;\;\;\frac{t\_1}{\mathsf{hypot}\left(\sin ky, kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{1}{\frac{\sin kx}{\sin ky}}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0400000000000000008Initial program 99.5%
Taylor expanded in ky around 0 12.6%
associate-*l/12.6%
clear-num12.6%
*-commutative12.6%
Applied egg-rr12.6%
Taylor expanded in th around 0 13.4%
add-sqr-sqrt0.0%
sqrt-prod56.3%
rem-sqrt-square56.3%
Applied egg-rr28.5%
if -0.0400000000000000008 < (sin.f64 kx) < 1.05e-117Initial program 83.4%
unpow283.4%
sqr-neg83.4%
sin-neg83.4%
sin-neg83.4%
unpow283.4%
associate-*l/81.6%
associate-/l*83.3%
+-commutative83.3%
unpow283.3%
sin-neg83.3%
sin-neg83.3%
Simplified99.7%
Taylor expanded in kx around 0 41.4%
if 1.05e-117 < (sin.f64 kx) < 1e-27Initial program 99.8%
unpow299.8%
sqr-neg99.8%
sin-neg99.8%
sin-neg99.8%
unpow299.8%
associate-*l/93.3%
associate-/l*99.9%
+-commutative99.9%
unpow299.9%
sin-neg99.9%
sin-neg99.9%
Simplified100.0%
associate-*r/93.4%
Applied egg-rr93.4%
Taylor expanded in th around 0 67.8%
Taylor expanded in kx around 0 67.8%
if 1e-27 < (sin.f64 kx) Initial program 99.3%
Taylor expanded in ky around 0 62.5%
clear-num62.5%
inv-pow62.5%
Applied egg-rr62.5%
unpow-162.5%
Simplified62.5%
Final simplification45.1%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.04)
(fabs (* th (/ (sin ky) (sin kx))))
(if (<= (sin kx) 1.05e-117)
(sin th)
(if (<= (sin kx) 1e-27)
(/ (* th (sin ky)) (hypot (sin ky) kx))
(* (sin th) (/ 1.0 (/ (sin kx) (sin ky))))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.04) {
tmp = fabs((th * (sin(ky) / sin(kx))));
} else if (sin(kx) <= 1.05e-117) {
tmp = sin(th);
} else if (sin(kx) <= 1e-27) {
tmp = (th * sin(ky)) / hypot(sin(ky), kx);
} else {
tmp = sin(th) * (1.0 / (sin(kx) / sin(ky)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.04) {
tmp = Math.abs((th * (Math.sin(ky) / Math.sin(kx))));
} else if (Math.sin(kx) <= 1.05e-117) {
tmp = Math.sin(th);
} else if (Math.sin(kx) <= 1e-27) {
tmp = (th * Math.sin(ky)) / Math.hypot(Math.sin(ky), kx);
} else {
tmp = Math.sin(th) * (1.0 / (Math.sin(kx) / Math.sin(ky)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.04: tmp = math.fabs((th * (math.sin(ky) / math.sin(kx)))) elif math.sin(kx) <= 1.05e-117: tmp = math.sin(th) elif math.sin(kx) <= 1e-27: tmp = (th * math.sin(ky)) / math.hypot(math.sin(ky), kx) else: tmp = math.sin(th) * (1.0 / (math.sin(kx) / math.sin(ky))) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.04) tmp = abs(Float64(th * Float64(sin(ky) / sin(kx)))); elseif (sin(kx) <= 1.05e-117) tmp = sin(th); elseif (sin(kx) <= 1e-27) tmp = Float64(Float64(th * sin(ky)) / hypot(sin(ky), kx)); else tmp = Float64(sin(th) * Float64(1.0 / Float64(sin(kx) / sin(ky)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.04) tmp = abs((th * (sin(ky) / sin(kx)))); elseif (sin(kx) <= 1.05e-117) tmp = sin(th); elseif (sin(kx) <= 1e-27) tmp = (th * sin(ky)) / hypot(sin(ky), kx); else tmp = sin(th) * (1.0 / (sin(kx) / sin(ky))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.04], N[Abs[N[(th * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1.05e-117], N[Sin[th], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-27], N[(N[(th * N[Sin[ky], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(1.0 / N[(N[Sin[kx], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.04:\\
\;\;\;\;\left|th \cdot \frac{\sin ky}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 1.05 \cdot 10^{-117}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;\sin kx \leq 10^{-27}:\\
\;\;\;\;\frac{th \cdot \sin ky}{\mathsf{hypot}\left(\sin ky, kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{1}{\frac{\sin kx}{\sin ky}}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0400000000000000008Initial program 99.5%
Taylor expanded in ky around 0 12.6%
associate-*l/12.6%
clear-num12.6%
*-commutative12.6%
Applied egg-rr12.6%
Taylor expanded in th around 0 13.4%
add-sqr-sqrt11.8%
sqrt-unprod15.8%
pow215.8%
clear-num15.8%
associate-/l*15.8%
Applied egg-rr15.8%
unpow215.8%
rem-sqrt-square19.9%
Simplified19.9%
if -0.0400000000000000008 < (sin.f64 kx) < 1.05e-117Initial program 83.4%
unpow283.4%
sqr-neg83.4%
sin-neg83.4%
sin-neg83.4%
unpow283.4%
associate-*l/81.6%
associate-/l*83.3%
+-commutative83.3%
unpow283.3%
sin-neg83.3%
sin-neg83.3%
Simplified99.7%
Taylor expanded in kx around 0 41.4%
if 1.05e-117 < (sin.f64 kx) < 1e-27Initial program 99.8%
unpow299.8%
sqr-neg99.8%
sin-neg99.8%
sin-neg99.8%
unpow299.8%
associate-*l/93.3%
associate-/l*99.9%
+-commutative99.9%
unpow299.9%
sin-neg99.9%
sin-neg99.9%
Simplified100.0%
associate-*r/93.4%
Applied egg-rr93.4%
Taylor expanded in th around 0 67.8%
Taylor expanded in kx around 0 67.8%
if 1e-27 < (sin.f64 kx) Initial program 99.3%
Taylor expanded in ky around 0 62.5%
clear-num62.5%
inv-pow62.5%
Applied egg-rr62.5%
unpow-162.5%
Simplified62.5%
Final simplification43.1%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.04)
(fabs (* th (/ (sin ky) (sin kx))))
(if (<= (sin kx) 1.05e-117)
(sin th)
(if (<= (sin kx) 1e-27)
(/ (* th (sin ky)) (hypot (sin ky) kx))
(* (sin ky) (/ (sin th) (sin kx)))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.04) {
tmp = fabs((th * (sin(ky) / sin(kx))));
} else if (sin(kx) <= 1.05e-117) {
tmp = sin(th);
} else if (sin(kx) <= 1e-27) {
tmp = (th * sin(ky)) / hypot(sin(ky), kx);
} else {
tmp = sin(ky) * (sin(th) / sin(kx));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.04) {
tmp = Math.abs((th * (Math.sin(ky) / Math.sin(kx))));
} else if (Math.sin(kx) <= 1.05e-117) {
tmp = Math.sin(th);
} else if (Math.sin(kx) <= 1e-27) {
tmp = (th * Math.sin(ky)) / Math.hypot(Math.sin(ky), kx);
} 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.04: tmp = math.fabs((th * (math.sin(ky) / math.sin(kx)))) elif math.sin(kx) <= 1.05e-117: tmp = math.sin(th) elif math.sin(kx) <= 1e-27: tmp = (th * math.sin(ky)) / math.hypot(math.sin(ky), kx) 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.04) tmp = abs(Float64(th * Float64(sin(ky) / sin(kx)))); elseif (sin(kx) <= 1.05e-117) tmp = sin(th); elseif (sin(kx) <= 1e-27) tmp = Float64(Float64(th * sin(ky)) / hypot(sin(ky), kx)); 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.04) tmp = abs((th * (sin(ky) / sin(kx)))); elseif (sin(kx) <= 1.05e-117) tmp = sin(th); elseif (sin(kx) <= 1e-27) tmp = (th * sin(ky)) / hypot(sin(ky), kx); else tmp = sin(ky) * (sin(th) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.04], N[Abs[N[(th * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1.05e-117], N[Sin[th], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-27], N[(N[(th * N[Sin[ky], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $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.04:\\
\;\;\;\;\left|th \cdot \frac{\sin ky}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 1.05 \cdot 10^{-117}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;\sin kx \leq 10^{-27}:\\
\;\;\;\;\frac{th \cdot \sin ky}{\mathsf{hypot}\left(\sin ky, kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0400000000000000008Initial program 99.5%
Taylor expanded in ky around 0 12.6%
associate-*l/12.6%
clear-num12.6%
*-commutative12.6%
Applied egg-rr12.6%
Taylor expanded in th around 0 13.4%
add-sqr-sqrt11.8%
sqrt-unprod15.8%
pow215.8%
clear-num15.8%
associate-/l*15.8%
Applied egg-rr15.8%
unpow215.8%
rem-sqrt-square19.9%
Simplified19.9%
if -0.0400000000000000008 < (sin.f64 kx) < 1.05e-117Initial program 83.4%
unpow283.4%
sqr-neg83.4%
sin-neg83.4%
sin-neg83.4%
unpow283.4%
associate-*l/81.6%
associate-/l*83.3%
+-commutative83.3%
unpow283.3%
sin-neg83.3%
sin-neg83.3%
Simplified99.7%
Taylor expanded in kx around 0 41.4%
if 1.05e-117 < (sin.f64 kx) < 1e-27Initial program 99.8%
unpow299.8%
sqr-neg99.8%
sin-neg99.8%
sin-neg99.8%
unpow299.8%
associate-*l/93.3%
associate-/l*99.9%
+-commutative99.9%
unpow299.9%
sin-neg99.9%
sin-neg99.9%
Simplified100.0%
associate-*r/93.4%
Applied egg-rr93.4%
Taylor expanded in th around 0 67.8%
Taylor expanded in kx around 0 67.8%
if 1e-27 < (sin.f64 kx) Initial program 99.3%
unpow299.3%
sqr-neg99.3%
sin-neg99.3%
sin-neg99.3%
unpow299.3%
associate-*l/99.4%
associate-/l*99.2%
+-commutative99.2%
unpow299.2%
sin-neg99.2%
sin-neg99.2%
Simplified99.3%
Taylor expanded in ky around 0 62.4%
Final simplification43.1%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.002)
(* (sin ky) (/ th (hypot (sin ky) (sin kx))))
(if (<= (sin ky) 2e-8)
(* (sin ky) (/ (sin th) (hypot ky (sin kx))))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.002) {
tmp = sin(ky) * (th / hypot(sin(ky), sin(kx)));
} else if (sin(ky) <= 2e-8) {
tmp = sin(ky) * (sin(th) / hypot(ky, sin(kx)));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.002) {
tmp = Math.sin(ky) * (th / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else if (Math.sin(ky) <= 2e-8) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.hypot(ky, Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.002: tmp = math.sin(ky) * (th / math.hypot(math.sin(ky), math.sin(kx))) elif math.sin(ky) <= 2e-8: tmp = math.sin(ky) * (math.sin(th) / math.hypot(ky, math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.002) tmp = Float64(sin(ky) * Float64(th / hypot(sin(ky), sin(kx)))); elseif (sin(ky) <= 2e-8) tmp = Float64(sin(ky) * Float64(sin(th) / hypot(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.002) tmp = sin(ky) * (th / hypot(sin(ky), sin(kx))); elseif (sin(ky) <= 2e-8) tmp = sin(ky) * (sin(th) / hypot(ky, sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.002], 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[ky], $MachinePrecision], 2e-8], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.002:\\
\;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-8}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -2e-3Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.5%
associate-/l*99.5%
+-commutative99.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
Simplified99.6%
Taylor expanded in th around 0 49.6%
if -2e-3 < (sin.f64 ky) < 2e-8Initial program 85.3%
unpow285.3%
sqr-neg85.3%
sin-neg85.3%
sin-neg85.3%
unpow285.3%
associate-*l/83.1%
associate-/l*85.2%
+-commutative85.2%
unpow285.2%
sin-neg85.2%
sin-neg85.2%
Simplified99.6%
Taylor expanded in ky around 0 99.6%
if 2e-8 < (sin.f64 ky) Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.7%
associate-/l*99.5%
+-commutative99.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
Simplified99.5%
Taylor expanded in kx around 0 59.1%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.04) (fabs (* th (/ (sin ky) (sin kx)))) (if (<= (sin kx) 1.05e-117) (sin th) (* (sin ky) (/ (sin th) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.04) {
tmp = fabs((th * (sin(ky) / sin(kx))));
} else if (sin(kx) <= 1.05e-117) {
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.04d0)) then
tmp = abs((th * (sin(ky) / sin(kx))))
else if (sin(kx) <= 1.05d-117) 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.04) {
tmp = Math.abs((th * (Math.sin(ky) / Math.sin(kx))));
} else if (Math.sin(kx) <= 1.05e-117) {
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.04: tmp = math.fabs((th * (math.sin(ky) / math.sin(kx)))) elif math.sin(kx) <= 1.05e-117: 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.04) tmp = abs(Float64(th * Float64(sin(ky) / sin(kx)))); elseif (sin(kx) <= 1.05e-117) 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.04) tmp = abs((th * (sin(ky) / sin(kx)))); elseif (sin(kx) <= 1.05e-117) 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.04], N[Abs[N[(th * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1.05e-117], 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.04:\\
\;\;\;\;\left|th \cdot \frac{\sin ky}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 1.05 \cdot 10^{-117}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0400000000000000008Initial program 99.5%
Taylor expanded in ky around 0 12.6%
associate-*l/12.6%
clear-num12.6%
*-commutative12.6%
Applied egg-rr12.6%
Taylor expanded in th around 0 13.4%
add-sqr-sqrt11.8%
sqrt-unprod15.8%
pow215.8%
clear-num15.8%
associate-/l*15.8%
Applied egg-rr15.8%
unpow215.8%
rem-sqrt-square19.9%
Simplified19.9%
if -0.0400000000000000008 < (sin.f64 kx) < 1.05e-117Initial program 83.4%
unpow283.4%
sqr-neg83.4%
sin-neg83.4%
sin-neg83.4%
unpow283.4%
associate-*l/81.6%
associate-/l*83.3%
+-commutative83.3%
unpow283.3%
sin-neg83.3%
sin-neg83.3%
Simplified99.7%
Taylor expanded in kx around 0 41.4%
if 1.05e-117 < (sin.f64 kx) Initial program 99.4%
unpow299.4%
sqr-neg99.4%
sin-neg99.4%
sin-neg99.4%
unpow299.4%
associate-*l/98.2%
associate-/l*99.3%
+-commutative99.3%
unpow299.3%
sin-neg99.3%
sin-neg99.3%
Simplified99.4%
Taylor expanded in ky around 0 59.1%
(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-undefine99.6%
Applied egg-rr99.6%
Final simplification99.6%
(FPCore (kx ky th) :precision binary64 (* (sin ky) (/ (sin th) (hypot (sin ky) (sin kx)))))
double code(double kx, double ky, double th) {
return sin(ky) * (sin(th) / hypot(sin(ky), sin(kx)));
}
public static double code(double kx, double ky, double th) {
return Math.sin(ky) * (Math.sin(th) / Math.hypot(Math.sin(ky), Math.sin(kx)));
}
def code(kx, ky, th): return math.sin(ky) * (math.sin(th) / math.hypot(math.sin(ky), math.sin(kx)))
function code(kx, ky, th) return Float64(sin(ky) * Float64(sin(th) / hypot(sin(ky), sin(kx)))) end
function tmp = code(kx, ky, th) tmp = sin(ky) * (sin(th) / hypot(sin(ky), sin(kx))); end
code[kx_, ky_, th_] := N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}
\end{array}
Initial program 92.0%
unpow292.0%
sqr-neg92.0%
sin-neg92.0%
sin-neg92.0%
unpow292.0%
associate-*l/90.9%
associate-/l*92.0%
+-commutative92.0%
unpow292.0%
sin-neg92.0%
sin-neg92.0%
Simplified99.6%
(FPCore (kx ky th)
:precision binary64
(if (<= kx 1.05e-117)
(sin th)
(if (<= kx 9.5e-28)
(/ (* th (sin ky)) (hypot (sin ky) kx))
(* (sin th) (/ (sin ky) (fabs (sin kx)))))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 1.05e-117) {
tmp = sin(th);
} else if (kx <= 9.5e-28) {
tmp = (th * sin(ky)) / hypot(sin(ky), kx);
} else {
tmp = sin(th) * (sin(ky) / fabs(sin(kx)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 1.05e-117) {
tmp = Math.sin(th);
} else if (kx <= 9.5e-28) {
tmp = (th * Math.sin(ky)) / Math.hypot(Math.sin(ky), kx);
} else {
tmp = Math.sin(th) * (Math.sin(ky) / Math.abs(Math.sin(kx)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 1.05e-117: tmp = math.sin(th) elif kx <= 9.5e-28: tmp = (th * math.sin(ky)) / math.hypot(math.sin(ky), kx) else: tmp = math.sin(th) * (math.sin(ky) / math.fabs(math.sin(kx))) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 1.05e-117) tmp = sin(th); elseif (kx <= 9.5e-28) tmp = Float64(Float64(th * sin(ky)) / hypot(sin(ky), kx)); else tmp = Float64(sin(th) * Float64(sin(ky) / abs(sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 1.05e-117) tmp = sin(th); elseif (kx <= 9.5e-28) tmp = (th * sin(ky)) / hypot(sin(ky), kx); else tmp = sin(th) * (sin(ky) / abs(sin(kx))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 1.05e-117], N[Sin[th], $MachinePrecision], If[LessEqual[kx, 9.5e-28], N[(N[(th * N[Sin[ky], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 1.05 \cdot 10^{-117}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;kx \leq 9.5 \cdot 10^{-28}:\\
\;\;\;\;\frac{th \cdot \sin ky}{\mathsf{hypot}\left(\sin ky, kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\left|\sin kx\right|}\\
\end{array}
\end{array}
if kx < 1.05e-117Initial program 88.5%
unpow288.5%
sqr-neg88.5%
sin-neg88.5%
sin-neg88.5%
unpow288.5%
associate-*l/87.3%
associate-/l*88.4%
+-commutative88.4%
unpow288.4%
sin-neg88.4%
sin-neg88.4%
Simplified99.7%
Taylor expanded in kx around 0 30.7%
if 1.05e-117 < kx < 9.50000000000000001e-28Initial program 99.8%
unpow299.8%
sqr-neg99.8%
sin-neg99.8%
sin-neg99.8%
unpow299.8%
associate-*l/93.3%
associate-/l*99.9%
+-commutative99.9%
unpow299.9%
sin-neg99.9%
sin-neg99.9%
Simplified100.0%
associate-*r/93.4%
Applied egg-rr93.4%
Taylor expanded in th around 0 67.8%
Taylor expanded in kx around 0 67.8%
if 9.50000000000000001e-28 < kx Initial program 99.3%
Taylor expanded in ky around 0 33.6%
add-sqr-sqrt29.2%
sqrt-prod53.8%
rem-sqrt-square53.8%
Applied egg-rr53.8%
Final simplification39.0%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.04) (fabs (* th (/ (sin ky) (sin kx)))) (if (<= (sin kx) 1.05e-117) (sin th) (* ky (/ (sin th) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.04) {
tmp = fabs((th * (sin(ky) / sin(kx))));
} else if (sin(kx) <= 1.05e-117) {
tmp = sin(th);
} else {
tmp = ky * (sin(th) / sin(kx));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(kx) <= (-0.04d0)) then
tmp = abs((th * (sin(ky) / sin(kx))))
else if (sin(kx) <= 1.05d-117) then
tmp = sin(th)
else
tmp = ky * (sin(th) / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.04) {
tmp = Math.abs((th * (Math.sin(ky) / Math.sin(kx))));
} else if (Math.sin(kx) <= 1.05e-117) {
tmp = Math.sin(th);
} else {
tmp = ky * (Math.sin(th) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.04: tmp = math.fabs((th * (math.sin(ky) / math.sin(kx)))) elif math.sin(kx) <= 1.05e-117: tmp = math.sin(th) else: tmp = ky * (math.sin(th) / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.04) tmp = abs(Float64(th * Float64(sin(ky) / sin(kx)))); elseif (sin(kx) <= 1.05e-117) tmp = sin(th); else tmp = Float64(ky * Float64(sin(th) / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.04) tmp = abs((th * (sin(ky) / sin(kx)))); elseif (sin(kx) <= 1.05e-117) tmp = sin(th); else tmp = ky * (sin(th) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.04], N[Abs[N[(th * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1.05e-117], N[Sin[th], $MachinePrecision], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.04:\\
\;\;\;\;\left|th \cdot \frac{\sin ky}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 1.05 \cdot 10^{-117}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0400000000000000008Initial program 99.5%
Taylor expanded in ky around 0 12.6%
associate-*l/12.6%
clear-num12.6%
*-commutative12.6%
Applied egg-rr12.6%
Taylor expanded in th around 0 13.4%
add-sqr-sqrt11.8%
sqrt-unprod15.8%
pow215.8%
clear-num15.8%
associate-/l*15.8%
Applied egg-rr15.8%
unpow215.8%
rem-sqrt-square19.9%
Simplified19.9%
if -0.0400000000000000008 < (sin.f64 kx) < 1.05e-117Initial program 83.4%
unpow283.4%
sqr-neg83.4%
sin-neg83.4%
sin-neg83.4%
unpow283.4%
associate-*l/81.6%
associate-/l*83.3%
+-commutative83.3%
unpow283.3%
sin-neg83.3%
sin-neg83.3%
Simplified99.7%
Taylor expanded in kx around 0 41.4%
if 1.05e-117 < (sin.f64 kx) Initial program 99.4%
unpow299.4%
sqr-neg99.4%
sin-neg99.4%
sin-neg99.4%
unpow299.4%
associate-*l/98.2%
associate-/l*99.3%
+-commutative99.3%
unpow299.3%
sin-neg99.3%
sin-neg99.3%
Simplified99.4%
Taylor expanded in ky around 0 51.4%
associate-/l*52.6%
Simplified52.6%
(FPCore (kx ky th) :precision binary64 (if (<= kx 0.0007) (* (sin th) (/ (sin ky) (hypot (sin ky) kx))) (* (sin th) (/ (sin ky) (fabs (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.0007) {
tmp = sin(th) * (sin(ky) / hypot(sin(ky), kx));
} else {
tmp = sin(th) * (sin(ky) / fabs(sin(kx)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.0007) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.hypot(Math.sin(ky), kx));
} else {
tmp = Math.sin(th) * (Math.sin(ky) / Math.abs(Math.sin(kx)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 0.0007: tmp = math.sin(th) * (math.sin(ky) / math.hypot(math.sin(ky), kx)) else: tmp = math.sin(th) * (math.sin(ky) / math.fabs(math.sin(kx))) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 0.0007) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), kx))); else tmp = Float64(sin(th) * Float64(sin(ky) / abs(sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 0.0007) tmp = sin(th) * (sin(ky) / hypot(sin(ky), kx)); else tmp = sin(th) * (sin(ky) / abs(sin(kx))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 0.0007], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 0.0007:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\left|\sin kx\right|}\\
\end{array}
\end{array}
if kx < 6.99999999999999993e-4Initial program 89.7%
+-commutative89.7%
unpow289.7%
unpow289.7%
hypot-undefine99.8%
Applied egg-rr99.8%
Taylor expanded in kx around 0 75.7%
if 6.99999999999999993e-4 < kx Initial program 99.3%
Taylor expanded in ky around 0 34.0%
add-sqr-sqrt29.3%
sqrt-prod55.8%
rem-sqrt-square55.8%
Applied egg-rr55.8%
Final simplification70.8%
(FPCore (kx ky th) :precision binary64 (if (<= kx 0.00035) (* (sin ky) (/ (sin th) (hypot (sin ky) kx))) (* (sin th) (/ (sin ky) (fabs (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.00035) {
tmp = sin(ky) * (sin(th) / hypot(sin(ky), kx));
} else {
tmp = sin(th) * (sin(ky) / fabs(sin(kx)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.00035) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.hypot(Math.sin(ky), kx));
} else {
tmp = Math.sin(th) * (Math.sin(ky) / Math.abs(Math.sin(kx)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 0.00035: tmp = math.sin(ky) * (math.sin(th) / math.hypot(math.sin(ky), kx)) else: tmp = math.sin(th) * (math.sin(ky) / math.fabs(math.sin(kx))) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 0.00035) tmp = Float64(sin(ky) * Float64(sin(th) / hypot(sin(ky), kx))); else tmp = Float64(sin(th) * Float64(sin(ky) / abs(sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 0.00035) tmp = sin(ky) * (sin(th) / hypot(sin(ky), kx)); else tmp = sin(th) * (sin(ky) / abs(sin(kx))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 0.00035], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 0.00035:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(\sin ky, kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\left|\sin kx\right|}\\
\end{array}
\end{array}
if kx < 3.49999999999999996e-4Initial program 89.7%
unpow289.7%
sqr-neg89.7%
sin-neg89.7%
sin-neg89.7%
unpow289.7%
associate-*l/88.1%
associate-/l*89.6%
+-commutative89.6%
unpow289.6%
sin-neg89.6%
sin-neg89.6%
Simplified99.7%
Taylor expanded in kx around 0 75.6%
if 3.49999999999999996e-4 < kx Initial program 99.3%
Taylor expanded in ky around 0 34.0%
add-sqr-sqrt29.3%
sqrt-prod55.8%
rem-sqrt-square55.8%
Applied egg-rr55.8%
Final simplification70.7%
(FPCore (kx ky th) :precision binary64 (if (<= th 0.0235) (* (sin ky) (/ th (hypot (sin ky) (sin kx)))) (* (sin th) (/ (sin ky) (fabs (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.0235) {
tmp = sin(ky) * (th / hypot(sin(ky), sin(kx)));
} else {
tmp = sin(th) * (sin(ky) / fabs(sin(kx)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.0235) {
tmp = Math.sin(ky) * (th / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else {
tmp = Math.sin(th) * (Math.sin(ky) / Math.abs(Math.sin(kx)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 0.0235: tmp = math.sin(ky) * (th / math.hypot(math.sin(ky), math.sin(kx))) else: tmp = math.sin(th) * (math.sin(ky) / math.fabs(math.sin(kx))) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 0.0235) tmp = Float64(sin(ky) * Float64(th / hypot(sin(ky), sin(kx)))); else tmp = Float64(sin(th) * Float64(sin(ky) / abs(sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 0.0235) tmp = sin(ky) * (th / hypot(sin(ky), sin(kx))); else tmp = sin(th) * (sin(ky) / abs(sin(kx))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 0.0235], N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 0.0235:\\
\;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\left|\sin kx\right|}\\
\end{array}
\end{array}
if th < 0.0235Initial program 92.1%
unpow292.1%
sqr-neg92.1%
sin-neg92.1%
sin-neg92.1%
unpow292.1%
associate-*l/90.5%
associate-/l*91.9%
+-commutative91.9%
unpow291.9%
sin-neg91.9%
sin-neg91.9%
Simplified99.6%
Taylor expanded in th around 0 64.1%
if 0.0235 < th Initial program 92.0%
Taylor expanded in ky around 0 22.9%
add-sqr-sqrt21.8%
sqrt-prod42.8%
rem-sqrt-square46.3%
Applied egg-rr46.3%
Final simplification59.7%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 5e-308) (fabs (sin th)) (if (<= (sin ky) 2e-197) (* ky (/ th (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 5e-308) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 2e-197) {
tmp = ky * (th / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= 5d-308) then
tmp = abs(sin(th))
else if (sin(ky) <= 2d-197) then
tmp = ky * (th / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= 5e-308) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 2e-197) {
tmp = ky * (th / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 5e-308: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 2e-197: tmp = ky * (th / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 5e-308) tmp = abs(sin(th)); elseif (sin(ky) <= 2e-197) tmp = Float64(ky * Float64(th / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= 5e-308) tmp = abs(sin(th)); elseif (sin(ky) <= 2e-197) tmp = ky * (th / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-308], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-197], N[(ky * N[(th / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 5 \cdot 10^{-308}:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-197}:\\
\;\;\;\;ky \cdot \frac{th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 4.99999999999999955e-308Initial program 91.0%
unpow291.0%
sqr-neg91.0%
sin-neg91.0%
sin-neg91.0%
unpow291.0%
associate-*l/90.2%
associate-/l*90.9%
+-commutative90.9%
unpow290.9%
sin-neg90.9%
sin-neg90.9%
Simplified99.6%
Taylor expanded in kx around 0 2.8%
add-sqr-sqrt1.5%
sqrt-unprod25.4%
pow225.4%
Applied egg-rr25.4%
unpow225.4%
rem-sqrt-square26.7%
Simplified26.7%
if 4.99999999999999955e-308 < (sin.f64 ky) < 2e-197Initial program 71.4%
Taylor expanded in ky around 0 56.3%
associate-*l/52.8%
clear-num52.6%
*-commutative52.6%
Applied egg-rr52.6%
Taylor expanded in th around 0 25.0%
Taylor expanded in ky around 0 25.0%
associate-/l*28.6%
Simplified28.6%
if 2e-197 < (sin.f64 ky) Initial program 97.9%
unpow297.9%
sqr-neg97.9%
sin-neg97.9%
sin-neg97.9%
unpow297.9%
associate-*l/97.8%
associate-/l*97.7%
+-commutative97.7%
unpow297.7%
sin-neg97.7%
sin-neg97.7%
Simplified99.5%
Taylor expanded in kx around 0 52.3%
(FPCore (kx ky th) :precision binary64 (if (<= kx 1.05e-117) (sin th) (* ky (/ (sin th) (sin kx)))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 1.05e-117) {
tmp = sin(th);
} else {
tmp = ky * (sin(th) / sin(kx));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (kx <= 1.05d-117) then
tmp = sin(th)
else
tmp = ky * (sin(th) / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 1.05e-117) {
tmp = Math.sin(th);
} else {
tmp = ky * (Math.sin(th) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 1.05e-117: tmp = math.sin(th) else: tmp = ky * (math.sin(th) / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 1.05e-117) tmp = sin(th); else tmp = Float64(ky * Float64(sin(th) / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 1.05e-117) tmp = sin(th); else tmp = ky * (sin(th) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 1.05e-117], N[Sin[th], $MachinePrecision], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 1.05 \cdot 10^{-117}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\end{array}
\end{array}
if kx < 1.05e-117Initial program 88.5%
unpow288.5%
sqr-neg88.5%
sin-neg88.5%
sin-neg88.5%
unpow288.5%
associate-*l/87.3%
associate-/l*88.4%
+-commutative88.4%
unpow288.4%
sin-neg88.4%
sin-neg88.4%
Simplified99.7%
Taylor expanded in kx around 0 30.7%
if 1.05e-117 < kx Initial program 99.4%
unpow299.4%
sqr-neg99.4%
sin-neg99.4%
sin-neg99.4%
unpow299.4%
associate-*l/98.3%
associate-/l*99.4%
+-commutative99.4%
unpow299.4%
sin-neg99.4%
sin-neg99.4%
Simplified99.4%
Taylor expanded in ky around 0 30.1%
associate-/l*31.3%
Simplified31.3%
(FPCore (kx ky th) :precision binary64 (if (<= kx 0.78) (sin th) (/ 1.0 (/ (sin kx) (* th ky)))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.78) {
tmp = sin(th);
} else {
tmp = 1.0 / (sin(kx) / (th * ky));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (kx <= 0.78d0) then
tmp = sin(th)
else
tmp = 1.0d0 / (sin(kx) / (th * ky))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.78) {
tmp = Math.sin(th);
} else {
tmp = 1.0 / (Math.sin(kx) / (th * ky));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 0.78: tmp = math.sin(th) else: tmp = 1.0 / (math.sin(kx) / (th * ky)) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 0.78) tmp = sin(th); else tmp = Float64(1.0 / Float64(sin(kx) / Float64(th * ky))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 0.78) tmp = sin(th); else tmp = 1.0 / (sin(kx) / (th * ky)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 0.78], N[Sin[th], $MachinePrecision], N[(1.0 / N[(N[Sin[kx], $MachinePrecision] / N[(th * ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 0.78:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{\sin kx}{th \cdot ky}}\\
\end{array}
\end{array}
if kx < 0.78000000000000003Initial program 89.7%
unpow289.7%
sqr-neg89.7%
sin-neg89.7%
sin-neg89.7%
unpow289.7%
associate-*l/88.2%
associate-/l*89.7%
+-commutative89.7%
unpow289.7%
sin-neg89.7%
sin-neg89.7%
Simplified99.7%
Taylor expanded in kx around 0 30.4%
if 0.78000000000000003 < kx Initial program 99.3%
Taylor expanded in ky around 0 32.9%
associate-*l/32.9%
clear-num32.9%
*-commutative32.9%
Applied egg-rr32.9%
Taylor expanded in th around 0 12.1%
Taylor expanded in ky around 0 9.5%
(FPCore (kx ky th) :precision binary64 (if (<= kx 0.78) (sin th) (* ky (/ th (sin kx)))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.78) {
tmp = sin(th);
} else {
tmp = ky * (th / sin(kx));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (kx <= 0.78d0) then
tmp = sin(th)
else
tmp = ky * (th / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.78) {
tmp = Math.sin(th);
} else {
tmp = ky * (th / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 0.78: tmp = math.sin(th) else: tmp = ky * (th / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 0.78) tmp = sin(th); else tmp = Float64(ky * Float64(th / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 0.78) tmp = sin(th); else tmp = ky * (th / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 0.78], N[Sin[th], $MachinePrecision], N[(ky * N[(th / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 0.78:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;ky \cdot \frac{th}{\sin kx}\\
\end{array}
\end{array}
if kx < 0.78000000000000003Initial program 89.7%
unpow289.7%
sqr-neg89.7%
sin-neg89.7%
sin-neg89.7%
unpow289.7%
associate-*l/88.2%
associate-/l*89.7%
+-commutative89.7%
unpow289.7%
sin-neg89.7%
sin-neg89.7%
Simplified99.7%
Taylor expanded in kx around 0 30.4%
if 0.78000000000000003 < kx Initial program 99.3%
Taylor expanded in ky around 0 32.9%
associate-*l/32.9%
clear-num32.9%
*-commutative32.9%
Applied egg-rr32.9%
Taylor expanded in th around 0 12.1%
Taylor expanded in ky around 0 9.5%
associate-/l*9.5%
Simplified9.5%
(FPCore (kx ky th) :precision binary64 (if (<= kx 1.7e+35) (sin th) (* -0.16666666666666666 (pow th 3.0))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 1.7e+35) {
tmp = sin(th);
} else {
tmp = -0.16666666666666666 * pow(th, 3.0);
}
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 <= 1.7d+35) then
tmp = sin(th)
else
tmp = (-0.16666666666666666d0) * (th ** 3.0d0)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 1.7e+35) {
tmp = Math.sin(th);
} else {
tmp = -0.16666666666666666 * Math.pow(th, 3.0);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 1.7e+35: tmp = math.sin(th) else: tmp = -0.16666666666666666 * math.pow(th, 3.0) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 1.7e+35) tmp = sin(th); else tmp = Float64(-0.16666666666666666 * (th ^ 3.0)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 1.7e+35) tmp = sin(th); else tmp = -0.16666666666666666 * (th ^ 3.0); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 1.7e+35], N[Sin[th], $MachinePrecision], N[(-0.16666666666666666 * N[Power[th, 3.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 1.7 \cdot 10^{+35}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;-0.16666666666666666 \cdot {th}^{3}\\
\end{array}
\end{array}
if kx < 1.7000000000000001e35Initial program 90.0%
unpow290.0%
sqr-neg90.0%
sin-neg90.0%
sin-neg90.0%
unpow290.0%
associate-*l/88.5%
associate-/l*89.9%
+-commutative89.9%
unpow289.9%
sin-neg89.9%
sin-neg89.9%
Simplified99.7%
Taylor expanded in kx around 0 29.9%
if 1.7000000000000001e35 < kx Initial program 99.3%
unpow299.3%
sqr-neg99.3%
sin-neg99.3%
sin-neg99.3%
unpow299.3%
associate-*l/99.3%
associate-/l*99.2%
+-commutative99.2%
unpow299.2%
sin-neg99.2%
sin-neg99.2%
Simplified99.3%
Taylor expanded in kx around 0 8.4%
Taylor expanded in th around 0 5.9%
Taylor expanded in th around inf 6.7%
(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%
unpow292.0%
sqr-neg92.0%
sin-neg92.0%
sin-neg92.0%
unpow292.0%
associate-*l/90.9%
associate-/l*92.0%
+-commutative92.0%
unpow292.0%
sin-neg92.0%
sin-neg92.0%
Simplified99.6%
Taylor expanded in kx around 0 25.1%
(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%
unpow292.0%
sqr-neg92.0%
sin-neg92.0%
sin-neg92.0%
unpow292.0%
associate-*l/90.9%
associate-/l*92.0%
+-commutative92.0%
unpow292.0%
sin-neg92.0%
sin-neg92.0%
Simplified99.6%
Taylor expanded in kx around 0 25.1%
Taylor expanded in th around 0 15.0%
herbie shell --seed 2024167
(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)))