
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 21 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\end{array}
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (hypot (sin ky) (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / hypot(sin(ky), sin(kx))) * sin(th);
}
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot \sin th
\end{array}
Initial program 92.9%
+-commutative92.9%
unpow292.9%
unpow292.9%
hypot-undefine99.7%
Applied egg-rr99.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.02)
(fabs (* (sin th) (/ (sin ky) (sin kx))))
(if (<= (sin kx) 2e-204)
(sin th)
(if (<= (sin kx) 2e-14)
(* th (/ (sin ky) (hypot (sin ky) kx)))
(/ (sin ky) (/ (sin kx) (sin th)))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.02) {
tmp = fabs((sin(th) * (sin(ky) / sin(kx))));
} else if (sin(kx) <= 2e-204) {
tmp = sin(th);
} else if (sin(kx) <= 2e-14) {
tmp = th * (sin(ky) / hypot(sin(ky), kx));
} else {
tmp = sin(ky) / (sin(kx) / sin(th));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.02) {
tmp = Math.abs((Math.sin(th) * (Math.sin(ky) / Math.sin(kx))));
} else if (Math.sin(kx) <= 2e-204) {
tmp = Math.sin(th);
} else if (Math.sin(kx) <= 2e-14) {
tmp = th * (Math.sin(ky) / Math.hypot(Math.sin(ky), kx));
} else {
tmp = Math.sin(ky) / (Math.sin(kx) / Math.sin(th));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.02: tmp = math.fabs((math.sin(th) * (math.sin(ky) / math.sin(kx)))) elif math.sin(kx) <= 2e-204: tmp = math.sin(th) elif math.sin(kx) <= 2e-14: tmp = th * (math.sin(ky) / math.hypot(math.sin(ky), kx)) else: tmp = math.sin(ky) / (math.sin(kx) / math.sin(th)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.02) tmp = abs(Float64(sin(th) * Float64(sin(ky) / sin(kx)))); elseif (sin(kx) <= 2e-204) tmp = sin(th); elseif (sin(kx) <= 2e-14) tmp = Float64(th * Float64(sin(ky) / hypot(sin(ky), kx))); else tmp = Float64(sin(ky) / Float64(sin(kx) / sin(th))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.02) tmp = abs((sin(th) * (sin(ky) / sin(kx)))); elseif (sin(kx) <= 2e-204) tmp = sin(th); elseif (sin(kx) <= 2e-14) tmp = th * (sin(ky) / hypot(sin(ky), kx)); else tmp = sin(ky) / (sin(kx) / sin(th)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.02], N[Abs[N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 2e-204], N[Sin[th], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 2e-14], N[(th * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.02:\\
\;\;\;\;\left|\sin th \cdot \frac{\sin ky}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 2 \cdot 10^{-204}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;\sin kx \leq 2 \cdot 10^{-14}:\\
\;\;\;\;th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky}{\frac{\sin kx}{\sin th}}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0200000000000000004Initial program 99.3%
unpow299.3%
sqr-neg99.3%
sin-neg99.3%
sin-neg99.3%
unpow299.3%
associate-*l/99.3%
associate-/l*99.2%
unpow299.2%
Simplified99.3%
Taylor expanded in ky around 0 8.5%
add-sqr-sqrt6.6%
sqrt-unprod19.2%
pow219.2%
Applied egg-rr19.2%
unpow219.2%
rem-sqrt-square34.9%
associate-*r/34.9%
*-commutative34.9%
associate-/l*34.9%
Simplified34.9%
if -0.0200000000000000004 < (sin.f64 kx) < 2e-204Initial program 84.9%
unpow284.9%
sqr-neg84.9%
sin-neg84.9%
sin-neg84.9%
unpow284.9%
associate-*l/81.4%
associate-/l*84.7%
unpow284.7%
Simplified99.7%
Taylor expanded in kx around 0 41.9%
if 2e-204 < (sin.f64 kx) < 2e-14Initial program 88.6%
+-commutative88.6%
unpow288.6%
unpow288.6%
hypot-undefine99.8%
Applied egg-rr99.8%
Taylor expanded in th around 0 67.0%
Taylor expanded in kx around 0 67.0%
if 2e-14 < (sin.f64 kx) Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.4%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
clear-num99.4%
un-div-inv99.4%
Applied egg-rr99.4%
Taylor expanded in ky around 0 56.4%
Final simplification47.6%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.16)
(* th (/ (sin ky) (hypot (sin ky) kx)))
(if (<= (sin ky) -0.05)
(fabs (sin th))
(if (<= (sin ky) 5e-119) (* (sin th) (/ (sin ky) (sin kx))) (sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.16) {
tmp = th * (sin(ky) / hypot(sin(ky), kx));
} else if (sin(ky) <= -0.05) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 5e-119) {
tmp = sin(th) * (sin(ky) / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.16) {
tmp = th * (Math.sin(ky) / Math.hypot(Math.sin(ky), kx));
} else if (Math.sin(ky) <= -0.05) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 5e-119) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.16: tmp = th * (math.sin(ky) / math.hypot(math.sin(ky), kx)) elif math.sin(ky) <= -0.05: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 5e-119: tmp = math.sin(th) * (math.sin(ky) / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.16) tmp = Float64(th * Float64(sin(ky) / hypot(sin(ky), kx))); elseif (sin(ky) <= -0.05) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-119) tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.16) tmp = th * (sin(ky) / hypot(sin(ky), kx)); elseif (sin(ky) <= -0.05) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-119) tmp = sin(th) * (sin(ky) / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.16], N[(th * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], -0.05], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-119], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.16:\\
\;\;\;\;th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, kx\right)}\\
\mathbf{elif}\;\sin ky \leq -0.05:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-119}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.160000000000000003Initial program 99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-undefine99.5%
Applied egg-rr99.5%
Taylor expanded in th around 0 47.1%
Taylor expanded in kx around 0 26.9%
if -0.160000000000000003 < (sin.f64 ky) < -0.050000000000000003Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.5%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in kx around 0 2.2%
add-sqr-sqrt0.8%
sqrt-unprod36.4%
pow236.4%
Applied egg-rr36.4%
unpow236.4%
rem-sqrt-square37.5%
associate-*r/37.4%
*-rgt-identity37.4%
times-frac37.5%
/-rgt-identity37.5%
*-inverses37.5%
*-lft-identity37.5%
Simplified37.5%
if -0.050000000000000003 < (sin.f64 ky) < 4.99999999999999993e-119Initial program 82.6%
+-commutative82.6%
unpow282.6%
unpow282.6%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 46.8%
if 4.99999999999999993e-119 < (sin.f64 ky) Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/98.6%
associate-/l*99.6%
unpow299.6%
Simplified99.7%
Taylor expanded in kx around 0 56.7%
Final simplification45.4%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.05) (fabs (sin th)) (if (<= (sin ky) 5e-119) (* (sin th) (/ (sin ky) (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.05) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 5e-119) {
tmp = sin(th) * (sin(ky) / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.05d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 5d-119) then
tmp = sin(th) * (sin(ky) / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.05) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 5e-119) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.05: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 5e-119: tmp = math.sin(th) * (math.sin(ky) / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.05) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-119) tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.05) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-119) tmp = sin(th) * (sin(ky) / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.05], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-119], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.05:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-119}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.050000000000000003Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.4%
associate-/l*99.4%
unpow299.4%
Simplified99.4%
Taylor expanded in kx around 0 2.6%
add-sqr-sqrt0.9%
sqrt-unprod28.1%
pow228.1%
Applied egg-rr28.1%
unpow228.1%
rem-sqrt-square34.9%
associate-*r/35.0%
*-rgt-identity35.0%
times-frac35.0%
/-rgt-identity35.0%
*-inverses35.0%
*-lft-identity35.0%
Simplified35.0%
if -0.050000000000000003 < (sin.f64 ky) < 4.99999999999999993e-119Initial program 82.6%
+-commutative82.6%
unpow282.6%
unpow282.6%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 46.8%
if 4.99999999999999993e-119 < (sin.f64 ky) Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/98.6%
associate-/l*99.6%
unpow299.6%
Simplified99.7%
Taylor expanded in kx around 0 56.7%
Final simplification47.1%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.05) (fabs (sin th)) (if (<= (sin ky) 5e-119) (* (sin ky) (/ (sin th) (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.05) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 5e-119) {
tmp = sin(ky) * (sin(th) / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.05d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 5d-119) then
tmp = sin(ky) * (sin(th) / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.05) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 5e-119) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.05: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 5e-119: tmp = math.sin(ky) * (math.sin(th) / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.05) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-119) tmp = Float64(sin(ky) * Float64(sin(th) / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.05) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-119) tmp = sin(ky) * (sin(th) / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.05], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-119], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.05:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-119}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.050000000000000003Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.4%
associate-/l*99.4%
unpow299.4%
Simplified99.4%
Taylor expanded in kx around 0 2.6%
add-sqr-sqrt0.9%
sqrt-unprod28.1%
pow228.1%
Applied egg-rr28.1%
unpow228.1%
rem-sqrt-square34.9%
associate-*r/35.0%
*-rgt-identity35.0%
times-frac35.0%
/-rgt-identity35.0%
*-inverses35.0%
*-lft-identity35.0%
Simplified35.0%
if -0.050000000000000003 < (sin.f64 ky) < 4.99999999999999993e-119Initial program 82.6%
unpow282.6%
sqr-neg82.6%
sin-neg82.6%
sin-neg82.6%
unpow282.6%
associate-*l/79.6%
associate-/l*82.5%
unpow282.5%
Simplified99.6%
Taylor expanded in ky around 0 46.8%
if 4.99999999999999993e-119 < (sin.f64 ky) Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/98.6%
associate-/l*99.6%
unpow299.6%
Simplified99.7%
Taylor expanded in kx around 0 56.7%
(FPCore (kx ky th) :precision binary64 (* (sin ky) (/ (sin th) (hypot (sin ky) (sin kx)))))
double code(double kx, double ky, double th) {
return sin(ky) * (sin(th) / hypot(sin(ky), sin(kx)));
}
public static double code(double kx, double ky, double th) {
return Math.sin(ky) * (Math.sin(th) / Math.hypot(Math.sin(ky), Math.sin(kx)));
}
def code(kx, ky, th): return math.sin(ky) * (math.sin(th) / math.hypot(math.sin(ky), math.sin(kx)))
function code(kx, ky, th) return Float64(sin(ky) * Float64(sin(th) / hypot(sin(ky), sin(kx)))) end
function tmp = code(kx, ky, th) tmp = sin(ky) * (sin(th) / hypot(sin(ky), sin(kx))); end
code[kx_, ky_, th_] := N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}
\end{array}
Initial program 92.9%
unpow292.9%
sqr-neg92.9%
sin-neg92.9%
sin-neg92.9%
unpow292.9%
associate-*l/91.3%
associate-/l*92.8%
unpow292.8%
Simplified99.6%
(FPCore (kx ky th)
:precision binary64
(if (<= th 0.0125)
(* (sin ky) (/ th (hypot (sin ky) (sin kx))))
(if (or (<= th 2.9e+40) (not (<= th 1.65e+137)))
(* (sin ky) (/ (sin th) (fabs (sin ky))))
(* (sin ky) (/ (sin th) (fabs (sin kx)))))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.0125) {
tmp = sin(ky) * (th / hypot(sin(ky), sin(kx)));
} else if ((th <= 2.9e+40) || !(th <= 1.65e+137)) {
tmp = sin(ky) * (sin(th) / fabs(sin(ky)));
} else {
tmp = sin(ky) * (sin(th) / fabs(sin(kx)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.0125) {
tmp = Math.sin(ky) * (th / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else if ((th <= 2.9e+40) || !(th <= 1.65e+137)) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.abs(Math.sin(ky)));
} else {
tmp = Math.sin(ky) * (Math.sin(th) / Math.abs(Math.sin(kx)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 0.0125: tmp = math.sin(ky) * (th / math.hypot(math.sin(ky), math.sin(kx))) elif (th <= 2.9e+40) or not (th <= 1.65e+137): tmp = math.sin(ky) * (math.sin(th) / math.fabs(math.sin(ky))) else: tmp = math.sin(ky) * (math.sin(th) / math.fabs(math.sin(kx))) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 0.0125) tmp = Float64(sin(ky) * Float64(th / hypot(sin(ky), sin(kx)))); elseif ((th <= 2.9e+40) || !(th <= 1.65e+137)) tmp = Float64(sin(ky) * Float64(sin(th) / abs(sin(ky)))); else tmp = Float64(sin(ky) * Float64(sin(th) / abs(sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 0.0125) tmp = sin(ky) * (th / hypot(sin(ky), sin(kx))); elseif ((th <= 2.9e+40) || ~((th <= 1.65e+137))) tmp = sin(ky) * (sin(th) / abs(sin(ky))); else tmp = sin(ky) * (sin(th) / abs(sin(kx))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 0.0125], N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[th, 2.9e+40], N[Not[LessEqual[th, 1.65e+137]], $MachinePrecision]], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Abs[N[Sin[ky], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 0.0125:\\
\;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{elif}\;th \leq 2.9 \cdot 10^{+40} \lor \neg \left(th \leq 1.65 \cdot 10^{+137}\right):\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\left|\sin ky\right|}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\left|\sin kx\right|}\\
\end{array}
\end{array}
if th < 0.012500000000000001Initial program 91.5%
unpow291.5%
sqr-neg91.5%
sin-neg91.5%
sin-neg91.5%
unpow291.5%
associate-*l/89.4%
associate-/l*91.4%
unpow291.4%
Simplified99.6%
Taylor expanded in th around 0 68.7%
if 0.012500000000000001 < th < 2.90000000000000017e40 or 1.65000000000000001e137 < th Initial program 97.4%
unpow297.4%
sqr-neg97.4%
sin-neg97.4%
sin-neg97.4%
unpow297.4%
associate-*l/97.3%
associate-/l*97.3%
unpow297.3%
Simplified99.5%
Taylor expanded in kx around 0 14.5%
add-sqr-sqrt13.4%
sqrt-prod49.2%
rem-sqrt-square49.6%
Applied egg-rr49.6%
if 2.90000000000000017e40 < th < 1.65000000000000001e137Initial program 95.1%
unpow295.1%
sqr-neg95.1%
sin-neg95.1%
sin-neg95.1%
unpow295.1%
associate-*l/95.3%
associate-/l*95.0%
unpow295.0%
Simplified99.4%
Taylor expanded in ky around 0 20.8%
add-sqr-sqrt18.9%
sqrt-unprod54.2%
pow254.2%
Applied egg-rr54.2%
unpow254.2%
rem-sqrt-square58.8%
Simplified58.8%
Final simplification64.4%
(FPCore (kx ky th)
:precision binary64
(if (<= kx 0.12)
(/ (sin ky) (/ (hypot (sin ky) kx) (sin th)))
(if (<= kx 1.25e+193)
(* (sin ky) (/ (sin th) (fabs (sin kx))))
(/ th (/ (hypot (sin ky) (sin kx)) (sin ky))))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.12) {
tmp = sin(ky) / (hypot(sin(ky), kx) / sin(th));
} else if (kx <= 1.25e+193) {
tmp = sin(ky) * (sin(th) / fabs(sin(kx)));
} else {
tmp = th / (hypot(sin(ky), sin(kx)) / sin(ky));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.12) {
tmp = Math.sin(ky) / (Math.hypot(Math.sin(ky), kx) / Math.sin(th));
} else if (kx <= 1.25e+193) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.abs(Math.sin(kx)));
} else {
tmp = th / (Math.hypot(Math.sin(ky), Math.sin(kx)) / Math.sin(ky));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 0.12: tmp = math.sin(ky) / (math.hypot(math.sin(ky), kx) / math.sin(th)) elif kx <= 1.25e+193: tmp = math.sin(ky) * (math.sin(th) / math.fabs(math.sin(kx))) else: tmp = th / (math.hypot(math.sin(ky), math.sin(kx)) / math.sin(ky)) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 0.12) tmp = Float64(sin(ky) / Float64(hypot(sin(ky), kx) / sin(th))); elseif (kx <= 1.25e+193) tmp = Float64(sin(ky) * Float64(sin(th) / abs(sin(kx)))); else tmp = Float64(th / Float64(hypot(sin(ky), sin(kx)) / sin(ky))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 0.12) tmp = sin(ky) / (hypot(sin(ky), kx) / sin(th)); elseif (kx <= 1.25e+193) tmp = sin(ky) * (sin(th) / abs(sin(kx))); else tmp = th / (hypot(sin(ky), sin(kx)) / sin(ky)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 0.12], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[kx, 1.25e+193], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(th / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 0.12:\\
\;\;\;\;\frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin ky, kx\right)}{\sin th}}\\
\mathbf{elif}\;kx \leq 1.25 \cdot 10^{+193}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\left|\sin kx\right|}\\
\mathbf{else}:\\
\;\;\;\;\frac{th}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{\sin ky}}\\
\end{array}
\end{array}
if kx < 0.12Initial program 90.6%
unpow290.6%
sqr-neg90.6%
sin-neg90.6%
sin-neg90.6%
unpow290.6%
associate-*l/88.5%
associate-/l*90.4%
unpow290.4%
Simplified99.6%
clear-num99.4%
un-div-inv99.6%
Applied egg-rr99.6%
Taylor expanded in kx around 0 71.8%
if 0.12 < kx < 1.24999999999999993e193Initial program 99.4%
unpow299.4%
sqr-neg99.4%
sin-neg99.4%
sin-neg99.4%
unpow299.4%
associate-*l/99.3%
associate-/l*99.3%
unpow299.3%
Simplified99.3%
Taylor expanded in ky around 0 29.1%
add-sqr-sqrt26.4%
sqrt-unprod59.0%
pow259.0%
Applied egg-rr59.0%
unpow259.0%
rem-sqrt-square59.0%
Simplified59.0%
if 1.24999999999999993e193 < kx Initial program 99.3%
unpow299.3%
sqr-neg99.3%
sin-neg99.3%
sin-neg99.3%
unpow299.3%
associate-*l/99.2%
associate-/l*99.4%
unpow299.4%
Simplified99.4%
associate-*r/99.3%
hypot-undefine99.2%
unpow299.2%
unpow299.2%
+-commutative99.2%
associate-*l/99.3%
*-commutative99.3%
clear-num99.3%
un-div-inv99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in th around 0 62.7%
(FPCore (kx ky th)
:precision binary64
(if (<= kx 5.5e-203)
(sin th)
(if (<= kx 1.6e-14)
(* th (/ (sin ky) (hypot (sin ky) kx)))
(* (sin ky) (/ (sin th) (fabs (sin kx)))))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 5.5e-203) {
tmp = sin(th);
} else if (kx <= 1.6e-14) {
tmp = th * (sin(ky) / hypot(sin(ky), kx));
} else {
tmp = sin(ky) * (sin(th) / fabs(sin(kx)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 5.5e-203) {
tmp = Math.sin(th);
} else if (kx <= 1.6e-14) {
tmp = th * (Math.sin(ky) / Math.hypot(Math.sin(ky), kx));
} else {
tmp = Math.sin(ky) * (Math.sin(th) / Math.abs(Math.sin(kx)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 5.5e-203: tmp = math.sin(th) elif kx <= 1.6e-14: tmp = th * (math.sin(ky) / math.hypot(math.sin(ky), kx)) else: tmp = math.sin(ky) * (math.sin(th) / math.fabs(math.sin(kx))) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 5.5e-203) tmp = sin(th); elseif (kx <= 1.6e-14) tmp = Float64(th * Float64(sin(ky) / hypot(sin(ky), kx))); else tmp = Float64(sin(ky) * Float64(sin(th) / abs(sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 5.5e-203) tmp = sin(th); elseif (kx <= 1.6e-14) tmp = th * (sin(ky) / hypot(sin(ky), kx)); else tmp = sin(ky) * (sin(th) / abs(sin(kx))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 5.5e-203], N[Sin[th], $MachinePrecision], If[LessEqual[kx, 1.6e-14], N[(th * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 5.5 \cdot 10^{-203}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;kx \leq 1.6 \cdot 10^{-14}:\\
\;\;\;\;th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\left|\sin kx\right|}\\
\end{array}
\end{array}
if kx < 5.5000000000000002e-203Initial program 91.1%
unpow291.1%
sqr-neg91.1%
sin-neg91.1%
sin-neg91.1%
unpow291.1%
associate-*l/89.0%
associate-/l*90.9%
unpow290.9%
Simplified99.6%
Taylor expanded in kx around 0 27.6%
if 5.5000000000000002e-203 < kx < 1.6000000000000001e-14Initial program 88.6%
+-commutative88.6%
unpow288.6%
unpow288.6%
hypot-undefine99.8%
Applied egg-rr99.8%
Taylor expanded in th around 0 67.0%
Taylor expanded in kx around 0 67.0%
if 1.6000000000000001e-14 < kx Initial program 99.4%
unpow299.4%
sqr-neg99.4%
sin-neg99.4%
sin-neg99.4%
unpow299.4%
associate-*l/99.3%
associate-/l*99.3%
unpow299.3%
Simplified99.4%
Taylor expanded in ky around 0 29.1%
add-sqr-sqrt25.2%
sqrt-unprod55.8%
pow255.8%
Applied egg-rr55.8%
unpow255.8%
rem-sqrt-square55.8%
Simplified55.8%
Final simplification41.5%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.0005) (fabs (sin th)) (if (<= (sin ky) 5e-119) (* (sin th) (/ ky (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.0005) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 5e-119) {
tmp = sin(th) * (ky / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.0005d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 5d-119) then
tmp = sin(th) * (ky / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.0005) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 5e-119) {
tmp = Math.sin(th) * (ky / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.0005: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 5e-119: tmp = math.sin(th) * (ky / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.0005) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-119) tmp = Float64(sin(th) * Float64(ky / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.0005) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-119) tmp = sin(th) * (ky / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.0005], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-119], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.0005:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-119}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -5.0000000000000001e-4Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.5%
associate-/l*99.4%
unpow299.4%
Simplified99.5%
Taylor expanded in kx around 0 2.6%
add-sqr-sqrt0.9%
sqrt-unprod28.8%
pow228.8%
Applied egg-rr28.8%
unpow228.8%
rem-sqrt-square35.4%
associate-*r/35.5%
*-rgt-identity35.5%
times-frac35.5%
/-rgt-identity35.5%
*-inverses35.5%
*-lft-identity35.5%
Simplified35.5%
if -5.0000000000000001e-4 < (sin.f64 ky) < 4.99999999999999993e-119Initial program 82.3%
Taylor expanded in ky around 0 47.7%
if 4.99999999999999993e-119 < (sin.f64 ky) Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/98.6%
associate-/l*99.6%
unpow299.6%
Simplified99.7%
Taylor expanded in kx around 0 56.7%
Final simplification47.5%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.0005) (fabs (sin th)) (if (<= (sin ky) 5e-119) (* ky (/ (sin th) (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.0005) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 5e-119) {
tmp = ky * (sin(th) / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.0005d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 5d-119) then
tmp = ky * (sin(th) / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.0005) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 5e-119) {
tmp = ky * (Math.sin(th) / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.0005: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 5e-119: tmp = ky * (math.sin(th) / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.0005) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-119) tmp = Float64(ky * Float64(sin(th) / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.0005) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-119) tmp = ky * (sin(th) / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.0005], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-119], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.0005:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-119}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -5.0000000000000001e-4Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.5%
associate-/l*99.4%
unpow299.4%
Simplified99.5%
Taylor expanded in kx around 0 2.6%
add-sqr-sqrt0.9%
sqrt-unprod28.8%
pow228.8%
Applied egg-rr28.8%
unpow228.8%
rem-sqrt-square35.4%
associate-*r/35.5%
*-rgt-identity35.5%
times-frac35.5%
/-rgt-identity35.5%
*-inverses35.5%
*-lft-identity35.5%
Simplified35.5%
if -5.0000000000000001e-4 < (sin.f64 ky) < 4.99999999999999993e-119Initial program 82.3%
unpow282.3%
sqr-neg82.3%
sin-neg82.3%
sin-neg82.3%
unpow282.3%
associate-*l/79.2%
associate-/l*82.1%
unpow282.1%
Simplified99.5%
Taylor expanded in ky around 0 44.8%
associate-/l*47.8%
Simplified47.8%
if 4.99999999999999993e-119 < (sin.f64 ky) Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/98.6%
associate-/l*99.6%
unpow299.6%
Simplified99.7%
Taylor expanded in kx around 0 56.7%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.0005) (fabs (sin th)) (if (<= (sin ky) 2e-146) (fabs (* th (/ ky (sin kx)))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.0005) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 2e-146) {
tmp = fabs((th * (ky / sin(kx))));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.0005d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 2d-146) then
tmp = abs((th * (ky / sin(kx))))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.0005) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 2e-146) {
tmp = Math.abs((th * (ky / Math.sin(kx))));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.0005: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 2e-146: tmp = math.fabs((th * (ky / math.sin(kx)))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.0005) tmp = abs(sin(th)); elseif (sin(ky) <= 2e-146) tmp = abs(Float64(th * Float64(ky / sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.0005) tmp = abs(sin(th)); elseif (sin(ky) <= 2e-146) tmp = abs((th * (ky / sin(kx)))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.0005], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-146], N[Abs[N[(th * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.0005:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-146}:\\
\;\;\;\;\left|th \cdot \frac{ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -5.0000000000000001e-4Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.5%
associate-/l*99.4%
unpow299.4%
Simplified99.5%
Taylor expanded in kx around 0 2.6%
add-sqr-sqrt0.9%
sqrt-unprod28.8%
pow228.8%
Applied egg-rr28.8%
unpow228.8%
rem-sqrt-square35.4%
associate-*r/35.5%
*-rgt-identity35.5%
times-frac35.5%
/-rgt-identity35.5%
*-inverses35.5%
*-lft-identity35.5%
Simplified35.5%
if -5.0000000000000001e-4 < (sin.f64 ky) < 2.00000000000000005e-146Initial program 81.3%
+-commutative81.3%
unpow281.3%
unpow281.3%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in th around 0 51.7%
Taylor expanded in ky around 0 28.9%
associate-/l*31.8%
Simplified31.8%
add-sqr-sqrt25.1%
sqrt-unprod24.7%
pow224.7%
Applied egg-rr24.7%
unpow224.7%
rem-sqrt-square32.5%
associate-*r/28.6%
*-commutative28.6%
associate-/l*32.6%
Simplified32.6%
if 2.00000000000000005e-146 < (sin.f64 ky) Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/98.7%
associate-/l*99.6%
unpow299.6%
Simplified99.7%
Taylor expanded in kx around 0 54.4%
(FPCore (kx ky th) :precision binary64 (if (<= ky 2.8e-5) (* (sin th) (/ (sin ky) (hypot ky (sin kx)))) (* (sin ky) (/ (sin th) (fabs (sin ky))))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 2.8e-5) {
tmp = sin(th) * (sin(ky) / hypot(ky, sin(kx)));
} else {
tmp = sin(ky) * (sin(th) / fabs(sin(ky)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 2.8e-5) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.hypot(ky, Math.sin(kx)));
} else {
tmp = Math.sin(ky) * (Math.sin(th) / Math.abs(Math.sin(ky)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 2.8e-5: tmp = math.sin(th) * (math.sin(ky) / math.hypot(ky, math.sin(kx))) else: tmp = math.sin(ky) * (math.sin(th) / math.fabs(math.sin(ky))) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 2.8e-5) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(ky, sin(kx)))); else tmp = Float64(sin(ky) * Float64(sin(th) / abs(sin(ky)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 2.8e-5) tmp = sin(th) * (sin(ky) / hypot(ky, sin(kx))); else tmp = sin(ky) * (sin(th) / abs(sin(ky))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 2.8e-5], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Abs[N[Sin[ky], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 2.8 \cdot 10^{-5}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\left|\sin ky\right|}\\
\end{array}
\end{array}
if ky < 2.79999999999999996e-5Initial program 90.2%
+-commutative90.2%
unpow290.2%
unpow290.2%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 67.4%
if 2.79999999999999996e-5 < ky Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.6%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 35.2%
add-sqr-sqrt34.0%
sqrt-prod60.7%
rem-sqrt-square60.7%
Applied egg-rr60.7%
Final simplification65.5%
(FPCore (kx ky th) :precision binary64 (if (<= ky 2.8e-5) (* (sin ky) (/ (sin th) (hypot ky (sin kx)))) (* (sin ky) (/ (sin th) (fabs (sin ky))))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 2.8e-5) {
tmp = sin(ky) * (sin(th) / hypot(ky, sin(kx)));
} else {
tmp = sin(ky) * (sin(th) / fabs(sin(ky)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 2.8e-5) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.hypot(ky, Math.sin(kx)));
} else {
tmp = Math.sin(ky) * (Math.sin(th) / Math.abs(Math.sin(ky)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 2.8e-5: tmp = math.sin(ky) * (math.sin(th) / math.hypot(ky, math.sin(kx))) else: tmp = math.sin(ky) * (math.sin(th) / math.fabs(math.sin(ky))) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 2.8e-5) tmp = Float64(sin(ky) * Float64(sin(th) / hypot(ky, sin(kx)))); else tmp = Float64(sin(ky) * Float64(sin(th) / abs(sin(ky)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 2.8e-5) tmp = sin(ky) * (sin(th) / hypot(ky, sin(kx))); else tmp = sin(ky) * (sin(th) / abs(sin(ky))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 2.8e-5], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Abs[N[Sin[ky], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 2.8 \cdot 10^{-5}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\left|\sin ky\right|}\\
\end{array}
\end{array}
if ky < 2.79999999999999996e-5Initial program 90.2%
unpow290.2%
sqr-neg90.2%
sin-neg90.2%
sin-neg90.2%
unpow290.2%
associate-*l/88.0%
associate-/l*90.1%
unpow290.1%
Simplified99.5%
Taylor expanded in ky around 0 67.3%
if 2.79999999999999996e-5 < ky Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.6%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 35.2%
add-sqr-sqrt34.0%
sqrt-prod60.7%
rem-sqrt-square60.7%
Applied egg-rr60.7%
(FPCore (kx ky th) :precision binary64 (if (<= kx 4.2e-30) (* (sin ky) (/ (sin th) (fabs (sin ky)))) (* (sin ky) (/ (sin th) (fabs (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 4.2e-30) {
tmp = sin(ky) * (sin(th) / fabs(sin(ky)));
} else {
tmp = sin(ky) * (sin(th) / fabs(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 <= 4.2d-30) then
tmp = sin(ky) * (sin(th) / abs(sin(ky)))
else
tmp = sin(ky) * (sin(th) / abs(sin(kx)))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 4.2e-30) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.abs(Math.sin(ky)));
} else {
tmp = Math.sin(ky) * (Math.sin(th) / Math.abs(Math.sin(kx)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 4.2e-30: tmp = math.sin(ky) * (math.sin(th) / math.fabs(math.sin(ky))) else: tmp = math.sin(ky) * (math.sin(th) / math.fabs(math.sin(kx))) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 4.2e-30) tmp = Float64(sin(ky) * Float64(sin(th) / abs(sin(ky)))); else tmp = Float64(sin(ky) * Float64(sin(th) / abs(sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 4.2e-30) tmp = sin(ky) * (sin(th) / abs(sin(ky))); else tmp = sin(ky) * (sin(th) / abs(sin(kx))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 4.2e-30], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Abs[N[Sin[ky], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 4.2 \cdot 10^{-30}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\left|\sin ky\right|}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\left|\sin kx\right|}\\
\end{array}
\end{array}
if kx < 4.2000000000000004e-30Initial program 90.4%
unpow290.4%
sqr-neg90.4%
sin-neg90.4%
sin-neg90.4%
unpow290.4%
associate-*l/88.2%
associate-/l*90.2%
unpow290.2%
Simplified99.6%
Taylor expanded in kx around 0 29.7%
add-sqr-sqrt28.1%
sqrt-prod51.3%
rem-sqrt-square54.8%
Applied egg-rr54.8%
if 4.2000000000000004e-30 < kx Initial program 99.4%
unpow299.4%
sqr-neg99.4%
sin-neg99.4%
sin-neg99.4%
unpow299.4%
associate-*l/99.3%
associate-/l*99.3%
unpow299.3%
Simplified99.4%
Taylor expanded in ky around 0 30.7%
add-sqr-sqrt27.0%
sqrt-unprod56.3%
pow256.3%
Applied egg-rr56.3%
unpow256.3%
rem-sqrt-square56.3%
Simplified56.3%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.0005) (fabs (sin th)) (if (<= (sin ky) 2e-146) (* th (/ ky (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.0005) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 2e-146) {
tmp = th * (ky / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.0005d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 2d-146) then
tmp = th * (ky / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.0005) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 2e-146) {
tmp = th * (ky / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.0005: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 2e-146: tmp = th * (ky / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.0005) tmp = abs(sin(th)); elseif (sin(ky) <= 2e-146) tmp = Float64(th * Float64(ky / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.0005) tmp = abs(sin(th)); elseif (sin(ky) <= 2e-146) tmp = th * (ky / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.0005], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-146], N[(th * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.0005:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-146}:\\
\;\;\;\;th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -5.0000000000000001e-4Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.5%
associate-/l*99.4%
unpow299.4%
Simplified99.5%
Taylor expanded in kx around 0 2.6%
add-sqr-sqrt0.9%
sqrt-unprod28.8%
pow228.8%
Applied egg-rr28.8%
unpow228.8%
rem-sqrt-square35.4%
associate-*r/35.5%
*-rgt-identity35.5%
times-frac35.5%
/-rgt-identity35.5%
*-inverses35.5%
*-lft-identity35.5%
Simplified35.5%
if -5.0000000000000001e-4 < (sin.f64 ky) < 2.00000000000000005e-146Initial program 81.3%
+-commutative81.3%
unpow281.3%
unpow281.3%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in th around 0 51.7%
Taylor expanded in ky around 0 31.9%
if 2.00000000000000005e-146 < (sin.f64 ky) Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/98.7%
associate-/l*99.6%
unpow299.6%
Simplified99.7%
Taylor expanded in kx around 0 54.4%
Final simplification41.1%
(FPCore (kx ky th) :precision binary64 (if (<= ky 1.95e-145) (* th (/ ky (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 1.95e-145) {
tmp = 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 (ky <= 1.95d-145) then
tmp = 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 (ky <= 1.95e-145) {
tmp = th * (ky / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 1.95e-145: tmp = th * (ky / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 1.95e-145) tmp = Float64(th * Float64(ky / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 1.95e-145) tmp = th * (ky / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 1.95e-145], N[(th * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 1.95 \cdot 10^{-145}:\\
\;\;\;\;th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 1.95000000000000015e-145Initial program 88.7%
+-commutative88.7%
unpow288.7%
unpow288.7%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in th around 0 51.9%
Taylor expanded in ky around 0 20.2%
if 1.95000000000000015e-145 < ky Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/98.7%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 35.9%
Final simplification26.3%
(FPCore (kx ky th) :precision binary64 (if (<= ky 3.1e-146) (* ky (/ th (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 3.1e-146) {
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 (ky <= 3.1d-146) 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 (ky <= 3.1e-146) {
tmp = ky * (th / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 3.1e-146: tmp = ky * (th / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 3.1e-146) 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 (ky <= 3.1e-146) tmp = ky * (th / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 3.1e-146], N[(ky * N[(th / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 3.1 \cdot 10^{-146}:\\
\;\;\;\;ky \cdot \frac{th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 3.0999999999999998e-146Initial program 88.7%
+-commutative88.7%
unpow288.7%
unpow288.7%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in th around 0 51.9%
Taylor expanded in ky around 0 18.4%
associate-/l*20.2%
Simplified20.2%
if 3.0999999999999998e-146 < ky Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/98.7%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 35.9%
(FPCore (kx ky th) :precision binary64 (if (<= ky 5.9e-186) (* ky (/ th kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 5.9e-186) {
tmp = ky * (th / kx);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= 5.9d-186) then
tmp = ky * (th / kx)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 5.9e-186) {
tmp = ky * (th / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 5.9e-186: tmp = ky * (th / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 5.9e-186) tmp = Float64(ky * Float64(th / kx)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 5.9e-186) tmp = ky * (th / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 5.9e-186], N[(ky * N[(th / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 5.9 \cdot 10^{-186}:\\
\;\;\;\;ky \cdot \frac{th}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 5.8999999999999999e-186Initial program 89.3%
+-commutative89.3%
unpow289.3%
unpow289.3%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in th around 0 52.2%
Taylor expanded in ky around 0 18.0%
associate-/l*19.9%
Simplified19.9%
Taylor expanded in kx around 0 15.4%
associate-/l*17.3%
Simplified17.3%
if 5.8999999999999999e-186 < ky Initial program 97.8%
unpow297.8%
sqr-neg97.8%
sin-neg97.8%
sin-neg97.8%
unpow297.8%
associate-*l/96.9%
associate-/l*97.8%
unpow297.8%
Simplified99.6%
Taylor expanded in kx around 0 35.1%
(FPCore (kx ky th) :precision binary64 (if (<= ky 1.45e-72) (* ky (/ th kx)) th))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 1.45e-72) {
tmp = ky * (th / kx);
} else {
tmp = th;
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= 1.45d-72) then
tmp = ky * (th / kx)
else
tmp = th
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 1.45e-72) {
tmp = ky * (th / kx);
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 1.45e-72: tmp = ky * (th / kx) else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 1.45e-72) tmp = Float64(ky * Float64(th / kx)); else tmp = th; end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 1.45e-72) tmp = ky * (th / kx); else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 1.45e-72], N[(ky * N[(th / kx), $MachinePrecision]), $MachinePrecision], th]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 1.45 \cdot 10^{-72}:\\
\;\;\;\;ky \cdot \frac{th}{kx}\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if ky < 1.44999999999999999e-72Initial program 89.5%
+-commutative89.5%
unpow289.5%
unpow289.5%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in th around 0 52.2%
Taylor expanded in ky around 0 18.5%
associate-/l*20.0%
Simplified20.0%
Taylor expanded in kx around 0 16.1%
associate-/l*17.6%
Simplified17.6%
if 1.44999999999999999e-72 < ky Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.6%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 37.7%
Taylor expanded in th around 0 23.9%
(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.9%
unpow292.9%
sqr-neg92.9%
sin-neg92.9%
sin-neg92.9%
unpow292.9%
associate-*l/91.3%
associate-/l*92.8%
unpow292.8%
Simplified99.6%
Taylor expanded in kx around 0 23.4%
Taylor expanded in th around 0 15.0%
herbie shell --seed 2024135
(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)))