
(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 18 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.3%
remove-double-neg92.3%
sin-neg92.3%
neg-mul-192.3%
*-commutative92.3%
associate-*l*92.3%
associate-*l/90.3%
associate-/r/90.3%
associate-*l/92.3%
associate-/r/92.2%
sin-neg92.2%
neg-mul-192.2%
associate-/r*92.2%
associate-/r/92.3%
Simplified99.7%
Final simplification99.7%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.01) (* (sin th) (/ (sin ky) (sin kx))) (if (<= (sin ky) 5e-35) (* (sin th) (/ ky (fabs (sin kx)))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.01) {
tmp = sin(th) * (sin(ky) / sin(kx));
} else if (sin(ky) <= 5e-35) {
tmp = sin(th) * (ky / fabs(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.01d0)) then
tmp = sin(th) * (sin(ky) / sin(kx))
else if (sin(ky) <= 5d-35) then
tmp = sin(th) * (ky / abs(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.01) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.sin(kx));
} else if (Math.sin(ky) <= 5e-35) {
tmp = Math.sin(th) * (ky / Math.abs(Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.01: tmp = math.sin(th) * (math.sin(ky) / math.sin(kx)) elif math.sin(ky) <= 5e-35: tmp = math.sin(th) * (ky / math.fabs(math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.01) tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); elseif (sin(ky) <= 5e-35) tmp = Float64(sin(th) * Float64(ky / abs(sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.01) tmp = sin(th) * (sin(ky) / sin(kx)); elseif (sin(ky) <= 5e-35) tmp = sin(th) * (ky / abs(sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.01], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-35], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.01:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-35}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\left|\sin kx\right|}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0100000000000000002Initial program 99.6%
Taylor expanded in ky around 0 7.8%
if -0.0100000000000000002 < (sin.f64 ky) < 4.99999999999999964e-35Initial program 83.2%
Taylor expanded in ky around 0 49.9%
associate-/l*54.7%
associate-/r/54.7%
Simplified54.7%
add-sqr-sqrt45.0%
sqrt-prod75.0%
rem-sqrt-square82.6%
Applied egg-rr82.6%
if 4.99999999999999964e-35 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 63.8%
Final simplification57.8%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 1e-303) (* (sin ky) (/ (sin th) (sin kx))) (if (<= (sin ky) 5e-35) (* (sin th) (/ ky (fabs (sin kx)))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 1e-303) {
tmp = sin(ky) * (sin(th) / sin(kx));
} else if (sin(ky) <= 5e-35) {
tmp = sin(th) * (ky / fabs(sin(kx)));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= 1d-303) then
tmp = sin(ky) * (sin(th) / sin(kx))
else if (sin(ky) <= 5d-35) then
tmp = sin(th) * (ky / abs(sin(kx)))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= 1e-303) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
} else if (Math.sin(ky) <= 5e-35) {
tmp = Math.sin(th) * (ky / Math.abs(Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 1e-303: tmp = math.sin(ky) * (math.sin(th) / math.sin(kx)) elif math.sin(ky) <= 5e-35: tmp = math.sin(th) * (ky / math.fabs(math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 1e-303) tmp = Float64(sin(ky) * Float64(sin(th) / sin(kx))); elseif (sin(ky) <= 5e-35) tmp = Float64(sin(th) * Float64(ky / abs(sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= 1e-303) tmp = sin(ky) * (sin(th) / sin(kx)); elseif (sin(ky) <= 5e-35) tmp = sin(th) * (ky / abs(sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-303], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-35], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 10^{-303}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-35}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\left|\sin kx\right|}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 9.99999999999999931e-304Initial program 88.7%
*-commutative88.7%
clear-num88.6%
un-div-inv88.7%
unpow288.7%
unpow288.7%
hypot-def99.6%
Applied egg-rr99.6%
associate-/r/99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 30.2%
if 9.99999999999999931e-304 < (sin.f64 ky) < 4.99999999999999964e-35Initial program 90.4%
Taylor expanded in ky around 0 52.1%
associate-/l*55.4%
associate-/r/55.4%
Simplified55.4%
add-sqr-sqrt51.2%
sqrt-prod84.1%
rem-sqrt-square89.1%
Applied egg-rr89.1%
if 4.99999999999999964e-35 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 63.8%
Final simplification52.3%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 1e-266) (/ (sin ky) (/ (sin kx) (sin th))) (if (<= (sin ky) 5e-35) (* (sin th) (/ ky (fabs (sin kx)))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 1e-266) {
tmp = sin(ky) / (sin(kx) / sin(th));
} else if (sin(ky) <= 5e-35) {
tmp = sin(th) * (ky / fabs(sin(kx)));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= 1d-266) then
tmp = sin(ky) / (sin(kx) / sin(th))
else if (sin(ky) <= 5d-35) then
tmp = sin(th) * (ky / abs(sin(kx)))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= 1e-266) {
tmp = Math.sin(ky) / (Math.sin(kx) / Math.sin(th));
} else if (Math.sin(ky) <= 5e-35) {
tmp = Math.sin(th) * (ky / Math.abs(Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 1e-266: tmp = math.sin(ky) / (math.sin(kx) / math.sin(th)) elif math.sin(ky) <= 5e-35: tmp = math.sin(th) * (ky / math.fabs(math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 1e-266) tmp = Float64(sin(ky) / Float64(sin(kx) / sin(th))); elseif (sin(ky) <= 5e-35) tmp = Float64(sin(th) * Float64(ky / abs(sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= 1e-266) tmp = sin(ky) / (sin(kx) / sin(th)); elseif (sin(ky) <= 5e-35) tmp = sin(th) * (ky / abs(sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-266], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-35], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 10^{-266}:\\
\;\;\;\;\frac{\sin ky}{\frac{\sin kx}{\sin th}}\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-35}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\left|\sin kx\right|}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 9.9999999999999998e-267Initial program 88.4%
Taylor expanded in ky around 0 32.1%
associate-*l/28.6%
associate-/l*32.1%
Applied egg-rr32.1%
if 9.9999999999999998e-267 < (sin.f64 ky) < 4.99999999999999964e-35Initial program 91.5%
Taylor expanded in ky around 0 50.9%
associate-/l*52.8%
associate-/r/52.8%
Simplified52.8%
add-sqr-sqrt48.3%
sqrt-prod84.5%
rem-sqrt-square88.1%
Applied egg-rr88.1%
if 4.99999999999999964e-35 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 63.8%
Final simplification51.9%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 5e-35) (* (sin th) (/ (sin ky) (fabs (sin kx)))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 5e-35) {
tmp = sin(th) * (sin(ky) / fabs(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-35) then
tmp = sin(th) * (sin(ky) / abs(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-35) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.abs(Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 5e-35: tmp = math.sin(th) * (math.sin(ky) / math.fabs(math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 5e-35) tmp = Float64(sin(th) * Float64(sin(ky) / abs(sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= 5e-35) tmp = sin(th) * (sin(ky) / abs(sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-35], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 5 \cdot 10^{-35}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\left|\sin kx\right|}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 4.99999999999999964e-35Initial program 89.2%
Taylor expanded in ky around 0 37.6%
add-sqr-sqrt29.1%
sqrt-prod48.7%
rem-sqrt-square53.6%
Applied egg-rr57.9%
if 4.99999999999999964e-35 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 63.8%
Final simplification59.6%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (/ (hypot (sin ky) (sin kx)) th)))
(t_2 (fabs (sin kx))))
(if (<= kx 70000.0)
(* (sin th) (/ (sin ky) (hypot (sin ky) kx)))
(if (<= kx 3.3e+102)
t_1
(if (<= kx 5.4e+141)
(/ (sin ky) (/ t_2 (sin th)))
(if (<= kx 9.5e+235) t_1 (* (sin th) (/ (sin ky) t_2))))))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / (hypot(sin(ky), sin(kx)) / th);
double t_2 = fabs(sin(kx));
double tmp;
if (kx <= 70000.0) {
tmp = sin(th) * (sin(ky) / hypot(sin(ky), kx));
} else if (kx <= 3.3e+102) {
tmp = t_1;
} else if (kx <= 5.4e+141) {
tmp = sin(ky) / (t_2 / sin(th));
} else if (kx <= 9.5e+235) {
tmp = t_1;
} else {
tmp = sin(th) * (sin(ky) / t_2);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(ky) / (Math.hypot(Math.sin(ky), Math.sin(kx)) / th);
double t_2 = Math.abs(Math.sin(kx));
double tmp;
if (kx <= 70000.0) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.hypot(Math.sin(ky), kx));
} else if (kx <= 3.3e+102) {
tmp = t_1;
} else if (kx <= 5.4e+141) {
tmp = Math.sin(ky) / (t_2 / Math.sin(th));
} else if (kx <= 9.5e+235) {
tmp = t_1;
} else {
tmp = Math.sin(th) * (Math.sin(ky) / t_2);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.sin(ky) / (math.hypot(math.sin(ky), math.sin(kx)) / th) t_2 = math.fabs(math.sin(kx)) tmp = 0 if kx <= 70000.0: tmp = math.sin(th) * (math.sin(ky) / math.hypot(math.sin(ky), kx)) elif kx <= 3.3e+102: tmp = t_1 elif kx <= 5.4e+141: tmp = math.sin(ky) / (t_2 / math.sin(th)) elif kx <= 9.5e+235: tmp = t_1 else: tmp = math.sin(th) * (math.sin(ky) / t_2) return tmp
function code(kx, ky, th) t_1 = Float64(sin(ky) / Float64(hypot(sin(ky), sin(kx)) / th)) t_2 = abs(sin(kx)) tmp = 0.0 if (kx <= 70000.0) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), kx))); elseif (kx <= 3.3e+102) tmp = t_1; elseif (kx <= 5.4e+141) tmp = Float64(sin(ky) / Float64(t_2 / sin(th))); elseif (kx <= 9.5e+235) tmp = t_1; else tmp = Float64(sin(th) * Float64(sin(ky) / t_2)); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = sin(ky) / (hypot(sin(ky), sin(kx)) / th); t_2 = abs(sin(kx)); tmp = 0.0; if (kx <= 70000.0) tmp = sin(th) * (sin(ky) / hypot(sin(ky), kx)); elseif (kx <= 3.3e+102) tmp = t_1; elseif (kx <= 5.4e+141) tmp = sin(ky) / (t_2 / sin(th)); elseif (kx <= 9.5e+235) tmp = t_1; else tmp = sin(th) * (sin(ky) / t_2); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[kx, 70000.0], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[kx, 3.3e+102], t$95$1, If[LessEqual[kx, 5.4e+141], N[(N[Sin[ky], $MachinePrecision] / N[(t$95$2 / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[kx, 9.5e+235], t$95$1, N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{th}}\\
t_2 := \left|\sin kx\right|\\
\mathbf{if}\;kx \leq 70000:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, kx\right)}\\
\mathbf{elif}\;kx \leq 3.3 \cdot 10^{+102}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;kx \leq 5.4 \cdot 10^{+141}:\\
\;\;\;\;\frac{\sin ky}{\frac{t_2}{\sin th}}\\
\mathbf{elif}\;kx \leq 9.5 \cdot 10^{+235}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{t_2}\\
\end{array}
\end{array}
if kx < 7e4Initial program 89.5%
remove-double-neg89.5%
sin-neg89.5%
neg-mul-189.5%
*-commutative89.5%
associate-*l*89.5%
associate-*l/86.7%
associate-/r/86.7%
associate-*l/89.5%
associate-/r/89.3%
sin-neg89.3%
neg-mul-189.3%
associate-/r*89.3%
associate-/r/89.5%
Simplified99.7%
Taylor expanded in kx around 0 74.4%
if 7e4 < kx < 3.29999999999999999e102 or 5.4000000000000002e141 < kx < 9.49999999999999966e235Initial program 99.5%
expm1-log1p-u99.5%
expm1-udef34.8%
Applied egg-rr34.8%
expm1-def99.5%
expm1-log1p99.5%
associate-/r/99.5%
hypot-def99.5%
unpow299.5%
unpow299.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.5%
Simplified99.5%
Taylor expanded in th around 0 68.6%
associate-*l/68.7%
unpow268.7%
unpow268.7%
hypot-def68.8%
*-lft-identity68.8%
hypot-def68.7%
unpow268.7%
unpow268.7%
+-commutative68.7%
unpow268.7%
unpow268.7%
hypot-def68.8%
Simplified68.8%
if 3.29999999999999999e102 < kx < 5.4000000000000002e141Initial program 99.6%
Taylor expanded in ky around 0 38.5%
associate-*l/38.6%
associate-/l*38.6%
Applied egg-rr38.6%
add-sqr-sqrt33.7%
sqrt-prod59.4%
rem-sqrt-square59.4%
Applied egg-rr65.4%
if 9.49999999999999966e235 < kx Initial program 99.5%
Taylor expanded in ky around 0 42.3%
add-sqr-sqrt25.0%
sqrt-prod63.4%
rem-sqrt-square63.4%
Applied egg-rr70.8%
Final simplification72.8%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (/ (hypot (sin ky) (sin kx)) th)))
(t_2 (fabs (sin kx))))
(if (<= kx 70000.0)
(* (sin th) (/ (sin ky) (hypot (sin ky) kx)))
(if (<= kx 6.6e+101)
t_1
(if (<= kx 2.5e+144)
(/ 1.0 (/ t_2 (* (sin ky) (sin th))))
(if (<= kx 4.4e+235) t_1 (* (sin th) (/ (sin ky) t_2))))))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / (hypot(sin(ky), sin(kx)) / th);
double t_2 = fabs(sin(kx));
double tmp;
if (kx <= 70000.0) {
tmp = sin(th) * (sin(ky) / hypot(sin(ky), kx));
} else if (kx <= 6.6e+101) {
tmp = t_1;
} else if (kx <= 2.5e+144) {
tmp = 1.0 / (t_2 / (sin(ky) * sin(th)));
} else if (kx <= 4.4e+235) {
tmp = t_1;
} else {
tmp = sin(th) * (sin(ky) / t_2);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(ky) / (Math.hypot(Math.sin(ky), Math.sin(kx)) / th);
double t_2 = Math.abs(Math.sin(kx));
double tmp;
if (kx <= 70000.0) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.hypot(Math.sin(ky), kx));
} else if (kx <= 6.6e+101) {
tmp = t_1;
} else if (kx <= 2.5e+144) {
tmp = 1.0 / (t_2 / (Math.sin(ky) * Math.sin(th)));
} else if (kx <= 4.4e+235) {
tmp = t_1;
} else {
tmp = Math.sin(th) * (Math.sin(ky) / t_2);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.sin(ky) / (math.hypot(math.sin(ky), math.sin(kx)) / th) t_2 = math.fabs(math.sin(kx)) tmp = 0 if kx <= 70000.0: tmp = math.sin(th) * (math.sin(ky) / math.hypot(math.sin(ky), kx)) elif kx <= 6.6e+101: tmp = t_1 elif kx <= 2.5e+144: tmp = 1.0 / (t_2 / (math.sin(ky) * math.sin(th))) elif kx <= 4.4e+235: tmp = t_1 else: tmp = math.sin(th) * (math.sin(ky) / t_2) return tmp
function code(kx, ky, th) t_1 = Float64(sin(ky) / Float64(hypot(sin(ky), sin(kx)) / th)) t_2 = abs(sin(kx)) tmp = 0.0 if (kx <= 70000.0) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), kx))); elseif (kx <= 6.6e+101) tmp = t_1; elseif (kx <= 2.5e+144) tmp = Float64(1.0 / Float64(t_2 / Float64(sin(ky) * sin(th)))); elseif (kx <= 4.4e+235) tmp = t_1; else tmp = Float64(sin(th) * Float64(sin(ky) / t_2)); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = sin(ky) / (hypot(sin(ky), sin(kx)) / th); t_2 = abs(sin(kx)); tmp = 0.0; if (kx <= 70000.0) tmp = sin(th) * (sin(ky) / hypot(sin(ky), kx)); elseif (kx <= 6.6e+101) tmp = t_1; elseif (kx <= 2.5e+144) tmp = 1.0 / (t_2 / (sin(ky) * sin(th))); elseif (kx <= 4.4e+235) tmp = t_1; else tmp = sin(th) * (sin(ky) / t_2); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[kx, 70000.0], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[kx, 6.6e+101], t$95$1, If[LessEqual[kx, 2.5e+144], N[(1.0 / N[(t$95$2 / N[(N[Sin[ky], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[kx, 4.4e+235], t$95$1, N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{th}}\\
t_2 := \left|\sin kx\right|\\
\mathbf{if}\;kx \leq 70000:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, kx\right)}\\
\mathbf{elif}\;kx \leq 6.6 \cdot 10^{+101}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;kx \leq 2.5 \cdot 10^{+144}:\\
\;\;\;\;\frac{1}{\frac{t_2}{\sin ky \cdot \sin th}}\\
\mathbf{elif}\;kx \leq 4.4 \cdot 10^{+235}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{t_2}\\
\end{array}
\end{array}
if kx < 7e4Initial program 89.5%
remove-double-neg89.5%
sin-neg89.5%
neg-mul-189.5%
*-commutative89.5%
associate-*l*89.5%
associate-*l/86.7%
associate-/r/86.7%
associate-*l/89.5%
associate-/r/89.3%
sin-neg89.3%
neg-mul-189.3%
associate-/r*89.3%
associate-/r/89.5%
Simplified99.7%
Taylor expanded in kx around 0 74.4%
if 7e4 < kx < 6.60000000000000022e101 or 2.5e144 < kx < 4.4e235Initial program 99.5%
expm1-log1p-u99.5%
expm1-udef34.8%
Applied egg-rr34.8%
expm1-def99.5%
expm1-log1p99.5%
associate-/r/99.5%
hypot-def99.5%
unpow299.5%
unpow299.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.5%
Simplified99.5%
Taylor expanded in th around 0 68.6%
associate-*l/68.7%
unpow268.7%
unpow268.7%
hypot-def68.8%
*-lft-identity68.8%
hypot-def68.7%
unpow268.7%
unpow268.7%
+-commutative68.7%
unpow268.7%
unpow268.7%
hypot-def68.8%
Simplified68.8%
if 6.60000000000000022e101 < kx < 2.5e144Initial program 99.6%
Taylor expanded in ky around 0 38.5%
associate-*l/38.6%
clear-num38.3%
Applied egg-rr38.3%
add-sqr-sqrt33.7%
sqrt-prod59.4%
rem-sqrt-square59.4%
Applied egg-rr65.2%
if 4.4e235 < kx Initial program 99.5%
Taylor expanded in ky around 0 42.3%
add-sqr-sqrt25.0%
sqrt-prod63.4%
rem-sqrt-square63.4%
Applied egg-rr70.8%
Final simplification72.8%
(FPCore (kx ky th) :precision binary64 (if (<= kx 0.0145) (* (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.0145) {
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.0145) {
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.0145: 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.0145) 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.0145) 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.0145], 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.0145:\\
\;\;\;\;\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 < 0.0145000000000000007Initial program 89.5%
remove-double-neg89.5%
sin-neg89.5%
neg-mul-189.5%
*-commutative89.5%
associate-*l*89.5%
associate-*l/86.7%
associate-/r/86.7%
associate-*l/89.5%
associate-/r/89.3%
sin-neg89.3%
neg-mul-189.3%
associate-/r*89.3%
associate-/r/89.5%
Simplified99.7%
Taylor expanded in kx around 0 74.4%
if 0.0145000000000000007 < kx Initial program 99.5%
Taylor expanded in ky around 0 37.8%
add-sqr-sqrt26.9%
sqrt-prod50.2%
rem-sqrt-square50.2%
Applied egg-rr59.0%
Final simplification70.1%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 1e-51) (* (sin ky) (/ (sin th) kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 1e-51) {
tmp = sin(ky) * (sin(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 (sin(ky) <= 1d-51) then
tmp = sin(ky) * (sin(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 (Math.sin(ky) <= 1e-51) {
tmp = Math.sin(ky) * (Math.sin(th) / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 1e-51: tmp = math.sin(ky) * (math.sin(th) / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 1e-51) tmp = Float64(sin(ky) * Float64(sin(th) / kx)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= 1e-51) tmp = sin(ky) * (sin(th) / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-51], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 10^{-51}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 1e-51Initial program 89.0%
Taylor expanded in ky around 0 37.3%
associate-*l/34.2%
clear-num34.1%
Applied egg-rr34.1%
Taylor expanded in kx around 0 25.4%
associate-*r/28.5%
Simplified28.5%
if 1e-51 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 60.9%
Final simplification38.5%
(FPCore (kx ky th) :precision binary64 (if (<= ky 7e-32) (* (sin th) (/ ky (fabs (sin kx)))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 7e-32) {
tmp = sin(th) * (ky / fabs(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 <= 7d-32) then
tmp = sin(th) * (ky / abs(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 <= 7e-32) {
tmp = Math.sin(th) * (ky / Math.abs(Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 7e-32: tmp = math.sin(th) * (ky / math.fabs(math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 7e-32) tmp = Float64(sin(th) * Float64(ky / abs(sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 7e-32) tmp = sin(th) * (ky / abs(sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 7e-32], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 7 \cdot 10^{-32}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\left|\sin kx\right|}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 6.9999999999999997e-32Initial program 88.9%
Taylor expanded in ky around 0 33.6%
associate-/l*36.8%
associate-/r/36.7%
Simplified36.7%
add-sqr-sqrt29.9%
sqrt-prod50.0%
rem-sqrt-square54.9%
Applied egg-rr54.9%
if 6.9999999999999997e-32 < ky Initial program 99.8%
Taylor expanded in kx around 0 32.6%
Final simplification47.9%
(FPCore (kx ky th) :precision binary64 (if (<= ky 3.1e-35) (* (sin th) (/ ky (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 3.1e-35) {
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 (ky <= 3.1d-35) 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 (ky <= 3.1e-35) {
tmp = Math.sin(th) * (ky / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 3.1e-35: tmp = math.sin(th) * (ky / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 3.1e-35) 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 (ky <= 3.1e-35) tmp = sin(th) * (ky / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 3.1e-35], 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}\;ky \leq 3.1 \cdot 10^{-35}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 3.10000000000000012e-35Initial program 88.8%
Taylor expanded in ky around 0 33.8%
associate-/l*37.0%
associate-/r/36.9%
Simplified36.9%
if 3.10000000000000012e-35 < ky Initial program 99.7%
Taylor expanded in kx around 0 32.3%
Final simplification35.5%
(FPCore (kx ky th) :precision binary64 (if (<= ky 8e-36) (/ ky (/ (sin kx) (sin th))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 8e-36) {
tmp = ky / (sin(kx) / sin(th));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= 8d-36) then
tmp = ky / (sin(kx) / sin(th))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 8e-36) {
tmp = ky / (Math.sin(kx) / Math.sin(th));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 8e-36: tmp = ky / (math.sin(kx) / math.sin(th)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 8e-36) tmp = Float64(ky / Float64(sin(kx) / sin(th))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 8e-36) tmp = ky / (sin(kx) / sin(th)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 8e-36], N[(ky / N[(N[Sin[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 8 \cdot 10^{-36}:\\
\;\;\;\;\frac{ky}{\frac{\sin kx}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 7.9999999999999995e-36Initial program 88.8%
Taylor expanded in ky around 0 33.8%
associate-/l*37.0%
Simplified37.0%
if 7.9999999999999995e-36 < ky Initial program 99.7%
Taylor expanded in kx around 0 32.3%
Final simplification35.5%
(FPCore (kx ky th) :precision binary64 (if (<= ky 8.6e-36) (/ (sin th) (/ (sin kx) ky)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 8.6e-36) {
tmp = sin(th) / (sin(kx) / ky);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= 8.6d-36) then
tmp = sin(th) / (sin(kx) / ky)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 8.6e-36) {
tmp = Math.sin(th) / (Math.sin(kx) / ky);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 8.6e-36: tmp = math.sin(th) / (math.sin(kx) / ky) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 8.6e-36) tmp = Float64(sin(th) / Float64(sin(kx) / ky)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 8.6e-36) tmp = sin(th) / (sin(kx) / ky); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 8.6e-36], N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 8.6 \cdot 10^{-36}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 8.6000000000000004e-36Initial program 88.8%
*-commutative88.8%
clear-num88.8%
un-div-inv88.9%
unpow288.9%
unpow288.9%
hypot-def99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 37.0%
if 8.6000000000000004e-36 < ky Initial program 99.7%
Taylor expanded in kx around 0 32.3%
Final simplification35.5%
(FPCore (kx ky th) :precision binary64 (if (<= ky 9.5e-52) (* (sin th) (/ ky kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 9.5e-52) {
tmp = sin(th) * (ky / kx);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= 9.5d-52) then
tmp = sin(th) * (ky / kx)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 9.5e-52) {
tmp = Math.sin(th) * (ky / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 9.5e-52: tmp = math.sin(th) * (ky / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 9.5e-52) tmp = Float64(sin(th) * Float64(ky / kx)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 9.5e-52) tmp = sin(th) * (ky / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 9.5e-52], N[(N[Sin[th], $MachinePrecision] * N[(ky / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 9.5 \cdot 10^{-52}:\\
\;\;\;\;\sin th \cdot \frac{ky}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 9.50000000000000007e-52Initial program 88.7%
Taylor expanded in ky around 0 33.2%
associate-/l*36.4%
associate-/r/36.4%
Simplified36.4%
Taylor expanded in kx around 0 28.8%
if 9.50000000000000007e-52 < ky Initial program 99.7%
Taylor expanded in kx around 0 31.4%
Final simplification29.7%
(FPCore (kx ky th) :precision binary64 (if (<= ky 6.8e-52) (* ky (/ (sin th) kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 6.8e-52) {
tmp = ky * (sin(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 <= 6.8d-52) then
tmp = ky * (sin(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 <= 6.8e-52) {
tmp = ky * (Math.sin(th) / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 6.8e-52: tmp = ky * (math.sin(th) / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 6.8e-52) tmp = Float64(ky * Float64(sin(th) / kx)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 6.8e-52) tmp = ky * (sin(th) / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 6.8e-52], N[(ky * N[(N[Sin[th], $MachinePrecision] / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 6.8 \cdot 10^{-52}:\\
\;\;\;\;ky \cdot \frac{\sin th}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 6.80000000000000035e-52Initial program 88.7%
Taylor expanded in ky around 0 33.2%
associate-/l*36.4%
associate-/r/36.4%
Simplified36.4%
Taylor expanded in kx around 0 28.8%
*-commutative28.8%
clear-num28.8%
un-div-inv28.8%
Applied egg-rr28.8%
associate-/r/28.8%
Simplified28.8%
if 6.80000000000000035e-52 < ky Initial program 99.7%
Taylor expanded in kx around 0 31.4%
Final simplification29.6%
(FPCore (kx ky th) :precision binary64 (if (<= ky 6.8e-52) (/ ky (/ kx (sin th))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 6.8e-52) {
tmp = ky / (kx / sin(th));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= 6.8d-52) then
tmp = ky / (kx / sin(th))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 6.8e-52) {
tmp = ky / (kx / Math.sin(th));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 6.8e-52: tmp = ky / (kx / math.sin(th)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 6.8e-52) tmp = Float64(ky / Float64(kx / sin(th))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 6.8e-52) tmp = ky / (kx / sin(th)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 6.8e-52], N[(ky / N[(kx / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 6.8 \cdot 10^{-52}:\\
\;\;\;\;\frac{ky}{\frac{kx}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 6.80000000000000035e-52Initial program 88.7%
Taylor expanded in ky around 0 33.2%
associate-/l*36.4%
associate-/r/36.4%
Simplified36.4%
Taylor expanded in kx around 0 25.6%
associate-/l*28.8%
Simplified28.8%
if 6.80000000000000035e-52 < ky Initial program 99.7%
Taylor expanded in kx around 0 31.4%
Final simplification29.6%
(FPCore (kx ky th) :precision binary64 (if (<= ky 4.5e-107) (/ ky (/ kx th)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 4.5e-107) {
tmp = ky / (kx / th);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= 4.5d-107) then
tmp = ky / (kx / th)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 4.5e-107) {
tmp = ky / (kx / th);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 4.5e-107: tmp = ky / (kx / th) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 4.5e-107) tmp = Float64(ky / Float64(kx / th)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 4.5e-107) tmp = ky / (kx / th); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 4.5e-107], N[(ky / N[(kx / th), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 4.5 \cdot 10^{-107}:\\
\;\;\;\;\frac{ky}{\frac{kx}{th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 4.50000000000000016e-107Initial program 87.6%
Taylor expanded in ky around 0 31.7%
associate-/l*34.7%
associate-/r/34.7%
Simplified34.7%
Taylor expanded in kx around 0 28.7%
Taylor expanded in th around 0 20.6%
associate-/l*23.5%
Simplified23.5%
if 4.50000000000000016e-107 < ky Initial program 99.7%
Taylor expanded in kx around 0 29.6%
Final simplification25.8%
(FPCore (kx ky th) :precision binary64 (/ ky (/ kx th)))
double code(double kx, double ky, double th) {
return ky / (kx / th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = ky / (kx / th)
end function
public static double code(double kx, double ky, double th) {
return ky / (kx / th);
}
def code(kx, ky, th): return ky / (kx / th)
function code(kx, ky, th) return Float64(ky / Float64(kx / th)) end
function tmp = code(kx, ky, th) tmp = ky / (kx / th); end
code[kx_, ky_, th_] := N[(ky / N[(kx / th), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{ky}{\frac{kx}{th}}
\end{array}
Initial program 92.3%
Taylor expanded in ky around 0 24.1%
associate-/l*26.3%
associate-/r/26.2%
Simplified26.2%
Taylor expanded in kx around 0 20.6%
Taylor expanded in th around 0 14.9%
associate-/l*17.1%
Simplified17.1%
Final simplification17.1%
herbie shell --seed 2023314
(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)))